:root {
  --bg: #06070d;
  --grid: rgba(120, 140, 255, 0.06);
  --surface: rgba(20, 23, 42, 0.86);
  --surface-2: #171b33;
  --text: #eef1ff;
  --text-soft: #a9b0d6;
  --muted: #7d84a8;
  --border: rgba(140, 150, 255, 0.16);
  --g: linear-gradient(135deg, #2dd4bf 0%, #0d9488 60%, #134e4a 120%);
  --accent: #2dd4bf;
  --ok: #22e07a;
  --warn: #ffb020;
  --off: #ff5c7c;
}
* { box-sizing: border-box; margin: 0; }
body {
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(13, 148, 136, 0.20), transparent 60%),
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 32px 32px,
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  display: flex; flex-direction: column; align-items: center;
  padding: 20px 16px 28px;
}
header.top, nav.tabs, main, footer { width: 100%; max-width: 760px; }

header.top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.home {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  text-decoration: none; font-size: 18px;
}
/* Kennzeichnungen brechen unter den Titel um, statt den Pfeil in eine eigene Zeile zu schieben */
.title { display: flex; align-items: baseline; gap: 10px; flex: 1; flex-wrap: wrap; row-gap: 4px; min-width: 0; }
h1 {
  font-size: 26px; font-weight: 800;
  background: linear-gradient(90deg, #fff, #99f6e4 60%, #2dd4bf);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.proto {
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--warn);
  border: 1px solid rgba(255, 176, 32, .4); border-radius: 999px; padding: 2px 8px;
}
/* Benutzerkonto der Firmen-Apps: wer angemeldet ist */
.wer { font-size: 12px; font-weight: 600; color: var(--text-soft); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.wer:empty { display: none; }

select, input, button, textarea { font: inherit; color: inherit; }
select, textarea, input[type="text"], input[type="number"], input[type="date"] {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px; width: 100%; min-width: 0; color-scheme: dark;
}
textarea { resize: vertical; }
input:focus-visible, select:focus-visible, button:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

nav.tabs { display: flex; gap: 6px; margin: 18px 0 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 4px; }
nav.tabs button { flex: 1; background: none; border: 0; border-radius: 10px; padding: 10px 6px; color: var(--text-soft); cursor: pointer; font-weight: 600; }
nav.tabs button.on { background: var(--g); color: #fff; }

button { cursor: pointer; }
.primary, .ghost, .danger {
  border-radius: 14px; padding: 12px 18px; font-weight: 700; border: 1px solid transparent;
}
.primary { background: var(--g); color: #fff; }
.ghost { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.danger { background: none; border-color: rgba(255, 92, 124, .5); color: var(--off); }
.big { width: 100%; padding: 18px; font-size: 18px; margin-bottom: 18px; }
.klein { padding: 8px 12px; font-size: 13px; border-radius: 10px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  padding: 16px; margin-bottom: 10px; backdrop-filter: blur(10px);
}
.card h3 { font-size: 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; overflow-wrap: anywhere; }
.card.storniert { opacity: .55; }
.card.storniert h3 > span:first-child { text-decoration: line-through; }
h2.abschnitt { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 20px 4px 10px; }
.muted { color: var(--muted); font-size: 13px; }
.text { color: var(--text-soft); font-size: 14px; margin-top: 6px; overflow-wrap: anywhere; white-space: pre-wrap; }
.empty { text-align: center; color: var(--text-soft); padding: 28px 16px; line-height: 1.5; }
.gap {
  border: 1px dashed rgba(255, 176, 32, .6); color: var(--warn); border-radius: 12px;
  padding: 8px 12px; margin-bottom: 10px; font-size: 14px;
}
.gap.rot { border-color: rgba(255, 92, 124, .7); color: var(--off); }

.badge { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 9px; border: 1px solid currentColor; white-space: nowrap; flex: none; }
.badge.ok, .badge.frei { color: var(--ok); }
.badge.bald, .badge.ausgegeben { color: var(--warn); }
.badge.ueberfaellig, .badge.fehlt, .badge.storno { color: var(--off); }
.badge.ausgemustert, .badge.art { color: var(--muted); }

/* Stand je Benutzer und Thema, Verlauf */
.zeile { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--border); font-size: 14px; }
.zeile:first-of-type { margin-top: 10px; }
.zeile .was { min-width: 0; overflow-wrap: anywhere; }
.zeile .was .muted { display: block; margin-top: 2px; }
.zeile .knoepfe { display: flex; gap: 6px; flex: none; }
details { margin-top: 10px; font-size: 13px; color: var(--text-soft); }
details summary { cursor: pointer; font-weight: 600; }
details ul { list-style: none; padding: 0; margin-top: 6px; display: grid; gap: 8px; }
details li { overflow-wrap: anywhere; }
details li.storniert { text-decoration: line-through; opacity: .7; }
.links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.links a { text-decoration: none; display: inline-block; }

/* Formulare */
form.inline { display: grid; gap: 10px; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--text-soft); min-width: 0; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
fieldset { border: 0; padding: 0; min-width: 0; }
legend { font-size: 13px; color: var(--text-soft); margin-bottom: 6px; }
.wahl { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.wahl label { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; color: var(--text); cursor: pointer; }
.wahl input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.error { color: var(--off); font-weight: 600; }
.error:empty, .hint:empty { display: none; }
.hint { color: var(--text-soft); font-size: 14px; }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
[hidden] { display: none !important; }

dialog {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px); margin: auto;
  background: #0e1122; color: var(--text); border: 1px solid var(--border); border-radius: 22px; padding: 20px;
}
dialog::backdrop { background: rgba(3, 4, 10, .72); backdrop-filter: blur(3px); }
dialog form { display: grid; gap: 12px; }
dialog h2 { font-size: 20px; overflow-wrap: anywhere; }

footer { margin-top: auto; padding-top: 28px; font-size: 12px; color: var(--muted); text-align: center; }

@media (max-width: 560px) {
  nav.tabs button { font-size: 13px; padding: 10px 2px; }
}

/* Ausdruck: das Kalibrierprotokoll steht in #druck, alles andere bleibt weg */
#druck { display: none; }
@media print {
  body { background: #fff; color: #000; padding: 0; display: block; }
  body.nur-druck > *:not(#druck) { display: none !important; }
  body.nur-druck #druck { display: block; }
  #druck { font-size: 14px; line-height: 1.5; }
  #druck h2 { font-size: 20px; margin-bottom: 12px; }
  #druck table { width: 100%; border-collapse: collapse; margin: 14px 0; }
  #druck th, #druck td { border: 1px solid #000; padding: 8px; text-align: left; vertical-align: top; }
  #druck td.unterschrift { height: 44px; width: 55%; }
  #druck .feld { margin-top: 44px; border-top: 1px solid #000; padding-top: 4px; width: 60%; }
  #druck .klein { font-size: 11px; color: #333; margin-top: 18px; padding: 0; }
  nav.tabs, .home, .links, footer, .proto, .knoepfe, .big { display: none; }
  h1 { color: #000; -webkit-text-fill-color: #000; background: none; }
  .card { border: 1px solid #999; background: none; backdrop-filter: none; }
  .muted, .text { color: #333; }
}

/* ---- Prüfmittel ---- */
.buttons { display: grid; }
.kennzahlen { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 10px; }
@media (min-width: 561px) { .kennzahlen { grid-template-columns: repeat(4, 1fr); } }
.kennzahlen .card { margin: 0; padding: 12px 14px; }
.stat span { font-size: 13px; color: var(--text-soft); }
.stat b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.stat b.rot { color: var(--off); }
.stat b.gelb { color: var(--warn); }
.karte { display: grid; gap: 4px; width: 100%; text-align: left; cursor: pointer; }
.karte.leise { opacity: .55; }
.kopf { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.kopf .name { font-weight: 700; overflow-wrap: anywhere; min-width: 0; }
.kopf h3 { min-width: 0; overflow-wrap: anywhere; }
.karte .sub { color: var(--text-soft); font-size: 14px; overflow-wrap: anywhere; }
.karte .sub.muted { color: var(--muted); font-size: 13px; }
.badge.gesperrt { color: #fff; background: var(--off); border-color: var(--off); }
.badge.ohne_intervall, .badge.ausgesondert { color: var(--muted); }
.liste { list-style: none; padding: 0; display: grid; gap: 0; margin-top: 8px; }
.liste li { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); font-size: 14px; }
.liste li > span:first-child { min-width: 0; overflow-wrap: anywhere; line-height: 1.5; }
.liste li.weg > span:first-child { opacity: .55; }
.liste.verlauf li.weg > span:first-child b { text-decoration: line-through; }
.knoepfe { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; flex: none; max-width: 45%; }
#druck th { width: 34%; }

/* Messpunkte im Formular: vier Felder und ein Knopf, auf dem Handy zwei mal zwei */
.punkt { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 6px; margin-bottom: 10px; align-items: end; }
.punkt label { font-size: 12px; gap: 3px; }
.punkt .befund { grid-column: 1 / -1; }
.punkt .befund:empty { display: none; }
.punkt input { padding: 9px 8px; }
@media (max-width: 560px) {
  .punkt { grid-template-columns: repeat(2, minmax(0, 1fr)) auto; }
  .punkt button { grid-column: 3; grid-row: 1 / span 2; align-self: stretch; }
}
select:disabled { opacity: .75; }
.liste details ul { gap: 4px; }
#druck table.punkte th { width: auto; }
#druck table.punkte th, #druck table.punkte td { padding: 5px; font-size: 12px; }
