/* Research Bid Studio — editorial, sparse, thin rules, one accent. */

@import url('https://fonts.googleapis.com/css2?family=Newsreader:opsz,wght@6..72,300;6..72,400&family=Hanken+Grotesk:wght@300;400;500&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #0d0e10;
  --ink: #ebe8e2;
  --body: rgba(235, 232, 226, 0.75);
  --secondary: rgba(235, 232, 226, 0.55);
  --label: rgba(235, 232, 226, 0.4);
  --hairline: rgba(235, 232, 226, 0.12);
  --fill: rgba(235, 232, 226, 0.05);
  --accent: #9ccbd8;
  --serif: 'Newsreader', Georgia, serif;
  --sans: 'Hanken Grotesk', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --pad: 32px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--body);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 300;
  color: var(--ink);
  letter-spacing: 0.005em;
  margin: 0;
  line-height: 1.16;
}

h1 { font-size: clamp(28px, 3.4vw, 44px); }
h2 { font-size: clamp(21px, 2.1vw, 27px); }
h3 { font-size: 18px; }
h4 { font-size: 15px; font-family: var(--sans); font-weight: 500; color: var(--body); }

p { margin: 0 0 14px; }
a { color: var(--accent); text-decoration: none; border-bottom: 1px solid rgba(156, 203, 216, 0.3); }
a:hover { border-bottom-color: var(--accent); }

.label, .eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--label);
}
.num, .mono { font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.dim { color: var(--secondary); }
.faint { color: var(--label); }
.hint { color: var(--label); font-size: 12.5px; line-height: 1.5; }

/* ---------------------------------------------------------------- layout */
.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 20px var(--pad) 16px;
  border-bottom: 1px solid var(--hairline);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.brand .mark {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 300;
  color: var(--ink);
}
.brand .sub { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.04em; color: var(--label); border-left: 1px solid var(--hairline); padding-left: 12px; }
.topbar .actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

nav.tabs {
  display: flex;
  gap: 0;
  padding: 0 var(--pad);
  border-bottom: 1px solid var(--hairline);
  overflow-x: auto;
  scrollbar-width: none;
}
nav.tabs::-webkit-scrollbar { display: none; }
nav.tabs button {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  color: var(--label);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 13px 16px;
  cursor: pointer;
  white-space: nowrap;
  margin-bottom: -1px;
}
nav.tabs button:first-child { padding-left: 0; }
nav.tabs button:hover { color: var(--secondary); }
nav.tabs button[aria-selected='true'] { color: var(--ink); border-bottom-color: var(--accent); }
nav.tabs button:disabled { color: rgba(235, 232, 226, 0.2); cursor: default; }

main { flex: 1; padding: 0 var(--pad) 72px; max-width: 1240px; width: 100%; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; }

section.block { padding: 28px 0; border-bottom: 1px solid var(--hairline); }
section.block:last-child { border-bottom: 0; }
.block-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.block-head .eyebrow { margin-bottom: 6px; }

/* ---------------------------------------------------------------- controls */
button, .btn {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--body);
  background: transparent;
  border: 1px solid var(--hairline);
  padding: 8px 13px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
button:hover, .btn:hover { border-color: rgba(235, 232, 226, 0.32); color: var(--ink); }
button:focus-visible, .btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
}
button.primary { border-color: rgba(156, 203, 216, 0.5); color: var(--accent); }
button.primary:hover { background: rgba(156, 203, 216, 0.09); border-color: var(--accent); }
button.ghost { border-color: transparent; padding: 6px 8px; }
button.danger:hover { color: #e0a3a3; border-color: rgba(224, 163, 163, 0.4); }
button:disabled { opacity: 0.35; cursor: not-allowed; }

input, textarea, select {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 300;
  color: var(--ink);
  background: var(--fill);
  border: 1px solid var(--hairline);
  padding: 8px 10px;
  width: 100%;
  border-radius: 0;
}
input[type='number'] { font-family: var(--mono); font-size: 13px; }
textarea { resize: vertical; min-height: 84px; line-height: 1.55; }
select { appearance: none; background-image: none; cursor: pointer; }
input::placeholder, textarea::placeholder { color: rgba(235, 232, 226, 0.28); }
input[type='range'] { padding: 0; background: none; border: 0; accent-color: var(--accent); }

.field { margin-bottom: 14px; }
.field > label { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--label); margin-bottom: 5px; }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.grid.four { grid-template-columns: repeat(4, 1fr); }

