/* =========================================================================
   CoBuild
   Visual direction: a set of construction drawings. Warm neutral paper, a
   title block on every sheet, and the two colours from the CoBuild badge —
   deep navy for the record, brass gold for the work.
   ========================================================================= */

:root {
  /* Blue, orange, white.
     Two blues: a deep one for chrome and text, a mid one for links.
     Two oranges: the vivid brand orange for fills and bars, and a darker
     derivative for anything carrying white text — the vivid one only reaches
     3.3:1 against white, which is not enough for a button label. */
  --paper:      #ffffff;
  --paper-lift: #ffffff;
  --paper-deep: #e4ebf2;
  --canvas:     #f3f7fb;

  --ink:        #0a2e52;
  --ink-soft:   #3d5a75;
  --ink-faint:  #5a7186;
  --steel:      #8aa0b4;

  --blue:       #12558f;
  --blue-wash:  #e8f0f7;

  --rule:       #d5dfe8;
  --rule-soft:  #e7eef4;

  --flag:       #b8500e;   /* orange for type and anything under white text */
  --flag-bright:#e2691c;   /* the brand orange, for fills, bars and underlines */
  --flag-wash:  #fdefe4;

  --pass:       #1e7a4b;
  --pass-wash:  #e6f2eb;
  --warn:       #8a6100;
  --warn-wash:  #fbf1da;
  --fail:       #c0341d;
  --fail-wash:  #fbe7e3;

  --display: "Saira Condensed", "Arial Narrow", sans-serif;
  --body:    "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono:    "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --gut: 1.5rem;
  --max: 1240px;
  --radius: 4px;
  --shadow: 0 1px 2px rgba(10,46,82,.06), 0 2px 8px rgba(10,46,82,.05);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Faint drafting grid, only where it belongs. */
.paper-grid {
  background-image:
    linear-gradient(to right, rgba(70,89,107,.07) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(70,89,107,.07) 1px, transparent 1px);
  background-size: 28px 28px;
}

a { color: var(--ink); text-decoration-color: var(--flag); text-underline-offset: 3px; }
a:hover { color: var(--flag); }

:focus-visible {
  outline: 2px solid var(--flag);
  outline-offset: 2px;
}

img, svg { max-width: 100%; }

/* ---------------------------------------------------------------- type -- */

.display {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: .01em;
  line-height: 1.02;
  margin: 0;
}

h1.display { font-size: 3.4rem; font-size: clamp(2.1rem, 6vw, 4.4rem); }
h2.display { font-size: 2.1rem; font-size: clamp(1.6rem, 3.6vw, 2.6rem); }
h3.display { font-size: 1.32rem; font-size: clamp(1.15rem, 2.2vw, 1.5rem); }

.eyebrow {
  font-family: var(--mono);
  font-size: .69rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--flag);
  margin: 0 0 .85rem;
  display: flex;
  align-items: center;
  gap: .6rem;
}
.eyebrow::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

.lede {
  font-size: 1.06rem;
  color: var(--ink-soft);
  max-width: 62ch;
}

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.fineprint { font-size: .82rem; color: var(--ink-faint); }
.right { text-align: right; }

code {
  font-family: var(--mono);
  font-size: .88em;
  background: var(--paper-deep);
  padding: .1em .35em;
  border-radius: var(--radius);
}

/* ------------------------------------------------------- title block --- */
/* Every sheet carries its identification strip, like a real drawing set.   */

.titleblock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid var(--ink);
  background: var(--paper-lift);
  padding: .45rem .8rem;
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.tb-mark { font-family: var(--display); font-size: 1.05rem; letter-spacing: .08em; font-weight: 700; }
.tb-mark .dot { color: var(--flag); }
.tb-sheet { color: var(--ink-soft); white-space: nowrap; }

/* ------------------------------------------------------------ layout --- */

.wrap { width: min(100% - 2.4rem, var(--max)); margin-inline: auto; }
.stack { display: grid; gap: 1rem; }
.section { padding: 4rem 0; padding: clamp(3rem, 7vw, 5.5rem) 0; }
.section + .section { border-top: 1px solid var(--rule-soft); }

/* -------------------------------------------------------- public nav --- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.topbar-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .7rem 0;
}
.brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.45rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-decoration: none;
}
.brand .dot { color: var(--flag); }

.nav { display: flex; align-items: center; gap: 1.4rem; }
.nav a {
  font-family: var(--mono);
  font-size: .74rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-soft);
}
.nav a:hover { color: var(--flag); }

.navtoggle {
  display: none;
  background: none;
  border: 1px solid var(--ink);
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: .4rem .6rem;
  cursor: pointer;
}

@media (max-width: 780px) {
  .navtoggle { display: block; }
  .nav {
    display: none;
    position: absolute;
    inset: 100% 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--paper-lift);
    border-bottom: 1px solid var(--ink);
  }
  .nav.open { display: flex; }
  .nav a { padding: .85rem 1.2rem; border-top: 1px solid var(--rule-soft); }
  .nav .btn { margin: .8rem 1.2rem 1.1rem; text-align: center; }
}

/* ------------------------------------------------------------ button --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  font-family: var(--mono);
  font-size: .76rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: .68rem 1.15rem;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  border-radius: var(--radius);
  transition: transform .12s ease, background .12s ease, color .12s ease;
}
.btn:hover { background: var(--ink); color: var(--paper); transform: translateY(-1px); }
.btn-primary {
  background: var(--flag-bright);
  border-color: var(--flag-bright);
  color: var(--ink);
  font-weight: 500;
}
.btn-primary:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-quiet { border-color: var(--rule); color: var(--ink-soft); }
.btn-sm { padding: .38rem .7rem; font-size: .68rem; }
.btn-danger:hover { background: var(--fail); border-color: var(--fail); color: #fff; }

/* -------------------------------------------------------------- hero --- */

.hero { padding: 3.6rem 0 4rem; padding: clamp(2.6rem, 6vw, 5rem) 0 clamp(3rem, 6vw, 5rem); }
.hero-grid {
  display: grid;
  gap: 2.6rem;
  gap: clamp(2rem, 5vw, 3.4rem);
  grid-template-columns: 1fr;
  align-items: start;
}
@media (min-width: 940px) {
  .hero-grid { grid-template-columns: 1.05fr .95fr; }
}

.hero h1 { margin: 0 0 1.1rem; }
.hero h1 em {
  font-style: normal;
  color: var(--flag);
  display: block;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.8rem; }

