/* 投了没 — a ledger of things sent into the dark. Cool slate ground, one steel
   accent, and colour reserved for two states only: something that's gone quiet,
   and something that came back. Every count is tabular so two rows compare. */
:root {
  --bg: #0d0f12;
  --panel: #161a20;
  --line: #232830;
  --ink: #e7eaef;
  --dim: #929aa8;
  --faint: #626b7a;
  --accent: #7fb3c8;
  --good: #6fbf8a;
  --bad: #e0756a;
  --warn: #dfb15a;
  --radius: 14px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
}
.hidden { display: none !important; }
b { font-weight: 600; }

.topbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: max(10px, env(safe-area-inset-top)) 12px 10px 12px;
  border-bottom: 1px solid var(--line); background: #11151a;
  position: sticky; top: 0; z-index: 10;
}
.mark { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid;
        place-items: center; font-weight: 700; color: #11151a;
        background: linear-gradient(140deg, #b6d7e4, var(--accent)); }
.titles { margin-right: auto; min-width: 0; }
.titles h1 { margin: 0; font-size: 17px; letter-spacing: .06em; }
.titles p { margin: 0; font-size: 11px; color: var(--faint);
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabs { display: flex; gap: 6px; }
.tab { position: relative; background: none; border: 1px solid transparent; color: var(--dim);
       padding: 7px 11px; border-radius: 10px; cursor: pointer; font: inherit; font-size: 14px; }
.tab.on { background: var(--panel); border-color: var(--line); color: var(--ink); }
.badge { margin-left: 5px; font-size: 11px; font-family: var(--mono);
         background: var(--accent); color: #11151a; border-radius: 999px; padding: 1px 6px; }
@media (max-width: 520px) { .tabs { flex-basis: 100%; } .tabs .tab { flex: 1 1 0; } }

main { padding: 14px 12px 24px; max-width: 780px; margin: 0 auto; }
input, button { font: inherit; font-family: inherit; }

.panel { background: var(--panel); border: 1px solid var(--line);
         border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.panel h2 { margin: 0 0 6px; font-size: 15px; }
.sub { color: var(--dim); font-size: 13px; }
.thin { color: var(--faint); font-size: 12.5px; }

.field { display: block; margin: 11px 0; }
.field > span { display: block; font-size: 12px; color: var(--dim); margin-bottom: 5px; }
.field input { width: 100%; padding: 11px 12px; background: #0b0d10; color: var(--ink);
               border: 1px solid var(--line); border-radius: 11px; }
.field input[type="date"] { font-variant-numeric: tabular-nums; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 460px) { .grid2 { grid-template-columns: 1fr; } }

.chips { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 6px; }
.chips .chip { flex: 1 1 auto; min-width: 66px; padding: 9px 10px; cursor: pointer;
               background: #0b0d10; color: var(--dim); border: 1px solid var(--line);
               border-radius: 999px; }
.chips .chip.on { color: var(--ink); border-color: var(--accent); background: #16222a; }

.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.row > button { flex: 1 1 0; min-width: 110px; }
.primary, .ghost { min-height: 46px; padding: 10px 14px; cursor: pointer; border-radius: 11px;
                   border: 1px solid var(--line); background: #1c222b; color: var(--ink); }
.primary { background: var(--accent); color: #11151a; font-weight: 700; border-color: transparent; }
.primary.big { width: 100%; margin-top: 6px; min-height: 52px; font-size: 17px; }
.primary:active, .ghost:active { filter: brightness(1.2); }

/* ---------- items ---------- */
.item { border-top: 1px solid var(--line); padding: 12px 0; }
.item:first-of-type { border-top: none; }
.item.dead { opacity: .6; }
.item.done { opacity: .75; }
.item .head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.item .head b { font-size: 15px; }
.item .meta { font-size: 12.5px; color: var(--faint); margin-top: 4px; }
.item .meta.warn { color: var(--warn); }
.chip { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: #0b0d10;
        border: 1px solid var(--line); color: var(--dim); white-space: nowrap; }
.chip.good { color: var(--good); border-color: #2d4a37; }

.acts { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 9px; }
.acts button { flex: 1 1 0; min-width: 74px; min-height: 40px; border-radius: 10px;
               border: 1px solid var(--line); background: #1c222b; color: var(--ink); cursor: pointer; }
.acts .up { border-color: #2f4a58; color: var(--accent); }
.acts .end { color: var(--dim); }
.acts .drop { flex: 0 0 auto; min-width: 0; background: none; border: none; color: var(--faint);
              font-size: 18px; padding: 0 8px; }

.verdict { padding: 14px 15px; border-radius: 12px; margin-bottom: 14px; font-size: 14.5px;
           background: var(--panel); border: 1px solid var(--line); }
.verdict > b { display: block; font-size: 16px; margin-bottom: 4px; }
.verdict.bad  { border-color: #4a302c; background: #211816; }
.verdict.warn { border-color: #4a3d24; background: #211d16; }
.verdict.good { border-color: #2d4a37; background: #16211a; }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 520px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }
.stat { background: #0b0d10; border: 1px solid var(--line); border-radius: 11px;
        padding: 10px; text-align: center; }
.stat .n { font-size: 20px; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.stat .l { font-size: 11px; color: var(--faint); margin-top: 2px; }

/* ---------- the funnel ---------- */
.frow { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.frow .fl { flex: 0 0 96px; font-size: 13.5px; }
.frow .fl .fn { font-family: var(--mono); color: var(--faint); margin-left: 6px; }
.frow .fbar { flex: 1 1 auto; height: 12px; background: #0b0d10; border-radius: 4px; overflow: hidden; }
.frow .fbar > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.frow .fr { flex: 0 0 84px; text-align: right; font-family: var(--mono);
            font-variant-numeric: tabular-nums; font-size: 13px; color: var(--dim); }
.frow.worst .fbar > i { background: var(--bad); }
.frow.worst .fr { color: var(--bad); }

/* ---------- channels ---------- */
.crow { border-top: 1px solid var(--line); padding: 11px 0; }
.crow:first-of-type { border-top: none; }
.crow .ch { font-size: 14px; }
.crow .cv { font-size: 12.5px; color: var(--dim); margin: 3px 0 7px;
            font-variant-numeric: tabular-nums; }
/* Label above the track, never inside it. Text laid over a bar has to be
   readable both on the fill and off it, and the two halves of a comparison bar
   are by definition different colours — the label vanished on every short bar,
   which is exactly the case you most want to read. */
.cbars { display: grid; gap: 8px; }
.cb .cl { font-size: 11.5px; color: var(--dim); margin-bottom: 3px; }
.cb .cl b { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.cb .ct { height: 10px; background: #0b0d10; border-radius: 5px; overflow: hidden; }
.cb .ct > i { display: block; height: 100%; background: #3a4652; border-radius: 5px; }
.cb.alt .ct > i { background: var(--accent); }

.weeks { display: flex; align-items: flex-end; gap: 5px; height: 72px; margin: 10px 0 4px; }
.wk { flex: 1 1 0; background: var(--accent); border-radius: 3px 3px 0 0;
      height: var(--h); min-height: 3px; opacity: .85; }

.foot { text-align: center; padding: 6px 12px max(18px, env(safe-area-inset-bottom));
        color: var(--faint); font-size: 11px; }