/* ------------------------------------------------------------------ tables */
table { width: 100%; border-collapse: collapse; }
th {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--label);
  font-weight: 400;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}
td { padding: 10px; border-bottom: 1px solid var(--hairline); vertical-align: top; font-size: 13.5px; }
td.num, th.num { text-align: right; font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
tr:hover td { background: rgba(235, 232, 226, 0.017); }
.table-wrap { overflow-x: auto; }

/* --------------------------------------------------------------- citations */
.cite {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--label);
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
}
.cite a { color: var(--label); border-bottom: 1px dotted rgba(235, 232, 226, 0.25); }
.cite a:hover { color: var(--accent); border-bottom-color: var(--accent); }
blockquote {
  margin: 10px 0 0;
  padding: 8px 0 8px 14px;
  border-left: 1px solid rgba(156, 203, 216, 0.45);
  color: var(--secondary);
  font-family: var(--serif);
  font-size: 14.5px;
  line-height: 1.5;
}
.quote-src { display: block; margin-top: 5px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; color: var(--label); text-transform: uppercase; }

/* ------------------------------------------------------------------ badges */
.badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 7px;
  border: 1px solid var(--hairline);
  color: var(--secondary);
  white-space: nowrap;
}
.badge.addressed { color: rgba(156, 203, 216, 0.9); border-color: rgba(156, 203, 216, 0.35); }
.badge.needs-info { color: rgba(235, 232, 226, 0.6); border-color: rgba(235, 232, 226, 0.22); }
.badge.gap { color: rgba(224, 163, 163, 0.85); border-color: rgba(224, 163, 163, 0.3); }
.badge.hypo { color: var(--label); border-style: dashed; }
.badge.mandatory { color: var(--label); }

.ph {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--accent);
  background: rgba(156, 203, 216, 0.07);
  border: 1px dashed rgba(156, 203, 216, 0.32);
  padding: 1px 6px;
  white-space: normal;
}
.placeholder-block {
  border: 1px dashed rgba(156, 203, 216, 0.3);
  background: rgba(156, 203, 216, 0.04);
  padding: 12px 14px;
  margin: 12px 0;
  font-size: 13px;
  color: var(--body);
}
.placeholder-block .label { color: var(--accent); }

.banner {
  border: 1px solid rgba(156, 203, 216, 0.28);
  background: rgba(156, 203, 216, 0.045);
  padding: 11px 15px;
  margin: 0 0 22px;
  font-size: 13px;
  color: var(--body);
  display: flex;
  gap: 12px;
  align-items: baseline;
  flex-wrap: wrap;
}
.banner .label { color: var(--accent); flex-shrink: 0; }
.notice { border-left: 1px solid var(--hairline); padding: 10px 0 10px 14px; color: var(--secondary); font-size: 13px; }
.error-text { color: #e0a3a3; font-size: 13px; }
.ok-text { color: var(--accent); font-size: 13px; }

/* -------------------------------------------------------------- dashboard */
.masthead {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 40px;
  padding: 34px 0 26px;
  border-bottom: 1px solid var(--hairline);
}
.masthead h1 { margin: 8px 0 12px; max-width: 22ch; }
.masthead .lede { max-width: 52ch; color: var(--secondary); font-size: 14.5px; }
.facts { display: grid; grid-template-columns: 1fr; gap: 0; }
.fact { padding: 10px 0; border-bottom: 1px solid var(--hairline); display: flex; justify-content: space-between; gap: 16px; align-items: baseline; }
.fact:last-child { border-bottom: 0; }
.fact .label { flex-shrink: 0; }
.fact .value { font-family: var(--mono); font-size: 12.5px; color: var(--ink); text-align: right; }

.weights { display: grid; gap: 0; }
.weight-row { display: grid; grid-template-columns: 1fr 44px; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--hairline); }
.weight-row:last-child { border-bottom: 0; }
.weight-bar { height: 2px; background: var(--hairline); position: relative; margin-top: 6px; }
.weight-bar span { position: absolute; inset: 0 auto 0 0; background: var(--accent); }

