/* CoreBlock team tracker — styled after the From The Forest playtest page. */
:root {
  --bg: #f3f5f1;
  --surface: #ffffff;
  --ink: #1d2620;
  --muted: #5d6b61;
  --line: #d9e0d8;
  --pine: #2f5a43;
  --soul: #127c86;
  --soul-soft: #dcf0f1;
  --pass: #2e7d4f;
  --pass-soft: #e1f2e7;
  --issue: #b4482f;
  --issue-soft: #f8e4de;
  --amber: #8a5a0b;
  --amber-soft: #f6ebd3;
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111713; --surface: #18201b; --ink: #e3ebe4; --muted: #95a59a; --line: #2a362e;
    --pine: #8fc4a3; --soul: #5fd0d8; --soul-soft: #143034;
    --pass: #6fcf95; --pass-soft: #16301f; --issue: #f08b70; --issue-soft: #3a1d16;
    --amber: #e8b75a; --amber-soft: #33270f;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--soul); }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0; text-wrap: balance; }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--soul); outline-offset: 2px; }

.skip { position: absolute; left: 12px; top: -48px; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 6px; z-index: 50; }
.skip:focus { top: 8px; }

.wrap { max-width: 900px; margin: 0 auto; padding: 28px 16px 72px; }

/* ---------- Top bar ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-in {
  max-width: 900px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; font: 700 1.05rem var(--font-display); color: var(--pine); text-decoration: none; }
.brand img { border-radius: 4px; background: #fff; }
.topbar nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.topbar nav a, .topbar nav button {
  font: 500 0.9rem var(--font-body); color: var(--muted); text-decoration: none;
  padding: 6px 10px; border-radius: 6px; background: none; border: 0; cursor: pointer;
}
.topbar nav a:hover, .topbar nav button:hover { color: var(--ink); background: var(--bg); }
.topbar nav a[aria-current="page"] { color: var(--ink); background: var(--bg); }
.topbar form { margin: 0; }

/* ---------- Page header ---------- */
.crumb { display: inline-block; font-size: 0.88rem; margin-bottom: 8px; text-decoration: none; }
.crumb:hover { text-decoration: underline; }
.page-h h1 { font-size: clamp(1.8rem, 5vw, 2.5rem); color: var(--pine); margin-bottom: 8px; }
.page-h > p { color: var(--muted); max-width: 62ch; }
.meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; font-size: 0.85rem; color: var(--muted); }
.meta b { color: var(--ink); font-weight: 600; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-block; font: 600 0.88rem var(--font-body); padding: 8px 14px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--pine); border-color: var(--pine); color: var(--bg); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--issue); border-color: var(--issue); }
.btn.small { padding: 5px 10px; font-size: 0.8rem; }

.form { display: grid; gap: 14px; }
.field { display: grid; gap: 5px; }
.field label, .field .label { font-weight: 600; font-size: 0.9rem; }
.field .hint { font-size: 0.82rem; color: var(--muted); }
input[type=text], input[type=password], input[type=search], select, textarea {
  font: 0.95rem var(--font-body); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--soul); outline: 2px solid var(--soul-soft); }
