/* ===========================================================================
   Servicekonsole im PosioGO-Designsystem (quintgruppe/Posio, docs/gestaltung.md)
   Schwarz auf Weiß, Raster und Haarlinie statt Dekoration: keine Rundungen,
   keine Schatten, keine Verläufe. Farbe trägt nie Text – nur Quadrat, Linie,
   Fläche. Zustände eindeutig: aktiv = schwarz gefüllt.
   =========================================================================== */

/* Oberflächenschrift Geist (SIL OFL), Lizenz: fonts/Geist-LICENSE.txt */
@font-face { font-family: "Geist"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("fonts/Geist-Latin.woff2") format("woff2"); }

:root {
  --gasse: 20px; --rand: 20px;
  --papier: #ffffff; --tinte: #111111; --still: #767676;
  --linie: #111111; --linie-still: #d8d8d8; --arbeitsflaeche: #f4f4f4;
  --alarm: #c81e1e; --gut: #0b6b3a;
  --blau: #4c8df6; --blau-zart: #e6f0fe;
  --gruen: #34c27e; --gruen-zart: #e2f7eb;
  --gelb: #ffc83d; --gelb-zart: #fff5d4;
  --koralle: #ff7a66; --koralle-zart: #ffeae6;
  --schrift: "Geist", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--papier); }
body { margin: 0; background: var(--papier); color: var(--tinte);
  font: 15px/1.45 var(--schrift); letter-spacing: -.005em; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--tinte); outline-offset: 2px; }

/* --- Kopf: Wortmarke, Werkzeugtitel, Navigation als Umschaltergruppe ------- */
.top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 14px var(--rand);
  background: var(--papier); border-bottom: 1px solid var(--linie); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.marke-wort { font-size: 17px; font-weight: 700; letter-spacing: -.035em; }
.marke-go { font-weight: 300; letter-spacing: -.01em; }
.bar-trenner { color: var(--linie-still); }
.bar-title { font-size: 15px; font-weight: 700; letter-spacing: -.02em; }
nav { display: flex; flex: 0 1 auto; margin-left: auto; overflow-x: auto; min-width: 0; }
nav a { text-decoration: none; padding: 10px 14px; min-height: 40px; font-size: 13px; font-weight: 700; letter-spacing: -.01em;
  border: 1px solid var(--linie); margin-left: -1px; white-space: nowrap; background: var(--papier); }
nav a:first-child { margin-left: 0; }
nav a:hover { background: var(--arbeitsflaeche); }
nav a.active { background: var(--tinte); color: var(--papier); position: relative; z-index: 1; }

/* --- Seite ------------------------------------------------------------------ */
main { padding: 32px var(--rand) 80px; }
h1 { margin: 0 0 28px; font-size: clamp(36px, 5vw, 56px); line-height: .95; letter-spacing: -.045em; font-weight: 700;
  display: flex; align-items: flex-end; justify-content: space-between; gap: var(--gasse); flex-wrap: wrap; }
h1 a { text-decoration: none; color: var(--still); }
h1 a:hover { color: var(--tinte); }
h1 .meta { font-size: 11px; font-weight: 500; letter-spacing: .13em; text-transform: uppercase; color: var(--still); }
/* Jede Feldgruppe beginnt mit einer Linie und einem Versal-Label */
h2 { margin: 36px 0 14px; padding-top: 12px; border-top: 1px solid var(--linie);
  font-size: 11px; font-weight: 500; letter-spacing: .13em; text-transform: uppercase; color: var(--still); }
