/* ============================================================
   飞镖俱乐部管理软件 · UI v2
   横向工作台：深色分组侧栏 + 浅色内容区 + 金色主色
   本文件只做外观覆盖，不改业务逻辑；如需回退，删除 index.html
   里的 ui-v2.css 引用即可恢复旧版样式。
   ============================================================ */
:root {
  --ui-bg: #f4f2ec;
  --ui-surface: #ffffff;
  --ui-surface-2: #faf9f5;
  --ui-ink: #1d1b17;
  --ui-muted: #6f6a60;
  --ui-line: #e6e1d6;
  --ui-line-strong: #d7d1c4;
  --ui-side: #101216;
  --ui-side-2: #171a20;
  --ui-side-ink: #e9e6df;
  --ui-side-muted: #9aa0aa;
  --ui-accent: #d9b26a;
  --ui-accent-ink: #2b1f08;
  --ui-accent-soft: rgba(217, 178, 106, .16);
  --ui-green: #1f8a52;
  --ui-green-soft: rgba(31, 138, 82, .13);
  --ui-amber: #b7791f;
  --ui-amber-soft: rgba(183, 121, 31, .14);
  --ui-red: #cf3f2f;
  --ui-red-soft: rgba(207, 63, 47, .13);
  --ui-blue: #2f5da8;
  --ui-blue-soft: rgba(47, 93, 168, .13);
  --ui-purple: #6b4fd0;
  --ui-purple-soft: rgba(107, 79, 208, .13);
  --ui-radius: 14px;
  --ui-radius-sm: 10px;
  --ui-shadow: 0 1px 2px rgba(20, 20, 20, .04);
  --ui-font: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}

body {
  background: var(--ui-bg);
  color: var(--ui-ink);
  font-family: var(--ui-font);
}

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #101216, #1d2129);
}
.login-card {
  width: 360px;
  max-width: 100%;
  padding: 34px 30px;
  border-radius: 18px;
  background: var(--ui-surface);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}
.login-logo {
  display: block;
  width: 76px;
  height: 76px;
  margin: 0 auto 14px;
  border-radius: 18px;
  object-fit: cover;
  box-shadow: 0 8px 20px rgba(15, 17, 21, .16);
}
.login-card h1 { font-size: 19px; text-align: center; }
.login-card .muted { text-align: center; }
.login-card input {
  width: 100%;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--ui-line-strong);
  border-radius: 9px;
  background: var(--ui-surface);
  color: var(--ui-ink);
}
.login-card .btn { margin-top: 16px; }

/* 登录卡片底部备案号：官网查询链接，样式低调不抢焦点 */
.login-beian {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--ui-line);
  text-align: center;
  font-size: 12px;
  color: var(--ui-muted);
}
.login-beian a {
  color: inherit;
  text-decoration: none;
}
.login-beian a:hover {
  color: var(--ui-accent);
  text-decoration: underline;
}

/* ---------- 工作台外壳 ---------- */
#main-view { min-height: 100vh; }
.app-shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
  background: var(--ui-bg);
}
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100vh;
  padding: 16px 12px 14px;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--ui-side), var(--ui-side-2));
  color: var(--ui-side-ink);
  border-right: 1px solid rgba(255, 255, 255, .06);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 6px 4px;
}
.sidebar-logo {
  display: block;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 12px;
  object-fit: cover;
  background: #fff;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .28);
}
.sidebar-brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.sidebar-brand-text b { font-size: 14px; letter-spacing: .06em; }
.sidebar-brand-text span {
  overflow: hidden;
  color: var(--ui-side-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 14px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-title {
  padding: 0 8px 4px;
  color: var(--ui-side-muted);
  font-size: 10px;
  letter-spacing: .14em;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 9px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ui-side-ink);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); }
.nav-item.active {
  background: var(--ui-accent-soft);
  color: var(--ui-accent);
  font-weight: 600;
}
.nav-icon {
  width: 18px;
  flex: none;
  font-size: 14px;
  text-align: center;
}
.sidebar-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .05);
  color: var(--ui-side-muted);
  font-size: 12px;
}
.sidebar-avatar { color: var(--ui-green); font-size: 11px; }

