:root {
  --ink: #15115E;
  --teal: #23A8A3;
  --magenta: #CE1AA2;
  --paper: #FAFAFD;
  --surface: #FFFFFF;
  --mist: #EEEDF6;
  --line: #DEDCEC;
  --text: #22213A;
  --muted: #64627F;
  --fillc: rgba(21, 17, 94, .82);
  --rail: #15115E;
  --rail-text: #E8E7F7;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0E0C27;
    --surface: #17143D;
    --mist: #221E52;
    --line: #322D6B;
    --text: #ECEBF8;
    --muted: #A9A6CC;
    --ink: #CFCBFF;
    --fillc: rgba(140, 132, 255, .55);
    --rail: #0A0820;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--text); font: 17px/1.55 var(--body); }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--magenta); outline-offset: 2px; border-radius: 4px; }
h1, h2 { font-family: var(--display); line-height: 1.1; margin: 0 0 .5rem; color: var(--ink); }
h1 { font-size: clamp(2rem, 4vw, 3.2rem); font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 1.25rem; font-weight: 700; }
p { margin: 0 0 1rem; max-width: 72ch; }
.muted { color: var(--muted); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--surface); padding: .5rem 1rem; z-index: 9; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--rail) 232px, transparent 232px); }
.rail { background: var(--rail); color: var(--rail-text); padding: 1.5rem 1rem; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2rem; }
.brand { display: flex; gap: .75rem; align-items: center; text-decoration: none; font: 700 1.15rem/1.15 var(--display); color: #fff; }
.brand small { font: 400 .78rem var(--body); color: var(--rail-text); opacity: .8; }
.brand svg, .login-mark { width: 40px; height: 40px; flex: none; }
.b1 { fill: var(--teal); } .b2 { fill: #fff; opacity: .9; } .b3 { fill: var(--magenta); }
.rail nav { display: flex; flex-direction: column; gap: .15rem; }
.rail nav a { text-decoration: none; padding: .55rem .75rem; border-radius: 8px; border-left: 3px solid transparent; }
.rail nav a:hover { background: rgba(255,255,255,.08); }
.rail nav a[aria-current="page"] { background: rgba(255,255,255,.1); border-left-color: var(--teal); color: #fff; font-weight: 700; }
.rail .present-link { margin-top: .75rem; border: 1px solid rgba(255,255,255,.3); text-align: center; border-left-width: 1px; }
.me { margin-top: auto; font-size: .9rem; display: flex; flex-direction: column; gap: .2rem; }
.me span { color: var(--teal); font-size: .8rem; }
.me a { opacity: .8; font-size: .85rem; }
main { padding: 2.5rem clamp(1.25rem, 4vw, 3.5rem) 4rem; max-width: 1240px; width: 100%; }

/* ---------- hero + mosaic ---------- */
.hero { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(320px, 620px); gap: 2.5rem; align-items: center; margin-bottom: 3rem; }
.kicker { color: var(--muted); font-size: .95rem; margin-bottom: .4rem; }
.num { color: var(--teal); }
.lede { font-size: 1.15rem; color: var(--muted); }
.legend { display: flex; gap: .4rem 1rem; flex-wrap: wrap; align-items: center; font-size: .85rem; color: var(--muted); }
.legend .k { display: inline-block; width: 14px; height: 14px; border-radius: 3px; margin-right: -.6rem; vertical-align: -2px; }
.k.complete { background: var(--teal); }
.k.in-progress { background: var(--mist); border-bottom: 4px solid var(--ink); }
.k.to-do { border: 1.5px dashed var(--muted); }

.mosaic { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.tile a { display: flex; flex-direction: column; justify-content: space-between; gap: .3rem; height: 92px; padding: .45rem .5rem; border-radius: 7px; text-decoration: none; font-size: .66rem; line-height: 1.15; overflow: hidden; transition: transform .15s; }
.tile a:hover { transform: translateY(-2px); }
.t-clause { font-weight: 700; display: flex; justify-content: space-between; gap: .25rem; }
.t-clause em { font-style: normal; color: var(--ink); }
.t-title { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tile.complete a { background: var(--teal); color: #fff; }
.tile.complete .t-clause { opacity: .85; }
.tile.in-progress a { background: var(--mist); color: var(--text); }
.t-bar { display: block; height: 5px; border-radius: 99px; background: var(--line); overflow: hidden; flex: none; }
.t-bar span { display: block; height: 100%; background: var(--ink); }
.tile.to-do a { border: 1.5px dashed var(--muted); color: var(--muted); }
.mosaic.big .tile a { height: 118px; font-size: .82rem; }

/* ---------- panels ---------- */
.cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2rem; align-items: start; }
.panel h2 { margin-bottom: 1rem; }
.mt { margin-top: 2.25rem; }
.open-list, .milestones, .dates-list { list-style: none; margin: 0; padding: 0; }
.open-list li + li { border-top: 1px solid var(--line); }
.open-list a { display: grid; grid-template-columns: 1fr 120px; gap: .25rem 1rem; padding: .85rem 0; text-decoration: none; }
.ol-title { font-weight: 700; }
.ol-meta { grid-column: 1 / -1; color: var(--muted); font-size: .9rem; }
.open-list a:hover .ol-title { text-decoration: underline; }
.bar { display: block; height: 8px; border-radius: 99px; background: var(--mist); overflow: hidden; align-self: center; }
.bar span { display: block; height: 100%; background: var(--ink); border-radius: 99px; }
.bar.wide { max-width: 420px; margin-top: .75rem; }

.dates-list li { display: grid; grid-template-columns: 3.2rem 1fr auto; gap: .75rem; padding: .55rem .75rem; border-radius: 8px; align-items: baseline; }
.dates-list .next { background: var(--magenta); color: #fff; }
.dates-list .next .d-days, .dates-list .next .d-date { color: #fff; }
.dates-list .past { opacity: .55; }
.d-date { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.d-days { font-size: .85rem; color: var(--muted); }
.milestones li { padding: .45rem 0; font-size: .93rem; border-top: 1px solid var(--line); }
.milestones .d-date { margin-right: .4rem; }
.more { display: inline-block; margin-top: 1rem; font-weight: 700; color: var(--ink); }

/* ---------- pages ---------- */
.page-head { margin-bottom: 2rem; }
.crumb { margin-bottom: .75rem; font-size: .95rem; }
.tabs { display: flex; gap: .5rem; flex-wrap: wrap; }
.tabs a { text-decoration: none; padding: .4rem .9rem; border-radius: 99px; border: 1px solid var(--line); }
.tabs a[aria-current] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.pill { display: inline-block; font-size: .8rem; font-weight: 700; padding: .15rem .6rem; border-radius: 99px; white-space: nowrap; }
.pill.complete { background: var(--teal); color: #fff; }
.pill.in-progress { background: var(--mist); color: var(--ink); }
.pill.to-do { border: 1.5px dashed var(--muted); color: var(--muted); }

.finding-list { list-style: none; padding: 0; margin: 0; }
.finding-list li + li { border-top: 1px solid var(--line); }
.fl-row { display: grid; grid-template-columns: 11rem 1fr 13rem; gap: 1.25rem; padding: 1rem 0; text-decoration: none; }
.fl-clause { color: var(--muted); font-size: .88rem; }
.fl-main strong { display: block; color: var(--ink); font-family: var(--display); font-size: 1.1rem; margin-bottom: .2rem; }
.fl-main span { color: var(--muted); font-size: .92rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fl-side { display: flex; flex-direction: column; align-items: flex-start; gap: .3rem; font-size: .85rem; color: var(--muted); }
.fl-row:hover strong { text-decoration: underline; }

.story { display: grid; gap: 1.5rem; max-width: 760px; }
.story h2 { font-size: 1rem; color: var(--muted); font-family: var(--body); font-weight: 700; margin-bottom: .3rem; }
.story p { font-size: 1.12rem; }
.story .did { border-left: 4px solid var(--teal); padding-left: 1.1rem; }
.story .did p { font-size: 1.22rem; }
.story .next { border-left: 4px solid var(--magenta); padding-left: 1.1rem; }
.pager { display: flex; gap: 1.5rem; margin: 2.5rem 0 1rem; font-weight: 700; }
.notice { background: var(--mist); padding: .6rem 1rem; border-radius: 8px; display: inline-block; }

.editor { margin-top: 2rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.editor summary { cursor: pointer; padding: .9rem 1.1rem; font-weight: 700; color: var(--ink); }
.editor form { padding: 0 1.1rem 1.1rem; display: grid; gap: .9rem; }
.editor .row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: end; }
label { display: grid; gap: .3rem; font-size: .9rem; font-weight: 700; }
label.check { display: flex; align-items: center; gap: .4rem; padding-bottom: .5rem; }
input, select, textarea { font: inherit; font-weight: 400; color: var(--text); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .65rem; }
textarea { width: 100%; resize: vertical; }
.hint { color: var(--muted); font-size: .85rem; margin: 0; }
.btn { display: inline-block; font: 700 1rem var(--body); padding: .65rem 1.2rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none; cursor: pointer; justify-self: start; }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.filters { display: flex; gap: 1rem; margin: 1.5rem 0; flex-wrap: wrap; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); margin-left: .4rem; }
.timeline .day h2 { font-size: 1rem; color: var(--muted); font-family: var(--body); margin: 1.5rem 0 .5rem 1.25rem; }
.timeline .entry { position: relative; margin: 0 0 .9rem 1.25rem; padding: .7rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.timeline .entry::before { content: ""; position: absolute; left: calc(-1.25rem - 6px); top: 1.05rem; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.timeline .milestone { border-color: var(--teal); }
.timeline .milestone::before { background: var(--teal); width: 14px; height: 14px; left: calc(-1.25rem - 8px); top: .95rem; }
.timeline .entry p { margin: .2rem 0; }
.timeline small { color: var(--muted); }
.e-kind { font-size: .78rem; font-weight: 700; color: var(--ink); }
.empty { margin-left: 1.25rem; color: var(--muted); }

.table-wrap { overflow-x: auto; }
table.docs { border-collapse: collapse; width: 100%; font-size: .93rem; }
.docs th, .docs td { text-align: left; padding: .7rem .8rem .7rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.docs thead th { color: var(--muted); font-weight: 700; font-size: .85rem; }
.docs tbody th { color: var(--ink); }
.nowrap { white-space: nowrap; }

.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
.person { padding: 1.25rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.person p { margin-bottom: .6rem; }
.p-stats strong { color: var(--teal); font-size: 1.3rem; font-family: var(--display); margin-left: .5rem; }
.p-stats strong:first-child { margin-left: 0; }
.person ul { padding-left: 1.1rem; margin: .5rem 0 0; font-size: .93rem; }

/* ---------- login ---------- */
body.login { min-height: 100vh; display: grid; place-items: center; background: var(--rail); }
.login-card { background: var(--surface); padding: 2.5rem; border-radius: 16px; max-width: 420px; margin: 1rem; }
.login-mark .b2 { fill: var(--ink); }
.login-card h1 { font-size: 2rem; margin-top: 1rem; }
.error { color: var(--magenta); font-weight: 700; }
.dev { margin-top: 1rem; font-size: .85rem; }

/* ---------- present ---------- */
body.present { background: var(--paper); }
.slide { min-height: 100vh; padding: 6vh 7vw; display: flex; flex-direction: column; justify-content: center; }
.slide h1 { font-size: clamp(2.4rem, 5vw, 4.2rem); }
.slide .story p { font-size: 1.35rem; }
.slide .story .did p { font-size: 1.5rem; }
.slide.intro .mosaic { max-width: 980px; margin: 1.5rem 0; }
.present-nav { position: fixed; bottom: 1rem; right: 1.5rem; display: flex; gap: 1.25rem; color: var(--muted); font-size: .9rem; }

/* ---------- responsive / motion ---------- */
@media (max-width: 980px) {
  .hero, .cols { grid-template-columns: 1fr; }
  .fl-row { grid-template-columns: 1fr; gap: .4rem; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .shell { background: none; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 1rem; padding: 1rem; }
  .rail nav { flex-direction: row; flex-wrap: wrap; }
  .rail .present-link { margin-top: 0; }
  .me { margin-top: 0; flex-direction: row; gap: .75rem; }
  .mosaic { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tile a { height: 80px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  .rail, .editor, .pager, .filters, .tabs { display: none; }
  .shell { display: block; }
}
