:root {
  --navy: #052d5d;
  --navy-2: #071f45;
  --ink: #102a55;
  --teal: #04979c;
  --teal-dark: #00727a;
  --aqua: #e8f7f7;
  --line: #d8e2ec;
  --muted: #60708b;
  --soft: #f5f8fb;
  --warn: #d98c00;
  --danger: #b42318;
  --success: #178b68;
  --shadow: 0 10px 30px rgba(18, 44, 83, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #eef3f8;
}

button, input { font: inherit; }
button:disabled { cursor: wait; opacity: .65; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  min-height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  color: white;
  background: linear-gradient(180deg, var(--navy-2), var(--navy));
  box-shadow: 5px 0 24px rgba(4, 31, 69, .14);
}

.brand {
  min-height: 132px;
  padding: 24px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid rgba(255,255,255,.14);
}

.brand-mark {
  width: 44px;
  height: 55px;
  position: relative;
  border: 2px solid #37d7d7;
  clip-path: polygon(50% 0, 100% 27%, 100% 100%, 0 100%, 0 27%);
}

.brand-mark span:first-child {
  position: absolute;
  top: -1px;
  bottom: -1px;
  left: 50%;
  border-left: 2px solid #fff;
}

.brand-mark span:last-child {
  position: absolute;
  width: 25px;
  height: 34px;
  right: -2px;
  bottom: -2px;
  border: 2px solid #fff;
  border-bottom: 0;
}

.brand-name {
  font-weight: 800;
  font-size: 32px;
  letter-spacing: .5px;
}

.brand-tag {
  font-size: 11px;
  line-height: 1.35;
  opacity: .9;
}

.nav {
  padding: 18px 0;
  flex: 1;
}

.nav button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 15px 22px;
  border: 0;
  color: rgba(255,255,255,.86);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: .18s ease;
}

.nav button span {
  width: 22px;
  font-size: 19px;
  text-align: center;
}

.nav button:hover,
.nav button.active {
  color: white;
  background: linear-gradient(90deg, #00a6aa, #0bb4b8);
}

.sidebar-footer {
  margin: 20px;
  padding: 18px 10px;
  display: flex;
  gap: 12px;
  align-items: center;
  border-top: 1px solid rgba(255,255,255,.16);
}

.sidebar-footer strong,
.sidebar-footer small { display: block; }
.sidebar-footer small { margin-top: 4px; opacity: .72; }

.secure-dot {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #31c6c8;
  box-shadow: inset 0 0 0 9px rgba(255,255,255,.18);
}

.main { min-width: 0; }

.topbar {
  min-height: 116px;
  padding: 25px 30px 20px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  background: white;
  border-bottom: 1px solid var(--line);
}

.eyebrow,
.section-kicker {
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.1px;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(26px, 3vw, 38px); }
h2 { margin-bottom: 12px; font-size: 26px; }
h3 { margin-bottom: 14px; font-size: 18px; }

.confidential {
  padding: 11px 16px;
  border-radius: 10px;
  background: var(--navy-2);
  color: white;
  font-size: 13px;
  box-shadow: var(--shadow);
}

.content { padding: 24px; }

.panel,
.kpi,
.risk-row,
.protection-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.upload-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(330px, .65fr);
  gap: 22px;
}

.upload-panel,
.process-panel { padding: 30px; }

.lead {
  color: var(--muted);
  line-height: 1.6;
  max-width: 820px;
}

.field {
  display: grid;
  gap: 8px;
  margin: 20px 0;
}

.field span { font-weight: 700; font-size: 14px; }

.field input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid #bccadb;
  border-radius: 10px;
  color: var(--ink);
  background: white;
}

.field input:focus {
  outline: 3px solid rgba(4,151,156,.14);
  border-color: var(--teal);
}

