:root {
  --bg: #f4f6f8; --card: #fff; --text: #1b2430; --muted: #6b7684; --line: #e3e8ee;
  --brand: #0f766e; --brand-d: #0b5c56; --brand-l: #e6f4f2;
  --warn: #b45309; --warn-l: #fef3c7; --bad: #b91c1c; --bad-l: #fee2e2; --ok: #15803d; --ok-l: #dcfce7;
  --info: #1d4ed8; --info-l: #dbeafe; --radius: 12px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1319; --card: #171e27; --text: #e8edf3; --muted: #93a0b0; --line: #283240;
    --brand: #2dd4bf; --brand-d: #5eead4; --brand-l: #12332f;
    --warn: #fbbf24; --warn-l: #3a2d0e; --bad: #f87171; --bad-l: #3f1717; --ok: #4ade80; --ok-l: #11301c;
    --info: #60a5fa; --info-l: #14284a; --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif; }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h1 { font-size: 20px; } h2 { font-size: 16px; } h3 { font-size: 14px; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.bold { font-weight: 600; } .mt { margin-top: 12px; } .mb { margin-bottom: 12px; } .hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; } .row.wrap { flex-wrap: wrap; } .row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; } .gap-s { gap: 6px; }
.money { font-variant-numeric: tabular-nums; }

/* ---- shell ---- */
.shell { min-height: 100vh; }
.nav { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line);
  display: flex; padding-bottom: env(safe-area-inset-bottom); }
.nav a { flex: 1; text-align: center; padding: 8px 2px 7px; color: var(--muted); font-size: 12px; }
.nav a b { display: block; font-size: 20px; line-height: 1.2; font-weight: normal; }
.nav a.on { color: var(--brand); font-weight: 600; }
.nav .brand, .nav .sp { display: none; }
main { padding: 14px 14px calc(78px + env(safe-area-inset-bottom)); max-width: 980px; margin: 0 auto; }
@media (min-width: 900px) {
  .nav { top: 0; bottom: auto; right: auto; width: 200px; height: 100vh; flex-direction: column; border-top: 0;
    border-right: 1px solid var(--line); padding: 14px 10px; gap: 2px; }
  .nav .brand { display: block; font-size: 17px; font-weight: 700; padding: 6px 10px 16px; color: var(--brand); }
  .nav .sp { display: block; flex: 1; }
  .nav a { flex: none; text-align: left; padding: 9px 12px; border-radius: 8px; font-size: 14.5px; display: flex; align-items: center; gap: 10px; }
  .nav a b { display: inline; font-size: 17px; }
  .nav a.on { background: var(--brand-l); }
  main { margin-left: 200px; max-width: none; padding: 22px 28px 40px; }
  main > .page { max-width: 980px; }
}

