@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("/fonts/space-grotesk-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("/fonts/space-grotesk-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Brand tokens (colors, typography, radii) live in /brand.css */

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--page);
  font-family: var(--brand-font-ui);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
button { font-family: inherit; }
.boot { padding: 32px; color: var(--muted); }

.shell {
  display: flex;
  flex-wrap: wrap;
  min-height: 100vh;
  background: var(--page);
}

/* Sidebar */
.nav {
  flex: 1 1 232px;
  background: var(--sidebar);
  color: var(--on-dark-muted);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 280px;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.brand-name {
  font-family: var(--brand-font-display);
  font-weight: 600;
  font-size: 17px;
  color: var(--on-dark);
  letter-spacing: -0.01em;
}
.brand-sub { font-size: 12px; color: var(--on-dark-dim); }
.nav-links { display: flex; flex-direction: column; gap: 4px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--on-dark-muted);
  text-decoration: none;
  font-weight: 500;
}
.nav-link:hover { color: var(--on-dark); background: rgba(255,255,255,0.06); }
.nav-link.is-active {
  color: var(--on-dark);
  background: rgba(255,255,255,0.09);
}
.nav-link.is-active svg { stroke: var(--icon); }
.nav-link.is-stub { cursor: default; }
.nav-label { flex: 1; }
.nav-badge {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  background: var(--badge);
  color: var(--badge-fg);
  border-radius: 999px;
  padding: 1px 8px;
}
.nav-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--avatar);
  color: var(--avatar-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  flex: 0 0 34px;
}
.nav-foot-name { font-size: 13px; font-weight: 500; color: var(--on-dark); }
.nav-foot-role { font-size: 12px; color: var(--on-dark-dim); }
.dev-switch { margin-top: 10px; padding: 0 8px 4px; }
.dev-switch label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #F2B14C;
  margin-bottom: 4px;
}
.dev-switch select {
  width: 100%;
  font: inherit;
  font-size: 12px;
  color: var(--on-dark);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 6px 8px;
}

