/* Statusseite – bewusst ohne externe Schriften/CDNs (DSGVO), Schriften liegen unter /static/fonts */
/* Erscheinungsbild nach OSD Markenhandbuch „Thin Final“: viel Weiß/Hellgrau, Anthrazit für Text und dunkle Flächen, Rot gezielt und selten */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("/static/fonts/inter-400.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("/static/fonts/inter-600.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 700; font-display: swap; src: url("/static/fonts/montserrat-700.woff2") format("woff2"); }

:root {
  /* OSD-Farben: Rot #990033, Anthrazit #16181F, Schiefer #5B6170, Silbergrau #9AA0AB, Hellgrau #F3F4F7, Linie #C9CDD6 */
  --bg: #e9ebf0;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --text: #16181f;
  --muted: #5b6170;
  --border: #d9dce3;
  --line: #c9cdd6;
  --accent: #990033;
  --accent-bg: #f8e9ee;
  --link: #990033;
  --primary: #990033;
  --primary-hover: #b3003c;
  --focus: #990033;
  --on-solid: #ffffff;

  /* Kopfbereich mit Gesamtstatus: immer Anthrazit */
  --hero-bg: #16181f;
  --hero-text: #ffffff;
  --hero-muted: #9aa0ab;

  --ok: #15803d;      --ok-bg: #e7f5ec;
  --maint: #1d5fd1;   --maint-bg: #e8effd;
  --minor: #a35a00;   --minor-bg: #fdf3e0;
  --major: #c2410c;   --major-bg: #fdebe2;
  --critical: #c81e1e; --critical-bg: #fde7e7;
  --info: #5b6170;    --info-bg: #e4e7ec;

  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(22, 24, 31, .04);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: "Montserrat", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}

/* Dunkel: wenn System dunkel ist und nicht "hell" gewählt wurde, oder wenn "dunkel" gewählt wurde.
   Rot auf Anthrazit nie für Text (Kontrast 2:1), daher Links in Textfarbe. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16181f;
    --surface: #1e2029;
    --surface-2: #272a34;
    --text: #f3f4f7;
    --muted: #9aa0ab;
    --border: #2e323c;
    --line: #5b6170;
    --accent: #990033;
    --accent-bg: #2e1720;
    --link: #f3f4f7;
    --primary: #990033;
    --primary-hover: #b0063f;
    --focus: #9aa0ab;
    --on-solid: #16181f;

    --hero-bg: #1e2029;

    --ok: #4ade80;      --ok-bg: #12301f;
    --maint: #7aa2ff;   --maint-bg: #172744;
    --minor: #fbbf24;   --minor-bg: #36290c;
    --major: #fb923c;   --major-bg: #3a1f10;
    --critical: #f87171; --critical-bg: #3d1616;
    --info: #9aa0ab;    --info-bg: #23262f;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #16181f;
  --surface: #1e2029;
  --surface-2: #272a34;
  --text: #f3f4f7;
  --muted: #9aa0ab;
  --border: #2e323c;
  --line: #5b6170;
  --accent: #990033;
  --accent-bg: #2e1720;
  --link: #f3f4f7;
  --primary: #990033;
  --primary-hover: #b0063f;
  --focus: #9aa0ab;
  --on-solid: #16181f;

  --hero-bg: #1e2029;

  --ok: #4ade80;      --ok-bg: #12301f;
  --maint: #7aa2ff;   --maint-bg: #172744;
  --minor: #fbbf24;   --minor-bg: #36290c;
  --major: #fb923c;   --major-bg: #3a1f10;
  --critical: #f87171; --critical-bg: #3d1616;
  --info: #9aa0ab;    --info-bg: #23262f;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-underline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 700; line-height: 1.25; margin: 0; }
p { margin: 0 0 .6em; }
p:last-child { margin-bottom: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

.wrap { max-width: 820px; margin: 0 auto; padding: 0 16px; }
.wrap.wide { max-width: 1100px; }
.wrap.narrow { max-width: 460px; }

/* Kopf / Fuß */
/* Kopfzeile immer in Anthrazit (auch im hellen Modus), daher eigene dunkle Werte und die dunkle Logo-Fassung */
header.site {
  --bg: #23262f; --surface: #2e323c; --surface-2: #272a34;
  --text: #f3f4f7; --muted: #9aa0ab; --border: #2e323c; --line: #5b6170;
  --link: #f3f4f7; --focus: #9aa0ab;
  background: var(--hero-bg); color: var(--text); border-bottom: 1px solid rgba(255, 255, 255, .08);
}
header.site .brand .logo-light { display: none; }
header.site .brand .logo-dark { display: block; }
header.site .wrap { display: flex; align-items: center; gap: 20px; min-height: 72px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 14px; color: var(--text); text-decoration: none; }
.brand-sub { font-family: var(--font-head); font-weight: 700; font-size: 1rem; color: var(--muted); padding-left: 14px; border-left: 1px solid var(--line); line-height: 34px; white-space: nowrap; }
.logo { height: 34px; width: auto; display: block; }
.logo-osd { height: 38px; } /* OSD Kompakt, laut Handbuch mind. 100 px breit */
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light { display: none; }
  :root:not([data-theme="light"]) .logo-dark { display: block; }
}
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }

