/* Hand-written admin styles — no frameworks. Theme-aware (light/dark). */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e2e5ea;
  --text: #1c2430;
  --muted: #67707c;
  --accent: #2b6cb0;
  --accent-weak: #e8f0fb;
  --danger: #c53030;
  --good: #2f855a;
  --mediocre: #b7791f;
  --poor: #c53030;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --surface: #1b212a;
    --border: #2c343f;
    --text: #e6e9ee;
    --muted: #98a2b0;
    --accent: #63a4e6;
    --accent-weak: #1e2b3a;
    --danger: #f08a8a;
    --good: #7fc9a3;
    --mediocre: #e0b463;
    --poor: #f08a8a;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.nav .brand { font-weight: 700; font-size: 16px; color: var(--text); }
.nav form { margin: 0; }

.container { max-width: 1100px; margin: 24px auto; padding: 0 24px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; color: var(--text); }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
tbody tr:hover { background: var(--accent-weak); }
.table-scroll { overflow-x: auto; }

.btn {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn:hover { text-decoration: none; opacity: .92; }

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.filters select, .filters input, input[type=text], input[type=date] {
  padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font-size: 14px;
}

.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.summary-grid .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.summary-grid .v { font-size: 16px; font-weight: 600; margin-top: 2px; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.good { background: rgba(47,133,90,.15); color: var(--good); }
.badge.mediocre { background: rgba(183,121,31,.15); color: var(--mediocre); }
.badge.poor { background: rgba(197,48,48,.15); color: var(--poor); }
.badge.derived { background: var(--accent-weak); color: var(--accent); }

.plot img { max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: 8px; }
.placeholder { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: 8px; }

audio { width: 100%; margin-top: 8px; }

.login-wrap { max-width: 380px; margin: 12vh auto; }
.error { color: var(--danger); margin: 8px 0 0; font-size: 14px; }
.pagination { display: flex; gap: 12px; align-items: center; margin-top: 14px; }

.pill-links a { margin-right: 12px; }

/* ---------------------------------------------------------------- root bar */
.nav .areas { display: flex; gap: 2px; margin-left: 18px; flex: 1; }
.nav .area {
  padding: 6px 10px; border-radius: 7px; color: var(--muted);
  font-weight: 500; font-size: 14px;
}
.nav .area:hover { background: var(--accent-weak); color: var(--text); text-decoration: none; }
.nav .area.current { background: var(--accent-weak); color: var(--accent); }
.nav .whoami { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); }
.hint { background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
        padding: 10px 12px; font-size: 12px; overflow-x: auto; }
.secret { background: var(--accent-weak); border: 1px solid var(--accent); border-radius: 8px;
          padding: 12px 14px; font-size: 17px; letter-spacing: .04em; overflow-wrap: anywhere; }
.card.warn { border-color: var(--mediocre); }
.row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }

