/* Theme: light (default) is a pale take on kantertechnologies.com; dark
   (toggle) mirrors it closely: deep green + lime. Dark applies only when
   chosen, never from the OS setting. */
:root {
  --bg: #f3f8f1;
  --bg-glow: rgba(184, 255, 0, .20);
  --surface: #ffffff;
  --surface-2: #e8f1e4;
  --text: #002a1c;
  --muted: #557063;
  --border: #d6e5d3;
  --grid: rgba(0, 42, 28, .07);
  --accent: #b8ff00;
  --accent-ink: #0a1f14;
  --accent-text: #3f8a00;
  --cheap: #1fbf8f;
  --mid: #f5b83d;
  --high: #f25f6b;
  --neg: #4f7cff;
  --gridfee: #a3aed6;
  --up: #e5484d;
  --down: #3b7cf6;
  --alt: #7c5cff;
  --alt2: #0fa39a;
  --shadow: 0 1px 2px rgba(0, 42, 28, .05), 0 10px 30px rgba(0, 42, 28, .06);
  --header: rgba(243, 248, 241, .85);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #002a1c;
  --bg-glow: rgba(40, 140, 40, .35);
  --surface: #01321f;
  --surface-2: #033f29;
  --text: #e9f5ee;
  --muted: #9fbfae;
  --border: rgba(184, 255, 0, .14);
  --grid: rgba(233, 245, 238, .07);
  --accent: #b8ff00;
  --accent-ink: #0a1400;
  --accent-text: #b8ff00;
  --cheap: #b8ff00;
  --mid: #ffd24a;
  --high: #ff6b7a;
  --neg: #5ec8ff;
  --gridfee: #6d8aa6;
  --up: #ff6b7a;
  --down: #5ec8ff;
  --alt: #b49bff;
  --alt2: #3ee6c8;
  --shadow: none;
  --header: rgba(0, 42, 28, .82);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--text);
  background: radial-gradient(1100px 520px at 85% -8%, var(--bg-glow), transparent 65%) no-repeat, var(--bg);
  font: 15px/1.5 Manrope, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