/* Umschalter Hell / Dunkel / System */
.theme-switch { display: inline-flex; margin-left: auto; padding: 3px; gap: 2px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); }
.theme-switch button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 28px; padding: 0; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.theme-switch button:hover { color: var(--text); }
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border); }
.theme-switch svg { width: 16px; height: 16px; }
footer.site { margin-top: 48px; padding: 28px 0 40px; background: var(--hero-bg); color: var(--hero-muted); font-size: .9rem; border-top: 1px solid rgba(255, 255, 255, .08); }
footer.site .wrap { display: flex; gap: 20px; flex-wrap: wrap; }
footer.site a { color: #c9cdd6; }
footer.site a:hover { color: #ffffff; }

main.wrap { padding-top: 32px; padding-bottom: 24px; }
.admin main.wrap { padding-top: 36px; }
section { margin-top: 40px; }
section > h2 { font-size: 1.15rem; margin-bottom: 14px; }
h2 .sub { font-family: var(--font); font-weight: 400; color: var(--muted); font-size: .9rem; }
.intro { color: var(--muted); margin-bottom: 20px; }
.meta, .hint { color: var(--muted); font-size: .9rem; }
.hint { font-weight: 400; }
.empty { color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 16px 20px; }

.icon { width: 28px; height: 28px; flex: none; }

/* Kleine Überschrift in Versalien, wie im Markenhandbuch */
.eyebrow { font-size: .75rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; margin: 0 0 14px; }

/* Gesamtstatus (Kopfbereich in Anthrazit) */
.hero { margin: 0; background: var(--hero-bg); color: var(--hero-text); padding: 44px 0 48px; }
.hero .eyebrow { color: var(--hero-muted); }
.hero-status { display: flex; align-items: center; gap: 18px; }
.hero h1 { font-size: clamp(1.45rem, 4.2vw, 2.1rem); letter-spacing: -.005em; }
.hero h1::after { content: ""; display: block; width: 56px; height: 4px; margin-top: 14px; background: #990033; border-radius: 2px; }
.status-icon {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--ok); color: var(--on-solid);
  align-self: flex-start;
}
.status-icon .icon { width: 26px; height: 26px; }
.hero.lvl-maint .status-icon { background: var(--maint); }
.hero.lvl-minor .status-icon { background: var(--minor); }
.hero.lvl-major .status-icon { background: var(--major); }
.hero.lvl-critical .status-icon { background: var(--critical); }
.hero-intro { color: #c9cdd6; max-width: 60ch; margin: 22px 0 0; }
.hero-meta { color: var(--hero-muted); font-size: .88rem; margin: 10px 0 0; }

/* Hinweise */
.notice {
  display: flex; gap: 14px; margin-bottom: 14px; padding: 18px 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); border-left: 4px solid var(--accent);
}
.notice .icon { color: var(--muted); width: 22px; height: 22px; margin-top: 2px; }
.notice h3 { font-size: 1rem; margin-bottom: 4px; }

/* Tags */
.tag {
  display: inline-block; font-size: .78rem; font-weight: 600; letter-spacing: .01em;
  padding: 2px 9px; border-radius: 999px; white-space: nowrap;
  background: var(--info-bg); color: var(--info);
}
.tag-ok { background: var(--ok-bg); color: var(--ok); }
.tag-maint { background: var(--maint-bg); color: var(--maint); }
.tag-minor { background: var(--minor-bg); color: var(--minor); }
.tag-major { background: var(--major-bg); color: var(--major); }
.tag-critical { background: var(--critical-bg); color: var(--critical); }
.phase { font-size: .85rem; color: var(--muted); }
.msg-tags { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }

/* Meldungskarten */
.msg {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 14px;
  border-left: 4px solid var(--line);
}
.msg.lvl-maint { border-left-color: var(--maint); }
.msg.lvl-minor { border-left-color: var(--minor); }
.msg.lvl-major { border-left-color: var(--major); }
.msg.lvl-critical { border-left-color: var(--critical); }
.msg h3 { font-size: 1.1rem; margin-bottom: 4px; }
.msg header { margin-bottom: 14px; }
.msg.planned .tl-text { color: var(--text); }

/* Verlauf */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 20px; border-left: 2px solid var(--border); margin-left: 5px; }
.timeline li:last-child { padding-bottom: 0; border-left-color: transparent; }
.timeline li::before {
  content: ""; position: absolute; left: -7px; top: 5px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--line);
}
.timeline li:first-child::before { border-color: var(--accent); background: var(--accent); }
.tl-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-size: .92rem; }
.tl-head time { color: var(--muted); }
.tl-text { margin-top: 2px; }

