/* Ridoc Connect portal. Same layout as the Gas Masters portal; colours follow the Ridoc Ventures logo (gold on charcoal). */
:root {
  --bg: #f1f1f2;
  --paper: #ffffff;
  --ink: #221f1f;
  --muted: #625b5b;
  --line: #dcd9d9;
  --accent: #85600f;        /* buttons, links: deep gold, white text passes AA */
  --accent-bright: #e2b54a; /* chart bars, highlights */
  --accent-ink: #ffffff;
  --accent-soft: #f8efd8;
  --amber: #9a5b0c;
  --amber-soft: #f8ebd6;
  --ok: #2b7347;
  --ok-soft: #e0f1e6;
  --bad: #b03a2e;
  --bad-soft: #f8e1de;
  --info: #3c4a57;
  --info-soft: #e6eaee;
  --nav: #24211c;
  --nav-ink: #d9d4d4;
  --font-display: "Archivo", "Arial Narrow", Arial, sans-serif;
  --font-body: "Source Sans 3", "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", Consolas, "Courier New", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161414; --paper: #211e1e; --ink: #ece8e8; --muted: #a59e9e; --line: #3a3535;
    --accent: #eecb6d; --accent-bright: #eecb6d; --accent-ink: #1d1708; --accent-soft: #3a3019;
    --amber: #e2a65a; --amber-soft: #382a17; --ok: #6cc391; --ok-soft: #173325; --bad: #ef8a7e; --bad-soft: #3d1f1b;
    --info: #b9c6d2; --info-soft: #262d33; --nav: #0f0d0d; --nav-ink: #c9c2c2; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161414; --paper: #211e1e; --ink: #ece8e8; --muted: #a59e9e; --line: #3a3535;
  --accent: #eecb6d; --accent-bright: #eecb6d; --accent-ink: #1d1708; --accent-soft: #3a3019;
  --amber: #e2a65a; --amber-soft: #382a17; --ok: #6cc391; --ok-soft: #173325; --bad: #ef8a7e; --bad-soft: #3d1f1b;
  --info: #b9c6d2; --info-soft: #262d33; --nav: #0f0d0d; --nav-ink: #c9c2c2; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; line-height: 1.2; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1rem; }
.num, .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.mono { font-size: 0.82rem; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.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; }

/* Shell */
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.pnav { background: var(--nav); color: var(--nav-ink); padding: 16px 10px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.pnav .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; color: #fff; text-decoration: none; font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; }
.pnav .brand img { width: 40px; height: 40px; border-radius: 8px; background: #fff; padding: 2px; }
.pnav .brand small { display: block; font-family: var(--font-body); font-weight: 400; font-size: 0.75rem; color: var(--nav-ink); }
.pnav a:not(.brand) { color: inherit; text-decoration: none; padding: 9px 12px; border-radius: 8px; border-left: 3px solid transparent; }
.pnav a:not(.brand):hover { background: rgba(255, 255, 255, .07); }
.pnav a.active { background: rgba(255, 255, 255, .12); color: #fff; font-weight: 600; border-left-color: var(--accent-bright); }
.pnav .who { margin-top: auto; padding: 12px; border-top: 1px solid rgba(255, 255, 255, .12); display: grid; gap: 2px; font-size: 0.85rem; }
.pnav .who b { color: #fff; }
.linkbtn { background: none; border: 0; padding: 4px 0 0; color: var(--nav-ink); text-decoration: underline; font-size: 0.85rem; }
.pmain { padding: 24px; display: grid; gap: 18px; align-content: start; min-width: 0; max-width: 1400px; }
.phead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; }
.phead span { color: var(--muted); font-size: 0.88rem; }

/* Blocks */
.box { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: grid; gap: 12px; align-content: start; min-width: 0; }
.box.editing { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.box-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: grid; gap: 2px; }
.kpi small { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.kpi b { font-family: var(--font-mono); font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 0.8rem; color: var(--muted); }
.hint { font-size: 0.85rem; color: var(--muted); margin: 0; }
.empty { color: var(--muted); font-size: 0.9rem; margin: 0; }
.empty.pad { padding: 14px; }
.code { font-family: var(--font-mono); font-weight: 600; background: var(--bg); border: 1px solid var(--line); border-radius: 5px; padding: 0 6px; font-size: 0.82rem; }
.alert { border-radius: 8px; padding: 9px 12px; margin: 0; font-size: 0.9rem; }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.bad { background: var(--bad-soft); color: var(--bad); }

/* Tables */
.tbl { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; min-width: 640px; }
table.narrow { min-width: 0; max-width: 520px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 0.7rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); font-family: var(--font-display); background: var(--bg); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.tot td { font-weight: 700; background: var(--bg); border-top: 1px solid var(--line); border-bottom: 0; }
tr.row-editing td { background: var(--accent-soft); }

/* Forms */
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; align-items: end; }
.pfield { display: grid; gap: 4px; border: 0; padding: 0; margin: 0; min-width: 0; }
.pfield label, .pfield legend { font-size: 0.78rem; color: var(--muted); font-weight: 600; padding: 0; }
.pfield input, .pfield select, .pfield textarea { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--paper); width: 100%; min-width: 0; }
.pfield input:disabled, .pfield select:disabled { opacity: 0.6; cursor: not-allowed; }
.pfield .validation-message { color: var(--bad); font-size: 0.82rem; }
input.upper { text-transform: uppercase; font-family: var(--font-mono); }
.filterbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.filterbar .pfield { width: auto; }
.filterbar .grow { flex: 1; min-width: 200px; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { border-radius: 8px; padding: 8px 16px; border: 1px solid var(--line); background: var(--paper); font-weight: 600; font-size: 0.9rem; }
.btn:hover { border-color: var(--muted); }
.btn.pri { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.pri:hover { filter: brightness(1.08); }
.btn.sm { padding: 4px 12px; font-size: 0.82rem; }
.btn.wide { width: 100%; padding: 11px; }
.chks { display: flex; flex-wrap: wrap; gap: 8px; }
.chk { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 0.9rem; width: fit-content; }
.chk:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.chk .num { color: var(--muted); font-size: 0.78rem; }

/* Pills */
.pill { display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: 0.74rem; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.wait { background: var(--amber-soft); color: var(--amber); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }

/* 7-day column chart: one series, columns <= 24px, 4px rounded tops, only today labelled */
.cols { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; height: 180px; align-items: end; border-bottom: 1px solid var(--line); margin-bottom: 26px; }
.col { position: relative; height: 100%; display: flex; outline-offset: 4px; border-radius: 4px; }
.col .cb { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; width: 100%; height: 100%; }
.col .cb i { display: block; width: 100%; max-width: 24px; min-height: 2px; background: var(--accent-bright); opacity: 0.55; border-radius: 4px 4px 0 0; }
.col:last-child .cb i, .col:hover .cb i, .col:focus .cb i { opacity: 1; }
.col .cv { font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink); margin-bottom: 3px; white-space: nowrap; }
.col .cl { position: absolute; bottom: -22px; left: 0; right: 0; text-align: center; font-size: 0.74rem; color: var(--muted); }
.col .tip { display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); border-radius: 6px; padding: 6px 9px; font-size: 0.78rem; white-space: nowrap; z-index: 2; pointer-events: none; }
.col .tip b { display: block; }
.col:hover .tip, .col:focus .tip { display: block; }
.col:first-child .tip { left: 0; transform: none; }
.col:last-child .tip { left: auto; right: 0; transform: none; }

/* Lists */
.clist { display: grid; }
.clist > div { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.clist > div:last-child { border-bottom: 0; }
.clist .rk { color: var(--muted); }
.clist .nm { display: grid; min-width: 0; }
.clist .nm b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clist small { color: var(--muted); font-size: 0.78rem; }
.feed { display: grid; }
.feed div { display: grid; grid-template-columns: 50px minmax(0, 1fr); gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 0.88rem; }
.feed div:last-child { border-bottom: 0; }
.feed .t { font-family: var(--font-mono); color: var(--muted); }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--nav); }
.login-card { background: var(--paper); border-radius: 14px; padding: 28px 24px; width: 100%; max-width: 380px; display: grid; gap: 14px; justify-items: center; }
.login-logo { width: 120px; height: 120px; }
.login-form { display: grid; gap: 12px; width: 100%; }

/* Errors (Blazor) */
#blazor-error-ui { color-scheme: light only; background: #fff3cd; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, .2); display: none; left: 0; padding: .6rem 1.25rem .7rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

/* Phone width */
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .pnav { position: static; height: auto; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; padding: 8px; gap: 4px; }
  .pnav .brand span { display: none; }
  .pnav .brand { padding: 0 6px 0 0; }
  .pnav a:not(.brand) { white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; }
  .pnav a.active { border-bottom-color: var(--accent-bright); }
  .pnav .who { margin: 0 0 0 auto; border: 0; padding: 0 6px; white-space: nowrap; }
  .pnav .who span { display: none; }
  .pmain { padding: 16px; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
}

/* Blazor focuses the page title after navigation for screen readers; no visible ring needed there. */
h1:focus { outline: none; }
.tbl:has(> table.narrow) { width: fit-content; max-width: 100%; }

/* Operations pages */
h3 { font-size: 0.9rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.muted { color: var(--muted); }
.neg { color: var(--bad); }
.badge { background: var(--accent-bright); color: #fff; border-radius: 999px; font-size: 0.72rem; padding: 1px 8px; font-family: var(--font-mono); margin-left: 6px; }
.pnav a:not(.brand) { display: flex; align-items: center; justify-content: space-between; }
.btn.okb { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn.badb { color: var(--bad); border-color: var(--bad); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btns.end { justify-content: flex-end; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 6px 14px; font-size: 0.88rem; }
.seg button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.req { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; align-items: center; }
.req > div:first-child { min-width: 0; }
.req .sub { color: var(--muted); font-size: 0.85rem; }
.decide { flex-basis: 100%; display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.pfield textarea { resize: vertical; }
.level { display: inline-block; width: 110px; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; vertical-align: middle; margin-right: 6px; }
.level i { display: block; height: 100%; background: var(--info); border-radius: 0 4px 4px 0; }
.level i.low { background: var(--amber); }
.sum-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.sum-grid > div { background: var(--bg); border-radius: 8px; padding: 9px 12px; display: grid; gap: 2px; font-size: 0.86rem; }
.sum-grid small { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.sum-grid b { font-family: var(--font-mono); }
.denlist { font-family: var(--font-mono); font-size: 0.8rem; }
.rep-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.rep-card { text-align: left; border: 1px solid var(--line); background: var(--paper); border-radius: 10px; padding: 10px 12px; display: grid; gap: 2px; }
.rep-card span { font-size: 0.8rem; color: var(--muted); }
.rep-card[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.rep-card[aria-pressed="true"] b { color: var(--accent); }
.exports { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.rep-title { font-size: 0.95rem; color: var(--muted); }
.rep-title b { color: var(--ink); }
.tplcols { display: flex; flex-wrap: wrap; gap: 6px; }
.tplcols code { font-family: var(--font-mono); font-size: 0.8rem; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; }
.drop { position: relative; border: 2px dashed var(--line); border-radius: 10px; padding: 22px; display: grid; justify-items: center; gap: 2px; text-align: center; cursor: pointer; }
.drop:hover, .drop:focus-within { border-color: var(--accent); background: var(--accent-soft); }
.drop span { font-size: 0.85rem; color: var(--muted); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.print-only { display: none; }

/* Print / Save as PDF: just the report, no menu or filters */
@media print {
  :root { color-scheme: light; --bg: #fff; --paper: #fff; --ink: #000; --muted: #444; --line: #bbb; }
  body { font-size: 11px; }
  .pnav, .no-print, #blazor-error-ui, .btn { display: none !important; }
  .shell { display: block; }
  .pmain { padding: 0; max-width: none; }
  .box, .tbl { border: 0; padding: 0; overflow: visible; }
  table { min-width: 0; font-size: 10px; }
  th, td { padding: 4px 6px; }
  tr { break-inside: avoid; }
  .print-only { display: flex; }
  .print-head { align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 16px; margin-bottom: 6px; }
  .print-head img { width: 48px; height: 48px; }
}
.alerts { display: flex; flex-wrap: wrap; gap: 8px; }
.alerts a { background: var(--amber-soft); color: var(--ink); border-radius: 8px; padding: 8px 12px; font-size: 0.9rem; text-decoration: none; border: 1px solid transparent; }
.alerts a:hover { border-color: var(--amber); }
.alerts a::after { content: " →"; color: var(--amber); }
.sum-grid > div.scale-alert { background: var(--bad-soft); }

/* ---------- Customer portal: lighter, product-style shell ---------- */
.cshell { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }
.ctop { background: var(--nav); color: #fff; }
.ctop-in { max-width: 1100px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.ctop .brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-family: var(--font-display); font-weight: 800; font-size: 1.1rem; margin-right: auto; }
.ctop .brand img { width: 34px; height: 34px; }
.ctop nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.ctop nav a { color: var(--nav-ink); text-decoration: none; padding: 7px 12px; border-radius: 8px; font-weight: 600; font-size: 0.92rem; }
.ctop nav a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.ctop nav a.active { color: #fff; background: rgba(255, 255, 255, .12); }
.ctop nav a.cta { background: var(--accent-bright); color: #1d1708; }
.ctop nav a.cta:hover { filter: brightness(1.06); }
.ctop form { margin: 0; }
.ctop .linkbtn { color: var(--nav-ink); padding: 7px 4px; }
.cmain { max-width: 1100px; width: 100%; margin: 0 auto; padding: 28px 16px 40px; display: grid; gap: 20px; align-content: start; }
.cfoot { text-align: center; color: var(--muted); font-size: 0.82rem; padding: 18px 16px 26px; }
.hero { display: grid; gap: 10px; text-align: center; justify-items: center; padding: 18px 0 6px; }
.hero h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); }
.hero p { max-width: 640px; color: var(--muted); margin: 0; font-size: 1.05rem; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.plan { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 22px 20px; display: grid; gap: 12px; align-content: start; }
.plan.featured { border: 2px solid var(--accent-bright); box-shadow: 0 6px 24px rgba(133, 96, 15, .12); }
.plan h2 { font-size: 1.25rem; }
.plan .price { font-family: var(--font-display); font-size: 2rem; font-weight: 800; }
.plan .price small { font-family: var(--font-body); font-size: 0.9rem; font-weight: 400; color: var(--muted); }
.plan ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 0.92rem; }
.plan .tag { justify-self: start; }
.toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--paper); }
.toggle button { border: 0; background: none; border-radius: 999px; padding: 6px 16px; font-weight: 600; font-size: 0.9rem; }
.toggle button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.lic { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; display: grid; gap: 14px; }
.lic-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.lic-head h2 { font-size: 1.15rem; }
.keybox { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; background: var(--bg); border: 1px dashed var(--accent-bright); border-radius: 10px; padding: 12px 14px; }
.keybox code { font-family: var(--font-mono); font-size: clamp(0.95rem, 2.6vw, 1.2rem); font-weight: 600; letter-spacing: 0.04em; word-break: break-all; }
.meter { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent-bright); }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.auth-card { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 26px 22px; width: 100%; max-width: 440px; margin: 0 auto; display: grid; gap: 14px; }
.auth-card h1 { text-align: center; }
.auth-card .hint { text-align: center; }
.checkout { max-width: 520px; margin: 0 auto; width: 100%; }
.sum-line { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.sum-line:last-child { border-bottom: 0; font-weight: 700; }
