/*
 * NEO SSH-Win Manager - Stats-Dashboard.
 *
 * Farben, Schriften und Bausteine folgen www.neosshwinmanager.org
 * (assets/css/site.css). Die Schriftdateien werden von dort geladen - der
 * Hauptserver liefert Fonts mit Access-Control-Allow-Origin: *.
 *
 * Die Diagrammfarben (--viz-*) sind kein Griff in die Markenpalette, sondern
 * gegen Farbfehlsichtigkeit, Helligkeitsband und Kontrast auf der jeweiligen
 * Flaeche geprueft - je Modus eigene Stufen derselben Farbtoene.
 */

@font-face { font-family: "Inter"; src: url("https://www.neosshwinmanager.org/assets/fonts/inter-400.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("https://www.neosshwinmanager.org/assets/fonts/inter-500.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("https://www.neosshwinmanager.org/assets/fonts/inter-600.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("https://www.neosshwinmanager.org/assets/fonts/inter-700.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("https://www.neosshwinmanager.org/assets/fonts/jetbrains-mono-500.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("https://www.neosshwinmanager.org/assets/fonts/jetbrains-mono-600.ttf") format("truetype"); font-weight: 600; font-display: swap; }

:root {
  --accent: #00b4d8;
  --accent-2: #0077b6;
  --accent-soft: rgba(0, 180, 216, 0.12);
  --accent-border: rgba(0, 180, 216, 0.35);
  --ok: #00d464;
  --warn: #f59e0b;
  --err: #ef4444;

  --mono: "JetBrains Mono", "Fira Code", ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

:root, [data-theme="dark"] {
  --bg-0: #0a0a0f;
  --bg-1: #0d0d12;
  --bg-2: #0f0f1a;
  --bg-3: #14141f;
  --bg-4: #1a1a2e;
  --border: #1e1e30;
  --border-strong: #2a2a4a;
  --text: #e4eaf0;
  --text-2: #c8d6e5;
  --text-3: #8b949e;
  --text-4: #556070;
  --link: #58a6ff;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.02) inset, 0 24px 60px -30px rgba(0, 0, 0, 0.7);
  --grid-line: rgba(255, 255, 255, 0.035);

  /* Diagrammfarben, geprueft gegen die Kartenflaeche #14141f */
  --viz-1: #12a3c4;
  --viz-2: #d95926;
  --viz-3: #9085e9;
  --viz-4: #199e70;
  --viz-step-1: #0a6d92;
  --viz-step-2: #0e8cb4;
  --viz-step-3: #22a8cc;
  --viz-step-4: #4cc3dd;
  --viz-step-5: #8ad9ea;
  --viz-grid: #22223a;
  --viz-axis: #8b949e;
  --viz-good: #00d464;
  --viz-bad: #ef4444;
}

[data-theme="light"] {
  --bg-0: #e4e8ef;
  --bg-1: #f0f2f5;
  --bg-2: #f8fafc;
  --bg-3: #ffffff;
  --bg-4: #eef2f7;
  --border: #d0d8e4;
  --border-strong: #a8c0d8;
  --text: #1a2332;
  --text-2: #2a3a4a;
  --text-3: #4a5a6a;
  --text-4: #6a7a8a;
  --link: #0077b6;
  --accent: #0077b6;
  --accent-2: #00b4d8;
  --accent-soft: rgba(0, 119, 182, 0.10);
  --accent-border: rgba(0, 119, 182, 0.35);
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 12px 40px -20px rgba(15, 23, 42, 0.18);
  --grid-line: rgba(15, 23, 42, 0.05);

  /* Eigene Stufen fuer die helle Flaeche #ffffff, nicht die dunklen gespiegelt */
  --viz-1: #0077b6;
  --viz-2: #eb6834;
  --viz-3: #4a3aa7;
  --viz-4: #199e70;
  --viz-step-1: #5cc4de;
  --viz-step-2: #2ba7ca;
  --viz-step-3: #0d8ab2;
  --viz-step-4: #00709f;
  --viz-step-5: #00537b;
  --viz-grid: #e6ebf2;
  --viz-axis: #4a5a6a;
  --viz-good: #0a7f3f;
  --viz-bad: #d03b3b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg-1);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); }

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Kopfzeile ──────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklab, var(--bg-1) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 60px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.brand-mark {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 4px 14px rgba(0, 180, 216, 0.45));
}

.brand-name { font-size: 15px; letter-spacing: 0.2px; }
.brand-name b { font-weight: 700; }
.brand-name span { color: var(--text-3); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.user-chip {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-3);
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
}

/* ── Knöpfe ─────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: var(--text);
  transition: border-color .15s, background .15s;
}

.btn:hover { border-color: var(--border-strong); }
.btn-sm { padding: 7px 11px; font-size: 13px; }
.btn-lg { padding: 13px 20px; font-size: 15px; width: 100%; justify-content: center; }

.btn-primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: #fff;
  border: 1px solid transparent;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 8px 24px -8px rgba(0, 180, 216, 0.6);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: var(--text-2);
  cursor: pointer;
}

.icon-btn:hover { border-color: var(--border-strong); }

/* ── Abschnitte ─────────────────────────────────────────────────────── */

.section { padding: 40px 0; border-bottom: 1px solid var(--border); }
.section:last-of-type { border-bottom: 0; }

.eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  padding: 4px 10px;
  margin-bottom: 12px;
}

h1, h2 { margin: 0 0 6px; line-height: 1.25; letter-spacing: -0.4px; }
h1 { font-size: 30px; font-weight: 700; }
h2 { font-size: 22px; font-weight: 600; }
h3 { margin: 0 0 14px; font-size: 15px; font-weight: 600; }

.section-sub {
  margin: 0 0 24px;
  max-width: 680px;
  color: var(--text-3);
  font-size: 14px;
}

.card {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  box-shadow: var(--shadow-card);
}

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ── Kennzahlen ─────────────────────────────────────────────────────── */

.tile { padding: 18px 20px; }

.tile-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.tile-value {
  margin-top: 6px;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1.1;
}

.tile-hint { margin-top: 4px; font-size: 12px; color: var(--text-4); }

/* ── Zeitraumwahl ───────────────────────────────────────────────────── */

.range {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-3);
}

.range a {
  padding: 5px 12px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  text-decoration: none;
  white-space: nowrap;
}

.range a:hover { color: var(--text); }

.range a[aria-current="page"] {
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  padding: 4px 11px;
  color: var(--accent);
}

/* ── Balkenliste ────────────────────────────────────────────────────── */

.barlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.barlist li {
  display: grid;
  grid-template-columns: minmax(90px, 30%) 1fr auto;
  align-items: center;
  gap: 12px;
}

.barlist-label { font-size: 13px; color: var(--text-2); }

.barlist-track {
  height: 10px;
  border-radius: 999px;
  background: var(--bg-4);
  overflow: hidden;
}

.barlist-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--viz-1);
}

