/* QA Desk — tokens (WCAG AA checked), light / dark / auto */
:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --surface: #ffffff;
  --surface-2: #efefea;
  --border: #dad9d2;
  --border-strong: #8c8b83;
  --text: #1b1e1c;
  --muted: #5a605c;
  --accent: #1d5fd1;
  --accent-ink: #ffffff;
  --accent-soft: #e5edfb;
  --works: #17683a; --works-bg: #e1f3e8;
  --problem: #b4231a; --problem-bg: #fce6e3;
  --skip: #565b58; --skip-bg: #ecece7;
  --working: #8a5300; --working-bg: #fdefcf;
  --check: #6334b8; --check-bg: #eee6fa;
  --solid-ink: #ffffff;
  --shadow: 0 1px 2px rgba(20, 24, 22, .06), 0 1px 1px rgba(20, 24, 22, .03);
  --shadow-up: 0 -1px 0 var(--border), 0 -6px 18px rgba(20, 24, 22, .06);
  --r-sm: 8px; --r: 12px; --r-pill: 999px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans Arabic", "Segoe UI Arabic", Tahoma, sans-serif;
  --tab-h: 60px;
  --side-w: 248px;
  --vz-1: #2a78d6; --vz-2: #eb6834;
  --vs-fix: #e34948; --vs-work: #eda100; --vs-check: #6250d6; --vs-done: #1baf7a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #101312; --surface: #181c1a; --surface-2: #212623; --border: #2d3330; --border-strong: #6b746f;
    --text: #e8ebe9; --muted: #a0a9a4; --accent: #7ba7f5; --accent-ink: #0b1220; --accent-soft: #1b2740;
    --works: #6fd39a; --works-bg: #14301f; --problem: #ff9d94; --problem-bg: #3b1b19;
    --skip: #a0a9a4; --skip-bg: #262b28; --working: #f2c25c; --working-bg: #35290f; --check: #c4a6f5; --check-bg: #2a1f42;
    --solid-ink: #0b1a12; --shadow: none; --shadow-up: 0 -1px 0 var(--border); --vz-1: #3987e5; --vz-2: #d95926; --vs-fix: #d04848; --vs-work: #c98500; --vs-check: #9085e9; --vs-done: #199e70;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101312; --surface: #181c1a; --surface-2: #212623; --border: #2d3330; --border-strong: #6b746f;
  --text: #e8ebe9; --muted: #a0a9a4; --accent: #7ba7f5; --accent-ink: #0b1220; --accent-soft: #1b2740;
  --works: #6fd39a; --works-bg: #14301f; --problem: #ff9d94; --problem-bg: #3b1b19;
  --skip: #a0a9a4; --skip-bg: #262b28; --working: #f2c25c; --working-bg: #35290f; --check: #c4a6f5; --check-bg: #2a1f42;
  --solid-ink: #0b1a12; --shadow: none; --shadow-up: 0 -1px 0 var(--border); --vz-1: #3987e5; --vz-2: #d95926; --vs-fix: #d04848; --vs-work: #c98500; --vs-check: #9085e9; --vs-done: #199e70;
}

/* base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--font); overflow-x: clip; -webkit-tap-highlight-color: transparent; }
[dir="rtl"] body { font-size: 17px; line-height: 1.7; }
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.25; margin: 0; font-weight: 600; }
p { margin: .4rem 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.i { width: 20px; height: 20px; flex: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
html.theming, html.theming * { transition: background-color .15s, border-color .15s, color .15s !important; }

/* header */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px; height: 56px; padding: 0 16px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text); text-decoration: none; white-space: nowrap; }
.logo { width: 26px; height: 26px; border-radius: 7px; background: url(favicon.svg) center / cover; flex: none; }
.logo.big { width: 44px; height: 44px; border-radius: 11px; display: block; margin-bottom: 12px; }
.tabbar { display: flex; gap: 4px; flex: 1; }
.tabbar a { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: var(--r-sm); color: var(--muted); text-decoration: none; font-size: .95rem; }
.tabbar a:hover { background: var(--surface-2); color: var(--text); }
.tabbar a.on { color: var(--text); background: var(--surface-2); font-weight: 600; }
.tabbar .ico { display: inline-flex; }
.top-right { display: flex; align-items: center; gap: 6px; margin-inline-start: auto; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 40px; padding: 0 10px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--muted); font: inherit; font-size: .9rem; cursor: pointer; list-style: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn::-webkit-details-marker { display: none; }
.usermenu, .more { position: relative; }
.usermenu summary { list-style: none; cursor: pointer; padding: 4px; border-radius: var(--r-pill); }
.usermenu summary::-webkit-details-marker { display: none; }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.menu { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); min-width: 200px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: 0 8px 28px rgba(0, 0, 0, .14); padding: 6px; z-index: 20; }
.menu a { display: flex; flex-direction: column; padding: 10px 12px; border-radius: var(--r-sm); color: var(--text); text-decoration: none; }
.menu a:hover { background: var(--surface-2); }
.menu .muted { font-size: .85rem; }
.menu-name { margin: 4px 12px 6px; font-weight: 600; }
body.logged-out .tabbar, body.logged-out #who { display: none; }