/* Dienste */
.components { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.components li { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 15px 22px; border-top: 1px solid var(--border); }
.components li:first-child { border-top: 0; }
.c-name { display: block; font-weight: 600; }
.c-desc { display: block; color: var(--muted); font-size: .88rem; }
.c-status { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 600; white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; flex: none; }
.st-ok { color: var(--ok); }
.st-maint { color: var(--maint); }
.st-minor { color: var(--minor); }
.st-major { color: var(--major); }
.st-critical { color: var(--critical); }

/* Historie */
h3.day { font-family: var(--font); font-size: .75rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 20px 0 8px; }
h3.day:first-of-type { margin-top: 0; }
.past { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; }
.past summary { display: flex; gap: 10px; align-items: center; padding: 13px 18px; cursor: pointer; list-style: none; flex-wrap: wrap; }
.past summary::-webkit-details-marker { display: none; }
.past summary::after { content: "▸"; margin-left: auto; color: var(--muted); }
.past[open] summary::after { content: "▾"; }
.past-title { font-weight: 600; }
.past .timeline { padding: 4px 18px 18px; }

.contact p { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 15px 22px; }
.contact .sep { margin: 0 10px; color: var(--muted); }

/* ---------- Admin ---------- */
.admin-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.admin-nav a { padding: 6px 12px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font-size: .95rem; }
.admin-nav a:hover { background: var(--surface-2); }
.admin-nav a[aria-current] { background: var(--surface-2); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.logout { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .9rem; }

.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 1.6rem; }
.page-head .msg-tags { margin-bottom: 10px; }
.page-head .meta { margin-top: 6px; }
.back { margin-bottom: 16px; }
.current { margin-bottom: 12px; }
.admin section > h2 { margin-bottom: 14px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: .95rem; font-weight: 600; line-height: 1;
  padding: 11px 16px; border-radius: var(--radius-sm); cursor: pointer; text-decoration: none;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { color: var(--critical); border-color: currentColor; background: transparent; }
.btn.danger:hover { background: var(--critical-bg); }
.btn.small { padding: 7px 11px; font-size: .85rem; }
.btn-link { font: inherit; background: none; border: 0; padding: 0; color: var(--link); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; font-size: .9rem; }
.danger-link { color: var(--critical); }

.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-weight: 600; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--critical-bg); color: var(--critical); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 16px; }
.card h2 { font-size: 1.05rem; }
details.card > summary { cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h2::after { content: " ▸"; color: var(--muted); }
details.card[open] > summary h2::after { content: " ▾"; }
details.card[open] > summary { margin-bottom: 14px; }

.form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.form h2 { margin-top: 6px; }
label { display: block; font-weight: 600; font-size: .95rem; }
input:not([type=radio]):not([type=checkbox]), select, textarea {
  display: block; margin-top: 6px;
  font: inherit; font-weight: 400; width: 100%;
  padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
}
input:not([type=radio]):not([type=checkbox]):focus, select:focus, textarea:focus { border-color: var(--focus); }
input[type=radio], input[type=checkbox] { accent-color: var(--accent); }
textarea { resize: vertical; min-height: 110px; }
fieldset { border: 0; margin: 0; padding: 0; }
legend { font-weight: 600; font-size: .95rem; padding: 0; margin-bottom: 8px; }
.types { display: flex; gap: 8px; flex-wrap: wrap; }
.types legend { width: 100%; }
label.radio, label.check {
  display: inline-flex; align-items: center; gap: 8px; font-weight: 400;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer;
}
label.radio:has(input:checked), label.check:has(input:checked) { border-color: var(--accent); background: var(--accent-bg); }
label.radio:has(input:disabled) { opacity: .45; cursor: default; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 > label > span[data-for] { display: inline; }
.form-actions { display: flex; align-items: center; gap: 16px; }

.rows { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.row { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-top: 1px solid var(--border); color: var(--text); text-decoration: none; }
.row:first-child { border-top: 0; }
.row:hover { background: var(--surface-2); }
.row-main { flex: 1; min-width: 0; display: grid; }
.row-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.state { font-size: .8rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; border: 1px solid var(--line); color: var(--muted); }
.state-aktiv { color: var(--ok); border-color: currentColor; }
.state-geplant { color: var(--maint); border-color: currentColor; }

.cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 24px; align-items: start; }
.cols section { margin-top: 24px; }
.cols .tl-head form { display: inline; margin-left: auto; }
.danger-zone { border-color: var(--critical-bg); }
.danger-zone .hint { margin: 6px 0 12px; }

.comp { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.comp-edit { display: flex; gap: 12px; align-items: flex-end; flex: 1; flex-wrap: wrap; }
.comp-edit label { flex: 1; min-width: 180px; }
.comp-tools { display: flex; gap: 6px; }
.comp .btn { height: 46px; } /* gleiche Höhe wie die Eingabefelder daneben */
.comp-tools .btn.small { min-width: 46px; padding: 0 12px; }
.comp-new { margin-top: 24px; }

.login main.wrap { padding-top: 12vh; }
.login-head { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 8px; }

@media (max-width: 760px) {
  .cols, .grid2 { grid-template-columns: 1fr; }
  .logout { margin-left: 0; }
  .components li { align-items: flex-start; flex-direction: column; gap: 4px; padding: 14px 18px; }
  /* Meldungszeile im Admin: Tag und Sichtbarkeit oben, Titel darunter in voller Breite */
  .row { flex-wrap: wrap; gap: 8px 10px; padding: 14px 16px; }
  .row .state { margin-left: auto; }
  .row-main { order: 3; flex-basis: 100%; }
  .row-main strong { white-space: normal; }
  .hero { padding: 32px 0 36px; }
  .hero-status { gap: 14px; }
  .status-icon { width: 42px; height: 42px; }
  .status-icon .icon { width: 22px; height: 22px; }
  .brand-sub { font-size: .92rem; }
}