.barlist-value {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.barlist-share { margin-left: 8px; color: var(--text-4); font-weight: 500; }

/* ── Trichter ───────────────────────────────────────────────────────── */

.funnel { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; counter-reset: step; }

.funnel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.funnel-label { font-size: 14px; font-weight: 500; color: var(--text-2); }

.funnel-value {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.funnel-share { margin-left: 8px; font-size: 12px; color: var(--text-4); font-weight: 500; }

.funnel-track {
  height: 30px;
  border-radius: 6px;
  background: var(--bg-4);
  overflow: hidden;
}

.funnel-fill {
  height: 100%;
  border-radius: 6px;
  background: var(--viz-step-1);
}

.funnel-step[style*="--step:2"] .funnel-fill { background: var(--viz-step-2); }
.funnel-step[style*="--step:3"] .funnel-fill { background: var(--viz-step-3); }
.funnel-step[style*="--step:4"] .funnel-fill { background: var(--viz-step-4); }
.funnel-step[style*="--step:5"] .funnel-fill { background: var(--viz-step-5); }

.funnel-note { margin-top: 6px; font-size: 12px; color: var(--text-4); }
.tone-bad { color: var(--viz-bad); font-weight: 600; }
.tone-good { color: var(--viz-good); font-weight: 600; }

/* ── Diagramm ───────────────────────────────────────────────────────── */

.chart-wrap { display: block; }
.chart-box { position: relative; margin-top: 8px; }
.chart { display: block; width: 100%; height: auto; overflow: visible; }

/* Das hidden-Attribut wirkt in SVG nicht von selbst - ohne diese Regel
   stünden Fadenkreuz und Hover-Punkte sichtbar auf 0,0. */
.chart [hidden] { display: none; }

.chart .grid { stroke: var(--viz-grid); stroke-width: 1; }
.chart .axis { fill: var(--viz-axis); font-family: var(--mono); font-size: 11px; }
.chart .line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .crosshair { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 3 3; }

.chart .series-1 { stroke: var(--viz-1); }
.chart .series-2 { stroke: var(--viz-2); }
.chart .series-3 { stroke: var(--viz-3); }
.chart .series-4 { stroke: var(--viz-4); }

/* Der 2px-Ring in Flaechenfarbe haelt sich ueberlappende Punkte auseinander. */
.chart circle { stroke: var(--bg-3); stroke-width: 2; }
.chart circle.series-1 { fill: var(--viz-1); }
.chart circle.series-2 { fill: var(--viz-2); }
.chart circle.series-3 { fill: var(--viz-3); }
.chart circle.series-4 { fill: var(--viz-4); }

.legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 0;
  padding: 0;
  font-size: 13px;
  color: var(--text-2);
}

.legend li { display: inline-flex; align-items: center; gap: 7px; }
.legend b { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--text); }

