:root {
  --red:        #d90128;
  --red-dark:   #a80020;
  --maroon:     #6e0016;
  --maroon-dark:#4a000f;
  --black:      #1a1a1a;
  --white:      #ffffff;
  --gray-bg:    #f7f3f1;
  --gray-mid:   #e5ded9;
  --gray-txt:   #5c5450;
  --green:      #2e8b3d;
  --green-dark: #216b2c;
  --green-light:#71c17e;
  --red-light:  #ef7c8e;
  --amber:      #f2c30f;
  --amber-dark: #b98600;
  --blue:       #1565c0;
  --blue-dark:  #0d47a1;
  --font-sans: 'Poppins', sans-serif;
  --font-mono: 'Poppins', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--gray-bg);
  color: var(--black);
  font-size: 16px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }

/* ── TOPBAR ────────────────────────────────────────────────────────────────
   Maroon statt Schwarz: die Werbematerialien sind komplett rot-dominiert, Schwarz
   kommt dort nur als winziger Icon-Akzent vor. Ein sattes Dunkelrot als Chrome-
   Farbe holt die Marke sofort in die App, ohne die Lesbarkeit zu verlieren. */
.topbar {
  background: linear-gradient(120deg, var(--maroon-dark), var(--maroon) 70%);
  min-height: 56px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 3px solid var(--red);
}
.logo { display: flex; align-items: center; gap: 11px; min-width: 0; }
.logo-icon { width: 30px; height: 30px; background: var(--black); display: flex; align-items: center; justify-content: center; flex-shrink: 0; border-radius: 8px; }
.logo-icon svg { width: 18px; height: 18px; }
.logo-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.logo-app { font-weight: 800; font-size: 1.15rem; color: var(--white); letter-spacing: 0.01em; line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 8px; }
.logo-mode-badge { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; background: rgba(0,0,0,0.28); color: rgba(255,255,255,0.85); padding: 3px 8px; border-radius: 20px; }
.logo-wordmark { font-weight: 600; font-size: 0.62rem; color: rgba(255,255,255,0.55); text-transform: uppercase; letter-spacing: 0.09em; line-height: 1.1; }
.logo-wordmark span { color: rgba(255,255,255,0.85); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-chip { font-size: 0.85rem; font-weight: 500; color: var(--white); background: rgba(255,255,255,0.14); padding: 6px 13px; border-radius: 20px; }

/* ── LAYOUT ────────────────────────────────────────────────────────────── */
.app-shell { max-width: 760px; margin: 0 auto; padding: 28px 20px 70px; }
.screen { display: none; }
.screen.active { display: block; animation: fade-in 0.2s ease-out; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.hidden { display: none !important; }

/* Auf breiten Desktop-Bildschirmen bleibt der Arbeitsbereich fokussiert schmal
   (lange Zeilen sind schlechter lesbar), der Rand bekommt dafür ein ruhiges,
   markiges Wasserzeichen statt einfach leer zu bleiben. */
body {
  background-image:
    radial-gradient(1100px 800px at 100% -10%, rgba(217,1,40,0.05), transparent 55%),
    radial-gradient(900px 700px at -10% 110%, rgba(110,0,22,0.05), transparent 55%);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.card { background: var(--white); border: 1px solid var(--gray-mid); border-radius: 10px; padding: 20px; }
.section-label {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--gray-txt); margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.section-label::before { content: ''; width: 3px; height: 13px; background: var(--red); flex-shrink: 0; }

/* ── BUTTONS ───────────────────────────────────────────────────────────── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  border: none; border-radius: 10px; font-weight: 800; letter-spacing: 0.02em;
  padding: 16px 20px; font-size: 1.05rem; width: 100%;
  transition: transform 0.08s ease, box-shadow 0.15s ease, background 0.15s ease;
  text-transform: uppercase;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--red); color: var(--white); }
.btn-primary:not(:disabled):hover { background: var(--red-dark); }
.btn-success { background: var(--green); color: var(--white); }
.btn-success:not(:disabled):hover { background: var(--green-dark); }
.btn-warn { background: var(--amber); color: var(--black); }
.btn-warn:not(:disabled):hover { background: var(--amber-dark); }
.btn-info { background: var(--blue); color: var(--white); }
.btn-info:not(:disabled):hover { background: var(--blue-dark); }
.btn-outline { background: var(--white); color: var(--black); border: 2px solid var(--gray-mid); }
.btn-outline:not(:disabled):hover { border-color: var(--black); }
.btn-danger-outline { background: var(--white); color: var(--red); border: 2px solid var(--red); }
.btn-danger-outline:not(:disabled):hover { background: #fff0f2; }
.btn-text { background: none; color: var(--gray-txt); text-transform: none; font-weight: 500; padding: 10px; width: auto; }
.btn-sm { width: auto; padding: 9px 16px; font-size: 0.78rem; border-radius: 8px; flex-shrink: 0; }
.btn-xl { padding: 34px 20px; font-size: 1.35rem; border-radius: 16px; }
.btn-xl svg { width: 30px; height: 30px; }

/* ── HEADINGS ──────────────────────────────────────────────────────────── */
.page-heading { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 4px; }
.page-sub { color: var(--gray-txt); font-size: 0.95rem; font-weight: 500; margin-bottom: 22px; }

/* ── LOGIN (Hero-Split, für Desktop-Arbeitsplätze konzipiert) ─────────────
   Läuft ausschließlich am PC, nie mobil — deshalb volles Zweispalten-Layout
   statt einer schmalen, zentrierten Karte. Links: Marke im Stil der XXL-Kampagnen
   (diagonale Bänder, große Wortmarke, Tagline). Rechts: die eigentliche Anmeldung. */
.login-screen.screen.active { display: grid; }
.login-screen { grid-template-columns: minmax(400px, 47%) 1fr; min-height: calc(100vh - 56px); }
.login-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, var(--red) 0%, var(--maroon) 100%);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 48px 44px; color: var(--white);
}
.login-hero-band {
  position: absolute; background: rgba(0,0,0,0.16); border-radius: 45% 55% 60% 40% / 50% 40% 60% 50%;
}
.login-hero-band.b1 { width: 140%; height: 46%; top: -14%; left: -30%; transform: rotate(-20deg); }
.login-hero-band.b2 { width: 130%; height: 40%; bottom: -12%; right: -35%; transform: rotate(-20deg); background: rgba(0,0,0,0.12); }
.login-hero-top, .login-hero-bottom { position: relative; z-index: 1; }
.login-hero-mark { display: flex; align-items: center; gap: 12px; margin-bottom: 40px; animation: hero-rise 0.6s ease-out both; }
.login-hero-icon { width: 46px; height: 46px; background: var(--black); border-radius: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.login-hero-icon svg { width: 28px; height: 28px; }
.login-hero-wordmark { font-size: 1.05rem; font-weight: 500; letter-spacing: 0.01em; }
.login-hero-wordmark b { font-weight: 900; }
.login-hero-location { display: block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.14em; color: rgba(255,255,255,0.7); }
.login-hero-product { font-size: 3.6rem; font-weight: 900; line-height: 0.95; letter-spacing: -0.02em; margin-bottom: 14px; animation: hero-rise 0.6s ease-out 0.1s both; }
.login-hero-tagline { font-size: 1.15rem; font-weight: 600; max-width: 22ch; color: rgba(255,255,255,0.92); animation: hero-rise 0.6s ease-out 0.2s both; }
.login-hero-foot { position: relative; z-index: 1; font-size: 0.78rem; font-weight: 500; color: rgba(255,255,255,0.65); animation: hero-rise 0.6s ease-out 0.3s both; }
@keyframes hero-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.login-form-panel {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; padding: 40px;
  background-image: radial-gradient(640px 480px at 108% 8%, rgba(217,1,40,0.055), transparent 60%),
                     radial-gradient(520px 420px at -8% 100%, rgba(110,0,22,0.05), transparent 60%);
}
.login-form-card { position: relative; z-index: 1; width: 100%; max-width: 420px; animation: hero-rise 0.5s ease-out 0.15s both; }
.login-form-eyebrow { display: flex; align-items: center; gap: 8px; margin-bottom: 22px; }
.login-form-eyebrow-bar { width: 3px; height: 13px; background: var(--red); flex-shrink: 0; }
.login-form-eyebrow-text { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--gray-txt); }

.monteur-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.monteur-btn {
  background: var(--white); border: 2px solid var(--gray-mid); border-radius: 12px;
  padding: 22px 12px; font-size: 1.1rem; font-weight: 700; text-align: center;
  min-height: 84px; display: flex; align-items: center; justify-content: center;
}
.monteur-btn:active { transform: scale(0.97); }
.monteur-btn:hover { border-color: var(--red); color: var(--red); }
.monteur-btn.add-new { border-style: dashed; color: var(--gray-txt); font-weight: 500; text-transform: none; font-size: 1rem; }
.new-monteur-form { margin-top: 16px; display: flex; gap: 10px; }
.new-monteur-form input { flex: 1; }

@media (max-width: 860px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-hero { padding: 36px 28px; min-height: 260px; }
  .login-hero-product { font-size: 2.6rem; }
}

/* ── FORM ELEMENTS ─────────────────────────────────────────────────────── */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 0.85rem; font-weight: 700; margin-bottom: 8px; }
.field input[type="text"], .field input[type="time"], .field textarea, .field select {
  width: 100%; padding: 16px; font-size: 1.15rem; border: 2px solid var(--gray-mid);
  border-radius: 10px; background: var(--white); appearance: none; -webkit-appearance: none;
}
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 18px; padding-right: 44px;
}
.field input[type="text"]:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--red); }
.field textarea { resize: vertical; min-height: 80px; font-size: 1rem; }
.hint { font-size: 0.8rem; color: var(--gray-txt); margin-top: 6px; }
.error-msg { background: #fff0f2; border: 1px solid var(--red); color: var(--red-dark); padding: 12px 14px; border-radius: 8px; font-size: 0.9rem; margin-bottom: 16px; }

.sondertaetigkeit-row { display: flex; gap: 12px; }
.sondertaetigkeit-row .field { flex: 1; }
.sondertaetigkeiten-liste:not(:empty) { margin: -6px 0 18px; }
.sondertaetigkeit-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--gray-bg); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; font-size: 0.86rem;
}
.sondertaetigkeit-item-zeit { font-family: var(--font-mono); font-weight: 700; flex-shrink: 0; }
.sondertaetigkeit-item-art { color: var(--gray-txt); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; padding: 0 8px; }
.sondertaetigkeit-item-edit { background: none; border: none; color: var(--gray-txt); font-size: 1rem; line-height: 1; padding: 2px 4px; flex-shrink: 0; }
.sondertaetigkeit-item-remove { background: none; border: none; color: var(--red); font-weight: 800; font-size: 1.1rem; line-height: 1; padding: 2px 4px; flex-shrink: 0; }
/* Aus einer Unterbrechung übernommener Vorschlag — leicht abgesetzt, mit Checkbox statt ×-Entfernen,
   da der Mechaniker hier nur an-/abwählt statt einen Datensatz zu löschen. */