/* ---- primitives ---- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; border: 1px solid var(--line); }
.card > h2 { margin-bottom: 10px; }
.card.warn { border-color: var(--warn); } .card.bad { border-color: var(--bad); }
.btn { appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 10px;
  padding: 9px 14px; font: inherit; font-weight: 600; cursor: pointer; min-height: 40px; }
.btn:active { transform: translateY(1px); } .btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #06201d; } }
.btn.danger { color: var(--bad); border-color: var(--bad); } .btn.sm { padding: 5px 10px; min-height: 32px; font-size: 13px; }
.btn.block { display: block; width: 100%; } .btn.big { min-height: 48px; font-size: 16px; }
label.f { display: block; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
label.f > span.req { color: var(--bad); }
input, select, textarea { width: 100%; font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 11px; min-height: 42px; margin-top: 4px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
textarea { min-height: 70px; resize: vertical; }
input[type=checkbox] { width: auto; min-height: 0; margin: 0 6px 0 0; transform: scale(1.2); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
@media (max-width: 480px) { .grid2.keep { grid-template-columns: 1fr 1fr; } .grid2:not(.keep) { grid-template-columns: 1fr; } }
.tag { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--line); color: var(--muted); white-space: nowrap; }
.tag.ok { background: var(--ok-l); color: var(--ok); } .tag.warn { background: var(--warn-l); color: var(--warn); }
.tag.bad { background: var(--bad-l); color: var(--bad); } .tag.info { background: var(--info-l); color: var(--info); } .tag.brand { background: var(--brand-l); color: var(--brand); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; -webkit-overflow-scrolling: touch; }
.chip { flex: none; padding: 6px 13px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); font-size: 13.5px; color: var(--text); cursor: pointer; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
@media (prefers-color-scheme: dark) { .chip.on { color: #06201d; } }
.list .item { display: block; padding: 11px 0; border-top: 1px solid var(--line); color: inherit; }
.list .item:first-child { border-top: 0; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: block; color: inherit; }
.stat .v { font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: 5.5em 1fr; gap: 4px 10px; font-size: 14px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-all; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; } table.t th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12.5px; padding: 6px 4px; }
table.t td { padding: 8px 4px; border-top: 1px solid var(--line); vertical-align: middle; } table.t input { margin: 0; padding: 5px 7px; min-height: 34px; }
.empty { text-align: center; color: var(--muted); padding: 22px 0; }
.notice { padding: 10px 12px; border-radius: 10px; background: var(--warn-l); color: var(--warn); font-size: 13.5px; margin-bottom: 10px; }
.notice.info { background: var(--info-l); color: var(--info); } .notice.ok { background: var(--ok-l); color: var(--ok); } .notice.bad { background: var(--bad-l); color: var(--bad); }

/* ---- 验车 ---- */
.slots { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 600px) { .slots { grid-template-columns: repeat(3, 1fr); } }
.slot { border: 1.5px dashed var(--line); border-radius: 12px; padding: 8px; background: var(--card); min-height: 132px; display: flex; flex-direction: column; }
.slot.done { border-style: solid; border-color: var(--ok); }
.slot .nm { font-weight: 600; font-size: 13.5px; display: flex; justify-content: space-between; align-items: center; }
.slot .ph { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; flex: 1; align-content: flex-start; }
.thumb { position: relative; width: 64px; height: 64px; border-radius: 8px; overflow: hidden; background: var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button { position: absolute; top: 1px; right: 1px; border: 0; background: rgba(0,0,0,.6); color: #fff; width: 20px; height: 20px; border-radius: 50%; line-height: 18px; padding: 0; cursor: pointer; }
.cam { display: block; text-align: center; padding: 8px; border-radius: 9px; background: var(--brand-l); color: var(--brand); font-weight: 600; font-size: 13.5px; cursor: pointer; }
.cam input { display: none; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; } .seg button { flex: 1; min-width: 52px; }
.seg .btn.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.cmp { border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 10px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.photos figure { margin: 0; } .photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 9px; display: block; background: var(--line); cursor: zoom-in; }
.photos figcaption { font-size: 12px; color: var(--muted); text-align: center; margin-top: 2px; }

/* ---- sheet / toast ---- */
.mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; border-radius: 16px 16px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .mask { align-items: center; } .sheet { border-radius: 16px; } }
.mask.img { background: rgba(0,0,0,.88); align-items: center; } .mask.img img { max-width: 96vw; max-height: 92vh; border-radius: 6px; }
#toasts { position: fixed; z-index: 99; left: 0; right: 0; top: 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { background: #1b2430; color: #fff; padding: 10px 16px; border-radius: 10px; max-width: 90vw; font-size: 14px; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.toast.bad { background: #b91c1c; } .toast.ok { background: #15803d; }

/* ---- login / share ---- */
.login { max-width: 360px; margin: 12vh auto 0; padding: 0 20px; }
.login h1 { text-align: center; margin-bottom: 20px; color: var(--brand); }
.share { max-width: 640px; margin: 0 auto; padding: 14px 14px 40px; }
.share .head { text-align: center; padding: 10px 0 14px; } .share .head h1 { color: var(--brand); }
.total { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
@media print { .nav, .noprint, #toasts { display: none !important; } main { margin: 0 !important; padding: 0 !important; } body { background: #fff; } .card { box-shadow: none; } }
