/* Caloran Tools – shared styles.
   Brand: Montserrat, slate #334553, coral #F26A63 (Caloran brochure 2026).
   Layout: Joakim's tool style – flat paper cards, 3px corners, KPI tiles, slider grid. */
@font-face {
  font-family: "Montserrat";
  src: url("../fonts/montserrat-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --slate: #334553;
  --slate-dark: #26343f;
  --coral: #f26a63;
  --coral-ink: #c9463f;
  --gold: #ffc000;
  --blue: #92d0ff;
  --green: #96c85b;
  --bg: #eef1f2;
  --paper: #ffffff;
  --ink: #1f2d36;
  --muted: #5c6b74;
  --line: #d7dee2;
  --soft: #f4f6f7;
  --font: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121a1f; --paper: #1b252b; --ink: #e7edf0; --muted: #9aaab3; --line: #2c3a42; --soft: #222e35;
    --coral-ink: #ff8a83; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121a1f; --paper: #1b252b; --ink: #e7edf0; --muted: #9aaab3; --line: #2c3a42; --soft: #222e35;
  --coral-ink: #ff8a83; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 16px/1.5 var(--font); color: var(--ink); background: var(--bg);
  display: flex; flex-direction: column; min-height: 100vh;
}
main { flex: 1; width: 100%; max-width: 900px; margin: 0 auto; padding: 20px 16px 8px; }
main.wide { max-width: 1080px; }
a { color: var(--coral-ink); }
img { max-width: 100%; display: block; }
h1 { font-size: clamp(21px, 4vw, 28px); font-weight: 700; margin: 8px 0 6px; line-height: 1.25; }
h2 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
  font-weight: 700; margin: 22px 0 8px;
}
h3 { font-size: 16px; font-weight: 700; margin: 0 0 4px; }
p { margin: 0 0 12px; }
.lede { color: var(--muted); max-width: 64ch; margin: 0 0 16px; }
.muted { color: var(--muted); }
.foot { color: var(--muted); font-size: 13px; margin: 18px 0 8px; max-width: 75ch; }
[hidden] { display: none !important; }

