:root {
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --surface-2: #F1EFE8;
  --line: #E3E5E9;
  --line-strong: #CBD0D7;
  --text: #22262E;
  --muted: #6B7280;
  --faint: #99A0AA;
  --blue: #185FA5;
  --blue-soft: #E6F1FB;
  --blue-deep: #0C447C;
  --teal: #0F6E56;
  --teal-soft: #E1F5EE;
  --amber: #BA7517;
  --amber-soft: #FAEEDA;
  --red: #A32D2D;
  --red-soft: #FCEBEB;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 13px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: 13px; }
button { cursor: pointer; }

.topbar { height: 56px; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 18px; padding: 0 22px; position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 500; color: var(--blue-deep); white-space: nowrap; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--blue); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 500; }
.topbar .sep { width: 1px; height: 20px; background: var(--line); }
.topbar .grow { flex: 1; }
.topbar .meta { color: var(--muted); font-size: 12px; white-space: nowrap; }

.layout { display: flex; min-height: calc(100vh - 56px); }
.sidebar { width: 196px; flex: none; background: var(--surface); border-right: 1px solid var(--line); padding: 14px 10px; }
.sidebar .group-title { font-size: 11px; color: var(--faint); padding: 10px 12px 4px; letter-spacing: .04em; }
.sidebar a.nav-item { display: block; padding: 9px 12px; border-radius: 8px; color: var(--text); margin-bottom: 2px; }
.sidebar a.nav-item:hover { background: var(--bg); }
.sidebar a.nav-item.active { background: var(--blue-soft); color: var(--blue-deep); font-weight: 500; }
.main { flex: 1; min-width: 0; padding: 22px 26px 40px; }

