/* KOVA ENERGY — B2B UI. Committed light look (color-scheme light).
   Data-viz tokens follow the validated reference palette; series colors are
   bound to energy-use entities in app.js (fixed order, never cycled). */

:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --brand: #0e2a47;
  --brand-2: #f5b52e;
  --accent: #2a78d6;
  --good-text: #006300;
  --status-good: #0ca30c;
  --status-warn: #fab219;
  --status-serious: #ec835a;
  --status-crit: #d03b3b;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); font-size: 15px; line-height: 1.45; }
.hidden { display: none !important; }
h1 { font-size: 1.35rem; margin: 0 0 .2rem; }
h2 { font-size: 1.02rem; margin: 0 0 .6rem; }
a { color: var(--accent); }

/* ---- layout ---- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--brand); color: #dbe4ee; padding: 1rem .9rem;
  display: flex; flex-direction: column; gap: .8rem; position: sticky; top: 0;
  height: 100vh; overflow-y: auto;
}
.brand { font-size: 1.05rem; letter-spacing: .04em; color: #fff; }
.brand b { font-weight: 700; color: var(--brand-2); }
.brand.big { font-size: 1.5rem; }
.brand-mark { color: var(--brand-2); }
.site-chip {
  font-size: .8rem; background: rgba(255,255,255,.08); border-radius: 6px;
  padding: .35rem .55rem; color: #b9c6d6;
}
#nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
#nav a { color: #c6d2e0; text-decoration: none; padding: .34rem .55rem; border-radius: 6px; cursor: pointer; font-size: .92rem; }
#nav a:hover { background: rgba(255,255,255,.08); }
#nav a.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.nav-group { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: #7d90a6; margin: .7rem .55rem .15rem; }
.sidebar-foot { display: flex; align-items: center; gap: .45rem; font-size: .8rem; color: #b9c6d6; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--status-warn); display: inline-block; }
.dot.ok { background: var(--status-good); }
main { padding: 1.4rem 1.8rem 3rem; max-width: 1160px; }

/* ---- header row / meta ---- */
.view-head { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.view-head .spacer { flex: 1; }
.sub { color: var(--ink-2); margin: .1rem 0 0; }
.meta { color: var(--muted); font-size: .8rem; }

/* ---- cards & grids ---- */
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 1.1rem; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .85rem 1rem;
}
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1.1rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  #nav { flex-direction: row; flex-wrap: wrap; }
  .two-col { grid-template-columns: 1fr; }
}

/* stat tile */
.stat .label { font-size: .78rem; color: var(--ink-2); }
.stat .value { font-size: 1.55rem; font-weight: 650; margin-top: .1rem; }
.stat .delta { font-size: .8rem; margin-top: .1rem; color: var(--ink-2); }
.delta.good { color: var(--good-text); }
.delta.bad { color: var(--status-crit); }