textarea { resize: vertical; min-height: 80px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .row2 { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.card + .card { margin-top: 16px; }
.card h2 { font-size: 1.2rem; margin-bottom: 12px; }

.notice { border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; border: 1px solid; }
.notice p + p { margin-top: 6px; }
.notice.is-ok { background: var(--pass-soft); border-color: var(--pass); }
.notice.is-error { background: var(--issue-soft); border-color: var(--issue); }
.notice.is-key { background: var(--amber-soft); border-color: var(--amber); }
.notice code { font-size: 0.95rem; }

code { font-family: var(--font-mono); font-size: 0.82rem; background: var(--soul-soft); color: var(--soul); padding: 1px 6px; border-radius: 4px; word-break: break-word; }
.items code { cursor: copy; }

/* ---------- Project list ---------- */
.projects { display: grid; gap: 12px; margin-top: 24px; }
.project-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; color: var(--ink); text-decoration: none; }
.project-card:hover { border-color: var(--muted); }
.project-card h2 { font-size: 1.25rem; color: var(--pine); margin-bottom: 4px; }
.project-card p { color: var(--muted); font-size: 0.9rem; }
.project-card .counts { margin-top: 10px; }
.project-card .track { margin-top: 8px; }

/* ---------- Sticky progress bar (from the playtest page) ---------- */
.bar { position: sticky; top: 0; z-index: 5; background: var(--bg); padding-block: 12px; margin-top: 20px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.bar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; justify-content: space-between; }
.counts { display: flex; flex-wrap: wrap; gap: 4px 14px; font-variant-numeric: tabular-nums; font-size: 0.9rem; }
.counts b { font-weight: 600; }
.c-pass b { color: var(--pass); } .c-issue b { color: var(--issue); } .c-open b { color: var(--amber); }
.track { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; display: flex; }
.track i { display: block; height: 100%; transition: width .3s ease; }
.track .tp { background: var(--pass); } .track .ti { background: var(--issue); }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters button { font: 500 0.85rem var(--font-body); padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.filters button[aria-pressed="true"] { background: var(--pine); border-color: var(--pine); color: var(--bg); }
.sync { font-size: 0.8rem; color: var(--muted); }

/* ---------- Sections ---------- */
.sec { margin-top: 26px; }
.sec > .head { all: unset; cursor: pointer; display: flex; align-items: baseline; gap: 12px; width: 100%; padding-block: 6px; }
.sec > .head:focus-visible { outline: 2px solid var(--soul); outline-offset: 3px; border-radius: 4px; }
.head h2 { font-size: 1.25rem; flex: 1; min-width: 0; }
.head .sc { font: 500 0.8rem var(--font-mono); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.head .chev { color: var(--muted); transition: transform .2s; }
.sec.closed .chev { transform: rotate(-90deg); }
.sec.closed .items, .sec.closed .how, .sec.closed .add { display: none; }
.how { margin: 4px 0 10px; color: var(--muted); font-size: 0.88rem; max-width: 70ch; }

.items { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; }
.item { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; padding: 11px 14px; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item[data-s="pass"] { background: var(--pass-soft); }
.item[data-s="issue"] { background: var(--issue-soft); }
.item.is-hidden { display: none; }
.txt { min-width: 0; }
.txt .t { font-weight: 500; }
.item[data-s="pass"] .t { color: var(--muted); }
.txt .d { font-size: 0.86rem; color: var(--muted); margin-top: 2px; }
.txt .by { font-size: 0.78rem; color: var(--muted); margin-top: 4px; }
.txt a.t { color: var(--ink); text-decoration: none; }
.txt a.t:hover { text-decoration: underline; }
.id { font: 500 0.78rem var(--font-mono); color: var(--muted); margin-right: 6px; }
.empty { padding: 14px; color: var(--muted); font-size: 0.9rem; }

.btns { display: flex; gap: 6px; align-items: flex-start; }
.btns button { font: 600 0.78rem var(--font-body); padding: 5px 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; }
.btns .bp[aria-pressed="true"] { background: var(--pass); border-color: var(--pass); color: var(--surface); }
.btns .bi[aria-pressed="true"] { background: var(--issue); border-color: var(--issue); color: var(--surface); }
.btns button:disabled { cursor: default; opacity: 0.7; }
.note { grid-column: 1 / -1; display: grid; gap: 6px; }
.note textarea { min-height: 54px; font-size: 0.88rem; border-color: var(--issue); }
.note-foot { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; font-size: 0.8rem; color: var(--muted); }

/* Issue rows (QA responses, bugs) */
.item.is-issue { grid-template-columns: 1fr auto; }
.resp { font-size: 0.88rem; margin-top: 4px; }
.resp.is-empty { color: var(--muted); font-style: italic; }
.pill { display: inline-block; font: 600 0.75rem var(--font-body); padding: 3px 9px; border-radius: 999px; white-space: nowrap; border: 1px solid; }
.pill.s-open { color: var(--amber); background: var(--amber-soft); border-color: var(--amber); }
.pill.s-active { color: var(--soul); background: var(--soul-soft); border-color: var(--soul); }
.pill.s-fixed { color: var(--pass); background: var(--pass-soft); border-color: var(--pass); }
.pill.s-closed { color: var(--muted); background: var(--bg); border-color: var(--line); }

.add { margin-top: 8px; }
.add summary { cursor: pointer; font-size: 0.88rem; font-weight: 600; color: var(--soul); padding: 4px 0; width: fit-content; }
.add .form { margin-top: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }

/* ---------- Item page ---------- */
.item-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 6px; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.timeline li { font-size: 0.9rem; }
.timeline .who { font-weight: 600; }
.timeline .when { color: var(--muted); font-size: 0.8rem; margin-left: 6px; }
.timeline .body { margin-top: 2px; white-space: normal; }
.timeline .log { color: var(--muted); }

/* ---------- Tables (team) ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { text-align: left; padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: middle; }
.table th { font-weight: 600; color: var(--muted); border-top: 0; }
.table form { display: inline-flex; gap: 6px; flex-wrap: wrap; margin: 0; }
.table select { width: auto; padding: 5px 8px; }
.table-scroll { overflow-x: auto; }

/* ---------- Sign-in ---------- */
.signin { max-width: 440px; margin: 6vh auto 0; }
.signin h1 { font-size: 1.8rem; color: var(--pine); margin-bottom: 6px; }
.signin > p { color: var(--muted); margin-bottom: 20px; }

.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); font-size: 0.85rem; padding: 6px 14px; border-radius: 999px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.on { opacity: 1; }

@media (max-width: 520px) {
  .item { grid-template-columns: 1fr; }
  .btns { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Rounds ---------- */
.round-type { font-size: 0.85rem; font-weight: 600; color: var(--soul); margin-bottom: 4px; }
.project-card h2 a { color: inherit; text-decoration: none; }
.project-card h2 a:hover { text-decoration: underline; }
.round-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.round-list a { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); text-decoration: none; background: var(--bg); }
.round-list a:hover { border-color: var(--muted); }
.rl-name { font-weight: 600; }
.rl-type { font-size: 0.82rem; color: var(--muted); }
.round-list .counts { font-size: 0.85rem; }
fieldset.field { border: 0; padding: 0; margin: 0; }
fieldset.field label, form > label { font-weight: 400; display: flex; gap: 8px; align-items: baseline; font-size: 0.92rem; }
.muted { color: var(--muted); font-style: italic; }

/* ---------- Publishing ---------- */
.publish-box {
  margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between;
}
.publish-box p { font-size: 0.9rem; }
.publish-box p + p { margin-top: 4px; }
.publish-box .dirty { color: var(--amber); font-weight: 600; }
.publish-box .clean { color: var(--pass); }
.publish-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.publish-actions form { margin: 0; }
.btn:disabled { opacity: 0.55; cursor: default; filter: none; }
.share-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.share-line input { flex: 1 1 280px; font-family: var(--font-mono); font-size: 0.8rem; }

/* ---------- Reviewer page ---------- */
.share-actions { display: flex; gap: 4px; }
.share-actions a, .share-actions button { font: 600 0.88rem var(--font-body); color: var(--pine); background: none; border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; cursor: pointer; text-decoration: none; }
.share-actions a:hover, .share-actions button:hover { border-color: var(--pine); }
.share-summary { margin-top: 12px; color: var(--ink); font-weight: 500; }
.share-sec { margin-top: 32px; }
.share-sec h2 { font-size: 1.3rem; margin-bottom: 10px; }
.share-table { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.share-table th, .share-table td { padding: 10px 12px; vertical-align: top; }
.share-table td.code { font: 500 0.8rem var(--font-mono); color: var(--muted); white-space: nowrap; }
.share-table td:nth-last-child(1) { min-width: 18ch; }
.share-foot { margin-top: 40px; font-size: 0.82rem; color: var(--muted); }

@media print {
  :root { --bg: #fff; --surface: #fff; --ink: #000; --muted: #444; --line: #bbb; color-scheme: light; }
  body { font-size: 10.5pt; }
  .topbar, .skip, .toast { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .page-h h1 { font-size: 20pt; }
  .share-sec { break-inside: auto; }
  .share-sec h2 { break-after: avoid; }
  .share-table { border-radius: 0; }
  .share-table tr { break-inside: avoid; }
  .table-scroll { overflow: visible; }
  .pill { border: 1px solid #888 !important; background: none !important; color: #000 !important; }
  a { color: #000; text-decoration: none; }
  @page { margin: 14mm; }
}

/* ---------- Approvals ---------- */
.badge { display: inline-block; min-width: 1.4em; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--issue); color: #fff; font-size: 0.75rem; font-weight: 600; text-align: center; }
.pending-line { flex-basis: 100%; font-size: 0.88rem; padding-top: 10px; border-top: 1px solid var(--line); color: var(--amber); }
.pending-line.is-rejected { color: var(--issue); }
.approval h2 a { color: inherit; text-decoration: none; }
.approval h2 a:hover { text-decoration: underline; }
.diff { list-style: none; margin: 10px 0 0; padding: 0; border: 1px solid var(--line); border-radius: 8px; }
.diff > li { padding: 10px 12px; border-top: 1px solid var(--line); font-size: 0.9rem; }
.diff > li:first-child { border-top: 0; }
.diff dl { margin: 6px 0 0; display: grid; gap: 4px; }
.diff dl div { display: grid; grid-template-columns: 6.5rem 1fr; gap: 8px; }
.diff dt { color: var(--muted); }
.diff dd { margin: 0; }
.diff .from { text-decoration: line-through; color: var(--muted); }
.diff .to { background: var(--pass-soft); padding: 0 3px; border-radius: 3px; }
.diff .arrow { color: var(--muted); }
.approval-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; margin-top: 16px; }
.approval-actions form { margin: 0; }
.approval-actions details { flex: 1 1 260px; }
.approval-actions summary { list-style: none; width: fit-content; }
.approval-actions summary::-webkit-details-marker { display: none; }
@media (max-width: 520px) { .diff dl div { grid-template-columns: 1fr; gap: 0; } }
