/* WhichCard — visual language locked to docs/mockups/whichcard-mockup-v1.html */

:root {
  --page:#f9f9f7; --surface:#fcfcfb; --ink:#0b0b0b; --ink-2:#52514e; --muted:#898781;
  --hairline:#e1e0d9; --border:rgba(11,11,11,0.10);
  --accent:#2a78d6; --accent-deep:#1c5cab; --accent-wash:#cde2fb;
  --good:#0ca30c; --good-text:#006300; --warn:#fab219; --serious:#ec835a; --critical:#d03b3b;
  --warn-bg:#fdf1d4; --warn-ink:#8a5a00; --crit-bg:#fbe3e3; --crit-ink:#a02020;
  --shadow:0 10px 24px rgba(28,92,171,.28);
  --winner:linear-gradient(135deg,#153e70 0%,#1c5cab 55%,#2a78d6 100%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --page:#0d0d0d; --surface:#1a1a19; --ink:#ffffff; --ink-2:#b8b6b0; --muted:#8a8880;
    --hairline:#2e2e2c; --border:rgba(255,255,255,0.12);
    --accent:#5ea0ea; --accent-deep:#9cc6f4; --accent-wash:#16304d;
    --good:#38c438; --good-text:#6fe06f; --critical:#f06a6a;
    --warn-bg:#3a2d10; --warn-ink:#ffd483; --crit-bg:#3b1a1a; --crit-ink:#ff9a9a;
    --shadow:0 10px 24px rgba(0,0,0,.5);
    --winner:linear-gradient(135deg,#10294c 0%,#1c5cab 55%,#2a78d6 100%);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page); color: var(--ink);
  min-height: 100dvh; overscroll-behavior-y: none;
}
button, input, select { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- shell ---------- */
.app {
  max-width: 560px; margin: 0 auto; min-height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--page);
}
@media (min-width: 600px) {
  .app { border-left: 1px solid var(--hairline); border-right: 1px solid var(--hairline); }
}
.content {
  flex: 1; padding: 10px 14px 16px; display: flex; flex-direction: column; gap: 10px;
}
.apphead { display: flex; justify-content: space-between; align-items: center; padding: 8px 4px 0; }
.apphead .logo { font-size: 17px; font-weight: 800; letter-spacing: -0.02em; }
.apphead .logo em { color: var(--accent); font-style: normal; }
.house {
  font-size: 11px; font-weight: 600; color: var(--ink-2); background: var(--surface);
  border: 1px solid var(--hairline); border-radius: 99px; padding: 5px 10px;
  display: inline-flex; align-items: center; gap: 5px;
}
.house b { color: var(--good-text); letter-spacing: .02em; }
.dot { width: 7px; height: 7px; border-radius: 99px; background: var(--muted); flex: 0 0 auto; }
.dot.synced { background: var(--good); }
.dot.pending { background: var(--warn); }
.dot.offline { background: var(--serious); }
.dot.local { background: var(--muted); }

.h-row { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px; gap: 8px; }
.h-row h3 { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }

/* ---------- search ---------- */
.search {
  background: var(--surface); border: 1.5px solid var(--accent); border-radius: 14px;
  padding: 10px 12px; display: flex; align-items: center; gap: 8px;
  box-shadow: 0 1px 2px rgba(11,11,11,.04);
}
.search input {
  flex: 1; border: none; background: none; outline: none;
  font-size: 15px; font-weight: 600; min-width: 0;
}
.search input::placeholder { color: var(--muted); font-weight: 500; }
.search .ico { color: var(--muted); font-size: 15px; }
.search .clear { color: var(--muted); font-size: 15px; padding: 0 2px; }
.resolved { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); padding: 0 4px; flex-wrap: wrap; }
.resolved .pill {
  background: var(--accent-wash); color: var(--accent-deep); font-weight: 700;
  border-radius: 99px; padding: 2px 8px; font-size: 11px;
}

/* ---------- chips ---------- */
.chips {
  display: flex; gap: 6px; padding: 2px 2px 4px; overflow-x: auto;
  scrollbar-width: none; -ms-overflow-style: none;
}
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip {
  flex: 0 0 auto; font-size: 12px; font-weight: 600; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--hairline); border-radius: 99px;
  padding: 7px 12px; white-space: nowrap;
}
.chip.on { background: var(--ink); color: var(--page); border-color: var(--ink); }
.chip:active { transform: scale(.97); }