h2.flush { margin-top: 0; }
/* Unter einem Abschnittstitel keine zweite Linie */
h2 + .panel, h2 + table, h2 + .empty { border-top: 0; padding-top: 4px; }
.meta { color: var(--still); font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
code { font: 500 13px/1.4 ui-monospace, Consolas, monospace; background: var(--arbeitsflaeche); padding: 1px 5px; }

/* Panel = Rasterzelle: Linie oben, keine Box */
.panel { border-top: 1px solid var(--linie); padding: 16px 0 4px; }
.panel ol { margin: 0; padding-left: 20px; }
.panel li { margin: 0 0 6px; }
.empty { color: var(--still); padding: 18px 0; border-top: 1px solid var(--linie-still); }

/* --- Kennzahlen: Rasterzellen mit großer Zahl ------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 28px var(--gasse); }
.kpi { border-top: 1px solid var(--linie); padding-top: 12px; display: flex; flex-direction: column-reverse; gap: 6px; }
.kpi b { font-size: 40px; line-height: 1; font-weight: 700; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 11px; font-weight: 500; letter-spacing: .13em; text-transform: uppercase; color: var(--still); }

/* --- Bildschirme: Zellen mit Linie oben, Vorschau auf Arbeitsfläche --------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 32px var(--gasse); }
.card { border-top: 1px solid var(--linie); display: flex; flex-direction: column; min-width: 0; position: relative; }
.card::before { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 2px; background: var(--tinte);
  transform: scaleX(0); transform-origin: left; transition: transform .3s cubic-bezier(.16,.84,.26,1); }
.card:hover::before, .card:focus-within::before { transform: scaleX(1); }
.card .thumb { margin-top: 14px; aspect-ratio: 16/9; background: var(--arbeitsflaeche); display: grid; place-items: center;
  color: var(--still); font-size: 11px; letter-spacing: .13em; text-transform: uppercase; overflow: hidden; }
.card .thumb.portrait { aspect-ratio: 9/16; max-height: 260px; }
.card .thumb img { width: 100%; height: 100%; object-fit: contain; }
.card .body { padding: 12px 0 0; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card .title { font-size: 20px; line-height: 1.1; font-weight: 700; letter-spacing: -.03em;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; min-width: 0; }
.card .title a { text-decoration: none; overflow-wrap: anywhere; }

/* Status-Kennzeichen: zarte Fläche + eckiges 10-px-Quadrat + schwarze Schrift */
.kennzeichen { display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px; flex: none;
  font-size: 13px; font-weight: 500; line-height: 1.2; letter-spacing: -.005em; color: var(--tinte); background: var(--k-zart); }
.kennzeichen::before { content: ""; flex: none; width: 10px; height: 10px; background: var(--k); }
.s-normal { --k: var(--gruen); --k-zart: var(--gruen-zart); }
.s-warning { --k: var(--gelb); --k-zart: var(--gelb-zart); }
.s-offline { --k: var(--koralle); --k-zart: var(--koralle-zart); }
.s-deactivated { --k: var(--linie-still); --k-zart: var(--arbeitsflaeche); }

/* --- Knöpfe: gerade Kanten, aktiv schwarz gefüllt, mind. 44 px -------------- */
button, .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 12px 18px;
  font: 700 14px/1 var(--schrift); letter-spacing: -.01em; cursor: pointer; text-decoration: none;
  border: 1px solid var(--linie-still); background: var(--papier); color: var(--tinte); border-radius: 0; }
button:hover, .btn:hover { border-color: var(--tinte); }
button.primary, a.btn.primary { background: var(--tinte); border-color: var(--tinte); color: var(--papier); }
button.primary:hover, a.btn.primary:hover { opacity: .84; }
/* Gefährliche Aktionen: keine rote Fläche (Alarm nur für echte Fehler), schwarze Kontur */
button.danger { border-color: var(--tinte); }
button.ghost { border-color: transparent; background: none; }
button.ghost:hover { border-color: var(--tinte); }
button.small { min-height: 36px; padding: 9px 12px; font-size: 13px; }
button:disabled, button:disabled:hover { background: #e6e6e6; border-color: #e6e6e6; color: #9b9b9b; cursor: not-allowed; opacity: 1; }

/* --- Felder ------------------------------------------------------------------ */
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; letter-spacing: -.01em; color: var(--tinte); }
input, select, textarea { width: 100%; min-width: 0; min-height: 44px; font: 400 15px/1.4 var(--schrift); color: var(--tinte);
  padding: 10px 12px; border: 1px solid var(--linie-still); border-radius: 0; background: var(--papier); }