/* layout */
main { max-width: 760px; margin: 0 auto; padding: 24px 16px 96px; outline: none; }
main.wide { max-width: 1240px; }
.page-title { font-size: 1.6rem; margin: 4px 0 16px; overflow-wrap: anywhere; }
.lead { color: var(--muted); margin: -8px 0 16px; }
.section-title { font-size: 1.05rem; margin: 28px 0 10px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; margin-bottom: 8px; padding: 6px 0; }
.back:hover { color: var(--text); }
[dir="rtl"] .back .i, [dir="rtl"] #prev .i, [dir="rtl"] #next .i { transform: scaleX(-1); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 20px; margin: 0 0 16px; box-shadow: var(--shadow); }
.card h2 { font-size: 1.1rem; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 16px 0; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: var(--r-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--text)); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.good { background: var(--works); border-color: var(--works); color: var(--solid-ink); }
.btn.bad { background: var(--problem); border-color: var(--problem); color: var(--solid-ink); }
.btn.block { display: flex; width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.start { flex-direction: column; gap: 0; padding: 12px 18px; margin-top: 14px; }
.btn-sub { font-weight: 400; font-size: .85rem; opacity: .85; }
.link-btn { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; color: var(--accent); font: inherit; padding: 10px 4px; cursor: pointer; min-height: 44px; }
.link-btn:disabled { color: var(--muted); opacity: .5; cursor: default; }

/* forms */
label { display: block; font-weight: 600; margin: 16px 0 6px; font-size: .95rem; }
input, textarea, select { font: inherit; width: 100%; padding: 11px 12px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--text); }
textarea { min-height: 110px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); }
fieldset { border: 0; padding: 0; margin: 16px 0; }
legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.choice { display: flex; flex-wrap: wrap; gap: 8px; }
.choice.stack { flex-direction: column; }
.choice label { margin: 0; font-weight: 400; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 14px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; flex: 1 1 140px; }
.choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.choice input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.form-error { color: var(--problem); min-height: 1.2em; font-size: .9rem; }
.login { max-width: 400px; margin: 8vh auto 0; padding: 28px; }
.login h1 { font-size: 1.5rem; }
.login .btn { margin-top: 8px; }

