/* ---------------------------------------------------------------------------
   The engineering ledger.

   This plan started life as a spreadsheet on a Windows desktop, so the page is
   built as a ruled ledger rather than a dashboard: paper ground, ruled panels,
   no floating cards, no drop shadows, no rounded corners. Calibri is the house
   face and stays for words; every figure is set in Consolas, the font that
   ships beside it, so hours and ticket keys align in columns the way they do in
   the sheet.

   Colour discipline: Safra gold, green and charcoal for the document; the chart
   hues are the validated pair only (see charts.js). Gold never carries small
   text — it fails contrast on this ground — so there is a separate darker gold
   reserved for type.
--------------------------------------------------------------------------- */

:root {
  --paper:   #E3D7BE;   /* the ground: light brown ledger stock */
  --panel:   #F3EDE0;   /* ruled panel */
  --panel-2: #EDE5D3;   /* alternating ledger row */
  --band:    #D9CBAC;   /* masthead */
  --rule:    #C6B693;
  --rule-soft: #DBCFB3;

  --ink:   #2A2722;
  --body:  #4E4940;
  --muted: #6B6252;

  --gold:      #B8893C;  /* fills and rules only */
  --gold-text: #8A6526;  /* gold that carries type */
  --green:     #1E7A46;

  --s-committed: #3E6FA8;
  --s-gap:       #B96A00;
  --s-gap-text:  #A05C00;
  --track:  #E0D6BE;
  --hatch:  #C9BC9C;
  --ramp-1: #2C5480;
  --ramp-2: #3E6FA8;
  --ramp-3: #6B96C8;

  color-scheme: light;

  --font: Calibri, "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: Consolas, "SF Mono", "Cascadia Mono", "Roboto Mono", ui-monospace, monospace;
}