input:hover, select:hover, textarea:hover { border-color: #a9a9a9; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--tinte); outline-offset: 0; border-color: var(--tinte); }
input[type=checkbox] { width: 20px; min-height: 20px; height: 20px; accent-color: var(--tinte); }
input.auto { width: auto; }
h1 .row select, h1 .row button { width: auto; font-size: 14px; letter-spacing: -.01em; }
h1 .row select { font-weight: 400; }
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px var(--gasse); align-items: end; }

/* --- Tabellen: Linie oben, Haarlinien, Versal-Kopf --------------------------- */
table { width: 100%; border-collapse: collapse; border-top: 1px solid var(--linie); }
th, td { text-align: left; padding: 11px 12px 11px 0; border-bottom: 1px solid var(--linie-still); vertical-align: top; }
th { font-size: 11px; font-weight: 500; letter-spacing: .13em; text-transform: uppercase; color: var(--still); }
td { font-size: 15px; }
td.pre { white-space: pre-wrap; }
tbody tr:hover td { background: var(--arbeitsflaeche); }
tr.missing td { color: var(--still); }
.cthumb { width: 72px; height: 44px; overflow: hidden; background: var(--arbeitsflaeche); }
.cthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* --- Anmeldung --------------------------------------------------------------- */
.login { max-width: 480px; margin: 12vh 0 0; }
.login h1 { margin-bottom: 14px; }
.login .meta { font-size: 15px; margin: 0 0 22px; }

/* --- Rückmeldung: Leiste unten wie in der Werkzeugseite ---------------------- */
#toast { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--papier); color: var(--tinte);
  border-top: 1px solid var(--linie); padding: 14px var(--rand); font-size: 14px; display: flex; align-items: center; gap: 10px; }
#toast::before { content: ""; flex: none; width: 10px; height: 10px; background: var(--gruen); }
#toast.err { color: var(--alarm); font-weight: 700; }
#toast.err::before { background: var(--alarm); }

/* --- Dialog: gerade Kanten, Linie oben ---------------------------------------- */
dialog { border: 0; border-top: 2px solid var(--tinte); padding: 24px; background: var(--papier); color: var(--tinte);
  width: min(560px, 92vw); border-radius: 0; }
dialog::backdrop { background: rgba(17,17,17,.45); }
dialog h2 { margin-top: 0; border-top: 0; padding-top: 0; }
.code-input { font-size: 36px; font-weight: 700; letter-spacing: .2em; text-align: center; font-variant-numeric: tabular-nums; }
.items { display: flex; flex-direction: column; margin: 8px 0 16px; border-top: 1px solid var(--linie); }
.items .it { display: grid; grid-template-columns: 1fr 90px auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--linie-still); }

@media (max-width: 700px) {
  .top { gap: 10px; }
  nav { margin-left: 0; flex-basis: 100%; }
  main { padding-top: 24px; }
  .kpi b { font-size: 32px; }
}
@media (prefers-reduced-motion: reduce) { .card::before { transition: none; } }

/* Abmelden wie in PosioGO: schlichter Textlink im Kopf (.nutzer a) */
#logout { order: 3; min-height: 0; padding: 4px 0; border: 0; background: none; font: 400 13px/1.3 var(--schrift);
  color: var(--still); text-decoration: underline; text-underline-offset: 2px; }
#logout:hover { color: var(--tinte); }
nav { order: 2; }
@media (max-width: 1000px) {
  #logout { margin-left: auto; order: 2; }
  nav { order: 3; margin-left: 0; flex-basis: 100%; }
}
