:root {
  --ink: #172033;
  --muted: #657086;
  --navy: #102a43;
  --navy-2: #193b5a;
  --blue: #2f6fa3;
  --paper: #f4f1ea;
  --surface: #ffffff;
  --line: #d9d5cb;
  --green: #276749;
  --green-soft: #dff4e8;
  --amber: #9a5b0a;
  --amber-soft: #fff0d4;
  --red: #a12b2b;
  --red-soft: #fee5e2;
  --shadow: 0 12px 30px rgba(22, 32, 51, 0.08);
  --radius: 10px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Aptos, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}
button, input, select { font: inherit; }
button, .button { min-height: 44px; }
a { color: inherit; }

h1, h2, strong, .risk-rating {
  font-family: Bahnschrift, "Arial Narrow", sans-serif;
  font-weight: 600;
  letter-spacing: -0.018em;
}
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.45rem, 3vw, 2.2rem); }
h2 { margin-bottom: 0; font-size: 1.45rem; }
small, .muted { color: var(--muted); }
.eyebrow {
  margin-bottom: 4px;
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 106px;
  padding: 22px max(24px, calc((100vw - 1440px) / 2));
  background: var(--navy);
  color: #fff;
}
.site-header .eyebrow { color: #9fc5e2; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.header-actions form { margin: 0; }
.target-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 99px;
  font-weight: 700;
}
.target-badge.is-good { background: rgba(80, 180, 120, .18); color: #d9fbe7; }
.target-badge.is-danger { background: rgba(220, 70, 70, .18); color: #ffe4e1; }
.button, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 9px 14px;
  background: var(--navy);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.button:hover, button:hover { filter: brightness(1.08); }
.button:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid #8ec5ef;
  outline-offset: 2px;
}
.button-secondary { border-color: rgba(255,255,255,.45); background: transparent; }
.button-quiet { background: rgba(255,255,255,.08); }

.section-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 4px;
  padding: 8px max(24px, calc((100vw - 1440px) / 2));
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 241, 234, .96);
  backdrop-filter: blur(8px);
}
.section-nav a {
  min-width: max-content;
  padding: 9px 13px;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}