/* ---------- winner ---------- */
.winner {
  border-radius: 18px; padding: 16px 16px 14px; color: #fff;
  background: var(--winner); box-shadow: var(--shadow);
}
.winner .use { font-size: 10px; font-weight: 800; letter-spacing: .14em; opacity: .85; }
.winner .row1 { display: flex; justify-content: space-between; align-items: flex-start; margin-top: 6px; gap: 10px; }
.winner .name { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; }
.winner .holder {
  font-size: 10px; font-weight: 700; background: rgba(255,255,255,.2);
  border-radius: 99px; padding: 3px 8px; margin-left: 8px; vertical-align: 2px;
}
.winner .rate { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; white-space: nowrap; }
.winner .rate small { font-size: 14px; font-weight: 700; }
.winner .unitnote { font-size: 10px; font-weight: 600; opacity: .8; text-align: right; margin-top: -2px; }
.winner .why { font-size: 12px; opacity: .92; margin-top: 4px; }
.winner .cav { font-size: 11px; opacity: .9; margin-top: 6px; display: flex; gap: 6px; align-items: flex-start; }
.winner .cav b { font-weight: 700; }
.capbar { margin-top: 12px; }
.capbar .lbl { display: flex; justify-content: space-between; font-size: 11px; opacity: .9; margin-bottom: 5px; gap: 8px; }
.capbar .track { height: 5px; border-radius: 3px; background: rgba(255,255,255,.25); }
.capbar .fill { height: 5px; border-radius: 3px; background: #fff; }

/* ---------- runner list ---------- */
.runners { background: var(--surface); border: 1px solid var(--hairline); border-radius: 16px; overflow: hidden; }
.runner {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px;
  border-bottom: 1px solid var(--hairline); width: 100%; text-align: left;
}
.runner:last-child { border-bottom: none; }
.runner.dim { opacity: .55; }
.mini { width: 38px; height: 26px; border-radius: 5px; flex: 0 0 auto; }
.runner .nm { font-size: 13.5px; font-weight: 650; }
.runner .why { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.runner .rt { margin-left: auto; font-size: 14px; font-weight: 750; color: var(--ink-2); text-align: right; white-space: nowrap; }
.runner .rt small { display: block; font-size: 10px; font-weight: 600; color: var(--muted); }
.holdtag {
  font-size: 9.5px; font-weight: 700; color: var(--ink-2); background: var(--page);
  border: 1px solid var(--hairline); border-radius: 99px; padding: 1.5px 6px;
  margin-left: 6px; vertical-align: 1px;
}
.footnote { font-size: 10.5px; color: var(--muted); padding: 0 6px; line-height: 1.45; }
.notebar {
  font-size: 11.5px; color: var(--warn-ink); background: var(--warn-bg);
  border-radius: 12px; padding: 9px 12px; line-height: 1.4;
}

/* ---------- benefits ---------- */
.stat-row { display: flex; gap: 10px; }
.tile { flex: 1; background: var(--surface); border: 1px solid var(--hairline); border-radius: 14px; padding: 11px 13px; }
.tile .v { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.tile .k { font-size: 11px; color: var(--ink-2); margin-top: 2px; }
.tile.warn .v { color: var(--warn-ink); }
.cardgroup { background: var(--surface); border: 1px solid var(--hairline); border-radius: 16px; overflow: hidden; }
.cg-head {
  display: flex; align-items: center; gap: 10px; padding: 11px 13px;
  border-bottom: 1px solid var(--hairline); background: var(--page);
}
.cg-head .nm { font-size: 13.5px; font-weight: 750; }
.cg-head .prog { margin-left: auto; font-size: 11px; font-weight: 650; color: var(--ink-2); }
.ben {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 13px;
  border-bottom: 1px solid var(--hairline); width: 100%; text-align: left;
}
.ben:last-child { border-bottom: none; }
.box { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--muted); flex: 0 0 auto; margin-top: 1px; }
.box.ck { background: var(--good); border-color: var(--good); position: relative; }
.box.ck::after { content: "✓"; color: #fff; font-size: 13px; font-weight: 800; position: absolute; top: -1px; left: 3.5px; }
.ben .t { font-size: 13px; font-weight: 600; }
.ben.done .t { color: var(--muted); text-decoration: line-through; }
.ben .s { font-size: 10.5px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.ben .s b { color: var(--good-text); font-weight: 650; }
.amt { margin-left: auto; font-size: 13px; font-weight: 750; text-align: right; white-space: nowrap; }
.ben.done .amt { color: var(--muted); }
.due {
  display: inline-flex; align-items: center; gap: 3px; font-size: 9.5px; font-weight: 700;
  border-radius: 99px; padding: 2px 7px; margin-left: 6px; vertical-align: 1px; white-space: nowrap;
}
.due.warn { background: var(--warn-bg); color: var(--warn-ink); }
.due.crit { background: var(--crit-bg); color: var(--crit-ink); }
.ben.action .t { font-weight: 700; }
.sectitle { font-size: 11px; font-weight: 750; letter-spacing: .06em; color: var(--muted); padding: 6px 6px 0; }

/* card-linked offers — same row rhythm as the to-dos, but the row holds a link */
.ben.offer .t { font-weight: 700; }
.ben.offer.done .t { color: var(--muted); text-decoration: line-through; }
.boxbtn { padding: 0; flex: 0 0 auto; margin-top: 1px; display: block; }
.boxbtn .box { display: block; }
.olink {
  margin-left: auto; align-self: center; font-size: 11px; font-weight: 700; text-decoration: none;
  color: var(--accent-deep); background: var(--accent-wash); border-radius: 99px;
  padding: 6px 11px; white-space: nowrap;
}

/* ---------- my cards ---------- */
.mycard {
  display: flex; align-items: center; gap: 11px; background: var(--surface);
  border: 1px solid var(--hairline); border-radius: 14px; padding: 11px 13px;
  width: 100%; text-align: left;
}
.mycard.sock { opacity: .6; }
.art { width: 46px; height: 30px; border-radius: 6px; flex: 0 0 auto; }
.mycard .nm { font-size: 13.5px; font-weight: 700; }
.mycard .st { font-size: 11.5px; color: var(--ink-2); margin-top: 2px; line-height: 1.35; }
.mycard .st b { font-weight: 700; }
.mycard .chev { margin-left: auto; color: var(--muted); font-size: 16px; }
.addbtn {
  border: 1.5px dashed var(--accent); color: var(--accent-deep); border-radius: 14px;
  padding: 13px; text-align: center; font-size: 13.5px; font-weight: 700;
  background: var(--accent-wash); width: 100%;
}
.addhint { font-size: 10.5px; color: var(--muted); text-align: center; margin-top: -4px; }
.syncbox { background: var(--surface); border: 1px solid var(--hairline); border-radius: 16px; padding: 13px; }
.syncbox .k { font-size: 11px; font-weight: 700; color: var(--ink-2); letter-spacing: .06em; }
.syncbox .code { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.syncbox .cd {
  font-size: 17px; font-weight: 800; letter-spacing: .04em; background: var(--page);
  border: 1px solid var(--hairline); border-radius: 10px; padding: 8px 12px;
}
.syncbox .cp { margin-left: auto; background: var(--ink); color: var(--page); font-size: 12px; font-weight: 700; border-radius: 10px; padding: 9px 14px; }
.syncbox .s { font-size: 10.5px; color: var(--muted); margin-top: 8px; line-height: 1.4; }
.syncrow { display: flex; gap: 8px; margin-top: 8px; }
.syncrow input {
  flex: 1; min-width: 0; background: var(--page); border: 1px solid var(--hairline);
  border-radius: 10px; padding: 9px 11px; font-size: 13px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; outline: none;
}

/* ---------- bottom nav ---------- */
.nav {
  display: flex; border-top: 1px solid var(--hairline); background: var(--surface);
  padding: 8px 8px calc(14px + env(safe-area-inset-bottom)); position: sticky; bottom: 0;
}
.nav button { flex: 1; text-align: center; font-size: 10.5px; font-weight: 650; color: var(--muted); padding: 4px 0; }
.nav button.on { color: var(--accent-deep); }
.nav .ic { font-size: 18px; display: block; margin-bottom: 2px; }

/* ---------- first run ---------- */
.hero { padding: 22px 8px 4px; }
.hero h3 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.hero p { font-size: 13px; color: var(--ink-2); margin-top: 8px; line-height: 1.45; }
.pick {
  display: flex; align-items: center; gap: 10px; background: var(--surface);
  border: 1px solid var(--hairline); border-radius: 13px; padding: 10px 12px; width: 100%;
  text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pick.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent-wash) 45%, var(--surface)); }
.pick .pkbody { min-width: 0; flex: 1; }
.pick .nm { font-size: 13px; font-weight: 650; }
.pick .iss { font-size: 10.5px; color: var(--muted); }
.pick .ck { margin-left: auto; width: 20px; height: 20px; border-radius: 99px; border: 1.5px solid var(--hairline); flex: 0 0 auto; }
.pick.on .ck { background: var(--accent); border-color: var(--accent); position: relative; }
.pick.on .ck::after { content: "✓"; color: #fff; font-size: 12px; font-weight: 800; position: absolute; top: 0; left: 3.5px; }
.pick .cnt { font-size: 10px; font-weight: 700; color: var(--muted); margin-left: auto; margin-right: 4px; white-space: nowrap; }
.pick .copies {
  font-size: 10.5px; font-weight: 700; color: var(--accent-deep); background: var(--page);
  border: 1px solid var(--accent); border-radius: 99px; padding: 4px 9px; margin-left: auto;
  white-space: nowrap; flex: 0 0 auto;
}
.pick .stepper {
  display: inline-flex; align-items: center; gap: 2px; margin-left: auto; flex: 0 0 auto;
  background: var(--page); border: 1px solid var(--accent); border-radius: 99px; padding: 2px;
}
.pick .stepper b { font-size: 12px; font-weight: 800; min-width: 16px; text-align: center; color: var(--accent-deep); }
.stepbtn {
  width: 24px; height: 24px; border-radius: 99px; font-size: 15px; font-weight: 800; line-height: 1;
  color: var(--accent-deep); background: var(--accent-wash);
}
.stepbtn:disabled { opacity: .35; }
.badge {
  display: inline-block; font-size: 8.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  border-radius: 99px; padding: 2px 6px; margin-left: 6px; vertical-align: 1px; white-space: nowrap;
}
.badge.gf { background: var(--warn-bg); color: var(--warn-ink); }
.badge.so { background: var(--accent-wash); color: var(--accent-deep); }
.badge.uv { background: transparent; color: var(--muted); border: 1px solid var(--hairline); font-weight: 700; }
.grouphd {
  font-size: 10px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); padding: 8px 6px 1px;
}
.grouphd:first-child { padding-top: 2px; }
.cta {
  background: var(--accent); color: #fff; border-radius: 14px; text-align: center;
  font-size: 15px; font-weight: 800; padding: 14px; box-shadow: 0 8px 18px rgba(42,120,214,.3); width: 100%;
}
.cta:disabled { opacity: .45; box-shadow: none; }
.ghostbtn {
  border: 1px solid var(--hairline); background: var(--surface); color: var(--ink-2);
  border-radius: 12px; padding: 11px; font-size: 13px; font-weight: 700; width: 100%;
}
.scrolllist { display: flex; flex-direction: column; gap: 7px; }

/* ---------- sheet ---------- */
.sheet-wrap {
  position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(11,11,11,.45);
}
.sheet {
  background: var(--page); width: 100%; max-width: 560px; max-height: 92dvh;
  border-radius: 22px 22px 0 0; display: flex; flex-direction: column; overflow: hidden;
  animation: rise .18s ease-out;
}
@keyframes rise { from { transform: translateY(14px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px;
  border-bottom: 1px solid var(--hairline); background: var(--surface);
}
.sheet-head h4 { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; flex: 1; }
.sheet-head .x { font-size: 20px; color: var(--muted); line-height: 1; padding: 2px 4px; }
.sheet-body { overflow-y: auto; padding: 12px 14px 16px; display: flex; flex-direction: column; gap: 10px; -webkit-overflow-scrolling: touch; }
.sheet-foot { padding: 10px 14px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--hairline); background: var(--surface); display: flex; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > .lab { font-size: 12.5px; font-weight: 750; }
.field > .help { font-size: 11px; color: var(--muted); line-height: 1.45; }
.field input[type=text], .field input[type=number], .field select {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: 11px;
  padding: 10px 12px; font-size: 14px; outline: none; width: 100%;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.toggle { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--hairline); border-radius: 12px; padding: 11px 12px; }
.toggle .lab { font-size: 13px; font-weight: 650; flex: 1; }
.sw { width: 44px; height: 26px; border-radius: 99px; background: var(--hairline); position: relative; flex: 0 0 auto; transition: background .15s; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 99px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: left .15s; }
.sw.on { background: var(--good); }
.sw.on::after { left: 21px; }
.dangerbtn { color: var(--critical); border: 1px solid var(--hairline); background: var(--surface); border-radius: 12px; padding: 11px; font-size: 13px; font-weight: 700; width: 100%; }
.kv { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--ink-2); padding: 3px 2px; }
.kv b { font-weight: 700; color: var(--ink); }
.empty { text-align: center; color: var(--muted); font-size: 12.5px; padding: 26px 18px; line-height: 1.5; }
.toast {
  position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%);
  background: var(--ink); color: var(--page); font-size: 12.5px; font-weight: 650;
  padding: 10px 16px; border-radius: 99px; z-index: 60; box-shadow: 0 6px 18px rgba(0,0,0,.3);
  max-width: 90vw; text-align: center;
}