.hero-facts {
  margin-top: 2.4rem;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  font-family: var(--mono);
}
.hero-facts div { padding: .9rem .6rem .2rem 0; }
.hero-facts b {
  display: block;
  font-family: var(--display);
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1;
}
.hero-facts span {
  font-size: .66rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* --------------------------------------------- signature: the card ----- */
/* A job-site inspection card: subcodes down the side, stamped as they pass */

.inspcard {
  background: var(--paper-lift);
  border: 1.5px solid var(--ink);
  box-shadow: 6px 6px 0 rgba(16,24,32,.09);
  position: relative;
  overflow: hidden;
}
.inspcard-head {
  border-bottom: 1.5px solid var(--ink);
  padding: .8rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .8rem;
}
.inspcard-head strong {
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.inspcard-head span {
  font-family: var(--mono);
  font-size: .66rem;
  letter-spacing: .1em;
  color: var(--ink-faint);
  text-transform: uppercase;
}

.insprow {
  display: grid;
  grid-template-columns: 3.1rem 1fr auto;
  align-items: center;
  gap: .8rem;
  padding: .62rem 1rem;
  border-bottom: 1px dashed var(--rule);
  font-size: .9rem;
}
.insprow:last-child { border-bottom: 0; }
.insprow .code {
  font-family: var(--mono);
  font-weight: 500;
  font-size: .8rem;
  color: var(--ink-soft);
  border: 1px solid var(--rule);
  padding: .1rem .3rem;
  text-align: center;
}
.insprow .what { color: var(--ink); }

.stamp {
  font-family: var(--display);
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  border: 2px solid currentColor;
  padding: .1rem .45rem;
  transform: rotate(-4deg);
  opacity: .88;
  white-space: nowrap;
}
.stamp-pass { color: var(--pass); }
.stamp-open { color: var(--ink-faint); border-style: dashed; opacity: .5; transform: none; }
.stamp-fail { color: var(--fail); }
.stamp-now  { color: var(--flag); }

.stamp-drop { animation: stampdrop .45s cubic-bezier(.2,1.5,.4,1) both; }
@keyframes stampdrop {
  0%   { transform: rotate(-14deg) scale(2.4); opacity: 0; }
  60%  { transform: rotate(-4deg) scale(.95); opacity: 1; }
  100% { transform: rotate(-4deg) scale(1); opacity: .88; }
}

@media (prefers-reduced-motion: reduce) {
  .stamp-drop { animation: none; }
  * { scroll-behavior: auto !important; }
}

/* ------------------------------------------------------------ cards ---- */

.grid { display: grid; gap: 1.2rem; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 700px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1000px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

.card {
  background: var(--paper-lift);
  border: 1px solid var(--rule);
  padding: 1.3rem;
  border-radius: var(--radius);
}
.card h3 { margin: .2rem 0 .5rem; font-family: var(--display); font-size: 1.25rem; letter-spacing: .02em; }
.card p { margin: 0; color: var(--ink-soft); font-size: .94rem; }

.card-num {
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .14em;
  color: var(--flag);
}

/* Feature list with a hairline left rule, like a drawing note. */
.notecard {
  border-left: 2px solid var(--flag);
  padding: .2rem 0 .2rem 1rem;
}
.notecard h3 { font-family: var(--display); font-size: 1.2rem; margin: 0 0 .35rem; }
.notecard p { margin: 0; color: var(--ink-soft); font-size: .93rem; }

/* --------------------------------------------------------- app shell --- */

.appbar {
  border-bottom: 1px solid var(--ink);
  background: var(--paper-lift);
  position: sticky;
  top: 0;
  z-index: 40;
}
.appbar-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .55rem 0;
}
.appbar .who {
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  display: flex;
  gap: 1rem;
  align-items: center;
}

.sheethead {
  border-bottom: 1px solid var(--rule);
  padding: 1.4rem 0 1.1rem;
}
.sheethead-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .8rem;
}
.sheethead h1 { font-family: var(--display); font-size: 2.1rem; font-size: clamp(1.7rem, 4vw, 2.5rem); margin: 0; }
.sheethead .meta {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .08em;
  color: var(--ink-faint);
  text-transform: uppercase;
}

/* Tabs scroll horizontally on a phone rather than wrapping into a wall. */
.tabs {
  display: flex;
  gap: .1rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--rule);
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.tabs a {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-soft);
  padding: .7rem .85rem;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tabs a:hover { color: var(--ink); background: var(--paper-deep); }
.tabs a.on { color: var(--ink); border-bottom-color: var(--flag); font-weight: 500; }

/* ------------------------------------------------------------ stats ---- */

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, 1fr); } }

.stat { background: var(--paper-lift); padding: .95rem 1rem; }
.stat span {
  display: block;
  font-family: var(--mono);
  font-size: .64rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: .3rem;
}
.stat b {
  font-family: var(--display);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  display: block;
}
.stat small { font-size: .76rem; color: var(--ink-soft); }
.stat.alert b { color: var(--fail); }
.stat.warnish b { color: var(--warn); }
.stat.good b { color: var(--pass); }

/* --------------------------------------------------------- progress ---- */

.bar {
  height: 7px;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  background: var(--flag-bright);
  transition: width .35s ease;
}
.bar.pass > i { background: var(--pass); }

.pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: .64rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: .16rem .45rem;
  border: 1px solid currentColor;
  border-radius: var(--radius);
  white-space: nowrap;
}
.is-idle { color: var(--ink-faint); }
.is-active { color: var(--flag); background: var(--flag-wash); }
.is-pass { color: var(--pass); background: var(--pass-wash); }
.is-warn { color: var(--warn); background: var(--warn-wash); }
.is-fail { color: var(--fail); background: var(--fail-wash); }

/* ------------------------------------------------------------ gates ---- */

.gate {
  border: 1px solid var(--rule);
  background: var(--paper-lift);
  margin-bottom: .9rem;
}
.gate.passed { border-color: var(--pass); }
.gate.failed { border-color: var(--fail); }

.gate-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .9rem;
  align-items: center;
  padding: .9rem 1rem;
  cursor: pointer;
  user-select: none;
}
.gate-code {
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--flag);
  line-height: 1;
  min-width: 2.2rem;
}
.gate.passed .gate-code { color: var(--pass); }
.gate-title { font-family: var(--display); font-size: 1.2rem; letter-spacing: .02em; }
.gate-test { font-size: .85rem; color: var(--ink-soft); }
.gate-meta { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .45rem; }
.gate-count { font-family: var(--mono); font-size: .72rem; color: var(--ink-faint); }

.gate-body { display: none; padding: 0 1rem 1rem; border-top: 1px dashed var(--rule); }
.gate.open .gate-body { display: block; }

.checklist { list-style: none; margin: .8rem 0 0; padding: 0; }
.checklist li {
  display: flex;
  gap: .65rem;
  align-items: flex-start;
  padding: .42rem 0;
  border-bottom: 1px dashed var(--rule-soft);
  font-size: .94rem;
}
.checklist li:last-child { border-bottom: 0; }
.checklist input[type=checkbox] {
  margin: .25rem 0 0;
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--flag);
  flex: 0 0 auto;
  cursor: pointer;
}
.checklist li.done label { color: var(--ink-faint); text-decoration: line-through; }
.checklist label { cursor: pointer; }

.gate-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }

/* ----------------------------------------------------------- phases ---- */