.drop-zone {
  min-height: 230px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 9px;
  border: 2px dashed #74c7ca;
  border-radius: 16px;
  background: linear-gradient(145deg, #f7ffff, #eef8fa);
  cursor: pointer;
  text-align: center;
}

.drop-zone.dragover {
  border-color: var(--teal);
  background: #e2f8f8;
}

.drop-zone input { display: none; }
.drop-zone small { color: var(--muted); }

.drop-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--teal);
  font-size: 30px;
}

.button-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.primary,
.secondary {
  padding: 12px 18px;
  border-radius: 9px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 800;
}

.primary { color: white; background: var(--teal-dark); }
.primary:hover { background: #005d64; }
.secondary { color: var(--ink); background: white; border-color: #aebed0; }
.secondary:hover { border-color: var(--teal); color: var(--teal-dark); }

.process-step {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.process-step:last-child { border-bottom: 0; }

.process-step b {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--teal);
}

.process-step strong,
.process-step span { display: block; }
.process-step span { margin-top: 4px; color: var(--muted); line-height: 1.45; }

.processing {
  margin-top: 22px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 15px;
  background: var(--aqua);
  border-radius: 12px;
}

.processing p { margin: 4px 0 0; color: var(--muted); }

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 4px solid rgba(0,114,122,.2);
  border-top-color: var(--teal-dark);
  animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

.alert {
  padding: 14px 16px;
  border-radius: 10px;
  margin-top: 18px;
}

.alert.error { color: #8a1c13; background: #fff0ee; border: 1px solid #f0bbb5; }
.alert.warning { color: #77530a; background: #fff8e6; border: 1px solid #ecd48c; }

.dashboard-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.dashboard-head p { margin: 5px 0 0; color: var(--muted); }

.status-pill {
  align-self: flex-start;
  padding: 9px 13px;
  border-radius: 999px;
  color: #805d00;
  background: #fff0b7;
  font-weight: 800;
  white-space: nowrap;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi {
  min-height: 138px;
  padding: 18px 14px;
  display: grid;
  align-content: center;
  text-align: center;
}

.kpi-icon {
  width: 37px;
  height: 37px;
  margin: 0 auto 8px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--teal-dark);
  border: 2px solid var(--teal);
  font-weight: 900;
}

.kpi-label { color: var(--ink); font-size: 13px; }
.kpi-value { margin: 7px 0 3px; font-size: 28px; font-weight: 850; }
.kpi-note { color: var(--muted); font-size: 12px; }

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
  gap: 18px;
  margin-bottom: 18px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.section-panel { padding: 22px; }

.highlight-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.highlight-list li {
  position: relative;
  padding: 10px 0 10px 28px;
  border-bottom: 1px solid #edf1f5;
  line-height: 1.45;
}

.highlight-list li:last-child { border-bottom: 0; }
.highlight-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--teal);
  font-weight: 900;
}

.readiness-wrap {
  display: flex;
  align-items: center;
  gap: 24px;
}

.readiness-ring {
  --score: 70;
  width: 150px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--teal) calc(var(--score) * 1%), #dce4e9 0);
  position: relative;
  flex: 0 0 auto;
}

.readiness-ring::before {
  content: "";
  position: absolute;
  inset: 16px;
  border-radius: 50%;
  background: white;
}

.readiness-ring div {
  position: relative;
  text-align: center;
}

.readiness-ring strong { display: block; font-size: 45px; }
.readiness-ring small { color: var(--muted); }

.pathway {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.pathway-step {
  padding: 16px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  text-align: center;
  background: #fafcfe;
}

.pathway-step.active {
  border: 2px solid var(--teal);
  background: #effcfc;
}

.pathway-step b,
.pathway-step span { display: block; }
.pathway-step span { margin-top: 6px; color: var(--muted); font-size: 12px; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  padding: 11px 10px;
  color: white;
  background: var(--navy);
  text-align: left;
}

.data-table td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
}

.data-table tr:nth-child(even) td { background: #f8fbfd; }
.data-table small { color: var(--muted); }

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

.bar-stack {
  display: grid;
  gap: 13px;
}

.bar-row {
  display: grid;
  grid-template-columns: 165px 1fr 58px;
  gap: 12px;
  align-items: center;
}

.bar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 99px;
  background: #e4ebf0;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #00a7aa, #07858d);
}

.score-list { display: grid; gap: 18px; }

.score-row {
  display: grid;
  grid-template-columns: 1fr 62px;
  gap: 9px 14px;
}

.score-row .bar-track { grid-column: 1 / -1; }
.score-row strong:last-child { text-align: right; }

.risk-list { display: grid; gap: 10px; }

.risk-row {
  padding: 15px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  box-shadow: none;
}

.risk-row p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.risk-level { font-size: 12px; font-weight: 850; text-transform: uppercase; }
.risk-level.low { color: var(--success); }
.risk-level.moderate { color: var(--warn); }
.risk-level.high { color: var(--danger); }

.mission-banner {
  padding: 20px 24px;
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 24px;
  align-items: center;
  border: 1px solid var(--teal);
  border-radius: 14px;
  background: linear-gradient(90deg, #edfafa, white);
  margin-bottom: 18px;
}

.mission-banner strong { color: var(--teal-dark); font-size: 18px; }
.mission-banner p { margin: 0; line-height: 1.55; font-weight: 650; }

.donut {
  --percent: 50;
  width: 200px;
  aspect-ratio: 1;
  margin: 18px auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--teal) calc(var(--percent) * 1%), #dbe4e9 0);
  position: relative;
}

.donut::before {
  content: "";
  position: absolute;
  inset: 34px;
  border-radius: 50%;
  background: white;
}

.donut div { position: relative; text-align: center; }
.donut strong { display: block; font-size: 32px; }
.donut small { color: var(--muted); }

.protection-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.protection-card {
  padding: 16px;
  box-shadow: none;
}

.protection-card strong { display: block; margin-bottom: 6px; }
.protection-card span { color: var(--muted); font-size: 13px; line-height: 1.45; }

.debt-chart {
  height: 290px;
  display: flex;
  align-items: end;
  gap: 12px;
  padding: 20px 5px 5px;
  border-bottom: 1px solid #9bacc0;
}

.debt-column {
  min-width: 40px;
  flex: 1;
  display: grid;
  justify-items: center;
  gap: 6px;
}

.debt-bar {
  width: 70%;
  min-height: 4px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #13aeb0, #00747b);
}

.debt-column small { color: var(--muted); }
.debt-column b { font-size: 11px; }

.empty-state {
  padding: 35px;
  color: var(--muted);
  text-align: center;
}

.admin-body { background: #eef3f8; }
.admin-shell { max-width: 1180px; margin: 0 auto; padding: 28px; }

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}

.admin-header a { color: var(--teal-dark); font-weight: 800; }

.admin-auth {
  padding: 20px;
  display: flex;
  align-items: end;
  gap: 14px;
  margin-bottom: 20px;
}

.admin-auth .field { flex: 1; margin: 0; }
.admin-auth .alert { margin: 0; flex: 1; }

.table-header { padding: 22px 22px 0; }
.admin-list { padding: 22px; }

.admin-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px 20px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.admin-card:last-child { border-bottom: 0; }
.admin-card p { margin: 5px 0 0; color: var(--muted); }
.admin-card .secondary { align-self: center; }

.admin-meta {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { min-height: auto; position: static; }
  .nav { display: flex; overflow-x: auto; padding: 0; }
  .nav button { min-width: 210px; }
  .sidebar-footer { display: none; }
  .brand { min-height: 95px; }
  .upload-layout, .grid-2 { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; }
}

@media (max-width: 640px) {
  .content { padding: 14px; }
  .topbar { padding: 20px 16px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .mission-banner { grid-template-columns: 1fr; }
  .protection-grid { grid-template-columns: 1fr; }
  .admin-auth { display: grid; }
  .pathway { grid-template-columns: 1fr; }
}