* { box-sizing: border-box; }
body {
  margin: 0; background: var(--paper); color: var(--body);
  font-family: var(--font); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { color: var(--ink); font-weight: 700; margin: 0; }
a { color: var(--s-committed); }
b, strong { color: var(--ink); font-weight: 700; }

.fig, td.num, th.num, .key { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- masthead ---------- */
.band { background: var(--band); border-bottom: 2px solid var(--gold); }
.band-inner {
  max-width: 1140px; margin: 0 auto; padding: 16px 30px 14px;
  display: flex; align-items: flex-end; gap: 22px;
}
.kicker {
  color: var(--gold-text); font-size: 11px; font-weight: 700;
  letter-spacing: .18em; text-transform: uppercase; margin-bottom: 6px;
}
.band h1 { font-size: 26px; letter-spacing: -.015em; line-height: 1.05; }
.band .sub {
  color: var(--muted); font-size: 12.5px; margin-top: 6px;
  font-family: var(--mono); letter-spacing: -.01em;
}
.band-right { margin-left: auto; text-align: right; }
.mark-logo {
  font-size: 11.5px; font-weight: 700; color: var(--ink);
  letter-spacing: .2em; text-transform: uppercase; white-space: nowrap;
}
.who { color: var(--muted); font-size: 12px; display: block; margin-top: 5px; }
.who a { color: var(--muted); }

/* ---------- sprint selector: a ledger tab strip, not a dropdown ---------- */
.sprint-bar {
  background: var(--panel-2); border-bottom: 1px solid var(--rule);
}
.sprint-inner {
  max-width: 1140px; margin: 0 auto; padding: 0 30px;
  display: flex; align-items: stretch; gap: 0; overflow-x: auto;
}
.sprint-lab {
  display: flex; align-items: center; color: var(--muted);
  font-size: 10.5px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; padding-right: 16px; white-space: nowrap;
}
.tab {
  display: flex; flex-direction: column; justify-content: center;
  padding: 8px 16px 7px; border-right: 1px solid var(--rule-soft);
  text-decoration: none; white-space: nowrap; border-bottom: 3px solid transparent;
}
.tab:first-of-type { border-left: 1px solid var(--rule-soft); }
.tab .t-id { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--body); }
.tab .t-meta { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.tab:hover { background: var(--panel); }
.tab[aria-current="page"] {
  background: var(--panel); border-bottom-color: var(--gold);
}
.tab[aria-current="page"] .t-id { color: var(--ink); }
.tab.future .t-id { color: var(--muted); font-weight: 400; }

/* ---------- layout ---------- */
main { max-width: 1140px; margin: 0 auto; padding: 0 30px 56px; }
section { margin-top: 32px; }
.sec-head {
  display: flex; align-items: baseline; gap: 12px;
  border-bottom: 1px solid var(--rule); padding-bottom: 7px; margin-bottom: 12px;
}
.sec-head h2 { font-size: 17px; letter-spacing: -.01em; }
.sec-num { font-family: var(--mono); color: var(--gold-text); font-weight: 700; font-size: 12.5px; }
.sec-note { color: var(--body); font-size: 13.5px; margin: 0 0 14px; max-width: 800px; }

/* ---------- the capacity equation: the page's thesis ---------- */
.eq {
  border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule);
  padding: 15px 0 14px; margin-top: 22px;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px;
}
.eq .term { display: flex; flex-direction: column; }
.eq .term b {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 24px; color: var(--ink); font-weight: 700; letter-spacing: -.02em; line-height: 1.1;
}
.eq .term b .u { font-size: 13px; color: var(--muted); }
.eq .lab {
  color: var(--muted); font-size: 10.5px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; margin-top: 3px;
}
.eq .op {
  align-self: center; color: var(--gold-text); font-family: var(--mono);
  font-size: 19px; font-weight: 700; padding-bottom: 12px;
}
.eq .term.flag b { color: var(--s-gap-text); }

/* ---------- ledger lines (instead of boxed stat tiles) ---------- */
.ledger-line { display: flex; flex-wrap: wrap; border-top: 1px solid var(--rule-soft); margin-top: 14px; }
.ledger-line > div { flex: 1 1 0; min-width: 148px; padding: 10px 16px 9px; border-right: 1px solid var(--rule-soft); }
.ledger-line > div:last-child { border-right: none; }
.ledger-line .l { color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.ledger-line .v {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  color: var(--ink); font-size: 20px; font-weight: 700; margin-top: 3px; letter-spacing: -.02em;
}
.ledger-line .v .u { font-size: 12px; color: var(--muted); }
.ledger-line .f { color: var(--muted); font-size: 12px; margin-top: 2px; line-height: 1.35; }
.ledger-line .v.flag { color: var(--s-gap-text); }

/* ---------- ruled panel ---------- */
.panel { background: var(--panel); border: 1px solid var(--rule); padding: 18px 20px; }
.panel + .panel { border-top: none; }
.panel-tight { padding: 0; }
.panel-title { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.cols-2 { display: grid; grid-template-columns: 1.4fr 1fr; }
.cols-2 > .panel + .panel { border-left: none; }

/* ---------- charts ---------- */
.chart { margin: 0; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
line.grid { stroke: var(--rule-soft); stroke-width: 1; }
.axis { stroke: var(--muted); stroke-width: 1; }
.connector { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; opacity: .65; }
.ref-plannable { stroke: var(--ink); stroke-width: 1.5; }
text { font-family: var(--font); }
.tick { fill: var(--muted); font-size: 11px; font-family: var(--mono); }
.tick.sm { font-size: 10px; }
.rowlab { fill: var(--body); font-size: 12.5px; }
.rowlab.sm { font-size: 11.5px; }
.barval { fill: var(--ink); font-size: 12px; font-weight: 700; font-family: var(--mono); }

.track { fill: var(--track); }
.reserve-band { fill: url(#hatch); }
.s-cmt { fill: var(--s-committed); }
.s-gap { fill: var(--s-gap); opacity: .55; stroke: var(--s-gap); stroke-width: 1.5; }
.s-open { fill: var(--s-committed); }
.s-done { fill: var(--muted); opacity: .4; }
.w-total { fill: var(--ink); }
.w-final { fill: var(--s-committed); }
.w-sub { fill: var(--muted); opacity: .45; }
.w-reserve { fill: var(--gold); opacity: .8; }
.f-1 { fill: var(--ramp-1); }
.f-2 { fill: var(--ramp-2); }
.f-3 { fill: var(--ramp-3); }
.mark { transition: opacity .12s; cursor: default; outline: none; }
.mark:hover, .mark:focus-visible { opacity: .8; }

/* ---------- tooltip ---------- */
#tip {
  position: fixed; z-index: 60; pointer-events: none; opacity: 0;
  transition: opacity .1s; background: var(--ink); color: var(--panel);
  padding: 8px 11px; font-size: 12.5px; max-width: 270px;
}
#tip .t-l { font-weight: 700; }
#tip .t-v { font-family: var(--mono); color: var(--gold); font-weight: 700; }
#tip .t-n { opacity: .78; margin-top: 3px; line-height: 1.4; }

/* ---------- ledger table ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; color: var(--muted); font-size: 10.5px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  padding: 10px 12px 8px; border-bottom: 1px solid var(--rule); background: var(--panel-2);
}
td { padding: 9px 12px; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; }
.key { font-weight: 700; color: var(--ink); white-space: nowrap; font-size: 12.5px; }
.why { color: var(--muted); font-size: 12.5px; }
.state { color: var(--muted); font-size: 11.5px; font-family: var(--mono); }
tbody tr.person-head td {
  background: var(--panel-2); border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule); color: var(--ink);
  font-weight: 700; font-size: 13px; padding: 8px 12px;
}
tbody tr.person-head .meta { font-family: var(--mono); font-weight: 400; color: var(--muted); font-size: 12px; }
tbody tr.person-head .open { color: var(--s-gap-text); font-family: var(--mono); }

/* basis: a mark in the margin, not a coloured chip */
.basis { font-family: var(--mono); font-size: 11px; font-weight: 700; white-space: nowrap; }
.basis.b-jira { color: var(--green); }
.basis.b-prop { color: var(--gold-text); }
.basis.b-slot { color: var(--muted); }

/* ---------- rules ---------- */
.rule-item { display: flex; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--rule-soft); }
.rule-item:last-child { border-bottom: none; }
.rule-item .n { flex: 0 0 auto; font-family: var(--mono); color: var(--gold-text); font-weight: 700; font-size: 13px; padding-top: 1px; }
.rule-item h3 { font-size: 14px; margin-bottom: 3px; }
.rule-item p { margin: 0; font-size: 13.5px; color: var(--body); }

.callout { border-left: 3px solid var(--s-gap); background: var(--panel-2); padding: 13px 17px; font-size: 13.5px; }

.legend { display: flex; gap: 20px; flex-wrap: wrap; margin: 0 0 14px; font-size: 12.5px; color: var(--body); }
.legend i { display: inline-block; width: 13px; height: 11px; margin-right: 6px; vertical-align: -1px; }
.legend .l-cmt { background: var(--s-committed); }
.legend .l-gap { background: var(--s-gap); opacity: .55; border: 1.5px solid var(--s-gap); }
.legend .l-res { background: var(--hatch); }
.legend .l-lim { border-left: 2px solid var(--ink); width: 2px; margin-right: 9px; }

/* ---------- empty state for a sprint that has no plan yet ---------- */
.empty { border: 1px solid var(--rule); background: var(--panel); padding: 40px 34px; margin-top: 26px; }
.empty h2 { font-size: 19px; margin-bottom: 8px; }
.empty p { max-width: 620px; font-size: 14px; margin: 0 0 18px; }
.empty ol { max-width: 620px; font-size: 13.5px; margin: 0; padding-left: 20px; color: var(--body); }
.empty li { margin-bottom: 7px; }
.empty li b { display: block; }

/* ---------- footer ---------- */
footer { border-top: 1px solid var(--rule); margin-top: 38px; padding: 14px 30px 26px; color: var(--muted); font-size: 11.5px; }
footer .inner { max-width: 1140px; margin: 0 auto; display: flex; gap: 16px; font-family: var(--mono); }
footer .r { margin-left: auto; }

/* ---------- sign in ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login { width: 100%; max-width: 390px; background: var(--panel); border: 1px solid var(--rule); }
.login .top { background: var(--band); border-bottom: 2px solid var(--gold); padding: 20px 24px 16px; }
.login .top h1 { font-size: 20px; }
.login .body { padding: 22px 24px 24px; }
label { display: block; font-size: 10.5px; font-weight: 700; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; margin-bottom: 6px; }
input[type=text], input[type=password] {
  width: 100%; padding: 9px 11px; font-family: var(--mono); font-size: 14.5px;
  color: var(--ink); background: var(--paper); border: 1px solid var(--rule);
  border-radius: 0; margin-bottom: 15px;
}
input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.remember { display: flex; align-items: center; gap: 8px; margin-bottom: 17px; }
.remember label { margin: 0; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--body); font-weight: 400; font-family: var(--font); }
button {
  width: 100%; padding: 10px; font-family: var(--font); font-size: 14px; font-weight: 700;
  letter-spacing: .04em; color: var(--panel); background: var(--ink); border: none; border-radius: 0; cursor: pointer;
}
button:hover { background: #443F38; }
.err { background: #F0DCD0; border: 1px solid #B4795A; color: #7A3312; padding: 9px 11px; font-size: 13px; margin-bottom: 15px; }

.scroll-x { overflow-x: auto; }

/* ===========================================================================
   Retrospective
   Same ledger: ruled panels, no shadows, no rounded corners. Words in Calibri,
   every figure (votes, counts, dates) in Consolas with tabular figures.
=========================================================================== */

/* view switch in the sprint bar */
.view-switch { display: flex; margin-left: auto; align-items: stretch; }
.view-switch a {
  display: flex; align-items: center; padding: 8px 15px 7px;
  border-left: 1px solid var(--rule-soft); border-bottom: 3px solid transparent;
  color: var(--body); text-decoration: none; font-size: 12.5px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
}
.view-switch a:hover { background: var(--panel); }
.view-switch a[aria-current="page"] { background: var(--panel); color: var(--ink); border-bottom-color: var(--gold); }

/* a one-line result of the last action */
.rnote { margin: 22px 0 0; padding: 9px 13px; font-size: 13.5px; border-left: 3px solid var(--rule); background: var(--panel-2); color: var(--body); }
.rnote.ok { border-left-color: var(--green); }
.rnote.warn { border-left-color: var(--s-gap); color: var(--ink); }

/* facilitator strip */
.facil {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule);
  padding: 11px 0 10px; margin-top: 22px;
}
.facil form { margin: 0; }
.facil-lab { color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.facil-done { font-family: var(--mono); font-size: 12.5px; font-weight: 700; color: var(--green); }
.facil-why { color: var(--muted); font-size: 12.5px; flex: 1 1 240px; }

/* buttons that are not the full-width sign-in button */
.btn-sm {
  width: auto; padding: 6px 13px; font-size: 13px; font-weight: 700;
  color: var(--panel); background: var(--ink); border: 1px solid var(--ink); cursor: pointer;
}
.btn-sm:hover { background: #443F38; }
.btn-sm[disabled] { background: var(--panel-2); color: var(--muted); border-color: var(--rule); cursor: not-allowed; }
.linkish {
  width: auto; padding: 0; background: none; border: none; color: var(--muted);
  font-family: var(--font); font-size: 12px; text-decoration: underline; cursor: pointer;
}
.linkish:hover { background: none; color: var(--ink); }
button:focus-visible, a:focus-visible, textarea:focus, select:focus, input[type=date]:focus {
  outline: 2px solid var(--gold); outline-offset: 1px;
}

/* three columns, sharing rules like the rest of the ledger */
.retro-cols { display: grid; grid-template-columns: repeat(3, 1fr); }
.retro-cols > .panel + .panel { border-left: none; }
.rcol { display: flex; flex-direction: column; }
.rcol-n { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--body); }
.rcol-hint { color: var(--muted); font-size: 12px; margin: -6px 0 10px; }
.rhidden {
  font-size: 12.5px; color: var(--body); margin: 0 0 4px;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  padding: 8px 0; background: var(--panel-2);
}
.rhidden .n { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); }
.rhidden.empty { color: var(--muted); }
.rempty { color: var(--muted); font-size: 12.5px; margin: 10px 0; }

/* a card is a ruled ledger row, not a floating tile */
.rcard { border-top: 1px solid var(--rule-soft); padding: 9px 0 8px; }
.rc-body { margin: 0; font-size: 13.5px; color: var(--ink); overflow-wrap: anywhere; }
.rc-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 5px; }
.rc-by { font-size: 11.5px; color: var(--muted); }
.rc-by.anon { font-style: italic; }
.rc-date { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 11.5px; color: var(--muted); }
.rc-acts { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.rc-act { margin: 0; }
.vote {
  width: auto; padding: 2px 9px; font-family: var(--font); font-size: 12px; font-weight: 700;
  color: var(--body); background: var(--panel-2); border: 1px solid var(--rule); cursor: pointer;
}
.vote:hover { background: var(--paper); color: var(--ink); }
.vote .n {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  margin-left: 7px; padding-left: 7px; border-left: 1px solid var(--rule); color: var(--ink);
}
.vote.on, .vote.on:hover { background: var(--s-committed); border-color: var(--s-committed); color: var(--panel); }
.vote.on .n { color: var(--panel); border-left-color: var(--rule); }

/* an AI group: label, one neutral line, combined votes, then the cards */
.rgroup { border: 1px solid var(--rule); border-left: 3px solid var(--gold); background: var(--panel-2); padding: 10px 12px 4px; margin: 0 0 10px; }
.rgroup-head { display: flex; align-items: baseline; gap: 10px; }
.rgroup-label { font-weight: 700; color: var(--ink); font-size: 13.5px; }
.rgroup-votes {
  margin-left: auto; font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 17px; font-weight: 700; color: var(--ink); line-height: 1;
}
.rgroup-votes .u { font-size: 10.5px; color: var(--muted); margin-left: 4px; }
.rgroup-sum { margin: 4px 0 0; font-size: 12.5px; color: var(--body); }
.rgroup-meta { font-family: var(--mono); font-size: 11px; color: var(--muted); margin: 5px 0 0; }
.rgroup .rcard:first-of-type { border-top: 1px solid var(--rule); margin-top: 6px; }

/* add-card form, pinned to the foot of its column */
.rform { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--rule); }
.rform label { margin-bottom: 5px; }
textarea {
  width: 100%; padding: 8px 10px; font-family: var(--font); font-size: 13.5px;
  color: var(--ink); background: var(--paper); border: 1px solid var(--rule);
  border-radius: 0; resize: vertical;
}
.rform-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.chk { display: flex; align-items: center; gap: 6px; margin: 0; text-transform: none; letter-spacing: 0; font-size: 12.5px; font-weight: 400; color: var(--body); font-family: var(--font); }
.chk input { width: auto; margin: 0; }
.rform-row .btn-sm { margin-left: auto; }

/* measures */
.none { color: var(--muted); }
.mform-wrap { border-top: none; }
.mform { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; }
.mform > div { flex: 0 0 auto; }
.mform .f-body { flex: 1 1 320px; }
.mform .f-act { margin-left: auto; }
.mform input[type=text] { margin-bottom: 0; }
input[type=date], select {
  padding: 8px 10px; font-family: var(--mono); font-size: 13.5px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--rule); border-radius: 0;
}
select { font-family: var(--font); }
.mform td button { margin: 0; }

@media (max-width: 900px) {
  .retro-cols { grid-template-columns: 1fr; }
  .retro-cols > .panel + .panel { border-left: 1px solid var(--rule); border-top: 1px solid var(--rule); }
  .view-switch { margin-left: 0; }
  .mform .f-act { margin-left: 0; }
  .mform > div { flex: 1 1 100%; }
}

@media (max-width: 900px) {
  .cols-2 { grid-template-columns: 1fr; }
  .cols-2 > .panel + .panel { border-top: 1px solid var(--rule); }
  .band-inner { flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px 18px; }
  .band-right { margin-left: 0; text-align: left; }
  main { padding: 0 18px 40px; }
  .sprint-inner { padding: 0 18px; }
  .eq { gap: 4px 10px; }
  .eq .term b { font-size: 20px; }
  .ledger-line > div { border-right: none; border-bottom: 1px solid var(--rule-soft); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- measure follow-through ---------- */
/* A carried-over measure is the team's own unkept promise: tinted so it reads
   as inherited debt rather than as something agreed in this retro. */
tr.carried td { background: var(--panel-2); }
tr.carried td:first-child { box-shadow: inset 3px 0 0 var(--s-gap); }
.statusform { display: flex; gap: 6px; align-items: center; }
.statusform select {
  font-family: var(--mono); font-size: 12px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--rule); border-radius: 0; padding: 3px 5px;
}
.btn-xs {
  width: auto; padding: 3px 8px; font-family: var(--font); font-size: 11.5px;
  font-weight: 700; color: var(--panel); background: var(--ink);
  border: none; border-radius: 0; cursor: pointer;
}
.btn-xs:hover { background: #443F38; }
