:root {
  --ink: #14211b;
  --muted: #6b7a72;
  --line: #e5ebe7;
  --bg: #f4f7f5;
  --card: #ffffff;
  --brand: #0f7a4a;
  --brand-2: #17a05e;
  --brand-soft: #e8f5ee;
  --warn: #b45309;
  --warn-soft: #fdf3e3;
  --danger: #c0392b;
  --danger-soft: #fdecea;
  --info: #1f6fb2;
  --info-soft: #eaf2fb;
  --radius: 14px;
  --shadow: 0 12px 30px rgba(20, 33, 27, .08);
  --font: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; }
code { background: #eef3f0; padding: 2px 6px; border-radius: 6px; font-size: 12.5px; }
.mono { font-family: "SFMono-Regular", Consolas, monospace; font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.hidden { display: none !important; }

/* ---------------- 后台布局 ---------------- */
.admin-shell { display: flex; min-height: 100vh; }
.side {
  width: 224px; flex: 0 0 224px;
  background: linear-gradient(180deg, #0d2a20 0%, #0f3a29 60%, #11402d 100%);
  color: #d9e6df; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; padding: 20px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 22px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, #1fd07d, #0f7a4a); color: #fff; font-weight: 800;
  box-shadow: 0 6px 14px rgba(31, 208, 125, .25);
}
.brand-text { line-height: 1.25; }
.brand-text b { color: #fff; font-size: 15px; letter-spacing: .02em; }
.brand-text span { display: block; font-size: 11px; color: #8fae9f; letter-spacing: .12em; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  color: #c2d6cc; font-size: 13.5px; transition: .18s;
}
.nav a svg { width: 17px; height: 17px; opacity: .8; }
.nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.nav a.on { background: rgba(31, 208, 125, .16); color: #fff; box-shadow: inset 0 0 0 1px rgba(31, 208, 125, .25); }
.side-user { border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 14px; font-size: 12.5px; color: #9bb8ab; }
.side-user b { color: #fff; display: block; font-weight: 600; }
.side-user form { margin-top: 10px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 26px; background: rgba(244, 247, 245, .86); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 19px; }
.topbar .crumb { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.content { padding: 22px 26px 40px; max-width: 1400px; width: 100%; }

/* ---------------- 通用组件 ---------------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(20, 33, 27, .03);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.card-head h3 { font-size: 15px; }
.card-body { padding: 18px; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }

.kpi { padding: 18px; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.kpi::after {
  content: ""; position: absolute; right: -26px; top: -26px; width: 92px; height: 92px;
  border-radius: 50%; background: radial-gradient(circle, rgba(23, 160, 94, .12), transparent 70%);
}
.kpi .label { color: var(--muted); font-size: 12.5px; letter-spacing: .02em; }
.kpi .value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi .value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.kpi .delta { font-size: 12px; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); cursor: pointer; font-size: 13px;
  transition: .16s; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #0b6540; color: #fff; }
.btn.ghost-danger { color: var(--danger); border-color: #f3d3cf; background: #fff; }
.btn.ghost-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: #eef2f0; color: #40544a; white-space: nowrap;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.chip.paid { background: var(--brand-soft); color: #0b6b41; }
.chip.pending { background: var(--warn-soft); color: var(--warn); }
.chip.failed { background: var(--danger-soft); color: var(--danger); }
.chip.cancelled { background: #f1f1f3; color: #5a6470; }
.chip.expired { background: #f2eee9; color: #8a6a3c; }
.chip.refunded { background: var(--info-soft); color: var(--info); }
.chip.plain { background: #f3f5f4; color: var(--muted); font-weight: 500; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.field .hint { font-size: 12px; color: #93a099; }
input[type=text], input[type=password], input[type=number], input[type=tel], input[type=date],
select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid #dbe3de; border-radius: 9px;
  background: #fff; color: var(--ink); outline: none; transition: .16s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(23, 160, 94, .12);
}
textarea { resize: vertical; min-height: 76px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }

.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filter-bar .field { min-width: 128px; flex: 1 1 128px; }
.filter-bar .field.wide { flex: 2 1 200px; }

table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 12px;
  letter-spacing: .03em; padding: 10px 14px; background: #f8faf9; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td { padding: 11px 14px; border-bottom: 1px solid #f0f3f1; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcfb; }
.table-wrap { overflow-x: auto; }
.table-empty { padding: 40px; text-align: center; color: var(--muted); }

.pagination { display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding: 14px 16px; flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  padding: 0 9px; border-radius: 8px; border: 1px solid var(--line); font-size: 12.5px; color: var(--muted);
}
.pagination a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.pagination .cur { background: var(--brand); border-color: var(--brand); color: #fff; }

.flash { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 13px; }
.flash.success { background: var(--brand-soft); color: #0b6b41; }
.flash.error { background: var(--danger-soft); color: var(--danger); }
.flash.info { background: var(--info-soft); color: var(--info); }

.bars { display: flex; align-items: flex-end; gap: 8px; height: 150px; padding: 10px 4px 0; }
.bar-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.bar-col { width: 100%; max-width: 34px; background: linear-gradient(180deg, #2fc47d, #0f7a4a); border-radius: 6px 6px 3px 3px; min-height: 2px; transition: .3s; }
.bar-item:hover .bar-col { filter: brightness(1.08); }
.bar-label { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.bar-value { font-size: 10.5px; color: #40544a; font-weight: 600; }

.list-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid #f0f3f1; }
.list-row:last-child { border-bottom: 0; }
.avatar { width: 34px; height: 34px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 12.5px; }

.kv { display: grid; grid-template-columns: 116px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }

.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 4px; top: 4px; bottom: 4px; width: 2px; background: #e7ece9; }
.timeline-item { position: relative; padding: 0 0 14px 6px; }
.timeline-item::before { content: ""; position: absolute; left: -18px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-2); box-shadow: 0 0 0 3px #e8f5ee; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item b { font-size: 12.5px; }
.timeline-item .muted { font-size: 12px; }

.note { font-size: 12.5px; color: var(--muted); background: #f8faf9; border: 1px dashed #dbe4df; border-radius: 10px; padding: 10px 12px; }

/* ---------------- 二维码/打印 ---------------- */
.qr-mini { width: 42px; height: 42px; border-radius: 6px; border: 1px solid var(--line); background: #fff; padding: 3px; }
.qr-card { display: grid; grid-template-columns: 300px 1fr; gap: 26px; align-items: start; }
.qr-frame { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 22px; text-align: center; box-shadow: var(--shadow); }
.qr-frame img { width: 100%; max-width: 260px; height: auto; display: block; margin: 0 auto; }
.qr-frame .plate { font-size: 26px; font-weight: 800; letter-spacing: .04em; margin-top: 12px; }
.qr-frame .code { color: var(--muted); font-size: 12.5px; }
.qr-tip { margin-top: 8px; font-size: 12.5px; color: var(--muted); }

/* ---------------- 登录 ---------------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1200px 600px at 10% -10%, #d9f0e3 0%, transparent 55%),
    radial-gradient(900px 500px at 110% 110%, #e3f1ea 0%, transparent 55%),
    #f4f7f5;
}
.login-card { width: 100%; max-width: 400px; padding: 34px 30px; }
.login-card .brand { padding: 0 0 22px; }
.login-card .brand-text b { color: var(--ink); }
.login-card .brand-text span { color: var(--muted); }
.login-card h1 { font-size: 21px; margin-bottom: 6px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.login-card .field { margin-bottom: 14px; }
.login-foot { margin-top: 18px; font-size: 12px; color: #93a099; text-align: center; }

/* ---------------- 乘客端 ---------------- */
body.pay-body {
  background: linear-gradient(180deg, #0f3a29 0%, #0d2a20 34%, #f4f7f5 34%, #f4f7f5 100%);
  min-height: 100vh;
}
.pay-wrap { max-width: 520px; margin: 0 auto; padding: 22px 16px 46px; }
.pay-top { color: #e6f2eb; display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 20px; }
.pay-top .brand { padding: 0; }
.pay-top .brand-text b { color: #fff; }
.pay-top .brand-text span { color: #9fc0b0; }
.pay-card { background: #fff; border-radius: 20px; box-shadow: 0 18px 40px rgba(13, 42, 32, .18); overflow: hidden; }
.pay-vehicle { padding: 20px 20px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 14px; align-items: center; }
.plate-badge {
  background: linear-gradient(180deg, #1c6fdc, #0f52b8); color: #fff; border-radius: 10px;
  padding: 8px 12px; font-weight: 800; font-size: 18px; letter-spacing: .06em;
  box-shadow: 0 6px 14px rgba(28, 111, 220, .22); white-space: nowrap;
}
.pay-vehicle .meta b { display: block; font-size: 14px; }
.pay-vehicle .meta span { color: var(--muted); font-size: 12.5px; }
.pay-body-inner { padding: 20px; }
.amount-display { display: flex; align-items: baseline; gap: 3px; margin: 4px 0 2px; }
.amount-display .cur { font-size: 18px; font-weight: 600; }
.amount-display .num { font-size: 40px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.quick {
  border: 1px solid #dfe7e2; background: #fff; border-radius: 11px; padding: 11px 6px;
  font-size: 15px; font-weight: 650; cursor: pointer; color: var(--ink); transition: .16s;
}
.quick:hover { border-color: var(--brand-2); color: var(--brand); }
.quick.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.pay-card input { font-size: 15px; }
.pay-submit {
  width: 100%; padding: 14px; border: 0; border-radius: 12px; color: #fff; font-size: 16px;
  font-weight: 700; cursor: pointer; margin-top: 16px;
  background: linear-gradient(135deg, #1fc37a, #0f7a4a); box-shadow: 0 10px 20px rgba(15, 122, 74, .22);
}
.pay-submit:active { transform: translateY(1px); }
.pay-safe { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 14px; color: #8b9a93; font-size: 12px; }
.pay-foot { text-align: center; color: #93a099; font-size: 12px; margin-top: 18px; }
.pay-err { background: var(--danger-soft); color: var(--danger); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px; }

.cashier { text-align: center; padding: 30px 22px; }
.cashier .amount { font-size: 38px; font-weight: 800; letter-spacing: -.03em; }
.cashier .amount small { font-size: 17px; font-weight: 600; }
.cashier .order-no { color: var(--muted); font-size: 12px; margin-top: 4px; }
.cashier .qr { width: 216px; height: 216px; margin: 20px auto 10px; padding: 10px; border: 1px solid var(--line); border-radius: 16px; }
.cashier .qr img { width: 100%; height: 100%; display: block; }
.cashier .tip { color: var(--muted); font-size: 13px; }
.cashier .status-line { margin-top: 16px; font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; justify-content: center; }
.spinner { width: 15px; height: 15px; border: 2px solid #d7e3dc; border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.mock-banner {
  background: var(--warn-soft); color: var(--warn); font-size: 12.5px; padding: 9px 14px;
  border-bottom: 1px solid #f5e2c3; text-align: center;
}
.mock-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.mock-actions .btn { padding: 12px; }
.btn-success { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-success:hover { background: #0b6540; color: #fff; }
.btn-danger { background: #fff; color: var(--danger); border-color: #f1cfc9; }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.result { text-align: center; padding: 34px 22px 26px; }
.result-icon { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 16px; font-size: 36px; }
.result-icon.ok { background: var(--brand-soft); color: var(--brand); }
.result-icon.bad { background: var(--danger-soft); color: var(--danger); }
.result-icon.wait { background: var(--warn-soft); color: var(--warn); }
.result h2 { font-size: 21px; }
.result .amount { font-size: 34px; font-weight: 800; margin: 8px 0 2px; }
.result .rows { margin: 22px 0 8px; text-align: left; border-top: 1px dashed var(--line); padding-top: 16px; }
.result .rows .row-line { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; font-size: 13px; }
.result .rows .row-line span:first-child { color: var(--muted); }
.notify-box { margin-top: 14px; text-align: left; background: #f8faf9; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.notify-box h4 { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.notify-box .msg { font-size: 12.5px; line-height: 1.55; color: #40544a; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qr-card { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .admin-shell { flex-direction: column; }
  .side { width: 100%; flex: none; height: auto; position: static; padding: 12px 12px 10px; }
  .brand { padding: 2px 6px 10px; }
  .nav { flex-direction: row; overflow-x: auto; gap: 6px; }
  .nav a { padding: 8px 10px; white-space: nowrap; }
  .nav a svg { display: none; }
  .side-user { display: none; }
  .topbar { padding: 14px 16px; flex-wrap: wrap; }
  .content { padding: 16px; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 100px 1fr; }
}

/* ---------------- 安装向导 ---------------- */
.setup-head { padding: 26px 24px 8px; }
.setup-head h1 { margin: 0 0 6px; font-size: 20px; }
.setup-head p { margin: 0; font-size: 13px; }
.setup-section { margin: 18px 0 10px; font-size: 13px; font-weight: 600; color: var(--muted); }

@media print {
  .side, .topbar, .no-print, .pagination, .flash { display: none !important; }
  body { background: #fff; }
  .admin-shell { display: block; }
  .content { padding: 0; max-width: none; }
  .print-card { border: 0; box-shadow: none; }
}