.section-nav a:hover { background: #e8e3d9; color: var(--ink); }

.tracker-shell {
  width: min(1440px, calc(100% - 48px));
  margin: 28px auto 80px;
}
.overview-grid {
  display: grid;
  grid-template-columns: 1.15fr repeat(4, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.metric {
  min-width: 0;
  padding: 19px 20px;
  border-left: 1px solid var(--line);
}
.metric:first-child { border-left: 0; }
.metric > span { display: block; color: var(--muted); font-size: .78rem; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.metric > strong { display: block; margin: 5px 0 2px; font-size: clamp(1.35rem, 2.2vw, 2rem); white-space: nowrap; }
.metric > small { display: block; }
.progress-track { height: 7px; margin-top: 12px; border-radius: 99px; background: #e6edf3; overflow: hidden; }
.progress-track i { display: block; height: 100%; background: var(--blue); }

.panel {
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  scroll-margin-top: 70px;
}
.panel-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}
.panel-heading p { margin-bottom: 0; }
.deadline, .budget-headroom { color: var(--muted); font-weight: 750; }
.is-danger-text { color: var(--red); }

.action-list { margin: 0; padding: 0; list-style: none; }
.action-list li {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 13px 22px;
  border-top: 1px solid #ece9e1;
}
.action-list li:first-child { border-top: 0; }
.action-list strong, .action-list small { display: block; }
.action-list time { color: var(--muted); font-variant-numeric: tabular-nums; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #9aa4b1; }
.status-in-progress { background: var(--blue); }
.status-blocked { background: var(--red); }
.status-complete { background: var(--green); }

.table-scroll { width: 100%; overflow-x: auto; }
.data-table { width: 100%; min-width: 980px; border-collapse: collapse; }
.data-table th {
  padding: 10px 12px;
  background: #f7f6f2;
  color: var(--muted);
  font-size: .72rem;
  letter-spacing: .06em;
  text-align: left;
  text-transform: uppercase;
}
.data-table td { padding: 10px 12px; border-top: 1px solid #ece9e1; vertical-align: middle; }
.data-table tr[data-endpoint]:hover { background: #fbfaf7; }
.data-table td:first-child { min-width: 270px; }
.data-table strong, .data-table small, .phase-label { display: block; }
.phase-label { color: var(--blue); font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.critical-tag { display: inline-block; margin-top: 4px; padding: 2px 6px; border-radius: 4px; background: var(--red-soft); color: var(--red); font-size: .68rem; font-weight: 800; text-transform: uppercase; }
input, select {
  width: 100%;
  min-height: 40px;
  border: 1px solid #c8cbd0;
  border-radius: 6px;
  padding: 8px 9px;
  background: #fff;
  color: var(--ink);
}
.progress-input, .money-input { display: flex; align-items: center; gap: 5px; }
.progress-input input { width: 74px; }
.money-input { min-width: 125px; }
.money-input span { color: var(--muted); font-weight: 700; }
.money-input input { min-width: 95px; }
.save-row { min-height: 38px; padding: 7px 12px; background: var(--blue); }
.save-row.is-saved { background: var(--green); }
.save-row.is-error { background: var(--red); }

.risk-list { display: grid; }
.risk-row {
  display: grid;
  grid-template-columns: 92px minmax(260px, 1fr) minmax(180px, 260px) 72px;
  align-items: center;
  gap: 16px;
  padding: 15px 22px;
  border-top: 1px solid #ece9e1;
}
.risk-row:first-child { border-top: 0; }
.risk-row p { margin: 3px 0 0; color: var(--muted); }
.risk-rating { color: var(--amber); text-transform: uppercase; }
.rating-critical .risk-rating, .rating-high .risk-rating { color: var(--red); }
.risk-row select { margin-top: 6px; }

.save-status {
  position: fixed;
  right: 18px;
  bottom: 18px;
  transform: translateY(140%);
  z-index: 30;
  max-width: 360px;
  padding: 12px 16px;
  border-radius: 7px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  transition: transform .18s ease;
}
.save-status.is-visible { transform: translateY(0); }
.save-status.is-error { background: var(--red); }

.login-page { min-height: 100vh; background: var(--navy); }
.login-shell { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.login-panel { width: min(430px, 100%); padding: 36px; border-radius: 12px; background: #fff; box-shadow: 0 24px 70px rgba(0,0,0,.25); }
.login-panel h1 { margin-bottom: 6px; }
.login-form { display: grid; gap: 11px; margin-top: 26px; }
.login-form label { font-weight: 750; }
.login-form button { margin-top: 5px; }
[role="alert"] { margin: 0; padding: 9px 11px; border-radius: 6px; background: var(--red-soft); color: var(--red); }

@media (max-width: 1050px) {
  .overview-grid { grid-template-columns: repeat(3, 1fr); }
  .metric { border-top: 1px solid var(--line); }
  .metric:nth-child(-n+3) { border-top: 0; }
  .metric:nth-child(4) { border-left: 0; }
  .risk-row { grid-template-columns: 82px 1fr 210px; }
  .risk-row .save-row { grid-column: 3; justify-self: end; }
}

@media (max-width: 720px) {
  .site-header { align-items: flex-start; padding: 18px; }
  .header-actions { flex-wrap: wrap; justify-content: flex-end; }
  .target-badge { order: -1; width: 100%; justify-content: center; }
  .tracker-shell { width: min(100% - 24px, 1440px); margin-top: 14px; }
  .overview-grid { grid-template-columns: 1fr 1fr; }
  .metric, .metric:nth-child(-n+3) { border-top: 1px solid var(--line); }
  .metric:first-child, .metric:nth-child(2) { border-top: 0; }
  .metric:nth-child(odd) { border-left: 0; }
  .metric > strong { font-size: 1.45rem; }
  .panel-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .action-list li { grid-template-columns: 12px 1fr; }
  .action-list time { grid-column: 2; }
  .risk-row { grid-template-columns: 1fr; }
  .risk-row .save-row { grid-column: 1; width: 100%; }
}

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