.phase {
  border: 1px solid var(--rule);
  background: var(--paper-lift);
  margin-bottom: .9rem;
}
.phase-head {
  display: grid;
  grid-template-columns: 3.2rem 1fr;
  gap: .9rem;
  padding: .9rem 1rem;
  align-items: start;
  cursor: pointer;
}
@media (min-width: 820px) {
  .phase-head { grid-template-columns: 3.2rem 1fr 15rem; align-items: center; }
}
.phase-code {
  font-family: var(--mono);
  font-weight: 500;
  font-size: .95rem;
  border: 1px solid var(--ink);
  text-align: center;
  padding: .18rem 0;
}
.phase.complete .phase-code { background: var(--pass); border-color: var(--pass); color: #fff; }
.phase.blocked .phase-code { background: var(--fail); border-color: var(--fail); color: #fff; }
.phase-title { font-family: var(--display); font-size: 1.16rem; }
.phase-sub { font-size: .8rem; color: var(--ink-faint); font-family: var(--mono); margin-top: .18rem; }
.phase-progress { display: grid; gap: .35rem; }
.phase-progress .row { display: flex; justify-content: space-between; font-family: var(--mono); font-size: .72rem; color: var(--ink-soft); }
.phase-body { display: none; padding: 0 1rem 1.1rem; border-top: 1px dashed var(--rule); }
.phase.open .phase-body { display: block; }
.phase-controls { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1rem; align-items: end; }

/* ------------------------------------------------------------ table ---- */

.tablewrap { overflow-x: auto; border: 1px solid var(--rule); background: var(--paper-lift); }

table.reg { width: 100%; border-collapse: collapse; font-size: .88rem; min-width: 720px; }
table.reg th {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-weight: 400;
  font-size: .66rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-align: left;
  padding: .55rem .6rem;
  position: sticky;
  top: 0;
  z-index: 2;
}
table.reg td {
  border-bottom: 1px solid var(--rule-soft);
  padding: 0;
  vertical-align: middle;
}
table.reg tr:hover td { background: #fff; }
table.reg tfoot td {
  border-top: 2px solid var(--ink);
  font-family: var(--mono);
  font-weight: 500;
  padding: .55rem .6rem;
  background: var(--paper-deep);
}

.cell {
  width: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  padding: .5rem .6rem;
  min-height: 2.3rem;
}
.cell:focus { background: #fff; outline: 2px solid var(--flag); outline-offset: -2px; }
.cell.mono, .cell[type=date], .cell[type=number] { font-family: var(--mono); font-size: .82rem; }
.cell.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
select.cell { appearance: none; cursor: pointer; }

.w-xs { width: 5rem; } .w-sm { width: 8.5rem; }
.w-lg { width: 14rem; } .w-xl { width: 20rem; }

td.expiring { background: var(--warn-wash); border-left: 3px solid var(--warn); }
td.expired  { background: var(--fail-wash); border-left: 3px solid var(--fail); }

.rowdel {
  border: 0;
  background: none;
  color: var(--ink-faint);
  cursor: pointer;
  font-family: var(--mono);
  font-size: .95rem;
  padding: .4rem .55rem;
  line-height: 1;
}
.rowdel:hover { color: var(--fail); }

.tablebar {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  justify-content: space-between;
  align-items: center;
  margin: 1.1rem 0 .8rem;
}

/* Registers collapse into stacked records on a phone. */
@media (max-width: 700px) {
  table.reg { min-width: 0; }
  table.reg thead { display: none; }
  table.reg, table.reg tbody, table.reg tr, table.reg td { display: block; width: 100%; }
  table.reg tr {
    border: 1px solid var(--rule);
    margin-bottom: .8rem;
    background: var(--paper-lift);
  }
  table.reg td {
    display: grid;
    grid-template-columns: 8.5rem 1fr;
    align-items: center;
    border-bottom: 1px dashed var(--rule-soft);
  }
  table.reg td::before {
    content: attr(data-label);
    font-family: var(--mono);
    font-size: .63rem;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--ink-faint);
    padding-left: .6rem;
  }
  .cell, .w-xs, .w-sm, .w-lg, .w-xl { width: 100%; }
  .cell.num { text-align: left; }
  table.reg tfoot { display: block; }
  table.reg tfoot td { grid-template-columns: 8.5rem 1fr; }
}

/* ----------------------------------------------------------- zoning ---- */

.relief-d td:first-child { border-left: 3px solid var(--flag); }
.relief-d td { background: var(--flag-wash); }
.zoning-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--ink-soft);
  margin-top: .9rem;
}

/* ------------------------------------------------------------ forms ---- */

.field { display: grid; gap: .3rem; }
.field > span {
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.field small { font-size: .76rem; color: var(--ink-faint); }

input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], select, textarea {
  font: inherit;
  font-size: .95rem;
  color: var(--ink);
  background: var(--paper-lift);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: .58rem .7rem;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--flag);
  outline-offset: -1px;
  background: #fff;
}
textarea { min-height: 6rem; resize: vertical; }

.formgrid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 700px) { .formgrid { grid-template-columns: repeat(2, 1fr); } }
.formgrid .span2 { grid-column: 1 / -1; }

.fieldset {
  border: 1px solid var(--rule);
  background: var(--paper-lift);
  padding: 1.2rem;
  margin-bottom: 1.2rem;
}
.fieldset > legend {
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--flag);
  padding: 0 .45rem;
}

.radioset { display: grid; gap: .6rem; grid-template-columns: 1fr; }
@media (min-width: 560px) { .radioset { grid-template-columns: 1fr 1fr; } }
.radioset label {
  border: 1px solid var(--rule);
  padding: .8rem .9rem;
  cursor: pointer;
  display: grid;
  gap: .2rem;
  background: var(--paper);
}
.radioset label:has(input:checked) { border-color: var(--flag); background: var(--flag-wash); }
.radioset strong { font-family: var(--display); font-size: 1.05rem; }
.radioset span { font-size: .84rem; color: var(--ink-soft); }
.radioset input { margin-right: .4rem; accent-color: var(--flag); }

/* ------------------------------------------------------------ notes ---- */

.note {
  border-left: 3px solid var(--ink);
  background: var(--paper-lift);
  padding: .75rem .95rem;
  font-size: .92rem;
  margin: 0 0 1.1rem;
}
.note-ok   { border-color: var(--pass); background: var(--pass-wash); }
.note-fail { border-color: var(--fail); background: var(--fail-wash); }
.note-warn { border-color: var(--warn); background: var(--warn-wash); }

.empty {
  border: 1px dashed var(--rule);
  padding: 2.6rem 1.4rem;
  text-align: center;
  color: var(--ink-soft);
  background: var(--paper-lift);
}
.empty h3 { font-family: var(--display); font-size: 1.35rem; margin: 0 0 .4rem; }

/* --------------------------------------------------- project cards ----- */

