/* Site Review Tool - single stylesheet, no build step, no external assets. */

:root {
  --bg:        #f5f6f8;
  --panel:     #ffffff;
  --panel-2:   #fafbfc;
  --ink:       #16181d;
  --ink-2:     #5b6270;
  --ink-3:     #8a91a0;
  --line:      #e2e5ea;
  --line-2:    #cfd4dc;
  --accent:    #2f6df6;
  --accent-ink:#ffffff;
  --high:      #d5362c;
  --med:       #c8790a;
  --low:       #6b7280;
  --todo:      #2f6df6;
  --info:      #7c7f88;
  --ok:        #12864a;
  --radius:    10px;
  --shadow:    0 1px 2px rgba(16,20,30,.05), 0 4px 14px rgba(16,20,30,.05);
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:      #14161a;
    --panel:   #1c1f25;
    --panel-2: #22262d;
    --ink:     #e8eaee;
    --ink-2:   #a2a9b6;
    --ink-3:   #767d8b;
    --line:    #2b3038;
    --line-2:  #3a414c;
    --accent:  #5b8dff;
    --high:    #ff7b6f;
    --med:     #ecab4a;
    --low:     #949bab;
    --todo:    #5b8dff;
    --info:    #8b929f;
    --ok:      #46c281;
    --shadow:  0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.25);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
}

code, .mono { font-family: var(--mono); font-size: .88em; }
a { color: var(--accent); }

/* ------------------------------------------------------------- topbar */

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .logo { font-size: 22px; line-height: 1; }
.brand strong { display: block; font-size: 15px; }
.brand small { display: block; color: var(--ink-3); font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.who { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.who input { width: 130px; }

/* ------------------------------------------------------------ controls */

input[type=text], input[type=number], input[type=search], textarea, select {
  font: inherit; color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: 7px;
  padding: 6px 9px;
}
input:focus-visible, textarea:focus-visible, button:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}

.btn {
  font: inherit; font-size: 13px;
  padding: 7px 13px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--high); border-color: color-mix(in srgb, var(--high) 45%, transparent); }
