:root {
  --paper: #F3F5F2; --card: #FBFCFA; --ink: #1E2A2B; --slate: #5B6B6A; --line: #D5DCD8;
  --needs: #E8A33D; --needs-ink: #6B4508; --needs-bg: #FBEFD9;
  --idea: #B9C2BF; --specced: #8A7BB8; --building: #3E6BA8; --shipped: #2F7D6D; --retired: #E2E6E3;
  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r-sm: 6px; --r-lg: 14px; --tabs-h: 58px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.55 var(--font); }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--building); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; background: var(--card); padding: 6px 10px; z-index: 9; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--slate); } .small { font-size: 13.5px; }
h1 { font-size: 26px; line-height: 1.2; font-weight: 600; margin: 4px 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 10px; color: var(--slate); }

/* top bar */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; background: var(--ink); color: #EEF2EF; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 600; letter-spacing: 0.01em; }
.brand span { display: none; }
.crumb { flex: 1; min-width: 0; display: flex; gap: 8px; align-items: baseline; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb a { color: #AFC0BC; text-decoration: none; } .crumb span { color: #6F8582; }
.status { font-size: 12.5px; color: #AFC0BC; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; max-width: 42vw; } .status.warn { color: var(--needs); }
.icon { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: #EEF2EF; cursor: pointer; }
.icon:hover { background: #2C3B3C; }

/* layout */
.layout { display: block; }
.rail { display: none; }
main { padding: 18px 16px calc(var(--tabs-h) + env(safe-area-inset-bottom) + 24px); max-width: 1180px; outline: none; }

/* tabs: bottom on phone */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs[hidden] { display: none; }
.tabs a { height: var(--tabs-h); display: flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; font-size: 14px; font-weight: 500; color: var(--slate); }
.tabs a.here { color: var(--ink); box-shadow: inset 0 3px 0 var(--ink); }
.dot { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--needs); color: var(--needs-ink); font-size: 12px; font-weight: 600; }

/* chips */
.chip { display: inline-block; font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 999px; background: var(--retired); color: var(--slate); white-space: nowrap; }
.chip.st-idea { background: #E7EBE9; color: #4E5B58; }
.chip.st-specced { background: #ECE8F6; color: #4B3F7A; }
.chip.st-building { background: #E1EAF5; color: #23466F; }
.chip.st-shipped { background: #DDEFEA; color: #1D5247; }
.chip.st-needs { background: var(--needs-bg); color: var(--needs-ink); }
.id { font-weight: 600; color: var(--slate); font-variant-numeric: tabular-nums; margin-right: 2px; }

/* portfolio: the capability strip is the one bold element */
.portfolio { display: grid; gap: 16px; }
.pcard { display: block; text-decoration: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 18px 16px; }
.pcard:hover { border-color: var(--slate); }
.pcard header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pcard h2 { font-size: 22px; color: var(--ink); margin: 0; letter-spacing: -0.01em; }
.pcard .lead { margin: 6px 0 16px; color: var(--slate); max-width: 62ch; }
.strip { display: flex; gap: 4px; height: 26px; margin-bottom: 10px; }
.strip .seg { flex: 1; border-radius: 4px; }
.seg.st-idea { background: var(--idea); } .seg.st-specced { background: var(--specced); }
.seg.st-building { background: var(--building); } .seg.st-shipped { background: var(--shipped); }
.seg.st-retired, .seg.st-other { background: var(--retired); }
.counts { margin: 0; font-size: 13.5px; color: var(--slate); }
.needs { margin: 10px 0 0; font-size: 14px; color: var(--slate); }
.needs.on { color: var(--needs-ink); font-weight: 600; }
.needs.on::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--needs); margin-right: 8px; }
.pcard.pending { opacity: .7; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 0 0 16px; font-size: 13px; color: var(--slate); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 14px; height: 10px; border-radius: 3px; }

/* map */
.areas { display: grid; gap: 22px; }
.area h2 { margin-bottom: 8px; }
.cap { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--idea); border-radius: 0 var(--r-sm) var(--r-sm) 0; padding: 12px 14px; margin-bottom: 10px; }
.cap.st-specced { border-left-color: var(--specced); } .cap.st-building { border-left-color: var(--building); } .cap.st-shipped { border-left-color: var(--shipped); }
.cap header { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.cap header a { text-decoration: none; font-weight: 600; }
.cap p { margin: 6px 0; color: var(--slate); font-size: 14.5px; }
.feats { list-style: none; margin: 8px 0 0; padding: 0; border-top: 1px solid var(--line); }
.feats li, .files li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.feats li:last-child { border-bottom: 0; }
.feats a, .files a { text-decoration: none; }
.feats a:hover, .files a:hover, .cap header a:hover, .dtitle:hover { text-decoration: underline; }

/* decisions */
.search input, .settings input { width: 100%; font: inherit; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); }
.declog { list-style: none; padding: 0; margin: 14px 0 0; }
.dec { padding: 14px 0; border-bottom: 1px solid var(--line); }
.dtitle { text-decoration: none; font-weight: 600; }
.dec p { margin: 4px 0; max-width: 72ch; }
.refs a { color: var(--slate); }

/* inbox */
.asks { list-style: none; padding: 0; margin: 0; }
.ask { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ask a { text-decoration: none; font-weight: 500; flex: 1 1 260px; }
.ask.closed a { color: var(--slate); font-weight: 400; }

/* files */
.filegroups { display: grid; gap: 20px; }
.files { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }

/* doc */
.doc { max-width: 74ch; }
.crumbs { margin: 0; font-size: 13px; color: var(--slate); }
.fields { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 14px 0 18px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 14px; }
.fields div { display: contents; } .fields dt { color: var(--slate); } .fields dd { margin: 0; overflow-wrap: anywhere; }
.idref { font-weight: 600; text-decoration: none; color: var(--building); margin-right: 6px; } .idref.missing { color: var(--slate); }
.prose { line-height: 1.65; }
.prose h2 { font-size: 17px; color: var(--ink); margin: 22px 0 6px; }
.prose a { color: var(--building); }
.prose table { border-collapse: collapse; width: 100%; font-size: 14.5px; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose code { font-size: .92em; background: #E7ECE9; padding: 1px 5px; border-radius: 4px; }
.prose pre { background: #E7ECE9; padding: 12px; border-radius: var(--r-sm); overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.backlinks { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--line); }
.backlinks ul { margin: 0; padding-left: 18px; } .backlinks a { text-decoration: none; } .backlinks a:hover { text-decoration: underline; }

/* settings */
.settings { max-width: 560px; }
.settings form { display: grid; gap: 14px; margin: 16px 0 26px; }
.settings label { display: grid; gap: 6px; font-weight: 500; font-size: 14px; }
button, .btn { font: inherit; font-weight: 500; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-block; }
.primary { background: var(--ink); color: #EEF2EF; border-color: var(--ink); justify-self: start; }
.seg-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg-toggle button { border: 0; border-radius: 0; } .seg-toggle button[aria-pressed="true"] { background: var(--ink); color: #EEF2EF; }
.actions { margin-top: 26px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.error { background: var(--needs-bg); color: var(--needs-ink); padding: 10px 12px; border-radius: var(--r-sm); }
.welcome { max-width: 520px; padding-top: 10vh; }

/* desktop */
@media (min-width: 900px) {
  .brand span { display: inline; }
  .layout { display: grid; grid-template-columns: 220px 1fr; }
  .rail { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 62px; align-self: start; height: calc(100vh - 62px); padding: 18px 10px; border-right: 1px solid var(--line); }
  .rail a { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; border-radius: 8px; text-decoration: none; color: var(--slate); font-weight: 500; }
  .rail a:hover { background: #E7ECE9; } .rail a.here { background: var(--ink); color: #EEF2EF; }
  .rail a:last-child { margin-top: auto; }
  main { padding: 26px 32px 48px; }
  .col { min-width: 0; }
  .tabs { position: sticky; top: 62px; display: flex; gap: 4px; border: 0; border-bottom: 1px solid var(--line); background: var(--paper); padding: 0 32px; z-index: 4; }
  .tabs a { height: 46px; padding: 0 14px; }
  .tabs a.here { box-shadow: inset 0 -3px 0 var(--ink); }
  .portfolio { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 20px; }
  .caps { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; align-items: start; }
  .caps .cap { margin-bottom: 0; }
  .filegroups { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); align-items: start; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
@media (max-width: 899px) {
  .crumb a, .crumb span { display: none; }
  .crumb strong { font-size: 17px; overflow: hidden; text-overflow: ellipsis; }
  .status:not(.warn) { display: none; }
}
