:root {
  --blue: #1554c0;
  --blue-dark: #0c3578;
  --red: #d72238;
  --bg: #f5f8ff;
  --card: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #dce5f5;
  --good: #0d7a4f;
  --warn: #a16207;
  --danger: #b42318;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
}
a { color: var(--blue); text-decoration: none; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  color: var(--text);
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}
.mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  background: var(--blue);
  color: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 22px rgba(21,84,192,.22);
}
nav { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
nav a { font-weight: 650; color: var(--blue-dark); font-size: 14px; }
.container { width: min(1180px, calc(100% - 28px)); margin: 28px auto 70px; }
.hero {
  display: grid;
  grid-template-columns: 1.5fr .8fr;
  gap: 22px;
  align-items: stretch;
}
.hero h1 {
  font-size: clamp(34px, 5vw, 62px);
  line-height: .98;
  letter-spacing: -2px;
  margin: 6px 0 18px;
}
.hero p { font-size: 18px; color: #3d4a62; max-width: 780px; }
.eyebrow {
  color: var(--red) !important;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: .08em;
  font-size: 13px !important;
}
.panel, .card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 18px 45px rgba(30, 62, 118, .08);
  padding: 24px;
}
.panel {
  border-top: 5px solid var(--red);
}
.card { margin-bottom: 18px; }
.card.narrow { max-width: 520px; margin-left: auto; margin-right: auto; }
.card.success { border-top: 5px solid var(--good); }
.card.danger { border-top: 5px solid var(--danger); }
h1, h2, h3 { margin-top: 0; }
.muted { color: var(--muted); font-size: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--blue-dark);
  border-radius: 12px;
  padding: 11px 15px;
  font-weight: 800;
  cursor: pointer;
}
.button.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.button.ghost { background: transparent; }
.button.small { padding: 7px 10px; font-size: 13px; }
.grid-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
label { display: grid; gap: 7px; font-weight: 750; color: #283449; }
input, select, textarea {
  width: 100%;
  border: 1px solid #cbd7eb;
  border-radius: 12px;
  padding: 11px 12px;
  font: inherit;
  background: #fff;
}
textarea { min-height: 100px; }
.full { grid-column: 1 / -1; }
.check { display: flex; flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 650; }
.check input { width: auto; margin-top: 4px; }
.flash {
  width: min(1180px, calc(100% - 28px));
  margin: 18px auto 0;
  border-radius: 14px;
  padding: 13px 16px;
  font-weight: 750;
  border: 1px solid var(--line);
  background: #fff;
}
.flash.success { border-color: #9ee0c1; color: var(--good); }
.flash.warning { border-color: #f4d27a; color: var(--warn); }
.flash.danger { border-color: #f0aaa3; color: var(--danger); }
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.metric {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 14px 30px rgba(30,62,118,.06);
}
.metric-value { font-size: 34px; font-weight: 900; color: var(--blue); }
.metric-label { font-weight: 850; }
.metric-hint { color: var(--muted); font-size: 13px; margin-top: 4px; }
.table-card { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  padding: 11px 9px;
}
th { color: #34405a; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 9px;
  background: #eef4ff;
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 850;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.detail {
  border-bottom: 1px solid var(--line);
  padding: 9px 0;
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 12px;
}
.detail span { color: var(--muted); font-weight: 750; }
.detail strong { font-weight: 700; }
.note {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fbfdff;
}
.note span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}
.footer {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto 30px;
  color: var(--muted);
  font-size: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
@media (max-width: 820px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .hero, .two-col, .grid-form, .metrics { grid-template-columns: 1fr; }
  .detail { grid-template-columns: 1fr; gap: 3px; }
  .container { width: min(100% - 20px, 1180px); margin-top: 18px; }
}

/* Phase 2 dispatch usability */
.metrics.compact .metric { padding: 15px; }
.dispatch-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0 18px;
}
.dispatch-summary div {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fbfdff;
}
.dispatch-summary strong {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.dispatch-summary span {
  display: block;
  margin-top: 4px;
  font-weight: 850;
}
.suggestions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.suggestion {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fbfdff;
  padding: 15px;
}
.suggestion-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.suggestion-head strong {
  display: block;
  font-size: 18px;
}
.suggestion-head span {
  display: block;
  color: var(--muted);
  font-weight: 750;
  margin-top: 2px;
}
.score {
  min-width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--blue);
  font-weight: 950;
  font-size: 20px;
}
.scorebar {
  height: 9px;
  background: #e4ebf8;
  border-radius: 999px;
  margin: 12px 0;
  overflow: hidden;
}
.scorebar span {
  display: block;
  height: 100%;
  background: var(--blue);
}
.mini-list {
  margin: 10px 0;
  padding-left: 18px;
  font-size: 14px;
}
.good-list li::marker { color: var(--good); }
.warn-list li::marker { color: var(--warn); }
.warn-text { color: var(--warn); font-weight: 800; }
.priority-urgent {
  background: #fff1f1;
  color: var(--danger);
}
.priority-manual_review {
  background: #fff7df;
  color: var(--warn);
}
.priority-normal {
  background: #eef4ff;
  color: var(--blue-dark);
}
.urgent-row {
  background: #fffafa;
}
.review-row {
  background: #fffdf4;
}
@media (max-width: 820px) {
  .dispatch-summary,
  .suggestions {
    grid-template-columns: 1fr;
  }
}

/* Phase 2.1 workflow polish */
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 18px;
}
.quick-actions form {
  margin: 0;
}
.driver-needs_review,
.driver-applied,
.bg-needs_review {
  background: #fff7df;
  color: var(--warn);
}
.driver-approved,
.bg-cleared {
  background: #eafaf2;
  color: var(--good);
}
.driver-pending_background_check,
.driver-background_check_submitted,
.bg-pending,
.bg-submitted {
  background: #eef4ff;
  color: var(--blue-dark);
}
.driver-rejected,
.driver-suspended,
.bg-failed {
  background: #fff1f1;
  color: var(--danger);
}
.driver-inactive,
.bg-expired,
.bg-not_started,
.bg-consent_received {
  background: #f2f4f7;
  color: #475467;
}

/* Phase 2.2 schedule board + assignment safety */
.workload-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.workload-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px;
  background: #fbfdff;
}
.workload-card strong,
.workload-card span,
.workload-card b,
.workload-card em {
  display: block;
}
.workload-card strong {
  font-size: 16px;
}
.workload-card span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}
.workload-card b {
  color: var(--blue);
  font-size: 20px;
  margin-top: 8px;
}
.workload-card em {
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
  margin-top: 3px;
}
.workload-card.medium {
  border-color: #f4d27a;
  background: #fffdf4;
}
.workload-card.high {
  border-color: #f0aaa3;
  background: #fffafa;
}
.notice {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 15px;
  margin-bottom: 18px;
  background: #fff;
}
.notice.good {
  border-color: #9ee0c1;
  background: #f0fff7;
  color: var(--good);
}
.notice.warning {
  border-color: #f4d27a;
  background: #fffdf4;
  color: var(--warn);
}
.notice ul {
  margin: 8px 0 0;
  padding-left: 20px;
}
@media (max-width: 960px) {
  .workload-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 620px) {
  .workload-grid {
    grid-template-columns: 1fr;
  }
}

/* Phase 2.3 notification queue + confirmations */
.confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.confirm-actions form {
  margin: 0;
}
.button.tiny {
  padding: 5px 8px;
  font-size: 12px;
  border-radius: 9px;
}
.channel-sms {
  background: #eef4ff;
  color: var(--blue-dark);
}
.channel-email {
  background: #eafaf2;
  color: var(--good);
}
.channel-internal {
  background: #f2f4f7;
  color: #475467;
}
.channel-web_push {
  background: #f5edff;
  color: #6941c6;
}
.notification-queued {
  background: #fff7df;
  color: var(--warn);
}
.notification-sent {
  background: #eafaf2;
  color: var(--good);
}
.notification-failed {
  background: #fff1f1;
  color: var(--danger);
}
.notification-skipped {
  background: #f2f4f7;
  color: #475467;
}

/* Phase 2.4 admin edit screens */
.form-section {
  margin: 10px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--blue-dark);
}
.grid-form .actions {
  margin-top: 8px;
}