.btn.big { padding: 11px 22px; font-size: 15px; }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.check { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); }
.check.inline { white-space: nowrap; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
.field input { width: 100%; }
.field small { display: block; margin-top: 4px; font-size: 11.5px; color: var(--ink-3); }

/* --------------------------------------------------------- layout bits */

main { padding: 18px; max-width: 1500px; margin: 0 auto; }
.view[hidden] { display: none; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.card h1 { margin: 0 0 8px; font-size: 22px; }
.card h2 { margin: 0 0 8px; font-size: 17px; }
.lede { color: var(--ink-2); font-size: 13.5px; margin: 0 0 18px; max-width: 70ch; }
.hint { color: var(--ink-3); font-size: 12px; margin: 10px 0 0; }

.start { max-width: 720px; margin: 24px auto; }
.opts { margin: 6px 0 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.opts summary { cursor: pointer; padding: 9px 12px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.opts-grid { padding: 4px 14px 14px; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.opts-grid .check { grid-column: 1 / -1; }

.banner { padding: 10px 18px; font-size: 13px; border-bottom: 1px solid var(--line); }
.banner.error { background: color-mix(in srgb, var(--high) 12%, var(--panel)); color: var(--ink); }

/* ------------------------------------------------------------ progress */

.bar { height: 7px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 10px 0; }
.bar.big { height: 9px; }
.bar-fill { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .3s ease; }
.bar-fill.done { background: var(--ok); }

.crawl-log {
  list-style: none; margin: 14px 0; padding: 10px 12px; max-height: 260px; overflow: auto;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  font-family: var(--mono); font-size: 11.5px; color: var(--ink-2);
}
.crawl-log li { padding: 1px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------------------- project list */

.project-list { display: grid; gap: 10px; }
.project-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2);
  cursor: pointer;
}
.project-row:hover { border-color: var(--accent); }
.project-row .pr-main { flex: 1; min-width: 0; }
.project-row .pr-host { font-weight: 600; }
.project-row .pr-meta { font-size: 12px; color: var(--ink-3); }
.project-row .pr-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 99px;
  background: var(--line); color: var(--ink-2); white-space: nowrap;
}
.project-row .pr-badge.running { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent); }

/* ---------------------------------------------------------- todo head */

.todo-head { display: flex; gap: 20px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
.todo-head .summary { flex: 1; min-width: 280px; }
.todo-head h2 { margin: 0; font-size: 18px; }
.todo-actions { display: flex; gap: 8px; align-items: center; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-size: 11.5px; padding: 2px 9px; border-radius: 99px;
  border: 1px solid var(--line-2); color: var(--ink-2); background: var(--panel);
}
.chip.high { color: var(--high); border-color: color-mix(in srgb, var(--high) 40%, transparent); }
.chip.med  { color: var(--med);  border-color: color-mix(in srgb, var(--med) 40%, transparent); }
.chip.todo { color: var(--todo); border-color: color-mix(in srgb, var(--todo) 40%, transparent); }
.chip.ok   { color: var(--ok);   border-color: color-mix(in srgb, var(--ok) 40%, transparent); }

.menu { position: relative; }
.menu-body {
  display: none; position: absolute; right: 0; top: calc(100% + 4px); z-index: 30;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px;
  box-shadow: var(--shadow); min-width: 190px; overflow: hidden;
}
.menu-body.open { display: block; }
.menu-body a { display: block; padding: 9px 13px; font-size: 13px; color: var(--ink); text-decoration: none; }
.menu-body a:hover { background: var(--panel-2); }

/* ----------------------------------------------------------- toolbar */

.toolbar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 9px 12px; margin-bottom: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  position: sticky; top: 56px; z-index: 20;
}
.toolbar .spacer { flex: 1; }
.search { min-width: 220px; flex: 1 1 220px; max-width: 380px; }

.seg { display: flex; border: 1px solid var(--line-2); border-radius: 7px; overflow: hidden; }
.seg button {
  font: inherit; font-size: 12px; padding: 5px 10px;
  background: var(--panel-2); color: var(--ink-2);
  border: 0; border-right: 1px solid var(--line-2); cursor: pointer;
}
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }

.live { width: 8px; height: 8px; border-radius: 99px; background: var(--ok); opacity: .35; transition: opacity .2s; }
.live.pulse { opacity: 1; }

/* -------------------------------------------------------- todo layout */

.todo-body { display: grid; grid-template-columns: 260px 1fr; gap: 16px; align-items: start; }
@media (max-width: 980px) { .todo-body { grid-template-columns: 1fr; } .pagenav { display: none; } }

.pagenav {
  position: sticky; top: 108px; max-height: calc(100vh - 130px); overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 12.5px;
}
.nav-item:hover { background: var(--panel-2); }
.nav-item.active { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.nav-item .nv-path { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .nv-count { font-size: 11px; color: var(--ink-3); font-family: var(--mono); }
.nav-item.complete .nv-path { color: var(--ink-3); text-decoration: line-through; }
.nav-dot { width: 7px; height: 7px; border-radius: 99px; background: var(--line-2); flex: none; }
.nav-dot.has-high { background: var(--high); }
.nav-dot.complete { background: var(--ok); }

/* ------------------------------------------------------------ sections */

.todo-list { display: grid; gap: 12px; min-width: 0; }

.section {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.section.site { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }

.sec-head {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; cursor: pointer; background: var(--panel);
}
.sec-head:hover { background: var(--panel-2); }
.sec-caret { font-size: 11px; color: var(--ink-3); width: 10px; flex: none; transition: transform .15s; }
.section.open .sec-caret { transform: rotate(90deg); }
.sec-title { flex: 1; min-width: 0; }
.sec-title strong { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sec-title .sec-url {
  display: block; font-family: var(--mono); font-size: 11.5px; color: var(--ink-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sec-meta { display: flex; align-items: center; gap: 7px; flex: none; }
.status-pill {
  font-family: var(--mono); font-size: 11px; padding: 2px 7px; border-radius: 5px;
  background: var(--line); color: var(--ink-2);
}
.status-pill.s2 { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.status-pill.s3 { background: color-mix(in srgb, var(--med) 18%, transparent); color: var(--med); }
.status-pill.s4, .status-pill.s0 { background: color-mix(in srgb, var(--high) 18%, transparent); color: var(--high); }
.mini-bar { width: 54px; height: 5px; background: var(--line); border-radius: 99px; overflow: hidden; }
.mini-bar > i { display: block; height: 100%; background: var(--accent); }
.mini-bar > i.done { background: var(--ok); }
.sec-count { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); min-width: 44px; text-align: right; }

.sec-body { display: none; border-top: 1px solid var(--line); }
.section.open .sec-body { display: block; }

/* -------------------------------------------------------------- groups */

.group { border-bottom: 1px solid var(--line); }
.group:last-child { border-bottom: 0; }
.grp-head {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; background: var(--panel-2);
}
.grp-key {
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 4px; color: var(--accent-ink); background: var(--accent);
}
.grp-key.text     { background: #6b46c1; }
.grp-key.links    { background: #0f766e; }
.grp-key.requests { background: #b45309; }
.grp-key.site     { background: #334155; }
.grp-label { font-size: 13px; font-weight: 600; }
.grp-sum { font-size: 11.5px; color: var(--ink-3); flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grp-all { font-size: 11.5px; }

.items { list-style: none; margin: 0; padding: 0; }
.item { display: flex; gap: 10px; padding: 9px 14px; border-top: 1px solid var(--line); align-items: flex-start; }
.item:first-child { border-top: 0; }
.item:hover { background: var(--panel-2); }
.item.is-done .it-title { color: var(--ink-3); text-decoration: line-through; }
.item.is-done { opacity: .72; }

.item > input[type=checkbox] { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--ok); flex: none; cursor: pointer; }
.it-main { flex: 1; min-width: 0; }
.it-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.it-title { font-size: 13.5px; }
.sev {
  font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 1px 6px; border-radius: 4px; border: 1px solid currentColor; flex: none;
}
.sev.high { color: var(--high); }
.sev.med  { color: var(--med); }
.sev.low  { color: var(--low); }
.sev.todo { color: var(--todo); }
.sev.info { color: var(--info); }

.it-detail {
  margin: 5px 0 0; padding: 7px 10px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px;
  font-family: var(--mono); font-size: 11.5px; color: var(--ink-2);
  white-space: pre-wrap; word-break: break-word; max-height: 240px; overflow: auto;
}
.it-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 5px; }
.it-foot input[type=text] { font-size: 12px; padding: 3px 7px; }
.it-note  { flex: 1 1 260px; min-width: 160px; }
.it-owner { width: 120px; }
.it-by { font-size: 11px; color: var(--ink-3); }
.it-flag { font-size: 11.5px; padding: 3px 6px; }
.item.flag-blocked { box-shadow: inset 3px 0 0 var(--high); }
.item.flag-wontfix { box-shadow: inset 3px 0 0 var(--ink-3); }

.empty { padding: 26px; text-align: center; color: var(--ink-3); font-size: 13px; }

/* --------------------------------------------------------------- toast */

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: var(--ink); color: var(--bg);
  padding: 9px 16px; border-radius: 8px; font-size: 13px; z-index: 90;
  box-shadow: var(--shadow); max-width: 90vw;
}
.toast.err { background: var(--high); color: #fff; }

/* ------------------------------------------------------ sign-in gate */

.gate {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.gate-card {
  width: 100%; max-width: 400px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px;
}
.gate-brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; color: var(--ink-2); font-size: 14px; margin-bottom: 18px;
}
.gate-card h1 { margin: 0 0 6px; font-size: 20px; }
.gate-card .lede { margin-bottom: 18px; }
.btn.full { width: 100%; }

.gate-err {
  margin: 0 0 14px; padding: 9px 12px; font-size: 13px;
  background: color-mix(in srgb, var(--high) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--high) 40%, transparent);
  border-radius: 7px; color: var(--high);
}
.gate-warn {
  margin: 18px 0 0; padding: 9px 12px; font-size: 12.5px;
  background: color-mix(in srgb, var(--med) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--med) 35%, transparent);
  border-radius: 7px; color: var(--ink-2);
}
.gate-warn.err {
  background: color-mix(in srgb, var(--high) 12%, transparent);
  border-color: color-mix(in srgb, var(--high) 40%, transparent);
}

/* ------------------------------------------------------- account admin */

.user-list { display: grid; gap: 8px; margin-bottom: 22px; }
.user-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 13px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2);
}
.user-row .pr-main { flex: 1; min-width: 0; }
.user-row select { font-size: 12px; padding: 4px 7px; }

.card h3.sub { margin: 22px 0 10px; font-size: 14px; color: var(--ink-2); }
.user-form { display: flex; gap: 8px; flex-wrap: wrap; }
.user-form input { flex: 1 1 150px; min-width: 120px; }
.user-form select { flex: 0 0 auto; }

/* ------------------------------------------------ the copy, for reading */

.chip.copy { color: #6b46c1; border-color: color-mix(in srgb, #6b46c1 40%, transparent); }
@media (prefers-color-scheme: dark) { .chip.copy { color: #b39ddb; } }
.sev.copy { color: #6b46c1; }
@media (prefers-color-scheme: dark) { .sev.copy { color: #b39ddb; } }

.copy { border-top: 1px solid var(--line); }
.copy-head {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 14px; background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}
.copy-title { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2); }
.copy-sum { font-size: 11.5px; color: var(--ink-3); flex: 1; }
.copy-count { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }

.copy-list { display: block; }

.blk {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 14px; border-top: 1px solid var(--line);
}
.blk:first-child { border-top: 0; }
.blk:hover { background: var(--panel-2); }
.blk > input[type=checkbox] {
  margin-top: 3px; width: 16px; height: 16px; flex: none;
  accent-color: var(--ok); cursor: pointer;
}
.blk-main { flex: 1; min-width: 0; }

.blk-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 3px; }
.blk-tag {
  font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 1px 6px; border-radius: 4px;
  background: var(--line); color: var(--ink-2); flex: none;
}
.blk-tag.h { background: #6b46c1; color: #fff; }
.blk-tag.li, .blk-tag.blockquote { background: var(--line-2); }
.blk-words { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }
.blk-shared {
  font-size: 10.5px; padding: 1px 7px; border-radius: 99px;
  background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent);
}
.tell {
  font-size: 10.5px; padding: 1px 7px; border-radius: 99px;
  background: color-mix(in srgb, var(--med) 16%, transparent);
  color: var(--med); border: 1px solid color-mix(in srgb, var(--med) 30%, transparent);
}

/* The copy is meant to be read, so it gets real prose treatment. */
.blk-text {
  font-size: 14.5px; line-height: 1.62; color: var(--ink);
  white-space: pre-wrap; word-break: break-word;
  max-width: 78ch;
}
.blk-text.is-heading { font-weight: 650; font-size: 16px; }
.blk.is-done .blk-text { color: var(--ink-3); }
.blk.is-done { opacity: .62; }
.blk.flagged { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--med) 60%, transparent); }
.blk.flag-blocked { box-shadow: inset 3px 0 0 var(--high); }
.blk.flag-blocked .blk-text { color: var(--ink); }
.blk.flag-wontfix { box-shadow: inset 3px 0 0 var(--ink-3); }
.blk .it-foot { margin-top: 6px; }

/* ------------------------------------------------------ owner assignment */

.assign {
  display: flex; align-items: center; gap: 6px;
  padding-left: 10px; border-left: 1px solid var(--line);
}
.assign label { font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.assign select { font-size: 12px; padding: 4px 7px; max-width: 150px; }

select.it-owner {
  font-size: 12px; padding: 3px 7px; max-width: 130px;
  color: var(--ink-3);
}
select.it-owner.assigned { color: var(--ink); border-color: var(--ink-3); }
select.it-owner.is-mine {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, var(--panel-2));
  font-weight: 600;
}

/* --------------------------------------------------------------- the mark */

.logo {
  width: 22px; height: 22px; flex: none;
  color: var(--accent);
  display: block;
}
.gate-brand .logo { width: 18px; height: 18px; }