.projcard {
  border: 1px solid var(--rule);
  background: var(--paper-lift);
  padding: 1.15rem;
  display: grid;
  gap: .85rem;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s ease, transform .15s ease;
}
.projcard:hover { border-color: var(--flag); transform: translateY(-2px); color: inherit; }
.projcard h3 { font-family: var(--display); font-size: 1.35rem; margin: 0; }
.projcard .addr { font-size: .85rem; color: var(--ink-soft); }
.projcard .kv {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .6rem;
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--ink-faint);
  border-top: 1px dashed var(--rule);
  padding-top: .7rem;
}
.projcard .kv b { display: block; font-size: 1.05rem; color: var(--ink); font-family: var(--display); }

/* --------------------------------------------------------- install ----- */

.install-wrap {
  width: min(100% - 2.4rem, 34rem);
  margin: 3rem auto;
  display: grid;
  gap: 1.3rem;
}

/* ----------------------------------------------------------- footer ---- */

.foot {
  border-top: 1px solid var(--ink);
  margin-top: 3.5rem;
  padding: 1.6rem 0 2.6rem;
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .07em;
  color: var(--ink-faint);
}
.foot-in { display: flex; flex-wrap: wrap; gap: .8rem 1.6rem; justify-content: space-between; }
.foot a { color: var(--ink-soft); text-decoration: none; }
.foot a:hover { color: var(--flag); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.4rem;
  transform: translateX(-50%) translateY(140%);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: .76rem;
  letter-spacing: .06em;
  padding: .7rem 1.1rem;
  border-radius: var(--radius);
  z-index: 90;
  transition: transform .25s ease;
  max-width: calc(100% - 2rem);
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.bad { background: var(--fail); }

.sr {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.skip {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--flag); color: #fff; padding: .6rem 1rem;
  font-family: var(--mono); font-size: .74rem;
}
.skip:focus { left: .6rem; top: .6rem; color: #fff; }

@media print {
  .topbar, .appbar, .tabs, .foot, .btn, .rowdel, .toast { display: none !important; }
  body { background: #fff; }
  .card, .gate, .phase, .tablewrap { break-inside: avoid; }
}

/* =========================================================================
   Additions: logo, reactive feedback, rings, S-curve, jurisdiction, filters
   ========================================================================= */

/* ------------------------------------------------------------- logo ---- */

.logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
}
.logo-lockup {
  display: block;
  height: 40px;
  width: auto;
}
.topbar .logo-lockup { height: 46px; }
.appbar .logo-lockup { height: 38px; }
.tb-mark .logo-mark  { height: 22px; width: auto; }

.logo:hover { opacity: .85; }

.tb-mark {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
}

@media (max-width: 620px) {
  .topbar .logo-lockup { height: 34px; }
  .appbar .logo-lockup { height: 30px; }
}

/* ------------------------------------------- saving + save feedback ---- */

.savechip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  opacity: 0;
  transition: opacity .2s ease;
}
.savechip i {
  width: .5rem; height: .5rem;
  border-radius: 50%;
  background: var(--pass);
  display: block;
}
.is-saving .savechip { opacity: 1; }
.is-saving .savechip i { background: var(--flag); animation: pulse .8s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }

.cell.saved, input.saved, select.saved, textarea.saved { animation: savedflash .8s ease; }
@keyframes savedflash {
  0%   { background: var(--pass-wash); box-shadow: inset 2px 0 0 var(--pass); }
  100% { background: transparent; box-shadow: none; }
}
.cell.errored, input.errored, select.errored, textarea.errored { animation: errflash 1.1s ease; }
@keyframes errflash {
  0%, 60% { background: var(--fail-wash); box-shadow: inset 2px 0 0 var(--fail); }
  100%    { background: transparent; box-shadow: none; }
}

[data-bind].ticked { animation: tick .45s ease; }
@keyframes tick {
  0%   { color: var(--flag); transform: translateY(-2px); }
  100% { color: inherit; transform: none; }
}

tr.row-new { animation: rownew .7s ease; }
@keyframes rownew {
  0%   { background: var(--flag-wash); }
  100% { background: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .savechip i, .cell.saved, .cell.errored, [data-bind].ticked, tr.row-new,
  input.saved, input.errored, select.saved, select.errored { animation: none; }
}

/* ------------------------------------------------------------ rings ---- */

.ringrow {
  display: grid;
  gap: 1.2rem;
  grid-template-columns: 1fr;
  margin: 1.6rem 0;
}
@media (min-width: 760px) { .ringrow { grid-template-columns: 1fr 1fr; } }

.ringcard {
  display: grid;
  grid-template-columns: 5.6rem 1fr;
  gap: 1.1rem;
  align-items: center;
  border: 1px solid var(--rule);
  background: var(--paper-lift);
  padding: 1.1rem 1.2rem;
}
.ringcard h3 { margin: 0 0 .3rem; font-size: 1.3rem; }
.ringcard p { margin: 0 0 .2rem; font-size: .9rem; color: var(--ink-soft); }

.ring { width: 5.6rem; height: 5.6rem; transform: rotate(-90deg); }
/* Colour comes from presentation attributes on the elements themselves, not
   from here: a CSS rule outranks a presentation attribute, and var() does not
   resolve inside SVG paint in every renderer. This keeps only behaviour. */
.ring-value {
  stroke-linecap: butt;
  transition: stroke-dashoffset .5s cubic-bezier(.3,.8,.3,1);
}
.ring-label {
  transform: rotate(90deg);
  transform-origin: 60px 60px;
  font-family: var(--display);
  font-size: 30px;
  font-weight: 700;
  fill: var(--ink);
}

/* ---------------------------------------------------------- S-curve ---- */

.panel {
  border: 1px solid var(--rule);
  background: var(--paper-lift);
  padding: 1.2rem;
  margin-top: 1.6rem;
}
.panel-head {
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: .8rem;
}
.panel-head h3 { margin: 0; font-size: 1.35rem; }

.curve { width: 100%; height: auto; display: block; }
/* Same rule as the rings: paint is set as attributes when the curve is drawn. */
.curve-tick { font-family: var(--mono); }

.curve-key { display: flex; gap: 1rem; font-size: .7rem; color: var(--ink-soft); }
.curve-key span { display: inline-flex; align-items: center; gap: .35rem; }
.curve-key i { width: 1.1rem; height: 0; border-top: 2px solid var(--flag); display: block; }
.curve-key .k-planned { border-top: 2px dashed var(--ink-soft); }

/* --------------------------------------------------- jurisdiction ------ */

.jurcard h3 { margin: 0 0 .7rem; }
.jurlist {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: .35rem .8rem;
  margin: 0;
  font-size: .86rem;
}
.jurlist dt {
  font-family: var(--mono);
  font-size: .64rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding-top: .18rem;
}
.jurlist dd { margin: 0; color: var(--ink); }
@media (max-width: 520px) {
  .jurlist { grid-template-columns: 1fr; gap: .1rem; }
  .jurlist dd { margin-bottom: .5rem; }
}

.jurpreview {
  display: grid;
  gap: 1px;
  background: var(--rule-soft);
  border: 1px solid var(--rule-soft);
  grid-template-columns: 1fr;
  margin-top: 1rem;
}
@media (min-width: 640px) { .jurpreview { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1020px) { .jurpreview { grid-template-columns: 1fr 1fr 1fr; } }
.jurpreview > div { background: var(--paper); padding: .6rem .75rem; }
.jurpreview .span-full { grid-column: 1 / -1; }
.jurpreview span {
  display: block;
  font-family: var(--mono);
  font-size: .6rem;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: .2rem;
}
.jurpreview strong { font-weight: 500; font-size: .86rem; }

/* ------------------------------------------------- live pro forma ------ */

.pfbar {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  margin-top: 1.2rem;
}
@media (min-width: 700px) { .pfbar { grid-template-columns: repeat(4, 1fr); } }
.pfbar > div { background: var(--paper); padding: .8rem .9rem; }
.pfbar span {
  display: block;
  font-family: var(--mono);
  font-size: .62rem;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: .25rem;
}
.pfbar b {
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1;
}
.pfbar > div.alert b   { color: var(--fail); }
.pfbar > div.warnish b { color: var(--warn); }
.pfbar > div.good b    { color: var(--pass); }
.pf-verdict { margin: .6rem 0 0; }

/* --------------------------------------------------- filter and sort --- */

.tablebar-left, .tablebar-right {
  display: flex;
  align-items: center;
  gap: .7rem;
  flex-wrap: wrap;
}
.filterbox input {
  width: 12rem;
  padding: .38rem .6rem;
  font-size: .85rem;
  font-family: var(--mono);
}
@media (max-width: 560px) { .filterbox input { width: 100%; } }

table.reg th[data-sort] { cursor: pointer; user-select: none; position: relative; padding-right: 1.1rem; }
table.reg th.right { text-align: right; }
table.reg th[data-sort]:hover { color: #fff; background: #1d3550; }
table.reg th[data-sort]::after {
  content: "";
  position: absolute;
  right: .45rem;
  top: 50%;
  margin-top: -2px;
  border: 3px solid transparent;
  opacity: .35;
  border-top-color: currentColor;
}
table.reg th.sort-asc::after  { opacity: 1; border-top-color: transparent; border-bottom-color: currentColor; margin-top: -5px; }
table.reg th.sort-desc::after { opacity: 1; }

table.reg tbody tr[hidden] { display: none; }

/* ------------------------------------------------------ zoning rows ---- */

.relief-c td:first-child { border-left: 3px solid var(--warn); }
.relief-c td { background: var(--warn-wash); }

/* -------------------------------------------------------- range input -- */

input[type=range] {
  width: 100%;
  accent-color: var(--flag);
  background: transparent;
  padding: 0;
  border: 0;
}

/* =========================================================================
   Jurisdiction facts and provenance
   ========================================================================= */

.factgroup { margin-top: 2rem; }

.fact {
  border: 1px solid var(--rule);
  border-left: 3px solid var(--ink-faint);
  background: var(--paper-lift);
  padding: 1.1rem 1.2rem;
  margin-bottom: .9rem;
}
.fact.verified   { border-left-color: var(--pass); }
.fact.stale      { border-left-color: var(--warn); }
.fact.unverified { border-left-color: var(--ink-faint); }

.fact-head {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: .9rem;
}
.fact-head h3 {
  font-family: var(--display);
  font-size: 1.15rem;
  margin: 0 0 .15rem;
}
.fact-head .fineprint { margin: 0; max-width: 54ch; }

.fact-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .25rem;
  text-align: right;
}
@media (max-width: 620px) {
  .fact-status { align-items: flex-start; text-align: left; }
}

.fact-value {
  min-height: 3.4rem;
  font-size: .95rem;
}

.fact-grid {
  display: grid;
  gap: .8rem;
  grid-template-columns: 1fr;
  margin-top: .8rem;
}
@media (min-width: 700px)  { .fact-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1040px) { .fact-grid { grid-template-columns: 1.3fr 1.6fr .8fr .9fr; } }

.fact-foot {
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  padding-top: .8rem;
  border-top: 1px dashed var(--rule);
}
.fact-foot .fineprint { margin: 0; max-width: 62ch; }
.fact-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.pill-xs {
  font-size: .55rem;
  padding: .08rem .32rem;
  margin-left: .35rem;
  vertical-align: middle;
}

.jurmeter { margin: .2rem 0 .9rem; }

.jurlist dd .fineprint {
  display: block;
  font-size: .72rem;
  margin-top: .1rem;
}

[data-site-facts] dd { min-height: 1.2rem; }

/* =========================================================================
   About — the discipline wall
   Each role is a brick; courses offset so they bond across the joint below,
   the same way the mark does.
   ========================================================================= */

.wall {
  margin-top: 2rem;
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  padding: 1.2rem 0;
}

.course + .course { margin-top: 1.4rem; }

.course-label {
  display: block;
  font-family: var(--mono);
  font-size: .66rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--flag);
  margin-bottom: .5rem;
}

.course-bricks {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

/* The offset is the bond: alternate courses start half a brick in. */
.course-offset .course-bricks { padding-left: 3.2rem; }
@media (max-width: 700px) {
  .course-offset .course-bricks { padding-left: 1.4rem; }
}

.brick {
  display: inline-block;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--body);
  font-size: .84rem;
  line-height: 1.2;
  padding: .62rem .95rem;
  border-radius: 1px;
  white-space: nowrap;
}

/* Every third brick in flagging pink, so the wall reads as two hands. */
.course-bricks .brick:nth-child(3n) {
  background: var(--flag);
}

@media (max-width: 560px) {
  .brick { font-size: .78rem; padding: .5rem .7rem; white-space: normal; }
}

.about-mark { display: inline-block; }

/* =========================================================================
   Vendors — application, vetting, directory
   ========================================================================= */

.statepick {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(3.6rem, 1fr));
  gap: 4px;
  margin-top: .5rem;
}
.statebox {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  border: 1px solid var(--rule);
  background: var(--paper);
  padding: .38rem .2rem;
  font-family: var(--mono);
  font-size: .72rem;
  cursor: pointer;
  border-radius: var(--radius);
}
.statebox input { accent-color: var(--flag-bright); margin: 0; width: .85rem; height: .85rem; }
.statebox:has(input:checked) {
  border-color: var(--flag-bright);
  background: var(--flag-wash);
  font-weight: 500;
}

.checkline {
  display: flex;
  gap: .7rem;
  align-items: flex-start;
  font-size: .94rem;
  line-height: 1.5;
}
.checkline input {
  margin: .25rem 0 0;
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--flag-bright);
  flex: 0 0 auto;
}

