:root {
  --navy: #1e3a52;
  --navy-deep: #14293c;
  --primary: #b02a2a;
  --primary-bright: #c0392b;
  --green: #7cb342;
  --gray-btn: #9b9b9b;
  --cell: #ececec;
  --cell-line: #d8d8d8;
  --ink: #1a1a1a;
  --muted: #5b7183;
  --rule: #e2e2e2;
  --steel: #7d9bb0;
  --sidebar-w: 380px;
}

* { box-sizing: border-box; }

/* A class-level display rule outranks the UA [hidden] style, and .shell sets
   display:flex, so the hidden report views would otherwise all render at once. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--ink);
  background: #fff;
  font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0 0 .5rem; font-weight: 700; letter-spacing: -.2px; }

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

.shell { display: flex; align-items: flex-start; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  align-self: stretch;
  background: var(--navy);
  color: #fff;
  padding: 1.75rem 1.6rem 2rem;
  display: flex;
  flex-direction: column;
}

.sidebar .logo { width: 210px; max-width: 100%; margin-bottom: 1.1rem; display: block; }
.sidebar .logo-badge { width: 46px; height: 46px; margin-bottom: .9rem; display: block; }

.sidebar h1 { font-size: 1.85rem; line-height: 1.15; margin: 0 0 .85rem; }

.sidebar .rule { border: 0; border-top: 1px solid rgba(255,255,255,.28); margin: 1rem 0; }

.sidebar p { font-size: .95rem; color: #e7eef4; margin: 0 0 .9rem; }

.sidebar .hint { font-weight: 700; color: #fff; margin-top: auto; padding-top: 1.5rem; }

.main {
  flex: 1 1 auto;
  min-width: 0;
  padding: 2.25rem 2.5rem 3rem;
}

.brandbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 2.5rem;
  border-bottom: 1px solid var(--rule);
}
.brandbar img { height: 54px; }
.brandbar .tag { color: var(--muted); font-size: .85rem; font-weight: 600; letter-spacing: 1.4px; text-transform: uppercase; }

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

.field { margin-bottom: 1.05rem; }

.field > label {
  display: block;
  font-size: .92rem;
  font-weight: 600;
  color: #fff;
}
.main .field > label { color: var(--ink); }

.field input[type=text],
.field input[type=email],
.field input[type=password],
.field input[type=number],
.field select {
  width: 100%;
  border: 1px solid #cfd8de;
  border-radius: 6px;
  background: #fff;
  color: #111;
  padding: .72rem .8rem;
  margin-top: .4rem;
  font: inherit;
  font-size: .95rem;
}

.field select { padding: .72rem .6rem; }

.unit {
  display: flex;
  gap: 1.1rem;
  margin-top: .35rem;
  font-size: .88rem;
  color: #dbe6ee;
}
.unit label { display: inline-flex; align-items: center; gap: .35rem; cursor: pointer; }

.info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  margin-left: .3rem;
  border-radius: 50%;
  background: rgba(255,255,255,.22);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  cursor: help;
  vertical-align: middle;
}
.main .info { background: #d3dde4; color: var(--navy); }

.err { color: #ffb4b4; font-size: .83rem; margin-top: .3rem; display: block; }
.main .err { color: var(--primary); }

.stepcount { font-weight: 700; color: #cfe0ec; margin: 1rem 0 .25rem; }

/* ------------------------------------------------------------- buttons */

.btn {
  border: 0;
  border-radius: 6px;
  padding: .68rem 1.25rem;
  font: inherit;
  font-size: .95rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary-bright); }
.btn-primary:hover:not(:disabled) { background: var(--primary); }
.btn-back { background: var(--gray-btn); }
.btn-green { background: var(--green); }
.btn-green:hover { background: #6ca337; }

.nav-row { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.2rem; }

/* ------------------------------------------------------------- modal */

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(8,18,28,.62);
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  z-index: 1000;
}
.modal {
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  max-width: 520px;
  width: 100%;
  padding: 1.6rem 1.7rem 1.4rem;
  box-shadow: 0 18px 48px rgba(0,0,0,.28);
}
.modal h2 { font-size: 1.25rem; }
.modal p { font-size: .95rem; }
.modal .nav-row { justify-content: flex-end; }

