/*
 * Werkstatt-/Diagnose-Ästhetik (Automotive + IT).
 *
 * Systemschriften statt Google Fonts: Der Prototyp lud sie von
 * fonts.googleapis.com nach, was bei jedem Aufruf die IP jedes Nutzers zu
 * Google schickte - bei Personendaten heikel - und in abgeschotteten Netzen
 * ohnehin nicht funktionierte.
 */
:root {
  --bg: #14171C;
  --surface: #1E232B;
  --surface-2: #262C36;
  --border: #2B313B;
  --text: #E8EAED;
  --muted: #8B93A1;
  --primary: #FF6A13;
  --accent: #4C8DFF;
  --green: #3ECF8E;
  --amber: #FFB020;
  --red: #FF5C5C;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: "Segoe UI Semibold", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  --font-mono: "Cascadia Mono", "JetBrains Mono", Consolas, "SF Mono", Menlo, "DejaVu Sans Mono", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  display: flex;
  min-height: 100vh;
}

h1, h2, h3 {
  font-family: var(--font-head);
  letter-spacing: .02em;
  text-transform: uppercase;
  margin: 0 0 .6rem 0;
}
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; margin-top: 2rem; }
h3 { font-size: 1rem; margin-top: 1.4rem; }

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

/* ---------- Seitenleiste ---------- */
.seitenleiste {
  width: 250px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1rem .8rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: sticky;
  top: 0;
  align-self: flex-start;
  max-height: 100vh;
  overflow-y: auto;
}
.marke {
  display: flex; align-items: center; gap: .6rem;
  padding: .3rem .3rem 1rem .3rem;
  border-bottom: 1px solid var(--border); margin-bottom: 1rem;
}
.marke .punkt {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary); box-shadow: 0 0 8px var(--primary);
}
.marke-name { font-family: var(--font-head); font-weight: 700; font-size: .95rem; letter-spacing: .04em; line-height: 1.1; }
.marke-sub { font-size: .68rem; color: var(--muted); }

.nav-gruppe {
  font-family: var(--font-head); text-transform: uppercase; letter-spacing: .08em;
  font-size: .66rem; color: var(--muted); margin: 1rem .4rem .3rem .4rem;
}
.nav-punkt {
  display: flex; align-items: center; gap: .55rem;
  padding: .42rem .5rem; border-radius: 5px;
  color: var(--text); text-decoration: none; font-size: .9rem;
  border-left: 3px solid transparent;
}
.nav-punkt:hover { background: var(--surface-2); }
.nav-punkt.aktiv { background: var(--surface-2); border-left-color: var(--primary); font-weight: 600; }
.nav-icon { width: 1.2rem; text-align: center; }

.seitenleiste-fuss { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border); }
.benutzer { font-size: .85rem; margin-bottom: .5rem; }
.benutzer .rolle { color: var(--muted); font-size: .78rem; }
.warnung-klein {
  font-size: .75rem; color: var(--amber); background: rgba(255,176,32,.1);
  border: 1px solid rgba(255,176,32,.3); border-radius: 4px;
  padding: .3rem .5rem; margin-bottom: .5rem;
}

/* ---------- Hauptbereich ---------- */
main { flex: 1; min-width: 0; }
main.ohne-leiste { display: flex; align-items: flex-start; justify-content: center; padding-top: 6vh; }
.inhalt { padding: 1.6rem 2rem 4rem 2rem; max-width: 1500px; }
main.ohne-leiste .inhalt { width: 100%; max-width: 480px; padding-top: 0; }

.streifen {
  height: 6px; border-radius: 3px; margin: .2rem 0 1.4rem 0;
  background: repeating-linear-gradient(135deg, var(--primary) 0 10px, var(--surface) 10px 20px);
}
.hinweis { color: var(--muted); font-size: .87rem; }

/* ---------- Kennzahlen ---------- */
.kpi-reihe { display: flex; gap: .9rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-top: 3px solid var(--primary); border-radius: 6px;
  padding: .8rem 1.1rem; min-width: 150px; flex: 1;
}
.kpi-label {
  font-family: var(--font-head); text-transform: uppercase;
  letter-spacing: .08em; font-size: .68rem; color: var(--muted);
}
.kpi-wert { font-family: var(--font-mono); font-size: 1.7rem; font-weight: 600; line-height: 1.3; }