.page-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 18px; font-weight: 500; margin: 0; }
.page-head .sub { color: var(--muted); font-size: 12px; }
.page-head .grow { flex: 1; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card.pad-0 { padding: 0; overflow: hidden; }
.card-title { font-size: 14px; font-weight: 500; margin: 0 0 14px; display: flex; align-items: center; gap: 10px; }
.card-title .grow { flex: 1; }
.card-title .hint { font-size: 12px; color: var(--muted); font-weight: 400; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px; }
.kpi .k-label { color: var(--muted); font-size: 12px; }
.kpi .k-value { font-size: 23px; font-weight: 500; margin-top: 5px; letter-spacing: -.02em; }
.kpi .k-foot { color: var(--faint); font-size: 11px; margin-top: 3px; }
.kpi.accent { border-color: #B5D4F4; background: var(--blue-soft); }
.kpi.accent .k-value { color: var(--blue-deep); }
.kpi.good .k-value { color: var(--teal); }
.kpi.warn .k-value { color: var(--amber); }
.kpi.bad .k-value { color: var(--red); }

.btn { border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); border-radius: 8px; padding: 7px 14px; font-weight: 400; }
.btn:hover { border-color: var(--blue); color: var(--blue); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-deep); border-color: var(--blue-deep); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { color: var(--red); border-color: #F0C9C9; background: var(--red-soft); }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 11px 20px; font-size: 14px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; line-height: 1.7; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.tag.blue { background: var(--blue-soft); color: var(--blue-deep); }
.tag.teal { background: var(--teal-soft); color: var(--teal); }
.tag.amber { background: var(--amber-soft); color: var(--amber); }
.tag.red { background: var(--red-soft); color: var(--red); }

table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { text-align: left; color: var(--muted); font-weight: 400; background: #FAFBFC; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #FAFBFC; }
.num, .mono { font-variant-numeric: tabular-nums; font-family: var(--font); }
.amount { font-variant-numeric: tabular-nums; font-weight: 500; }
.right { text-align: right; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.strong { font-weight: 500; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; color: var(--muted); }
input, select, textarea { border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); border-radius: 8px; padding: 8px 10px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }

.grid { display: grid; gap: 12px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); gap: 16px; align-items: start; }

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.bar-row .bar-label { width: 74px; color: var(--muted); font-size: 12px; flex: none; }
.bar-track { flex: 1; height: 9px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; background: var(--blue); border-radius: 6px; }
.bar-fill.teal { background: var(--teal); }
.bar-fill.amber { background: var(--amber); }
.bar-row .bar-val { width: 92px; text-align: right; font-variant-numeric: tabular-nums; flex: none; }

.chart { display: flex; align-items: flex-end; gap: 8px; height: 160px; padding-top: 8px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart .col .bar { width: 100%; max-width: 46px; background: var(--blue); border-radius: 5px 5px 0 0; min-height: 3px; }
.chart .col.today .bar { background: var(--teal); }
.chart .col .cap { font-size: 11px; color: var(--faint); white-space: nowrap; }
.chart .col .tip { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

.empty { padding: 34px 16px; text-align: center; color: var(--faint); }
.notice { padding: 11px 14px; border-radius: 8px; background: var(--amber-soft); color: #7A4D0A; font-size: 12px; margin-bottom: 14px; }
.notice.error { background: var(--red-soft); color: var(--red); }
.notice.ok { background: var(--teal-soft); color: var(--teal); }

.modal-mask { position: fixed; inset: 0; background: rgba(24, 30, 40, .42); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 20px; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 480px; max-height: 88vh; overflow: auto; padding: 20px; }
.modal.wide { max-width: 720px; }
.modal h2 { font-size: 15px; font-weight: 500; margin: 0 0 16px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.pay-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.pay-opt { border: 1px solid var(--line-strong); border-radius: 9px; padding: 13px 8px; text-align: center; background: var(--surface); }
.pay-opt:hover { border-color: var(--blue); }
.pay-opt.active { border-color: var(--blue); background: var(--blue-soft); color: var(--blue-deep); font-weight: 500; }
.pay-opt .ico { font-size: 16px; margin-bottom: 3px; }

.receipt { background: #FFFDF7; border: 1px dashed var(--line-strong); padding: 18px; font-size: 12px; font-family: var(--font); }
.receipt h3 { text-align: center; font-size: 14px; font-weight: 500; margin: 0 0 4px; }
.receipt .center { text-align: center; color: var(--muted); }
.receipt .line { border-top: 1px dashed var(--line-strong); margin: 11px 0; }
.receipt .row { display: flex; justify-content: space-between; margin: 4px 0; }

.pos-shell { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 14px; height: calc(100vh - 108px); min-height: 560px; }
.pos-left, .pos-right { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; overflow: hidden; }
.pos-head { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pos-head .grow { flex: 1; }
.pos-scroll { overflow: auto; padding: 14px; flex: 1; }
.cat-tabs { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 13px; }
.cat-tab { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 20px; padding: 5px 13px; font-size: 12px; }
.cat-tab.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.goods-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(126px, 1fr)); gap: 10px; }
.goods { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--surface); text-align: left; }
.goods:hover { border-color: var(--blue); background: var(--blue-soft); }
.goods .g-name { font-weight: 500; margin-bottom: 3px; }
.goods .g-price { color: var(--blue-deep); font-weight: 500; }
.goods .g-sub { color: var(--faint); font-size: 11px; }
.order-items { flex: 1; overflow: auto; }
.oi { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.oi .oi-name { flex: 1; }
.oi .stepper { display: flex; align-items: center; gap: 6px; }
.oi .stepper button { width: 24px; height: 24px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 6px; padding: 0; }
.pos-total { border-top: 1px solid var(--line); padding: 13px 14px; }
.pos-total .row { display: flex; justify-content: space-between; margin: 3px 0; }
.pos-total .grand { font-size: 22px; font-weight: 500; color: var(--blue-deep); }

.table-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 11px; }
.tbl { border: 1px solid var(--line); border-radius: 10px; padding: 13px; text-align: left; background: var(--surface); }
.tbl:hover { border-color: var(--blue); }
.tbl .t-code { font-size: 16px; font-weight: 500; }
.tbl .t-meta { color: var(--muted); font-size: 11px; }
.tbl.idle { background: var(--teal-soft); border-color: #9FE1CB; }
.tbl.dining { background: var(--blue-soft); border-color: #B5D4F4; }
.tbl.reserved { background: var(--amber-soft); border-color: #FAC775; }
.tbl.cleaning { background: var(--surface-2); }

.phone { width: 390px; max-width: 100%; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 26px; overflow: hidden; box-shadow: 0 2px 18px rgba(20,30,50,.06); }
.phone .p-status { height: 30px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; font-size: 11px; color: var(--muted); }
.phone .p-head { background: var(--blue); color: #fff; padding: 14px 18px; }
.phone .p-head h1 { font-size: 16px; font-weight: 500; margin: 0; }
.phone .p-head .sub { opacity: .85; font-size: 11px; }
.phone .p-body { padding: 16px; max-height: 560px; overflow: auto; }
.phone .p-tabs { display: flex; border-top: 1px solid var(--line); }
.phone .p-tabs div { flex: 1; text-align: center; padding: 10px 0; color: var(--faint); font-size: 11px; }
.phone .p-tabs div.active { color: var(--blue); }
.mini-kpi { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.mini-kpi .mk { background: var(--bg); border-radius: 10px; padding: 11px; }
.mini-kpi .mk .l { color: var(--muted); font-size: 11px; }
.mini-kpi .mk .v { font-size: 18px; font-weight: 500; }
.mini-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); }
.mini-row:last-child { border-bottom: none; }

.entry-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(238px, 1fr)); gap: 14px; }
.entry { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; color: var(--text); }
.entry:hover { border-color: var(--blue); transform: translateY(-1px); }
.entry .e-ico { width: 38px; height: 38px; border-radius: 10px; background: var(--blue-soft); color: var(--blue-deep); display: grid; place-items: center; font-size: 15px; font-weight: 500; margin-bottom: 12px; }
.entry.teal .e-ico { background: var(--teal-soft); color: var(--teal); }
.entry h3 { font-size: 14px; font-weight: 500; margin: 0 0 5px; }
.entry p { color: var(--muted); font-size: 12px; margin: 0 0 12px; }
.entry .e-foot { color: var(--blue); font-size: 12px; }

pre.code { background: #F7F8FA; border: 1px solid var(--line); border-radius: 8px; padding: 13px; overflow: auto; font-size: 11px; line-height: 1.7; color: #39404B; margin: 0; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }

@media (max-width: 960px) {
  .split { grid-template-columns: 1fr; }
  .pos-shell { grid-template-columns: 1fr; height: auto; }
  .sidebar { display: none; }
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- v3：二级菜单 / 完整时间表 / 轻重餐 / 打印机 ---- */
.nav-group { margin-bottom: 2px; }
.nav-group-head { display: flex; align-items: center; gap: 7px; padding: 8px 11px; border-radius: 8px; cursor: pointer; color: var(--text); font-size: 12.5px; font-weight: 500; user-select: none; }
.nav-group-head:hover { background: var(--bg); }
.nav-group-head .caret { margin-left: auto; color: var(--faint); font-size: 10px; transition: transform .15s; }
.nav-group.collapsed .caret { transform: rotate(-90deg); }
.nav-group.collapsed .nav-sub { display: none; }
.nav-group-head .g-ico { width: 18px; text-align: center; color: var(--blue); font-size: 12px; }
.nav-sub { padding: 2px 0 6px 12px; border-left: 1px solid var(--line); margin-left: 18px; }
.nav-sub a { display: block; padding: 6px 10px; border-radius: 7px; font-size: 12px; color: var(--muted); }
.nav-sub a:hover { background: var(--bg); color: var(--text); }
.nav-sub a.active { background: var(--blue-soft); color: var(--blue-deep); font-weight: 500; }

.time-strip { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; font-size: 12px; }
.time-strip .ts-item { color: var(--muted); }
.time-strip .ts-item b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.time-axis { display: grid; grid-template-columns: repeat(24, minmax(0,1fr)); gap: 3px; margin-top: 12px; }
.axis-cell { border-radius: 4px 4px 0 0; background: var(--surface-2); height: 48px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; padding-bottom: 3px; font-size: 9px; color: var(--faint); position: relative; }
.axis-cell .fill { position: absolute; bottom: 14px; left: 2px; right: 2px; background: var(--blue); border-radius: 3px 3px 0 0; min-height: 2px; }
.axis-cell.open { background: var(--teal-soft); }
.axis-cell.now { outline: 2px solid var(--amber); }
.axis-cell .lab { position: relative; z-index: 1; white-space: nowrap; }
.axis-legend { display: flex; gap: 14px; font-size: 11px; color: var(--faint); margin-top: 8px; }

.mode-switch { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 3px; }
.mode-switch button { border: none; background: transparent; padding: 5px 13px; border-radius: 7px; font-size: 12px; color: var(--muted); }
.mode-switch button.active { background: var(--surface); color: var(--blue-deep); font-weight: 500; box-shadow: 0 1px 3px rgba(20,30,50,.08); }
/* v5.27：账号登录后版本锁定，替换掉手动切换按钮 */
.mode-lock { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 9px; font-size: 11.5px; font-weight: 600; color: #8A5A12; background: #FFF7E8; border: 1px solid #F0DDB6; white-space: nowrap; }
.mode-lock .ml-no { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 10.5px; font-weight: 400; opacity: .8; }
.stage-bar { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.stage-bar .st { border: 1px solid var(--line-strong); border-radius: 20px; padding: 4px 11px; font-size: 11px; color: var(--faint); background: var(--surface); }
.stage-bar .st.done { background: var(--teal-soft); border-color: #9FE1CB; color: var(--teal); }
.stage-bar .st.now { background: var(--blue-soft); border-color: #B5D4F4; color: var(--blue-deep); font-weight: 500; }
.stage-bar .arrow { color: var(--faint); font-size: 11px; }

.receipt-preview { background: #FFFDF7; border: 1px dashed var(--line-strong); border-radius: 8px; padding: 14px; font-family: ui-monospace, Consolas, monospace; font-size: 11px; line-height: 1.55; white-space: pre; overflow: auto; max-height: 420px; color: #333; }
.bind-row { display: grid; grid-template-columns: 24px 1fr 108px 90px; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.bind-row:last-child { border-bottom: none; }
.printer-card { border: 1px solid var(--line); border-radius: 10px; padding: 13px; background: var(--surface); }
.printer-card .pc-name { font-weight: 500; margin-bottom: 4px; }
.printer-card .pc-meta { color: var(--muted); font-size: 11px; line-height: 1.6; }
.brand-chip { display: inline-block; padding: 2px 8px; border: 1px solid var(--line-strong); border-radius: 6px; font-size: 11px; color: var(--blue-deep); background: var(--blue-soft); margin: 0 5px 5px 0; }
.mini-tabs { display: flex; border-top: 1px solid var(--line); background: var(--surface); }
.mini-tabs div { flex: 1; text-align: center; padding: 11px 0; font-size: 11px; color: var(--faint); cursor: pointer; }
.mini-tabs div.active { color: var(--blue); font-weight: 500; border-top: 2px solid var(--blue); }
.device-frame { max-width: 100%; }
body.form-android .device-frame { max-width: 980px; margin: 0 auto; }
body.form-android .android-status { display: flex; }
.android-status { display: none; height: 28px; align-items: center; justify-content: space-between; padding: 0 16px; font-size: 11px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-bottom: none; border-radius: 12px 12px 0 0; }
body.form-windows .windows-titlebar { display: flex; }
.windows-titlebar { display: none; height: 28px; align-items: center; gap: 8px; padding: 0 14px; font-size: 11px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-bottom: none; border-radius: 10px 10px 0 0; }
.windows-titlebar .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.inline-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 9px; }
.flow-note { font-size: 11px; color: var(--muted); line-height: 1.7; }