/* pills, chips */
.pill { display: inline-flex; align-items: center; gap: 4px; border-radius: var(--r-pill); padding: 2px 10px; font-size: .8rem; font-weight: 600; white-space: nowrap; background: var(--skip-bg); color: var(--skip); }
.st-new, .st-reopened { background: var(--problem-bg); color: var(--problem); }
.st-in_progress { background: var(--working-bg); color: var(--working); }
.st-fixed { background: var(--check-bg); color: var(--check); }
.st-verified { background: var(--works-bg); color: var(--works); }
.st-wontfix, .st-skip { background: var(--skip-bg); color: var(--skip); }
.chip { display: inline-block; font-size: .78rem; padding: 1px 8px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--muted); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 0 12px; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip-btn { flex: none; display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: var(--r-pill); border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; font-size: .9rem; white-space: nowrap; }
.chip-btn.on { background: var(--text); border-color: var(--text); color: var(--bg); }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--r-pill); background: var(--surface); color: var(--muted); font-size: .78rem; font-weight: 600; }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.list.card { padding: 4px 0; }
.list li + li { border-top: 1px solid var(--border); }
.row-link { display: flex; align-items: center; gap: 12px; padding: 12px 0; color: var(--text); text-decoration: none; min-height: 56px; }
.list.card .row-link { padding-inline: 16px; }
.row-link:hover .row-title { color: var(--accent); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { font-weight: 600; overflow-wrap: anywhere; }
.row-meta { color: var(--muted); font-size: .85rem; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.row-meta .i { width: 15px; height: 15px; }
.tally { display: flex; gap: 4px; }
.empty-state { text-align: center; color: var(--muted); padding: 48px 16px; border: 1px dashed var(--border); border-radius: var(--r); }

/* home */
.queue h2 { display: flex; align-items: center; gap: 8px; }
.q-check { border-inline-start: 4px solid var(--check); }
.q-check .count { background: var(--check-bg); color: var(--check); }
.q-fix { border-inline-start: 4px solid var(--problem); }
.q-fix .count { background: var(--problem-bg); color: var(--problem); }
.projects { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.projects .card { margin: 0; }
.project-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.project-top a { color: var(--muted); }
.project-status { font-weight: 600; margin-top: 12px; }
.more summary { list-style: none; }

/* project page */
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
.known { margin: 10px 0 0; padding-inline-start: 20px; }
.known li { margin: 6px 0; }

/* runner */
body.in-run main { padding-bottom: 120px; }
.run-top { position: sticky; top: 56px; z-index: 5; background: var(--bg); margin: -24px -16px 16px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.run-top-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.run-top .back { margin: 0; padding: 4px 0; }
.run-count { font-weight: 600; font-variant-numeric: tabular-nums; }
.segs { display: flex; gap: 4px; margin-top: 8px; }
.seg-dot { flex: 1; height: 8px; min-width: 6px; border-radius: 4px; border: 0; padding: 0; background: var(--surface-2); cursor: pointer; position: relative; }
.seg-dot::after { content: ""; position: absolute; inset: -10px 0; }
.seg-dot.pass { background: var(--works); }
.seg-dot.fail { background: var(--problem); }
.seg-dot.skip { background: var(--border-strong); }
.seg-dot.cur { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.check-section { color: var(--muted); font-size: .875rem; margin: 0 0 6px; }
.check-title { font-size: 1.4rem; margin-bottom: 14px; }
.open-page { margin-bottom: 8px; }
ol.steps { margin: 12px 0; padding-inline-start: 0; list-style: none; counter-reset: s; }
ol.steps li { counter-increment: s; position: relative; padding-inline-start: 38px; margin: 10px 0; min-height: 26px; }
ol.steps li::before { content: counter(s); position: absolute; inset-inline-start: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-size: .85rem; font-weight: 600; display: grid; place-items: center; }
.expected { border-inline-start: 3px solid var(--works); background: var(--surface-2); border-radius: var(--r-sm); padding: 10px 14px; margin-top: 14px; }
.expected-label { font-size: .8rem; font-weight: 600; color: var(--works); margin: 0 0 2px; }
.tip { background: var(--working-bg); color: var(--text); border-radius: var(--r-sm); padding: 10px 14px; margin-top: 12px; font-size: .95rem; }
.bugslot:not(:empty) { border-top: 1px solid var(--border); margin-top: 18px; padding-top: 4px; }
.prevnext { display: flex; justify-content: space-between; }
.answerbar { position: fixed; inset-inline: 0; bottom: 0; z-index: 9; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); box-shadow: var(--shadow-up); }
@media (min-width: 761px) { .answerbar { max-width: 760px; margin: 0 auto; border-radius: var(--r) var(--r) 0 0; } }
.answer { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 56px; border-radius: var(--r); border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: 1.02rem; cursor: pointer; }
.answer .i { width: 22px; height: 22px; }
.a-pass .i { color: var(--works); }
.a-fail .i { color: var(--problem); }
.a-skip .i { color: var(--muted); }
.answer.on.a-pass { background: var(--works); border-color: var(--works); color: var(--solid-ink); }
.answer.on.a-fail { background: var(--problem); border-color: var(--problem); color: var(--solid-ink); }
.answer.on.a-skip { background: var(--skip); border-color: var(--skip); color: var(--solid-ink); }
.answer.on .i { color: inherit; }
.summary { text-align: center; }
.summary h1 { font-size: 1.35rem; margin: 8px 0 12px; }
.summary .list { text-align: start; margin: 12px 0 20px; }
.summary-line { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.big-check { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--works-bg); color: var(--works); }
.big-check .i { width: 30px; height: 30px; }

/* screenshots */
.drop { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 56px; margin-top: 12px; padding: 12px; border: 1.5px dashed var(--border-strong); border-radius: var(--r-sm); background: transparent; color: var(--muted); font: inherit; cursor: pointer; text-align: center; }
.drop:hover, .drop.over { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.shots { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.shots:empty { display: none; }
.shots img { width: 96px; height: 72px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--border); cursor: zoom-in; }
.shot-main { display: grid; gap: 10px; margin: -4px 0 12px; }
.shot-full { width: 100%; max-height: 520px; object-fit: contain; background: var(--surface-2); border-radius: var(--r-sm); border: 1px solid var(--border); cursor: zoom-in; }
.lightbox { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, .88); cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; }

/* problem page */
.bug-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bug-head + .page-title { margin-top: 8px; }
.field-label { font-size: .8rem; color: var(--muted); font-weight: 600; margin: 14px 0 2px; }
.field-view { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.url { overflow-wrap: anywhere; }
.foot { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 12px; }
.disclosure { margin-top: 12px; }
.disclosure summary { cursor: pointer; color: var(--muted); font-weight: 600; padding: 6px 0; }
.decide .btn { flex: 1 1 160px; min-height: 52px; }
.thread { margin-top: 8px; }
.msg { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 12px 16px; margin: 0 0 10px; max-width: 92%; }
.msg.mine { margin-inline-start: auto; background: var(--accent-soft); border-color: transparent; }
.msg-head { margin: 0 0 4px; }
.reply textarea { min-height: 80px; }
.reply .actions { margin-bottom: 0; }
.history { list-style: none; padding: 0; margin: 6px 0 0; }
.history li { padding: 6px 0; border-top: 1px solid var(--border); }

/* problems: page head, toggle */
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head .page-title { margin: 0; flex: 1 1 auto; }
.seg { display: inline-flex; padding: 3px; border-radius: var(--r-sm); background: var(--surface-2); }
.seg a { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 6px; color: var(--muted); text-decoration: none; font-size: .9rem; font-weight: 600; }
.seg a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg .i { width: 18px; height: 18px; }
.hint { color: var(--muted); font-size: .85rem; margin: 0 0 12px; }

/* kanban */
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: start; }
.col { background: var(--surface-2); border-radius: var(--r); padding: 10px; min-height: 160px; transition: box-shadow .12s; }
.col.over { box-shadow: inset 0 0 0 2px var(--accent); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 4px 4px 10px; }
.col-head h2 { font-size: .95rem; flex: 1; }
.col-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.col-fix .col-dot { background: var(--vs-fix); }
.col-work .col-dot { background: var(--vs-work); }
.col-check .col-dot { background: var(--vs-check); }
.col-done .col-dot { background: var(--vs-done); }
.col-body { display: grid; gap: 8px; }
.col-empty { color: var(--muted); font-size: .875rem; text-align: center; padding: 20px 0; margin: 0; }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px; box-shadow: var(--shadow); cursor: grab; }
.kcard.dragging { opacity: .45; }
.kcard-title { display: block; color: var(--text); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; line-height: 1.35; }
.kcard-title:hover { color: var(--accent); }
.kcard-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.meta-i { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-size: .8rem; }
.meta-i .i { width: 15px; height: 15px; }
.kcard-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; }
.kcard-when { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .8rem; }
.sev-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.sev-blocker .sev-dot { background: var(--problem); }
.sev-major .sev-dot { background: var(--working); }
.move { position: relative; display: inline-flex; align-items: center; gap: 4px; margin: 0; padding: 4px 8px; border-radius: 6px; color: var(--muted); font-size: .8rem; font-weight: 600; cursor: pointer; min-height: 32px; }
.move:hover, .move:focus-within { background: var(--surface-2); color: var(--text); }
.move .i { width: 16px; height: 16px; }
.move select { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; padding: 0; }
.colpick { display: none; }

/* toast */
#toast { position: fixed; inset-inline: 16px; bottom: 24px; margin: 0 auto; max-width: 420px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--text); color: var(--bg); padding: 10px 10px 10px 16px; border-radius: var(--r); box-shadow: 0 8px 24px rgba(0, 0, 0, .2); opacity: 0; transform: translateY(8px); pointer-events: none; z-index: 40; min-height: 48px; }
#toast.show { opacity: 1; transform: none; pointer-events: auto; }
body.in-run #toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
.toast-undo { background: transparent; border: 0; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; padding: 8px 10px; cursor: pointer; }

.prose p, .prose li { max-width: 68ch; }
.howto { padding-inline-start: 22px; }
.howto li { margin: 10px 0; }

/* phone */
@media (max-width: 760px) {
  .top { padding: 0 12px; gap: 8px; backdrop-filter: none; background: var(--surface); }
  .tabbar { position: fixed; inset-inline: 0; bottom: 0; z-index: 10; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding: 0 8px env(safe-area-inset-bottom); background: var(--surface); box-shadow: var(--shadow-up); justify-content: space-around; gap: 0; }
  .tabbar a { flex: 1; flex-direction: column; justify-content: center; gap: 2px; font-size: .75rem; padding: 6px 4px; border-radius: 0; background: none !important; }
  .tabbar a .i { width: 24px; height: 24px; }
  .tabbar a.on { color: var(--accent); }
  body.in-run .tabbar { display: none; }
  main { padding: 16px 16px calc(var(--tab-h) + 32px); }
  #toast { bottom: calc(var(--tab-h) + 12px + env(safe-area-inset-bottom)); }
  .page-title { font-size: 1.4rem; }
  .card { padding: 16px; }
  .run-top { margin: -16px -16px 12px; }
  .board { display: block; }
  .col { display: none; background: transparent; padding: 0; }
  .col.active { display: block; }
  .col-head { display: none; }
  .colpick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 3px; margin: 0 0 12px; background: var(--surface-2); border-radius: var(--r-sm); }
  .colpick a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 6px; color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 600; text-align: center; line-height: 1.2; }
  .colpick a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
  .colpick .count { order: -1; font-size: .95rem; background: none; min-width: 0; height: auto; color: inherit; }
  .colpick .col-dot { width: 6px; height: 6px; }
  .hint { display: none; }
  .kcard { cursor: default; }
  .move { min-height: 40px; padding: 6px 10px; border: 1px solid var(--border); }
  .new-btn span { display: none; }
  .new-btn { padding: 10px 12px; }
  .seg a span { display: none; }
  .decide { position: sticky; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); background: var(--bg); margin: 0 -16px; padding: 10px 16px; z-index: 4; }
}
@media (max-width: 380px) { .answer span { font-size: .95rem; } }