/* ---------- Header (slate bar, white logo – as caloran.es) ---------- */
.site-header { background: var(--slate); color: #fff; position: sticky; top: 0; z-index: 10; min-height: 60px; }
.site-header .in {
  max-width: 1080px; margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center; gap: 16px; min-height: 60px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; }
.brand img { height: 20px; width: auto; }
.brand .tag {
  font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  border-left: 1px solid rgba(255,255,255,.35); padding-left: 12px; opacity: .85;
}
.nav { margin-left: auto; display: flex; align-items: center; gap: 20px; }
.nav a {
  color: #fff; text-decoration: none; text-transform: uppercase; white-space: nowrap;
  font-size: 12px; font-weight: 600; letter-spacing: .1em; opacity: .9;
}
.nav a:hover, .nav a[aria-current="page"] { opacity: 1; color: var(--coral); }
.nav a.login {
  border: 1px solid var(--coral); background: var(--coral); color: #fff; padding: 6px 12px; border-radius: 3px;
}
.nav a.login:hover { background: #e2554e; color: #fff; }
.lang { display: flex; border: 1px solid rgba(255,255,255,.4); border-radius: 3px; overflow: hidden; }
.lang button {
  background: none; border: 0; color: #fff; font: inherit; font-size: 11px; font-weight: 700;
  padding: 4px 9px; cursor: pointer; letter-spacing: .08em; border-radius: 0;
}
.lang button[aria-pressed="true"] { background: #fff; color: var(--slate); }
.menu-btn {
  display: none; margin-left: auto; background: none; border: 0; color: #fff;
  font-size: 26px; line-height: 1; cursor: pointer; padding: 4px;
}
@media (max-width: 760px) {
  .brand .tag { display: none; }
  .menu-btn { display: block; }
  .nav {
    display: none; position: absolute; left: 0; right: 0; top: 60px;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--slate-dark); padding: 6px 16px 16px;
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.08); }
  .nav a.login { text-align: center; margin-top: 12px; border-bottom: 0; }
  .nav .lang { margin-top: 12px; align-self: flex-start; }
}

/* ---------- Cards, tiles, bars ---------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 3px; padding: 14px 16px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.tool {
  display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit;
  border-top: 3px solid var(--coral);
}
.tool:hover { border-color: var(--coral); border-top-color: var(--coral); }
.tool:hover h3 { color: var(--coral-ink); }
.tool .go { margin-top: auto; font-weight: 700; font-size: 14px; color: var(--coral-ink); }
.tool.soon { border-top-color: var(--line); opacity: .7; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: 3px; padding: 10px 12px; }
.tile b { display: block; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile span { font-size: 13px; color: var(--muted); }
.bar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.bar .sp { flex: 1; }

.badge {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 3px; background: var(--soft); color: var(--muted); border: 1px solid var(--line);
  vertical-align: middle;
}
.badge.premium { background: var(--gold); color: #3a2c00; border-color: var(--gold); }

/* ---------- Buttons & forms ---------- */
button, .btn {
  font: inherit; font-size: 13px; font-weight: 600; background: var(--paper); color: var(--ink);
  border: 1px solid var(--line); border-radius: 3px; padding: 6px 12px; cursor: pointer;
  text-decoration: none; display: inline-block;
}
button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.primary, button.primary { background: var(--coral); border-color: var(--coral); color: #fff; padding: 9px 16px; font-size: 14px; }
.btn.primary:hover, button.primary:hover { background: #e2554e; }
button:disabled { opacity: .5; cursor: not-allowed; }

.sl { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 28px; }
@media (max-width: 620px) { .sl { grid-template-columns: 1fr; } }
.sl label { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.sl label b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sl select { width: 100%; font: inherit; font-size: 14px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 3px; background: var(--paper); color: var(--ink); margin-top: 4px; }
input[type=range] { width: 100%; accent-color: var(--coral); }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 13px; font-weight: 600; }
.field input {
  font: inherit; font-size: 15px; padding: 8px 10px; border-radius: 3px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink); width: 100%;
}
.field input:focus { outline: 2px solid rgba(242,106,99,.45); border-color: var(--coral); }
.form-narrow { max-width: 420px; }

.msg { padding: 9px 12px; border-radius: 3px; font-size: 14px; margin: 10px 0; }
.msg.ok { background: rgba(150,200,91,.18); }
.msg.err { background: rgba(242,106,99,.16); }
.note { border-left: 3px solid var(--blue); background: var(--paper); padding: 10px 12px; font-size: 14px; margin: 0 0 14px; }

/* ---------- Premium locking ---------- */
.locked { border: 1px dashed var(--gold); }
.lock-note { font-size: 13px; color: var(--muted); }
body.is-premium .locked { border-style: solid; border-color: var(--line); }
body.is-premium .lock-note, body:not(.is-premium) .premium-only { display: none; }

/* ---------- Tables (admin) ---------- */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
code.link { word-break: break-all; font-size: 12px; background: var(--soft); padding: 2px 4px; border-radius: 3px; }

/* ---------- Footer ---------- */
.site-footer { color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); margin-top: 32px; }
.site-footer .in {
  max-width: 1080px; margin: 0 auto; padding: 16px;
  display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between;
}
.site-footer a { color: var(--muted); }

/* ---------- Heat Auction cash-flow tools ---------- */
:root { --c-grant: #e0574f; --c-after: #3a76a8; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --c-grant: #e8605a; --c-after: #4f93cc; } }
:root[data-theme="dark"] { --c-grant: #e8605a; --c-after: #4f93cc; }
.seg { display: inline-flex; }
.seg button { border-radius: 0; }
.seg button:first-child { border-radius: 3px 0 0 3px; }
.seg button:last-child { border-radius: 0 3px 3px 0; border-left: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 2px; }
.sw.line { height: 0; width: 18px; border-top: 2px dashed var(--ink); border-radius: 0; }
.chart-wrap { position: relative; }
.tip {
  position: absolute; z-index: 2; pointer-events: none; background: var(--paper); color: var(--ink);
  border: 1px solid var(--line); border-radius: 3px; padding: 8px 10px; font-size: 12px;
  box-shadow: 0 4px 14px rgba(0,0,0,.12); display: grid; grid-template-columns: auto auto; gap: 2px 14px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.tip b { grid-column: 1 / -1; font-size: 13px; margin-bottom: 2px; }
.tip span:nth-child(odd) { text-align: right; }
.tip span:nth-child(even) { color: var(--muted); }
.tip .t { font-weight: 700; color: var(--ink) !important; border-top: 1px solid var(--line); padding-top: 2px; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.res td { font-size: 14px; }
details.years { margin-top: 10px; }
details.years summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--coral-ink); }
details.years table { margin-top: 8px; }
.small { font-size: 13px; }
.notes ul { margin: 0; padding-left: 20px; font-size: 14px; }
.notes li { margin-bottom: 6px; }
.policy input:disabled { opacity: .4; }
body:not(.mode-legacy) .legacy-only { display: none; }
body.mode-legacy .sl .policy label { opacity: .5; }
