/* byliox.dev Status – Basis: Tokens, Themes, Typografie, Aktionen, Felder.
   Abgeleitet aus dem Design-System der Website (Petrol-Nacht, Leinen, Sonnengelb),
   ergänzt um einen Light Mode und semantische Statusfarben. */

@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('/fonts/bricolage-grotesque-wdth.woff2') format('woff2-variations'),
    url('/fonts/bricolage-grotesque-wdth.woff2') format('woff2');
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}

:root {
  /* ---- Primitives ---- */
  --petrol-950: #0a1719;
  --petrol-900: #0f2023;
  --petrol-850: #142a2e;
  --petrol-800: #1c363b;
  --petrol-600: #3b5a5f;
  --linen-50: #f6f6f1;
  --linen-100: #eeefe8;
  --linen-200: #e3e5dc;
  --linen-250: #d8dbd1;
  --linen-300: #b7c2bf;
  --linen-500: #85989a;
  --sun-400: #f2c14e;
  --sun-300: #f7d47e;
  --sun-700: #8a6500;
  --ink-900: #0a1719;
  --ink-700: #4a3d17;

  /* ---- Typ-Skala ---- */
  --font-display: clamp(2.5rem, 5.4vw, 4.75rem);
  --font-section: clamp(2rem, 3.6vw, 3rem);
  --font-title: clamp(1.375rem, 1.8vw, 1.75rem);
  --font-lead: clamp(1.0625rem, 1.25vw, 1.25rem);
  --font-body: 1.0625rem;
  --font-ui: 1rem;
  --font-small: 0.9375rem;
  --font-label: 0.8125rem;
  --stretch-display: 75%;
  --stretch-title: 85%;

  /* ---- Raum ---- */
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-6: 48px;
  --space-8: 64px;
  --space-12: 96px;
  --max-width: 1120px;
  --gutter: clamp(16px, 4vw, 56px);
  --nav-height: 72px;

  --radius-pill: 999px;
  --radius-field: 14px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 150ms;
  --dur-base: 240ms;
}

/* ---- Dark (Standard, wie die Website) ---- */
:root,
:root[data-theme='dark'] {
  --bg-primary: var(--petrol-950);
  --bg-secondary: var(--petrol-900);
  --bg-elevated: var(--petrol-850);
  --bg-raised: var(--petrol-800);
  --text-primary: var(--linen-100);
  --text-secondary: var(--linen-300);
  --text-muted: var(--linen-500);
  --text-faint: var(--petrol-600);
  --border-primary: rgba(238, 239, 232, 0.2);
  --border-subtle: rgba(238, 239, 232, 0.1);
  --accent: var(--sun-400);
  --accent-hover: var(--sun-300);
  --accent-foreground: var(--ink-900);
  --accent-text: var(--sun-400);
  --field-bg: var(--petrol-900);

  /* Statusfarben: gedämpft, damit Gelb das Handlungssignal bleibt */
  --st-ok: #4cc38a;
  --st-degraded: #e8c25a;
  --st-partial: #f0954f;
  --st-down: #ef6b5b;
  --st-maintenance: #72a9dc;
  --st-unknown: #4a6266;
  --st-empty: #1c363b;

  color-scheme: dark;
}

/* ---- Light: Leinen als Grund, Petrol als Schrift ---- */
:root[data-theme='light'] {
  --bg-primary: var(--linen-50);
  --bg-secondary: var(--linen-100);
  --bg-elevated: var(--linen-200);
  --bg-raised: var(--linen-250);
  --text-primary: var(--petrol-950);
  --text-secondary: #2e4549;
  --text-muted: #5a6f72;
  --text-faint: #a9b4b1;
  --border-primary: rgba(10, 23, 25, 0.18);
  --border-subtle: rgba(10, 23, 25, 0.09);
  --accent: var(--sun-400);
  --accent-hover: #e8b236;
  --accent-foreground: var(--ink-900);
  --accent-text: var(--sun-700);
  --field-bg: #ffffff;

  --st-ok: #1f9d64;
  --st-degraded: #c79a12;
  --st-partial: #d46a1f;
  --st-down: #d23f2f;
  --st-maintenance: #2f73b3;
  --st-unknown: #9aa8a6;
  --st-empty: #dfe2d9;

  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg-primary: var(--linen-50);
    --bg-secondary: var(--linen-100);
    --bg-elevated: var(--linen-200);
    --bg-raised: var(--linen-250);
    --text-primary: var(--petrol-950);
    --text-secondary: #2e4549;
    --text-muted: #5a6f72;
    --text-faint: #a9b4b1;
    --border-primary: rgba(10, 23, 25, 0.18);
    --border-subtle: rgba(10, 23, 25, 0.09);
    --accent-hover: #e8b236;
    --accent-text: var(--sun-700);
    --field-bg: #ffffff;
    --st-ok: #1f9d64;
    --st-degraded: #c79a12;
    --st-partial: #d46a1f;
    --st-down: #d23f2f;
    --st-maintenance: #2f73b3;
    --st-unknown: #9aa8a6;
    --st-empty: #dfe2d9;
    color-scheme: light;
  }
}

