:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --ink: #1e2430;
  --ink-2: #5d6675;
  --line: #e7e9ee;
  --brand: #8b5e3c;
  --brand-2: #b98a5c;
  --brand-soft: #f3e9df;
  --green: #2f9e6e;
  --red: #d9483d;
  --amber: #e0982b;
  --blue: #3a72d6;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(30, 36, 48, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
a { color: var(--brand); text-decoration: none; }

/* 启动 / 登录 */
.boot-screen, .auth-wrap {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #f7f2ec 0%, #eceff4 100%); gap: 14px;
}
.boot-logo {
  width: 64px; height: 64px; border-radius: 18px; background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 700;
  box-shadow: 0 8px 24px rgba(139,94,60,.25);
}
.boot-text { color: var(--ink-2); }
.auth-card {
  width: 420px; max-width: calc(100vw - 32px); background: var(--panel); border-radius: 18px;
  padding: 34px; box-shadow: 0 16px 48px rgba(30,36,48,.10); border: 1px solid var(--line);
}
.auth-title { font-size: 22px; font-weight: 700; margin: 0 0 6px; }
.auth-sub { color: var(--ink-2); margin: 0 0 26px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--ink-2); font-size: 13px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; outline: none; background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(185,138,92,.12); }
.field textarea { min-height: 76px; resize: vertical; }
.inline { display: flex; gap: 10px; align-items: center; }
.inline .field { flex: 1; margin-bottom: 16px; }
.btn {
  border: 0; border-radius: 8px; padding: 10px 16px; font-weight: 600; background: var(--brand); color: #fff;
  transition: opacity .15s; white-space: nowrap;
}
.btn:hover { opacity: .88; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; padding: 12px; }
.btn.ghost { background: var(--brand-soft); color: var(--brand); }
.btn.plain { background: #f0f1f4; color: var(--ink); }
.btn.danger { background: var(--red); }
.btn.sm { padding: 6px 10px; font-size: 12px; border-radius: 6px; }
.hint { font-size: 12px; color: var(--ink-2); margin-top: 8px; }
.err { color: var(--red); font-size: 13px; min-height: 20px; }

/* 主框架 */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 224px; flex: 0 0 224px; background: #232833; color: #d7dbe3; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-head { padding: 22px 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-logo { display: flex; align-items: center; gap: 10px; }
.sidebar-logo .mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--brand-2); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.sidebar-logo b { color: #fff; font-size: 15px; }
.sidebar-logo small { display: block; color: #98a0ae; font-size: 11px; }
.nav-group { padding: 14px 10px 0; }
.nav-group-title { font-size: 11px; color: #7f8898; padding: 0 10px 6px; letter-spacing: .08em; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; cursor: pointer;
  color: #c9ced8; font-size: 13px; margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,.07); }
.nav-item.active { background: var(--brand); color: #fff; font-weight: 600; }
.nav-item .ico { width: 18px; text-align: center; opacity: .9; }
.sidebar-foot { margin-top: auto; padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: #98a0ae; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center;
  justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 17px; margin: 0; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 13px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.content { padding: 22px 24px 40px; flex: 1; }

/* 通用组件 */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 18px; gap: 16px; flex-wrap: wrap; }
.page-head h2 { font-size: 20px; margin: 0 0 4px; }
.page-head p { margin: 0; color: var(--ink-2); font-size: 13px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar select, .toolbar input {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; outline: none;
}
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.card h3 { margin: 0 0 14px; font-size: 15px; }
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 1080px) { .grid.cols-4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .grid.cols-3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 700px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } .sidebar { width: 64px; flex-basis: 64px; } .nav-item span.txt, .nav-group-title, .sidebar-logo b, .sidebar-logo small { display: none; } .content { padding: 16px; } }

.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi .label { color: var(--ink-2); font-size: 12px; }
.kpi .value { font-size: 26px; font-weight: 700; margin-top: 6px; letter-spacing: -.02em; }
.kpi .sub { font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.kpi .sub.up { color: var(--red); }
.kpi .sub.down { color: var(--green); }
.progress { height: 8px; background: #eef0f3; border-radius: 99px; overflow: hidden; margin-top: 10px; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-2), var(--brand)); border-radius: 99px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--ink-2); font-weight: 600; font-size: 12px; background: #fafbfc; }
tbody tr:hover { background: #fafbfc; }
.table-scroll { overflow-x: auto; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; background: #f0f1f4; color: var(--ink-2); }
.badge.green { background: #e7f6ef; color: var(--green); }
.badge.red { background: #fdeceb; color: var(--red); }
.badge.amber { background: #fdf3e2; color: var(--amber); }
.badge.blue { background: #eaf1fd; color: var(--blue); }
.muted { color: var(--ink-2); }
.tiny { font-size: 12px; }
.right { text-align: right; }
.center { text-align: center; }
.money { font-variant-numeric: tabular-nums; font-weight: 600; }

/* 图表 */
.bars { display: flex; align-items: flex-end; gap: 12px; height: 170px; padding: 8px 4px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bar-col .bar { width: 100%; max-width: 46px; background: linear-gradient(180deg, var(--brand-2), var(--brand)); border-radius: 6px 6px 0 0; min-height: 2px; }
.bar-col .cap { font-size: 11px; color: var(--ink-2); }
.bar-col .val { font-size: 11px; font-weight: 600; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-top: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }

/* 弹窗 / 提示 */
.modal-mask { position: fixed; inset: 0; background: rgba(20,24,32,.45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: #fff; border-radius: 14px; width: 560px; max-width: 100%; max-height: 90vh; overflow-y: auto; padding: 22px; box-shadow: 0 24px 64px rgba(0,0,0,.2); }
.modal h3 { margin: 0 0 16px; font-size: 17px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
#toast-root { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #232833; color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18); font-size: 13px; }
.toast.ok { background: var(--green); }
.toast.err { background: var(--red); }
.empty { text-align: center; color: var(--ink-2); padding: 30px 10px; font-size: 13px; }
.loading { text-align: center; color: var(--ink-2); padding: 30px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
.rule-box { background: #faf7f3; border: 1px solid #ecdfd1; border-radius: 10px; padding: 14px; font-size: 12px; color: var(--ink-2); line-height: 1.9; }
.rule-box b { color: var(--brand); }

/* 客户消费登记（三段式）与日报自动汇总 */
.settle-block { margin-top: 14px; padding: 12px; background: #fafbfc; border: 1px dashed #d9dee6; border-radius: 10px; }
.settle-title { font-size: 12px; font-weight: 600; color: var(--brand); margin-bottom: 8px; }
.settle-block .inline { gap: 12px; margin-bottom: 6px; }
.settle-block .field { flex: 1; margin: 0; }
.auto-box { margin-top: 14px; padding: 14px; background: #faf7f3; border: 1px solid #ecdfd1; border-radius: 10px; }
.auto-box h3 { margin: 0 0 10px; font-size: 14px; }
.auto-box pre, .summary-pre { white-space: pre-wrap; word-break: break-word; font-family: inherit; font-size: 13px; line-height: 1.9; color: var(--ink); margin: 0 0 10px; }
table input, table select { width: 100%; min-width: 88px; }