/* ---- tables ---- */
table.data { border-collapse: collapse; width: 100%; font-size: .9rem; }
.data th, .data td { text-align: left; padding: .42rem .55rem; border-bottom: 1px solid var(--grid); vertical-align: top; }
.data th { color: var(--ink-2); font-weight: 600; font-size: .8rem; }
.data td.num, .data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.data tr:hover td { background: #f4f4f0; }

/* ---- badges / status ---- */
.badge { display: inline-block; font-size: .72rem; font-weight: 650; padding: .12rem .5rem; border-radius: 99px; border: 1px solid var(--border); }
.badge.NEW { background: #eef1f5; }
.badge.ACCEPTED { background: #e5effb; color: #1c5cab; }
.badge.IN_PROGRESS { background: #fdf3dc; color: #8a5b00; }
.badge.IMPLEMENTED { background: #e7f5ec; color: #1d6b3a; }
.badge.VERIFIED { background: #d9efdc; color: var(--good-text); }
.badge.REJECTED { background: #f6e3e3; color: #8f2020; }
.badge.suggested { background: #fdf3dc; color: #8a5b00; }
.badge.confirmed { background: #d9efdc; color: var(--good-text); }
.badge.rejected { background: #eef1f5; color: var(--muted); }
.status-ok { color: var(--good-text); font-weight: 650; }
.status-partial { color: #8a5b00; font-weight: 650; }
.status-missing { color: var(--status-crit); font-weight: 650; }

/* ---- forms & buttons ---- */
label { display: block; font-size: .82rem; color: var(--ink-2); margin-bottom: .5rem; }
input, select, textarea {
  display: block; width: 100%; margin-top: .2rem; padding: .42rem .55rem;
  border: 1px solid var(--axis); border-radius: 7px; font: inherit; background: #fff; color: var(--ink);
}
.form-row { display: flex; gap: .8rem; flex-wrap: wrap; align-items: flex-end; }
.form-row label { flex: 1; min-width: 130px; margin-bottom: 0; }
.btn {
  display: inline-block; border: 1px solid var(--axis); background: #fff; color: var(--ink);
  border-radius: 7px; padding: .42rem .9rem; font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #16385c; }
.btn.ghost { background: transparent; border-color: rgba(255,255,255,.3); color: #dbe4ee; }
.btn.small { padding: .2rem .6rem; font-size: .8rem; }
.btn.wide { width: 100%; }
.err { color: var(--status-crit); font-size: .85rem; }
.notice { border: 1px solid var(--status-warn); background: #fdf6e3; border-radius: 8px; padding: .6rem .9rem; font-size: .85rem; margin: .8rem 0; }

/* ---- login ---- */
.login { min-height: 100vh; display: grid; place-items: center; background: var(--brand); }
.login-card { background: var(--surface); border-radius: 14px; padding: 2rem 2.2rem; width: min(92vw, 360px); }
.login-card .brand { color: var(--brand); }
.login-card .brand b { color: #b8860b; }
.login-card label { margin: 1.1rem 0 .9rem; }

/* ---- charts ---- */
.chart-wrap { overflow-x: auto; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .axislabel { font-size: 11px; fill: var(--muted); }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .dlabel { font-size: 11px; fill: var(--ink-2); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: .35rem 1rem; font-size: .8rem; color: var(--ink-2); margin: .5rem 0 0; }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }

/* bar list (energy review) */
.barlist { display: grid; gap: .45rem; }
.barlist .row { display: grid; grid-template-columns: 120px 1fr 200px; gap: .7rem; align-items: center; font-size: .88rem; }
.barlist .track { background: transparent; height: 16px; position: relative; }
.barlist .fill { height: 100%; border-radius: 0 4px 4px 0; min-width: 2px; }
.barlist .nums { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: .82rem; }

/* readiness bar */
.progress { background: #dfe5ec; border-radius: 4px; height: 14px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: #2f6f4f; border-radius: 4px 0 0 4px; }

/* tooltip */
.tooltip {
  position: fixed; z-index: 50; pointer-events: none; background: #fff;
  border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.12);
  padding: .45rem .7rem; font-size: .8rem; color: var(--ink); max-width: 260px;
}
.tooltip .t-title { font-weight: 650; margin-bottom: .15rem; }
.tooltip .t-row { display: flex; justify-content: space-between; gap: 1rem; }
.tooltip .t-row .v { font-variant-numeric: tabular-nums; font-weight: 600; }

details.evidence { font-size: .84rem; margin-top: .3rem; }
details.evidence summary { cursor: pointer; color: var(--accent); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; }

/* ---- ISO-Tooltips + Einrichtungs-Wizard ---- */
.iso-i { font-size: .62em; font-weight: 600; color: var(--accent); cursor: help;
  vertical-align: middle; border: 1px solid var(--accent); border-radius: 99px;
  padding: .1rem .45rem; opacity: .75; white-space: nowrap; }
.iso-i:hover { opacity: 1; }
.steps { display: grid; gap: 14px; }
.step { border-left: 4px solid var(--axis); }
.step.done { border-left-color: var(--status-good); }
.step.active { border-left-color: var(--brand-2); }
.step .step-head { display: flex; align-items: baseline; gap: .6rem; }
.step .step-no { font-weight: 700; color: var(--muted); font-size: .85rem; }
.step.done .step-no { color: var(--good-text); }
.type-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.type-card { border: 2px solid var(--grid); border-radius: 10px; padding: .7rem .8rem;
  cursor: pointer; background: #fff; text-align: left; font: inherit; }
.type-card:hover { border-color: var(--axis); }
.type-card.active { border-color: var(--brand); background: #eef3f9; }
.type-card .t-icon { font-size: 1.3rem; }
.type-card b { display: block; margin: .15rem 0; }
.type-card small { color: var(--ink-2); }
.conf { display: inline-block; font-size: .72rem; font-weight: 650; padding: .1rem .45rem; border-radius: 99px; }
.conf.hi { background: #d9efdc; color: var(--good-text); }
.conf.mid { background: #fdf3dc; color: #8a5b00; }
.conf.lo { background: #eef1f5; color: var(--muted); }
.wow { border: 1px solid #d9efdc; background: #f2faf3; border-radius: 8px;
  padding: .6rem .9rem; font-size: .9rem; margin: .6rem 0; }