/* Main */
.main {
  flex: 999 1 560px;
  min-width: 0;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-end;
}
.crumb, .kicker { font-size: 13px; color: var(--muted); }
.crumb a { font-weight: 500; text-decoration: none; }
h1 {
  margin: 4px 0 0;
  font-family: var(--brand-font-display);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.sub { margin: 4px 0 0; color: var(--muted); }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.input, .btn {
  font: inherit;
  min-height: 44px;
  box-sizing: border-box;
  border-radius: 10px;
  cursor: pointer;
}
.input {
  padding: 0 14px;
  border: 1px solid var(--muted-fill);
  background: var(--card);
  color: var(--text);
  min-width: 200px;
  cursor: text;
}
.btn {
  font-weight: 500;
  padding: 0 18px;
  border: 1px solid var(--muted-fill);
  background: var(--card);
  color: var(--text);
}
.btn-primary {
  font-weight: 600;
  border: none;
  background: var(--accent);
  color: var(--on-dark);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-sm {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13px;
}
.btn:disabled, .btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

/* Cards / KPIs */
.kpis, .alert-grid { display: flex; flex-wrap: wrap; gap: 16px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
}
.kpi {
  flex: 1 1 220px;
  padding: 20px;
}
.kpi-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi-value {
  font-family: var(--brand-font-display);
  font-size: 32px;
  font-weight: 600;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}
.kpi-note { margin-top: 6px; font-size: 13px; color: var(--muted); }
.kpi-note.watch { color: var(--watch-fg); font-weight: 500; }
.kpi-note.risk { color: var(--risk-fg); font-weight: 500; }
.kpi-track {
  margin-top: 12px;
  height: 6px;
  border-radius: 99px;
  background: var(--track);
  overflow: hidden;
}
.kpi-track > span { display: block; height: 100%; background: var(--accent); }

h2 {
  margin: 0;
  font-family: var(--brand-font-display);
  font-size: 18px;
  font-weight: 600;
}

/* Alerts */
.section-stack { display: flex; flex-direction: column; gap: 12px; }
.alert-card {
  flex: 1 1 250px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 16px;
  display: flex;
  gap: 12px;
}
.alert-icon {
  flex: 0 0 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.alert-icon.risk { background: var(--risk-bg); color: var(--risk-fg); }
.alert-icon.watch { background: var(--watch-bg); color: var(--watch-fg); }
.alert-title { font-weight: 600; font-size: 14px; }
.alert-text { font-size: 13px; color: var(--muted); margin-top: 2px; }
.alert-cta { display: inline-block; margin-top: 8px; font-size: 13px; font-weight: 500; text-decoration: none; }

/* Table */
.table-card { overflow: hidden; }
.table-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--muted-fill);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}
.chip.is-on {
  background: var(--sidebar);
  color: var(--on-dark);
  border-color: var(--sidebar);
}
.scroll { overflow-x: auto; }
.grid-projects {
  min-width: 1090px;
}
.row, .thead {
  display: grid;
  grid-template-columns: minmax(190px, 2fr) 112px 76px 92px 120px 110px 94px 64px 96px;
  column-gap: 12px;
  align-items: center;
}
.thead {
  padding: 12px 20px;
  background: var(--table-head);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.row {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft);
}
.row:hover { background: var(--row-hover); }
.proj-name {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}
.proj-name:hover { color: var(--accent); }
.proj-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.segs { display: flex; gap: 3px; }
.seg { width: 16px; height: 6px; border-radius: 3px; background: var(--muted-fill); }
.seg.is-on { background: var(--accent); }
.phase-label { font-size: 12px; color: var(--muted); margin-top: 6px; }
.num { font-variant-numeric: tabular-nums; font-weight: 500; }
.num-sub { font-size: 12px; color: var(--muted); }
.bar {
  height: 6px;
  border-radius: 99px;
  background: var(--track);
  overflow: hidden;
}
.bar > span { display: block; height: 100%; background: var(--accent); }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.pill-dot { width: 7px; height: 7px; border-radius: 50%; }
.tone-ok { background: var(--ok-bg); color: var(--ok-fg); }
.tone-watch { background: var(--watch-bg); color: var(--watch-fg); }
.tone-risk { background: var(--risk-bg); color: var(--risk-fg); }
.tone-neutral { background: var(--line-soft); color: var(--secondary); }
.bl-risk { color: var(--risk-fg); font-weight: 600; font-variant-numeric: tabular-nums; }
.bl-watch { color: var(--watch-fg); font-weight: 600; font-variant-numeric: tabular-nums; }
.bl-ok { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.table-foot { padding: 14px 20px; font-size: 12px; color: var(--muted); }

/* Project detail */
.detail-head { display: flex; flex-direction: column; gap: 16px; }
.title-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: space-between;
  align-items: flex-start;
}
.title-with-pill { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.title-with-pill h1 { margin: 0; }
.meta-line { margin: 6px 0 0; color: var(--muted); }
.pill-lg { padding: 5px 12px; font-size: 13px; }
.pill-lg .pill-dot { width: 8px; height: 8px; }

.gate-card {
  padding: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
}
.gates { flex: 2 1 460px; min-width: 0; }
.gates-label { font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 12px; }
.gate-row { display: flex; gap: 6px; }
.gate { flex: 1; min-width: 0; }
.gate-bar { height: 8px; border-radius: 4px; background: var(--muted-fill); }
.gate.is-done .gate-bar { background: var(--accent); }
.gate-caption { font-size: 12px; margin-top: 8px; color: var(--muted); }
.gate.is-current .gate-caption { color: var(--text); font-weight: 600; }
.date-pair { display: flex; flex-wrap: wrap; gap: 28px; }
.date-k { font-size: 13px; color: var(--muted); font-weight: 500; }
.date-v {
  font-family: var(--brand-font-display);
  font-size: 22px;
  font-weight: 600;
  margin-top: 4px;
}
.date-s { font-size: 12px; color: var(--muted); }

.split { display: flex; flex-wrap: wrap; gap: 24px; align-items: stretch; }
.budget-card { flex: 2 1 560px; min-width: 0; padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.miles-card { flex: 1 1 340px; min-width: 0; padding: 24px; }
.budget-head, .split-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  align-items: baseline;
}
.banner { border-radius: 12px; padding: 14px 16px; }
.banner.risk { background: var(--risk-bg); color: var(--risk-fg); }
.banner.ok { background: var(--ok-bg); color: var(--ok-fg); }
.banner-title { font-weight: 600; }
.banner-text { font-size: 13px; margin-top: 2px; }

.budget-stats { display: flex; flex-wrap: wrap; gap: 16px; }
.bstat { flex: 1 1 120px; }
.bstat-k { font-size: 12px; color: var(--muted); font-weight: 500; }
.bstat-v {
  font-family: var(--brand-font-display);
  font-size: 24px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.bstat-s { font-size: 12px; color: var(--muted); }

.bar-scale { position: relative; height: 26px; }
.bar-afe-label {
  position: absolute;
  bottom: 0;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.stack-wrap { position: relative; }
.stack {
  display: flex;
  height: 22px;
  border-radius: 11px;
  overflow: hidden;
  background: var(--line-soft);
}
.stack-inv { background: var(--bar-invoiced); }
.stack-com { background: var(--bar-committed); }
.stack-etc { background: var(--bar-etc); }
.stack-pen { background: var(--bar-pending); }
.afe-tick {
  position: absolute;
  top: -6px;
  bottom: -6px;
  width: 2px;
  background: var(--text);
}
.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 14px; font-size: 12px; color: var(--muted); }
.swatch { display: inline-flex; align-items: center; gap: 6px; }
.swatch i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.rules-title { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.rules { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.rule {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.rule:last-child { border-bottom: 0; }
.rule-title { font-weight: 500; }
.rule-detail { font-size: 12px; color: var(--muted); }
.rule-badge { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }

.lines { width: 100%; border-collapse: collapse; font-size: 13px; }
.lines th {
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  padding: 8px 8px 8px 0;
  border-bottom: 1px solid var(--line);
}
.lines td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; }
.lines td:not(:first-child), .lines th:not(:first-child) { text-align: right; }

/* Milestones */
.miles-card h2 { margin: 0 0 16px; }
.mile { display: flex; gap: 14px; }
.mile-rail { display: flex; flex-direction: column; align-items: center; }
.mile-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  box-sizing: border-box;
  border: 2px solid var(--accent);
  background: var(--accent);
  flex: 0 0 16px;
  margin-top: 2px;
}
.mile-dot.in_progress { background: #fff; }
.mile-dot.upcoming { border-color: #B7C4C0; background: #fff; }
.mile-line { width: 2px; flex: 1; background: var(--line); min-height: 28px; }
.mile:last-child .mile-line { opacity: 0; }
.mile-body { padding-bottom: 18px; min-width: 0; }
.mile-title { font-weight: 500; }
.mile-meta { font-size: 12px; color: var(--muted); }

/* Change orders */
.co-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.co-head .hint { font-size: 13px; color: var(--muted); }
.grid-cos { min-width: 1120px; }
.co-thead, .co-row {
  display: grid;
  grid-template-columns: 70px minmax(200px, 2.4fr) 104px 140px 64px 76px 76px 96px 156px;
  column-gap: 12px;
  align-items: center;
}
.co-thead {
  padding: 12px 20px;
  background: var(--table-head);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.co-row {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line-soft);
}
.co-row:hover { background: var(--row-hover); }
.co-num { font-weight: 600; font-variant-numeric: tabular-nums; }
.co-actions { display: flex; gap: 8px; }
.gate-note { font-size: 12px; color: var(--watch-fg); margin-top: 4px; }
.decision { font-size: 12px; color: var(--muted); }
.co-error { font-size: 12px; color: var(--risk-fg); margin-top: 4px; }
.co-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  font-size: 13px;
  color: var(--muted);
}

.half { flex: 1 1 480px; min-width: 0; padding: 24px; }
.act-card { flex: 1 1 340px; min-width: 0; padding: 24px; }
.split-head { margin-bottom: 12px; }
.split-head .hint { font-size: 13px; color: var(--muted); }

.block { padding: 14px 0; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 6px; }
.block-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.block-title { font-weight: 600; }
.block-impact { font-size: 13px; color: var(--muted); }
.block-meta { font-size: 12px; color: var(--muted); }

.ll-grid { min-width: 460px; }
.ll-head, .ll-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.6fr) 84px 84px 84px;
  column-gap: 12px;
  align-items: center;
}
.ll-head {
  padding: 8px 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  border-top: 1px solid var(--line-soft);
}
.ll-row { padding: 12px 0; border-top: 1px solid var(--line-soft); }
.ll-item { font-weight: 600; }
.ll-note { font-size: 12px; color: var(--muted); }

.safe-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line-soft);
}
.safe-dot {
  flex: 0 0 22px;
  height: 22px;
  border-radius: 50%;
  box-sizing: border-box;
  border: 2px solid var(--accent);
  background: var(--accent);
}
.safe-dot.in_review, .safe-dot.pending, .safe-dot.in_progress {
  border-color: #B45309;
  background: #FDE8C8;
}
.safe-dot.not_started {
  border-color: #B7C4C0;
  background: #fff;
}
.safe-title { font-weight: 500; }
.safe-note { font-size: 12px; color: var(--muted); }
.safe-row .pill { white-space: nowrap; }

.act { padding: 12px 0; border-top: 1px solid var(--line-soft); }
.act-text { font-size: 13px; }
.act-when { font-size: 12px; color: var(--muted); margin-top: 2px; }

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--sidebar);
  color: var(--on-dark);
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(15, 28, 26, 0.18);
  z-index: 20;
}
.error-page { padding: 48px 32px; }
.muted { color: var(--muted); }