::selection { background: #b8ff00; color: #000; }
h1, h2, .stat .value, .now-big .value, .brand, #dial .big { font-family: "Space Grotesk", Manrope, system-ui, sans-serif; }
a { color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* header */
.top { position: sticky; top: 0; z-index: 10; background: var(--header);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.top-inner { max-width: 1180px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-size: 18px; white-space: nowrap; }
.brand svg { width: 26px; height: 26px; }
.brand b { color: var(--accent-text); }
.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tabs button {
  border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600;
  padding: 7px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.tabs button:hover { color: var(--text); background: var(--surface-2); }
.tabs button[aria-current="page"] { color: var(--accent-ink); background: var(--accent); box-shadow: 0 0 18px rgba(184, 255, 0, .35); }
.tools { display: flex; gap: 8px; align-items: center; }
select, .seg button, .icon-btn {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px; cursor: pointer;
}
.icon-btn { display: grid; place-items: center; padding: 6px; }
.icon-btn svg { width: 18px; height: 18px; }

/* layout */
main { max-width: 1180px; margin: 0 auto; padding: 20px 16px 8px; }
.intro h1 { margin: 0 0 4px; font-size: 28px; letter-spacing: -.03em; }
.intro p { margin: 0 0 18px; color: var(--muted); max-width: 760px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); }

.hero { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 16px; }
.dial-card { padding: 12px; display: grid; place-items: center; }
#dial { width: 100%; max-width: 320px; height: auto; display: block; }
#dial .tick { stroke: var(--muted); stroke-width: 1; opacity: .6; }
#dial .hour { fill: var(--muted); font-size: 10px; text-anchor: middle; dominant-baseline: middle; }
#dial .hand { stroke: var(--text); stroke-width: 2.5; stroke-linecap: round; }
#dial .hub { fill: var(--accent-text); }
#dial .big { fill: var(--text); font-size: 30px; font-weight: 700; text-anchor: middle; }
#dial .small { fill: var(--muted); font-size: 10.5px; text-anchor: middle; }
#dial .ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 22; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; align-content: start; }
.stat { padding: 14px 16px; min-width: 0; overflow-wrap: anywhere; }
.hero > *, #charts > * { min-width: 0; }
.intro h1 { overflow-wrap: anywhere; }
.stat .label { color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 28px; font-weight: 700; margin: 2px 0; letter-spacing: -.01em; }
.stat .value small { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.stat .sub { color: var(--muted); font-size: 13px; }
.stat .row { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; margin-top: 4px; }
.stat .row span:first-child { color: var(--muted); }
.stat.highlight { border-color: var(--accent-text); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin: 18px 0 12px; }
.toolbar .group { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.seg { display: inline-flex; }
.seg button { border-radius: 0; margin-left: -1px; padding: 6px 12px; }
.seg button:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.seg button:last-child { border-radius: 0 8px 8px 0; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; position: relative; }

.chart-card { padding: 14px 16px 10px; margin-bottom: 14px; }
.chart-card h2 { font-size: 16px; margin: 0 0 8px; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.chart-card h2 span { color: var(--muted); font-weight: 500; font-size: 13px; }
.chart-box { position: relative; height: 320px; }
.empty { color: var(--muted); padding: 36px 0; text-align: center; }
.chart-card.compact .chart-box { height: 230px; }
a.open { color: var(--text); font-weight: 600; text-decoration: none; white-space: nowrap; }
a.open:hover { text-decoration: underline; }

/* overview tiles */
.section-title { font-size: 18px; margin: 22px 0 10px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; margin-bottom: 14px; }
.tile { padding: 14px 16px 10px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tile-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tile-head h2 { font-size: 18px; margin: 0; min-width: 0; }
.tile-head h2 span { color: var(--muted); font-size: 12.5px; font-weight: 500; margin-left: 4px; }
.tile-head a.open { font-size: 14px; color: var(--muted); }
.metrics { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 16px; }
.metric .label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.metric .value { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.metric .value small { font-size: 12.5px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.metric .sub { color: var(--muted); font-size: 12.5px; }
.tile .chart-box { height: 140px; margin-top: auto; }

footer { max-width: 1180px; margin: 0 auto; padding: 12px 16px 32px; color: var(--muted); font-size: 13px; display: grid; gap: 4px; }
footer .domains a { text-decoration: none; color: var(--text); }

@media (max-width: 760px) {
  .top-inner { flex-wrap: wrap; gap: 8px 12px; }
  .tabs { order: 3; flex-basis: 100%; }
  .tools { margin-left: auto; }
  .hero { grid-template-columns: 1fr; }
  .dial-card #dial { max-width: 280px; }
  .cards { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .stat .value { font-size: 22px; }
  .chart-box { height: 260px; }
  .intro h1 { font-size: 20px; }
}
@media (max-width: 400px) { .cards { grid-template-columns: 1fr; } }

/* simple overview (nordpool.ee landing) */
body.simple .intro, body.simple .hero, body.simple .toolbar { display: none; }
.simple-card { padding: 18px 20px 14px; }
.now-big .label { color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.now-big .value { font-size: 44px; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; margin: 2px 0; }
.now-big .value .dot { width: 14px; height: 14px; vertical-align: 6px; margin-right: 10px; }
.now-big .value small { font-size: 15px; font-weight: 500; color: var(--muted); margin-left: 8px; letter-spacing: 0; }
.now-big .sub { color: var(--muted); font-size: 14px; }
.simple-card .chart-box { height: 380px; margin-top: 14px; }
.simple-card a.more { display: inline-block; margin-top: 8px; font-size: 14px; color: var(--muted); }
@media (max-width: 760px) {
  .now-big .value { font-size: 34px; }
  .simple-card .chart-box { height: 300px; }
}

/* region / language pickers */
.pick {
  display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 10px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; color: var(--muted);
}
.pick:hover { border-color: var(--accent-text); }
.pick:focus-within { outline: 2px solid var(--accent-text); outline-offset: 1px; }
.pick svg { width: 17px; height: 17px; flex: none; }
.pick-text { display: grid; line-height: 1.1; min-width: 0; }
.pick-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.pick select { border: 0; background: transparent; padding: 1px 18px 1px 0; margin-left: -2px; font-weight: 600; outline: none; max-width: 100%; }
.pick select option { background: var(--surface); color: var(--text); }

/* Kanter banner (styled after kantertechnologies.com) */
.kanter {
  --k-bg: #002a1c; --k-lime: #b8ff00; --k-ink: #e9f5ee; --k-muted: #a9c3b5;
  position: relative; overflow: hidden; margin: 28px 0 8px; padding: 34px 36px; border-radius: 18px;
  display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; align-items: center;
  color: var(--k-ink); font-family: Manrope, system-ui, sans-serif;
  background: radial-gradient(120% 140% at 85% 20%, #0f4a22 0%, #003a24 35%, var(--k-bg) 70%);
  border: 1px solid rgba(184, 255, 0, .18);
}
.kanter-eyebrow { display: flex; align-items: center; gap: 10px; color: var(--k-lime); font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.kanter-eyebrow .line { width: 26px; height: 1px; background: var(--k-lime); }
.kanter h2 { font-family: "Space Grotesk", system-ui, sans-serif; font-size: clamp(28px, 4.4vw, 46px); line-height: 1.02; letter-spacing: -.035em; margin: 12px 0 12px; font-weight: 700; }
.kanter h2 em { font-style: normal; color: var(--k-lime); display: block; }
.kanter p { margin: 0 0 18px; max-width: 560px; color: var(--k-muted); font-size: 16px; line-height: 1.55; }
.kanter-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.kanter-stats div { background: rgba(0, 0, 0, .25); border: 1px solid rgba(184, 255, 0, .14); border-radius: 10px; padding: 7px 12px; display: grid; }
.kanter-stats b { color: var(--k-lime); font-family: "Space Grotesk", system-ui, sans-serif; font-size: 17px; }
.kanter-stats span { color: var(--k-muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.kanter-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; }
.kanter-cta {
  background: var(--k-lime); color: #0a1400; text-decoration: none; font-weight: 700; font-size: 13px; letter-spacing: .08em; text-transform: uppercase;
  padding: 13px 22px; border-radius: 8px; box-shadow: 0 0 28px rgba(184, 255, 0, .28);
}
.kanter-cta:hover { box-shadow: 0 0 36px rgba(184, 255, 0, .45); }
.kanter-mail { color: var(--k-ink); font-weight: 600; font-size: 14px; text-decoration: none; border-bottom: 1px solid rgba(184, 255, 0, .4); }
.kanter-mail:hover { color: var(--k-lime); }
.kanter-art { position: relative; width: 280px; height: 280px; }
.kanter-art svg { width: 100%; height: 100%; }
.kanter-art .o1 { fill: none; stroke: rgba(184, 255, 0, .22); }
.kanter-art .o2 { fill: none; stroke: rgba(184, 255, 0, .18); stroke-dasharray: 3 5; }
.kanter-art .p { fill: var(--k-lime); filter: drop-shadow(0 0 6px var(--k-lime)); }
.kanter-core {
  position: absolute; inset: 0; margin: auto; width: 132px; height: 132px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 40% 35%, #0b4d3b, #022a20 70%); border: 1px solid rgba(184, 255, 0, .55);
  box-shadow: 0 0 44px rgba(184, 255, 0, .25), inset 0 0 22px rgba(0, 0, 0, .5);
}
.kanter-core img { width: 92px; height: auto; display: block; }

@media (max-width: 760px) {
  .top { position: static; }
  .tools { order: 2; flex-basis: 100%; }
  .pick { flex: 1; min-width: 0; }
  .pick select { width: 100%; }
  .kanter { grid-template-columns: 1fr; padding: 26px 20px; }
  .kanter-art { display: none; }
}

/* grid fees: overview header, toggle chip, info popover */
.now-top { display: flex; justify-content: space-between; align-items: center; gap: 8px 12px; }
.now-top .label { min-width: 0; }
.simple-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.now-big .split { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.now-big .split b, .stat .sub b { color: var(--text); }
.chip {
  display: inline-flex; align-items: center; gap: 8px; font: inherit; font-weight: 600; font-size: 14px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px 6px 8px; cursor: pointer;
}
.chip:hover { border-color: var(--accent-text); }
.chip .sw { width: 30px; height: 18px; border-radius: 999px; background: var(--surface-2); position: relative; transition: background .15s; }
.chip .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.chip[aria-pressed="true"] .sw { background: var(--accent); }
.chip[aria-pressed="true"] .sw::after { transform: translateX(12px); background: var(--accent-ink); }

details.gridinfo { position: relative; display: inline-block; }
details.gridinfo summary {
  list-style: none; cursor: pointer; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  font: italic 700 13px/1 "Space Grotesk", system-ui, sans-serif;
}
details.gridinfo summary::-webkit-details-marker { display: none; }
details.gridinfo summary:hover, details.gridinfo[open] summary { border-color: var(--accent-text); color: var(--accent-text); }
.gridinfo .pop {
  position: absolute; z-index: 20; right: 0; top: calc(100% + 8px); width: min(340px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px;
  box-shadow: 0 12px 40px rgba(0, 42, 28, .18); font-size: 13.5px; text-align: left; font-weight: 400;
}
.toolbar .gridinfo .pop { left: 0; right: auto; }
.gridinfo .pop-head { display: grid; margin-bottom: 8px; }
.gridinfo .pop-head span { color: var(--muted); font-size: 12.5px; }
.gridinfo table { width: 100%; border-collapse: collapse; }
.gridinfo td { padding: 5px 0; border-top: 1px solid var(--border); vertical-align: top; }
.gridinfo td:last-child { text-align: right; font-weight: 600; padding-left: 12px; white-space: nowrap; }
.gridinfo tr.total td { font-weight: 700; border-top: 2px solid var(--text); }
.gridinfo p { margin: 8px 0 0; color: var(--muted); font-size: 12.5px; }
.gridinfo a { color: var(--accent-text); }
@media (max-width: 760px) {
  .gridinfo .pop, .toolbar .gridinfo .pop {
    position: fixed; left: 12px; right: 12px; bottom: 12px; top: auto; width: auto; max-height: 75vh; overflow: auto; z-index: 50;
    box-shadow: 0 -8px 40px rgba(0, 42, 28, .25);
  }
  .chip { font-size: 13px; padding: 5px 10px 5px 6px; gap: 6px; }
  .chip .sw { width: 26px; height: 16px; }
  .chip .sw::after { width: 12px; height: 12px; }
  .chip[aria-pressed="true"] .sw::after { transform: translateX(10px); }
}
