/* Vendor Capture: tokens from DESIGN.md. System fonts only (no CDNs: must load behind the Great Firewall). */
:root {
  --bg: #f6f4ef; --surface: #fff; --ink: #1c1b19; --muted: #6b675f; --line: #e3dfd6;
  --accent: #0f6b5c; --accent-ink: #fff; --flag: #c23b22; --chip: #edeae3;
  --radius: 10px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #141413; --surface: #1e1d1b; --ink: #ecebe6; --muted: #a29e94; --line: #33312d;
          --accent: #4fb8a3; --accent-ink: #0b1f1b; --flag: #ff7a5c; --chip: #2a2926; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB",
        "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px 48px; }

/* top bar */
.top { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; padding-top: 6px; padding-bottom: 6px; }
.top .brand { font-weight: 700; white-space: nowrap; color: var(--ink); padding: 8px 0; }
.top form { margin-left: auto; }
.top nav { order: 3; flex: 1 0 100%; display: flex; gap: 2px; overflow-x: auto; margin: 0 -8px; }
.top nav a { padding: 10px 10px; border-radius: 8px; white-space: nowrap; color: var(--muted); }
.top nav a[aria-current="page"] { color: var(--ink); background: var(--chip); }
@media (min-width: 640px) { .top nav { order: 0; flex: 0 1 auto; margin: 0; } }

h1 { font-size: 22px; line-height: 1.25; margin: 20px 0 2px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; }
.zh { color: var(--muted); font-weight: 400; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.unknown { color: var(--muted); font-style: italic; }
.flag { color: var(--flag); }

/* filters */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0 8px; }
.filters .q { grid-column: 1 / -1; }
input, select, button, textarea {
  font: inherit; color: inherit; min-height: 44px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); padding: 8px 12px; width: 100%;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
button.primary, .btn { background: var(--accent); color: var(--accent-ink); border: 0; font-weight: 600; cursor: pointer; }
button.link { background: none; border: 0; color: var(--muted); width: auto; min-height: 40px; cursor: pointer; }
.filters button { grid-column: 1 / -1; }
@media (min-width: 640px) {
  .filters { grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto; }
  .filters .q { grid-column: auto; }
  .filters button { grid-column: auto; width: auto; }
}
.count { margin: 8px 0 12px; font-size: 14px; color: var(--muted); }

/* vendor rows */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.row { display: flex; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
       padding: 12px; color: inherit; }
.row:hover { text-decoration: none; border-color: var(--accent); }
.row .thumb { width: 64px; height: 40px; border-radius: 6px; object-fit: cover; flex: none; background: var(--chip); }
.row .body { min-width: 0; flex: 1; }
.row .name { font-weight: 600; font-size: 17px; overflow-wrap: anywhere; }
.row .meta { font-size: 14px; color: var(--muted); margin-top: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip { font-size: 12px; background: var(--chip); border-radius: 999px; padding: 2px 8px; color: var(--ink); }
.chip.flag { background: color-mix(in srgb, var(--flag) 14%, transparent); color: var(--flag); }
.stars { color: var(--accent); letter-spacing: 1px; }

/* sections */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-top: 12px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.contact + .contact { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.contact .who { font-weight: 600; }
.contact .lines { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 4px; font-size: 15px; }
.copy { cursor: copy; border-bottom: 1px dotted var(--muted); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.gallery figcaption { font-size: 13px; color: var(--muted); margin-top: 4px; }
.gallery .desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
button.link { white-space: nowrap; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline > li + li { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.timeline .when { font-size: 13px; color: var(--muted); }
details summary { cursor: pointer; color: var(--accent); min-height: 32px; padding-top: 4px; }
details .raw { white-space: pre-wrap; font-size: 15px; background: var(--bg); border-radius: 8px; padding: 10px; margin-top: 6px; }
audio { width: 100%; margin-top: 6px; }

/* quotes: stacked on phones, table from 640px */
.quotes { width: 100%; border-collapse: collapse; font-size: 15px; }
.quotes th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.quotes td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.price { font-weight: 600; white-space: nowrap; }
@media (max-width: 639px) {
  .quotes thead { display: none; }
  .quotes tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .quotes td { display: block; padding: 1px 0; border: 0; }
  .quotes td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-size: 13px; }
  .quotes td.item { font-weight: 600; }
  .quotes td.item .muted { font-weight: 400; }
}

.fu { display: flex; gap: 10px; align-items: baseline; }
.fu .due { font-size: 13px; color: var(--muted); white-space: nowrap; min-width: 92px; }
.fu.overdue .due { color: var(--flag); }
.fu .what { flex: 1; min-width: 0; }
.fu form { flex: none; }
.fu.done .what, .fu.done .due { opacity: .6; text-decoration: line-through; }
.mv summary { color: var(--muted); font-size: 12px; min-height: 24px; }
.mv form { display: grid; gap: 4px; margin-top: 4px; }
.mv select { min-height: 36px; padding: 4px 6px; font-size: 13px; }
.edit { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.editform { display: grid; gap: 10px; margin-top: 8px; }
.editform label { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
.editform input, .editform select { color: var(--ink); }
@media (min-width: 640px) { .editform { grid-template-columns: 1fr 1fr; } .editform p, .editform button { grid-column: 1 / -1; } }

.login { max-width: 360px; margin: 18vh auto 0; padding: 0 16px; }
.login form { display: grid; gap: 10px; margin-top: 16px; }
.empty { padding: 32px 0; text-align: center; color: var(--muted); }
.notice { background: var(--chip); border-radius: var(--radius); padding: 10px 12px; font-size: 14px; margin-top: 12px; }
@media (prefers-reduced-motion: no-preference) { a, .row { transition: border-color .12s, color .12s; } }
