/* ═══════════════════════════════════════════════════════════
   TimeManager Pro – Design System
   Konzept: „Digitale Stempeluhr" – Industrie-Terminal (dunkel)
   für den Kiosk, helles Backoffice für die Verwaltung.
   Signatur: die Stempelkarte (Stub) mit Abriss-Perforation.

   Regeln, die überall gelten:
   • Tiefe wird EINMAL erklärt: Flächen tragen eine Linie,
     schwebende Ebenen (Modal, Toast, Anmeldung) einen Schatten.
   • Farbe bedeutet immer dasselbe: Grün = läuft, Bernstein =
     bitte prüfen, Blau = Auswahl/Aktion, Rot = Gefahr,
     Violett = Beobachtung.
   • Icons sind gezeichnet (assets/icons.js), nie Emoji.
   ═══════════════════════════════════════════════════════════ */

:root {
  /* ── Farbwelt ── */
  --ink:      #0D1B26;   /* tiefes Petrol-Nachtblau (Terminal) */
  --ink-2:    #12293B;
  --panel:    #16324A;
  --line-d:   #2A4B67;   /* Linie auf dunklem Grund */
  --on-ink:   #E7EFF6;   /* Text auf dunklem Grund */
  --on-ink-2: #A6BCCD;   /* zweite Ebene, dunkler Grund (4.9:1) */
  --on-ink-3: #8AA2B6;   /* dritte Ebene, dunkler Grund */

  --bg:       #EDF1F4;   /* Backoffice-Grund */
  --wash:     #F4F7F9;   /* leicht getönte Fläche */
  --card:     #FFFFFF;
  --paper:    #FBF6EA;   /* Stempelkarten-Karton */
  --paper-ink:#2B2416;
  --text:     #17242E;
  --muted:    #56697A;   /* 5.8:1 auf Weiß */
  --line:     #DEE5EB;
  --line-2:   #EBF0F4;   /* zarte Trennung innerhalb einer Fläche */

  --green:    #1FB566;  --green-ink:#0C6E3C;  --green-bg: #E2F6EB;
  --amber:    #E9990B;  --amber-ink:#7A4F00;  --amber-bg: #FCF1D9;
  --blue:     #2F7DD1;  --blue-ink: #1A579C;  --blue-bg:  #E4EFFA;
  --red:      #D93A40;  --red-ink:  #A3272C;  --red-bg:   #FBE5E6;
  --violet:   #7C5CD6;  --violet-ink:#4E3799;  --violet-bg:#EEE9FB;
  --slate:    #64748B;  --slate-ink:#42536A;  --slate-bg: #EBEFF3;

  /* ── Typografie ── */
  --font-body: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --fs-xs:   11px;
  --fs-sm:   12.5px;
  --fs-md:   13.5px;
  --fs-base: 15px;
  --fs-lg:   17px;
  --fs-xl:   20px;
  --fs-2xl:  24px;

  /* ── Raster & Form ── */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px;
  --s6: 24px; --s7: 32px; --s8: 40px;
  --radius:    14px;   /* Flächen */
  --radius-sm: 10px;   /* Bedienelemente */
  --radius-xs: 8px;    /* kleine Bedienelemente */

  /* ── Tiefe (nur für schwebende Ebenen) ── */
  --lift:    0 4px 12px rgba(13,27,38,.10), 0 1px 2px rgba(13,27,38,.06);
  --lift-lg: 0 18px 48px rgba(13,27,38,.24), 0 2px 8px rgba(13,27,38,.10);
  --lift-dark: 0 24px 60px rgba(0,0,0,.42);

  /* ── Bewegung ── */
  --ease: cubic-bezier(.2, .8, .3, 1);
  --fast: .14s;
  --med:  .22s;
}

/* ───────── Basis ───────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { margin: 0; line-height: 1.18; letter-spacing: -.011em; text-wrap: balance; }
p { margin: 0; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }
a { color: var(--blue-ink); text-underline-offset: 2px; }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted);
}
.hidden { display: none !important; }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(47,125,209,.20); }

/* Gezeichnete Icons – eine Familie, ein Strich */
svg.ic { flex: none; vertical-align: -.18em; }

/* Feine Scrollbalken */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: rgba(86,105,122,.32); border-radius: 8px;
  border: 2px solid transparent; background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background-color: rgba(86,105,122,.52); }

/* ───────── Buttons ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  padding: 10px 17px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14px; line-height: 1.2;
  color: #fff; background: var(--blue);
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease),
              box-shadow var(--fast) var(--ease), transform var(--fast) var(--ease),
              color var(--fast) var(--ease);
  user-select: none; white-space: nowrap;
}
.btn:hover  { background: #2A70BC; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-green  { background: var(--green); }
.btn-green:hover  { background: #17A45B; }
.btn-amber  { background: var(--amber); color: #33220A; }
.btn-amber:hover  { background: #D68C08; }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #C63238; }
/* Schwebender WhatsApp-Knopf unten rechts – immer erreichbar, stört nichts.
   Gleiche Optik wie der Knopf auf supportzone24.de. */
.fab-wa {
  position: fixed; right: 22px; bottom: 22px; z-index: 55;
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, #25D366, #128C7E);
  color: #fff; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(37, 211, 102, .4);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.fab-wa:hover { transform: scale(1.08); box-shadow: 0 8px 30px rgba(37, 211, 102, .6); }
.fab-wa:active { transform: scale(1); }
.fab-wa svg { width: 27px; height: 27px; }
.fab-wa::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid rgba(37, 211, 102, .5);
  animation: fab-ring 2.6s ease-out infinite;
  pointer-events: none;
}
@keyframes fab-ring {
  0%   { transform: scale(.92); opacity: .8; }
  100% { transform: scale(1.45); opacity: 0; }
}
@media (max-width: 700px) { .fab-wa { right: 16px; bottom: 16px; width: 52px; height: 52px; } }
@media print { .fab-wa { display: none !important; } }