/* motion */
@media (prefers-reduced-motion: no-preference) {
  .btn, .answer, .chip-btn, .seg a, .colpick a, .kcard, .drop { transition: transform .12s ease, background-color .12s ease, border-color .12s ease, color .12s ease; }
  .btn:active, .answer:active, .chip-btn:active { transform: scale(.98); }
  #toast { transition: opacity .18s ease, transform .18s ease; }
  .kcard:hover { border-color: var(--border-strong); }
  .check { animation: rise .18s ease-out; }
  @keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}
button.row-link { width: 100%; background: none; border: 0; font: inherit; color: inherit; text-align: start; cursor: pointer; }
.summary .btn + .btn { margin-top: 8px; }

/* ---------- sidebar (desktop) ---------- */
.sidebar { display: none; }
@media (min-width: 1000px) {
  .sidebar { display: flex; flex-direction: column; position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--side-w); z-index: 11; padding: 16px 12px; background: var(--surface); border-inline-end: 1px solid var(--border); overflow-y: auto; }
  body:not(.logged-out) .top { display: none; }
  body:not(.logged-out) main { margin-inline-start: max(var(--side-w), calc(var(--side-w) + (100vw - var(--side-w) - 760px) / 2)); margin-inline-end: 0; }
  body:not(.logged-out) main.wide { max-width: calc(1180px + var(--side-w)); margin-inline: 0; padding-inline-start: calc(var(--side-w) + 32px); padding-inline-end: 32px; }
  body.in-run .answerbar { inset-inline-start: var(--side-w); }
  .run-top { top: 0; }
  #toast { inset-inline-start: calc(var(--side-w) + 16px); }
}
body.logged-out .sidebar { display: none; }
.side-brand { padding: 6px 10px 18px; font-size: 1.05rem; }
.side-nav, .side-sites { display: flex; flex-direction: column; gap: 2px; }
.side-link { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 8px 10px; border: 0; border-radius: var(--r-sm); background: none; color: var(--muted); font: inherit; font-size: .95rem; text-decoration: none; text-align: start; cursor: pointer; list-style: none; }
.side-link::-webkit-details-marker { display: none; }
.side-link:hover { background: var(--surface-2); color: var(--text); }
.side-link.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side-link span:not(.count):not(.avatar) { flex: 1; }
.side-link .count { background: var(--surface-2); }
.side-link.on .count { background: var(--surface); color: var(--accent); }
.side-title { margin: 22px 10px 6px; font-size: .78rem; font-weight: 600; color: var(--muted); }
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.side-foot .avatar { width: 26px; height: 26px; font-size: .85rem; }
.usermenu.up .menu { top: auto; bottom: calc(100% + 6px); inset-inline-start: 0; inset-inline-end: auto; }
.site-logo { width: 44px; height: 44px; border-radius: 10px; flex: none; object-fit: cover; background: var(--surface-2); }
.site-logo.sm { width: 22px; height: 22px; border-radius: 6px; }
.site-logo.lg { width: 56px; height: 56px; border-radius: 13px; }
.site-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.site-head .page-title { margin: 0; }