/* ---------- Tabellen ---------- */
.tabelle-rahmen { overflow-x: auto; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .86rem; }
th, td { text-align: left; padding: .45rem .7rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
th {
  font-family: var(--font-head); text-transform: uppercase; letter-spacing: .05em;
  font-size: .7rem; color: var(--muted); background: var(--surface-2);
  position: sticky; top: 0; z-index: 1;
}
tbody tr:hover { background: var(--surface-2); }
td.mono, .mono { font-family: var(--font-mono); font-size: .82rem; }
tr:last-child td { border-bottom: none; }

/* ---------- Formulare ---------- */
form { margin: 0; }
.feld { margin-bottom: .85rem; }
label { display: block; font-size: .8rem; color: var(--muted); margin-bottom: .25rem; }
input[type=text], input[type=password], input[type=search], input[type=number],
select, textarea {
  width: 100%; padding: .45rem .6rem;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 5px;
  font-family: var(--font-ui); font-size: .9rem;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[disabled], textarea[disabled] { color: var(--muted); background: var(--surface); }
textarea { min-height: 70px; resize: vertical; }
.feld-reihe { display: flex; gap: .8rem; flex-wrap: wrap; }
.feld-reihe > .feld { flex: 1; min-width: 200px; }

button, .knopf {
  padding: .45rem .95rem; border-radius: 5px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font-family: var(--font-ui); font-size: .88rem; text-decoration: none;
  display: inline-block;
}
button:hover, .knopf:hover { background: var(--border); }
button.primaer { background: var(--primary); border-color: var(--primary); color: #14171C; font-weight: 600; }
button.primaer:hover { filter: brightness(1.1); }
button.gefahr { border-color: var(--red); color: var(--red); }
button.gefahr:hover { background: rgba(255,92,92,.15); }
button[disabled] { opacity: .45; cursor: not-allowed; }
.knopf-neben { width: 100%; }
.knopf-reihe { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }

/* ---------- Meldungen ---------- */
.meldung {
  padding: .6rem .9rem; border-radius: 5px; margin-bottom: .9rem;
  border-left: 3px solid var(--muted); background: var(--surface); font-size: .88rem;
}
.meldung.success { border-left-color: var(--green); }
.meldung.error   { border-left-color: var(--red); }
.meldung.warning { border-left-color: var(--amber); }
.meldung.info    { border-left-color: var(--accent); }

/* ---------- Karten ---------- */
.karte {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 1rem 1.2rem; margin-bottom: 1rem;
}
.geraete-karte { border-left: 3px solid var(--accent); overflow-wrap: anywhere; }
.geraete-titel {
  font-family: var(--font-head); font-weight: 600; text-transform: uppercase;
  letter-spacing: .03em; margin-bottom: .4rem;
}
.geraete-feld { font-family: var(--font-mono); font-size: .8rem; color: var(--muted); margin: .12rem 0; }
.geraete-feld b { color: var(--text); font-weight: 500; }

.id-karte {
  background: linear-gradient(135deg, var(--surface) 0%, var(--bg) 100%);
  border: 1px solid var(--border); border-top: 4px solid var(--primary);
  border-radius: 8px; padding: 1.1rem 1.3rem; margin-bottom: 1.2rem; overflow-wrap: anywhere;
}
.id-nummer { font-family: var(--font-mono); color: var(--primary); font-size: .92rem; }
.id-name { font-family: var(--font-head); font-weight: 700; font-size: 1.35rem; text-transform: uppercase; }

.abzeichen {
  display: inline-block; padding: .12rem .55rem; border-radius: 3px;
  font-family: var(--font-mono); font-size: .72rem;
  border: 1px solid var(--border); background: var(--surface); margin-right: .3rem;
}
.led { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.led-green { background: var(--green); box-shadow: 0 0 6px var(--green); }
.led-grey  { background: var(--muted); }

/* ---------- Spalten ---------- */
.spalten { display: flex; gap: 1.2rem; flex-wrap: wrap; }
.spalten > * { flex: 1; min-width: 280px; }

details { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: .6rem .9rem; margin-bottom: 1rem; }
summary { cursor: pointer; font-weight: 600; }
details[open] summary { margin-bottom: .7rem; }

code, pre {
  font-family: var(--font-mono); font-size: .82rem;
  background: var(--bg); border: 1px solid var(--border); border-radius: 4px;
}
code { padding: .12rem .35rem; }
pre { padding: .7rem .9rem; overflow-x: auto; }

.werkzeugleiste { display: flex; gap: .8rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1rem; }
.werkzeugleiste .feld { margin-bottom: 0; }
.aufdecken { display: flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--muted); }
.aufdecken input { width: auto; }

.paginierung { margin-top: .8rem; font-size: .82rem; color: var(--muted); }

@media (max-width: 820px) {
  body { flex-direction: column; }
  .seitenleiste { width: 100%; position: static; max-height: none; min-height: 0; }
  .inhalt { padding: 1rem; }
}