.kpi-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border: 1px solid var(--hairline); border-left: 0; border-right: 0; }
.kpi { padding: 16px 18px; border-right: 1px solid var(--hairline); }
.kpi:last-child { border-right: 0; }
.kpi .label { display: block; margin-bottom: 6px; }
.kpi .figure { font-family: var(--mono); font-size: 20px; color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi .figure small { font-size: 11px; color: var(--label); margin-left: 4px; }

/* ------------------------------------------------------------------ matrix */
.matrix-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; border-bottom: 1px solid var(--hairline); }
.matrix-row.open { background: rgba(235, 232, 226, 0.02); }
.matrix-summary { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto auto; gap: 12px; align-items: start; padding: 13px 4px; }
.matrix-summary > div { min-width: 0; }
.matrix-quick { padding: 4px 0 18px 0; display: grid; grid-template-columns: 1fr 190px; gap: 16px; }
.matrix-toggle {
  background: none;
  border: 0;
  color: var(--label);
  font-size: 13px;
  line-height: 1;
  justify-self: start;
  width: 26px;
  height: 26px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -2px;
}
.matrix-toggle:hover { color: var(--accent); border-color: transparent; }
.matrix-text { font-size: 14px; color: var(--ink); }
.matrix-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.matrix-preview {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 88ch;
}

/* --------------------------------------------------------------- economics */
.scenario-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.scenario-tabs button { text-transform: none; letter-spacing: 0.02em; font-family: var(--sans); font-size: 12.5px; }
.scenario-tabs button[aria-pressed='true'] { border-color: rgba(156, 203, 216, 0.5); color: var(--accent); }

