/* 开单系统 · 界面样式 */
:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f4f6fb;
  --card: #fff;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
button { font-family: inherit; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 18px;
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 10px 22px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: .5px; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, #2563eb, #4f8ef7); color: #fff; font-size: 15px; font-weight: 800;
}
.nav { display: flex; gap: 4px; margin-left: 8px; flex-wrap: wrap; }
.nav a {
  padding: 7px 14px; border-radius: 9px; color: #334155; font-size: 14px;
}
.nav a:hover { background: #eef2ff; }
.nav a.on { background: var(--blue); color: #fff; }
.spacer { flex: 1; }
.userbox { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: #dbeafe; color: #1d4ed8;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}

/* 布局 */
.wrap { max-width: 1280px; margin: 0 auto; padding: 18px 22px 60px; }
.page-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; margin: 0; font-weight: 700; }
.page-head .sub { color: var(--muted); font-size: 13px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 16px; }
.card h3 { margin: 0 0 12px; font-size: 15px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; min-width: 180px; }
.hint { color: var(--muted); font-size: 12px; }

/* 表单 */
label.f { display: block; font-size: 12.5px; color: var(--muted); margin: 0 0 4px; }
input[type=text], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 9px;
  font-family: inherit; font-size: 14px; color: var(--ink); background: #fff; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
textarea { resize: vertical; line-height: 1.7; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 760px) {
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
  .wrap { padding: 12px 12px 50px; }
  .topbar { padding: 8px 12px; gap: 8px; }
  .nav a { padding: 6px 10px; font-size: 13px; }
}

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 8px 16px; border-radius: 9px; border: 1px solid #cbd5e1; background: #fff;
  color: #334155; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: #f8fafc; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.danger { color: var(--red); border-color: #fecaca; background: #fff5f5; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 表格 */
table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th, table.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13.5px; vertical-align: middle; }
table.tbl th { color: var(--muted); font-weight: 600; font-size: 12.5px; background: #fafbfe; position: sticky; top: 0; }
table.tbl tbody tr:hover { background: #f8fafc; }
.tbl-wrap { overflow: auto; border-radius: 10px; border: 1px solid var(--line); }
.r { text-align: right; }
.c { text-align: center; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }

/* 明细表 */
table.items { width: 100%; border-collapse: collapse; table-layout: fixed; }
table.items th { font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 6px; border-bottom: 1px solid var(--line); text-align: left; }
table.items td { padding: 4px 4px; border-bottom: 1px solid #f1f5f9; }
table.items input { padding: 7px 8px; font-size: 13.5px; border-radius: 7px; }
table.items td.amt { text-align: right; padding-right: 8px; font-variant-numeric: tabular-nums; }
.col-no { width: 34px; text-align: center; color: var(--muted); font-size: 12px; }
.col-del { width: 34px; }
.del-row { border: none; background: transparent; color: #cbd5e1; cursor: pointer; font-size: 16px; line-height: 1; }
.del-row:hover { color: var(--red); }

/* 合计条 */
.totals { display: flex; justify-content: flex-end; align-items: center; gap: 26px; padding: 12px 6px; flex-wrap: wrap; }
.totals .item { text-align: right; }
.totals .item span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.totals .item b { font-size: 19px; font-variant-numeric: tabular-nums; }
.totals .item.big b { color: var(--blue-dark); font-size: 23px; }
.upper-line { text-align: right; font-size: 12.5px; color: #475569; padding: 0 6px 4px; }

/* 状态与标签 */
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; line-height: 20px; background: #eef2ff; color: #4338ca; }
.tag.draft { background: #f1f5f9; color: #475569; }
.tag.confirmed { background: #ecfdf5; color: #047857; }
.tag.done { background: #eff6ff; color: #1d4ed8; }
.tag.void { background: #fef2f2; color: #b91c1c; }
.tag.admin { background: #fff7ed; color: #c2410c; }

/* 空状态 */
.empty { text-align: center; color: var(--muted); padding: 46px 10px; font-size: 13.5px; }

/* 弹窗 */
.mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: none; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.mask.on { display: flex; }
.modal { background: #fff; border-radius: 14px; width: 520px; max-width: 100%; max-height: 88vh; overflow: auto; padding: 20px 22px; box-shadow: 0 20px 60px rgba(15, 23, 42, .3); }
.modal h3 { margin: 0 0 14px; font-size: 17px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* 提示 */
#toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px); background: #0f172a; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 13.5px; opacity: 0; transition: .22s; z-index: 99; pointer-events: none; }
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: #b91c1c; }

/* 登录页 */
.login-bg { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 20% 0%, #e0e9ff, #f4f6fb 60%); padding: 20px; }
.login-card { width: 380px; max-width: 100%; background: #fff; border-radius: 16px; padding: 32px 30px; box-shadow: 0 24px 60px rgba(15, 23, 42, .14); }
.login-card .brand { justify-content: center; font-size: 20px; margin-bottom: 4px; }
.login-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.login-card .form-row { margin-bottom: 14px; }
.login-err { color: var(--red); font-size: 13px; min-height: 18px; margin-top: 6px; text-align: center; }