[hidden] { display: none !important; }

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  accent-color: var(--accent);
}

body {
  margin: 0;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Bricolage Grotesque', 'Helvetica Neue', Arial, sans-serif;
  font-size: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  transition: background-color var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out);
}

h1, h2, h3, h4, p, dl, dd, figure, ol, ul { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

::selection { background: var(--accent); color: var(--accent-foreground); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.container {
  width: 100%;
  max-width: calc(var(--max-width) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---- Typografie ---- */
.t-display {
  font-size: var(--font-display);
  font-weight: 760;
  font-stretch: var(--stretch-display);
  line-height: 0.95;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.t-section {
  font-size: var(--font-section);
  font-weight: 760;
  font-stretch: var(--stretch-display);
  line-height: 0.95;
  letter-spacing: -0.025em;
}
.t-title {
  font-size: var(--font-title);
  font-weight: 700;
  font-stretch: var(--stretch-title);
  line-height: 1.1;
  letter-spacing: -0.015em;
}
.t-lead { font-size: var(--font-lead); color: var(--text-secondary); line-height: 1.55; }
.t-small { font-size: var(--font-small); }
.t-label { font-size: var(--font-label); font-weight: 600; color: var(--text-muted); line-height: 1.4; }
.t-muted { color: var(--text-muted); }
.t-secondary { color: var(--text-secondary); }
.num { font-variant-numeric: tabular-nums; }

/* ---- Wortmarke ---- */
.wordmark {
  display: inline-flex;
  align-items: baseline;
  font-size: 1.375rem;
  font-weight: 780;
  font-stretch: var(--stretch-display);
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
}
.wordmark .tld { font-weight: 500; color: var(--accent-text); }
.wordmark .suffix {
  margin-left: 10px;
  padding-left: 10px;
  border-left: 1px solid var(--border-primary);
  font-weight: 600;
  font-stretch: var(--stretch-title);
  color: var(--text-secondary);
  font-size: 1.125rem;
}

/* ---- Aktionen: rund, weil man sie anfasst ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 48px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  font-size: var(--font-ui);
  font-weight: 650;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out);
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--accent); color: var(--accent-foreground); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { border-color: var(--border-primary); color: var(--text-primary); }
.btn-secondary:hover { background: var(--bg-elevated); }
.btn-ghost { color: var(--text-secondary); padding: 0 14px; }
.btn-ghost:hover { background: var(--bg-elevated); color: var(--text-primary); }
.btn-danger { border-color: color-mix(in srgb, var(--st-down) 55%, transparent); color: var(--st-down); }
.btn-danger:hover { background: color-mix(in srgb, var(--st-down) 12%, transparent); }
.btn-sm { height: 38px; padding: 0 16px; font-size: var(--font-small); }
.btn-icon { width: 44px; padding: 0; }
.btn-icon.btn-sm { width: 38px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---- Felder ---- */
.field { display: grid; gap: 6px; }
.field > label, .field > .field-label { font-size: var(--font-small); font-weight: 600; color: var(--text-primary); }
.field .hint { font-size: var(--font-label); color: var(--text-muted); }
.input, .select, .textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 16px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-field);
  background: var(--field-bg);
  color: var(--text-primary);
  font-size: var(--font-ui);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.textarea { min-height: 140px; resize: vertical; line-height: 1.55; }
.select {
  appearance: none;
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2385989a' stroke-width='2.4'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-muted); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: var(--font-small);
  cursor: pointer;
}
.check input { width: 18px; height: 18px; margin: 3px 0 0; flex: none; }
.check small { display: block; color: var(--text-muted); font-size: var(--font-label); }

/* Segmentierte Auswahl (z. B. E-Mail / SMS, Sichtbarkeit) */
.segmented {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-pill);
}
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented label > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  font-size: var(--font-small);
  font-weight: 650;
  color: var(--text-secondary);
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.segmented label > span svg { width: 16px; height: 16px; }
.segmented input:checked + span { background: var(--text-primary); color: var(--bg-primary); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Statusmarken: Symbole, keine Pulse ---- */
.st { --c: var(--st-unknown); }
.st-operational { --c: var(--st-ok); }
.st-degraded { --c: var(--st-degraded); }
.st-partial { --c: var(--st-partial); }
.st-down { --c: var(--st-down); }
.st-maintenance { --c: var(--st-maintenance); }
.st-unknown { --c: var(--st-unknown); }

.mark { display: inline-block; width: 10px; height: 10px; background: var(--c); flex: none; }
.st-text { color: var(--c); font-weight: 650; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--c, var(--text-muted)) 45%, transparent);
  border-radius: var(--radius-pill);
  color: var(--c, var(--text-secondary));
  font-size: var(--font-label);
  font-weight: 650;
  white-space: nowrap;
}
.tag .mark { width: 8px; height: 8px; }

/* ---- Theme-Schalter ---- */
.theme-toggle .i-sun { display: none; }
:root[data-theme='dark'] .theme-toggle .i-sun { display: block; }
:root[data-theme='dark'] .theme-toggle .i-moon { display: none; }
:root[data-theme='light'] .theme-toggle .i-sun { display: none; }
:root[data-theme='light'] .theme-toggle .i-moon { display: block; }

/* ---- Dialog ---- */
dialog.modal {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--border-primary);
  background: var(--bg-primary);
  color: var(--text-primary);
}
dialog.modal::backdrop { background: rgba(5, 12, 13, 0.62); }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-3) 0;
}
.modal-body { padding: var(--space-3); display: grid; gap: var(--space-3); }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}