/* ------------------------------------------------------------ product map */
.subnav { display: flex; flex-wrap: wrap; gap: 2px; margin: 0 0 18px; border-bottom: 1px solid var(--border); }
.subnav a { padding: 8px 12px; color: var(--muted); font-size: 14px; border-bottom: 2px solid transparent; }
.subnav a:hover { color: var(--text); text-decoration: none; }
.subnav a.current { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.subnav .n { font-size: 12px; opacity: .7; margin-left: 3px; }

.lede { max-width: 68ch; font-size: 15px; }
.crumb { font-size: 13px; color: var(--muted); margin: 0 0 4px; }
.prose { max-width: 68ch; }
.prose p { margin: 0 0 10px; }
.prose code, .note code, .item code { background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; padding: 0 4px; font-size: 12px; }
h1 .id, .item .id { font-family: ui-monospace, Menlo, monospace; font-size: 13px; color: var(--muted); }

/* the chain strip: where an item sits, from persona through to metric */
.trace { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
         border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
         overflow: hidden; margin: 14px 0 20px; }
.trace .col { padding: 10px 11px; border-right: 1px solid var(--border);
              display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.trace .col:last-child { border-right: 0; }
.trace .col.here { background: var(--accent-weak); }
.trace .lbl { font-size: 10px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-family: ui-monospace, Menlo, monospace; font-size: 12px; padding: 2px 6px;
        border-radius: 5px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
a.chip:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.chip.self { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.chip.gapchip { border-style: dashed; border-color: var(--mediocre); color: var(--mediocre);
                background: transparent; font-family: inherit; }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600;
        padding: 2px 9px; border-radius: 999px; background: var(--accent-weak); color: var(--accent); }
.pill.implemented, .pill.good { background: rgba(47,133,90,.15); color: var(--good); }
.pill.partial, .pill.warn { background: rgba(183,121,31,.15); color: var(--mediocre); }
.pill.planned, .pill.none { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
.pill.gap { background: rgba(197,48,48,.12); color: var(--poor); }
.pill.hyp { background: transparent; color: var(--muted); border: 1px dashed var(--muted); font-weight: 500; }

ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain .item { display: grid; grid-template-columns: 5.5rem minmax(0,1fr) auto;
                 gap: 2px 14px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--border); }
ul.plain .item:last-child { border-bottom: 0; }
.item .t { font-weight: 500; overflow-wrap: anywhere; }
.item .sub { grid-column: 2 / -1; color: var(--muted); font-size: 13px; }
.item .end { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 12px; margin: 14px 0 24px; }
.tile { border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
        padding: 13px 15px; display: flex; flex-direction: column; gap: 2px; color: var(--text); }
a.tile:hover { border-color: var(--accent); text-decoration: none; }
.tile .num { font-size: 26px; font-weight: 700; }
.tile .cap { font-size: 13px; color: var(--muted); }

.two-col { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(0,1fr); gap: 26px; align-items: start; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); }
.legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }
.legend .dot.good { background: var(--good); }
.legend .dot.warn { background: var(--mediocre); }
.legend .dot.none { background: var(--muted); }

.evidence { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px,1fr)); gap: 10px; margin: 10px 0; }
.evidence > div { border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px;
                  background: var(--bg); display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.evidence .lbl { font-size: 10px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.evidence .note { font-size: 12px; color: var(--muted); }

.step { display: grid; grid-template-columns: 2.4rem minmax(0,1fr); gap: 0 14px; }
.step .rail { display: flex; flex-direction: column; align-items: center; }
.step .dot { width: 2rem; height: 2rem; border-radius: 50%; background: var(--accent); color: var(--surface);
             display: grid; place-items: center; font-size: 13px; font-weight: 600; }
.step .stepbody { padding-bottom: 22px; }
.cps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 9px; margin: 8px 0; }
.cps > div { background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
             padding: 9px 11px; font-size: 14px; }
.cps .lbl { display: block; font-size: 10px; letter-spacing: .09em; text-transform: uppercase;
            color: var(--muted); margin-bottom: 3px; }

@media (max-width: 860px) {
  .trace { grid-template-columns: minmax(0,1fr); }
  .trace .col { border-right: 0; border-bottom: 1px solid var(--border); flex-direction: row; align-items: baseline; gap: 12px; }
  .trace .col:last-child { border-bottom: 0; }
  .trace .lbl { flex: 0 0 5.5rem; }
  .two-col { grid-template-columns: minmax(0,1fr); }
  .nav .areas { margin-left: 0; width: 100%; overflow-x: auto; }
}

/* ------------------------------------------------------------- comments */
.comments .comment { border-top: 1px solid var(--border); padding: 10px 0; }
.comments .comment:first-of-type { border-top: 0; }
.comments .comment.resolved .txt { color: var(--muted); }
.comments .meta { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline;
                  font-size: 13px; color: var(--muted); }
.comments .txt { white-space: pre-wrap; max-width: 68ch; overflow-wrap: anywhere; margin-top: 3px; }
.comments form.inline { display: inline; }
.addcomment { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.addcomment textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--border);
                       border-radius: 8px; background: var(--surface); color: var(--text);
                       font: inherit; resize: vertical; }
.tiny { font-size: 12px; }
.nav .count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px;
              background: var(--accent); color: var(--surface); font-size: 11px;
              font-weight: 700; text-align: center; }