.main-area { display: flex; flex-direction: column; min-width: 0; }
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 18px;
  border-bottom: 1px solid var(--ui-line);
  background: var(--ui-surface);
}
.topbar-title { min-width: 0; }
.topbar-title h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.topbar-title span { color: var(--ui-muted); font-size: 11px; }
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}
.topbar-clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 0 6px;
  line-height: 1.2;
}
.topbar-clock b { font-size: 14px; font-variant-numeric: tabular-nums; }
.topbar-clock span { color: var(--ui-muted); font-size: 11px; }
.content {
  flex: 1;
  padding: 16px 18px 24px;
  background: var(--ui-bg);
}
.content > .view { padding: 0; }
#view-pos.active {
  display: grid;
  grid-template-columns: minmax(0, 2.05fr) minmax(300px, .85fr);
  grid-template-rows: auto auto auto auto;
  gap: 10px;
}

/* ---------- 通用控件覆盖 ---------- */
.panel {
  padding: 14px;
  margin-bottom: 12px;
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow);
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 600;
}
.panel-head .sub { color: var(--ui-muted); font-size: 11px; font-weight: 400; }
.row { gap: 10px; }
.field { margin-bottom: 10px; }
.field label, .field .label { color: var(--ui-muted); font-size: 12px; }
.input, .select, textarea.input {
  padding: 7px 9px;
  border: 1px solid var(--ui-line-strong);
  border-radius: 8px;
  background: var(--ui-surface);
  color: var(--ui-ink);
}
.input:focus, .select:focus, textarea.input:focus {
  outline: 2px solid var(--ui-accent-soft);
  border-color: var(--ui-accent);
}
.btn {
  padding: 7px 12px;
  border: 1px solid var(--ui-line-strong);
  border-radius: 8px;
  background: var(--ui-surface);
  color: var(--ui-ink);
}
.btn:hover { border-color: var(--ui-accent); }
.btn.primary {
  border-color: var(--ui-accent);
  background: var(--ui-accent);
  color: var(--ui-accent-ink);
  font-weight: 600;
}
.btn.ghost { border-color: transparent; background: transparent; color: var(--ui-muted); }
.btn.danger { color: var(--ui-red); border-color: rgba(207, 63, 47, .35); background: var(--ui-surface); }
.btn.small { padding: 4px 8px; font-size: 12px; }
.tabs { gap: 6px; }
.tab {
  padding: 6px 13px;
  border: 1px solid var(--ui-line);
  border-radius: 999px;
  background: var(--ui-surface);
  color: var(--ui-muted);
}
.tab.active { border-color: var(--ui-accent); background: var(--ui-accent); color: var(--ui-accent-ink); }
.amount-box {
  padding: 10px 12px;
  border: 1px solid var(--ui-line);
  border-radius: 11px;
  background: var(--ui-surface-2);
}
.amount-box b { color: var(--ui-accent); }
.badge { background: var(--ui-red); }
.pill {
  border-color: var(--ui-line-strong);
  background: var(--ui-surface);
  color: var(--ui-muted);
}
.pill.green { border-color: var(--ui-green); color: var(--ui-green); }
.pill.amber { border-color: var(--ui-amber); color: var(--ui-amber); }
.pill.blue { border-color: var(--ui-blue); color: var(--ui-blue); }
.pill.gray { border-color: var(--ui-line-strong); color: var(--ui-muted); }
.list li {
  padding: 9px 11px;
  border: 1px solid var(--ui-line);
  border-radius: 10px;
  background: var(--ui-surface-2);
}
.feed-item { border-bottom-color: var(--ui-line); }
.data { font-size: 13px; }
table.data th { color: var(--ui-muted); border-bottom-color: var(--ui-line); }
table.data td { border-bottom-color: var(--ui-line); }
table.data tr.clickable:hover td { background: var(--ui-accent-soft); }
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}
.stat {
  padding: 12px 14px;
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
}
.stat .label { color: var(--ui-muted); font-size: 12px; }
.stat .value { color: var(--ui-accent); font-size: 22px; }
.stat:first-child {
  border-color: rgba(217, 178, 106, .38);
  background: linear-gradient(135deg, var(--ui-accent-soft), var(--ui-surface));
}
.menu-grid { gap: 8px; }
.menu-item {
  border: 1px solid var(--ui-line);
  border-radius: 11px;
  background: var(--ui-surface-2);
}
.menu-item .price { color: var(--ui-red); }
.qty-btn { border-color: var(--ui-accent); color: var(--ui-accent); }
#view-sales .menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 6px;
}
#view-sales .menu-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 9px;
}
#view-sales .menu-item b {
  flex: 0 0 auto;
  max-width: 45%;
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#view-sales .menu-item .muted {
  flex: 1;
  min-width: 0;
  display: block;
  overflow: hidden;
  color: var(--ui-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#view-sales .menu-item .price { display: none; }
#view-sales .menu-item .foot { justify-content: flex-end; margin: 0; gap: 4px; }
#view-sales .menu-item .qty-btn { width: 24px; height: 24px; font-size: 13px; }
#view-sales .menu-item .qty-val { min-width: 20px; font-size: 12px; }
#cart-list { list-style: none; margin: 0; padding: 0; }
#cart-list li { list-style: none; }
.cart-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--ui-line);
}
.cart-row:last-child { border-bottom: 0; }
.cart-row .cart-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cart-row .cart-qty { display: flex; align-items: center; gap: 4px; }
.cart-row .cart-amount {
  min-width: 58px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.cart-row .qty-btn { width: 24px; height: 24px; font-size: 13px; }
.cart-row .qty-val { min-width: 20px; font-size: 12px; text-align: center; }
.cart-bar {
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
}
.modal { border-radius: var(--ui-radius); }
.modal-head, .modal-foot { border-color: var(--ui-line); }
.qr-box { border: 1px solid var(--ui-line); border-radius: 11px; background: var(--ui-surface-2); }

/* ---------- 收银台 ---------- */
#view-pos .pos-main-row,
#view-pos .pos-bottom-row { display: contents; }
#view-pos .pos-statusbar { grid-column: 1 / -1; }
#view-pos .pos-machine-panel { grid-column: 1; grid-row: 2; }
#view-pos .pos-open-panel { grid-column: 2; grid-row: 2 / span 3; }
#view-pos .pos-sessions-panel { grid-column: 1; grid-row: 3; }
#view-pos .pos-scan-panel { grid-column: 1; grid-row: 4; }
#view-pos .panel { margin-bottom: 0; }
#view-pos .grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
}
.machine {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 78px;
  padding: 7px;
  border: 1px solid var(--ui-line);
  border-radius: 10px;
  background: var(--ui-surface-2);
  text-align: left;
  color: var(--ui-ink);
}
.machine.free { border-color: rgba(31, 138, 82, .32); }
.machine.free.selectable:hover {
  border-color: var(--ui-green);
  background: var(--ui-surface);
  box-shadow: 0 0 0 3px var(--ui-green-soft);
}
.machine.busy { border-color: rgba(183, 121, 31, .34); background: var(--ui-amber-soft); color: var(--ui-amber); }
.machine.busy.timeup {
  border-color: rgba(207, 63, 47, .44);
  background: var(--ui-red-soft);
  color: var(--ui-red);
  animation: uiPulse 2.2s ease-in-out infinite;
}
.machine.busy.paused { border-color: rgba(47, 93, 168, .34); background: var(--ui-blue-soft); color: var(--ui-blue); }
.machine.maintenance { border-color: var(--ui-line-strong); color: var(--ui-muted); opacity: .68; }
.machine.event { border-color: rgba(107, 79, 208, .34); background: var(--ui-purple-soft); color: var(--ui-purple); }
.machine.staff { border-color: rgba(31, 138, 82, .40); background: var(--ui-green-soft); color: var(--ui-green); }
.machine.selected { outline: 2px solid var(--ui-accent); outline-offset: 1px; }
.machine-name { font-size: 11px; font-weight: 600; color: var(--ui-ink); }
.machine-time {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}
.machine-time small { font-size: 10px; font-weight: 500; margin-left: 2px; }
.machine-note {
  overflow: hidden;
  color: var(--ui-muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.machine .tag {
  top: 6px;
  right: 6px;
  padding: 1px 4px;
  border-radius: 999px;
  background: var(--ui-surface);
  color: var(--ui-muted);
  font-size: 9px;
}
.machine.busy .tag { background: var(--ui-surface); color: var(--ui-amber); }
.machine.busy.timeup .tag { background: var(--ui-surface); color: var(--ui-red); }
.machine.busy.paused .tag { background: var(--ui-surface); color: var(--ui-blue); }
.machine.event .tag { background: var(--ui-surface); color: var(--ui-purple); }
.machine.maintenance .tag { background: var(--ui-surface); color: var(--ui-muted); }
.machine.staff .tag { background: var(--ui-surface); color: var(--ui-green); }
.machine .set-status {
  top: 6px;
  left: 6px;
  z-index: 2;
  padding: 1px 5px;
  border-radius: 6px;
  background: rgba(0, 0, 0, .05);
  color: var(--ui-muted);
  font-size: 10px;
}
.machine .set-status + .machine-name { padding-left: 18px; }
.dur-presets { display: flex; gap: 6px; flex-wrap: wrap; }
@keyframes uiPulse {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  50% { box-shadow: 0 0 0 5px var(--ui-red-soft); }
}
@media (prefers-reduced-motion: reduce) {
  .machine.busy.timeup { animation: none; }
}
.pos-statusbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 12px;
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
}
.pos-statusbar .status-live {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
}
.pos-statusbar .status-live span:last-child { color: var(--ui-muted); font-size: 11px; }
.pos-statusbar .status-dot { color: var(--ui-green); font-size: 11px; }
.pos-statusbar .count-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--ui-surface-2);
  color: var(--ui-muted);
  font-size: 11px;
}
.pos-statusbar .count-chip b { color: var(--ui-ink); font-variant-numeric: tabular-nums; }
.pos-settle-bar {
  position: sticky;
  bottom: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border: 1px solid rgba(217, 178, 106, .42);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
  box-shadow: 0 -8px 24px rgba(15, 17, 21, .12);
}
.pos-settle-bar .settle-info { display: flex; flex-direction: column; gap: 2px; min-width: 180px; }
.pos-settle-bar .settle-kicker { color: var(--ui-muted); font-size: 11px; }
.pos-settle-bar .settle-info b { font-size: 13px; }
.pos-settle-bar .settle-amount {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-left: auto;
  color: var(--ui-muted);
  font-size: 12px;
}
.pos-settle-bar .settle-amount b {
  color: var(--ui-accent);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

/* ---------- 首页待办 ---------- */
.dash-todo {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.dash-todo-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
  color: var(--ui-ink);
  text-align: left;
  cursor: pointer;
}
.dash-todo-card:hover { border-color: var(--ui-accent); }
.dash-todo-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  font-size: 16px;
}
.dash-todo-card.danger .dash-todo-icon { background: var(--ui-red-soft); }
.dash-todo-card.amber .dash-todo-icon { background: var(--ui-amber-soft); }
.dash-todo-card.blue .dash-todo-icon { background: var(--ui-blue-soft); }
.dash-todo-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.dash-todo-count { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dash-todo-label { color: var(--ui-muted); font-size: 11px; }
.dash-main-grid {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
  gap: 10px;
  align-items: stretch;
}
.dash-main-grid > .panel { display: flex; flex-direction: column; }
#dash-monthly { flex: 1; }
.dash-cat-table td:first-child { color: var(--ui-muted); }
.dash-cat-table td:nth-child(2),
.dash-cat-table td:nth-child(3) { font-variant-numeric: tabular-nums; text-align: right; }
.dash-dart-total td {
  background: var(--ui-accent-soft);
  color: var(--ui-ink);
  font-weight: 600;
}
.dash-coffee-row td { color: var(--ui-muted); }
.dash-store-total td {
  border-top: 2px solid var(--ui-line-strong);
  font-weight: 600;
}
.dash-extra {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--ui-line);
  color: var(--ui-muted);
  font-size: 11px;
}