/* ------------------------------------------------------------- zone grid */

.chart-title { text-align: center; font-size: 1.5rem; font-weight: 700; margin: 0 0 1.4rem; }

.framework { display: grid; grid-template-columns: 92px 1fr; gap: .35rem; }

.yaxis {
  display: flex; flex-direction: column; justify-content: space-between;
  align-items: flex-end; text-align: right;
  padding: .1rem .6rem .1rem 0;
  font-size: .85rem; color: #333;
}
.yaxis .axis-name { font-weight: 700; }

.grid-wrap { position: relative; }

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

.zone-cell {
  position: relative;
  background: var(--cell);
  border: 2px solid transparent;
  border-radius: 2px;
  padding: .9rem .8rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  font-size: .86rem;
  line-height: 1.35;
}
.zone-cell .badge {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-weight: 700; font-size: .9rem;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: .55rem;
}
.zone-cell.active { border-color: var(--primary); }
.zone-cell.active .badge { background: var(--primary-bright); }

.frontier-overlay {
  position: absolute; inset: 0;
  pointer-events: none;
}

.xaxis {
  display: flex; justify-content: space-between;
  margin-top: .45rem;
  font-size: .85rem; color: #333;
}
.xaxis-name { text-align: center; font-weight: 700; margin-top: .3rem; }

.verdict { margin-top: 1.6rem; }
.verdict .line { color: var(--primary-bright); font-size: 1.05rem; }
.verdict .line strong { color: var(--primary); }
.verdict hr { border: 0; border-top: 1px solid var(--rule); margin: 1rem 0; }
.verdict h3 { font-size: 1.1rem; }
.verdict p { margin: .3rem 0 0; }

/* ------------------------------------------------------------- charts */

.chart-card { margin-bottom: 2rem; }
.chart-card svg { width: 100%; height: auto; display: block; }

.chart-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
}
.toggle-table {
  border: 1px solid #cfd8de; background: #fff; border-radius: 5px;
  padding: .3rem .55rem; cursor: pointer; color: var(--navy); font-size: .85rem;
}

table.data {
  width: 100%; border-collapse: collapse; font-size: .9rem; margin-top: .6rem;
}
table.data th, table.data td {
  border-bottom: 1px solid var(--rule); padding: .5rem .6rem; text-align: right;
}
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data thead th { background: #f5f7f9; font-weight: 700; }

.legend { display: flex; gap: 1.2rem; justify-content: center; font-size: .85rem; font-weight: 700; margin-bottom: .5rem; }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.swatch { width: 26px; height: 12px; border-radius: 2px; display: inline-block; }
.swatch.run { background: var(--navy); }
.swatch.change { background: var(--steel); }

.note {
  background: #fdf6e6; border-left: 4px solid #e0a800;
  padding: .7rem .9rem; font-size: .88rem; margin: 1rem 0;
}

.scenario { margin-top: .4rem; }
.scenario h2 { font-size: 1rem; font-weight: 700; color: #fff; margin-bottom: .5rem; }

.denied { max-width: 620px; margin: 5rem auto; padding: 0 1.5rem; }

/* ------------------------------------------------------------- responsive */

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex: 1 1 auto; }
  .main { padding: 1.5rem 1.25rem 2.5rem; width: 100%; }
  .zone-grid { grid-auto-rows: auto; }
  .zone-cell { min-height: 118px; }
  .framework { grid-template-columns: 64px 1fr; }
}

/* ------------------------------------------------------------- print */

@media print {
  .sidebar { background: var(--navy) !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .no-print { display: none !important; }
  .shell { min-height: auto; }
  .report-view { page-break-after: always; }
  .report-view:last-child { page-break-after: auto; }
  body { font-size: 12px; }
}

.report-view + .report-view { margin-top: 3rem; }