/* ---------- dashboard ---------- */
.dash-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.dash-head .lead { margin: -10px 0 0; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi-label { margin: 0; color: var(--muted); font-size: .85rem; font-weight: 600; }
.kpi-value { margin: 2px 0 0; font-size: 2rem; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi-sub { margin: 2px 0 0; color: var(--muted); font-size: .8rem; }
.kpi.alert .kpi-sub { color: var(--problem); font-weight: 600; }
.dash-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.dash-grid .card { margin: 0; min-width: 0; }
.chart-card h2 { margin-bottom: 2px; }
.chart { margin-top: 8px; min-height: 120px; }
.viz { display: block; overflow: visible; font-family: var(--font); }
.viz .grid { stroke: var(--border); stroke-width: 1; }
.viz .grid.base { stroke: var(--border-strong); }
.viz .axis { fill: var(--muted); font-size: 11px; }
.viz .row-label { fill: var(--text); font-size: 13px; font-weight: 600; }
.viz .track { fill: var(--surface-2); }
.viz .hit { fill: transparent; cursor: crosshair; }
.viz .crosshair { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; pointer-events: none; }
.viz .crosshair.on { opacity: 1; }
.viz .seg-label { font-size: 12px; font-weight: 600; pointer-events: none; }
.viz .seg-label.ink-light { fill: #fff; }
.viz .seg-label.ink-dark { fill: #0b0b0b; }
.vz-1 { fill: var(--vz-1); background: var(--vz-1); }
.vz-2 { fill: var(--vz-2); background: var(--vz-2); }
.vs-fix { fill: var(--vs-fix); background: var(--vs-fix); }
.vs-work { fill: var(--vs-work); background: var(--vs-work); }
.vs-check { fill: var(--vs-check); background: var(--vs-check); }
.vs-done { fill: var(--vs-done); background: var(--vs-done); }
.viz-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0 0; font-size: .85rem; color: var(--text); }
.viz-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.viz-tip { position: fixed; z-index: 60; pointer-events: none; opacity: 0; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-sm); box-shadow: 0 8px 24px rgba(0, 0, 0, .16); padding: 8px 10px; font-size: .85rem; min-width: 140px; }
.viz-tip.show { opacity: 1; }
.tip-row { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.tip-row b { margin-inline-start: auto; padding-inline-start: 12px; font-variant-numeric: tabular-nums; }
.viz-table { margin-top: 10px; }
.viz-table summary { cursor: pointer; color: var(--muted); font-size: .85rem; font-weight: 600; }
.table-wrap { overflow-x: auto; margin-top: 8px; }
.viz-table table { border-collapse: collapse; width: 100%; font-size: .85rem; }
.viz-table th, .viz-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: start; }
.viz-table td.num { text-align: end; font-variant-numeric: tabular-nums; }
.viz-table thead th { color: var(--muted); font-weight: 600; }
.sites { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.sites .card { margin: 0; display: flex; flex-direction: column; }
.site-top { display: flex; align-items: center; gap: 12px; }
.site-id { flex: 1; min-width: 0; }
.site-id h3 { font-size: 1.1rem; }
.site-id a { text-decoration: none; }
.site-tagline { color: var(--muted); margin: 12px 0 4px; }
.project-status.has-open { color: var(--problem); }
.lastcheck { margin-top: 6px; }
.mini-bar { display: flex; gap: 2px; height: 8px; margin: 6px 0 4px; border-radius: 4px; overflow: hidden; background: var(--surface-2); }
.mini-bar span { flex-basis: 0; }
.mb-pass { background: var(--vs-done); }
.mb-fail { background: var(--vs-fix); }
.mb-skip { background: var(--border-strong); }
.mb-w0 { flex-grow: 0; }
.mb-w1 { flex-grow: 1; }
.mb-w2 { flex-grow: 2; }
.mb-w3 { flex-grow: 3; }
.mb-w4 { flex-grow: 4; }
.mb-w5 { flex-grow: 5; }
.mb-w6 { flex-grow: 6; }
.mb-w7 { flex-grow: 7; }
.mb-w8 { flex-grow: 8; }
.mb-w9 { flex-grow: 9; }
.mb-w10 { flex-grow: 10; }
.mb-w11 { flex-grow: 11; }
.mb-w12 { flex-grow: 12; }
.mb-w13 { flex-grow: 13; }
.mb-w14 { flex-grow: 14; }
.mb-w15 { flex-grow: 15; }
.mb-w16 { flex-grow: 16; }
.mb-w17 { flex-grow: 17; }
.mb-w18 { flex-grow: 18; }
.mb-w19 { flex-grow: 19; }
.mb-w20 { flex-grow: 20; }
.mini-legend { display: flex; gap: 14px; flex-wrap: wrap; margin: 0; font-size: .82rem; color: var(--muted); }
.mini-legend span { display: inline-flex; align-items: center; gap: 4px; }
.mini-legend .i { width: 14px; height: 14px; }
.site-actions { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; margin-top: auto; padding-top: 14px; }
.site-actions .btn { flex-direction: column; gap: 0; margin: 0; }
.site-actions .btn-sub { font-weight: 400; }
.feed-card { margin-top: 16px; }
.feed-head { display: flex; justify-content: space-between; align-items: baseline; }
.feed { list-style: none; margin: 8px 0 0; padding: 0; }
.feed li { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.feed li:first-child { border-top: 0; }
.ev-ico { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; flex: none; background: var(--surface-2); color: var(--muted); }
.ev-ico .i { width: 17px; height: 17px; }
.ev-reported .ev-ico, .ev-reopened .ev-ico { background: var(--problem-bg); color: var(--problem); }
.ev-fixed .ev-ico { background: var(--check-bg); color: var(--check); }
.ev-verified .ev-ico, .ev-run-done .ev-ico { background: var(--works-bg); color: var(--works); }
.ev-in_progress .ev-ico { background: var(--working-bg); color: var(--working); }
.ev-run .ev-ico, .ev-comment .ev-ico { background: var(--accent-soft); color: var(--accent); }
.ev-body { min-width: 0; flex: 1; }
.ev-body p { margin: 0; overflow-wrap: anywhere; }
.ev-body a { font-weight: 600; text-decoration: none; }
.ev-quote { display: block; color: var(--muted); font-size: .9rem; margin-top: 2px; }
.ev-body .ev-meta { display: flex; gap: 8px; align-items: center; margin-top: 4px; color: var(--muted); font-size: .8rem; }
.ev-tally { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-size: .85rem; }
.ev-tally .i { width: 14px; height: 14px; }
.day-title { font-size: .85rem; color: var(--muted); margin: 18px 0 2px; }
.day-title:first-child { margin-top: 0; }
.more-link { display: inline-block; margin-top: 8px; font-weight: 600; text-decoration: none; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-value { font-size: 1.6rem; }
  .dash-head .btn span { display: none; }
  .tabbar a { font-size: .7rem; }
  .site-actions { grid-template-columns: 1fr; }
}
