/* Skandi Lotto – Designsystem */
:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --surface-3: #eceef2;
  --border: #e3e6eb;
  --border-strong: #cfd4dc;
  --text: #0f1419;
  --text-2: #4b5563;
  --muted: #8b93a1;
  --accent: #2a78d6;
  --accent-hover: #256abf;
  --accent-soft: #e8f1fc;
  --accent-ink: #ffffff;
  --side-bg: #101828;
  --side-text: #c4cad6;
  --side-muted: #7c8597;
  --side-active: #1d2939;
  --good: #0ca30c; --good-ink: #067a06; --good-soft: #e7f6e7;
  --warn: #fab219; --warn-ink: #8a5a00; --warn-soft: #fff4dc;
  --crit: #d03b3b; --crit-ink: #b42323; --crit-soft: #fdecec;
  --div-neg: #2a78d6; --div-pos: #e34948; --div-mid: #f0efec;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
  --radius: 14px;
  --radius-sm: 9px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d0f12; --surface: #16191e; --surface-2: #1b1f25; --surface-3: #242931;
    --border: #2a3038; --border-strong: #3a414c;
    --text: #eef0f3; --text-2: #b4bbc6; --muted: #7d8592;
    --accent: #3987e5; --accent-hover: #5598e7; --accent-soft: #15253a;
    --side-bg: #0a0c0f; --side-text: #b4bbc6; --side-muted: #6b7380; --side-active: #1b1f25;
    --good-ink: #4cc24c; --good-soft: #13261a; --warn-ink: #fab219; --warn-soft: #2b2312; --crit-ink: #f07070; --crit-soft: #2d1616;
    --div-neg: #3987e5; --div-pos: #e66767; --div-mid: #383835;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0f12; --surface: #16191e; --surface-2: #1b1f25; --surface-3: #242931;
  --border: #2a3038; --border-strong: #3a414c;
  --text: #eef0f3; --text-2: #b4bbc6; --muted: #7d8592;
  --accent: #3987e5; --accent-hover: #5598e7; --accent-soft: #15253a;
  --side-bg: #0a0c0f; --side-text: #b4bbc6; --side-muted: #6b7380; --side-active: #1b1f25;
  --good-ink: #4cc24c; --good-soft: #13261a; --warn-ink: #fab219; --warn-soft: #2b2312; --crit-ink: #f07070; --crit-soft: #2d1616;
  --div-neg: #3987e5; --div-pos: #e66767; --div-mid: #383835;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.55 var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
[hidden] { display: none !important; }
.icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.icon.sm { width: 15px; height: 15px; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--side-bg); color: var(--side-text); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 20px 14px; overflow-y: auto; }
.logo { display: flex; align-items: center; gap: 11px; padding: 4px 10px 22px; color: #fff; font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.logo:hover { color: #fff; }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #3987e5, #1c5cab); display: grid; place-items: center; font-weight: 800; font-size: 16px; color: #fff; box-shadow: 0 4px 14px rgba(42, 120, 214, .4); }
.logo small { display: block; font-weight: 500; font-size: 11.5px; color: var(--side-muted); letter-spacing: 0; }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--side-muted); padding: 16px 12px 6px; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 9px; color: var(--side-text); font-weight: 500; margin-bottom: 2px; transition: background .12s, color .12s; }
.nav a:hover { background: var(--side-active); color: #fff; }
.nav a.active { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav a .count { margin-left: auto; font-size: 11px; background: rgba(255, 255, 255, .08); padding: 1px 7px; border-radius: 99px; }
.side-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid rgba(255, 255, 255, .06); font-size: 12px; color: var(--side-muted); }
.side-foot .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--good); margin-right: 6px; }
.side-foot .dot.err { background: var(--crit); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 12px 32px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }
.content { padding: 28px 32px 64px; max-width: 1360px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 26px; line-height: 1.2; margin: 0; letter-spacing: -.02em; font-weight: 700; }
.page-head p { margin: 6px 0 0; color: var(--text-2); max-width: 760px; }

