/* ================================================================
   酒吧点餐系统 · 管理后台样式
   零依赖，纯手写。配色以深色侧栏 + 浅色内容区为主，
   状态色沿用中式习惯：进行中=蓝，完成=绿，风险=红，待办=灰。
   ================================================================ */

:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --ink: #1b2332;
  --ink-2: #5a6478;
  --ink-3: #8b94a6;
  --line: #e4e8f0;
  --brand: #3b5bdb;
  --brand-2: #4c6ef5;
  --sidebar: #1b2332;
  --sidebar-ink: #c8d0de;
  --ok: #2f9e44;
  --warn: #e8590c;
  --danger: #e03131;
  --info: #1971c2;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 12px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ---------------- 登录 ---------------- */
.login-wrap {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(1200px 600px at 20% 10%, #e9edf9 0%, transparent 60%),
              radial-gradient(900px 500px at 90% 90%, #e6f0f9 0%, transparent 55%),
              var(--bg);
  padding: 24px;
}

.login-card {
  width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 28px 28px 20px;
}

.login-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; }
.login-brand h1 { font-size: 18px; margin: 0 0 2px; letter-spacing: .3px; }
.login-brand p { margin: 0; color: var(--ink-3); font-size: 12px; }

.brand-mark {
  width: 40px; height: 40px; border-radius: 11px;
  background: linear-gradient(135deg, var(--brand) 0%, #6c8bff 100%);
  color: #fff; font-weight: 700; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.brand-mark.sm { width: 28px; height: 28px; font-size: 14px; border-radius: 8px; }

.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.field input {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; color: var(--ink); background: #fbfcfe;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus {
  outline: none; border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(76, 110, 245, .12); background: #fff;
}

.login-tips {
  font-size: 12px; color: var(--ink-3); line-height: 1.7;
  background: #f7f9fd; border: 1px dashed var(--line);
  border-radius: 8px; padding: 8px 10px; margin: 4px 0 16px;
}

.login-error {
  color: var(--danger); font-size: 13px; min-height: 18px;
  margin-top: 10px; text-align: center;
}

.login-foot {
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--ink-3); text-align: center;
}
.login-foot code { background: #f1f3f9; padding: 1px 5px; border-radius: 4px; }
.dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-3); margin: 0 4px 0 8px; vertical-align: middle;
}
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--danger); }