/* The pass tick used in feature lists reads as a marker, not a checkbox. */
.checklist .pill { margin-top: .1rem; }

/* =========================================================================
   Theme — blue, orange, white
   Layered after the base so the component shapes stay and only their surface
   treatment changes: white cards on a tinted canvas, a solid blue masthead,
   orange for the things you can act on.
   ========================================================================= */

body { background: var(--canvas); }

/* The drafting grid read as a technical drawing. Gone; a flat tinted band
   does the same separating work without the character. */
.paper-grid {
  background-image: none;
  background: linear-gradient(180deg, var(--blue-wash) 0%, var(--canvas) 100%);
}

/* ---------------------------------------------------------- mastheads --- */

.topbar,
.appbar {
  background: var(--ink);
  border-bottom: 3px solid var(--flag-bright);
  backdrop-filter: none;
}
.topbar .nav a,
.appbar .who,
.appbar .who span { color: #cfe0ee; }
.topbar .nav a:hover { color: #fff; }
.topbar .navtoggle { color: #fff; border-color: rgba(255,255,255,.5); }

.appbar .btn-quiet,
.topbar .btn-quiet {
  border-color: rgba(255,255,255,.35);
  color: #eaf2f8;
}
.appbar .btn-quiet:hover,
.topbar .btn-quiet:hover { background: #fff; color: var(--ink); border-color: #fff; }

@media (max-width: 780px) {
  .nav { background: var(--ink); border-bottom-color: var(--flag-bright); }
  .nav a { border-top-color: rgba(255,255,255,.14); }
}

/* ------------------------------------------------------------ surfaces -- */

.card,
.fieldset,
.inspcard,
.panel,
.ringcard,
.projcard,
.fact,
.tablewrap,
.empty {
  background: #fff;
  border-color: var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stats {
  background: var(--rule);
  border-color: var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.stat { background: #fff; }

.inspcard { box-shadow: var(--shadow); border-width: 1px; }
.inspcard-head {
  background: var(--blue-wash);
  border-bottom: 1px solid var(--rule);
}
.inspcard-head strong { color: var(--ink); }

/* --------------------------------------------------------------- type --- */

.eyebrow { color: var(--flag); }
.eyebrow::after { background: var(--rule); }

h1.display, h2.display, h3.display,
.sheethead h1, .card h3, .projcard h3 { color: var(--ink); }

/* Mono was doing too much work. Keep it for data, codes and figures;
   labels go back to the body face. */
.stat span,
.field > span,
.jurpreview span,
.pfbar span,
.course-label,
.fact-head .fact-status .pill {
  font-family: var(--body);
  font-weight: 600;
  letter-spacing: .06em;
}

.sheethead .meta { color: var(--ink-faint); }

a { text-decoration-color: var(--flag-bright); }
a:hover { color: var(--blue); }
.lede { color: var(--ink-soft); }

/* ------------------------------------------------------------ controls -- */

.btn { border-radius: var(--radius); }
.btn-primary {
  background: var(--flag);
  border-color: var(--flag);
  color: #fff;
}
.btn-primary:hover {
  background: #99420b;
  border-color: #99420b;
  color: #fff;
}
.btn:not(.btn-primary):not(.btn-quiet) {
  border-color: var(--blue);
  color: var(--blue);
}
.btn:not(.btn-primary):not(.btn-quiet):hover {
  background: var(--blue);
  color: #fff;
}

input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], input[type=search], input[type=url], select, textarea {
  background: #fff;
  border-color: var(--rule);
  border-radius: var(--radius);
}
input:focus, select:focus, textarea:focus {
  outline-color: var(--flag-bright);
  border-color: var(--flag-bright);
}
:focus-visible { outline-color: var(--flag-bright); }

/* --------------------------------------------------------------- tabs --- */

.tabs {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-top: .2rem;
}
.tabs a { font-family: var(--body); font-weight: 600; letter-spacing: .04em; }
.tabs a.on {
  border-bottom-width: 3px;
  border-bottom-color: var(--flag-bright);
  color: var(--ink);
  background: var(--blue-wash);
}
.tabs a:hover { background: var(--blue-wash); }

/* -------------------------------------------------------------- tables -- */

table.reg th {
  background: var(--ink);
  font-family: var(--body);
  font-weight: 600;
  letter-spacing: .05em;
  border-color: var(--ink);
}
table.reg th[data-sort]:hover { background: #123f6c; }
table.reg tr:hover td { background: var(--blue-wash); }
table.reg tfoot td { background: var(--blue-wash); border-top-color: var(--ink); }

/* ------------------------------------------------------------- status --- */

/* The rubber-stamp treatment went with the drafting theme. These are chips. */
.stamp {
  font-family: var(--body);
  font-weight: 600;
  font-size: .68rem;
  letter-spacing: .05em;
  text-transform: none;
  border-width: 1px;
  border-radius: 999px;
  padding: .18rem .6rem;
  transform: none;
  opacity: 1;
}
.stamp-pass { color: var(--pass); background: var(--pass-wash); border-color: #bcd9c9; }
.stamp-open { color: var(--ink-faint); background: var(--canvas); border-color: var(--rule); border-style: solid; opacity: 1; }
.stamp-now  { color: var(--flag); background: var(--flag-wash); border-color: #f0cdb1; }
.stamp-fail { color: var(--fail); background: var(--fail-wash); border-color: #eec4bc; }
.stamp-drop { animation: none; }

.pill { border-radius: 999px; font-family: var(--body); font-weight: 600; letter-spacing: .04em; }
.is-active { color: var(--flag); background: var(--flag-wash); border-color: #f0cdb1; }
.is-pass   { border-color: #bcd9c9; }
.is-warn   { border-color: #e6d3a8; }
.is-fail   { border-color: #eec4bc; }
.is-idle   { border-color: var(--rule); background: var(--canvas); }

.bar { background: var(--paper-deep); border-color: var(--rule); border-radius: 999px; }
.bar > i { background: var(--flag-bright); border-radius: 999px; }
.bar.pass > i { background: var(--pass); }

/* --------------------------------------------------------- misc surfaces */

.titleblock {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  border-radius: var(--radius);
}
.titleblock .tb-sheet { color: #a9c4da; }
.tb-mark { color: #fff; }

.note { border-radius: var(--radius); background: var(--blue-wash); border-left-color: var(--blue); }
.note-ok   { background: var(--pass-wash); border-left-color: var(--pass); }
.note-warn { background: var(--warn-wash); border-left-color: var(--flag-bright); }
.note-fail { background: var(--fail-wash); border-left-color: var(--fail); }

.notecard { border-left-color: var(--flag-bright); }
.card-num { color: var(--flag); font-family: var(--body); font-weight: 700; letter-spacing: .08em; }

.gate, .phase { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
.gate-code { color: var(--flag); }
.gate.passed .gate-code { color: var(--pass); }
.phase-code { border-radius: var(--radius); }

.brick { border-radius: var(--radius); background: var(--ink); }
.course-bricks .brick:nth-child(3n) { background: var(--flag-bright); color: #fff; }
.course-label { color: var(--flag); }

.hero-facts b { color: var(--ink); }
.foot { border-top-color: var(--rule); }
.wall { border-color: var(--ink); }

.ring-value { stroke-linecap: round; }

/* =========================================================================
   Navigation — larger, heavier, and on one line
   The uppercase micro-type read as a caption rather than a menu, and at that
   letter-spacing several items were wrapping to two lines in the bar.
   ========================================================================= */

.topbar .nav {
  gap: 1.5rem;
  align-items: center;
}
.topbar .nav a {
  font-family: var(--body);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .005em;
  text-transform: none;
  white-space: nowrap;
  color: #dbe8f2;
  padding: .25rem 0;
  border-bottom: 2px solid transparent;
}
.topbar .nav a:hover {
  color: #fff;
  border-bottom-color: var(--flag-bright);
}
.topbar .nav a.btn {
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: none;
  border-bottom: 0;
  padding: .6rem 1.1rem;
}
.topbar .nav a.btn:hover { border-bottom: 0; }

.navtoggle {
  font-family: var(--body);
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: none;
  padding: .5rem .8rem;
}

/* Nothing in the chrome should wrap mid-label. */
.appbar .who {
  gap: 1.1rem;
  font-family: var(--body);
  font-size: .92rem;
  font-weight: 600;
  letter-spacing: .005em;
  text-transform: none;
  white-space: nowrap;
}
.appbar .who .btn,
.topbar .btn-sm {
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .01em;
  text-transform: none;
  white-space: nowrap;
  padding: .5rem .9rem;
}
.btn { white-space: nowrap; }

/* Project tabs read as navigation now, not as a legend. */
.tabs a {
  font-family: var(--body);
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .005em;
  text-transform: none;
  padding: .85rem 1.05rem;
  white-space: nowrap;
}
.tabs a.on { font-weight: 700; }

/* Section headers in the queue and library filters. */
.eyebrow {
  font-family: var(--body);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .09em;
}

@media (max-width: 900px) {
  .topbar .nav { gap: 1.1rem; }
  .topbar .nav a { font-size: .94rem; }
  .tabs a { font-size: .9rem; padding: .8rem .85rem; }
}

@media (max-width: 780px) {
  .nav a {
    font-size: 1.05rem;
    padding: .95rem 1.2rem;
    white-space: normal;
    border-bottom: 0;
  }
  .appbar .who { font-size: .85rem; gap: .6rem; }
}

/* Section links live as links; only the two actions are buttons, so the bar
   stops competing with itself once every link is present. */
.appnav {
  display: flex;
  gap: 1.35rem;
  align-items: center;
}
.appnav a {
  font-family: var(--body);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .005em;
  color: #dbe8f2;
  text-decoration: none;
  white-space: nowrap;
  padding: .25rem 0;
  border-bottom: 2px solid transparent;
}
.appnav a:hover { color: #fff; border-bottom-color: var(--flag-bright); }

.whoami {
  font-weight: 600;
  color: #9fbcd4;
  white-space: nowrap;
  padding-left: .3rem;
  border-left: 1px solid rgba(255,255,255,.22);
}

/* Eleven tabs will not fit on one line at any sensible size. Wrap them on a
   wide screen rather than hiding the last few behind a scroll. */
@media (min-width: 1000px) {
  .tabs { flex-wrap: wrap; overflow-x: visible; }
}

@media (max-width: 1100px) {
  .appnav { gap: 1rem; }
  .appnav a { font-size: .92rem; }
  .appbar .who { gap: .8rem; }
}
@media (max-width: 820px) {
  .appnav { display: none; }
  .whoami { border-left: 0; }
}

/* The bar must never let its own items collide. */
.appbar-in { gap: 1.2rem; }
.appbar .who { min-width: 0; flex-wrap: nowrap; }
.appnav { min-width: 0; }
.whoami {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: .2rem;
}
@media (max-width: 1240px) {
  .appnav { gap: 1.05rem; }
  .appnav a { font-size: .95rem; }
  .whoami { display: none; }
}

/* The signed-in name was the widest, least useful item in the bar and pushed
   the section links into the actions. "Sign out" already implies who you are. */
.whoami { display: none; }

/* =========================================================================
   Masthead layout — inline, not flex
   A row of links and two buttons is exactly what inline layout is for. Flex
   here bought nothing and behaved differently across engines; inline-block
   wraps predictably everywhere and cannot overlap.
   ========================================================================= */

.appbar-in,
.topbar-in {
  display: block;
  text-align: right;
  padding: .7rem 0;
}
.appbar-in .logo,
.topbar-in .logo {
  float: left;
  margin-right: 1.5rem;
}
.appbar-in::after,
.topbar-in::after { content: ""; display: block; clear: both; }

.appbar .who,
.topbar .nav {
  display: inline;
  white-space: normal;
}
.appnav { display: inline; }

.appnav a,
.topbar .nav a {
  display: inline-block;
  margin: .3rem 0 .3rem 1.5rem;
  vertical-align: middle;
}
.appbar .who .btn,
.topbar .nav .btn {
  display: inline-block;
  margin: .3rem 0 .3rem 1rem;
  vertical-align: middle;
}
.topbar .nav a.btn { margin-left: 1.4rem; }

.navtoggle { float: right; margin-top: .3rem; }

@media (max-width: 780px) {
  .appbar-in, .topbar-in { text-align: left; }
  .nav a, .nav .btn { display: block; margin: 0; }
  .appnav a { margin-left: 1rem; }
}

/* =========================================================================
   Document repository
   ========================================================================= */

.filecats {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: sticky;
  top: 1rem;
}
.filecats a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: .6rem .85rem;
  font-size: .88rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid var(--rule-soft);
  border-left: 3px solid transparent;
}
.filecats a:last-child { border-bottom: 0; }
.filecats a:hover { background: var(--blue-wash); color: var(--ink); }
.filecats a.on {
  background: var(--blue-wash);
  border-left-color: var(--flag-bright);
  color: var(--ink);
  font-weight: 700;
}
.filecats b {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--ink-faint);
  background: var(--canvas);
  border: 1px solid var(--rule);
  border-radius: 999px;
  min-width: 1.9rem;
  text-align: center;
  padding: .05rem .35rem;
}
.filecats a.on b { background: #fff; color: var(--flag); border-color: #f0cdb1; }

.filetag {
  display: inline-block;
  font-family: var(--mono);
  font-size: .62rem;
  font-weight: 500;
  letter-spacing: .06em;
  background: var(--ink);
  color: #fff;
  border-radius: 3px;
  padding: .12rem .38rem;
  margin-right: .45rem;
  vertical-align: middle;
}

@media (max-width: 900px) {
  .grid-2:has(.filecats) { grid-template-columns: 1fr !important; }
  .filecats { position: static; }
  .filecats a { font-size: .92rem; }
}

/* ------------------------------------------- application, forms, notice ---- */

input[type=tel], input[type=time], input[type=search], input:not([type]) {
  font: inherit; font-size: .95rem; color: var(--ink); background: var(--paper-lift);
  border: 1px solid var(--rule); border-radius: var(--radius); padding: .58rem .7rem; width: 100%;
}
input.cell:not([type]), input.cell[type=date] { border: 1px solid transparent; background: transparent; padding: .3rem .4rem; font-size: .86rem; }
input.cell:not([type]):hover, input.cell[type=date]:hover { border-color: var(--rule); }
.h2 { font-family: var(--display); font-size: 1.45rem; margin: 1.2rem 0 .5rem; }
.h3 { font-family: var(--display); font-size: 1.15rem; }
.appgrid .field-xs { max-width: 9rem; }
.appq .from { font-style: normal; text-transform: none; letter-spacing: 0; color: var(--ink-faint); background: var(--paper); border: 1px dashed var(--rule); padding: 0 .3rem; margin-left: .3rem; font-size: .66rem; }
.checkgrid { display: grid; gap: .3rem 1rem; grid-template-columns: 1fr; }
@media (min-width: 700px) { .checkgrid { grid-template-columns: repeat(2, 1fr); } }
.rows-q { min-width: 0; }
.saved { outline: 2px solid var(--pass) !important; transition: outline-color .6s; }
.bad { color: var(--fail); }
.linkish { background: none; border: 0; padding: 0; color: var(--flag); cursor: pointer; text-decoration: underline; }

/* form filler */
.ff-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; }
.ff-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.ff-wrap { display: grid; gap: 1.2rem; grid-template-columns: 1fr; margin-top: 1rem; align-items: start; }
@media (min-width: 1180px) { .ff-wrap { grid-template-columns: minmax(0, 1fr) 27rem; } .ff-side { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto; } }
.ff-pages { display: grid; gap: 1rem; justify-items: center; overflow-x: auto; }
.ff-pages.adding .ff-page { cursor: crosshair; outline: 2px dashed var(--flag); }
.ff-page { position: relative; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.ff-page canvas { display: block; }
.ff-layer { position: absolute; inset: 0; }
.ff-box { position: absolute; background: rgba(184, 80, 14, .07); border: 1px solid rgba(184, 80, 14, .35); color: #0b2a6b;
  font-family: Helvetica, Arial, sans-serif; line-height: 1.15; padding: 0 2px; overflow: hidden; white-space: nowrap; cursor: pointer; }
.ff-box.multi { white-space: pre-wrap; }
.ff-box.empty { background: rgba(192, 52, 29, .08); border-style: dashed; }
.ff-box.hot { outline: 3px solid var(--flag); z-index: 2; }
.ff-check { display: grid; place-items: center; font-weight: bold; }
.ff-pl { position: absolute; color: #0b2a6b; font-family: Helvetica, Arial, sans-serif; white-space: pre; line-height: 1.2; cursor: move;
  background: rgba(37, 99, 235, .08); outline: 1px dashed rgba(37, 99, 235, .55); padding: 0 2px; touch-action: none; }
.ff-side { border: 1px solid var(--rule); background: var(--paper-lift); padding: .9rem; }
.ff-sidehead, .ff-place, .ff-sidefoot { padding-bottom: .7rem; margin-bottom: .7rem; border-bottom: 1px solid var(--rule); }
.ff-sidefoot { border: 0; display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; margin: .6rem 0 0; }
.ff-row { display: grid; gap: .3rem; padding: .55rem .2rem; border-bottom: 1px dotted var(--rule); }
.ff-row.is-auto { background: #fffaf0; }
.ff-row.hot { background: var(--flag-wash, #fde7d6); }
.ff-row select, .ff-row input, .ff-row textarea { font-size: .84rem; padding: .35rem .45rem; }
.ff-row textarea { min-height: 3.5rem; }
.ff-label strong { font-size: .86rem; display: block; }
.ff-label small { display: block; font-size: .7rem; color: var(--ink-faint); font-family: var(--mono); overflow-wrap: anywhere; }
.ff-label .ff-guess { color: var(--warn); font-family: inherit; }
.ff-val { display: flex; gap: .4rem; align-items: center; }
.ff-val input[type=checkbox] { width: 1.2rem; height: 1.2rem; accent-color: var(--flag); }
.ff-prow .ff-val input { flex: 1 1 auto; min-width: 0; }
.ff-prow .ff-val input[type=number] { flex: 0 0 4.2rem; width: 4.2rem; }
.ff-prow .ff-val .btn { flex: none; }

/* notice */
@media (min-width: 900px) { .nstats { grid-template-columns: repeat(4, 1fr); } }
.ntable td { vertical-align: top; }
.ntable .cell { width: 100%; }
.ntable .csz { display: grid; grid-template-columns: 1fr 3.6rem 5.6rem; gap: .2rem; }
.ntable tr.st-to_send td:first-child { box-shadow: inset 3px 0 0 var(--rule); }
.ntable tr.st-mailed td:first-child, .ntable tr.st-served td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.ntable tr.st-delivered td:first-child { box-shadow: inset 3px 0 0 var(--pass); }
.ntable tr.st-returned td:first-child { box-shadow: inset 3px 0 0 var(--fail); }
.proofs { white-space: nowrap; }
.proof { display: inline-block; width: 2.6rem; height: 2.6rem; border: 1px solid var(--rule); margin: 0 .2rem .2rem 0; overflow: hidden; background: #fff;
  text-align: center; font: .62rem/2.6rem var(--mono); }
.proof img { width: 100%; height: 100%; object-fit: cover; }
#n-previewtable tr.needs td { background: var(--warn-wash); }
#n-previewtable tr.off td { opacity: .35; }
#n-previewtable .cell { min-width: 4.5rem; }
.scanq { display: grid; gap: .8rem; margin-top: .8rem; }
.scancard { display: grid; grid-template-columns: 9rem 1fr; gap: .9rem; border: 1px solid var(--rule); border-left: 4px solid var(--rule); padding: .7rem; background: #fff; }
.scancard.sure { border-left-color: var(--pass); }
.scancard.maybe { border-left-color: var(--warn); }
.scancard.none { border-left-color: var(--fail); }
.scanthumb img { width: 100%; max-height: 12rem; object-fit: contain; background: var(--paper); border: 1px solid var(--rule); }
.scanbody { display: grid; gap: .45rem; align-content: start; }
.scanbody .field > span { font-size: .6rem; }
.scanact { display: flex; gap: .4rem; flex-wrap: wrap; }
.ntoast { position: fixed; right: 1rem; bottom: 1rem; z-index: 50; max-width: 28rem; box-shadow: 0 4px 16px rgba(0,0,0,.18); }
@media (max-width: 640px) { .scancard { grid-template-columns: 1fr; } }
.ntable { min-width: 1120px; }
.ntable td[data-label="Owner"] { min-width: 19rem; }
.ntable td[data-label="Certified mail no."] .cell { font-size: .78rem; min-width: 14rem; }
@media (max-width: 780px) { .ntable { min-width: 0; } .ntable td[data-label="Owner"] { min-width: 0; } }