/* Phase 2.5 reports + audit */
.quality-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}
.quality-grid a {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfdff;
  padding: 13px;
  color: var(--text);
}
.quality-grid strong {
  display: block;
  color: var(--red);
  font-size: 28px;
  line-height: 1;
}
.quality-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  margin-top: 6px;
}
code {
  white-space: normal;
  font-size: 12px;
  color: #344054;
}
@media (max-width: 1100px) {
  .quality-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 620px) {
  .quality-grid {
    grid-template-columns: 1fr;
  }
}

/* Phase 3.0 mapping foundation */
.location-note {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fbfdff;
  color: var(--muted);
}

/* Phase 3.2 location readiness */
.table-card .button.tiny {
  white-space: nowrap;
}

/* Phase 3.3 coordinate import */
.csvbox {
  min-height: 320px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}
.codebox {
  background: #0f172a;
  color: #e5e7eb;
  border-radius: 14px;
  padding: 14px;
  overflow-x: auto;
}

/* Phase 3.4 assignment assistant */
.assistant-list {
  display: grid;
  gap: 18px;
}
.assistant-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 18px 45px rgba(30, 62, 118, .08);
  padding: 20px;
}
.assistant-ride {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.assistant-ride h2 {
  margin-bottom: 6px;
}
.assistant-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.flags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 12px 0;
}
.flag {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 850;
  background: #eef4ff;
  color: var(--blue-dark);
}
.flag.ok {
  background: #eafaf2;
  color: var(--good);
}
.flag.warning {
  background: #fff7df;
  color: var(--warn);
}
.flag.danger {
  background: #fff1f1;
  color: var(--danger);
}
.flag.info {
  background: #eef4ff;
  color: var(--blue-dark);
}
.notice.slim {
  padding: 10px 12px;
  border-radius: 14px;
}
.assistant-suggestions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 12px;
  margin-top: 14px;
}
.assistant-suggestion {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 13px;
  background: #fbfdff;
}
@media (max-width: 1100px) {
  .assistant-suggestions {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 760px) {
  .assistant-ride {
    flex-direction: column;
  }
  .assistant-actions {
    justify-content: flex-start;
  }
}

/* Phase 4.0 driver mobile portal */
.driver-portal-body {
  background: #f5f8ff;
}
.driver-portal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.driver-portal-header strong,
.driver-portal-header span {
  display: block;
}
.driver-portal-header span {
  color: var(--muted);
  font-size: 14px;
}
.driver-portal-container {
  width: min(760px, calc(100% - 22px));
  margin: 18px auto 60px;
}
.driver-welcome {
  background: var(--blue);
  color: #fff;
  border-radius: 22px;
  padding: 20px;
  margin-bottom: 16px;
}
.driver-welcome h1 {
  margin-bottom: 8px;
}
.driver-welcome p {
  margin: 0;
  color: #eaf1ff;
}
.driver-ride-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 18px 45px rgba(30,62,118,.08);
  padding: 18px;
  margin-bottom: 18px;
}
.driver-ride-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 14px;
}
.driver-ride-top h2 {
  margin: 8px 0 4px;
}
.driver-status-stack {
  display: grid;
  gap: 6px;
  justify-items: end;
}
.driver-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.driver-detail-grid div,
.driver-address {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: #fbfdff;
}
.driver-detail-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 850;
}
.driver-detail-grid strong,
.driver-detail-grid a {
  display: block;
  margin-top: 4px;
}
.driver-address {
  margin-bottom: 12px;
}
.driver-address h3 {
  margin-bottom: 8px;
}
.driver-address p {
  margin-top: 0;
}
.driver-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 10px;
  margin-top: 14px;
}
.driver-action-grid form {
  margin: 0;
}
.driver-action-grid .button {
  width: 100%;
  min-height: 48px;
}
.button.danger {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
@media (max-width: 620px) {
  .driver-ride-top,
  .driver-detail-grid,
  .driver-action-grid {
    grid-template-columns: 1fr;
  }
  .driver-ride-top {
    flex-direction: column;
  }
  .driver-status-stack {
    justify-items: start;
  }
}

/* Phase 4.1 rider status portal */
.driver-portal-container .flash {
  width: auto;
  margin: 0 0 14px;
}

/* Phase 4.2 PWA mobile install layer */
@media (display-mode: standalone) {
  body::before {
    content: "Free Ride To Vote";
    display: none;
  }
}
.install-note {
  border: 1px solid var(--line);
  background: #fbfdff;
  border-radius: 16px;
  padding: 12px;
  color: var(--muted);
}

/* Phase 4.3 user management */
.user-active {
  background: #eafaf2;
  color: var(--good);
}
.user-inactive {
  background: #f2f4f7;
  color: #475467;
}

/* Phase 4.4 pilot preflight */
.preflight-status {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 950;
}
.preflight-status.pass {
  background: #eafaf2;
  color: var(--good);
}
.preflight-status.fail {
  background: #fff1f1;
  color: var(--danger);
}

/* Phase 4.5 pilot packet */
.walkthrough-list {
  display: grid;
  gap: 10px;
  padding-left: 24px;
}
.walkthrough-list li {
  padding: 8px 0;
}
.pilot-checklist {
  display: grid;
  gap: 10px;
}
.pilot-checklist .check {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: #fbfdff;
}

/* Phase 5.1 provider test */
.card.narrow textarea {
  min-height: 150px;
}

/* Phase 5.3 controlled geocoding */
.actions form {
  margin: 0;
}

/* Phase 5.6 email queue */
.card.narrow input[name="limit"] {
  max-width: 180px;
}

/* Phase 5.7 route cache warmup */
.route-cache-note {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fbfdff;
}

/* Phase 5.8 route cache metric cleanup */
.metrics.compact .metric {
  min-width: 150px;
}

/* Phase 5.9 safer email queue */
.inline-form {
  display: inline-block;
  margin: 0;
}

.button.small {
  padding: 7px 10px;
  font-size: 0.85rem;
}

.small {
  font-size: 0.85rem;
}

/* Phase 6.0 demo readiness */
.provider-safety {
  border-left: 5px solid var(--accent, #dc2626);
}

.demo-safety-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.demo-safety-grid > div {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: #fbfdff;
}

.demo-safety-grid p {
  margin-bottom: 0;
}

.demo-actions {
  flex-wrap: wrap;
}

.demo-steps {
  padding-left: 22px;
}

.demo-steps li {
  margin: 8px 0;
}

/* Phase 6.1 demo reset */
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: #fbfdff;
  font-size: 0.9rem;
}

.button.danger-soft {
  border-color: #fecaca;
  background: #fff1f2;
  color: #991b1b;
}

/* Phase 6.2 demo script */
.demo-script-section .demo-steps p {
  margin: 5px 0 12px;
}

.lead {
  font-size: 1.1rem;
  line-height: 1.6;
}

/* Phase 6.3 pilot handoff */
.card .mini-list li {
  line-height: 1.45;
}

/* Phase 6.4 demo feedback */
.priority-urgent {
  background: #fee2e2;
  color: #991b1b;
}

.priority-high {
  background: #ffedd5;
  color: #9a3412;
}

/* Phase 6.5 pilot launch */
.launch-update-form input[type="text"] {
  max-width: 180px;
  margin-top: 6px;
}

.launch-blocked {
  background: #fee2e2;
  color: #991b1b;
}

.launch-done {
  background: #dcfce7;
  color: #166534;
}

/* Phase 6.6 executive brief */
.executive-section {
  break-inside: avoid;
}

@media print {
  .topbar,
  .sidebar,
  .actions {
    display: none !important;
  }

  .card {
    box-shadow: none !important;
    border: 1px solid #ddd;
  }
}

/* Phase 6.7 release readiness */
.release-pass {
  color: #166534;
}

.release-fail {
  color: #991b1b;
}

/* Pilot scope page */
.scope-form {
  display: grid;
  gap: 14px;
}

.scope-row span {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
}

.scope-row textarea {
  min-height: 82px;
}

/* Phase 6.8 grouped navigation */
.nav-public,
.nav-primary,
.nav-secondary {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.nav-public {
  margin-right: 8px;
}

.nav-primary {
  margin-right: 10px;
}

.nav-link,
.nav-menu-link,
.nav-group > summary {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 700;
  color: var(--blue, #0b3a78);
  cursor: pointer;
  white-space: nowrap;
}

.nav-link:hover,
.nav-menu-link:hover,
.nav-group > summary:hover {
  background: #eef5ff;
}

.nav-link-feature {
  background: #eaf2ff;
  border: 1px solid #cfe0ff;
}

.nav-group {
  position: relative;
}

.nav-group > summary {
  list-style: none;
  border: 1px solid transparent;
}

.nav-group > summary::-webkit-details-marker {
  display: none;
}

.nav-group > summary::after {
  content: "▾";
  font-size: 0.75rem;
  margin-left: 7px;
  opacity: 0.75;
}

.nav-group[open] > summary {
  background: #eef5ff;
  border-color: #d7e7ff;
}

.nav-menu {
  position: absolute;
  z-index: 1000;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  padding: 8px;
  border: 1px solid #dbe7f7;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
}

.nav-menu-link {
  display: flex;
  width: 100%;
  justify-content: flex-start;
  padding: 9px 10px;
}

@media (max-width: 960px) {
  .nav-public,
  .nav-primary,
  .nav-secondary {
    width: 100%;
  }

  .nav-menu {
    position: static;
    width: 100%;
    box-shadow: none;
    margin: 4px 0 8px;
  }
}

/* Phase 6.8.1 nav layout fix */
header,
.topbar,
.app-header {
  overflow: visible !important;
}

header nav,
.topbar nav,
.app-header nav,
nav.main-nav {
  width: 100% !important;
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 8px !important;
  align-items: start !important;
  justify-items: stretch !important;
  overflow: visible !important;
}

.nav-public,
.nav-primary,
.nav-secondary {
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  margin: 0 !important;
}

.nav-public {
  order: 1;
}

.nav-primary {
  order: 2;
}

.nav-secondary {
  order: 3;
}

.nav-link,
.nav-menu-link,
.nav-group > summary {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  min-height: 34px !important;
  padding: 8px 11px !important;
  margin: 0 !important;
  border-radius: 10px !important;
  text-decoration: none !important;
  font-weight: 700 !important;
  line-height: 1.1 !important;
  color: #0b3a78 !important;
  white-space: nowrap !important;
}

.nav-link {
  border: 1px solid transparent !important;
}

.nav-link-feature {
  background: #eaf2ff !important;
  border-color: #cfe0ff !important;
}

.nav-group {
  position: relative !important;
  display: inline-block !important;
  margin: 0 !important;
}

.nav-group > summary {
  list-style: none !important;
  cursor: pointer !important;
  border: 1px solid #e2e8f0 !important;
  background: #ffffff !important;
}

.nav-group > summary::-webkit-details-marker {
  display: none !important;
}

.nav-group > summary::before {
  content: "" !important;
}

.nav-group > summary::after {
  content: "▾" !important;
  font-size: 0.75rem !important;
  margin-left: 6px !important;
  opacity: 0.75 !important;
}

.nav-menu {
  position: absolute !important;
  z-index: 3000 !important;
  top: calc(100% + 6px) !important;
  left: 0 !important;
  min-width: 230px !important;
  display: grid !important;
  gap: 2px !important;
  padding: 8px !important;
  border: 1px solid #dbe7f7 !important;
  border-radius: 14px !important;
  background: #ffffff !important;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16) !important;
}

.nav-menu-link {
  width: 100% !important;
  justify-content: flex-start !important;
}

.nav-link:hover,
.nav-menu-link:hover,
.nav-group > summary:hover,
.nav-group[open] > summary {
  background: #eef5ff !important;
}

@media (min-width: 1000px) {
  header nav,
  .topbar nav,
  .app-header nav,
  nav.main-nav {
    grid-template-columns: 1fr !important;
  }

  .nav-public,
  .nav-primary,
  .nav-secondary {
    max-width: 100% !important;
  }
}

@media (max-width: 760px) {
  .nav-menu {
    position: static !important;
    width: 100% !important;
    box-shadow: none !important;
    margin: 4px 0 8px !important;
  }

  .nav-group {
    width: 100% !important;
  }

  .nav-group > summary {
    width: 100% !important;
    justify-content: flex-start !important;
  }
}

/* Phase 6.8.1 header wrap */
header > nav,
.topbar > nav,
.app-header > nav {
  flex: 1 1 100% !important;
}

header,
.topbar,
.app-header {
  flex-wrap: wrap !important;
}


/* Phase 6.8.3 stable grouped navigation */
header,
.topbar,
.app-header {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 12px !important;
  padding-top: 10px !important;
  padding-bottom: 10px !important;
  overflow: visible !important;
}

header nav,
.topbar nav,
.app-header nav,
nav.main-nav {
  flex: 1 1 100% !important;
  width: 100% !important;
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 8px !important;
  align-items: start !important;
  justify-items: stretch !important;
  overflow: visible !important;
}

.nav-public,
.nav-primary,
.nav-secondary {
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  margin: 0 !important;
}

.nav-public {
  order: 1 !important;
}

.nav-primary {
  order: 2 !important;
}

.nav-secondary {
  order: 3 !important;
}

.nav-link,
.nav-menu-link,
.nav-group > summary {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 32px !important;
  padding: 7px 10px !important;
  margin: 0 !important;
  border-radius: 10px !important;
  text-decoration: none !important;
  font-weight: 700 !important;
  font-size: 0.92rem !important;
  line-height: 1.1 !important;
  color: #0b3a78 !important;
  white-space: nowrap !important;
}

.nav-link:hover,
.nav-menu-link:hover,
.nav-group > summary:hover,
.nav-group[open] > summary {
  background: #eef5ff !important;
}

.nav-link-feature {
  background: #eaf2ff !important;
  border: 1px solid #cfe0ff !important;
}

.nav-group {
  position: relative !important;
  display: inline-block !important;
}

.nav-group > summary {
  list-style: none !important;
  cursor: pointer !important;
  border: 1px solid #dbe7f7 !important;
  background: #ffffff !important;
}

.nav-group > summary::-webkit-details-marker {
  display: none !important;
}

.nav-group > summary::before {
  content: "" !important;
}

.nav-group > summary::after {
  content: "▾" !important;
  font-size: 0.75rem !important;
  margin-left: 7px !important;
  opacity: 0.75 !important;
}

.nav-menu {
  position: absolute !important;
  z-index: 3000 !important;
  top: calc(100% + 6px) !important;
  left: 0 !important;
  min-width: 230px !important;
  display: grid !important;
  gap: 2px !important;
  padding: 8px !important;
  border: 1px solid #dbe7f7 !important;
  border-radius: 14px !important;
  background: #ffffff !important;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16) !important;
}

.nav-menu-link {
  width: 100% !important;
  justify-content: flex-start !important;
}

@media (min-width: 1180px) {
  header nav,
  .topbar nav,
  .app-header nav,
  nav.main-nav {
    grid-template-columns: auto 1fr auto !important;
    align-items: center !important;
  }

  .nav-public,
  .nav-primary,
  .nav-secondary {
    width: auto !important;
  }

  .nav-public {
    grid-column: 1 !important;
  }

  .nav-primary {
    grid-column: 2 !important;
  }

  .nav-secondary {
    grid-column: 3 !important;
  }
}

@media (max-width: 760px) {
  .nav-menu {
    position: static !important;
    width: 100% !important;
    box-shadow: none !important;
    margin: 4px 0 8px !important;
  }

  .nav-group {
    width: 100% !important;
  }

  .nav-group > summary {
    width: 100% !important;
    justify-content: flex-start !important;
  }
}


/* Phase 6.10 clickable metric tiles */
a.metric,
.metric-link {
  color: inherit !important;
  text-decoration: none !important;
  cursor: pointer !important;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease !important;
}

a.metric:hover,
.metric-link:hover {
  transform: translateY(-2px) !important;
  border-color: #1d5fd1 !important;
  box-shadow: 0 14px 30px rgba(29, 95, 209, 0.13) !important;
}

a.metric:focus-visible,
.metric-link:focus-visible {
  outline: 3px solid rgba(29, 95, 209, 0.35) !important;
  outline-offset: 3px !important;
}

a.metric small,
.metric-link small {
  color: #516789 !important;
}

/* Phase 6.10B stable clickable metric tile layout */
.metrics {
  align-items: stretch !important;
}

.metric,
a.metric,
.metric-link {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: center !important;
  gap: 5px !important;
  min-height: 104px !important;
  padding: 22px 18px !important;
  border-radius: 16px !important;
  text-decoration: none !important;
  color: inherit !important;
  line-height: 1.22 !important;
  white-space: normal !important;
}

.metric .metric-value,
.metric > strong,
a.metric .metric-value,
a.metric > strong {
  display: block !important;
  width: 100% !important;
  margin: 0 !important;
  color: #1d5fd1 !important;
  font-size: 2.05rem !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  letter-spacing: -0.03em !important;
}

.metric .metric-label,
.metric > span,
a.metric .metric-label,
a.metric > span {
  display: block !important;
  width: 100% !important;
  margin: 0 !important;
  color: #061a3a !important;
  font-size: 1rem !important;
  font-weight: 850 !important;
  line-height: 1.2 !important;
}

.metric .metric-caption,
.metric > small,
a.metric .metric-caption,
a.metric > small {
  display: block !important;
  width: 100% !important;
  margin: 0 !important;
  color: #516789 !important;
  font-size: 0.86rem !important;
  font-weight: 500 !important;
  line-height: 1.25 !important;
}

a.metric:hover,
.metric-link:hover {
  transform: translateY(-2px) !important;
  border-color: #1d5fd1 !important;
  box-shadow: 0 14px 30px rgba(29, 95, 209, 0.13) !important;
}

a.metric:focus-visible,
.metric-link:focus-visible {
  outline: 3px solid rgba(29, 95, 209, 0.35) !important;
  outline-offset: 3px !important;
}