/* ---------- 设置页 LOGO 编辑 ---------- */
.logo-editor {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}
.logo-preview {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  flex: none;
  overflow: hidden;
  border: 1px solid var(--ui-line);
  border-radius: 16px;
  background: var(--ui-surface-2);
}
.logo-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.logo-editor-main { flex: 1; min-width: 0; }
.logo-editor-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.member-pick-list .feed-item {
  padding: 12px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--ui-line);
  border-radius: 10px;
  background: var(--ui-surface-2);
  font-size: 14px;
}
.member-pick-list .feed-item:hover { border-color: var(--ui-accent); }
.member-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}
.member-toolbar .input { flex: 1; min-width: 180px; max-width: 320px; }
.member-search-row { display: flex; align-items: center; gap: 8px; }
.member-search-row .input { flex: 1 1 auto; min-width: 0; }
.member-search-row .btn { flex: 0 0 auto; padding-left: 14px; padding-right: 14px; }
#view-schedule table.data td[data-sched] {
  min-width: 46px;
  height: 34px;
  padding: 2px;
  text-align: center;
}
#view-schedule table.data td[data-shift="早班"] { background: var(--ui-green-soft); }
#view-schedule table.data td[data-shift="晚班"] { background: var(--ui-amber-soft); }
#view-schedule table.data td[data-shift="全班"] { background: var(--ui-blue-soft); }
#view-schedule table.data td[data-shift="休"] { background: var(--ui-surface-2); }
#view-schedule table.data td[data-sched] .pill {
  border: 0;
  background: transparent;
  font-weight: 600;
}
#view-schedule table.data td[data-shift="休"] .pill {
  color: var(--ui-muted);
  font-weight: 400;
}
/* 团建订单：默认近30天，固定高度内部滚动，表头吸顶 */
#view-teambuilding .tb-scroll {
  max-height: 58vh;
  overflow: auto;
  border: 1px solid var(--ui-line);
  border-radius: 10px;
  background: var(--ui-surface);
}
#view-teambuilding .tb-scroll table.data { margin: 0; }
#view-teambuilding .tb-scroll table.data th { white-space: nowrap; }
#view-teambuilding .tb-scroll table.data td:last-child .btn,
#view-teambuilding .tb-scroll table.data .pill { white-space: nowrap; }
#view-teambuilding .tb-scroll table.data thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--ui-surface);
  box-shadow: inset 0 -1px 0 var(--ui-line);
}
#view-settings.active { display: block; }
.settings-subnav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 6px;
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
  position: sticky;
  top: 60px;
  z-index: 5;
}
.settings-subnav button {
  padding: 7px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ui-muted);
  font-size: 13px;
  cursor: pointer;
}
.settings-subnav button:hover { background: var(--ui-surface-2); color: var(--ui-ink); }
.settings-subnav button.active {
  background: var(--ui-accent);
  color: var(--ui-accent-ink);
  font-weight: 600;
}
.settings-group { display: none; }
.settings-group.active { display: block; }
.settings-group > .panel,
.settings-group > .row > .panel { margin-bottom: 0; }
.settings-group > .row { display: contents; }