@media (max-width: 479px) {
  .btn-block-sm { width: 100%; }
}

/* ---- Geteilt zwischen Statusseite und Admin ---- */
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  font-size: var(--font-small);
  color: var(--text-secondary);
  text-decoration: none;
}
.back:hover { color: var(--text-primary); }
.back svg { width: 16px; height: 16px; }

.form-error {
  padding: 12px 16px;
  border-left: 3px solid var(--st-down);
  background: color-mix(in srgb, var(--st-down) 10%, transparent);
  font-size: var(--font-small);
}
.form-ok {
  padding: 12px 16px;
  border-left: 3px solid var(--st-ok);
  background: color-mix(in srgb, var(--st-ok) 10%, transparent);
  font-size: var(--font-small);
}

.bars {
  display: grid;
  grid-template-columns: repeat(var(--n, 90), minmax(0, 1fr));
  gap: 2px;
  height: 34px;
}
.bar {
  position: relative;
  background: var(--c, var(--st-empty));
  outline: none;
  transition: opacity var(--dur-fast) var(--ease-out);
}
.bar.st-empty { --c: var(--st-empty); }
.bars:hover .bar { opacity: 0.55; }
.bars:hover .bar:hover, .bars .bar:focus-visible { opacity: 1; }

/* ---- Statussymbole statt Quadrate (Lucide, als Maske, Farbe aus --c) ---- */
.st-unknown, .st { --mi: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272.2%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Ccircle%20cx%3D%2712%27%20cy%3D%2712%27%20r%3D%2710%27%20%2F%3E%20%3Cpath%20d%3D%27M9.09%209a3%203%200%200%201%205.83%201c0%202-3%203-3%203%27%20%2F%3E%20%3Cpath%20d%3D%27M12%2017h.01%27%20%2F%3E%3C%2Fsvg%3E"); }
.st-operational { --mi: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272.2%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Ccircle%20cx%3D%2712%27%20cy%3D%2712%27%20r%3D%2710%27%20%2F%3E%20%3Cpath%20d%3D%27m16%209-5.5%205.5L8%2012%27%20%2F%3E%3C%2Fsvg%3E"); }
.st-degraded { --mi: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272.2%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27m21.73%2018-8-14a2%202%200%200%200-3.48%200l-8%2014A2%202%200%200%200%204%2021h16a2%202%200%200%200%201.73-3%27%20%2F%3E%20%3Cpath%20d%3D%27M12%209v4%27%20%2F%3E%20%3Cpath%20d%3D%27M12%2017h.01%27%20%2F%3E%3C%2Fsvg%3E"); }
.st-partial { --mi: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272.2%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Ccircle%20cx%3D%2712%27%20cy%3D%2712%27%20r%3D%2710%27%20%2F%3E%20%3Cline%20x1%3D%2712%27%20x2%3D%2712%27%20y1%3D%278%27%20y2%3D%2712%27%20%2F%3E%20%3Cline%20x1%3D%2712%27%20x2%3D%2712.01%27%20y1%3D%2716%27%20y2%3D%2716%27%20%2F%3E%3C%2Fsvg%3E"); }
.st-down { --mi: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272.2%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Ccircle%20cx%3D%2712%27%20cy%3D%2712%27%20r%3D%2710%27%20%2F%3E%20%3Cpath%20d%3D%27m15%209-6%206%27%20%2F%3E%20%3Cpath%20d%3D%27m9%209%206%206%27%20%2F%3E%3C%2Fsvg%3E"); }
.st-maintenance { --mi: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272.2%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M14.7%206.3a1%201%200%200%200%200%201.4l1.6%201.6a1%201%200%200%200%201.4%200l3.106-3.105c.32-.322.863-.22.983.218a6%206%200%200%201-8.259%207.057l-7.91%207.91a1%201%200%200%201-2.999-3l7.91-7.91a6%206%200%200%201%207.057-8.259c.438.12.54.662.219.984z%27%20%2F%3E%3C%2Fsvg%3E"); }
.st-unknown { --mi: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%272.2%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Ccircle%20cx%3D%2712%27%20cy%3D%2712%27%20r%3D%2710%27%20%2F%3E%20%3Cpath%20d%3D%27M9.09%209a3%203%200%200%201%205.83%201c0%202-3%203-3%203%27%20%2F%3E%20%3Cpath%20d%3D%27M12%2017h.01%27%20%2F%3E%3C%2Fsvg%3E"); }
.mark {
  width: 16px;
  height: 16px;
  background: var(--c);
  -webkit-mask: var(--mi) center / contain no-repeat;
  mask: var(--mi) center / contain no-repeat;
}
.tag .mark, .legend .mark { width: 14px; height: 14px; }
