:root {
  --ink: #111;
  --muted: #777;
  --line: #e4e4e4;
  --bg: #fff;
  --soft: #f6f6f6;
  --err: #c0392b;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 15px/1.5 -apple-system, "PingFang SC", "Noto Sans SC", system-ui, sans-serif; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--ink); background: var(--ink); color: #fff; border-radius: 8px; padding: 7px 14px; }
button.small { padding: 4px 10px; font-size: 13px; }
button.ghost { background: none; border: 0; color: var(--ink); padding: 6px 10px; font-size: 18px; }
button.ghostb { background: #fff; color: var(--ink); }
button.danger { background: #fff; color: var(--err); border-color: var(--err); }
input, select, textarea { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #fff; width: 100%; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); }
.muted { color: var(--muted); font-size: 13px; }
.err { color: var(--err); font-size: 13px; min-height: 1em; }
.mt { margin-top: 18px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0; font-weight: 650; }
h3 { margin: 0 0 12px; font-size: 16px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login form { width: min(320px, 100%); display: grid; gap: 12px; }

.top { position: sticky; top: 0; z-index: 5; background: rgba(255,255,255,.96); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: space-between; padding: 8px 12px 4px; padding-top: max(8px, env(safe-area-inset-top)); }
.datebar { display: flex; align-items: center; }
.datebar .date { font-size: 16px; font-weight: 650; }
.live { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #ccc; margin-right: 8px; }
.live.on { background: #2e9e6b; }
.tabs { position: sticky; top: 46px; z-index: 4; background: #fff; display: flex; gap: 4px; padding: 0 12px; border-bottom: 1px solid var(--line); }
.tabs button { background: none; color: var(--muted); border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 8px 10px; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
main { max-width: 760px; margin: 0 auto; padding: 12px 12px 60px; }
#v-week { max-width: none; }
main:has(#v-week:not([hidden])) { max-width: 1280px; }

.card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.card-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; gap: 8px; }
.subh { font-size: 12px; color: var(--muted); margin: 12px 0 2px; }
.lab { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.row { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.row input[type=checkbox] { width: auto; }
.num { width: 70px !important; }
.stack { display: grid; gap: 8px; }
.grow { flex: 1; }

.now { border: 1px solid var(--ink); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.now .k { font-size: 12px; color: var(--muted); }
.now .t { font-size: 18px; font-weight: 650; margin-top: 2px; }
.now .s { font-size: 13px; color: var(--muted); }
.now .next { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 13px; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .chk { width: 22px; height: 22px; flex: none; border: 1.5px solid var(--ink); border-radius: 6px; background: #fff; padding: 0; display: grid; place-items: center; color: #fff; font-size: 14px; }
.list li.done .chk { background: var(--ink); }
.list li.done .tt { color: var(--muted); text-decoration: line-through; }
.list .tt { flex: 1; min-width: 0; cursor: pointer; }
.list .tt small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .tm { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.empty { color: var(--muted); font-size: 13px; padding: 6px 2px; }
.quick { display: flex; gap: 6px; margin-top: 10px; }
.quick #qaTime { width: 110px; flex: none; }
.quick button { flex: none; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.timeline li:last-child { border-bottom: 0; }
.timeline .tm { width: 92px; flex: none; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.timeline .bar { width: 3px; border-radius: 2px; flex: none; }
.timeline li.cur { background: var(--soft); margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 6px; }
.timeline li.past { opacity: .5; }
.timeline small { display: block; color: var(--muted); font-size: 12px; white-space: pre-line; }

.weekwrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.week { display: flex; min-width: 980px; position: relative; }
.week .axis { width: 44px; flex: none; position: relative; border-right: 1px solid var(--line); }
.week .tick { position: absolute; right: 6px; font-size: 11px; color: var(--muted); transform: translateY(-7px); font-variant-numeric: tabular-nums; }
.week .col { flex: 1; min-width: 0; border-right: 1px solid var(--line); }
.week .col:last-child { border-right: 0; }
.week .dh { height: 32px; line-height: 32px; text-align: center; font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--line); }
.week .dh.today { background: var(--ink); color: #fff; }
.week .lane { position: relative; background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 68px, #f0f0f0 68px, #f0f0f0 69px); }
.week .blk { position: absolute; left: 2px; right: 2px; border-radius: 5px; padding: 2px 5px; overflow: hidden; font-size: 11.5px; cursor: pointer; border: 1px solid rgba(0,0,0,.06); border-left-width: 3px; }
.week .blk b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.week .blk i { display: block; font-style: normal; color: #555; font-size: 11px; white-space: pre-line; }
.week .blk.tiny i { display: none; }
.week .blk:hover { outline: 1px solid var(--ink); }
.tablewrap { overflow-x: auto; }
table.tally { border-collapse: collapse; font-variant-numeric: tabular-nums; margin-top: 8px; }
.tally th, .tally td { border: 1px solid var(--line); padding: 4px 10px; text-align: center; font-size: 13px; }
.tally td.no { color: var(--err); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips label { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 13px; cursor: pointer; }
.chips input { width: auto; margin: 0; }
.chips label:has(input:checked) { border-color: var(--ink); background: var(--soft); }

pre { background: var(--soft); border-radius: 8px; padding: 10px; overflow-x: auto; font-size: 12px; white-space: pre-wrap; word-break: break-all; }

.sheet { border: 1px solid var(--line); border-radius: 14px; padding: 18px; width: min(440px, 94vw); max-height: 90vh; }
.sheet::backdrop { background: rgba(0,0,0,.25); }
.sheet-actions { display: flex; gap: 8px; margin-top: 14px; align-items: center; }
.sheet .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

@media (max-width: 600px) {
  body { font-size: 15px; }
  .card { padding: 12px; }
}