.dyn-w { /* width set via CSSOM from data-width */ }
.dyn-left { position: absolute; }
.var-over { color: var(--watch-fg); font-weight: 500; }
.strong { color: var(--text); }
.meta-cell { font-size: 13px; }
.meta-cell.muted { color: var(--muted); }
.num-days { font-variant-numeric: tabular-nums; font-size: 13px; }
.forecast-note { font-weight: 500; }

.safe-body { flex: 1; min-width: 0; }
.num-sub.fw, .fw { font-weight: 500; }
.pill-dot { background: currentColor; }

.sw-inv { background: var(--bar-invoiced); }
.sw-com { background: var(--bar-committed); }
.sw-etc { background: var(--bar-etc); }
.sw-pen { background: var(--bar-pending); }

.brand { text-decoration: none; color: inherit; }
.signin-banner {
  border-radius: var(--radius-banner);
  padding: 14px 16px;
  background: var(--watch-bg);
  color: var(--watch-fg);
}
.signin-banner strong { display: block; font-weight: 600; }
.signin-banner p { margin: 2px 0 0; font-size: 13px; }

.coming-card { padding: 28px 24px; max-width: 640px; }
.coming-card h2 { margin: 0 0 8px; font-family: var(--font-display); font-size: 22px; }
.coming-card p { margin: 0 0 12px; color: var(--muted); line-height: 1.5; }
.coming-card a { color: var(--accent); font-weight: 500; }
.list-simple { grid-template-columns: minmax(220px, 2fr) 1fr 1fr 1fr 1fr 0.8fr 0.9fr; }
.toast { font-weight: 500; max-width: 360px; }
.half-full { padding: 8px 0; }