.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.swatch.series-1 { background: var(--viz-1); }
.swatch.series-2 { background: var(--viz-2); }
.swatch.series-3 { background: var(--viz-3); }
.swatch.series-4 { background: var(--viz-4); }

.tooltip {
  position: absolute;
  z-index: 5;
  min-width: 150px;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg-2);
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.6);
  font-size: 12px;
  pointer-events: none;
  transform: translate(-50%, -100%);
}

.tooltip-day { font-family: var(--mono); color: var(--text-3); margin-bottom: 5px; }
.tooltip-row { display: flex; align-items: center; gap: 7px; }
.tooltip-row b { margin-left: auto; font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ── Tabellen ───────────────────────────────────────────────────────── */

.table-view { margin-top: 12px; }

.table-view summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--text-3);
  list-style-position: inside;
}

.table-scroll { overflow-x: auto; margin-top: 10px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

th, td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th { color: var(--text-3); font-weight: 500; font-size: 12px; }
td { font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }

.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--text-4); }
.empty { color: var(--text-4); font-size: 13px; margin: 0; }

/* ── Anmeldung ──────────────────────────────────────────────────────── */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(closest-side, rgba(0, 180, 216, 0.18), transparent 70%) center -120px / 700px 420px no-repeat,
    var(--bg-1);
}

.login-card { width: 100%; max-width: 400px; padding: 30px; }
.login-card .brand { margin-bottom: 20px; }
.login-card h1 { font-size: 22px; }
.login-card p { margin: 0 0 22px; color: var(--text-3); font-size: 14px; }

.field { margin-bottom: 14px; }

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}

.field input {
  width: 100%;
  padding: 11px 13px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.alert {
  margin-bottom: 16px;
  padding: 11px 13px;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.10);
  color: var(--text);
  font-size: 13px;
}

/* ── Fußzeile ───────────────────────────────────────────────────────── */

.footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  color: var(--text-4);
  font-size: 12px;
}

.footer-inner { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; }

@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  h1 { font-size: 24px; }
}

@media (max-width: 560px) {
  .grid-4 { grid-template-columns: 1fr; }
  .container { padding: 0 16px; }
  .barlist li { grid-template-columns: 1fr; gap: 4px; }
  .topbar-inner { height: auto; padding: 10px 0; flex-wrap: wrap; }
}
