/*
  OPS Portal theme – dark, rounded cards, pill navigation.
  Brand colours (from the OPS logo): blue #015B97, green #66BD4A.
  Chart series use the same two hues stepped for the dark surface and checked for
  colour-blind separation and contrast: blue #3B8FD4, green #4FA83A.
*/
:root {
  color-scheme: dark;
  --ops-blue: #015b97;
  --ops-green: #66bd4a;

  --bg: #05070a;
  --surface: #0b0e13;
  --card: #141a22;
  --card-2: #1b232d;
  --line: #26303c;
  --grid: #222b36;

  --text: #eef2f6;
  --text-2: #b3bdc8;
  --muted: #7d8996;

  --accent: #3b8fd4;          /* interactive + series 1 (used / weighted) */
  --accent-soft: #15314a;
  --series-1: #3b8fd4;
  --series-2: #4fa83a;        /* series 2 (earmarked / simple average) */
  --track: #222b36;
  --warn: #e3a33b;
  --warn-soft: #3a2a10;
  --good: #66bd4a;

  --radius: 22px;
  --radius-sm: 14px;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-size: 15px; line-height: 1.45; }
a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Frame ---------- */
.app { min-height: 100vh; background: var(--surface); display: grid; grid-template-columns: 84px 1fr; }
.rail {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; align-items: center;
  padding: 22px 0; gap: 10px;
}
.rail .mark { margin-bottom: 26px; }
.rail-group { background: var(--card); border-radius: 40px; padding: 12px 10px; display: flex; flex-direction: column; gap: 8px; }
.rail a {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--muted);
}
.rail a:hover, .rail a:focus-visible { color: var(--text); background: var(--card-2); outline: none; }
.rail a.active { color: #fff; background: var(--accent-soft); }
.rail svg { width: 21px; height: 21px; }

.mark {  /* the original OPS ball (company logo), Daryl 18 Nov 2026 */
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; padding: 0 !important;
}
.mark img { width: 44px; height: 44px; display: block; }
.brand-ball { width: 30px; height: 30px; vertical-align: middle; margin-right: 8px; }

.main { padding: 22px 32px 40px 8px; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; margin-right: 22px; }
.brand b { color: var(--ops-green); font-weight: 800; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  padding: 11px 22px; border-radius: 999px; background: var(--card); color: var(--text-2); font-weight: 500;
}
.pill:hover, .pill:focus-visible { color: var(--text); background: var(--card-2); outline: none; }
.pill.active { background: var(--accent-soft); color: #fff; }
.user {
  margin-left: auto; display: flex; align-items: center; gap: 10px; background: var(--card);
  border-radius: 999px; padding: 6px 16px 6px 6px;
}
.account-menu summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu .caret { color: var(--muted); font-size: 12px; }
.account-menu[open] { background: var(--card-2); }
.apps-list.account-list { min-width: 250px; }
.account-head { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 10px; border-bottom: 1px solid var(--line);
  margin-bottom: 4px; font-size: 13px; overflow-wrap: anywhere; }
.account-head b { font-size: 14px; }
.menu-form { margin: 4px 0 0; padding-top: 4px; border-top: 1px solid var(--line); }
.menu-form button { display: flex; gap: 10px; align-items: center; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px;
  background: none; color: var(--text); font: inherit; font-size: 14px; cursor: pointer; text-align: left; }
.menu-form button:hover, .menu-form button:focus-visible { background: var(--accent-soft); outline: none; }
.menu-form svg { width: 18px; height: 18px; flex: none; }
/* Language toggle (account menu) and the "English is the official version" note (release switch "languages") */
.lang-form label { display: flex; gap: 10px; align-items: center; padding: 6px 10px; font-size: 14px; }
.lang-form label > span { flex: 1; }
.lang-form svg { width: 18px; height: 18px; flex: none; }
.lang-form select { max-width: 150px; font-size: 14px; padding: 6px 8px; }
.banner.lang-note { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; font-weight: 400; font-size: 12.5px;
  background: var(--card-2); color: var(--text); border-left: 4px solid var(--accent); padding: 7px 14px; }
.banner.lang-note .muted { font-size: 12px; }
.lang-english { display: inline; margin: 0 0 0 auto; }
.lang-english button { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; font-weight: 600;
  text-decoration: underline; cursor: pointer; }
.user .avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--ops-blue); display: grid; place-items: center; font-weight: 700; }
.user small { display: block; color: var(--muted); font-size: 12px; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 30px; font-weight: 600; letter-spacing: -.3px; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.asof { display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 999px; padding: 6px 6px 6px 18px; }
.asof label { color: var(--text-2); font-size: 14px; }
.asof input {
  background: var(--card-2); border: 1px solid var(--line); color: var(--text); border-radius: 999px;
  padding: 7px 12px; font: inherit; font-size: 14px; color-scheme: dark;
}
.btn {
  border: 0; border-radius: 999px; padding: 9px 18px; font: inherit; font-weight: 600; cursor: pointer;
  background: var(--accent); color: #fff;
}
.btn:hover { filter: brightness(1.1); }
.btn.ghost { background: var(--card-2); color: var(--text); }

/* ---------- Grid + cards ---------- */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; }
.span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }
@media (max-width: 1250px) {
  .span-3, .span-4, .span-5 { grid-column: span 6; }
  .span-6 { grid-column: span 12; }
  .span-7, .span-8 { grid-column: span 12; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .rail { display: none; }
  .main { padding: 16px; }
  .grid > * { grid-column: span 12; }
}

.card { background: var(--card); border-radius: var(--radius); padding: 22px 24px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card h2 { margin: 0; font-size: 18px; font-weight: 600; }
.card-head .sub { color: var(--muted); font-size: 13px; }
.circle-link {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; color: var(--text-2);
}
.circle-link:hover { color: var(--text); background: var(--card-2); }

.hero { font-size: 38px; font-weight: 600; letter-spacing: -.5px; line-height: 1.1; }
.hero small { font-size: 18px; color: var(--muted); font-weight: 500; }
.chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; }
.chip.good { background: #16301a; color: #8fd47a; }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.info { background: var(--accent-soft); color: #9cc8ef; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.split .label { color: var(--text-2); font-size: 13px; }
.split .value { font-size: 22px; font-weight: 600; }

/* Segmented usage bar: used | 2px gap | earmarked | 2px gap | free track */
.usage { display: flex; gap: 2px; height: 10px; margin: 18px 0 8px; }
.usage span { border-radius: 4px; min-width: 0; }
.usage .used { background: var(--series-1); }
.usage .earmark { background: var(--series-2); }
.usage .free { background: var(--track); flex: 1; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--text-2); font-size: 13px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .s1 { background: var(--series-1); } .legend .s2 { background: var(--series-2); }
.legend .tr { background: var(--track); } .legend .ln2 { background: var(--series-2); height: 2px; width: 14px; border-radius: 2px; vertical-align: 3px; }
.legend .ln1 { background: var(--series-1); height: 2px; width: 14px; border-radius: 2px; vertical-align: 3px; }

/* Utilisation rows */
.bank-rows { display: flex; flex-direction: column; gap: 14px; }
.bank-row { display: grid; grid-template-columns: 62px 1fr 150px; align-items: center; gap: 12px; }
.bank-row .code { font-weight: 600; }
.bank-row .usage { margin: 0; height: 12px; }
.bank-row .figs { text-align: right; font-size: 13px; color: var(--text-2); }
.bank-row .figs b { color: var(--text); font-size: 14px; }

/* Coming-due tiles */
.due-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.due-tile { background: var(--card-2); border-radius: var(--radius-sm); padding: 12px 14px; }
.due-tile .label { color: var(--text-2); font-size: 12px; }
.due-tile .amt { font-size: 20px; font-weight: 600; }
.due-tile .cnt { color: var(--muted); font-size: 12px; }
.past-due { margin-top: 10px; display: flex; justify-content: space-between; align-items: center; color: var(--text-2); font-size: 13px; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px dashed var(--line); }

.list { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.list-item {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center;
  background: var(--card-2); border-radius: var(--radius-sm); padding: 10px 14px;
}
.list-item .badge { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); font-size: 11px; font-weight: 700; color: var(--text-2); }
.list-item .title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .meta { color: var(--muted); font-size: 12px; }
.list-item .right { text-align: right; }
.list-item .right .meta { text-transform: none; }

.alerts { display: flex; flex-direction: column; gap: 10px; }
.alert { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--card-2); font-size: 14px; }
.alert svg { width: 20px; height: 20px; margin-top: 1px; }
.alert.warn svg { color: var(--warn); }
.alert.ok svg { color: var(--good); }
.alert .meta { color: var(--muted); font-size: 12px; }

/* ---------- Charts ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--grid); stroke-width: 1; stroke-dasharray: 3 4; }
.chart .baseline { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .value { fill: var(--text); font-size: 12px; font-weight: 600; }
.chart .bar { fill: var(--series-1); }
.chart .bar-muted { fill: var(--muted); }
.chart .hit-area { fill: transparent; }
.chart .hit:hover .bar, .chart .hit:focus .bar { filter: brightness(1.2); }
.chart .hit { outline: none; cursor: default; }
.chart .line-1 { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line-2 { fill: none; stroke: var(--series-2); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 5 4; }
.chart .direct { font-size: 12px; font-weight: 600; fill: var(--text-2); }
.chart .cross { stroke: var(--text-2); stroke-width: 1; opacity: 0; }
.chart .dot { opacity: 0; stroke: var(--card); stroke-width: 2; }
.chart .dot-1 { fill: var(--series-1); } .chart .dot-2 { fill: var(--series-2); }
.chart .crosshair:hover .cross, .chart .crosshair:focus .cross,
.chart .crosshair:hover .dot, .chart .crosshair:focus .dot { opacity: 1; }
/* FX rate chart: deal strikes (green) and knock-outs (amber) as dashed levels */
.chart .level-strike, .chart .level-ko { stroke-width: 1.5; stroke-dasharray: 6 4; }
.chart .level-strike { stroke: var(--good); } .chart .level-ko { stroke: var(--warn); }
.chart .hit-line { stroke: transparent; stroke-width: 10; }
.chart .hit:hover .level-strike, .chart .hit:hover .level-ko { stroke-width: 2.5; }
.chart .level-strike-label { fill: var(--good); } .chart .level-ko-label { fill: var(--warn); }
.legend .lvs { background: var(--good); height: 2px; width: 14px; border-radius: 2px; vertical-align: 3px; }
.legend .lvk { background: var(--warn); height: 2px; width: 14px; border-radius: 2px; vertical-align: 3px; }
.fx-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(128px, 100%), 1fr)); gap: 10px; }
.fx-tiles .fx-tile { background: var(--card-2); border-radius: var(--radius-sm); padding: 16px 18px; color: var(--text); text-decoration: none; }
.fx-tiles a.fx-tile:hover { background: var(--line); }
.fx-tile .label { color: var(--text-2); font-size: 13px; }
.fx-tile .value { font-size: 26px; font-weight: 600; margin: 4px 0 2px; }
.fx-tile .value.warn { color: var(--warn); } .fx-tile .value.good { color: var(--good); }