.ladder { display: grid; gap: 0; }
.ladder-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; padding: 7px 0; border-bottom: 1px solid var(--hairline); align-items: baseline; }
.ladder-row:last-child { border-bottom: 0; }
.ladder-row.total { border-top: 1px solid rgba(235, 232, 226, 0.28); border-bottom: 0; padding-top: 11px; margin-top: 3px; font-size: 15px; }
.ladder-row.total .val { color: var(--accent); font-size: 17px; }
.ladder-row .val { text-align: right; font-family: var(--mono); font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
.ladder-row.sub .lbl, .ladder-row.sub .val { color: var(--secondary); }

.chart { width: 100%; height: 210px; display: block; overflow: visible; }
.chart text { font-family: var(--mono); font-size: 9px; fill: rgba(235, 232, 226, 0.4); }
.chart .axis { stroke: rgba(235, 232, 226, 0.12); stroke-width: 1; }
.chart .series { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.chart .series-tech { fill: none; stroke: rgba(235, 232, 226, 0.3); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .marker { fill: var(--accent); }
.chart .grid-line { stroke: rgba(235, 232, 226, 0.07); stroke-width: 1; }

/* --------------------------------------------------------------- dropzone */
.dropzone {
  border: 1px dashed rgba(235, 232, 226, 0.2);
  padding: 34px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: rgba(235, 232, 226, 0.012);
}
.dropzone:hover, .dropzone.drag { border-color: rgba(156, 203, 216, 0.5); background: rgba(156, 203, 216, 0.04); }
.dropzone h3 { margin-bottom: 8px; }
.dropzone p { color: var(--label); font-size: 13px; margin: 0; }

pre.raw {
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--secondary);
  background: var(--fill);
  border: 1px solid var(--hairline);
  padding: 12px 14px;
  overflow: auto;
  max-height: 320px;
  margin: 0;
}

/* ------------------------------------------------------------------- modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(13, 14, 16, 0.82);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 20px;
  z-index: 50;
  overflow-y: auto;
}
.modal-backdrop.open { display: flex; }
.modal { background: #101114; border: 1px solid var(--hairline); max-width: 620px; width: 100%; padding: 24px 26px; }
.modal h2 { margin-bottom: 6px; }
.modal .close { float: right; }

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: #16181b;
  border: 1px solid rgba(156, 203, 216, 0.4);
  color: var(--ink);
  padding: 9px 16px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  z-index: 80;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.toast.show { opacity: 1; }

footer.foot {
  padding: 18px var(--pad) 30px;
  border-top: 1px solid var(--hairline);
  color: var(--label);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------- report */
.report { max-width: 780px; }
.report h1 { font-size: 32px; margin-bottom: 6px; }
.report h2 { font-size: 21px; margin: 30px 0 10px; }
.report h3 { margin: 20px 0 6px; font-size: 16.5px; }
.report-section { break-inside: avoid-page; }
.report table { font-size: 12.5px; }
.report .report-banner { border: 1px solid rgba(156, 203, 216, 0.35); padding: 10px 14px; margin: 14px 0 24px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; color: var(--accent); }

.split-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* -------------------------------------------------------------- responsive */
@media (max-width: 1000px) {
  .masthead { grid-template-columns: 1fr; gap: 24px; }
  .grid.four { grid-template-columns: repeat(2, 1fr); }
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .kpi:nth-child(2) { border-right: 0; }
  .kpi:nth-child(1), .kpi:nth-child(2) { border-bottom: 1px solid var(--hairline); }
}

@media (max-width: 720px) {
  :root { --pad: 16px; }
  html, body { font-size: 14.5px; }
  .grid.two, .grid.three, .grid.four { grid-template-columns: 1fr; }
  .matrix-summary { grid-template-columns: 22px minmax(0, 1fr) auto; }
  .matrix-summary .cite { grid-column: 2 / -1; }
  .matrix-summary > div:nth-child(4) { grid-column: 2 / -1; }
  .matrix-quick { grid-template-columns: 1fr; }
  .split-fields { grid-template-columns: 1fr; }
  .topbar { padding: 14px var(--pad) 12px; gap: 10px; }
  .brand .mark { font-size: 17px; }
  nav.tabs { padding: 0 var(--pad); }
  nav.tabs button { padding: 11px 11px; font-size: 10px; letter-spacing: 0.08em; }
  main { padding-bottom: 48px; }
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .kpi { padding: 13px 12px; }
  .kpi .figure { font-size: 17px; }
  .chart { height: 180px; }
  .toast { left: 12px; right: 12px; transform: none; }
}

/* ------------------------------------------------------------------ print */
@media print {
  @page { margin: 16mm 15mm; }
  :root { --pad: 0; }
  html, body {
    background: #fff !important;
    color: #1a1a1a !important;
    font-size: 10.5pt;
    line-height: 1.42;
    /* Chromium embeds ffi/fi ligature glyphs by default, which makes text
       copied out of the generated PDF read "gures" instead of "figures".
       The proposal gets emailed as a PDF, so keep the text layer honest. */
    font-variant-ligatures: none;
    font-feature-settings: 'liga' 0, 'clig' 0, 'dlig' 0;
  }
  .topbar, nav.tabs, .actions, .no-print, footer.foot, .scenario-tabs, .dropzone, .modal-backdrop, .toast { display: none !important; }
  main { max-width: none; padding: 0; }
  .view { display: none !important; }
  .view.print-target { display: block !important; }
  h1, h2, h3, h4 { color: #111 !important; page-break-after: avoid; }
  .dim, .faint, .label, .eyebrow, .cite, .hint, td, p { color: #333 !important; }
  .label, .eyebrow, .cite, th { color: #555 !important; }
  .report-banner { border-color: #999 !important; color: #333 !important; background: none !important; }
  blockquote { border-left-color: #999 !important; color: #333 !important; }
  .badge { border-color: #999 !important; color: #333 !important; white-space: normal; }
  .ph { border-color: #666 !important; color: #111 !important; background: none !important; }
  .placeholder-block { border-color: #999 !important; background: none !important; }
  table { font-size: 8.6pt; table-layout: fixed; width: 100%; }
  th, td { border-bottom: 1px solid #ccc !important; padding: 3px 4px; overflow-wrap: anywhere; }
  .report { max-width: none; }
  tr { page-break-inside: avoid; }
  .report-section { page-break-inside: avoid; }
  .page-break { page-break-before: always; }
  a { color: #111 !important; border-bottom: 0 !important; }
  .ladder-row.total .val { color: #111 !important; }
  .chart { display: none !important; }
  .table-wrap { overflow: visible !important; }
  .matrix-preview { -webkit-line-clamp: unset; display: block; overflow: visible; }
}
