/* SteamCycle: an engineering-workstation layout.
   Square panels, header bars, dense grids, one accent colour. */

:root {
  color-scheme: light;
  --page: #eef0f3;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --surface-3: #e9ecf0;
  --ink: #16191d;
  --ink-2: #5d6570;
  --ink-3: #8a929c;
  --line: #d5d9df;
  --line-2: #e6e9ed;
  --grid: #e7e7e7;
  --axis: #c2c2c2;
  --appbar: #1b2026;
  --appbar-ink: #e8ebef;
  --appbar-ink-2: #9aa3ad;
  --accent: #1b64be;
  --accent-soft: #e5effb;
  --series-1: #257de0;  /* Mahihkan */
  --series-2: #f47230;  /* Nabiye */
  --series-3: #00b894;  /* steam */
  --good: #0aac23;
  --warning: #fbb315;
  --critical: #dc3c3d;
  --good-text: #006c10;
  --warn-text: #8a5a00;
  --crit-text: #b3282a;
  --raw: #7d858f;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --rail-w: 188px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0f1113;
  --surface: #181a1d;
  --surface-2: #1e2125;
  --surface-3: #262a2f;
  --ink: #e9ebee;
  --ink-2: #a1a8b1;
  --ink-3: #737b85;
  --line: #2e3238;
  --line-2: #25292e;
  --grid: #2b2e32;
  --axis: #474747;
  --appbar: #0b0d0f;
  --accent: #338ced;
  --accent-soft: #16273b;
  --series-1: #338ced;
  --series-2: #e76624;
  --series-3: #00a888;
  --good-text: #53c556;
  --warn-text: #f2c14e;
  --crit-text: #f07475;
  --raw: #8f969e;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0f1113; --surface: #181a1d; --surface-2: #1e2125; --surface-3: #262a2f;
    --ink: #e9ebee; --ink-2: #a1a8b1; --ink-3: #737b85; --line: #2e3238; --line-2: #25292e;
    --grid: #2b2e32; --axis: #474747; --appbar: #0b0d0f; --accent: #338ced; --accent-soft: #16273b;
    --series-1: #338ced; --series-2: #e76624; --series-3: #00a888;
    --good-text: #53c556; --warn-text: #f2c14e; --crit-text: #f07475; --raw: #8f969e;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink); font: 13px/1.45 var(--font);
  display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); grid-template-rows: 40px minmax(0, 1fr) 24px;
  grid-template-areas: "bar bar" "rail main" "status status";
}
a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }

/* ---------- app bar ---------- */
.appbar {
  grid-area: bar; display: flex; align-items: center; gap: 14px; padding: 0 12px;
  background: var(--appbar); color: var(--appbar-ink); border-bottom: 1px solid #000;
}
.product { display: flex; align-items: center; gap: 8px; color: var(--appbar-ink); text-decoration: none; font-weight: 600; letter-spacing: .01em; }
.product svg { width: 18px; height: 18px; color: #6aabf1; }
.context { color: var(--appbar-ink-2); font-size: 12px; padding-left: 14px; border-left: 1px solid #39414b; }
.spacer { flex: 1; }
.vintage { font-size: 12px; color: var(--appbar-ink-2); font-family: var(--mono); }
.appbar .tool {
  background: transparent; border: 1px solid #39414b; color: var(--appbar-ink); padding: 3px 9px; border-radius: 2px;
  cursor: pointer; text-decoration: none; font-size: 12px; line-height: 16px;
}
.appbar .tool:hover { background: #262d35; }

/* ---------- rail ---------- */
.rail { grid-area: rail; background: var(--surface); border-right: 1px solid var(--line); padding: 8px 0; display: flex; flex-direction: column; }
.rail a {
  display: flex; align-items: center; gap: 10px; padding: 7px 14px; color: var(--ink-2); text-decoration: none;
  border-left: 3px solid transparent; font-size: 13px;
}
.rail a:hover { background: var(--surface-2); color: var(--ink); }
.rail a[aria-current="page"] { background: var(--accent-soft); color: var(--ink); border-left-color: var(--accent); font-weight: 600; }
.rail .ico { width: 16px; text-align: center; color: var(--ink-3); }
.rail a[aria-current="page"] .ico { color: var(--accent); }

/* ---------- workspace ---------- */
.workspace { grid-area: main; overflow: auto; padding: 12px 14px 20px; min-width: 0; }
.view { display: flex; flex-direction: column; gap: 10px; }
.view[hidden] { display: none; }
.viewbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-height: 30px; }
.viewbar h1 { font-size: 16px; font-weight: 600; margin: 0; margin-right: auto; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lead-note { margin: 0; color: var(--ink-2); max-width: 1100px; }
.muted { color: var(--ink-2); }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 2px; min-width: 0; }
.panel > header {
  display: flex; align-items: baseline; gap: 10px; padding: 6px 10px; border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.panel > header h2 { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin: 0; color: var(--ink); }
.panel > header .unit { color: var(--ink-3); font-size: 11.5px; }
.panel > header .actions { margin-left: auto; display: flex; gap: 6px; }
.panel .foot { margin: 0; padding: 4px 10px 8px; color: var(--ink-3); font-size: 11.5px; }
.grid { display: grid; gap: 10px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.chart { height: 250px; width: 100%; }
.chart.tall { height: 420px; }
.chart.short { height: 210px; }

/* ---------- KPI strip ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: 2px; }
.kpi { padding: 8px 12px 9px; border-right: 1px solid var(--line-2); min-width: 0; }
.kpi:last-child { border-right: 0; }
.kpi .k { color: var(--ink-2); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; line-height: 1.3; min-height: 2.6em; }
.kpi .v { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.25; margin-top: 2px; }
.kpi .s { color: var(--ink-3); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- controls ---------- */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 2px; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 4px 12px; cursor: pointer; color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button[aria-checked="true"] { background: var(--accent-soft); color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.seg.small button { padding: 3px 9px; font-size: 12px; }
.swatch { width: 9px; height: 9px; display: inline-block; flex: none; }
select, input[type="search"] {
  background: var(--surface); border: 1px solid var(--line); border-radius: 2px; padding: 4px 7px; font-size: 12.5px; min-height: 27px;
}
input[type="search"]:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }
.btn { background: var(--surface); border: 1px solid var(--line); border-radius: 2px; padding: 4px 10px; cursor: pointer; font-size: 12.5px; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn:disabled { opacity: .45; cursor: default; }
.chk { display: flex; gap: 6px; align-items: center; color: var(--ink-2); font-size: 12.5px; }

/* ---------- tables ---------- */
.table-wrap { overflow: auto; }
.table-wrap.tall { max-height: calc(100vh - 230px); }
.grid-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 12.5px; }
.grid-table th, .grid-table td { padding: 4px 9px; border-bottom: 1px solid var(--line-2); text-align: right; white-space: nowrap; }
.grid-table th {
  position: sticky; top: 0; background: var(--surface-2); color: var(--ink-2); font-weight: 600; font-size: 11.5px;
  border-bottom: 1px solid var(--line); z-index: 1;
}
.grid-table .l { text-align: left; }
.grid-table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.grid-table tbody tr:hover { background: var(--accent-soft); }
.grid-table tbody tr.link { cursor: pointer; }
.sortable th[data-key] { cursor: pointer; user-select: none; }
.sortable th[data-key]:hover { color: var(--ink); }
.sortable th[aria-sort="ascending"]::after { content: " ▲"; font-size: 9px; }
.sortable th[aria-sort="descending"]::after { content: " ▼"; font-size: 9px; }
.uwi { font-family: var(--mono); font-size: 12px; }
.neg { color: var(--crit-text); }
.pager { display: flex; gap: 6px; justify-content: flex-end; padding: 6px 10px; border-top: 1px solid var(--line); }

.flag { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; padding: 0 6px; border: 1px solid var(--line); border-radius: 2px; white-space: nowrap; }
.flag::before { content: ""; width: 7px; height: 7px; background: var(--c); }
.flag.ok { --c: var(--good); color: var(--good-text); }
.flag.warn { --c: var(--warning); color: var(--warn-text); }
.flag.crit { --c: var(--critical); color: var(--crit-text); }
.flag.na { --c: var(--ink-3); color: var(--ink-2); }

/* ---------- well analysis ---------- */
.split { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 10px; align-items: start; }
.browser { position: sticky; top: 0; display: flex; flex-direction: column; height: calc(100vh - 40px - 24px - 32px); }
.browser-tools { padding: 8px; display: grid; gap: 6px; border-bottom: 1px solid var(--line); }
.browser-tools .row { display: flex; gap: 6px; }
.browser-tools select { flex: 1; }
.list-head, .well-list button { display: grid; grid-template-columns: minmax(0, 1fr) 26px 64px; gap: 6px; align-items: center; }
.list-head { padding: 4px 10px; font-size: 11px; color: var(--ink-3); border-bottom: 1px solid var(--line); background: var(--surface-2); text-transform: uppercase; letter-spacing: .04em; }
.list-head span:not(:first-child) { text-align: right; }
.well-list { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; }
.well-list button {
  width: 100%; border: 0; border-bottom: 1px solid var(--line-2); background: transparent; padding: 4px 10px; cursor: pointer; text-align: left;
  font-variant-numeric: tabular-nums; font-size: 12px;
}
.well-list button:hover { background: var(--surface-2); }
.well-list button[aria-current="true"] { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.well-list .uwi { overflow: hidden; text-overflow: ellipsis; }
.well-list .n { text-align: right; color: var(--ink-2); }
.well-list .more { padding: 8px 10px; color: var(--ink-3); font-size: 12px; }

.well-pane { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.empty { padding: 48px 20px; text-align: center; color: var(--ink-2); }
.well-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 12px; }
.well-head .uwi { font-size: 15px; font-weight: 600; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 11.5px; padding: 1px 7px; border: 1px solid var(--line); border-radius: 2px; color: var(--ink-2); display: inline-flex; gap: 5px; align-items: center; background: var(--surface-2); }
.well-head .actions { margin-left: auto; display: flex; gap: 6px; }

.tabs { display: flex; border-bottom: 1px solid var(--line); background: var(--surface-2); padding: 0 6px; }
.tabs button { border: 0; background: transparent; padding: 7px 12px; cursor: pointer; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 12.5px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; background: var(--surface); }
.tabpanel { padding: 8px 10px 10px; }
.tabpanel[hidden] { display: none; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--ink-2); padding: 2px 0 4px; }
.legend i { display: inline-block; width: 16px; height: 0; border-top: 2px solid; vertical-align: middle; margin-right: 5px; }
.legend i.dash { border-top-style: dashed; }
.legend i.block { height: 9px; border: 0; }
.legend i.dot { width: 7px; height: 7px; border: 0; border-radius: 50%; }

.assume { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 18px; padding: 4px 0 10px; }
.assume label { display: flex; justify-content: space-between; color: var(--ink-2); font-size: 12px; }
.assume output { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.assume input[type="range"] { width: 100%; accent-color: var(--accent); }
.totals { display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: baseline; padding: 6px 0 8px; border-top: 1px solid var(--line-2); }
.totals .big { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.totals .muted { font-size: 12px; }
.totals .actions { margin-left: auto; display: flex; gap: 6px; }

/* ---------- methodology ---------- */
.prose { padding-bottom: 6px; }
.prose ol, .prose ul { margin: 8px 0; padding: 0 14px 0 30px; }
.prose li { margin: 0 0 6px; }
.prose p { margin: 6px 12px; }
.prose dl { margin: 6px 12px 8px; }
.prose dt { font-weight: 600; margin-top: 6px; }
.prose dd { margin: 0; color: var(--ink-2); }

/* ---------- status bar ---------- */
.statusbar {
  grid-area: status; display: flex; gap: 18px; align-items: center; padding: 0 12px; font-size: 11.5px;
  background: var(--surface-2); border-top: 1px solid var(--line); color: var(--ink-2); font-family: var(--mono); white-space: nowrap; overflow: hidden;
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .g3 { grid-template-columns: 1fr 1fr; }
  .assume { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  body { grid-template-columns: 1fr; grid-template-rows: 40px auto minmax(0, 1fr) 24px; grid-template-areas: "bar" "rail" "main" "status"; }
  .rail { flex-direction: row; overflow-x: auto; padding: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .rail a { border-left: 0; border-bottom: 3px solid transparent; white-space: nowrap; padding: 8px 12px; }
  .rail a[aria-current="page"] { border-bottom-color: var(--accent); }
  .context, .vintage { display: none; }
  .g2, .g3, .split { grid-template-columns: 1fr; }
  .browser { position: static; height: 420px; }
  .statusbar #st-st53, .statusbar #st-build { display: none; }
}

/* ---------- home: a report title page, not a landing hero ---------- */
.home { max-width: 1240px; }
.title-block { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 400px); }
.tb-main { padding: 18px 22px 16px; border-right: 1px solid var(--line); }
.tb-ref { margin: 0 0 6px; font: 11px/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.title-block h1 {
  margin: 0; font: 400 34px/1.1 Georgia, "Times New Roman", serif; letter-spacing: -.005em;
  padding-bottom: 10px; border-bottom: 3px double var(--line);
}
.tb-lede { margin: 10px 0 14px; font-size: 14px; color: var(--ink-2); max-width: 62ch; }
.lookup label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); margin-bottom: 4px; }
.lookup-row { display: flex; max-width: 460px; }
.lookup-row input {
  flex: 1; min-width: 0; padding: 5px 8px; border: 1px solid var(--line); border-right: 0; border-radius: 2px 0 0 2px;
  background: var(--surface); font-family: var(--mono); font-size: 12px;
}
.lookup-row input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.lookup-row button {
  padding: 5px 14px; border: 1px solid var(--accent); border-radius: 0 2px 2px 0; background: var(--accent); color: #fff; cursor: pointer;
}
.lookup-row button:hover { filter: brightness(1.08); }
.lookup-msg { margin: 4px 0 0; min-height: 1.3em; font-size: 12px; color: var(--crit-text); }

.datasheet { margin: 0; padding: 14px 18px 14px; display: grid; grid-template-columns: auto minmax(0, 1fr); align-content: start; background: var(--surface-2); }
.ds-title {
  grid-column: 1 / -1; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  padding-bottom: 6px; margin-bottom: 2px; border-bottom: 1px solid var(--ink);
}
.datasheet dt, .datasheet dd { padding: 6px 0; border-bottom: 1px dotted var(--line); margin: 0; }
.datasheet dt { color: var(--ink-2); font-size: 12px; padding-right: 14px; white-space: nowrap; }
.datasheet dd { font: 12px/1.45 var(--mono); text-align: right; }

.fig { margin: 0; }
.fig-chart { height: 330px; }
.fig figcaption { padding: 4px 14px 12px; border-top: 1px solid var(--line-2); }
.callouts { list-style: none; margin: 8px 0 6px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 6px 18px; }
.callouts li { font-size: 12px; color: var(--ink-2); padding-left: 26px; position: relative; }
.callouts b { color: var(--ink); font-weight: 600; }
.co-n {
  position: absolute; left: 0; top: 1px; width: 17px; height: 17px; border: 1px solid var(--ink); background: var(--surface);
  font: 600 10.5px/15px var(--mono); text-align: center; color: var(--ink);
}
#home-fig-note { margin: 4px 0 0; font-size: 12px; font-style: italic; color: var(--ink-2); }

.home-cols { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.toc { list-style: none; margin: 0; padding: 0; }
.toc li + li { border-top: 1px solid var(--line-2); }
.toc a {
  display: grid; grid-template-columns: 34px 150px minmax(0, 1fr) 14px; align-items: baseline; gap: 8px;
  padding: 9px 12px; text-decoration: none; color: var(--ink-2);
}
.toc a::after { content: "›"; color: var(--ink-3); }
.toc a:hover { background: var(--surface-2); }
.toc a:hover::after { color: var(--accent); }
.toc-n { font: 12px var(--mono); color: var(--accent); }
.toc-t { color: var(--ink); font-weight: 600; }
.toc-d { font-size: 12px; }

.findings { margin: 0; padding: 10px 14px 4px 30px; }
.findings li { margin-bottom: 8px; color: var(--ink-2); font-size: 12.5px; }
.findings li::marker { content: "▪  "; color: var(--accent); }
.findings b { color: var(--ink); font-variant-numeric: tabular-nums; }

.sources { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.sources th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); padding: 6px 12px; border-bottom: 1px solid var(--line); }
.sources td { padding: 6px 12px; border-bottom: 1px solid var(--line-2); }
.sources td:first-child { font-weight: 600; white-space: nowrap; }
.sources .num { font-family: var(--mono); font-size: 12px; white-space: nowrap; text-align: right; }
.sources th:last-child { text-align: right; }

@media (max-width: 860px) {
  .title-block, .home-cols { grid-template-columns: 1fr; }
  .tb-main { border-right: 0; border-bottom: 1px solid var(--line); }
  .toc a { grid-template-columns: 30px minmax(0, 1fr) 14px; }
  .toc-d { grid-column: 2 / 3; }
}