.sondertaetigkeit-item--vorschlag { background: #fff4d6; }
.sondertaetigkeit-item-check { display: flex; align-items: center; flex-shrink: 0; }
.sondertaetigkeit-item-check input { width: 18px; height: 18px; accent-color: var(--red); }
.sondertaetigkeit-item-tag { color: var(--amber-dark); font-size: 0.68rem; font-style: italic; flex-shrink: 0; }

/* ── HOME ──────────────────────────────────────────────────────────────── */
.home-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.home-actions { display: flex; flex-direction: column; gap: 12px; margin-bottom: 30px; }
/* Unterbrochene Reparaturen dürfen mehrfach parallel offen sein — eigene Karte auf dem Home-Screen,
   damit der Monteur bewusst auswählt, welche er fortsetzen will. Amber-Akzent wie bei Pausiert-Status. */
.unterbrochen-card { border-color: var(--amber); background: #fffaf0; margin-bottom: 20px; }
.unterbrochen-card .section-label { margin-bottom: 12px; }
.unterbrochen-item { background: var(--white); border: 1px solid var(--gray-mid); border-radius: 10px; padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.unterbrochen-item + .unterbrochen-item { margin-top: 10px; }
.unterbrochen-item-main { flex: 1; min-width: 0; }
.unterbrochen-item-titel { font-weight: 700; font-size: 0.95rem; }
.unterbrochen-item-meta { font-size: 0.8rem; color: var(--gray-txt); }
.own-list { display: flex; flex-direction: column; gap: 10px; }
.own-item { background: var(--white); border: 1px solid var(--gray-mid); border-radius: 10px; padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.kat-dot { display: inline-block; width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0; vertical-align: middle; border: 1px solid rgba(0,0,0,0.15); }
.own-item-main { flex: 1; min-width: 0; }
.own-item-art { font-weight: 700; font-size: 0.95rem; }
.own-item-meta { font-size: 0.8rem; color: var(--gray-txt); }
.status-badge { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 4px 9px; border-radius: 20px; white-space: nowrap; }
.status-fertig { background: #e3f4e6; color: var(--green-dark); }
.status-abgebrochen { background: #fde8ea; color: var(--red-dark); }
/* Vormontiert-Montagen bekommen einen helleren Ton als Neu-Montagen — dieselbe Status-Aussage
   (Fertig/Abgebrochen), aber auf einen Blick unterscheidbar, welche Rad-Vorbereitung dahintersteckt. */
.status-fertig--vormontiert { background: #eef9f0; color: var(--green-light); }
.status-abgebrochen--vormontiert { background: #fdf0f2; color: var(--red-light); }
.status-pausiert { background: #fff4d6; color: var(--amber-dark); }
.status-laufend { background: #e3edfb; color: var(--blue-dark); }
.status-nachbearbeitung { background: #edeff2; color: #5b6b7a; }
.empty-state { text-align: center; color: var(--gray-txt); padding: 30px 10px; font-size: 0.9rem; }

/* ── WIZARD ────────────────────────────────────────────────────────────── */
.wizard-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.wizard-back { background: none; border: none; color: var(--gray-txt); font-size: 0.9rem; display: flex; align-items: center; gap: 4px; }
.wizard-dots { display: flex; gap: 6px; margin-left: auto; }
.wizard-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gray-mid); }
.wizard-dot.active { background: var(--red); }
.wizard-dot.done { background: var(--green); }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 22px; }
.choice-tile {
  background: var(--white); border: 2px solid var(--gray-mid); border-radius: 14px;
  padding: 26px 14px; font-size: 1.05rem; font-weight: 700; text-align: center;
  min-height: 96px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
}
.choice-tile:active { transform: scale(0.97); }
.choice-tile.selected { border-color: var(--red); background: #fff5f6; color: var(--red-dark); }
.choice-swatch { width: 30px; height: 30px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.15); }

/* ── RUNNING ───────────────────────────────────────────────────────────── */
.running-context { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 26px; }
.context-chip { background: var(--white); border: 1px solid var(--gray-mid); border-radius: 20px; padding: 6px 14px; font-size: 0.82rem; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.timer-wrap { text-align: center; margin: 10px 0 34px; }
.timer-display {
  font-family: var(--font-mono); font-size: 4.4rem; font-weight: 600; font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em; color: var(--black); line-height: 1;
}
.timer-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--gray-txt); margin-top: 8px; }
.running-actions { display: flex; flex-direction: column; gap: 12px; }

/* ── PAUSED (gesperrt) ─────────────────────────────────────────────────── */
.paused-banner {
  background: var(--amber); color: var(--black); text-align: center; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em; padding: 14px; border-radius: 10px; margin-bottom: 22px;
}
.paused-timer { font-family: var(--font-mono); text-align: center; font-size: 2.1rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--gray-txt); margin-bottom: 26px; }
.grund-readonly { background: var(--gray-bg); border: 1px solid var(--gray-mid); border-radius: 10px; padding: 14px 16px; margin-bottom: 22px; font-size: 0.95rem; }
.grund-readonly strong { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--gray-txt); margin-bottom: 4px; }
.paused-actions { display: flex; flex-direction: column; gap: 12px; }

/* ── CHECKLISTE ────────────────────────────────────────────────────────── */
.check-group { margin-bottom: 20px; }
.check-options { display: flex; gap: 10px; }
.check-opt {
  flex: 1; background: var(--white); border: 2px solid var(--gray-mid); border-radius: 10px;
  padding: 14px 8px; text-align: center; font-weight: 700; font-size: 0.95rem;
}
.check-opt.selected { border-color: var(--green); background: #e9f7ec; color: var(--green-dark); }

/* ── UTILITY ───────────────────────────────────────────────────────────── */
.stack-gap { display: flex; flex-direction: column; gap: 12px; }
.mt-24 { margin-top: 24px; }
.center { text-align: center; }
.icon { width: 1em; height: 1em; }

@media (max-width: 420px) {
  .timer-display { font-size: 3.6rem; }
  .choice-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .monteur-grid { grid-template-columns: 1fr 1fr; }
}

/* ── LEITUNG ───────────────────────────────────────────────────────────── */

/* Live-Board: bewusst im dunklen Topbar-Idiom gehalten (statt einer weiteren weißen Karte),
   damit "gerade jetzt" optisch sofort von den historischen Auswertungskarten darunter absticht. */
.live-board {
  background: linear-gradient(120deg, var(--maroon-dark), var(--maroon) 70%);
  border-bottom: 1px solid rgba(0,0,0,0.25);
  padding: 16px 20px 18px;
}
.live-board-head { display: flex; align-items: baseline; gap: 9px; max-width: 1080px; margin: 0 auto 13px; }
.live-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #3ddc73; flex-shrink: 0;
  animation: live-pulse 2.2s ease-out infinite;
}
@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(61, 220, 115, 0.55); }
  70%  { box-shadow: 0 0 0 7px rgba(61, 220, 115, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 220, 115, 0); }
}
.live-board-title { color: var(--white); font-size: 0.76rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; }
.live-board-time { margin-left: auto; color: #767676; font-size: 0.72rem; font-family: var(--font-mono); }
.live-refresh-btn {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.18); border-radius: 7px;
  color: var(--white); width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; padding: 0;
}
.live-refresh-btn:hover { background: rgba(255,255,255,0.16); }
.live-refresh-btn .icon { width: 14px; height: 14px; }
.live-refresh-btn.is-spinning .icon { animation: live-refresh-spin 0.6s linear; }
@keyframes live-refresh-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.live-board-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px 32px; max-width: 1080px; margin: 0 auto; }
.live-group { display: flex; align-items: center; flex-wrap: wrap; gap: 18px; padding: 4px 0; }
.live-group + .live-group { border-left: 1px solid #2c2c2c; padding-left: 24px; }
.live-group-label { color: #8a8a8a; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em; min-width: 68px; }
.live-stat { display: flex; align-items: center; gap: 7px; }
.live-indicator { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.live-indicator--fertig     { background: #4ade80; }
.live-indicator--pausiert   { background: #fbbf24; }
.live-indicator--laufend    { background: #60a5fa; }
.live-indicator--abgebrochen{ background: #f87171; }
.live-stat-value {
  font-family: var(--font-mono); color: var(--white); font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums;
  min-width: 1.2ch; display: inline-block;
}
.live-stat-value.flash { animation: live-value-flash 0.5s ease; }
@keyframes live-value-flash {
  0%   { transform: scale(1.4); color: #ffe8a3; }
  100% { transform: scale(1); color: var(--white); }
}
.live-stat-label { color: #9a9a9a; font-size: 0.76rem; }

.werkstatt-jetzt {
  max-width: 1080px; margin: 14px auto 0; padding-top: 14px; border-top: 1px solid rgba(0,0,0,0.2);
}
.werkstatt-jetzt-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 11px; }
.live-checkedin-label { color: rgba(255,255,255,0.55); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em; margin-right: 2px; }
.werkstatt-jetzt-empty { color: rgba(255,255,255,0.4); font-size: 0.82rem; font-style: italic; }
.werkstatt-jetzt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); gap: 10px; }

.wj-card {
  background: rgba(0,0,0,0.22); border-left: 4px solid #5a5a5a; border-radius: 8px;
  padding: 11px 14px 12px; transition: box-shadow 0.2s ease;
}
.wj-card--ok   { border-left-color: #4ade80; }
.wj-card--warn { border-left-color: #fbbf24; }
.wj-card--crit { border-left-color: #f87171; animation: wj-crit-pulse 1.6s ease-in-out infinite; }
@keyframes wj-crit-pulse {
  0%, 100% { box-shadow: inset 0 0 0 0 rgba(248, 113, 113, 0); }
  50%      { box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.5); background: rgba(248, 113, 113, 0.1); }
}
.wj-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.wj-card-name { color: var(--white); font-weight: 700; font-size: 0.92rem; }
.wj-pill { font-size: 0.64rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; padding: 3px 8px; border-radius: 20px; flex-shrink: 0; }
.wj-pill--frei      { background: rgba(255,255,255,0.12); color: #b8b8b8; }
.wj-pill--laufend   { background: rgba(74, 222, 128, 0.18); color: #4ade80; }
.wj-pill--pausiert  { background: rgba(255,255,255,0.12); color: #b8b8b8; }
.wj-card--warn .wj-pill--pausiert { background: rgba(251, 191, 36, 0.18); color: #fbbf24; }
.wj-card--crit .wj-pill--pausiert { background: rgba(248, 113, 113, 0.22); color: #f87171; }
.wj-card-sub { color: #9a9a9a; font-size: 0.78rem; line-height: 1.4; min-height: 1.1em; }
.wj-card-grund { color: #ffd699; font-size: 0.78rem; font-style: italic; }
.wj-card-timer {
  font-family: var(--font-mono); color: var(--white); font-size: 1.5rem; font-weight: 700;
  font-variant-numeric: tabular-nums; margin-top: 4px;
}
.wj-card--warn .wj-card-timer { color: #fbbf24; }
.wj-card--crit .wj-card-timer { color: #f87171; }
.wj-card-hint { color: #767676; font-size: 0.68rem; margin-top: 1px; }
.wj-card-abmelden {
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.25); color: var(--white);
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 5px 10px; border-radius: 6px; margin-top: 9px;
}
.wj-card-abmelden:hover { background: rgba(255,255,255,0.18); }

@media (max-width: 700px) {
  .live-board-grid { grid-template-columns: 1fr; gap: 12px; }
  .live-group + .live-group { border-left: none; padding-left: 0; border-top: 1px solid #2c2c2c; padding-top: 12px; }
}

.app-shell-wide { max-width: 1080px; margin: 0 auto; padding: 24px 20px 60px; }
.filter-bar { margin-bottom: 22px; }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.filter-row:last-child { margin-bottom: 0; }
.filter-preset {
  background: var(--white); border: 2px solid var(--gray-mid); border-radius: 20px;
  padding: 8px 16px; font-size: 0.85rem; font-weight: 700;
}
.filter-preset.active { border-color: var(--red); background: var(--red); color: var(--white); }
.filter-row select, .filter-row input[type="date"] {
  padding: 10px 12px; border: 2px solid var(--gray-mid); border-radius: 8px; font-size: 0.9rem; background: var(--white);
}
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 30px; }
.kpi-tile { position: relative; background: var(--white); border: 1px solid var(--gray-mid); border-radius: 10px; padding: 19px 18px 17px; text-align: center; overflow: hidden; }
.kpi-tile::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--gray-mid); }
.kpi-tile.kpi-fertig::before { background: var(--green); }
.kpi-tile.kpi-pause::before { background: var(--amber); }
.kpi-warn::before { background: var(--red) !important; }
.kpi-value { font-family: var(--font-mono); font-size: 1.8rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: 0.72rem; color: var(--gray-txt); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 4px; }
.kpi-warn .kpi-value { color: var(--red); }
.kpi-sub { font-size: 0.72rem; color: var(--gray-txt); margin-top: 5px; font-weight: 600; min-height: 1.1em; }

/* ── Reiter: Filter bleiben global, Reiter schalten nur zwischen vorgerechneten Ansichten um ── */
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--gray-mid); margin-bottom: 24px; overflow-x: auto; }
.tab-btn {
  background: none; border: none; padding: 12px 18px; font-size: 0.9rem; font-weight: 700;
  color: var(--gray-txt); border-bottom: 3px solid transparent; margin-bottom: -2px;
  white-space: nowrap; flex-shrink: 0;
}
.tab-btn:hover { color: var(--black); }
.tab-btn.active { color: var(--red); border-bottom-color: var(--red); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Grafische Auswertungen: reine Inline-SVG-Balkendiagramme, keine Chart-Bibliothek nötig ──
   Jedes Diagramm bekommt eine "nice"-gerundete Achse (computeAxis in leitung.js) statt den
   rohen Maximalwert zu skalieren — sonst wirkt ein Balken je nach Zufall der Daten mal fast leer,
   mal randvoll, ohne dass sich die Zahl dahinter wirklich unterscheidet. */
.chart-card { margin-bottom: 22px; }
.chart-card .empty-state { padding: 10px; }
.bar-chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.bar-chart-label { font: 600 11px var(--font-sans); fill: var(--black); }
.bar-chart-value { font: 700 11px var(--font-mono); fill: var(--gray-txt); }
.bar-chart-grid { stroke: var(--gray-mid); stroke-width: 1; }
.bar-chart-axis-label { font: 500 10px var(--font-sans); fill: var(--gray-txt); }
.trend-chart-svg { width: 100%; height: 200px; display: block; }
.trend-axis-label { font: 500 10px var(--font-sans); fill: var(--gray-txt); }
.chart-legend { display: flex; gap: 18px; font-size: 0.78rem; color: var(--gray-txt); margin-top: 10px; flex-wrap: wrap; }
.chart-legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

.btn-row-delete {
  background: none; border: 1px solid transparent; color: var(--red); font-size: 0.78rem; font-weight: 700;
  padding: 5px 10px; border-radius: 6px; white-space: nowrap;
}
.btn-row-delete:hover { border-color: var(--red); background: #fff0f2; }
.btn-row-action {
  background: none; border: 1px solid transparent; color: var(--blue); font-size: 0.78rem; font-weight: 700;
  padding: 5px 10px; border-radius: 6px; white-space: nowrap;
}
.btn-row-action:hover { border-color: var(--blue); background: #eaf1fb; }
.hinweis-offen { color: var(--amber-dark); font-size: 0.78rem; font-weight: 600; }
.table-wrap { overflow-x: auto; margin-bottom: 30px; border: 1px solid var(--gray-mid); border-radius: 10px; }
.data-table { width: 100%; border-collapse: collapse; background: var(--white); font-size: 0.88rem; }
.data-table th, .data-table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--gray-mid); white-space: nowrap; }
.data-table th { background: var(--gray-bg); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gray-txt); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--gray-bg); cursor: pointer; }
/* Freitext-Spalten (Mangel, Grund, Tätigkeit, Kommentar) dürfen umbrechen statt die Tabelle in die
   Breite zu ziehen — anders als Datum/Status/Zahlen-Spalten, die bewusst einzeilig bleiben.
   Selektor bewusst so spezifisch wie ".data-table td" (2 Klassen schlagen 1 Klasse + 1 Typ),
   sonst gewinnt die allgemeine nowrap-Regel unabhängig von der Reihenfolge im Stylesheet. */
.data-table td.cell-wrap { white-space: normal; max-width: 280px; }

/* ── KI-ANALYSE (CHAT) ─────────────────────────────────────────────────── */
.ki-chat-card { display: flex; flex-direction: column; height: 65vh; min-height: 420px; padding: 0; overflow: hidden; }
.ki-chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.ki-chat-empty { color: var(--gray-txt); font-size: 0.9rem; text-align: center; padding: 30px 10px; }
.ki-chat-msg { display: flex; flex-direction: column; gap: 10px; max-width: 78%; }
.ki-chat-msg--user { align-self: flex-end; align-items: flex-end; }
.ki-chat-msg--assistant { align-self: flex-start; align-items: flex-start; }
.ki-chat-bubble { padding: 10px 14px; border-radius: 12px; font-size: 0.92rem; line-height: 1.45; white-space: normal; }
.ki-chat-msg--user .ki-chat-bubble { background: var(--red); color: var(--white); border-bottom-right-radius: 3px; }
.ki-chat-msg--assistant .ki-chat-bubble { background: var(--gray-bg); color: var(--black); border-bottom-left-radius: 3px; }
.ki-chat-msg--loading .ki-chat-bubble { color: var(--gray-txt); animation: ki-chat-pulse 1.1s ease-in-out infinite; }
.ki-chat-chart { width: 100%; margin: 0; padding: 14px 16px; }
.ki-chat-chart .section-label { margin-bottom: 8px; }
.ki-chat-input-row { display: flex; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--gray-mid); background: var(--white); }
.ki-chat-input-row textarea {
  flex: 1; resize: none; border: 2px solid var(--gray-mid); border-radius: 8px; padding: 10px 12px;
  font: inherit; font-size: 0.92rem;
}
.ki-chat-input-row textarea:focus { outline: none; border-color: var(--red); }
.ki-chat-input-row .btn { width: auto; padding: 0 22px; }
@keyframes ki-chat-pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
@media (max-width: 720px) { .ki-chat-msg { max-width: 92%; } }

/* ── ADMINISTRATION ────────────────────────────────────────────────────── */
.admin-card { margin-bottom: 22px; }
.admin-card--danger { border-color: var(--red); background: #fff6f7; }
.admin-card--danger p { font-size: 0.88rem; color: var(--gray-txt); margin-bottom: 14px; line-height: 1.5; }
.admin-add-row { display: flex; gap: 10px; margin-bottom: 16px; }
.admin-add-row input { flex: 1; border: 2px solid var(--gray-mid); border-radius: 8px; padding: 10px 12px; font: inherit; font-size: 0.92rem; }
.admin-add-row input:focus { outline: none; border-color: var(--red); }
.admin-add-row .btn { width: auto; padding: 0 22px; }
.admin-mitarbeiter-liste { display: flex; flex-direction: column; }
.admin-mitarbeiter-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--gray-mid); }
.admin-mitarbeiter-row:last-child { border-bottom: none; }
.admin-mitarbeiter-name { font-size: 0.92rem; display: flex; align-items: center; gap: 8px; }
.admin-mitarbeiter-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.admin-tag { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-txt); background: var(--gray-bg); border-radius: 6px; padding: 2px 7px; }
.admin-tag--live { color: var(--green-dark); background: #e8f7ea; }
.btn-danger { background: var(--red-dark); color: var(--white); }
.btn-danger:not(:disabled):hover { background: #7a0018; }
.modal-box--danger { border-top: 5px solid var(--red); }
.modal-warnliste { margin: 10px 0 14px 20px; font-size: 0.9rem; line-height: 1.6; }
.modal-box--wide { max-width: 720px; }
.ki-archiv-liste { display: flex; flex-direction: column; }
.ki-archiv-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--gray-mid); }
.ki-archiv-row:last-child { border-bottom: none; }
.ki-archiv-titel { font-size: 0.92rem; font-weight: 600; }
.ki-archiv-datum { font-size: 0.78rem; color: var(--gray-txt); margin-top: 2px; }
.ki-archiv-actions { display: flex; gap: 8px; flex-shrink: 0; }
.ki-chat-messages--archiv { max-height: 60vh; overflow-y: auto; padding: 4px 0; margin-bottom: 4px; }
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 300; padding: 20px; }
.modal-box { background: var(--white); border-radius: 12px; padding: 24px; max-width: 460px; width: 100%; max-height: 80vh; overflow-y: auto; }
.modal-box h3 { margin-bottom: 14px; }
.modal-row { margin-bottom: 10px; font-size: 0.9rem; }
.modal-row strong { display: block; font-size: 0.72rem; text-transform: uppercase; color: var(--gray-txt); letter-spacing: 0.06em; margin-bottom: 2px; }
.mangel-hinweis-item { padding: 12px 0; border-bottom: 1px solid var(--gray-mid); }
.mangel-hinweis-item:last-child { border-bottom: none; padding-bottom: 0; }
.mangel-hinweis-item:first-child { padding-top: 0; }
.modal-text { color: var(--gray-txt); margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions-col { flex-direction: column; }
.modal-actions-col .btn-text { padding-top: 2px; }
.modal-actions .btn { width: auto; flex: 1; }

@media (max-width: 700px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}

/* ── ARBEITSNACHWEIS (Druck/PDF) ───────────────────────────────────────────
   Nur beim Drucken sichtbar (window.print → "Als PDF speichern"). Kein PDF-Lib
   nötig, das erledigt der Browser-Druckdialog — passt zur restlichen App ohne
   externe Abhängigkeiten. */
.print-only { display: none; }
@media print {
  @page { margin: 14mm; }
  body * { visibility: hidden; }
  /* Nur die gerade aktive Druckvorlage zeigen — es gibt zwei Vorlagen (#print-report,
     #print-mangel), die beide dauerhaft im DOM stehen. Ohne diese Unterscheidung
     würden bei jedem Druck beide übereinander gerendert (siehe App-Code: die jeweilige
     Druckfunktion setzt "print-active" exklusiv auf ihre eigene Vorlage). */
  .print-active, .print-active * { visibility: visible; }
  .print-active { display: block; position: absolute; top: 0; left: 0; width: 100%; font-family: var(--font-sans); color: #1a1a1a; }
  .report-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 3px solid #d90128; padding-bottom: 10px; margin-bottom: 18px; }
  .report-brand { font-size: 1.3rem; font-weight: 700; }
  .report-brand span { color: #d90128; }
  .report-doctitle { font-size: 0.85rem; color: #555; text-transform: uppercase; letter-spacing: 0.08em; }
  .report-meta-table { border-collapse: collapse; margin-bottom: 20px; font-size: 0.85rem; }
  .report-meta-table td { padding: 2px 14px 2px 0; }
  .report-meta-table td:first-child { color: #777; text-transform: uppercase; font-size: 0.68rem; letter-spacing: 0.06em; }
  .report-meta-table td:nth-child(2) { font-weight: 600; }
  .report-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; margin-bottom: 18px; }
  .report-table th { text-align: left; padding: 6px 8px; border-bottom: 2px solid #1a1a1a; font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em; color: #555; }
  .report-table td { padding: 6px 8px; border-bottom: 1px solid #ddd; font-variant-numeric: tabular-nums; }
  .report-table tbody tr:nth-child(even) { background: #f7f7f7; }
  .report-summary-table { margin-left: auto; border-collapse: collapse; font-size: 0.85rem; }
  .report-summary-table td { padding: 3px 0 3px 28px; text-align: right; }
  .report-summary-table td:first-child { color: #555; padding-left: 0; }
  .report-summary-table td:last-child { font-weight: 700; font-family: var(--font-mono); }
  .report-foot { margin-top: 26px; font-size: 0.66rem; color: #999; text-align: center; border-top: 1px solid #ddd; padding-top: 8px; }
  .report-mangel-box { border: 2px solid #1a1a1a; border-radius: 6px; padding: 16px 18px; margin-top: 6px; }
  .report-mangel-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: #555; font-weight: 700; margin-bottom: 8px; }
  .report-mangel-text { font-size: 1.15rem; line-height: 1.5; white-space: pre-wrap; }
}