/* ---------- Bausteine ---------- */
.seg { display: inline-flex; background: var(--surface-3); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button, .seg a { border: 0; background: transparent; color: var(--text-2); font: 600 12px var(--font); padding: 5px 10px; border-radius: 7px; cursor: pointer; }
.seg .on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; }
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 4px 6px 4px 4px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); position: relative; cursor: pointer; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 12px; text-transform: uppercase; }
.user-chip .name { font-weight: 600; font-size: 13px; padding-right: 4px; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 200px; z-index: 30; }
.menu a, .menu button { display: flex; width: 100%; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 7px; color: var(--text); background: none; border: 0; font: 500 13px var(--font); cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--surface-2); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); min-width: 0; }
.card + .card { margin-top: 20px; }
.grid > .card, .stack > .card { margin-top: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h2 { font-size: 15px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
.card-head p { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
.card.flush { padding: 0; }
.card.flush .card-head { padding: 18px 22px 0; }
.stack { display: grid; gap: 20px; align-content: start; }
.grid { display: grid; gap: 20px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.mt { margin-top: 20px; }

.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi .label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; display: flex; align-items: center; gap: 7px; }
.kpi .value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi .value.sm { font-size: 20px; }
.kpi .note { font-size: 12.5px; color: var(--text-2); }
.kpi-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }

/* Lottokugeln */
.balls { display: inline-flex; flex-wrap: wrap; gap: 5px; }
.ball { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); flex-shrink: 0; }
a.ball:hover { border-color: var(--accent); color: var(--accent); }
.ball.hl { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ball.lg { width: 46px; height: 46px; font-size: 17px; background: radial-gradient(circle at 30% 22%, rgba(255,255,255,.55) 0, rgba(255,255,255,0) 32%), linear-gradient(145deg, #4d97ec, #1c5cab); border: 0; color: #fff; box-shadow: 0 6px 14px rgba(28, 92, 171, .3), inset 0 -3px 6px rgba(0, 0, 0, .15); }
.ball.lg span { position: relative; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
td.wide { min-width: 280px; }
.ball.lg.alt { background: radial-gradient(circle at 30% 22%, rgba(255,255,255,.55) 0, rgba(255,255,255,0) 32%), linear-gradient(145deg, #f0874f, #c4501f); box-shadow: 0 6px 14px rgba(196, 80, 31, .28), inset 0 -3px 6px rgba(0, 0, 0, .15); }
.ball.sm { width: 26px; height: 26px; font-size: 11.5px; }

/* Tabellen */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
thead th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.card.flush table thead th:first-child, .card.flush table td:first-child { padding-left: 22px; }
.card.flush table thead th:last-child, .card.flush table td:last-child { padding-right: 22px; }
tbody tr:hover td { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
td.actions { text-align: right; white-space: nowrap; }
tr.dim td { opacity: .55; }
.card.flush .table-wrap { margin-top: 14px; }

/* Formulare */
.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field.grow { flex: 1; min-width: 220px; }
input, select { font: 14px var(--font); padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); min-height: 38px; transition: border-color .12s, box-shadow .12s; }
input:focus, select:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input[type=checkbox] { width: 16px; height: 16px; min-height: 0; accent-color: var(--accent); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); font-weight: 500; min-height: 38px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: 600 13.5px var(--font); padding: 0 16px; min-height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--surface); color: var(--crit-ink); border-color: color-mix(in srgb, var(--crit) 45%, var(--border)); }
.btn.danger:hover { background: var(--crit-soft); }
.btn.sm { min-height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 7px; }
.btn.block { width: 100%; }
.btn.link { background: none; border: 0; color: var(--accent); padding: 0; min-height: 0; }
form.inline { display: inline; }

/* Badges & Hinweise */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.badge.ok { background: var(--good-soft); color: var(--good-ink); } .badge.ok::before { background: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn-ink); } .badge.warn::before { background: var(--warn); }
.badge.crit { background: var(--crit-soft); color: var(--crit-ink); } .badge.crit::before { background: var(--crit); }
.badge.info { background: var(--accent-soft); color: var(--accent); } .badge.info::before { background: var(--accent); }
.badge.plain::before { display: none; }
.flash { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 11px; margin-bottom: 18px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); font-weight: 500; }
.flash.ok { border-left: 4px solid var(--good); }
.flash.error { border-left: 4px solid var(--crit); }
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: 11px; background: var(--accent-soft); color: var(--text); font-size: 13.5px; }
.callout .icon { color: var(--accent); margin-top: 2px; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 650; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--text-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.chips a { padding: 5px 12px; border: 1px solid var(--border); border-radius: 99px; color: var(--text-2); background: var(--surface); font-size: 12.5px; font-weight: 600; }
.chips a:hover { border-color: var(--border-strong); color: var(--text); }
.chips a.active { background: var(--text); color: var(--surface); border-color: var(--text); }

/* Diagramme */
.chart-box { position: relative; height: 290px; }
.chart-box.sm { height: 230px; }
.chart-box.xs { height: 170px; }
.legend-ramp { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); margin-top: 12px; flex-wrap: wrap; }
.legend-ramp .sw { width: 22px; height: 12px; border-radius: 3px; display: inline-block; }
.heat { border-collapse: separate; border-spacing: 2px; width: auto; }
.heat td { padding: 0; border: 0; width: 24px; height: 20px; border-radius: 3px; }
.heat th { padding: 2px; font-size: 10.5px; text-align: center; background: none; color: var(--muted); border: 0; }
.heat td.y { width: auto; text-align: right; padding-right: 8px; font-size: 11.5px; color: var(--text-2); background: none !important; }
.heat tbody tr:hover td { background: inherit; }
.zbar-wrap { display: flex; width: 150px; align-items: center; }
.zbar-wrap > div { width: 75px; display: flex; }
.zbar-wrap > div:first-child { justify-content: flex-end; }
.zbar-wrap .axis { width: 1px; height: 16px; background: var(--border-strong); }
.zbar { height: 10px; border-radius: 3px; }
.meter { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* Nummernraster */
.numgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.numgrid a { display: grid; place-items: center; aspect-ratio: 1; border-radius: 10px; border: 1px solid var(--border); font-weight: 700; color: var(--text); background: var(--surface); }
.numgrid a:hover { border-color: var(--accent); color: var(--accent); }
.numgrid a.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* Liste */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.draw-hero { display: flex; flex-direction: column; gap: 16px; }
.draw-hero .row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.draw-hero .tag { width: 92px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* Login */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-side { background: radial-gradient(circle at 20% 20%, #1f4f8f 0, transparent 55%), radial-gradient(circle at 80% 90%, #7a2f12 0, transparent 50%), #0b1220; color: #e7ecf3; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side h2 { font-size: 34px; letter-spacing: -.02em; line-height: 1.15; margin: 0 0 14px; max-width: 460px; }
.auth-side p { color: #a9b4c4; max-width: 440px; margin: 0; }
.auth-balls { display: flex; gap: 10px; flex-wrap: wrap; margin: 36px 0; }
.auth-main { display: grid; place-items: center; padding: 32px; background: var(--bg); }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 24px; margin: 0 0 6px; letter-spacing: -.02em; }
.auth-card .field { margin-bottom: 14px; }
.auth-card input[type=text], .auth-card input[type=password] { width: 100%; }
.auth-top { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 40px; }

/* Responsiv */
@media (max-width: 1180px) { .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-main { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 264px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 10px 16px; }
  .content { padding: 20px 16px 48px; }
  .g-3, .g-2 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .user-chip .name { display: none; }
}
@media (max-width: 520px) { .g-4 { grid-template-columns: 1fr; } .page-head h1 { font-size: 22px; } }