/* ---------- 菜单管理弹窗：左分类 / 右商品 ---------- */
.modal.modal-wide {
  width: min(1180px, 96vw);
  height: min(880px, 92vh);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal.modal-wide .modal-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
}
.mm { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.mm-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border: 1px solid var(--ui-line);
  border-radius: 12px;
  background: var(--ui-surface-2);
}
.mm-top-label { font-size: 12px; font-weight: 600; color: var(--ui-muted); }
.mm-top .input { max-width: 210px; }
.mm-top-gap { flex: 1; }
.mm-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 212px minmax(0, 1fr);
  gap: 10px;
}
.mm-cats {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--ui-line);
  border-radius: 12px;
  background: var(--ui-surface-2);
}
.mm-cat-wrap { border-radius: 10px; }
.mm-cat {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--ui-ink);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.mm-cat:hover { background: var(--ui-surface); border-color: var(--ui-line); }
.mm-cat-wrap.active .mm-cat {
  border-color: var(--ui-accent);
  background: var(--ui-surface);
  font-weight: 600;
}
.mm-cat-wrap.active { background: var(--ui-accent-soft); }
.mm-cat-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.mm-cat-count {
  flex: none;
  padding: 0 6px;
  font-size: 11px;
  color: var(--ui-muted);
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-radius: 999px;
}
.mm-cat-tools { display: flex; flex-wrap: wrap; gap: 4px; padding: 2px 6px 6px; }
.mm-cat-edit { display: flex; gap: 4px; padding: 4px; }
.mm-cat-edit .input { flex: 1; min-width: 0; }
.mm-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--ui-line);
  border-radius: 12px;
  background: var(--ui-surface);
  overflow: hidden;
}
.mm-main-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-bottom: 1px solid var(--ui-line);
  background: var(--ui-surface-2);
}
.mm-main-title { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.mm-main-title b { font-size: 14px; overflow-wrap: anywhere; }
.mm-main-title .sub { font-size: 11px; color: var(--ui-muted); overflow-wrap: anywhere; }
.mm-main-head #mm-search { margin-left: auto; max-width: 190px; }
.mm-scroll { flex: 1; min-height: 0; overflow: auto; }
.mm-tip {
  margin: 10px 12px 0;
  padding: 6px 9px;
  border-radius: 8px;
  background: var(--ui-surface-2);
  color: var(--ui-muted);
  font-size: 12px;
}
#mm-grid-box { padding: 10px 12px 14px; }
.mm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.mm-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--ui-line);
  border-radius: 12px;
  background: var(--ui-surface);
  color: var(--ui-ink);
  text-align: left;
  cursor: pointer;
}
.mm-card:hover { border-color: var(--ui-accent); box-shadow: 0 3px 12px rgba(0, 0, 0, .07); }
.mm-card-img { display: block; height: 84px; overflow: hidden; border-radius: 9px; background: var(--ui-surface-2); }
.mm-card-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mm-card-name { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.mm-card-spec { font-size: 11px; color: var(--ui-muted); overflow-wrap: anywhere; }
.mm-card-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.mm-card-foot b { font-size: 14px; color: var(--ui-red); }
.mm-card-foot em { font-style: normal; font-size: 11px; color: var(--ui-muted); }
.mm-card-opt {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  color: var(--ui-muted);
  background: var(--ui-surface-2);
  border: 1px solid var(--ui-line);
}
.mm-card-opt.on { color: var(--ui-green); border-color: rgba(31, 138, 82, .35); background: var(--ui-green-soft); }
.mm-card-opt.off { color: var(--ui-amber); border-color: rgba(183, 121, 31, .35); background: var(--ui-amber-soft); }
.mm-empty { padding: 26px 12px; text-align: center; color: var(--ui-muted); font-size: 13px; }
.mm-form { padding: 14px; }
.mm-form .row { margin-bottom: 2px; }
.mm-form .row > * { flex: 1 1 165px; }
.mm-pic {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
  padding: 10px;
  margin-bottom: 12px;
  border: 1px solid var(--ui-line);
  border-radius: 10px;
  background: var(--ui-surface-2);
}
.mm-pic img {
  flex: none;
  width: 72px;
  height: 72px;
  object-fit: cover;
  border: 1px solid var(--ui-line-strong);
  border-radius: 10px;
  background: #fff;
}
.mm-pic-fields { flex: 1; min-width: 180px; display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.mm-pic-fields .field { flex: 1 1 200px; min-width: 0; margin-bottom: 0; }
.mm-opt {
  padding: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--ui-accent);
  border-radius: 10px;
  background: var(--ui-accent-soft);
}
.mm-opt-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.mm-opt-head .sub { font-size: 11px; color: var(--ui-muted); }
.mm-opt-modes { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.mm-opt-mode {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  flex: 1 1 210px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--ui-line-strong);
  border-radius: 10px;
  background: var(--ui-surface);
  cursor: pointer;
}
.mm-opt-mode:hover { border-color: var(--ui-accent); }
.mm-opt-mode input { margin-top: 2px; flex: none; }
.mm-opt-mode span { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mm-opt-mode b { font-size: 12.5px; font-weight: 600; }
.mm-opt-mode em { font-style: normal; font-size: 11px; color: var(--ui-muted); }
.mm-opt-mode:has(input:checked),
.mm-opt-mode.active { border-color: var(--ui-accent); background: var(--ui-accent-soft); }
.mm-cat-off-note {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 9px 11px;
  margin-bottom: 8px;
  border-radius: 8px;
  border: 1px solid rgba(183, 121, 31, .35);
  background: var(--ui-amber-soft);
  color: var(--ui-amber);
  font-size: 11.5px;
}
.mm-cat-off-note b { color: var(--ui-amber); }
.mm-cat-off-note .btn { margin-left: auto; flex: none; }
.mm-cat-options {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border: 1px solid var(--ui-line);
  border-radius: 999px;
  background: var(--ui-surface);
  font-size: 12px;
  color: var(--ui-muted);
  cursor: pointer;
  white-space: nowrap;
}
.mm-cat-options:hover { border-color: var(--ui-accent); }
.mm-cat-options input { margin: 0; }
.mm-cat-options:has(input:checked),
.mm-cat-options.on {
  border-color: rgba(183, 121, 31, .5);
  background: var(--ui-amber-soft);
  color: var(--ui-amber);
  font-weight: 600;
}
.mm-opt textarea { width: 100%; background: var(--ui-surface); }
.mm-opt-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.mm-opt-actions .sub { font-size: 11px; color: var(--ui-muted); }
.mm-form-foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1280px) {
  #view-pos .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 204px minmax(0, 1fr); }
  #view-pos.active { grid-template-columns: 1fr; }
  #view-pos .pos-statusbar,
  #view-pos .pos-machine-panel,
  #view-pos .pos-open-panel,
  #view-pos .pos-sessions-panel,
  #view-pos .pos-scan-panel { grid-column: 1; grid-row: auto; }
}
@media (max-width: 820px) {
  .app-shell { grid-template-columns: 1fr; min-height: 0; }
  .sidebar { position: static; height: auto; }
  .sidebar-nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 4px; }
  .nav-group { display: contents; }
  .nav-group-title { display: none; }
  .sidebar-foot { display: none; }
  .dash-todo { grid-template-columns: 1fr; }
  .dash-main-grid { grid-template-columns: 1fr; }
  .modal.modal-wide {
    width: 100%;
    max-width: 100%;
    height: 92dvh;
    max-height: 92dvh;
    border-radius: 18px 18px 0 0;
  }
  .modal.modal-wide .modal-body { padding: 10px 12px; }
  .mm-top .input { flex: 1 1 130px; max-width: none; }
  .mm-top-gap { display: none; }
  .mm-body { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .mm-cats { flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 5px; }
  .mm-cat-wrap { flex: 0 0 auto; }
  .mm-cat { padding: 7px 10px; }
  .mm-cat-name { white-space: nowrap; }
  .mm-cat-tools { padding: 0 4px 4px; }
  .mm-grid { grid-template-columns: repeat(auto-fill, minmax(126px, 1fr)); }
}
@media (max-width: 560px) {
  .app-topbar { padding: 10px 12px; }
  .topbar-right { width: 100%; margin-left: 0; }
  .content { padding: 12px; }
  #view-pos .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .logo-editor { flex-direction: column; }
  .pos-settle-bar .settle-info { min-width: 0; }
  .pos-settle-bar .settle-amount { margin-left: 0; }
  .mm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mm-card-img { height: 70px; }
}