.tooltip {
  position: fixed; z-index: 50; pointer-events: none; background: #0d1218; border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 12px; font-size: 13px; white-space: pre-line; color: var(--text);
  box-shadow: 0 8px 24px rgba(0,0,0,.4); max-width: 320px; opacity: 0; transition: opacity .08s;
}
.tooltip.show { opacity: 1; }
.tooltip::first-line { font-weight: 600; }

/* Table view under each chart */
details.table-view { margin-top: 12px; }
details.table-view summary { cursor: pointer; color: var(--text-2); font-size: 13px; }
details.table-view summary:hover { color: var(--text); }
.data-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
.data-table th, .data-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: right; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table th { color: var(--muted); font-weight: 500; }

.footnote { color: var(--muted); font-size: 12px; margin-top: 12px; }

/* ---------- Bank costs / charges ---------- */
.table-wrap { overflow-x: auto; }
.data-table .meta { color: var(--muted); font-size: 11px; }
.data-table th.left, .data-table td.left { text-align: left; }
.rank-table tr.best td { background: #10241a; }
.rank-table tr.best td:first-child { border-radius: 10px 0 0 10px; }
.rank-table tr.best td:last-child { border-radius: 0 10px 10px 0; }
.rank-table tr.dim td { color: var(--muted); }
.rank-table tr.dim b { color: var(--text-2); }
.rank-table td { vertical-align: top; }
.rank-table .chip { margin: 0 2px 4px 0; }

.calc { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px; }
.calc label { display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-size: 13px; }
.calc label.grow { flex: 1; min-width: 240px; }
.calc input, .calc select {
  background: var(--card-2); border: 1px solid var(--line); color: var(--text); border-radius: 12px;
  padding: 9px 12px; font: inherit; font-size: 14px; min-width: 140px;
}
.calc input:focus, .calc select:focus, .asof input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.heat { width: 100%; border-collapse: separate; border-spacing: 2px; font-size: 13px; }
.heat th { color: var(--muted); font-weight: 500; padding: 6px 8px; text-align: center; white-space: nowrap; }
.heat tbody th { text-align: left; color: var(--text); font-weight: 600; }
.heat td { text-align: center; padding: 9px 6px; border-radius: 6px; color: var(--text); white-space: nowrap; outline: none; }
.heat td[data-tip]:hover, .heat td[data-tip]:focus { box-shadow: inset 0 0 0 2px var(--text-2); }
.heat tr.total th, .heat tr.total td { font-weight: 700; }
.heat tr.total th { padding-top: 12px; }
.legend i.heat-scale { display: inline-block; width: 90px; height: 10px; border-radius: 4px; vertical-align: -1px;
  background: linear-gradient(90deg, rgba(59,143,212,.10), rgba(59,143,212,.72)); }
.charge-row { outline: none; }
.charge-row:focus { box-shadow: 0 0 0 2px var(--accent); border-radius: 8px; }

/* ---------- Stage 3: lists, forms, detail pages ---------- */
.subtabs { display: flex; gap: 4px; margin: -12px 0 20px; }
.subtabs a { padding: 7px 16px; border-radius: 999px; color: var(--muted); font-size: 14px; }
.subtabs a:hover { color: var(--text); }
.subtabs a.active { color: var(--text); background: var(--card-2); }

.head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.head-actions form { margin: 0; }
.btn.small { padding: 5px 12px; font-size: 12px; }
a.btn { display: inline-block; }
.link { color: #8fc0ec; }
.link:hover { text-decoration: underline; }
.tick { color: var(--good); font-weight: 700; }

.messages { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.notice { padding: 12px 16px; border-radius: var(--radius-sm); background: var(--card); border-left: 4px solid var(--accent); font-size: 14px; margin-bottom: 10px; }
.notice.success { border-left-color: var(--good); }
.notice.warning, .notice.warn { border-left-color: var(--warn); }
.notice.error { border-left-color: #e5534b; }
.notice form.inline, form.inline { display: inline; margin-left: 8px; }

.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 20px; padding: 16px 20px; }
.filters label, .inline-form { display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-size: 13px; }
.filters label.grow { flex: 1; min-width: 220px; }
.inline-form { flex-direction: row; align-items: center; }
.filters input, .filters select, .release-tools input, .release-tools select, .inline-form select, .form-grid input, .form-grid select, .form-grid textarea,
.edit-table input, .edit-table select, form.stack input, form.stack select, form.stack textarea {
  background: var(--card-2); border: 1px solid var(--line); color: var(--text); border-radius: 10px;
  padding: 8px 10px; font: inherit; font-size: 14px; color-scheme: dark; max-width: 100%;
}
.edit-table input, .edit-table select { padding: 6px 8px; font-size: 13px; width: 100%; min-width: 90px; }
.edit-table input[type=checkbox] { width: auto; min-width: 0; }
.edit-table td { vertical-align: top; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.form-card { max-width: 1100px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { color: var(--text-2); font-size: 13px; }
.field.wide { grid-column: 1 / -1; }
.field.check label { display: flex; gap: 8px; align-items: center; color: var(--text); padding-top: 26px; }
.field small { color: var(--muted); font-size: 12px; }
.field .err, .err { color: #f0857d; font-size: 12px; }
.field.has-error input, .field.has-error select { border-color: #e5534b; }
.req { color: var(--warn); }
.form-actions { display: flex; gap: 10px; margin-top: 22px; }
form.stack p { display: flex; flex-direction: column; gap: 6px; margin: 0 0 12px; color: var(--text-2); font-size: 13px; }
form.stack .helptext { color: var(--muted); font-size: 12px; }

.status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--card-2); color: var(--text-2); }
.status.s-active { background: var(--accent-soft); color: #9cc8ef; }
.status.s-applied { background: #2a2540; color: #c3b6f2; }
.status.s-earmarked { background: #16301a; color: #8fd47a; }
.status.s-settled { background: var(--card-2); color: var(--muted); }
.status.s-unknown, .status.s-expired { background: var(--warn-soft); color: var(--warn); }

.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 20px; margin: 0; }
.facts div.wide { grid-column: 1 / -1; }
.facts dt { color: var(--muted); font-size: 12px; }
.facts dd { margin: 2px 0 0; font-size: 15px; }
.facts small { color: var(--muted); font-size: 12px; }
.facility { padding: 14px 0; border-top: 1px solid var(--line); }
.facility:first-of-type { border-top: 0; padding-top: 0; }
.facility h3 { margin: 0 0 12px; font-size: 15px; }
ul.plain { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
ul.plain li { font-size: 14px; line-height: 1.5; }
ul.plain li.to-review { color: var(--text-2); }
.bank-card { display: block; transition: background .1s; }
.bank-card:hover { background: var(--card-2); }

.lines td { white-space: nowrap; }
.lines td.left { white-space: normal; max-width: 260px; }
.data-table tr.subtotal td { font-weight: 600; color: var(--text-2); border-bottom: 2px solid var(--line); }
.data-table tr.grandtotal td { font-weight: 700; font-size: 14px; }
.data-table tr.dim td { color: var(--muted); }

.matrix td, .matrix th { text-align: center; }
.matrix form { margin: 0; }
.cell-toggle { background: transparent; border: 1px solid transparent; color: var(--muted); width: 30px; height: 28px; border-radius: 8px; cursor: pointer; font: inherit; }
.cell-toggle.on { color: var(--good); font-weight: 700; background: #16301a; }
.cell-toggle:hover { border-color: var(--line); }

/* ---------- Stage 4: bank advices ---------- */
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 34px 20px; border: 2px dashed var(--line);
  border-radius: var(--radius); cursor: pointer; text-align: center; transition: border-color .1s, background .1s; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone .drop-icon { font-size: 28px; color: var(--accent); }
.review { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.pdf-pane { padding: 8px; position: sticky; top: 16px; }
.pdf-pane iframe { width: 100%; height: calc(100vh - 140px); min-height: 520px; border: 0; border-radius: 14px; background: #fff; }
.form-grid.compact { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 16px; }
.checks li.ok { color: var(--text-2); }
.checks li.ok::first-letter { color: var(--good); }
.checks li.bad { color: var(--warn); }
code { background: var(--card-2); padding: 1px 6px; border-radius: 6px; font-size: 13px; }
@media (max-width: 1100px) { .review { grid-template-columns: 1fr; } .pdf-pane { position: static; } }
.allocate { margin-bottom: 20px; border: 1px solid var(--accent-soft); }
.allocate .inline-form { flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.allocate .inline-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-2); }
.allocate .inline-form select, .allocate .inline-form input { background: var(--card-2); border: 1px solid var(--line);
  color: var(--text); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 14px; color-scheme: dark; }
.allocate .inline-form select[name=facility] { min-width: 260px; }
.allocate .inline-form input { width: 120px; }

/* Sign-in pages, and the banners everyone sees (test copy, file folder, backups) */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.signin-card { max-width: 440px; width: 100%; padding: 32px; display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.signin-card h1 { margin: 0; font-size: 22px; }
.signin-card p { margin: 0; }
.banner { padding: 10px 16px; border-radius: var(--radius-sm); margin-bottom: 12px; font-size: 14px; font-weight: 600; }
.banner.test { background: #4a3b00; color: #ffd84d; border: 1px solid #ffd84d; text-align: center; letter-spacing: .02em; }
.banner.error { background: #3a1414; color: #ffb3ad; border-left: 4px solid #e5534b; }
.banner.warn { background: var(--warn-soft); color: var(--warn); border-left: 4px solid var(--warn); }
.user form { margin-left: 10px; }
.audit-details { color: var(--text-2); font-size: 12px; max-width: 560px; white-space: normal; }
.facts-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.facts-list dt { color: var(--muted); }
.facts-list dd { margin: 0; }

/* "Fill from the PDF" */
.ai-fill { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 16px 0 4px; }
.ai-fill .ai-status { font-size: 13px; max-width: 760px; }
.field[hidden] { display: none !important; }
.data-table tr.receipt-head td { background: var(--card-2); font-size: 13px; }
.data-table tr.not-claimed td { color: var(--muted); }
.snap-card { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.snap-btn { justify-content: center; font-size: 18px; padding: 18px 22px; cursor: pointer; }
.waiting-claims { list-style: none; margin: 0; padding: 0; }
.waiting-claim { padding: 12px 0; border-bottom: 1px solid var(--line); }
.waiting-claim-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; color: var(--text); text-decoration: none; }
.waiting-claim-amt { margin-left: auto; font-weight: 600; }
.quick-decide { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.quick-decide input { flex: 1 1 220px; min-width: 0; background: var(--card-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 14px; color-scheme: dark; }
.snap-btn .filedrop { display: contents; }  /* the camera button needs no "drag the file here" box */
.snap-btn .filedrop-note { display: none; }
@media (max-width: 600px) { .quick-decide .btn { flex: 1 1 40%; padding: 12px; font-size: 15px; } }
.claim-flag { margin-top: 6px; font-size: 13px; }
.proof-row { margin-top: 6px; font-size: 13px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.proof-block { margin-top: 16px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 10px; }
.proof-block h3 { margin: 0 0 4px; font-size: 14px; }
.receipt-kind { display: inline; }
.receipt-kind select { font-size: 12px; padding: 2px 6px; width: auto; }
.claim-flag.cleared { color: var(--muted); }
.flag-clear { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.flag-clear input { flex: 1; min-width: 180px; }
.ai-filled, .field.unsure input, .field.unsure select { outline: 2px solid var(--warn); outline-offset: 1px; background: var(--warn-soft) !important; }
.card p.big { font-size: 26px; font-weight: 700; margin: 0; }

/* ---------- Phones and small tablets ----------
   The side bar goes; the menu becomes one row of pills you swipe sideways (Admins' extra pages included).
   Cards, forms and filters go to one column, and wide tables scroll inside their card. */
.pill.phone-only, .phone-only { display: none; }
@media (max-width: 820px) {
  .topbar { gap: 10px; margin-bottom: 16px; }
  .brand { margin-right: 0; }
  .pills { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
           -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; padding-bottom: 2px; }
  .pills::-webkit-scrollbar { display: none; }
  .pill { padding: 9px 16px; white-space: nowrap; flex: none; scroll-snap-align: start; }
  .pill.phone-only, .phone-only { display: inline-block; }
  .user { padding: 4px 10px 4px 4px; gap: 8px; }
  .user .avatar { width: 32px; height: 32px; }
  .user form { margin-left: 4px; }
  .page-head { align-items: flex-start; margin-bottom: 16px; }
  .page-head h1 { font-size: 24px; }
  .page-head .btn { padding: 8px 14px; }
  .grid { gap: 14px; }
  .card { padding: 16px; overflow-x: auto; }
  .card-head { flex-wrap: wrap; }
  .hero { font-size: 30px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-actions { flex-wrap: wrap; }
  .filters, .calc { padding: 14px; gap: 10px; }
  .filters label, .filters label.grow, .calc label, .calc label.grow { flex: 1 1 100%; min-width: 0; }
  .filters input, .filters select, .calc input, .calc select { width: 100%; min-width: 0; box-sizing: border-box; }
  /* 16px stops iPhones zooming in when a field is tapped */
  input, select, textarea { font-size: 16px !important; }
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 6px 6px; }
  .banner { font-size: 13px; }
  .pdf-pane iframe { height: 70vh; min-height: 380px; }
  .ai-fill .btn { width: 100%; }
}
@media (max-width: 480px) {
  .main { padding: 12px; }
  .user > span:not(.avatar) small { display: none; }
  .page-head h1 { font-size: 22px; }
  .hero { font-size: 26px; }
  .signin-card { padding: 22px; }
}

/* Cost of funds: pick a period */
.cof-period { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin: 4px 0 10px; }
.cof-period label { display: flex; flex-direction: column; gap: 4px; color: var(--text-2); font-size: 12px; flex: 1; min-width: 120px; }
.cof-period input { background: var(--card-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; font: inherit; }
.cof-picks { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.cof-picks .pill { font-size: 12px; padding: 4px 10px; }

/* Any upload box: drop a file on it */
.filedrop { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; border: 2px dashed var(--line); border-radius: 12px;
  padding: 18px 16px; min-height: 84px; transition: border-color .15s, background .15s; min-width: 0; }  /* a roomy target (Daryl, 19 Nov 2026) */
.filedrop input[type="file"] { flex: 1 1 220px; min-width: 0; border: 0; background: transparent; }
.filedrop-note { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.filedrop.over { border-color: var(--accent); background: var(--accent-soft); }
.upload-btn { flex: none; align-self: flex-start; min-width: 170px; white-space: nowrap; }  /* upload buttons side by side: one size */

/* Sections: the home page tiles, the section switcher on the side bar, and the section's name in the menu */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.tile { display: flex; flex-direction: column; gap: 8px; padding: 26px 24px; color: var(--text); text-decoration: none;
  transition: background .15s, transform .15s; }
.tile:hover, .tile:focus-visible { background: var(--card-2); outline: none; transform: translateY(-2px); }
.tile b { font-size: 19px; }
.tile .muted { font-size: 13px; }
.tile-icon { display: inline-flex; width: 46px; height: 46px; border-radius: 14px; align-items: center; justify-content: center;
  background: var(--accent-soft); color: #fff; }
.tile-icon svg { width: 24px; height: 24px; }
.rail-sections { margin-bottom: 14px; }
.section-name { align-self: center; font-weight: 600; color: var(--muted); font-size: 13px; text-transform: uppercase;
  letter-spacing: .6px; margin-right: 4px; }
.section-pill { background: var(--card-2); }

/* Facility form: groups follow the paper form */
.form-group-title { font-size: 14px; margin: 22px 0 10px; color: var(--text-2); }
.form-group-title:first-of-type { margin-top: 4px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* People: Ask OPS, the handbook and announcements */
.rail a { position: relative; }
.rail .dot { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: #e5534b; }
/* Home (home_rail_counts): the red "waiting for you" count on an app's icon in the left bar; the tiles stay for phones */
.rail .rail-count { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box;
  border-radius: 9px; background: #e5534b; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
@media (min-width: 821px) { .hub-tiles.phone-tiles { display: none; } }
.pill .count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: #e5534b;
  color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
a.banner { display: block; text-decoration: none; }
.banner.info { background: var(--accent-soft); color: #cfe5f8; border-left: 4px solid var(--accent); }
.ask-box textarea { width: 100%; min-height: 96px; resize: vertical; box-sizing: border-box; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 18px; background: var(--card-2); color: var(--text); font: inherit; font-size: 15px;
  line-height: 1.5; transition: border-color .15s, box-shadow .15s; }
.ask-box textarea::placeholder { color: var(--muted); }
.ask-box textarea:focus, .ask-box textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ask-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; justify-content: space-between; margin-top: 10px; }
.answer { border-left: 4px solid var(--accent); }
.answer.not-covered { border-left-color: var(--warn); }
.answer .q { color: var(--text-2); font-size: 14px; margin: 0 0 10px; }
.answer .a { font-size: 16px; line-height: 1.55; margin: 0 0 14px; white-space: pre-line; }
.quote { margin: 0 0 10px; padding: 10px 14px; background: var(--card-2); border-radius: var(--radius-sm); font-size: 14px; line-height: 1.5; }
.quote cite { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; font-style: normal; }
.fineprint { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 12px 0 0; }
.history li { padding: 10px 0; border-bottom: 1px solid var(--line); list-style: none; }
.history { padding: 0; margin: 0; }
.announcement-body { white-space: pre-line; line-height: 1.6; font-size: 15px; }
.unread-title { font-weight: 700; }

/* OPS Hub (home) and the Apps menu in the top bar */
.hub { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 18px; align-items: start; }
.hub-main, .hub-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
@media (max-width: 1000px) { .hub { grid-template-columns: 1fr; } }
.hub-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.hub-tile { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 18px; background: var(--card);
  border-radius: var(--radius); color: var(--text); text-decoration: none; transition: background .15s, transform .15s; }
.hub-tile:hover, .hub-tile:focus-visible { background: var(--card-2); outline: none; transform: translateY(-2px); }
.hub-tile b { font-size: 16px; margin-top: 4px; }
.hub-tile small { font-size: 12px; line-height: 1.4; }
.hub-badge { position: absolute; top: 14px; right: 14px; min-width: 24px; height: 24px; padding: 0 7px; box-sizing: border-box;
  border-radius: 7px; background: #e5534b; color: #fff; font-size: 13px; font-weight: 700; line-height: 24px; text-align: center; }
.waiting-row { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; cursor: pointer; list-style: none; }
.waiting-row::-webkit-details-marker { display: none; }
.waiting-row b { min-width: 130px; font-weight: 600; }
.waiting-text { flex: 1; min-width: 0; color: var(--text-2); }
.waiting-row:hover .waiting-text, .waiting-row:focus-visible .waiting-text { color: var(--text); }
.waiting-icon { display: inline-flex; color: var(--muted); }
.waiting-icon svg { width: 18px; height: 18px; }
.waiting-items { margin: 8px 0 0 28px; padding: 0; list-style: none; }
.waiting-items li { padding: 5px 0; }
@media (max-width: 600px) { .waiting-row { flex-wrap: wrap; } .waiting-row b { min-width: 0; } .waiting-text { flex-basis: 100%; } }
.hub-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1000px) { .hub-pair { grid-template-columns: 1fr; } }
@media (max-width: 600px) {
  .hub-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .hub-tile { padding: 12px 14px; }
  .hub-tile .tile-icon { width: 36px; height: 36px; border-radius: 11px; }
  .hub-tile small { display: none; }
}
.app-list { display: flex; flex-direction: column; gap: 8px; }
.app-link { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.app-link:hover, .app-link:focus-visible { background: var(--card-2); outline: none; }
.app-link small { display: block; font-size: 12px; }
.apps-menu { position: relative; }
.apps-menu summary { list-style: none; cursor: pointer; }
.apps-menu summary::-webkit-details-marker { display: none; }
/* Fixed to the screen (placed under the button by portal.js): on phones the menu bar scrolls sideways and would clip it. */
.apps-list[hidden] { display: none; }
.apps-list { position: fixed; z-index: 50; min-width: 200px; max-width: calc(100vw - 24px); padding: 6px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }
.apps-list a { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: 14px; }
.apps-list a:hover, .apps-list a:focus-visible, .apps-list a.active { background: var(--accent-soft); outline: none; }
.apps-list svg { width: 18px; height: 18px; flex: none; }
.nowrap { white-space: nowrap; }
.access-table label.meta { display: flex; gap: 5px; align-items: center; margin-top: 5px; }
@media (max-width: 820px) {
  .account-menu .who, .account-menu .caret { display: none; }
  .account-menu.user { padding: 4px; }
}

/* Treasury: the Financing / FX & Hedging switch in the top bar */
.area-switch { display: inline-flex; align-self: center; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 999px; margin-right: 6px; flex: none; }
.area-switch a { padding: 5px 12px; border-radius: 999px; color: var(--muted); font-size: 13px; text-decoration: none; white-space: nowrap; }
.area-switch a:hover, .area-switch a:focus-visible { color: var(--text); outline: none; }
.area-switch a.active { background: var(--card-2); color: var(--text); }

/* Person page: role ticks (core/person.html) */
.role-ticks { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin: 6px 0 14px; }
.role-tick { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.role-tick:has(input:checked) { border-color: var(--accent, currentColor); }
/* Releases page: one card per feature, spaced apart (they were touching and looked stacked on top of each other) */
/* Releases page (Daryl, 19 Nov 2026): grouped by app, one line per change, details on click */
.release-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.release-tools p { margin: 0; flex: 1 1 100%; }
.release-tools .release-search { flex: 1 1 240px; min-width: 0; }
.release-group { margin-bottom: 16px; padding: 6px 18px 10px; }
.release-group-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; margin: 0; }
.release-group-head h2, .release-done summary h2 { margin: 0; font-size: 17px; }
.release-row { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 4px 10px; align-items: start;
  padding: 9px 0; border-top: 1px solid var(--line); }
.release-row > input[type=checkbox] { margin-top: 3px; }
.release-row summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; list-style-position: outside; }
.release-row .release-label { overflow-wrap: anywhere; }
.release-body { padding: 8px 0 4px; display: grid; gap: 8px; }
.release-body p { margin: 0; }
.release-testers { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tester-chip { display: inline-flex; align-items: center; gap: 4px; margin: 0; padding: 3px 4px 3px 10px; border-radius: 999px;
  background: var(--accent-soft); font-size: 13px; }
.tester-chip button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 6px; font-size: 12px; }
.tester-chip button:hover { color: var(--text); }
.release-done summary { cursor: pointer; padding: 8px 0; }
.release-row.done { grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; }
.release-row.done form { margin: 0; }
.release-row[hidden], .release-group[hidden] { display: none; }
@media (max-width: 700px) {
  .release-group { padding: 4px 12px 8px; }
  .release-body .inline-form { flex-wrap: wrap; }
  .release-body .inline-form select { flex: 1 1 100%; min-width: 0; max-width: 100%; }
  .release-row.done { grid-template-columns: minmax(0, 1fr) auto; }
  .release-row.done .chip { grid-column: 1; justify-self: start; }
}
/* "Not yet released" tag on pages only Admins and testers can see (core/releases.py unreleased_here) */
.unreleased-tag { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 12px; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn);
  text-decoration: none; }
a.unreleased-tag:hover { text-decoration: underline; }
/* Person page: label in the first column, the choice in the second (Daryl: tidier than a loose grid) */
.settings-table td { vertical-align: middle; }
.settings-table td:first-child { width: 34%; }
.settings-table select { width: 100%; max-width: 360px; }
.entity-ticks { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px 14px; }
.entity-ticks label { white-space: nowrap; font-size: 13px; }
.role-tick label { cursor: pointer; }
.role-tick .until { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.role-tick .until input, .settings-table input[type=date] { font-size: 12px; padding: 3px 6px; }
.role-tick:not(:has(input[type=checkbox]:checked)) .until { display: none; }  /* an end date only for roles they hold */

/* FX fixings: one card per contract, with a progress bar of fixings done */
details.contract > summary { list-style: none; cursor: pointer; }
details.contract > summary::-webkit-details-marker { display: none; }
details.contract > summary h2::before { content: "▸ "; color: var(--muted); }
details.contract[open] > summary h2::before { content: "▾ "; }
.progress { height: 6px; border-radius: 999px; background: var(--card-2); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent-soft); }
.data-table tr.highlight td { background: var(--card-2); font-weight: 600; }

.settings-table .group-row td { font-weight: 700; color: var(--text); padding-top: 16px; border-bottom: 1px solid var(--line); }  /* app heading above its access rows */

/* OPStimize name, style C (Daryl, 18 Nov 2026): monospace, bold OPS in blue, a green cursor that blinks on sign-in only */
.wordmark { font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace; font-weight: 400; letter-spacing: -0.3px; color: var(--text); }
.wordmark b { color: var(--accent); font-weight: 700; }
.brand .wordmark b { color: var(--accent); }
.wordmark .cursor { color: var(--ops-green); font-weight: 700; }
.signin-brand { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 6px; }
.signin-brand .brand { font-size: 26px; margin: 0; }
.signin-brand .cursor { animation: cursor-blink 1s step-end infinite; }
@keyframes cursor-blink { 50% { opacity: 0; } }
.atom { width: 200px; height: auto; }
.atom .orbit { fill: none; stroke: var(--accent); stroke-width: 1.2; }
.atom .orbit.far { opacity: .22; }    /* behind the ball */
.atom .orbit.near { opacity: .75; stroke-width: 1.5; }  /* in front of it */
.atom .electron { fill: #6fb3ff; }
.atom .atom-shadow { fill: #000; opacity: .35; }
@media (prefers-reduced-motion: reduce) { .signin-brand .cursor { animation: none; } .atom animateMotion { display: none; } }

/* Loading (Daryl, 18 Nov 2026): while a page or save is on its way, small electrons circle the OPS ball and a thin
   blue line runs across the top (OPS.busy in portal.js). The orbits stay close to the ball, clear of the line. */
.mark, .brand-mark { position: relative; }
.mini-atom { position: absolute; left: -10px; top: -10px; width: 64px; height: 64px; pointer-events: none; opacity: 0; transition: opacity .2s; }
.rail .mark .mini-atom { width: 64px; height: 64px; }  /* not the rail's icon size */
.mini-atom .orbit { fill: none; stroke: var(--accent); stroke-width: 1.4; opacity: .55; }
.mini-atom .electron { fill: #6fb3ff; }
html.is-busy .mini-atom { opacity: 1; }
.brand-mark { display: none; width: 30px; height: 30px; }
.brand-mark img { width: 30px; height: 30px; display: block; }
.brand-mark .mini-atom { left: -7px; top: -7px; width: 44px; height: 44px; }
#loadbar { position: fixed; left: 0; top: 0; height: 3px; width: 0; background: var(--accent); z-index: 1000; opacity: 0;
  transition: width 10s cubic-bezier(.1, .8, .2, 1), opacity .3s; }
html.is-busy #loadbar { width: 90%; opacity: 1; }
@media (max-width: 820px) { .brand-mark { display: inline-block; margin: 0 4px 0 7px; } }
@media (prefers-reduced-motion: reduce) { .mini-atom animateMotion { display: none; } #loadbar { transition: opacity .3s; } }

/* Friendly empty pages (includes/empty.html) and "Saved – Undo" notes (core/undo.py) – Daryl, 18 Nov 2026 */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 34px 16px; color: var(--text-2); }
.empty-state .empty-icon { width: 54px; height: 54px; border-radius: 50%; background: var(--card-2); display: grid; place-items: center; color: var(--accent); }
.empty-state .empty-icon svg { width: 26px; height: 26px; }
.empty-state p { margin: 0; max-width: 420px; }
.notice.undo { display: flex; align-items: center; justify-content: space-between; gap: 12px; transition: opacity .5s; }
.undo-form { margin: 0; }
.notice.fading { opacity: 0; }

/* Search everything (core/search.py) – Daryl, 18 Nov 2026 */
.search-open { margin-left: auto; width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--card); color: var(--text-2); display: grid; place-items: center; cursor: pointer; }
.search-open:hover, .search-open:focus-visible { color: var(--text); background: var(--card-2); outline: none; }
.search-open svg { width: 20px; height: 20px; }
.search-box { width: min(620px, 94vw); margin-top: 10vh; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); color: var(--text); }
.search-box::backdrop { background: rgba(0, 0, 0, .55); }
.search-input { width: 100%; box-sizing: border-box; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); padding: 16px 18px; font-size: 17px; outline: none; }
.search-results { max-height: 55vh; overflow-y: auto; padding: 6px; }
.search-results .group { font-size: 12px; color: var(--muted); padding: 10px 12px 4px; text-transform: uppercase; letter-spacing: .5px; }
.search-results a { display: block; padding: 9px 12px; border-radius: 10px; color: var(--text); }
.search-results a small { display: block; color: var(--text-2); font-size: 13px; }
.search-results a.on, .search-results a:hover { background: var(--accent-soft); }
.search-results .none { padding: 14px 12px; color: var(--text-2); }
.search-hint { margin: 0; padding: 8px 14px 12px; font-size: 12px; color: var(--muted); }

/* Stay in place (portal.js): the green "Done ✓" button, its quieter row, and messages that pop up at the bottom. */
.btn.is-done, .btn.is-done:disabled { background: var(--good); border-color: var(--good); color: #0b1a07; opacity: 1; cursor: default; }
.row-done { opacity: .75; }
.messages.floating { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; margin: 0;
  width: min(520px, calc(100vw - 32px)); }
.messages.floating .notice { margin: 0; box-shadow: 0 6px 24px rgba(0, 0, 0, .35); }

/* Mistakes by the field (portal.js): a field outside the usual .field box, and the line at the top. */
input.is-wrong, select.is-wrong, textarea.is-wrong, .has-error textarea { border-color: #e5534b; }
.mistakes-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Search bar (Daryl, 19 Nov 2026; behind "search_bar"): the magnifier was easy to miss, so it becomes a rounded bar with
   a cheeky grey line (a different one each page) and the Ctrl K shortcut. Still a button – it opens the search box. */
.search-open.as-bar { width: 320px; max-width: 34vw; height: 42px; border-radius: 999px; display: flex; align-items: center;
  gap: 10px; padding: 0 8px 0 14px; border: 1px solid var(--line); text-align: left; }
.search-open.as-bar svg { flex: none; width: 18px; height: 18px; }
.search-open.as-bar .search-words { flex: 1; min-width: 0; color: var(--muted); font-size: 14px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.search-open.as-bar:hover .search-words { color: var(--text-2); }
.search-key { flex: none; font: 600 11px/1 var(--mono, ui-monospace, monospace); color: var(--muted); border: 1px solid var(--line);
  border-radius: 6px; padding: 4px 6px; }
@media (max-width: 820px) {
  .search-open.as-bar { order: 2; flex: 1 1 100%; width: 100%; max-width: none; min-width: 0; }  /* its own row under the logo */
  .search-key { display: none; }  /* phones have no Ctrl key */
}

/* Treasury – FX & Hedging: fixings gain / loss, and the summary of a person's view */
.gl-up { color: var(--good); font-weight: 600; } .gl-down { color: #f0857d; font-weight: 600; } .gl-none { color: var(--muted); }
.view-summary { background: rgba(102, 189, 74, .12); border: 1px solid rgba(102, 189, 74, .45); border-radius: var(--radius-sm); padding: 12px 16px; margin: 10px 0; }
.view-summary h4 { margin: 0 0 6px; font-size: 13px; color: var(--good); text-transform: uppercase; letter-spacing: .06em; }
.view-summary p { margin: 6px 0; } .view-summary p.fits, .view-summary p.against { font-weight: 600; color: var(--text); }
/* Treasury – bank logos in the round badges (white behind the logo in light and dark mode) */
.list-item .badge.bank-logo { background: #fff; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); overflow: hidden; }
.list-item .badge.bank-logo img { width: 72%; height: 72%; object-fit: contain; display: block; }
/* Treasury – fixings: one table per contract, all with the same columns so they line up */
.fixing-table { table-layout: fixed; min-width: 900px; }
.fixing-table td { overflow-wrap: anywhere; }
/* Treasury – Add / change a drawdown in sections; "More details" folded until needed */
.form-section { border-top: 1px solid var(--line); padding: 14px 0 6px; }
.form-section:first-of-type { border-top: 0; padding-top: 0; }
.form-section > summary { cursor: pointer; list-style: none; margin-bottom: 12px; }
.form-section > summary::-webkit-details-marker { display: none; }
.form-section > summary h2 { display: inline; font-size: 15px; margin: 0; }
.form-section > summary::after { content: " ▾"; color: var(--muted); }
.form-section:not([open]) > summary::after { content: " ▸"; }
/* Treasury / Purchasing – a PO's payment date: Tuesday is the urgent one, in red (Daryl) */
.pay-urgent, option.urgent, select.urgent-picked { color: #f0857d; font-weight: 600; }
/* Treasury – Loose ends: one row per break, its fix on the right */
.loose-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 0; border-bottom: 1px solid var(--line); }
.loose-row:last-child { border-bottom: 0; }

/* Budget customer page on phones (Daryl, 19 Nov 2026): one card per line instead of a wide table – product on top,
   the inputs stacked, baseline / budget / margin underneath. Same form fields, so saving works as before. */
@media (max-width: 700px) {
  .budget-cards thead { display: none; }
  .budget-cards, .budget-cards tbody { display: block; }
  .budget-cards tr { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px 12px; padding: 14px 0;
    border-bottom: 1px solid var(--line); }
  .budget-cards td { display: block; padding: 0; border: 0; text-align: left; grid-column: span 6; min-width: 0; }
  .budget-cards td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: 12px;
    margin-bottom: 3px; }
  .budget-cards td.card-half { grid-column: span 3; }
  .budget-cards td.card-base, .budget-cards td.card-plan, .budget-cards td.card-margin { grid-column: span 2; order: 10; }
  .budget-cards input, .budget-cards select { min-width: 0; font-size: 16px; }  /* 16px: phones don't zoom in */
  .budget-cards [data-industry], .budget-cards [data-application] { display: block; }
  .budget-cards [data-application] { margin-top: 6px; }
}

/* AI answers in the green box (Daryl, 19 Nov 2026; behind "ai_box"): every reply or summary the AI writes – Ask OPS,
   Ask Materials, Ask the rates, an FX document's "In short" – sits in the same green box as the FX view summary, with
   a small label saying it's from the AI and what it's based on. Before release the box is plain and the label hidden.
   "Found online" answers keep their amber box on purpose: they are not from OPS records. */
.ai-box > .ai-label { display: none; }
[data-aibox] .ai-box { background: rgba(102, 189, 74, .12); border: 1px solid rgba(102, 189, 74, .45);
  border-radius: var(--radius-sm); padding: 12px 16px; margin: 10px 0 14px; }
[data-aibox] .ai-box > .ai-label { display: block; margin: 0 0 6px; font-size: 13px; color: var(--good);
  text-transform: uppercase; letter-spacing: .06em; }
[data-aibox] .ai-box > :last-child { margin-bottom: 0; }

/* Phone look (Daryl, 20 Nov 2026; behind "phone_look"): on phones the portal works like a phone app – a tab bar
   along the bottom (Home · Apps · Search · Me; Apps and Me open the top bar's menus as sheets from the bottom),
   bigger buttons and fields, and a form's Save / Cancel pinned above the tab bar while you scroll. Computers and
   everyone without the switch see no change. */
.tabbar { display: none; }
@media (max-width: 820px) {
  [data-phone] body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  [data-phone] .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 55; background: var(--surface);
    border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .tabbar > a, .tabbar > button { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 7px 0 5px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 11px; cursor: pointer;
    text-decoration: none; -webkit-tap-highlight-color: transparent; }
  .tabbar svg { width: 24px; height: 24px; }
  .tabbar .active { color: var(--ops-green); }
  .tabbar .tab-dot { position: absolute; top: 5px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
  /* Home, Apps and the account button move to the tab bar; the top bar keeps the logo, search and the app's own menu */
  [data-phone] .pill-home, [data-phone] .apps-menu, [data-phone] .account-menu { display: none; }
  [data-phone] .messages.floating { bottom: calc(80px + env(safe-area-inset-bottom)); }
  /* Sheets from the bottom */
  [data-phone] .apps-list.as-sheet { left: 0; right: 0; top: auto; bottom: calc(62px + env(safe-area-inset-bottom)); max-width: none;
    max-height: 70vh; overflow-y: auto; padding: 14px; border-radius: var(--radius) var(--radius) 0 0; border-width: 1px 0 0;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, .55); }
  [data-phone] .apps-list.as-sheet a, [data-phone] .apps-list.as-sheet .menu-form button { padding: 13px 12px; font-size: 15px; }
  [data-phone] .apps-list.as-sheet svg { width: 22px; height: 22px; }
  [data-phone] .apps-list.as-sheet:not(.account-list):not([hidden]) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  [data-phone] .apps-list.as-sheet:not(.account-list) a { flex-direction: column; justify-content: center; gap: 8px; min-height: 92px;
    text-align: center; background: var(--card-2); border-radius: var(--radius-sm); }
  [data-phone] .apps-list.as-sheet:not(.account-list) svg { width: 28px; height: 28px; color: var(--ops-green); }
  /* Bigger, easier to tap */
  [data-phone] .page-head h1 { font-size: 26px; }
  [data-phone] .card { border-radius: 18px; }
  [data-phone] .btn:not(.small) { min-height: 44px; padding: 11px 20px; }
  [data-phone] input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=file]), [data-phone] select {
    min-height: 44px; border-radius: 12px; }
  /* a dropdown with a long option no longer pushes the form wider than the screen */
  [data-phone] .form-grid { grid-template-columns: minmax(0, 1fr); }
  [data-phone] .field { min-width: 0; }
  [data-phone] .field select, [data-phone] .field input:not([type=checkbox]):not([type=radio]) { max-width: 100%; min-width: 0; }
  /* Save / Cancel stay in reach on long forms */
  [data-phone] form .form-actions { position: sticky; bottom: calc(62px + env(safe-area-inset-bottom)); z-index: 20; flex-wrap: nowrap;
    margin: 18px -16px 0; padding: 10px 16px; background: var(--surface); border-top: 1px solid var(--line); }
  [data-phone] form .form-actions > .btn, [data-phone] form .form-actions > a.btn { flex: 1; text-align: center; }
  /* a card that scrolls sideways would hold the bar in place; forms without a wide table don't need that scroll */
  [data-phone] .card:has(form .form-actions):not(:has(table)) { overflow: visible; }
}
@media (max-width: 480px) {
  [data-phone] form .form-actions { margin-left: -12px; margin-right: -12px; padding: 10px 12px; }
}
