/* CP Run economy site. The BattleForge dark theme (ice blue accent, ember
   highlights); chart series colours were checked for colour-blind safety
   against the --panel surface. */
@font-face { font-family: "Manrope"; font-weight: 400; font-display: swap; src: url("fonts/manrope-400-cyrillic.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Manrope"; font-weight: 400; font-display: swap; src: url("fonts/manrope-400-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Manrope"; font-weight: 600; font-display: swap; src: url("fonts/manrope-600-cyrillic.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Manrope"; font-weight: 600; font-display: swap; src: url("fonts/manrope-600-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Manrope"; font-weight: 700; font-display: swap; src: url("fonts/manrope-700-cyrillic.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Manrope"; font-weight: 700; font-display: swap; src: url("fonts/manrope-700-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Cormorant SC"; font-weight: 700; font-display: swap; src: url("fonts/cormorant-sc-700-cyrillic.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Cormorant SC"; font-weight: 700; font-display: swap; src: url("fonts/cormorant-sc-700-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  color-scheme: dark;
  --bg: #07090d;
  --panel: #111821;
  --panel-2: #17202b;
  --line: #243142;
  --grid: #1d2733;
  --text: #eef3f7;
  --muted: #9aa7b4;
  --ice: #8fd3ff;
  --ice-deep: #1a3448;
  --ember: #ec8f45;
  --good: #7fd88f;
  --bad: #ef8b8b;
  --series-1: #3987e5;   /* silver */
  --series-2: #d95926;   /* CP */
  --pos: #3987e5;        /* balance: overpaid */
  --neg: #e66767;        /* balance: owes */
  --display: "Cormorant SC", Georgia, serif;
  --body: "Manrope", "Segoe UI", system-ui, sans-serif;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.55 var(--body); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: var(--ice); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
h1 { font: 700 34px/1.1 var(--display); letter-spacing: .01em; margin-bottom: 6px; }
h2 { font: 700 26px/1.15 var(--display); margin: 34px 0 12px; }
h3 { font-size: 15px; font-weight: 700; margin: 0 0 4px; }
p { margin: 0 0 10px; max-width: 75ch; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--bad); min-height: 1.2em; margin: 8px 0 0; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding-inline: 16px; }

/* -- header -------------------------------------------------------------- */
.top { border-bottom: 1px solid var(--line); background: #0a0e13; position: sticky; top: 0; z-index: 10; }
.top-row { display: flex; align-items: center; gap: 24px; min-height: 60px; flex-wrap: wrap; padding-block: 8px; }
.brand { display: flex; flex-direction: column; text-decoration: none; color: var(--text); line-height: 1.05; }
.brand-mark { font: 700 26px var(--display); color: var(--ember); }
.brand-sub { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 10px; font-weight: 600; }
.nav a:hover { color: var(--text); background: var(--panel); }
.nav a.active { color: var(--text); background: var(--ice-deep); }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.lang button { background: transparent; color: var(--muted); border: 0; padding: 4px 9px; font: 700 12px var(--body); cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--ice-deep); color: var(--ice); }
.lang button:hover { color: var(--text); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; align-self: end; }
.seg button { background: transparent; color: var(--muted); border: 0; padding: 8px 16px; font: 700 13px var(--body); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ice-deep); color: var(--ice); }
.seg button:hover { color: var(--text); }
td.strong { font-weight: 700; }

main { padding-block: 28px 80px; }

/* -- controls -------------------------------------------------------------- */
.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 18px;
  border-radius: 10px; border: 1px solid transparent; background: var(--ice); color: #061019; font: 700 14px var(--body); cursor: pointer; }
.btn:hover { background: #b5e3ff; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--panel-2); }
.btn-danger { background: transparent; color: var(--bad); border-color: #4a2a2a; }
.btn-danger:hover { background: #2a1818; }
.btn-sm { min-height: 30px; padding: 0 12px; font-size: 13px; }
input, select, textarea { font: inherit; color: var(--text); background: #0b1118; border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; min-height: 40px; width: 100%; }
textarea { min-height: 120px; resize: vertical; font-family: "Cascadia Mono", Consolas, monospace; font-size: 13px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ice); }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.stack { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; }
.toolbar { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar label { min-width: 220px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 16px; }
.mb { margin-bottom: 18px; }
.mt { margin-top: 14px; }
.narrow { max-width: 460px; margin: 40px auto; }
.note { border-left: 3px solid var(--ember); padding: 10px 14px; background: #15110c; border-radius: 0 10px 10px 0; margin: 12px 0; }

/* -- KPI tiles -------------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.kpi-label { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.kpi-value { font-size: 28px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.kpi-value.good { color: var(--good); }
.kpi-value.bad { color: var(--bad); }

/* -- charts ----------------------------------------------------------------- */
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); gap: 16px; }
.charts .card { margin-top: 0; }
.chart-card h3 { margin-bottom: 2px; }
.chart-card .muted { font-size: 13px; margin-bottom: 10px; }
.chart { width: 100%; overflow: hidden; }
.chart svg { display: block; width: 100%; height: auto; }
.chart text { fill: var(--muted); font: 12px var(--body); }
.chart .label-strong { fill: var(--text); font-weight: 600; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover { fill: rgba(143, 211, 255, .06); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.sw-1 { background: var(--series-1); }
.sw-2 { background: var(--series-2); }
.sw-pos { background: var(--pos); }
.sw-neg { background: var(--neg); }
.empty { color: var(--muted); padding: 28px 0; text-align: center; }
.tooltip { position: fixed; z-index: 50; pointer-events: none; background: #0b1118; border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.45); max-width: 280px; }
.tooltip b { display: block; margin-bottom: 2px; }

/* -- tables ----------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; background: var(--panel-2); position: sticky; top: 0; }
th.num, td.num { text-align: right; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #141c26; }
tfoot td { font-weight: 700; background: var(--panel-2); }
td select, td input { min-height: 32px; padding: 4px 8px; }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--panel-2); color: var(--muted); }
.tag-ice { background: var(--ice-deep); color: var(--ice); }
.tag-ember { background: #3a2414; color: var(--ember); }
.tag-gold { background: #332b14; color: #e0c880; }
.secret { font-family: "Cascadia Mono", Consolas, monospace; background: #0b1118; border: 1px dashed var(--ember); padding: 10px 12px; border-radius: 10px; word-break: break-all; }

.toast { position: fixed; right: 16px; bottom: 16px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; z-index: 60; }
.toast.err { border-color: #6a3434; color: var(--bad); }

@media (max-width: 640px) {
  h1 { font-size: 28px; }
  .who { margin-left: 0; }
  .kpi-value { font-size: 23px; }
}
