/* Solar Savings Ledger. Every colour is a token; dark mode redefines the tokens only. */
/* Inter (OFL, bundled in static/fonts): clean, has tabular figures and the naira sign. */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/static/fonts/inter-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/static/fonts/inter-latin-ext-400-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap;
  src: url(/static/fonts/inter-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap;
  src: url(/static/fonts/inter-latin-ext-500-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap;
  src: url(/static/fonts/inter-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap;
  src: url(/static/fonts/inter-latin-ext-600-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
:root {
  color-scheme: light;
  --page: #f6f4ef;
  --surface: #fcfcfb;
  --surface-2: #f1efe9;
  --ink: #1b1a17;
  --ink-2: #52514e;
  --muted: #6b6a66;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.12);
  --input-border: #8a897f;
  --accent: #9a5800;
  --accent-ink: #ffffff;
  --accent-soft: #f6e7cf;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --track: #e4e2db;
  --good: #006300;
  --bad: #b3261e;
  --warn: #8a6100;
  --focus: #2a78d6;
  --tip-bg: #1b1a17;
  --tip-ink: #f0efec;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0f0f0e; --surface: #1a1a19; --surface-2: #232321;
    --ink: #f0efec; --ink-2: #c3c2b7; --muted: #a3a29a;
    --grid: #2c2c2a; --baseline: #383835; --border: rgba(255, 255, 255, 0.10); --input-border: #6e6d66;
    --accent: #f0b44a; --accent-ink: #1a1a19; --accent-soft: #3a2c12;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --track: #2e3238;
    --good: #4cc44c; --bad: #ff8a80; --warn: #e0a32e; --focus: #6da7ec;
    --tip-bg: #f0efec; --tip-ink: #1b1a17; --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0f0f0e; --surface: #1a1a19; --surface-2: #232321;
  --ink: #f0efec; --ink-2: #c3c2b7; --muted: #a3a29a;
  --grid: #2c2c2a; --baseline: #383835; --border: rgba(255, 255, 255, 0.10); --input-border: #6e6d66;
  --accent: #f0b44a; --accent-ink: #1a1a19; --accent-soft: #3a2c12;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --track: #2e3238;
  --good: #4cc44c; --bad: #ff8a80; --warn: #e0a32e; --focus: #6da7ec;
  --tip-bg: #f0efec; --tip-ink: #1b1a17; --shadow: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--page); }
body {
  overflow-wrap: anywhere;
  margin: 0; background: var(--page); color: var(--ink);
  font: 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "cv11" 1;
}
h1, h2 { margin: 0; font-weight: 600; }
h1 { font-size: 18px; }
h2 { font-size: 16px; }
p { margin: 0; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.topbar {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 16px;
  padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { flex: none; border-radius: 7px; }
.sub, .card-sub, .tile-note, .payback-note, .hero-break, .note { color: var(--ink-2); font-size: 13px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.tabs { display: flex; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.tabs a { padding: 5px 14px; border-radius: 7px; color: var(--ink-2); text-decoration: none; font-size: 14px; font-weight: 500; border: 1px solid transparent; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { background: var(--surface); color: var(--ink); border-color: var(--border); box-shadow: var(--shadow); }
.sync-msg { flex-basis: 100%; margin: -4px 0 0; font-size: 13px; color: var(--ink-2); text-align: right; }
.sync-msg[hidden] { display: none; }
.btn:disabled { opacity: .55; cursor: default; filter: none; }
.online-note { font-size: 13px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--input-border);
  background: var(--surface); color: var(--ink); font-size: 17px; cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }

.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 13px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--border);
  white-space: nowrap;
}
.badge.ok { color: var(--good); }
.badge.partial, .badge.running { color: var(--warn); }
.badge.failed, .badge.interrupted { color: var(--bad); }
.badge.flag { color: var(--bad); }

main { max-width: 1120px; margin: 0 auto; padding: 20px 24px 48px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px; box-shadow: var(--shadow); min-width: 0;
}
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 12px; }
.label { color: var(--ink-2); font-size: 13px; font-weight: 500; }
.banner {
  padding: 12px 16px; border-radius: 10px; background: var(--accent-soft); color: var(--ink);
  border: 1px solid var(--border);
}
.banner.error { border-color: var(--bad); }

.hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; align-items: center; }
.hero-value { font-size: 52px; font-weight: 600; line-height: 1.1; margin: 4px 0 6px; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.payback-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.payback-pct { font-size: 22px; font-weight: 600; }
.meter { height: 12px; border-radius: 999px; background: var(--track); overflow: hidden; }
.meter-fill { display: block; height: 100%; width: 0; background: var(--series-1); border-radius: 999px; transition: width .4s; }
.payback-note { margin-top: 8px; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); }
.tile-value { font-size: 26px; font-weight: 600; margin: 2px 0; letter-spacing: -0.3px; font-variant-numeric: tabular-nums; }

.live { display: flex; flex-wrap: wrap; gap: 8px 28px; align-items: center; padding: 14px 20px; }
.live strong { font-weight: 600; }
.live .muted { color: var(--muted); font-size: 13px; }

.filters { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; }
.filters label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }

select, input {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--input-border); border-radius: 8px; padding: 7px 10px; min-height: 38px;
}
input::placeholder { color: var(--muted); }
input:disabled, select:disabled { background: var(--surface-2); color: var(--muted); }
input[aria-invalid="true"] { border-color: var(--bad); }

.chart { position: relative; width: 100%; min-height: 240px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .baseline { stroke: var(--baseline); stroke-width: 1; shape-rendering: crispEdges; }
.chart text { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart .bar { cursor: default; }
.chart .bar:hover path, .chart .bar:focus path { opacity: .8; }
.chart .bar:focus { outline: none; }
.chart .bar:focus-visible path { stroke: var(--focus); stroke-width: 2; }
.chart .s1 { fill: var(--series-1); }
.chart .s2 { fill: var(--series-2); }
.chart .s3 { fill: var(--series-3); }
.chart .s4 { fill: var(--series-4); }
.legend .key.s3 { background: var(--series-3); }
.legend .key.s4 { background: var(--series-4); }
.chart .partial { opacity: .45; }
.chart .hit { fill: transparent; }
.chart-empty { display: grid; place-items: center; min-height: 200px; color: var(--muted); border: 1px dashed var(--border); border-radius: 10px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 4px 0 8px; font-size: 13px; color: var(--ink-2); }
.legend .key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .key.s1 { background: var(--series-1); }
.legend .key.s2 { background: var(--series-2); }

.tooltip {
  position: fixed; z-index: 20; pointer-events: none; padding: 8px 10px; border-radius: 8px;
  background: var(--tip-bg); color: var(--tip-ink); font-size: 13px; max-width: 260px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
}
.tooltip .tv { font-weight: 600; font-size: 14px; }
.tooltip .tl { opacity: .8; }

.table-wrap { overflow: auto; margin-top: 12px; border: 1px solid var(--border); border-radius: 10px; }
.table-wrap.tall { max-height: 420px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 8px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--grid); }
th:first-child, td:first-child { text-align: left; }
thead th { position: sticky; top: 0; background: var(--surface-2); color: var(--ink-2); font-weight: 600; }
tbody tr:nth-child(even) td { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }
td { font-variant-numeric: tabular-nums; }
td.flag { color: var(--bad); font-weight: 600; }
td.muted { color: var(--muted); }

details { margin-top: 12px; }
summary { cursor: pointer; color: var(--accent); font-size: 14px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.field { display: grid; gap: 4px; align-content: start; }
.field label { font-size: 14px; font-weight: 500; }
.field .help { font-size: 12px; color: var(--muted); }
.field .err { font-size: 12px; color: var(--bad); min-height: 0; }
.field.wide { grid-column: 1 / -1; }
.radio { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; padding: 6px 0; }
.radio input { min-height: auto; margin-top: 3px; accent-color: var(--accent); }
.form-actions { display: flex; align-items: center; gap: 14px; margin-top: 16px; flex-wrap: wrap; }
.form-msg { font-size: 14px; color: var(--ink-2); }
.form-msg.ok { color: var(--good); }
.form-msg.bad { color: var(--bad); }

.btn {
  display: inline-flex; align-items: center; min-height: 38px; padding: 8px 14px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); filter: none; }
.exports { display: flex; flex-wrap: wrap; gap: 10px; }

h3 { font-size: 15px; font-weight: 600; margin: 18px 0 4px; }
.card-head + h3 { margin-top: 4px; }
.subform { margin: 14px 0 6px; padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.subform input, .subform select { background: var(--surface); }
.row-actions { display: inline-flex; gap: 6px; }
.btn.small { min-height: 30px; padding: 4px 10px; font-size: 13px; font-weight: 500; }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.danger:hover { background: transparent; filter: brightness(1.15); }
.est { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 500;
       background: var(--accent-soft); color: var(--ink); border: 1px solid var(--border); vertical-align: 2px; }
.method ol { margin: 10px 0 12px; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; }

@media (max-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .topbar, main { padding-left: 16px; padding-right: 16px; }
  .hero-value { font-size: 40px; }
  .tiles { grid-template-columns: minmax(0, 1fr); }
  .sub { display: none; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .badge { white-space: normal; }
}
@media print {
  .topbar { position: static; }
  .filters, .exports, #settings-form, #theme-toggle { display: none; }
}
