/* Software Ledger. System fonts only: the page's CSP allows nothing but this site. */
:root {
  --ground: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --ink: #0f1720;
  --ink-2: #2b3440;
  --muted: #5b6675;
  --line: #e3e7ec;
  --line-2: #eef1f5;
  --field: #d5dbe3;
  --accent: #2457d6;
  --accent-ink: #ffffff;
  --accent-soft: #eef3ff;
  --accent-strong: #1a3f9e;
  --dark: #0f1720;
  --dark-2: #17212e;
  --dark-line: #26313f;
  --dark-muted: #a9b4c4;
  --good: #15803d;   --good-bg: #e9f6ee;  --good-line: #d7ebdd;
  --info: #1a3f9e;   --info-bg: #e7f0ff;
  --warn: #8a5a00;   --warn-bg: #fff4d6;
  --bad: #b4480f;    --bad-bg: #fff1e6;
  --quiet: #3b4552;  --quiet-bg: #f1f3f6;
  --review: #7a4bc4;
  --radius: 14px;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Space Grotesk", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0e131a; --surface: #151c25; --surface-2: #121820; --ink: #e8edf3; --ink-2: #c9d2dd; --muted: #93a0b0;
    --line: #253041; --line-2: #1d2633; --field: #334155;
    --accent: #6d9bff; --accent-ink: #0b1220; --accent-soft: #1a2740; --accent-strong: #a8c3ff;
    --dark: #0a0f15; --dark-2: #141b24; --dark-line: #222c39; --dark-muted: #93a0b0;
    --good: #6ad79a; --good-bg: #13291d; --good-line: #1f3d2b;
    --info: #a8c3ff; --info-bg: #182541;
    --warn: #f0c26b; --warn-bg: #33270e;
    --bad: #ffa06b; --bad-bg: #3a2212;
    --quiet: #c2ccd8; --quiet-bg: #222b37;
    --review: #c4a6f5;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #0e131a; --surface: #151c25; --surface-2: #121820; --ink: #e8edf3; --ink-2: #c9d2dd; --muted: #93a0b0;
  --line: #253041; --line-2: #1d2633; --field: #334155;
  --accent: #6d9bff; --accent-ink: #0b1220; --accent-soft: #1a2740; --accent-strong: #a8c3ff;
  --dark: #0a0f15; --dark-2: #141b24; --dark-line: #222c39; --dark-muted: #93a0b0;
  --good: #6ad79a; --good-bg: #13291d; --good-line: #1f3d2b;
  --info: #a8c3ff; --info-bg: #182541;
  --warn: #f0c26b; --warn-bg: #33270e;
  --bad: #ffa06b; --bad-bg: #3a2212;
  --quiet: #c2ccd8; --quiet-bg: #222b37;
  --review: #c4a6f5;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 15px/1.5 var(--sans); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { text-wrap: balance; }
a { color: var(--accent); }

/* ---- header and navigation ---- */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-in { max-width: 1280px; margin: 0 auto; padding: 0 32px; min-height: 64px; display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.logo-box { fill: var(--ink); }
.logo-lines { stroke: var(--surface); stroke-width: 2; stroke-linecap: round; fill: none; }
.logo-dot { fill: #5b8cff; }
.nav { display: flex; gap: 4px; flex: 1 1 auto; }
.tab { display: flex; align-items: center; gap: 8px; border: 0; background: none; color: var(--muted); padding: 8px 14px; border-radius: 8px; font-weight: 500; min-height: 40px; }
.tab svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: none; }
.tab:hover { color: var(--ink); background: var(--surface-2); }
.tab[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.count { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 8px; font-size: 12px; line-height: 20px; font-weight: 600; }
.tab[aria-pressed="false"] .count { background: var(--line); color: var(--ink-2); }
.top-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.when { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.weekpill { border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.link { background: none; border: 0; color: var(--accent); padding: 4px; font-weight: 600; font-size: 14px; }

main { max-width: 1280px; margin: 0 auto; padding: 36px 32px 72px; display: grid; gap: 24px; }

/* ---- shared pieces ---- */
.lede h1, .gate h1 { margin: 0; font-family: var(--display); font-size: 40px; line-height: 1.1; letter-spacing: -0.02em; font-weight: 700; }
.sub { margin: 6px 0 0; color: var(--muted); max-width: 64ch; }
.primary { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 10px; padding: 10px 18px; font-weight: 600; min-height: 44px; }
.primary:disabled { opacity: 0.6; cursor: default; }
.primary.small { padding: 6px 14px; min-height: 36px; font-size: 14px; }
.notice { margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--warn-bg); color: var(--warn); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--field); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 500; min-height: 36px; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); font-weight: 600; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; display: grid; gap: 14px; }
.card h2 { margin: 0; font-family: var(--display); font-size: 17px; font-weight: 600; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card.dark { background: var(--dark); color: #ffffff; border-color: var(--dark); }
.card.dark h2 { font-family: var(--sans); font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dark-muted); }
.ring { flex: none; }
.ring .track { fill: none; stroke: var(--line-2); }
.ring .arc { fill: none; stroke-linecap: round; }
.ring text { font-family: var(--display); font-weight: 700; fill: var(--ink); }
.card.dark .ring .track { stroke: var(--dark-line); }
.card.dark .ring text { fill: #ffffff; }

/* ---- sign-in ---- */
.gate { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 48px 24px; text-align: center; display: grid; gap: 16px; justify-items: center; margin-top: 24px; }
.gate h1 { font-size: 32px; }
.gate p { margin: 0; max-width: 46ch; color: var(--muted); }
.signin { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

/* ---- inbox ---- */
.inbox { display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; }
.inbox-main { flex: 999 1 620px; min-width: 0; display: grid; gap: 22px; }
.inbox-side { flex: 1 1 300px; min-width: 0; display: grid; gap: 20px; }
.groups { display: grid; gap: 20px; }
.qgroup { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.qhead { display: flex; align-items: center; gap: 16px; padding: 18px 22px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.qhead .who { flex: 1 1 240px; min-width: 0; }
.qhead h2 { margin: 0; font-family: var(--display); font-size: 20px; font-weight: 600; overflow-wrap: anywhere; }
.qhead .tags { margin-top: 2px; }
.qhead p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.qlist { list-style: none; margin: 0; padding: 0; }
.qitem { padding: 16px 22px; border-bottom: 1px solid var(--line-2); display: grid; gap: 8px; }
.qitem:last-child { border-bottom: 0; }
.qtop { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.qkind { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.qkind.decision { color: var(--bad); }
.qkind.field { color: var(--info); }
.qkind.review { color: var(--review); }
.qlabel { font-weight: 600; }
.qform { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.qform input, .qform textarea { flex: 1 1 280px; min-width: 0; border: 1px solid var(--field); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); min-height: 44px; resize: vertical; }
.qsaved { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--good-bg); border: 1px solid var(--good-line); border-radius: 10px; padding: 10px 12px; }
.qsaved svg { width: 16px; height: 16px; fill: none; stroke: var(--good); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.qsaved .answer { flex: 1 1 200px; white-space: pre-wrap; overflow-wrap: anywhere; }
.qsaved .state { font-size: 12px; color: var(--good); }
.qnote { font-size: 13px; color: var(--muted); }
.qnote.err { color: var(--bad); }
.qitem.blocked .qlabel { font-weight: 500; color: var(--muted); }
.qwhy { margin: -2px 0 0; font-size: 13px; color: var(--muted); max-width: 72ch; }
.qbg { margin: 0; font-size: 13px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; }
.qbody { display: grid; gap: 10px; }
.qsuggest { border: 1px dashed var(--accent); background: var(--accent-soft); border-radius: 10px; padding: 12px 14px; display: grid; gap: 6px; }
.qs-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.qs-tag { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent-strong); }
.qs-src { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.qs-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.qs-acts { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.link.quiet { color: var(--muted); }
.empty-state { background: var(--surface); border: 1px dashed var(--field); border-radius: var(--radius); padding: 32px; display: grid; justify-items: center; gap: 8px; text-align: center; color: var(--muted); }
.empty-state svg { width: 36px; height: 36px; fill: none; stroke: var(--good); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.empty-state p { margin: 0; max-width: 44ch; }
.org { display: flex; align-items: center; gap: 18px; }
.org .big { font-family: var(--display); font-size: 22px; font-weight: 700; }
.org .small { font-size: 13px; color: var(--dark-muted); }
.stats { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stats div { background: var(--dark-2); border-radius: 10px; padding: 10px 12px; }
.stats dt { font-size: 12px; color: var(--dark-muted); }
.stats dd { margin: 0; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stats dd.hot { color: #ffb27a; }
.bars { display: grid; gap: 12px; }
.bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; }
.bar .bname { font-weight: 500; overflow-wrap: anywhere; }
.bar .bval { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar .btrack { grid-column: 1 / -1; height: 6px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.bar .bfill { height: 6px; border-radius: 999px; background: var(--accent); }
.releases { display: grid; gap: 12px; }
.rel { display: flex; gap: 12px; align-items: flex-start; }
.rel .dot { margin-top: 7px; width: 8px; height: 8px; border-radius: 999px; background: var(--bad); flex: none; }
.rel .rname { font-weight: 600; }
.rel .rwhy { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }

/* ---- projects ---- */
#board { display: grid; gap: 20px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; gap: 2px; }
.tile .n { font-family: var(--display); font-size: 28px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile .l { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.tile.bad .n { color: var(--bad); }
.tile.warn .n { color: var(--warn); }
.tile.info .n { color: var(--info); }
.tile.good .n { color: var(--good); }
.tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.search { flex: 0 1 300px; }
.search input { width: 100%; padding: 9px 12px; border: 1px solid var(--field); border-radius: 10px; background: var(--surface); min-height: 42px; }
.projects { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.project { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.project summary { list-style: none; cursor: pointer; padding: 16px 20px; display: grid; gap: 6px; }
.project summary::-webkit-details-marker { display: none; }
.project:has(details[open]) { border-color: var(--accent); }
.head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.name { font-weight: 650; font-family: var(--display); font-size: 17px; overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 13px; }
.meta .need { color: var(--bad); font-weight: 600; }
.pill { display: inline-block; border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.good { color: var(--good); background: var(--good-bg); }
.pill.info { color: var(--info); background: var(--info-bg); }
.pill.warn { color: var(--warn); background: var(--warn-bg); }
.pill.bad { color: var(--bad); background: var(--bad-bg); }
.pill.quiet { color: var(--quiet); background: var(--quiet-bg); }
.body { border-top: 1px solid var(--line-2); padding: 14px 20px 18px; display: grid; gap: 16px; }
.group h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.findings { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.f { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 2px 12px; }
.f .kind { grid-row: span 2; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; padding-top: 3px; overflow-wrap: anywhere; }
.f .msg { overflow-wrap: anywhere; }
.f .fix { color: var(--muted); font-size: 13px; }
.f.due .kind, .f.bad .kind { color: var(--bad); }
.f.missing .kind, .f.setup .kind, .f.mismatch .kind { color: var(--warn); }
.f.stale .kind, .f.incomplete .kind, .f.info .kind { color: var(--info); }
.dim { margin: 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.repo-link { color: var(--accent); font-size: 13px; font-weight: 600; justify-self: start; }
.empty, .foot { color: var(--muted); font-size: 13px; margin: 0; }
.questions { display: grid; gap: 12px; margin-top: 10px; }
.question { display: grid; gap: 6px; }

/* ---- project cards ---- */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: grid; gap: 16px; align-content: start; }
.phead { display: flex; gap: 14px; align-items: center; }
.phead .who { flex: 1; min-width: 0; display: grid; gap: 4px; }
.phead h2 { margin: 0; font-family: var(--display); font-size: 19px; font-weight: 600; overflow-wrap: anywhere; }
.pstats { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pstats div { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.pstats dt { font-size: 12px; color: var(--muted); }
.pstats dd { margin: 0; font-weight: 700; font-size: 17px; overflow-wrap: anywhere; }
.pstats dd.hot { color: var(--bad); }
.pfoot { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.pacts { display: flex; align-items: center; gap: 8px; }
.pdialog { border: 0; border-radius: 16px; padding: 0; width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); background: var(--surface); color: var(--ink); box-shadow: 0 24px 64px rgba(15, 23, 32, 0.28); }
.pdialog::backdrop { background: rgba(15, 23, 32, 0.45); }
.dhead { position: sticky; top: 0; background: var(--surface); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line-2); }
.dhead h2 { margin: 0; font-family: var(--display); font-size: 20px; overflow-wrap: anywhere; }
.dclose { width: 40px; height: 40px; border: 0; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; flex: none; }
.dclose svg { width: 18px; height: 18px; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; }
.dbody { padding: 18px 22px 24px; display: grid; gap: 18px; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.plain { margin: 0 0 12px; padding-left: 20px; display: grid; gap: 4px; }

/* ---- time (restyled; its full redesign comes later) ---- */
#timesheet { display: grid; gap: 16px; }
.weekbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.weekbar h2 { margin: 0 8px; font-family: var(--display); font-size: 20px; }
.weekbar #ics { margin-left: auto; }
.days { display: grid; gap: 10px; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 18px; }
.dayhead { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.dayhead h3 { margin: 0; font-family: var(--display); font-size: 16px; }
.entries { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.entry { border-top: 1px solid var(--line-2); padding-top: 10px; display: grid; gap: 4px; }
.erow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.mins { font-weight: 650; }
.enote { margin: 0; overflow-wrap: anywhere; }
.eacts { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.link.danger { color: var(--bad); }
.entry.editing { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.entry.editing .eacts, .entry.editing .fld:has(textarea) { grid-column: 1 / -1; }
.fld { display: grid; gap: 2px; font-size: 13px; color: var(--muted); }
.fld input, .fld textarea { color: var(--ink); background: var(--surface-2); border: 1px solid var(--field); border-radius: 8px; padding: 8px 10px; }

/* ---- phone: the navigation moves to the bottom, within reach ---- */
@media (max-width: 720px) {
  .top-in { padding: 10px 16px; gap: 10px; min-height: 0; }
  .when { display: none; }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--surface); border-top: 1px solid var(--line);
         display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; padding: 4px 6px calc(8px + env(safe-area-inset-bottom)); }
  .tab { flex-direction: column; justify-content: center; gap: 2px; font-size: 12px; padding: 6px 0; min-height: 52px; position: relative; }
  .tab svg { display: block; }
  .tab[aria-pressed="true"] { background: none; }
  .count { position: absolute; top: 2px; left: calc(50% + 6px); line-height: 18px; padding: 0 6px; font-size: 11px; }
  main { padding: 20px 16px 104px; gap: 18px; }
  .lede h1 { font-size: 28px; }
  .qhead, .qitem { padding-left: 16px; padding-right: 16px; }
  .qform .primary { width: 100%; }
  .f { grid-template-columns: 1fr; }
  .f .kind { grid-row: auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media (max-width: 720px) {
  .pgrid { grid-template-columns: minmax(0, 1fr); }
  .pdialog { width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0; border-radius: 16px 16px 0 0; }
}