/* WhatsApp – gleiche Optik wie der Knopf auf supportzone24.de */
.btn-whatsapp {
  background: linear-gradient(135deg, #25D366, #128C7E);
  color: #fff; border-color: transparent;
  box-shadow: 0 3px 14px rgba(37, 211, 102, .35);
}
.btn-whatsapp:hover {
  background: linear-gradient(135deg, #2AE075, #14A08D);
  box-shadow: 0 6px 22px rgba(37, 211, 102, .5);
}
.btn-whatsapp .ic { opacity: 1; }
.btn-ghost  { background: var(--card); color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--wash); border-color: #CBD6DF; }
.btn-ghost-dark {
  background: rgba(255,255,255,.07); color: #DCE7F0; border-color: var(--line-d);
}
.btn-ghost-dark:hover { background: rgba(255,255,255,.14); }
.btn-sm { padding: 7px 12px; font-size: var(--fs-md); border-radius: var(--radius-xs); gap: 6px; }
.btn-xl { padding: 17px 28px; font-size: var(--fs-lg); border-radius: 16px; }
.btn-block { width: 100%; }
.btn .ic { opacity: .92; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--radius-xs);
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  transition: color var(--fast) var(--ease), background var(--fast) var(--ease),
              border-color var(--fast) var(--ease);
}
.icon-btn:hover { color: var(--text); background: var(--wash); border-color: #CBD6DF; }
.icon-btn.danger:hover { color: var(--red-ink); background: var(--red-bg); border-color: #F0B9BB; }
.icon-btn.is-on { color: var(--violet-ink); background: var(--violet-bg); border-color: #D6CBF3; }
.tbl .t-actions .icon-btn + .icon-btn { margin-left: 6px; }

/* ───────── Chips & Stempel ───────── */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: var(--fs-sm); font-weight: 600; white-space: nowrap;
}
.chip .ic { width: 13px; height: 13px; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.chip-cust  { background: var(--blue-bg);   color: var(--blue-ink); }
.chip-none  { background: #E7EBEF;          color: var(--muted); }
.chip-auto  { background: var(--amber-bg);  color: var(--amber-ink); }
.chip-edit  { background: var(--blue-bg);   color: var(--blue-ink); }
.chip-open  { background: var(--green-bg);  color: var(--green-ink); }
.chip-off   { background: #E7EBEF;          color: var(--muted); }
.chip-watch { background: var(--violet-bg); color: var(--violet-ink); }
.chip-warn  { background: var(--red-bg);    color: var(--red-ink); }
.chip-open .dot { animation: livepulse 1.8s ease-in-out infinite; }
@keyframes livepulse { 50% { opacity: .3; } }

.stamp {
  font-family: var(--font-mono);
  font-weight: 600; font-size: var(--fs-xs); letter-spacing: .12em;
  text-transform: uppercase;
  padding: 2px 8px; border: 2px solid currentColor; border-radius: 6px;
}
.stamp.in  { color: var(--green-ink); }
.stamp.out { color: var(--amber-ink); }

/* ───────── Flächen (Linie statt Schatten) ───────── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.card-pad { padding: var(--s5); }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line-2);
}
.card-head h3 { font-size: var(--fs-lg); font-weight: 700; }
.card-head .sub { font-size: var(--fs-md); color: var(--muted); }
.section-gap { margin-bottom: var(--s4); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); align-items: start; }

/* Hinweis-Fläche (ersetzt farbige Balken am Rand) */
.notice {
  display: flex; gap: var(--s3); align-items: flex-start;
  padding: var(--s4) var(--s5);
  background: var(--blue-bg); border: 1px solid #C8DDF3;
  border-radius: var(--radius); color: #143F72;
  font-size: var(--fs-md);
}
.notice .ic { color: var(--blue-ink); margin-top: 1px; }
.notice strong { color: #0F3159; }
.notice-amber { background: var(--amber-bg); border-color: #EFD9A4; color: #6B4400; }
.notice-amber .ic, .notice-amber strong { color: var(--amber-ink); }
.notice-violet { background: var(--violet-bg); border-color: #D6CBF3; color: #45307F; }
.notice-violet .ic, .notice-violet strong { color: var(--violet-ink); }

/* ───────── Formulare ───────── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--s4); }
.field > label { font-size: var(--fs-md); font-weight: 600; color: var(--text); }
.hint { font-size: var(--fs-sm); color: var(--muted); line-height: 1.5; }
.field .hint { margin-top: -1px; }
.input, select.input, textarea.input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #CFDAE3;
  border-radius: var(--radius-sm);
  background: var(--card); color: var(--text);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.input::placeholder { color: #8C9DAB; }
.input:hover { border-color: #B9C8D4; }
.input:focus {
  border-color: var(--blue); outline: none;
  box-shadow: 0 0 0 3px rgba(47,125,209,.18);
}
.input.mono { letter-spacing: .04em; }
/* Rückmeldung direkt am Feld: grün = passt, rot = stimmt nicht */
.input.ist-gut  { border-color: var(--green); background: #F4FCF7; }
.input.ist-gut:focus  { box-shadow: 0 0 0 3px rgba(31, 181, 102, .22); }
.input.ist-fehler { border-color: var(--red); background: #FEF6F6; }
.input.ist-fehler:focus { box-shadow: 0 0 0 3px rgba(217, 58, 64, .20); }
.input:disabled { background: var(--wash); color: var(--muted); cursor: not-allowed; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch .track {
  width: 42px; height: 24px; border-radius: 999px; background: #BFCCD7;
  position: relative; transition: background var(--fast) var(--ease); flex: none;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.28);
  transition: transform var(--fast) var(--ease);
}
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--blue); outline-offset: 3px; }
.switch input:disabled + .track { opacity: .5; }

.check-list {
  display: flex; flex-direction: column; gap: 6px; max-height: 180px; overflow: auto;
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px;
}
.check-list label { display: flex; align-items: center; gap: var(--s2); font-size: 14px; cursor: pointer; }
.check-list input { width: 16px; height: 16px; accent-color: var(--blue); }

/* ───────── Tabellen ───────── */
.table-scroll { overflow-x: auto; }
table.tbl, table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .table th {
  font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap; background: var(--wash);
}
.tbl td, .table td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr, .table tbody tr { transition: background var(--fast) var(--ease); }
.tbl tbody tr:hover, .table tbody tr:hover { background: rgba(47,125,209,.045); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .t-time { font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .t-num  { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.tbl .t-actions { text-align: right; white-space: nowrap; }
.tbl tr.row-warn  { background: #FEFAF0; }
.tbl tr.row-warn:hover  { background: #FCF4E3; }
.tbl tr.row-watch { background: #F8F4FE; }
.tbl tr.row-watch:hover { background: #F1EAFC; }
.tbl tr.row-off td { opacity: .5; }
.row-click { cursor: pointer; }
.row-click:hover td { background: rgba(47,125,209,.07); }
.tbl tfoot td {
  font-weight: 700; background: var(--wash);
  border-top: 2px solid var(--ink); border-bottom: 0;
  font-variant-numeric: tabular-nums;
}

.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: var(--fs-sm); color: #fff; flex: none;
  letter-spacing: .02em;
}
.name-cell { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.name-cell .sub { display: block; font-weight: 400; font-size: var(--fs-sm); color: var(--muted); }

.empty { padding: var(--s7) var(--s5); text-align: center; color: var(--muted); font-size: 14px; }
.empty strong { display: block; color: var(--text); font-size: var(--fs-base); margin-bottom: var(--s1); }
.empty .ic { color: #A9B8C4; margin-bottom: 10px; }

/* Ladezustand: Platzhalter in Form des späteren Inhalts */
.skeleton {
  background: linear-gradient(90deg, #E9EEF2 25%, #F2F6F9 37%, #E9EEF2 63%);
  background-size: 400% 100%;
  animation: skeleton 1.3s ease-in-out infinite;
  border-radius: 6px; color: transparent !important;
}
@keyframes skeleton { from { background-position: 100% 50%; } to { background-position: 0 50%; } }
.skeleton-row { height: 14px; margin: 13px 12px; }

/* ───────── Modal & Toast (schwebende Ebenen: Schatten, keine Linie) ───────── */
.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(9,20,29,.58);
  backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh var(--s4) var(--s4);
  overflow-y: auto;
  animation: ov-in var(--fast) ease;
}
@keyframes ov-in { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 540px;
  background: #fff; border-radius: 18px; border: 0;
  box-shadow: var(--lift-lg);
  animation: mod-in var(--med) cubic-bezier(.16, 1, .3, 1);
}
@keyframes mod-in { from { opacity: 0; transform: translateY(12px) scale(.985); } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s5) var(--s6) 0;
}
.modal-head h3 { font-size: var(--fs-xl); font-weight: 700; }
.modal-body { padding: var(--s4) var(--s6) var(--s1); }
.modal-body > p { color: var(--muted); font-size: 14px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: var(--s4) var(--s6) var(--s5);
}
.modal-foot .left { margin-right: auto; }

#toast-box {
  position: fixed; top: var(--s5); right: var(--s5); z-index: 90;
  display: flex; flex-direction: column; gap: var(--s2);
  max-width: min(380px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--ink); color: #E9F1F7;
  border-radius: var(--radius-sm); padding: 12px 15px;
  font-size: 14px; line-height: 1.4;
  box-shadow: var(--lift-dark);
  animation: toast-in var(--med) var(--ease);
}
.toast .ic { flex: none; margin-top: 1px; color: var(--blue); }
.toast.ok  .ic { color: #3FD98C; }
.toast.err .ic { color: #FF8A8F; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px) scale(.97); } }

/* ═════════════════ KIOSK (Terminal) ═════════════════ */
body.kiosk {
  background:
    radial-gradient(1100px 600px at 75% -10%, rgba(47,125,209,.15), transparent 60%),
    var(--ink);
  color: var(--on-ink);
  min-height: 100%;
}
/* ── Kein Internet ──────────────────────────────────────────
   Klebt oben am Bildschirm, ist von weitem lesbar und schiebt
   den Rest der Seite nach unten (überdeckt nichts). Solange sie
   zu sehen ist, nimmt das Terminal keinen Chip an. */
.netz-warnung {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: var(--s3);
  padding: 14px clamp(16px, 4vw, 48px);
  background: var(--red); color: #FFF;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .35);
  animation: netz-puls 1.8s ease-in-out infinite;
}
.netz-warnung svg { width: 30px; height: 30px; flex: none; }
.netz-warnung strong { display: block; font-size: 1.12rem; line-height: 1.3; }
.netz-warnung span   { display: block; font-size: .92rem; opacity: .9; margin-top: 2px; }
@keyframes netz-puls { 50% { background: #C0392B; } }
@media (prefers-reduced-motion: reduce) { .netz-warnung { animation: none; } }

/* Scan-Bereich abdunkeln, damit niemand vergeblich den Chip auflegt */
body.netz-aus .scan-zone,
body.netz-aus .nfc-pill { opacity: .3; filter: grayscale(1); }
body.netz-aus .scan-title::after {
  content: " – gerade nicht möglich"; color: var(--red); white-space: nowrap;
}

.kiosk-shell {
  min-height: 100vh;
  max-width: 1360px; margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 48px) var(--s8);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 460px);
  grid-template-rows: auto 1fr;
  gap: var(--s5) 48px;
}
.kiosk-top {
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
}
.brand { display: flex; align-items: center; gap: var(--s3); }
.brand-mark {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  background: var(--paper); color: var(--ink);
  display: flex; align-items: center; justify-content: center; flex: none;
}
.brand-mark svg { width: 23px; height: 23px; }
.brand h1 { font-size: var(--fs-lg); font-weight: 700; }
.brand .eyebrow { color: var(--on-ink-3); margin-top: 2px; }

.kiosk-left { display: flex; flex-direction: column; justify-content: center; gap: var(--s6); min-width: 0; }
.clock {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: clamp(64px, 10.5vw, 148px);
  letter-spacing: -.035em;
  font-variant-numeric: tabular-nums;
  color: #F4F9FD;
  line-height: 1;
  text-shadow: 0 0 38px rgba(47,125,209,.32);
}
.clock .sec { font-size: .42em; color: var(--on-ink-3); margin-left: .12em; }
.clock .colon { animation: colonblink 2s steps(1) infinite; }
@keyframes colonblink { 50% { opacity: .25; } }
.kiosk-date { font-size: clamp(16px, 2vw, 21px); color: var(--on-ink-2); font-weight: 500; }
.kiosk-date strong { color: var(--on-ink); font-weight: 700; }

.presence { margin-top: 6px; }
.presence h2 { font-size: var(--fs-md); margin-bottom: 10px; }
.presence-list { display: flex; flex-direction: column; gap: var(--s2); max-height: 34vh; overflow: auto; padding-right: var(--s1); }
.presence-row {
  display: flex; align-items: center; gap: var(--s3);
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius-sm); padding: 10px 14px;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.presence-row:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.16); }
.presence-row .who { font-weight: 600; min-width: 0; }
.presence-row .who .cust { display: block; font-size: var(--fs-sm); font-weight: 500; color: var(--on-ink-3); }
.presence-row .since {
  margin-left: auto; font-family: var(--font-mono); font-size: 14px;
  color: #A9E8C6; white-space: nowrap;
}
.presence-empty { color: var(--on-ink-3); font-size: 14px; padding: var(--s2) 2px; }

/* Scan-Panel */
.scan-panel {
  background: linear-gradient(180deg, var(--ink-2), var(--panel));
  border: 1px solid var(--line-d);
  border-radius: 22px;
  padding: 26px 26px 22px;
  display: flex; flex-direction: column; align-items: center;
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
  min-height: 520px;
}
.scan-zone { position: relative; width: 190px; height: 190px; margin: var(--s2) 0 var(--s1); }
.scan-zone .ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px dashed rgba(180,205,225,.45);
}
.scan-zone .pulse {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid rgba(47,125,209,.55);
  animation: scanpulse 2.6s ease-out infinite;
}
.scan-zone .pulse.pulse-2 { animation-delay: 1.3s; }
@keyframes scanpulse {
  0%   { transform: scale(.82); opacity: .9; }
  70%  { transform: scale(1.18); opacity: 0; }
  100% { transform: scale(1.18); opacity: 0; }
}
.scan-zone .sweep {
  position: absolute; inset: -12px; border-radius: 50%;
  background: conic-gradient(from 0deg,
    transparent 0deg 290deg,
    rgba(88,166,255,0) 300deg,
    rgba(88,166,255,.55) 335deg,
    transparent 360deg);
  -webkit-mask: radial-gradient(closest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
          mask: radial-gradient(closest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  animation: sweep-rotate 3.6s linear infinite;
  pointer-events: none;
}
@keyframes sweep-rotate { to { transform: rotate(360deg); } }
.scan-zone .core {
  position: absolute; inset: 26px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #23496B, #16324A 70%);
  border: 1px solid var(--line-d);
  display: flex; align-items: center; justify-content: center;
  color: #A6C8E8;
  animation: core-breathe 4.5s ease-in-out infinite;
}
@keyframes core-breathe {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255,255,255,.06), 0 14px 34px rgba(0,0,0,.35); }
  50%      { box-shadow: 0 0 0 1px rgba(255,255,255,.10), 0 14px 40px rgba(47,125,209,.35); }
}
.scan-zone .core svg { width: 64px; height: 64px; }
.scan-title { font-size: var(--fs-2xl); font-weight: 700; margin-top: 14px; color: #F0F6FB; text-align: center; }
.scan-sub { color: var(--on-ink-2); font-size: 14px; margin-top: var(--s1); text-align: center; }
.scan-actions { width: 100%; margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: var(--s5); }
.scan-feedback { width: 100%; display: flex; flex-direction: column; align-items: center; }

.manual-box { width: 100%; margin-top: 14px; display: flex; gap: var(--s2); }
.manual-box .input {
  background: rgba(255,255,255,.07); border-color: var(--line-d); color: #EAF2F8;
  font-family: var(--font-mono); letter-spacing: .06em;
}
.manual-box .input::placeholder { color: var(--on-ink-3); }

.nfc-pill {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 9px 16px; border-radius: 999px;
  background: rgba(31,181,102,.12);
  border: 1px solid rgba(31,181,102,.38);
  color: #8CE7B6; font-size: var(--fs-md); font-weight: 600;
}
.nfc-pill .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #2FD37F; box-shadow: 0 0 12px #2FD37F;
  animation: nfc-blink 1.8s ease-in-out infinite;
}
@keyframes nfc-blink { 50% { opacity: .3; } }

/* Signatur: die Stempelkarte */
.stub {
  width: 100%;
  background: var(--paper);
  color: var(--paper-ink);
  border-radius: 0 0 14px 14px;
  padding: var(--s5) var(--s5) var(--s4);
  position: relative;
  -webkit-mask-image: radial-gradient(circle at 9px 0, transparent 5px, #000 5.5px);
  -webkit-mask-size: 18px 100%;
  -webkit-mask-repeat: repeat-x;
  mask-image: radial-gradient(circle at 9px 0, transparent 5px, #000 5.5px);
  mask-size: 18px 100%;
  mask-repeat: repeat-x;
  animation: stub-print .42s cubic-bezier(.16, 1, .3, 1);
  box-shadow: 0 14px 34px rgba(0,0,0,.35);
}
@keyframes stub-print { from { transform: translateY(-18px); opacity: 0; } }
.stub .stub-top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); }
.stub .who { font-size: var(--fs-xl); font-weight: 800; letter-spacing: -.015em; }
.stub .cust { font-size: var(--fs-md); color: #6B6046; margin-top: 2px; }
.stamp-big {
  font-family: var(--font-mono); font-weight: 600;
  font-size: var(--fs-xl); letter-spacing: .14em; text-transform: uppercase;
  padding: 6px 12px; border: 3px double currentColor; border-radius: var(--radius-xs);
  transform: rotate(-4deg); flex: none;
  /* Bewusste Ausnahme: Der Stempel schlägt auf – ein echter Stempel federt
     beim Aufsetzen kurz zurück. Das ist DIE Signatur der Stempelkarte und
     der einzige Überschwung im ganzen System. */
  animation: stamp-hit .32s cubic-bezier(.34, 1.3, .64, 1);
}
@keyframes stamp-hit { from { transform: rotate(-4deg) scale(1.7); opacity: 0; } }
.stamp-big.in  { color: var(--green-ink); }
.stamp-big.out { color: var(--amber-ink); }
.stamp-big.err { color: var(--red); transform: rotate(0); }
.stub .stub-line { border-top: 2px dashed #D8CDB4; margin: 14px 0 10px; }
.stub .stub-meta { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.stub .stub-meta div { min-width: 90px; }
.stub .k { font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: #857A5F; }
.stub .v { font-family: var(--font-mono); font-size: var(--fs-lg); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Kundenauswahl am Terminal */
.choose h3 { font-size: var(--fs-lg); text-align: center; margin: var(--s1) 0 2px; color: #F0F6FB; }
.choose .scan-sub { margin-bottom: 14px; }
.choice-grid { display: grid; grid-template-columns: 1fr; gap: 10px; width: 100%; max-height: 42vh; overflow: auto; }
.choice-btn {
  display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 68px;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--line-d);
  border-radius: var(--radius);
  color: #EAF2F8; font-size: var(--fs-lg); font-weight: 700;
  padding: var(--s3) var(--s4); text-align: left;
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.choice-btn:hover { background: rgba(255,255,255,.12); }
.choice-btn:active { transform: scale(.985); }
.choice-btn .bar { width: 6px; align-self: stretch; border-radius: var(--s1); flex: none; }
.choice-btn.intern { color: var(--on-ink-2); font-weight: 600; }
.timerbar-wrap { width: 100%; height: 4px; background: rgba(255,255,255,.12); border-radius: 3px; overflow: hidden; margin-top: 14px; }
.timerbar { height: 100%; background: var(--blue); transform-origin: left; animation: shrink linear forwards; }
@keyframes shrink { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* Ereignis-Feed */
.feed { grid-column: 2; }
.feed h2 { font-size: var(--fs-md); margin: 2px 0 10px; }
.feed-list { display: flex; flex-direction: column; gap: 6px; }
.feed-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; color: #C6D5E1;
  padding: 8px 12px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,.04);
  transition: background var(--fast) var(--ease);
}
.feed-row:hover { background: rgba(255,255,255,.075); }
.feed-row .t { font-family: var(--font-mono); font-size: var(--fs-md); color: var(--on-ink-3); white-space: nowrap; }
.feed-row .n { font-weight: 600; color: var(--on-ink); }
.feed-row .c { font-size: var(--fs-sm); color: var(--on-ink-3); margin-left: auto; text-align: right; }

/* Unsichtbares Fang-Feld für USB-/RFID-Leser */
.hid-catch {
  position: fixed; top: 0; left: 0; width: 2px; height: 2px;
  opacity: 0; border: 0; padding: 0; background: transparent;
  caret-color: transparent; pointer-events: none; z-index: -1;
}

/* ═════════════════ ADMIN (Backoffice) ═════════════════ */
.admin-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side {
  background: var(--ink);
  color: #C6D5E1;
  display: flex; flex-direction: column;
  padding: var(--s5) 14px;
  position: sticky; top: 0; height: 100vh;
}
.side .brand { padding: 2px 10px var(--s5); }
.side .brand h1 { color: #F0F6FB; font-size: var(--fs-lg); }
.side-logo { max-height: 40px; max-width: 150px; object-fit: contain; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav button {
  display: flex; align-items: center; gap: var(--s3);
  background: none; border: 0; color: var(--on-ink-2);
  padding: 11px 12px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; text-align: left;
  position: relative;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.nav button svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav button:hover { background: rgba(255,255,255,.07); color: var(--on-ink); }
.nav button.active { background: rgba(47,125,209,.20); color: #fff; }
.nav button.active svg { opacity: 1; }
.nav button.active::before {
  content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--blue);
}
.nav button .badge {
  margin-left: auto; background: var(--amber); color: #33220A;
  font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 700;
  border-radius: 999px; padding: 1px 8px;
}
.side .foot { margin-top: auto; padding: var(--s3) 10px 0; font-size: var(--fs-sm); color: #7C93A6; }
.side .foot .mono { font-size: var(--fs-xs); }

.main { min-width: 0; padding: 26px clamp(16px, 3vw, 40px) 60px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s4); margin-bottom: var(--s6); flex-wrap: wrap;
}
.topbar h2 { font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -.022em; }
.topbar .sub { color: var(--muted); font-size: 14px; margin-top: 3px; }
.topbar .actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Kennzahl-Kacheln: der Ton steckt im Icon, nicht in einem Randbalken */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--s3); margin-bottom: var(--s6); }
.stat {
  display: flex; align-items: center; gap: 14px;
  padding: var(--s4) var(--s5);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.stat:hover { border-color: #CBD6DF; transform: translateY(-1px); }
.stat .stat-ic {
  width: 42px; height: 42px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--tone-bg, var(--blue-bg));
  color: var(--tone-ink, var(--blue-ink));
}
.stat .stat-ic svg { width: 21px; height: 21px; }
.stat .stat-tx { min-width: 0; }
.stat .v {
  font-family: var(--font-mono); font-weight: 600; font-size: var(--fs-2xl);
  font-variant-numeric: tabular-nums; letter-spacing: -.03em;
  margin: 0; line-height: 1.1; white-space: nowrap;
}
.stat .s { font-size: var(--fs-sm); color: var(--muted); margin-top: 3px; line-height: 1.3; }
.stat.tone-green  { --tone-bg: var(--green-bg);  --tone-ink: var(--green-ink); }
.stat.tone-blue   { --tone-bg: var(--blue-bg);   --tone-ink: var(--blue-ink); }
.stat.tone-amber  { --tone-bg: var(--amber-bg);  --tone-ink: var(--amber-ink); }
.stat.tone-violet { --tone-bg: var(--violet-bg); --tone-ink: var(--violet-ink); }
.stat.tone-slate  { --tone-bg: var(--slate-bg);  --tone-ink: var(--slate-ink); }
.stat.tone-amber .v { color: var(--amber-ink); }

/* Aktivitäts-Diagramm (14 Tage) */
.spark { display: flex; gap: 6px; align-items: stretch; padding: var(--s5) var(--s5) 14px; }
.spark-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.spark-val { font-size: var(--fs-xs); color: var(--muted); height: 14px; line-height: 14px; white-space: nowrap; font-family: var(--font-mono); }
.spark-track {
  width: 100%; max-width: 40px; height: 112px;
  display: flex; align-items: flex-end;
  background: linear-gradient(180deg, transparent calc(100% - 2px), var(--line) calc(100% - 2px));
  border-radius: var(--radius-xs);
}
.spark-bar {
  width: 100%; min-height: 2px;
  border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, #5AA1E0, var(--blue));
  transform-origin: bottom;
  animation: spark-rise .38s var(--ease) both;
  transition: filter var(--fast) var(--ease);
}
@keyframes spark-rise { from { transform: scaleY(0); } }
.spark-bar.today { background: linear-gradient(180deg, #3FCF86, var(--green)); }
.spark-col:hover .spark-bar { filter: brightness(1.1); }
.spark-lbl { font-family: var(--font-mono); font-size: 10px; line-height: 1.25; color: var(--muted); text-align: center; white-space: nowrap; }

/* Filterleiste & Segmente */
.filterbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px var(--s4); }
.filterbar .input, .filterbar select.input { width: auto; min-width: 150px; }
.filterbar .spacer { flex: 1; }
.sum-pill {
  font-family: var(--font-mono); font-size: var(--fs-md); font-weight: 600;
  background: var(--ink); color: #EAF2F8;
  padding: 6px 12px; border-radius: var(--radius-xs); white-space: nowrap;
}
.seg {
  display: inline-flex; gap: 3px; padding: 3px;
  background: #E4EAEF; border-radius: var(--radius-sm);
}
.seg button {
  border: 0; background: transparent; cursor: pointer;
  font: inherit; font-weight: 600; font-size: var(--fs-md);
  color: var(--muted); padding: 7px 14px; border-radius: var(--radius-xs);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.seg button:hover { color: var(--text); }
.seg button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(15,40,60,.16); }

.quickfill {
  display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap;
  padding: var(--s3) 14px; margin-bottom: 14px;
  background: var(--wash); border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: var(--fs-md);
}
.quickfill label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; }
.quickfill .input { width: auto; }

/* Zeiten: Gruppierung je Mitarbeiter */
.emp-group .card-head { flex-wrap: wrap; row-gap: 6px; }
.grp-sum { font-size: var(--fs-md); color: var(--muted); white-space: nowrap; }
.grp-sum b { color: var(--ink); font-weight: 700; }

/* Arbeitszeiten-Tabelle */
#ws-table td { vertical-align: middle; }
#ws-table .input { padding: 7px 9px; min-width: 96px; }
#ws-table tr.row-off td:nth-child(n+3) { opacity: .45; }
#ws-table tr.row-off .input { pointer-events: auto; }

/* Anmeldung */
.gate {
  position: fixed; inset: 0; z-index: 100;
  background:
    radial-gradient(900px 500px at 70% -10%, rgba(47,125,209,.17), transparent 60%),
    var(--ink);
  display: flex; align-items: center; justify-content: center; padding: var(--s5);
}
.gate-card {
  width: 100%; max-width: 380px;
  background: var(--ink-2);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 20px;
  padding: 30px 28px;
  color: var(--on-ink); text-align: center;
  box-shadow: var(--lift-dark), 0 1px 0 rgba(255,255,255,.06) inset;
}
.gate-card .brand { justify-content: center; margin-bottom: var(--s4); }
.gate-card h2 { font-size: var(--fs-xl); margin-bottom: var(--s1); }
.gate-card p { color: var(--on-ink-2); font-size: var(--fs-md); margin-bottom: var(--s5); }
.pin-input {
  width: 100%; text-align: center;
  font-family: var(--font-mono); font-size: 26px; letter-spacing: .5em;
  padding: 13px 8px 13px var(--s4);
  background: rgba(255,255,255,.07);
  border: 1px solid var(--line-d); border-radius: var(--radius);
  color: #fff;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.pin-input::placeholder { color: rgba(255,255,255,.28); }
.pin-input:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(47,125,209,.25); }
.gate-err { color: #FF9297; font-size: var(--fs-md); min-height: 18px; margin: 10px 0 var(--s1); }

/* Logo-Verwaltung */
.brand-logo { max-height: 52px; max-width: 200px; object-fit: contain; }
.report-logo { max-height: 40px; max-width: 160px; object-fit: contain; margin-left: auto; }
.logo-box {
  display: flex; align-items: center; justify-content: center;
  min-height: 96px; margin-bottom: var(--s3); padding: var(--s3);
  border: 1px dashed #C9D5DE; border-radius: var(--radius-sm);
  background:
    linear-gradient(45deg, #F1F4F7 25%, transparent 25%, transparent 75%, #F1F4F7 75%),
    linear-gradient(45deg, #F1F4F7 25%, #fff 25%, #fff 75%, #F1F4F7 75%);
  background-size: 18px 18px; background-position: 0 0, 9px 9px;
}
.logo-preview { max-height: 84px; max-width: 100%; object-fit: contain; }
.logo-empty { color: var(--muted); font-size: var(--fs-md); }

/* Berichte */
.report-block { margin-bottom: var(--s5); }
.rep-detail { font-size: var(--fs-sm); color: var(--muted); margin-top: 2px; }
.wage-line {
  margin: var(--s3) var(--s5) var(--s1);
  padding: 10px 14px;
  background: var(--violet-bg); color: var(--violet-ink);
  border: 1px solid #D6CBF3; border-radius: var(--radius-sm);
  font-size: var(--fs-md);
}

/* ═════════════════ ZENTRALE ═════════════════ */
.ctr-wrap { max-width: 1180px; margin: 0 auto; padding: 26px clamp(14px, 3vw, 36px) 60px; }
.ctr-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: var(--s5); }
.ctr-head .brand-mark { width: 44px; height: 44px; }

/* Mitarbeiter-Fenster der Zentrale: Die Liste bekommt einen eigenen
   Scroll-Bereich, damit das Formular darunter auch bei 100 Mitarbeitern
   erreichbar bleibt. */
#zt-list { max-height: 40vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
#zt-list table { margin: 0; }
#zt-list thead th { position: sticky; top: 0; z-index: 1; }

/* Kurzes Aufblitzen, wenn zu den Bearbeiten-Feldern gesprungen wird */
.hebt-hervor { animation: hebt-hervor 1.4s ease-out; border-radius: 6px; }
@keyframes hebt-hervor {
  0%   { background: var(--amber-bg); box-shadow: 0 0 0 6px var(--amber-bg); }
  100% { background: transparent;     box-shadow: 0 0 0 6px transparent; }
}

/* Kundenzeile: Aktionen gruppiert statt als Knopf-Wand */
.client-name { font-weight: 700; font-size: var(--fs-lg); letter-spacing: -.01em; }
.client-meta { display: flex; flex-direction: column; gap: 3px; margin-top: 5px; }
.client-meta > div { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--muted); }
.client-meta .ic { width: 13px; height: 13px; flex: none; }
.client-meta .warn { color: var(--amber-ink); }
.client-meta .bad  { color: var(--red-ink); }
.act-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.act-row .btn-sm .ic { width: 15px; height: 15px; }

/* ═════════════════ NUR-LESEN-SEITEN (Vorschau & Mitarbeiter) ═════════════════ */
body.readonly { background: var(--bg); }
.ro-wrap { max-width: 900px; margin: 0 auto; padding: var(--s5) var(--s4) var(--s8); }
.ro-head { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s5); }
.ro-head h1 { font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -.022em; }
.ro-head .eyebrow { margin-top: 3px; }
.ro-tools { margin-left: auto; display: flex; align-items: center; gap: var(--s2); }
.ro-live { display: inline-flex; align-items: center; gap: var(--s2); color: var(--muted); font-size: var(--fs-md); }
.ro-live .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: none;
  animation: livepulse 1.8s ease-in-out infinite;
}
.ro-live.is-stale .dot { background: var(--amber); }
.ro-live.is-dead .dot  { background: var(--red); animation: none; }
.ro-month { min-width: 148px; text-align: center; font-weight: 700; font-family: var(--font-mono); }
.ro-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s3); margin-bottom: var(--s4); }
.ro-tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px var(--s4); }
.ro-tile .v { font-family: var(--font-mono); font-size: var(--fs-xl); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.03em; line-height: 1.15; }
.ro-tile .s { color: var(--muted); font-size: var(--fs-sm); margin-top: 3px; }
.ro-tile.is-plus  .v { color: var(--green-ink); }
.ro-tile.is-minus .v { color: var(--red-ink); }
.ro-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: var(--s3); overflow: hidden; }
.ro-card > h2 {
  font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: .13em;
  text-transform: uppercase; color: var(--muted);
  margin: 0; padding: 14px var(--s4) var(--s1);
}
.ro-msg { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s7) var(--s5); text-align: center; color: var(--muted); }
.ro-msg strong { display: block; color: var(--text); font-size: var(--fs-lg); margin-bottom: 6px; }

/* ═════════ Buchhalter-Dashboard (vorschau.php, Monatsbericht) ═════════
   Arbeitsfläche für 100 Mitarbeiter: erst sehen ob etwas nicht stimmt,
   dann jemanden finden, dann ausgeben. */

/* Werkzeugleiste – bleibt beim Blättern oben stehen */
.pv-bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap;
  margin: 0 0 var(--s4);
  padding: var(--s3) 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.pv-bar-monat { display: flex; align-items: center; gap: var(--s2); }
.pv-bar-monat .input { width: auto; min-width: 156px; font-weight: 650; }
.pv-bar-akt { display: flex; align-items: center; gap: var(--s2); margin-left: auto; }

.pv-suche { position: relative; flex: 1 1 220px; min-width: 190px; max-width: 340px; }
.pv-suche .input { padding-left: 38px; }
.pv-suche-ic {
  position: absolute; left: 12px; top: 50%; width: 16px; height: 16px;
  transform: translateY(-50%); color: var(--muted); pointer-events: none;
}
.pv-suche input::-webkit-search-cancel-button { cursor: pointer; }

/* Prüfleiste: jede Kachel ist ein Filter */
.pv-pruef { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s4); align-items: center; }
.pv-flag {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px 7px 10px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--muted);
  font: inherit; font-size: var(--fs-sm); font-weight: 600;
  cursor: pointer;
  transition: border-color var(--fast) var(--ease), color var(--fast) var(--ease),
              background var(--fast) var(--ease);
}
.pv-flag b {
  font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--text);
}
.pv-flag:hover { border-color: var(--slate); color: var(--text); }
.pv-flag.is-on { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.pv-flag.is-on b { color: #fff; }
.pv-flag.ton-amber b { color: var(--amber-ink); }
.pv-flag.ton-red   b { color: var(--red-ink); }
.pv-flag.ton-amber.is-on, .pv-flag.ton-amber.is-on b { color: var(--amber-bg); }
.pv-flag.ton-red.is-on,   .pv-flag.ton-red.is-on   b { color: var(--red-bg); }
.pv-sauber {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--green-ink); font-size: var(--fs-sm); font-weight: 600; padding-left: var(--s2);
}

/* Kopfzeile über der Tabelle: wie viele sieht man gerade */
.pv-tabkopf {
  display: flex; align-items: center; gap: var(--s3);
  padding: 12px var(--s4); border-bottom: 1px solid var(--line-2);
  color: var(--muted); font-size: var(--fs-sm);
}
.pv-tabkopf b { color: var(--text); font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.pv-alle {
  margin-left: auto; border: 0; background: none; padding: 0; cursor: pointer;
  font: inherit; font-size: var(--fs-sm); font-weight: 600; color: var(--blue-ink);
  text-decoration: underline; text-underline-offset: 3px;
}

/* Tabelle: Kopf bleibt beim Scrollen stehen, Spalten sind sortierbar */
.pv-scroll { max-height: min(66vh, 760px); overflow: auto; }
.pv-tbl thead th { position: sticky; top: 0; z-index: 2; }
.pv-sort {
  display: inline-flex; align-items: center; gap: 4px;
  border: 0; background: none; padding: 0; margin: 0; cursor: pointer;
  font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit;
}
.pv-sort:hover { color: var(--text); }
.pv-sort.is-on { color: var(--blue-ink); }

.pv-auf {
  display: inline-flex; align-items: center; gap: var(--s2);
  border: 0; background: none; padding: 0; margin: 0; cursor: pointer;
  font: inherit; color: inherit; text-align: left; width: 100%;
}
.pv-auf > svg { flex: none; color: var(--muted); transition: transform var(--med) var(--ease); }
.pv-zeile.is-auf .pv-auf > svg { transform: rotate(90deg); color: var(--blue-ink); }
.pv-zeile.is-auf > td { background: var(--wash); }
.pv-zeile:hover > td { background: var(--wash); }

/* Aufgeklappte Tagesliste – eingerückt, ohne zweite Karte */
.pv-detail > td { padding: 0 !important; background: var(--wash); }
.pv-tage { padding: 2px 0 var(--s4) 34px; }
.pv-tage table { background: none; }
.pv-tage thead th { background: none; color: var(--muted); }
.pv-tage i { font-style: normal; color: var(--green-ink); font-weight: 600; }

.soft      { color: var(--muted); }
.ist-plus  { color: var(--green-ink); }
.ist-minus { color: var(--red-ink); }
.ist-woe td:first-child, .ist-woe td:nth-child(2) { color: var(--blue-ink); }
.row-warn > td { background: var(--red-bg); }

.ro-leer { padding: var(--s7) var(--s5); text-align: center; color: var(--muted); }
.ro-leer strong { display: block; color: var(--text); font-size: var(--fs-lg); margin: 10px 0 4px; }
.ro-leer p { margin-bottom: var(--s4); }

@media (max-width: 640px) {
  .pv-bar { position: static; }
  .pv-bar-akt { margin-left: 0; width: 100%; }
  .pv-bar-akt .btn { flex: 1; justify-content: center; }
  .pv-suche { max-width: none; }
  .pv-scroll { max-height: none; }
  .pv-tage { padding-left: var(--s3); }
}

/* ═════════ A4-Ausgabeliste für die Chip-Übergabe ═════════
   Papier, kein Bildschirm: schwarz auf weiß, Zeilen hoch genug zum
   Schreiben, Kopfzeile auf jeder Seite, nichts wird zerschnitten. */
#zt-druckblatt { display: none; }

@media print {
  /* Beim Drucken der Liste verschwindet die ganze Zentrale */
  body.druckt-liste > *:not(#zt-druckblatt) { display: none !important; }
  body.druckt-liste { background: #fff; }
  body.druckt-liste #zt-druckblatt { display: block; }

  #zt-druckblatt {
    color: #000;
    font-family: var(--font-body);
    font-size: 10.5pt;
  }
  .ab-kopf {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 12mm; padding-bottom: 3mm; margin-bottom: 5mm;
    border-bottom: 1.5pt solid #000;
  }
  .ab-kopf h1 { font-size: 16pt; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
  .ab-kopf .ab-firma { font-size: 11pt; font-weight: 600; margin-top: 1mm; }
  .ab-kopf .ab-meta { text-align: right; font-size: 9pt; line-height: 1.6; white-space: nowrap; }

  .ab-satz { font-size: 8.5pt; line-height: 1.4; margin-bottom: 3mm; }

  /* Zwei Spalten nebeneinander – nur so bleiben 50 Zeilen beschreibbar */
  .ab-spalten { display: flex; gap: 8mm; align-items: flex-start; }
  .ab-spalten > table.ab-tbl { flex: 1 1 0; width: 50%; }

  table.ab-tbl { width: 100%; border-collapse: collapse; }
  table.ab-tbl thead { display: table-header-group; }
  table.ab-tbl th {
    font-size: 8pt; font-weight: 700; text-align: left;
    text-transform: uppercase; letter-spacing: .06em;
    padding: 0 1.5mm 1.2mm; border-bottom: 1pt solid #000;
  }
  table.ab-tbl td {
    height: 8.6mm;                     /* Platz für Handschrift – nicht enger */
    padding: 0 1.5mm 1.2mm;
    border-bottom: .5pt solid #9a9a9a;
    vertical-align: bottom;
  }
  table.ab-tbl tr { break-inside: avoid; page-break-inside: avoid; }
  .ab-nr   { font-family: var(--font-mono); font-size: 12pt; font-weight: 600; width: 13mm; }
  .ab-name { width: auto; }
  .ab-erh  { width: 22mm; text-align: right; }
  .ab-x    { font-family: var(--font-body); font-size: 11pt; font-weight: 700; color: #000; }
  .ab-frei .ab-x { color: #b4b4b4; }
  .ab-vorgabe { color: #6a6a6a; font-size: 8.5pt; }

  .ab-fuss {
    margin-top: 3mm; padding-top: 1.5mm; border-top: .5pt solid #9a9a9a;
    font-size: 7.5pt; line-height: 1.5; color: #333;
    display: flex; justify-content: space-between; gap: 8mm;
  }
  .ab-seite { break-after: page; page-break-after: always; }
  .ab-seite:last-child { break-after: auto; page-break-after: auto; }
}

@page { size: A4 portrait; margin: 12mm 12mm 10mm; }

/* Am Finger bedient: Tippziele auf 44 px, sonst trifft man die
   Monatspfeile und die Prüfleiste auf dem Handy nicht zuverlässig. */
@media (pointer: coarse) {
  body.readonly .icon-btn { min-width: 44px; min-height: 44px; }
  body.readonly .btn { min-height: 44px; }
  .pv-flag { min-height: 44px; padding-inline: 14px; }
  .pv-bar-monat .input, .pv-suche .input { min-height: 44px; }
  .pv-auf { min-height: 40px; }
}
.ro-msg .ic { color: #A9B8C4; margin-bottom: 10px; }

/* ───────── Responsiv ───────── */
@media (max-width: 1060px) {
  .kiosk-shell { grid-template-columns: 1fr; grid-template-rows: none; }
  .feed { grid-column: 1; }
  .kiosk-left { order: 2; }
  .scan-panel { min-height: 0; }
  .clock { font-size: clamp(56px, 14vw, 110px); }
}
@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .side {
    position: sticky; top: 0; z-index: 20; height: auto;
    flex-direction: row; align-items: center; overflow-x: auto;
    padding: 10px 12px; gap: var(--s2);
  }
  .side .brand { padding: 0 var(--s2) 0 var(--s1); }
  .side .brand .eyebrow { display: none; }
  .nav { flex-direction: row; }
  .nav button { padding: 9px 11px; white-space: nowrap; }
  .nav button.active::before { left: 8px; right: 8px; top: auto; bottom: -10px; width: auto; height: 3px; border-radius: 3px 3px 0 0; }
  .side .foot, .side #btn-logout { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .main { padding-top: var(--s5); }
}
@media (max-width: 700px) {
  /* Auf Touch-Geräten bequemer treffen */
  .btn-sm { padding: 9px 14px; }
  .icon-btn { width: 38px; height: 38px; }
  .topbar h2 { font-size: var(--fs-xl); }
  .spark { gap: 3px; padding: 14px 12px 10px; }
  .spark-val { display: none; }
  .spark-track { height: 82px; }
  .spark-lbl { font-size: 9px; }
  .modal-head, .modal-body, .modal-foot { padding-left: var(--s5); padding-right: var(--s5); }
  .act-row { justify-content: flex-start; }
  #toast-box { left: var(--s3); right: var(--s3); top: var(--s3); max-width: none; }
}

/* ───────── Druck ───────── */
@media print {
  body { background: #fff; }
  .side, .topbar .actions, .filterbar, #toast-box, .seg, .no-print { display: none !important; }
  .admin-shell { display: block; }
  .main { padding: 0; }
  .card { border-color: #bbb; }
  .print-title { display: block !important; font-size: var(--fs-lg); margin-bottom: var(--s3); }
  .report-logo { max-height: 46px; }
  .wage-line { border-color: #bbb; }
  .tbl th { background: #f2f2f2 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.print-title { display: none; }

/* Nur-Lesen-Seiten (Buchhalter-/Mitarbeiter-Ansicht) sauber aufs Papier */
@media print {
  body.readonly { background: #fff; }
  body.readonly .ro-wrap { max-width: none; padding: 0; }
  body.readonly .ro-live,
  body.readonly .ro-tools,
  body.readonly .hint { display: none !important; }
  body.readonly .ro-card,
  body.readonly .ro-tile { border-color: #bbb; break-inside: avoid; }
  body.readonly .ro-tiles { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
  body.readonly .table-scroll { overflow: visible !important; }
  body.readonly .pv-detail { break-inside: avoid; }
  body.readonly tr { break-inside: avoid; }
  body.readonly thead { display: table-header-group; }   /* Kopfzeile auf jeder Seite */
}

/* ───────── Reduzierte Bewegung ───────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
}

/* ═════════ Terminal: festes Anzeige-Format ═════════ */
body.orient-landscape .kiosk-shell {
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, 440px);
  grid-template-rows: auto 1fr;
}
body.orient-landscape .feed { grid-column: 2; }
body.orient-landscape .kiosk-left { order: 0; }
body.orient-landscape .clock { font-size: clamp(48px, 9vw, 120px); }

body.logo-only .kiosk-top .brand > div:not(.brand-mark) { display: none; }
body.logo-only .brand-logo { max-height: 64px; max-width: 300px; }

:fullscreen body, body:fullscreen { background: var(--ink); }

/* ═════════ Hochformat-Terminal: bildschirmfüllend ═════════ */
@keyframes kiosk-drift {
  from { transform: translate(-7vmin, -4vmin); }
  to   { transform: translate(7vmin, 4vmin); }
}
body.kiosk.orient-portrait .kiosk-shell,
body.kiosk:not(.orient-landscape) .kiosk-shell:where(.portrait-auto) {
  max-width: min(94vw, 1060px);
  height: 100dvh; min-height: 100dvh;
  padding: clamp(12px, 2.2vh, 26px) clamp(14px, 4vw, 40px);
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1.3fr) minmax(0, 1fr);
  grid-template-areas: "top top" "scan scan" "left feed";
  gap: clamp(10px, 2vh, 26px);
  overflow: hidden;
  position: relative; z-index: 1;
}
body.kiosk.orient-portrait .kiosk-top  { grid-area: top; }
body.kiosk.orient-portrait .scan-panel { grid-area: scan; min-height: 0; justify-content: center; padding: clamp(16px, 3vh, 30px); }
body.kiosk.orient-portrait .kiosk-left { grid-area: left; min-height: 0; justify-content: flex-start; gap: clamp(10px, 2vh, 20px); }
body.kiosk.orient-portrait .feed       { grid-area: feed; grid-column: auto; min-height: 0; display: flex; flex-direction: column; }
body.kiosk.orient-portrait .feed-list  { flex: 1; min-height: 0; overflow-y: auto; padding-right: var(--s1); }
body.kiosk.orient-portrait .presence   { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-top: 0; }
body.kiosk.orient-portrait .presence-list { flex: 1; max-height: none; min-height: 0; }
body.kiosk.orient-portrait .clock      { font-size: clamp(40px, 9.5vmin, 96px); }
body.kiosk.orient-portrait .scan-zone  {
  width: clamp(210px, 44vmin, 440px); height: clamp(210px, 44vmin, 440px);
  margin: clamp(4px, 1vh, 14px) 0;
}
body.kiosk.orient-portrait .scan-zone .core { inset: 13%; }
body.kiosk.orient-portrait .scan-zone .core svg { width: 36%; height: 36%; }
body.kiosk.orient-portrait .scan-title { font-size: clamp(22px, 3.6vmin, 40px); }
body.kiosk.orient-portrait .scan-sub   { font-size: clamp(13px, 1.9vmin, 18px); }
body.kiosk.orient-portrait .stub       { width: min(600px, 100%); }
body.kiosk.orient-portrait::after {
  content: ""; position: fixed; left: 50%; top: 30%;
  width: 74vmin; height: 74vmin; margin: -37vmin 0 0 -37vmin;
  border-radius: 50%; filter: blur(60px); opacity: .22;
  background: radial-gradient(circle, rgba(88,166,255,.55), transparent 70%);
  animation: kiosk-drift 16s ease-in-out infinite alternate;
  pointer-events: none; z-index: 0;
}

@media (orientation: portrait) {
  body.kiosk:not(.orient-landscape) .kiosk-shell {
    max-width: min(94vw, 1060px);
    height: 100dvh; min-height: 100dvh;
    padding: clamp(12px, 2.2vh, 26px) clamp(14px, 4vw, 40px);
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1.3fr) minmax(0, 1fr);
    grid-template-areas: "top top" "scan scan" "left feed";
    gap: clamp(10px, 2vh, 26px);
    overflow: hidden; position: relative; z-index: 1;
  }
  body.kiosk:not(.orient-landscape) .kiosk-top  { grid-area: top; }
  body.kiosk:not(.orient-landscape) .scan-panel { grid-area: scan; min-height: 0; justify-content: center; padding: clamp(16px, 3vh, 30px); }
  body.kiosk:not(.orient-landscape) .kiosk-left { grid-area: left; min-height: 0; justify-content: flex-start; gap: clamp(10px, 2vh, 20px); }
  body.kiosk:not(.orient-landscape) .feed       { grid-area: feed; grid-column: auto; min-height: 0; display: flex; flex-direction: column; }
  body.kiosk:not(.orient-landscape) .feed-list  { flex: 1; min-height: 0; overflow-y: auto; padding-right: var(--s1); }
  body.kiosk:not(.orient-landscape) .presence   { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-top: 0; }
  body.kiosk:not(.orient-landscape) .presence-list { flex: 1; max-height: none; min-height: 0; }
  body.kiosk:not(.orient-landscape) .clock      { font-size: clamp(40px, 9.5vmin, 96px); }
  body.kiosk:not(.orient-landscape) .scan-zone  {
    width: clamp(210px, 44vmin, 440px); height: clamp(210px, 44vmin, 440px);
    margin: clamp(4px, 1vh, 14px) 0;
  }
  body.kiosk:not(.orient-landscape) .scan-zone .core { inset: 13%; }
  body.kiosk:not(.orient-landscape) .scan-zone .core svg { width: 36%; height: 36%; }
  body.kiosk:not(.orient-landscape) .scan-title { font-size: clamp(22px, 3.6vmin, 40px); }
  body.kiosk:not(.orient-landscape) .scan-sub   { font-size: clamp(13px, 1.9vmin, 18px); }
  body.kiosk:not(.orient-landscape) .stub       { width: min(600px, 100%); }
  body.kiosk:not(.orient-landscape)::after {
    content: ""; position: fixed; left: 50%; top: 30%;
    width: 74vmin; height: 74vmin; margin: -37vmin 0 0 -37vmin;
    border-radius: 50%; filter: blur(60px); opacity: .22;
    background: radial-gradient(circle, rgba(88,166,255,.55), transparent 70%);
    animation: kiosk-drift 16s ease-in-out infinite alternate;
    pointer-events: none; z-index: 0;
  }
}

/* Schmale Handys: untereinander mit normalem Blättern */
@media (max-width: 520px) {
  body.kiosk.orient-portrait .kiosk-shell {
    height: auto; min-height: 100dvh; overflow: visible;
    grid-template-columns: 1fr; grid-template-rows: auto auto auto auto;
    grid-template-areas: "top" "scan" "left" "feed";
  }
  body.kiosk.orient-portrait .presence-list { max-height: 34vh; }
  body.kiosk.orient-portrait .feed-list     { max-height: 40vh; }
  body.kiosk.orient-portrait::after         { opacity: .15; }
}
@media (orientation: portrait) and (max-width: 520px) {
  body.kiosk:not(.orient-landscape) .kiosk-shell {
    height: auto; min-height: 100dvh; overflow: visible;
    grid-template-columns: 1fr; grid-template-rows: auto auto auto auto;
    grid-template-areas: "top" "scan" "left" "feed";
  }
  body.kiosk:not(.orient-landscape) .presence-list { max-height: 34vh; }
  body.kiosk:not(.orient-landscape) .feed-list     { max-height: 40vh; }
  body.kiosk:not(.orient-landscape)::after         { opacity: .15; }
}