/* ---------------- 布局 ---------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 216px; flex: 0 0 216px;
  background: var(--sidebar); color: var(--sidebar-ink);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 16px; font-weight: 600; color: #fff; font-size: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}

#nav { flex: 1; overflow-y: auto; padding: 10px 10px 20px; }
.nav-group { margin-top: 14px; }
.nav-group:first-child { margin-top: 4px; }
.nav-group-title {
  font-size: 11px; color: #6b7688; padding: 6px 10px;
  letter-spacing: .6px; text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 10px; border-radius: 8px; cursor: pointer;
  color: var(--sidebar-ink); font-size: 13.5px;
  transition: background .15s, color .15s;
  user-select: none;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; }
.nav-item .badge {
  font-size: 10px; padding: 1px 6px; border-radius: 20px;
  background: rgba(255, 255, 255, .14); color: #dfe6f5;
}
.nav-item.active .badge { background: rgba(255, 255, 255, .25); color: #fff; }
.nav-item .badge.done { background: rgba(47, 158, 68, .22); color: #8ce99a; }

.sidebar-foot {
  padding: 12px; border-top: 1px solid rgba(255, 255, 255, .07);
}
.user-line { margin-bottom: 10px; padding: 0 4px; }
.user-line span { display: block; color: #fff; font-size: 13px; }
.user-line small { color: #6b7688; font-size: 11px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 68px; flex: 0 0 68px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar h2 { margin: 0; font-size: 16px; }
.topbar p { margin: 3px 0 0; font-size: 12px; color: var(--ink-3); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.content { padding: 20px 24px 40px; }

/* ---------------- 通用组件 ---------------- */
.btn {
  height: 34px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font-size: 13px; cursor: pointer; transition: all .15s;
  font-family: inherit;
}
.btn:hover { border-color: #c9d2e3; background: #f8fafd; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
.btn-danger { color: var(--danger); border-color: #ffc9c9; }
.btn-danger:hover { background: #fff5f5; border-color: #ffa8a8; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px; border-radius: 20px;
  background: #f1f3f9; color: var(--ink-2); font-size: 12px;
}

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-head {
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-head h3 { margin: 0; font-size: 14px; }
.card-head .sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.card-body { padding: 16px; }

/* 指标卡 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.stat .k { font-size: 12px; color: var(--ink-3); margin-bottom: 6px; }
.stat .v { font-size: 24px; font-weight: 650; letter-spacing: -.5px; }
.stat .v small { font-size: 12px; font-weight: 400; color: var(--ink-3); margin-left: 3px; }
.stat.ok .v { color: var(--ok); }
.stat.warn .v { color: var(--warn); }
.stat.danger .v { color: var(--danger); }
.stat.info .v { color: var(--info); }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { color: var(--ink-3); font-weight: 500; font-size: 12px; background: #fafbfe; }
tbody tr:hover { background: #fafbfe; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.tag {
  display: inline-block; padding: 1px 8px; border-radius: 4px;
  font-size: 11.5px; line-height: 18px;
}
.tag.ok { background: #ebfbee; color: var(--ok); }
.tag.warn { background: #fff4e6; color: var(--warn); }
.tag.danger { background: #fff5f5; color: var(--danger); }
.tag.info { background: #e7f5ff; color: var(--info); }
.tag.mute { background: #f1f3f9; color: var(--ink-2); }

/* 桌台 */
.table-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 12px;
}
.table-card {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px;
  background: #fff; cursor: pointer; transition: all .15s; position: relative;
}
.table-card:hover { border-color: #b9c6e6; box-shadow: 0 4px 14px rgba(59, 91, 219, .1); }
.table-card .code { font-size: 17px; font-weight: 650; letter-spacing: .5px; }
.table-card .meta { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.table-card .amt {
  margin-top: 10px; font-size: 13px; font-variant-numeric: tabular-nums;
  display: flex; justify-content: space-between; align-items: baseline;
}
.table-card .amt b { font-size: 15px; }
.table-card.idle { background: #fbfcfe; }
.table-card.busy { border-color: #ffd8a8; background: #fffdf8; }
.table-card.busy .code { color: var(--warn); }
.table-card.clearing { border-color: #b2f2bb; background: #f8fff9; }
.table-card .badge-time {
  position: absolute; top: 10px; right: 10px; font-size: 11px;
  color: var(--ink-3); font-variant-numeric: tabular-nums;
}

/* 进度看板 */
.progress-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; font-size: 12px; color: var(--ink-2); }
.progress-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }

.module-row td { vertical-align: middle; }
.bar { height: 7px; border-radius: 4px; background: #eef1f7; overflow: hidden; min-width: 90px; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--brand); }
.bar > i.ok { background: var(--ok); }
.bar > i.warn { background: var(--warn); }
.bar > i.mute { background: #c8d0de; }

.empty { padding: 40px 16px; text-align: center; color: var(--ink-3); font-size: 13px; }

.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 20px);
  background: #1b2332; color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 99;
  max-width: 80vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: #c92a2a; }

.loading { padding: 40px; text-align: center; color: var(--ink-3); font-size: 13px; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.muted { color: var(--ink-3); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

/* ---------- M05 三档价 / M08 提成：行内编辑 ---------- */
.price-input {
  width: 100%;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
  color: var(--ink);
  background: #fff;
  box-sizing: border-box;
}
.price-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 2px rgba(45,110,240,.12); }
.price-input::placeholder { color: #aab3c2; }

/* 进价可见性开关：默认隐藏时给一点视觉提示，避免误以为已开放 */
.switch { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.switch input { width: 15px; height: 15px; cursor: pointer; }
