/* ==========================================================
   zeit:mark – Zeiterfassung · Edition „Beige“
   Sand, Elfenbein, Espresso und Bordeaux (aus dem Logo),
   Schrift Lato (wie im Logo, lokal in assets/fonts).
   Andere Farben ohne CSS-Änderung: in config.php 'farben' setzen.
   ========================================================== */
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 300; font-display: swap; src: url('fonts/lato-latin-300-normal.woff2') format('woff2'); }
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/lato-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/lato-latin-700-normal.woff2') format('woff2'); }

:root {
  --pri-900: #1d1a17;
  --pri-800: #2e2924;   /* Espresso */
  --pri-700: #4a4038;
  --pri-500: #9a8b7b;
  --pri-300: #cfc3b3;
  --pri-100: #ede5d9;
  --acc: #871b1b;       /* Bordeaux aus dem Logo */
  --acc-dark: #6b1515;
  --acc-100: #f4e4df;
  --gold: #b8966a;      /* Champagner – feine Linien */
  --bg: #efe8dc;        /* Sand */
  --line: #e1d6c5;
  --card: #fbf8f2;      /* Elfenbein */
  --field: #fffdf9;
  --ink: #1d1d1b;
  --muted: #7d7165;
  --danger: #a12a1f;
  --danger-100: #f6e0da;
  --ok: #4f6b3a;
  --radius: 4px;
  --sans: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --head: var(--sans);
  --shadow: 0 1px 2px rgba(60, 44, 28, .05), 0 8px 24px rgba(60, 44, 28, .07);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .wordmark { font-family: var(--head); font-weight: 650; letter-spacing: -.005em; }
a { color: var(--pri-700); }

/* ==========================================================
   TERMINAL (iPad)
   ========================================================== */
body.terminal {
  background: var(--pri-800);
  color: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.t-wrap {
  min-height: 100vh; min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr minmax(420px, 520px);
  gap: 48px;
  align-items: center;
  padding: max(32px, env(safe-area-inset-top)) 56px max(32px, env(safe-area-inset-bottom));
  max-width: 1280px; margin: 0 auto;
}
.t-side { display: flex; flex-direction: column; gap: 10px; }
.t-brand { display: flex; flex-direction: column; gap: 4px; margin-bottom: 36px; }
.wordmark { font-size: 2.1rem; color: var(--bg); }
.t-logo { max-width: 220px; max-height: 90px; object-fit: contain; }
.t-sub {
  text-transform: uppercase; letter-spacing: .28em; font-size: .78rem; color: var(--acc);
}
.t-clock {
  font-family: var(--head); font-size: clamp(5rem, 11vw, 8.5rem); line-height: 1;
  font-variant-numeric: tabular-nums; color: var(--bg);
}
.t-date { font-size: 1.35rem; color: var(--pri-300); }

.t-card {
  background: var(--bg);
  color: var(--ink);
  border-radius: calc(var(--radius) * 1.6);
  padding: 36px 36px 32px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
  position: relative;
}
.t-card::before {
  content: ''; position: absolute; left: 36px; right: 36px; top: 0; height: 3px;
  background: var(--acc); border-radius: 0 0 3px 3px;
}
.t-title { font-size: 1.5rem; margin: 0 0 18px; text-align: center; }
.t-help { text-align: center; color: var(--muted); }

.pin-display { display: flex; justify-content: center; gap: 16px; margin-bottom: 10px; }
.pin-display span {
  width: 58px; height: 68px; border-radius: 10px;
  background: var(--card); border: 2px solid var(--line);
  position: relative; transition: border-color .15s, opacity .15s;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--head); font-size: 2rem; color: var(--ink);
}
.pin-display span.on { border-color: var(--pri-700); }
.pin-display span.opt { opacity: .45; border-style: dashed; }
.pin-display.pair { gap: 10px; }
.pin-display.pair span { width: 50px; }
.t-actions.one { grid-template-columns: 1fr; }
.t-device { text-align: center; margin-top: 14px; font-size: .78rem; color: var(--muted); letter-spacing: .04em; }

.t-msg { min-height: 1.6em; text-align: center; font-size: 1rem; color: var(--muted); margin-bottom: 8px; }
.t-msg.error { color: var(--danger); font-weight: 600; }

.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.numpad button {
  font-family: var(--head); font-size: 2rem;
  height: 78px; border: 0; border-radius: var(--radius);
  background: var(--card); color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--line);
  cursor: pointer; transition: transform .06s, background .1s;
}
.numpad button:active { transform: scale(.96); background: var(--pri-100); }
.numpad .np-fn { font-family: var(--sans); font-size: 1.4rem; color: var(--muted); background: transparent; box-shadow: none; }

.t-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.btn-stamp {
  height: 96px; border: 0; border-radius: var(--radius);
  font-family: var(--head); font-size: 1.7rem; color: #fff; cursor: pointer;
  transition: transform .06s, opacity .2s, filter .1s;
}
.btn-stamp:active { transform: scale(.97); filter: brightness(.95); }
.btn-stamp:disabled { opacity: .35; cursor: default; }
.btn-kommen { background: var(--pri-700); }
.btn-gehen { background: var(--acc); }

.t-result {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  background: var(--pri-800);
  animation: fade .2s ease-out;
}
.t-result.is-gehen { background: var(--acc-dark); }
.t-result[hidden] { display: none; }
.t-result-inner { text-align: center; padding: 40px; max-width: 760px; }
.t-check {
  width: 120px; height: 120px; margin: 0 auto 28px; border-radius: 50%;
  border: 3px solid var(--bg); display: flex; align-items: center; justify-content: center;
  font-size: 3.6rem; color: var(--bg);
}
.t-r-greet { font-family: var(--head); font-size: 2.6rem; color: var(--bg); margin-bottom: 12px; }
.t-r-main { font-size: 1.8rem; color: var(--bg); font-variant-numeric: tabular-nums; }
.t-r-sub { font-size: 1.2rem; color: rgba(255, 255, 255, .75); margin-top: 8px; }
.t-r-hint {
  margin-top: 26px; padding: 14px 20px; border-radius: var(--radius);
  background: rgba(255, 255, 255, .14); color: var(--bg); font-size: 1.1rem;
}
.t-admin {
  position: fixed; right: 18px; bottom: max(14px, env(safe-area-inset-bottom));
  color: rgba(255, 255, 255, .35); font-size: .8rem; text-decoration: none;
}
@keyframes fade { from { opacity: 0; transform: scale(1.02); } to { opacity: 1; transform: none; } }

/* iPad hochkant / kleinere Geräte */
@media (max-width: 960px), (orientation: portrait) {
  body.terminal { overflow: auto; }
  .t-wrap { grid-template-columns: 1fr; gap: 28px; padding: 28px 24px; align-content: center; justify-items: center; }
  .t-side { align-items: center; text-align: center; }
  .t-brand { margin-bottom: 8px; align-items: center; }
  .t-clock { font-size: clamp(4rem, 14vw, 6.5rem); }
  .t-card { width: 100%; max-width: 520px; }
}
@media (max-height: 700px) and (orientation: landscape) {
  .numpad button { height: 62px; }
  .btn-stamp { height: 76px; }
  .t-card { padding: 26px 28px 24px; }
}

/* ==========================================================
   ADMIN
   ========================================================== */
.a-header {
  background: var(--pri-800); color: var(--bg);
  border-bottom: 3px solid var(--acc);
}
.a-header-inner {
  max-width: 1200px; margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; gap: 16px; flex-wrap: nowrap;
}
.a-brand { display: flex; align-items: baseline; gap: 12px; text-decoration: none; color: var(--bg); }
.a-brand .wordmark { font-size: 1.45rem; }
.a-brand small { color: var(--acc); text-transform: uppercase; letter-spacing: .2em; font-size: .68rem; }
.a-brand { flex: none; }
.a-nav { display: flex; gap: 2px; flex-wrap: nowrap; flex: 1; min-width: 0; }
.a-nav a {
  color: var(--pri-100); text-decoration: none; padding: 8px 9px; border-radius: 8px; font-size: .92rem; white-space: nowrap;
}
.a-nav a:hover { background: var(--pri-700); }
.a-nav a.active { background: var(--pri-700); color: #fff; box-shadow: inset 0 -2px 0 var(--acc); }
.a-user { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: .85rem; line-height: 1.3; color: var(--pri-300); white-space: nowrap; }
.a-user a { color: var(--bg); font-size: .8rem; }
.a-user a.a-me { color: var(--pri-300); font-size: .85rem; text-decoration: none; }
.a-user a.a-me:hover, .a-user a.a-me.active { color: var(--bg); text-decoration: underline; }
.a-2fa { display: inline-block; font-size: .68rem; font-weight: 700; letter-spacing: .04em; padding: 1px 5px; border-radius: 4px; background: var(--acc); color: var(--bg); vertical-align: 1px; }

/* schmalere Bildschirme: Menü in eigene Zeile statt Umbruch mittendrin */
/* Menü immer in eigener Zeile unter Logo und Benutzer – überlappt bei keiner Breite */
.a-header-inner { flex-wrap: wrap; row-gap: 8px; padding-bottom: 10px; }
.a-user { margin-left: auto; flex-direction: row; align-items: baseline; gap: 14px; }
.a-nav { order: 3; flex: 1 1 100%; flex-wrap: wrap; margin-left: -9px; }

.a-main { max-width: 1200px; margin: 0 auto; padding: 32px 24px 64px; }
.a-main h1 { font-size: 1.9rem; margin: 0 0 6px; }
.a-lead { color: var(--muted); margin: 0 0 26px; }

.card {
  background: var(--card); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: 0 1px 0 var(--line), var(--shadow);
  margin-bottom: 24px;
}
.card h2 { font-size: 1.2rem; margin: 0 0 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 860px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.stat { background: var(--card); border-radius: var(--radius); padding: 18px 22px; box-shadow: var(--shadow); border-top: 3px solid var(--pri-500); }
.stat.accent { border-top-color: var(--acc); }
.stat .num { font-family: var(--head); font-size: 2.2rem; line-height: 1.1; }
.stat .lbl { color: var(--muted); font-size: .9rem; }

table.tbl { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tbl th {
  text-align: left; font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); padding: 10px 10px; border-bottom: 2px solid var(--line);
}
.tbl td { padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.sum td { font-weight: 700; background: var(--pri-100); }
.tbl tr.day-sep td { background: var(--bg); font-family: var(--head); font-size: .95rem; }
.tbl tr.pause-row td { font-size: .88rem; padding-top: 5px; padding-bottom: 7px; font-style: italic; }
.tbl .num, .tbl .t { font-variant-numeric: tabular-nums; }
.tbl .right { text-align: right; }
.table-wrap { overflow-x: auto; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap;
  background: var(--line); color: var(--muted);
}
.badge.in { background: var(--pri-100); color: var(--pri-700); }
.badge.out { background: var(--acc-100); color: var(--acc-dark); }
.badge.warn { background: var(--danger-100); color: var(--danger); }
.badge.admin { background: var(--pri-800); color: var(--bg); }

.form-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; min-width: 150px; }
.field.grow { flex: 1; }
.field label, .lbl-small { font-size: .82rem; color: var(--muted); font-weight: 600; }
input[type=text], input[type=password], input[type=date], input[type=time], input[type=number], input[type=datetime-local], select, input[type=file] {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); min-height: 42px;
}
input:focus, select:focus { outline: 2px solid var(--pri-500); outline-offset: 0; border-color: var(--pri-500); }
.check { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.check input { width: 18px; height: 18px; accent-color: var(--pri-700); }
.hint { font-size: .82rem; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; padding: 10px 18px; min-height: 42px;
  border-radius: 8px; border: 0; cursor: pointer; text-decoration: none;
  background: var(--pri-700); color: #fff;
}
.btn:hover { background: var(--pri-800); }
.btn.accent { background: var(--acc); }
.btn.accent:hover { background: var(--acc-dark); }
.btn.ghost { background: transparent; color: var(--pri-700); box-shadow: inset 0 0 0 1px var(--pri-300); }
.btn.ghost:hover { background: var(--pri-100); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 5px 10px; min-height: 0; font-size: .85rem; }
.link-sm { font-size: .85rem; }

.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; background: var(--pri-100); color: var(--pri-800); border-left: 4px solid var(--pri-500); }
.flash.err { background: var(--danger-100); color: var(--danger); border-left-color: var(--danger); }
.flash.warn { background: var(--acc-100); color: var(--acc-dark); border-left-color: var(--acc); }

.muted { color: var(--muted); }
.edit-mark { color: var(--acc-dark); font-size: .8rem; }
a.time-link {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; margin: -4px -10px;
  border-radius: 6px; text-decoration: none; color: var(--pri-800); font-variant-numeric: tabular-nums;
  border: 1px solid transparent; cursor: pointer;
}
a.time-link:hover { background: var(--pri-100); border-color: var(--pri-300); }
a.time-link.active { background: var(--acc-100); border-color: var(--acc); }
.time-form .field { min-width: 0; }
.time-form input.hhmm { width: 110px; text-align: center; font-size: 1.1rem; font-variant-numeric: tabular-nums; letter-spacing: .05em; }
.preset-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

/* Login-Seite */
body.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--pri-800); padding: 20px; }
.login-card { width: 100%; max-width: 400px; background: var(--bg); border-radius: 18px; padding: 36px; box-shadow: 0 24px 60px rgba(0,0,0,.25); position: relative; }
.login-card::before { content: ''; position: absolute; left: 36px; right: 36px; top: 0; height: 3px; background: var(--acc); }
.login-card h1 { margin: 0 0 4px; font-size: 1.7rem; }
.login-card .field { min-width: 0; }
.login-card .btn { width: 100%; margin-top: 6px; }
.login-card .back { display: block; text-align: center; margin-top: 18px; font-size: .9rem; }

/* ---------- Buchungen: ganze Zeilen auswählen & löschen ---------- */
.tbl th.sel, .tbl td.sel { width: 1%; text-align: center; padding-left: 6px; padding-right: 6px; }
.tbl .sel input[type=checkbox] { width: 18px; height: 18px; cursor: pointer; accent-color: var(--danger); vertical-align: middle; }
.tbl tr.is-selected td { background: var(--danger-100); }
.tbl tr.is-selected td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.bulk-bar {
  position: sticky; bottom: 16px; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin: 18px 0 0; padding: 12px 16px;
  background: var(--pri-800); color: var(--bg);
  border-radius: var(--radius); border-bottom: 3px solid var(--danger); box-shadow: var(--shadow);
}
.bulk-bar[hidden] { display: none; }
.bulk-bar .bulk-count { font-weight: 600; margin-right: 4px; }
.bulk-bar input[type=text] { flex: 1 1 240px; min-width: 0; }
.bulk-bar .btn.ghost { color: var(--bg); box-shadow: inset 0 0 0 1px var(--pri-500); }
.bulk-bar .btn.ghost:hover { background: var(--pri-700); }

/* ---------- Buchungen: Bearbeiten-Dialog pro Buchung ---------- */
.tbl .sel-wrap { display: inline-flex; align-items: center; gap: 8px; }
.tbl .row-edit {
  width: 30px; height: 30px; padding: 0; border: 0; border-radius: 8px; cursor: pointer;
  background: transparent; color: var(--pri-700); font-size: 1rem; line-height: 1;
  box-shadow: inset 0 0 0 1px var(--pri-300);
}
.tbl .row-edit:hover, .tbl .row-edit:focus-visible { background: var(--pri-100); color: var(--pri-900); }
.row-dialog {
  width: min(560px, calc(100vw - 32px)); padding: 24px 26px 20px; border: 0;
  border-radius: var(--radius); border-top: 4px solid var(--acc);
  background: var(--card); color: var(--ink); box-shadow: var(--shadow);
}
.row-dialog::backdrop { background: rgba(16, 32, 48, .45); }
.row-dialog h2 { margin: 0 0 4px; font-size: 1.2rem; }
.row-dialog .rd-sub { margin: 0 0 16px; color: var(--muted); }
.row-dialog .rd-time { width: 110px; font-variant-numeric: tabular-nums; }
.row-dialog .rd-dur output { display: block; padding: 10px 0; font-weight: 600; }
.row-dialog .rd-bounds { margin: -4px 0 14px; }
.row-dialog .rd-err { margin: 0 0 12px; color: var(--danger); font-weight: 600; }
.row-dialog .rd-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 4px; }
.row-dialog .rd-spacer { flex: 1; }

/* Rechte (Admin / Verwalter) */
.rechte-box { border: 1px solid rgba(0,0,0,.12); border-radius: 8px; padding: 12px 14px 4px; margin-bottom: 14px; }
.rechte-box .check { align-items: flex-start; }
.rechte-box .check input { flex: none; margin-top: 2px; }
.rechte-list { margin: 4px 0 8px 26px; }
.rechte-list .check { margin-bottom: 8px; }

/* ---------- Zwei-Faktor-Anmeldung ---------- */
.tfa-setup { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.tfa-qr { background: #fff; padding: 10px; border-radius: 10px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.1); line-height: 0; }
.tfa-qr svg { width: 220px; height: 220px; }
.tfa-key { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1rem; letter-spacing: .06em; background: var(--line); padding: 8px 12px; border-radius: 8px; display: inline-block; user-select: all; word-break: break-all; }
.tfa-steps { margin: 0 0 14px; padding-left: 20px; }
.tfa-steps li { margin-bottom: 6px; }
.tfa-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.05rem; background: var(--line); padding: 14px 18px; border-radius: 10px; margin: 0 0 14px; max-width: 360px; list-style: none; }
.otp-input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.5rem !important; letter-spacing: .3em; text-align: center; }
@media print { .a-header, .no-print { display: none !important; } }

/* Einrichtungsblatt für den Handy-Einladungslink (Drucken / als PDF) */
.einl-print { display: none; }
@media print {
  @page { size: A4; margin: 16mm 18mm; }
  body.print-einladung { background: #fff; }
  body.print-einladung .a-main { max-width: none; padding: 0; }
  body.print-einladung .a-main > *:not(.einl-print) { display: none !important; }
  body.print-einladung .einl-print { display: block; color: #222; font-size: 11pt; line-height: 1.45; }
}
.einl-print * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
@media print { body.print-einladung .einl-print + .einl-print { break-before: page; page-break-before: always; } }
.einl-p-head { text-align: center; padding-bottom: 10px; border-bottom: 2px solid var(--acc); margin-bottom: 14px; }
.einl-p-head .wordmark { font-size: 26pt; color: var(--ink); }
.einl-p-logo { max-width: 60mm; max-height: 22mm; object-fit: contain; }
.einl-p-sub { text-transform: uppercase; letter-spacing: .28em; font-size: 8pt; color: var(--acc); margin-top: 4px; }
.einl-p-title { font-family: var(--head); font-size: 22pt; font-weight: 400; text-align: center; margin: 0 0 4px; }
.einl-p-for { text-align: center; margin: 0 0 18px; }
.einl-p-main { display: flex; align-items: center; gap: 12mm; margin-bottom: 16px; break-inside: avoid; }
.einl-p-qr { flex: 0 0 auto; border: 1px solid #ccc; border-radius: 10px; padding: 8mm; }
.einl-p-qr svg { display: block; width: 52mm; height: 52mm; }
.einl-p-steps { margin: 0; padding-left: 20px; }
.einl-p-steps li { margin-bottom: 8px; }
.einl-p-box { background: #f0ebe1; border-radius: 10px; padding: 12px 18px; margin-bottom: 16px; break-inside: avoid; }
.einl-p-box h2 { font-family: var(--head); font-size: 13pt; font-weight: 400; margin: 0 0 4px; }
.einl-p-box p { margin: 0; }
.einl-p-link { font-size: 9pt; color: #555; margin: 0 0 12px; }
.einl-p-link code { font-size: 9pt; color: #222; word-break: break-all; }
.einl-p-foot { font-size: 8.5pt; color: #555; border-top: 1px solid #ddd; padding-top: 10px; margin: 0; }

/* ==========================================================
   HANDY (Einrichten / Stempeln per QR-Code)
   ========================================================== */
body.handy {
  background: var(--pri-800); color: var(--ink);
  min-height: 100vh; min-height: 100dvh;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.h-wrap {
  max-width: 480px; margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}
.h-brand { text-align: center; margin: 8px 0 20px; }
.h-brand .wordmark { font-size: 1.8rem; }
.h-logo { max-width: 180px; max-height: 70px; object-fit: contain; }
.h-card {
  background: var(--bg); border-radius: calc(var(--radius) * 1.4);
  padding: 28px 22px 24px; box-shadow: 0 24px 60px rgba(0, 0, 0, .25); position: relative;
}
.h-card::before { content: ''; position: absolute; left: 28px; right: 28px; top: 0; height: 3px; background: var(--acc); border-radius: 0 0 3px 3px; }
.h-title { font-size: 1.45rem; margin: 0 0 6px; text-align: center; }
.h-greet { text-align: center; font-family: var(--head); font-size: 1.15rem; margin: 0 0 18px; color: var(--pri-700); min-height: 1em; }
.h-text { margin: 0 0 14px; }
.h-steps { margin: 0 0 20px; padding-left: 22px; }
.h-steps li { margin-bottom: 6px; }
.h-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.h-actions.one { grid-template-columns: 1fr; }
.h-actions .btn-stamp { height: 110px; font-size: 1.6rem; }
.h-msg { min-height: 1.5em; text-align: center; color: var(--muted); margin-bottom: 10px; }
.h-msg.error { color: var(--danger); font-weight: 600; }
.h-help { text-align: center; font-size: .88rem; color: var(--muted); margin: 8px 0 0; }
.h-result {
  margin: -28px -22px -24px; padding: 36px 22px 28px; text-align: center;
  border-radius: calc(var(--radius) * 1.4); background: var(--pri-800); color: var(--bg);
}
.h-result.is-gehen { background: var(--acc-dark); }
.h-result[hidden], #stamp[hidden], #setup[hidden] { display: none; }
.h-result .t-check { width: 96px; height: 96px; font-size: 3rem; margin-bottom: 20px; }
.h-result .t-r-greet { font-size: 1.7rem; }
.h-result .t-r-main { font-size: 1.35rem; }
.h-result .t-r-hint { font-size: 1rem; }
.h-light { color: rgba(255, 255, 255, .8); }

/* ---------- Terminal: QR-Code fürs Handy ---------- */
.t-qr { text-align: center; }
.t-qr-box {
  display: inline-block; background: #fff; padding: 14px; border-radius: 14px; line-height: 0;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); position: relative;
}
.t-qr-box svg { width: min(300px, 62vw); height: auto; aspect-ratio: 1; transition: opacity .25s; }
.t-qr-box.loading svg { opacity: .25; }
.t-qr-bar { height: 4px; border-radius: 2px; background: var(--line); margin: 14px auto 0; max-width: 300px; overflow: hidden; }
.t-qr-bar span { display: block; height: 100%; background: var(--acc); width: 100%; transform-origin: left; }
.t-qr-steps { color: var(--muted); margin: 14px 0 0; font-size: 1rem; }
.t-switch {
  display: block; width: 100%; margin-top: 18px; padding: 14px; border: 0; border-radius: var(--radius);
  background: transparent; color: var(--pri-700); font: inherit; font-size: 1.05rem; cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--pri-300);
}
.t-switch:active { background: var(--pri-100); }
.t-pane[hidden] { display: none; }

/* ---------- Handy: Meine Stunden ---------- */
a.h-link { text-align: center; text-decoration: none; box-sizing: border-box; }
a.h-link[hidden] { display: none; }
.h-link-light { color: var(--bg); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .45); margin-bottom: 8px; }
.h-link-light:active { background: rgba(255, 255, 255, .08); }
.m-head .h-greet { margin-bottom: 14px; }
.m-today {
  background: var(--line); border-radius: var(--radius); padding: 16px; text-align: center; margin-bottom: 18px;
}
.m-today.is-in { background: var(--pri-800); color: var(--bg); }
.m-today-label { font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; opacity: .75; }
.m-today-val { font-family: var(--head); font-size: 2.2rem; line-height: 1.2; margin: 4px 0; }
.m-today-sub { font-size: .92rem; opacity: .85; }
.m-nav { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 6px; }
.m-nav a, .m-nav span {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%;
  font-size: 1.6rem; text-decoration: none; color: var(--pri-700);
}
.m-nav a:active { background: var(--pri-100); }
.m-nav strong { font-family: var(--head); font-size: 1.2rem; font-weight: 400; }
.m-sum { text-align: center; margin-bottom: 14px; color: var(--muted); }
.m-sum strong { color: var(--ink); }
.m-sum span { font-size: .85rem; }
.m-days { border-top: 1px solid var(--line); }
.m-week {
  font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--acc-dark);
  padding: 12px 0 4px; border-bottom: 1px solid var(--line);
}
.m-day {
  display: grid; grid-template-columns: 58px 1fr auto; gap: 10px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.m-day.has-gap { background: linear-gradient(90deg, rgba(180, 60, 40, .07), transparent 70%); }
.m-date { font-variant-numeric: tabular-nums; line-height: 1.2; }
.m-date span { display: block; font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.m-times { display: flex; flex-wrap: wrap; gap: 2px 10px; font-variant-numeric: tabular-nums; }
.m-times em { color: var(--danger); font-style: normal; font-weight: 600; }
.m-times small { width: 100%; color: var(--muted); font-size: .8rem; }
.m-dur { font-weight: 600; font-variant-numeric: tabular-nums; }
.m-foot { margin-top: 18px; }
.m-times em.run { color: var(--pri-700); font-weight: 600; }

/* Meine Stunden: Wochen zum Aufklappen */
.m-weeks { border-top: 1px solid var(--line); }
.m-wk { border-bottom: 1px solid var(--line); }
.m-wk summary {
  list-style: none; cursor: pointer; display: grid; grid-template-columns: 1fr auto; align-items: center;
  gap: 2px 12px; padding: 12px 2px;
}
.m-wk summary::-webkit-details-marker { display: none; }
.m-wk-title { font-family: var(--head); font-size: 1.1rem; }
.m-wk-title small { display: block; font-family: var(--sans, inherit); font-size: .8rem; color: var(--muted); }
.m-wk-title em { color: var(--danger); font-style: normal; font-weight: 600; }
.m-wk-sum { font-weight: 600; font-size: 1.1rem; font-variant-numeric: tabular-nums; text-align: right; }
.m-wk-more { grid-column: 1 / -1; font-size: .8rem; color: var(--pri-700); }
.m-wk-more::after { content: ' ▾'; }
.m-wk[open] .m-wk-more::after { content: ' ▴'; }
.m-wk[open] .m-wk-more { font-size: 0; }
.m-wk[open] .m-wk-more::after { font-size: .8rem; content: 'Details ausblenden ▴'; }
.m-wk .m-days { border-top: 0; padding: 0 0 8px; }
.m-wk .m-day { padding: 8px 0; font-size: .95rem; border-bottom: 1px dashed var(--line); }
.m-wk .m-day:last-child { border-bottom: 0; }
.m-wk.has-gap summary { background: linear-gradient(90deg, rgba(180, 60, 40, .07), transparent 70%); }
a.h-back {
  display: flex; align-items: center; justify-content: center; text-decoration: none;
  height: auto; min-height: 56px; padding: 12px 16px; font-size: 1.15rem; margin: 0 0 18px; border-radius: var(--radius);
}
.m-foot a.h-back { margin: 0 0 12px; }
a.h-back { font-size: 1.1rem; white-space: nowrap; }
.m-sum span { white-space: nowrap; }

/* Verwaltung: Stunden eines Mitarbeiters */
.stunden-grid { grid-template-columns: 1.4fr 1fr; align-items: start; }
@media (max-width: 860px) { .stunden-grid { grid-template-columns: 1fr; } }
.tbl tr.is-current td { background: var(--pri-100); }
.card .m-nav strong { font-size: 1.15rem; }

/* Übersicht: Kacheln als Filter */
a.stat-link { display: block; color: inherit; text-decoration: none; transition: transform .12s, box-shadow .12s; }
a.stat-link:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0, 0, 0, .10); }
a.stat-link.is-active { outline: 2px solid var(--pri-500); outline-offset: -2px; }
.stat-more { margin-left: 6px; font-size: .8rem; color: var(--pri-700); white-space: nowrap; }

/* ==========================================================
   Emba-Protec: Logo, Typografie, Ergänzungen
   ========================================================== */
.a-logo { height: 38px; width: auto; display: block; }
.a-brand { align-items: center; }
.a-brand small { color: var(--acc); }
.t-logo { max-width: 240px; max-height: 170px; width: 240px; height: auto; }
.h-logo { max-width: 150px; max-height: 110px; width: 150px; height: auto; }
.login-logo { display: block; width: 120px; height: auto; margin: 0 0 18px; }
.t-clock { font-weight: 300; letter-spacing: -.02em; }
.t-title, .h-title { font-weight: 650; }
.numpad button { font-family: var(--sans); font-weight: 500; font-size: 1.9rem; }
.btn-stamp { font-family: var(--sans); font-weight: 650; letter-spacing: .02em; }
.btn-gehen { color: var(--pri-900); }
.t-r-greet { font-weight: 650; }
.stat .num { font-weight: 650; }
.a-main h1 { font-weight: 700; }
.card h2 { font-weight: 650; }
.tbl tr.day-sep td { font-weight: 650; color: var(--pri-800); }
.m-nav strong, .m-wk-title { font-weight: 650; }
.btn.accent { color: var(--pri-900); }
.btn.accent:hover { color: #fff; }
.badge.abt { background: var(--pri-100); color: var(--pri-800); letter-spacing: .03em; }
.badge.modell { background: var(--acc-100); color: var(--acc-dark); }
.badge.befreit { background: var(--line); color: var(--muted); }
.diff-plus { color: var(--ok); font-weight: 600; }
.diff-minus { color: var(--danger); font-weight: 600; }
.soll { color: var(--muted); font-size: .85em; }

/* Stammdaten: Arbeitszeitmodell-Tabelle */
.mod-tage { width: 100%; border-collapse: collapse; margin: 6px 0 14px; }
.mod-tage th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 6px; border-bottom: 2px solid var(--line); }
.mod-tage td { padding: 5px 6px; border-bottom: 1px solid var(--line); }
.mod-tage input[type=text] { width: 90px; min-height: 36px; padding: 6px 8px; text-align: right; font-variant-numeric: tabular-nums; }
.mod-tage input.hhmm { text-align: center; }
.mod-tage tfoot td { font-weight: 700; border-bottom: 0; }
.mod-card { border-left: 4px solid var(--acc); }
.mod-list .tbl td { vertical-align: top; }
.zuordnung-hist { margin: 4px 0 12px; padding-left: 18px; font-size: .85rem; color: var(--muted); }

/* Farbiges Logo oben im hellen Stempelfeld (Terminal + Handy) */
.t-card, .h-card { background: #fff; }
.card-logo-wrap { text-align: center; margin: 4px 0 14px; }
.card-logo { width: 104px; height: auto; display: inline-block; }
.h-card .card-logo { width: 92px; }
.t-brand { margin-bottom: 20px; }
.t-sub { font-size: .9rem; }
.h-card .h-brand .wordmark { color: var(--pri-800); }
@media (max-height: 760px) and (orientation: landscape) {
  .card-logo { width: 76px; }
  .card-logo-wrap { margin: 0 0 8px; }
}
.t-card .numpad button { background: var(--bg); box-shadow: inset 0 -2px 0 var(--line); }
.t-card .numpad button:active { background: var(--pri-100); }
.t-card .numpad .np-fn { background: transparent; box-shadow: none; }
.t-card .pin-display span { background: var(--bg); border-color: var(--line); }
.t-card .pin-display span.on { border-color: var(--pri-700); }
@media (max-height: 880px) and (orientation: landscape) {
  .t-card { padding: 22px 30px 22px; }
  .card-logo { width: 72px; }
  .card-logo-wrap { margin: 0 0 6px; }
  .t-title { margin-bottom: 12px; }
  .numpad { gap: 10px; margin-bottom: 14px; }
  .numpad button { height: 64px; }
  .btn-stamp { height: 80px; }
}

/* Terminal hell, damit das farbige Logo (Blau + Gold) gut erkennbar ist */
body.terminal { background: #e9eef3; color: var(--ink); }
body.terminal .t-logo { width: 220px; max-width: 220px; max-height: none; }
body.terminal .t-sub { color: var(--acc-dark); }
body.terminal .t-clock { color: var(--pri-800); }
body.terminal .t-date { color: var(--muted); }
body.terminal .wordmark { color: var(--pri-800); }
body.terminal .t-card { box-shadow: 0 2px 4px rgba(16, 32, 48, .06), 0 18px 48px rgba(16, 32, 48, .14); }
body.terminal .t-admin { color: rgba(16, 32, 48, .35); }
@media (max-width: 960px), (orientation: portrait) {
  body.terminal .t-logo { width: 150px; }
}

/* Mitarbeiterliste kompakt; unter 1200 px Formular unter die Liste */
.ma-grid { grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); align-items: start; }
@media (max-width: 1200px) { .ma-grid { grid-template-columns: minmax(0, 1fr); } }
.ma-name a { font-weight: 600; }
.ma-name small { display: block; color: var(--muted); font-size: .78rem; letter-spacing: .04em; }
.ma-act { white-space: nowrap; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; margin-left: 4px;
  border-radius: 6px; text-decoration: none; color: var(--pri-700); font-size: 1rem;
  box-shadow: inset 0 0 0 1px var(--pri-300);
}
.icon-btn:hover { background: var(--pri-100); }
.ma-grid .tbl th, .ma-grid .tbl td { padding-left: 6px; padding-right: 6px; }
.ma-grid .tbl .badge { padding: 3px 8px; }
.ma-grid { grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); }
@media (max-width: 1200px) { .ma-grid { grid-template-columns: minmax(0, 1fr); } }

/* Abwesenheiten */
.abw-grid { grid-template-columns: minmax(280px, .8fr) minmax(0, 1.4fr); align-items: start; }
@media (max-width: 1000px) { .abw-grid { grid-template-columns: minmax(0, 1fr); } }
.badge.abw-urlaub { background: #e3f1e8; color: #2e7d4f; }
.badge.abw-krank { background: var(--danger-100); color: var(--danger); }
.badge.abw-sonder, .badge.abw-schule { background: var(--pri-100); color: var(--pri-800); }
.badge.abw-ueberstd { background: var(--acc-100); color: var(--acc-dark); }
.badge.abw-unbezahlt { background: var(--line); color: var(--muted); }

/* Import */
.imp-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 860px) { .imp-stats { grid-template-columns: 1fr 1fr; } }
.imp-felder .field { min-width: 210px; }

/* Arbeitszeitvereinbarung: Wochenstunden verteilen */
.mod-verteilen { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 12px 14px; background: var(--pri-100); border-radius: 10px; }
.mod-wt { display: flex; gap: 4px; }
.mod-wt label { cursor: pointer; }
.mod-wt input { position: absolute; opacity: 0; pointer-events: none; }
.mod-wt span { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; font-size: .85rem; font-weight: 600;
  background: #fff; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.mod-wt input:checked + span { background: var(--pri-700); color: #fff; box-shadow: none; }
.mod-wt input:focus-visible + span { outline: 2px solid var(--pri-500); outline-offset: 1px; }
/* Stammdaten: Standard-Arbeitszeit einer Abteilung zuweisen */
.abt-zuweisen { margin-top: 14px; padding: 12px 14px; border-left: 3px solid var(--acc); background: var(--acc-100); border-radius: 0 8px 8px 0; }
.abt-zuweisen .field { margin-bottom: 0; }

/* ==========================================================
   zeit:mark · Edition „Beige“ – Feinschliff
   (steht am Ende, damit es die Emba-Regeln oben übersteuert)
   ========================================================== */
body { font-weight: 400; letter-spacing: .005em; }
h1, h2, h3 { letter-spacing: .01em; }
::selection { background: var(--acc-100); color: var(--acc-dark); }
input[type=text], input[type=password], input[type=date], input[type=time], input[type=number], input[type=datetime-local], select, input[type=file], textarea {
  background: var(--field); border-color: var(--line); border-radius: var(--radius);
}
input:focus, select:focus, textarea:focus { outline: 1px solid var(--pri-500); border-color: var(--pri-500); }
.btn, .btn-stamp, .numpad button, .t-switch, a.h-back { border-radius: var(--radius); }
.btn { font-weight: 700; letter-spacing: .03em; background: var(--pri-800); }
.btn:hover { background: var(--pri-900); }
.btn.accent, .btn.accent:hover { color: #fff; }
.btn.ghost { color: var(--pri-800); box-shadow: inset 0 0 0 1px var(--pri-300); }

/* ---------- Terminal ---------- */
body.terminal {
  background: radial-gradient(ellipse at 20% 0%, #f7f2e9 0%, var(--bg) 55%, #e6ddcd 100%);
  color: var(--ink);
}
body.terminal .t-logo { width: 300px; max-width: 80vw; }
body.terminal .t-sub {
  color: var(--muted); font-size: .78rem; letter-spacing: .42em; font-weight: 400;
  padding-top: 14px; margin-top: 10px; border-top: 1px solid var(--gold); align-self: flex-start;
}
body.terminal .t-clock { color: var(--ink); font-weight: 300; letter-spacing: -.01em; }
body.terminal .t-date { color: var(--muted); font-weight: 300; letter-spacing: .04em; }
body.terminal .t-card {
  background: var(--card); border: 1px solid rgba(184, 150, 106, .28);
  box-shadow: 0 2px 6px rgba(60, 44, 28, .05), 0 24px 60px rgba(60, 44, 28, .12);
}
.t-card::before, .h-card::before, .login-card::before { background: var(--acc); height: 2px; left: 50%; right: auto; width: 56px; margin-left: -28px; border-radius: 0; }
.t-title, .h-title { font-weight: 300; font-size: 1.65rem; letter-spacing: .02em; }
.pin-display span, .t-card .pin-display span { background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); font-weight: 300; }
.pin-display span.on, .t-card .pin-display span.on { border-color: var(--pri-800); box-shadow: inset 0 -2px 0 var(--acc); }
.numpad button, .t-card .numpad button {
  font-family: var(--sans); font-weight: 300; font-size: 2rem;
  background: var(--bg); color: var(--ink); box-shadow: inset 0 0 0 1px rgba(184, 150, 106, .18);
}
.numpad button:active, .t-card .numpad button:active { background: var(--pri-100); }
.numpad .np-fn, .t-card .numpad .np-fn { background: transparent; box-shadow: none; color: var(--muted); }
.btn-stamp { font-weight: 400; letter-spacing: .12em; text-transform: uppercase; font-size: 1.35rem; }
.btn-kommen { background: var(--pri-800); color: var(--bg); }
.btn-gehen { background: var(--acc); color: #fff; }
.t-switch { color: var(--pri-800); box-shadow: inset 0 0 0 1px var(--pri-300); }
.t-qr-box { box-shadow: inset 0 0 0 1px var(--line); }
.t-qr-bar span { background: var(--acc); }
body.terminal .t-admin { color: rgba(29, 29, 27, .3); }

/* Rückmeldung nach dem Stempeln */
.t-result { background: var(--pri-800); }
.t-result.is-gehen, .h-result.is-gehen { background: var(--acc-dark); }
.t-check { border-width: 1px; border-color: var(--gold); color: var(--bg); }
.t-r-greet { font-weight: 300; letter-spacing: .01em; }
.t-r-hint { background: rgba(255, 255, 255, .08); border: 1px solid rgba(184, 150, 106, .4); }

/* ---------- Verwaltung ---------- */
.a-header { background: var(--card); color: var(--ink); border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 rgba(184, 150, 106, .25); }
.a-brand, .a-brand .wordmark { color: var(--ink); }
.a-logo { height: 28px; }
.a-brand small { color: var(--muted); letter-spacing: .3em; font-size: .64rem; padding-left: 12px; border-left: 1px solid var(--gold); }
.a-nav a { color: var(--muted); border-radius: 0; padding: 8px 10px 9px; }
.a-nav a:hover { background: transparent; color: var(--ink); }
.a-nav a.active { background: transparent; color: var(--ink); box-shadow: inset 0 -2px 0 var(--acc); }
.a-user, .a-user a.a-me { color: var(--muted); }
.a-user a { color: var(--pri-800); }
.a-user a.a-me:hover, .a-user a.a-me.active { color: var(--ink); }
.a-2fa { background: var(--acc); color: #fff; }

.a-main h1 { font-weight: 300; font-size: 2.1rem; letter-spacing: .01em; }
.card { background: var(--card); box-shadow: 0 0 0 1px rgba(184, 150, 106, .16), var(--shadow); }
.card h2 { font-weight: 400; letter-spacing: .02em; }
.stat { background: var(--card); border-top: 2px solid var(--pri-300); box-shadow: 0 0 0 1px rgba(184, 150, 106, .16), var(--shadow); }
.stat.accent { border-top-color: var(--acc); }
.stat .num { font-weight: 300; font-size: 2.4rem; }
.tbl th { color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--pri-300); }
.tbl tr.sum td { background: var(--pri-100); }
.tbl tr.day-sep td { background: var(--bg); color: var(--ink); font-weight: 400; }
.badge { font-weight: 700; letter-spacing: .02em; }
.badge.in { background: var(--pri-100); color: var(--pri-800); }
.badge.out { background: var(--acc-100); color: var(--acc); }
.badge.admin { background: var(--pri-800); color: var(--bg); }
.badge.abt { background: var(--pri-100); color: var(--pri-800); }
.badge.modell, .badge.abw-ueberstd { background: #f1e8d8; color: #7c6136; }
.badge.abw-urlaub { background: #e7ecdc; color: var(--ok); }
.flash { background: var(--card); color: var(--ink); border-left: 3px solid var(--gold); box-shadow: 0 0 0 1px var(--line); }
.flash.err { background: var(--danger-100); color: var(--danger); border-left-color: var(--danger); box-shadow: none; }
.flash.warn { background: var(--acc-100); color: var(--acc-dark); border-left-color: var(--acc); box-shadow: none; }
.edit-mark { color: var(--acc); }
a { color: var(--acc); }
a.time-link { color: var(--ink); }
a.time-link.active { background: var(--acc-100); border-color: var(--acc); }
.diff-plus { color: var(--ok); }
.mod-verteilen { background: var(--pri-100); }
.mod-wt span { background: var(--field); }
.mod-wt input:checked + span { background: var(--pri-800); }
.abt-zuweisen { background: #f4ecdf; border-left-color: var(--gold); }
.mod-card { border-left-color: var(--gold); }
.row-dialog { background: var(--card); border-top: 2px solid var(--acc); }
.row-dialog::backdrop { background: rgba(46, 41, 36, .45); }
.tfa-key, .tfa-codes { background: var(--pri-100); }
.bulk-bar { background: var(--pri-800); }

/* ---------- Anmeldung ---------- */
body.login { background: radial-gradient(ellipse at 50% 0%, #f7f2e9 0%, var(--bg) 60%, #e6ddcd 100%); }
.login-card { background: var(--card); border-radius: 6px; border: 1px solid rgba(184, 150, 106, .28); box-shadow: 0 24px 60px rgba(60, 44, 28, .12); }
.login-card h1 { font-weight: 300; }
.login-logo { width: 190px; margin: 6px 0 26px; }

/* ---------- Handy ---------- */
body.handy { background: radial-gradient(ellipse at 50% 0%, #f7f2e9 0%, var(--bg) 60%, #e6ddcd 100%); }
.h-card, .t-card { background: var(--card); }
.h-card { border: 1px solid rgba(184, 150, 106, .28); box-shadow: 0 18px 48px rgba(60, 44, 28, .12); border-radius: 6px; }
.card-logo { width: 170px; }
.h-card .card-logo { width: 150px; }
.card-logo-wrap { margin: 10px 0 22px; }
.h-logo { width: 190px; max-width: 70vw; }
.h-greet { color: var(--acc); font-weight: 300; font-size: 1.25rem; }
.h-result { background: var(--pri-800); border-radius: 6px; }
.m-today { background: var(--bg); }
.m-today.is-in { background: var(--pri-800); }
.m-today-val { font-weight: 300; }
.m-week { color: var(--acc); }
.m-nav a, .m-wk-more, .stat-more { color: var(--acc); }
.m-nav strong, .m-wk-title { font-weight: 400; }
.m-times em.run { color: var(--acc); }

@media (max-width: 960px), (orientation: portrait) {
  body.terminal .t-logo { width: 230px; }
  body.terminal .t-sub { align-self: center; }
}
@media (max-height: 880px) and (orientation: landscape) {
  .card-logo { width: 130px; }
}
.tbl td a:not(.btn):not(.icon-btn):not(.time-link) { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--pri-300); }
.tbl td a:not(.btn):not(.icon-btn):not(.time-link):hover { color: var(--acc); border-bottom-color: var(--acc); }
.login-card .t-sub { display: block; color: var(--muted); font-size: .7rem; letter-spacing: .3em; text-transform: uppercase; padding-top: 12px; border-top: 1px solid var(--gold); margin: -8px 0 22px; }
.login-logo { margin-bottom: 22px; }
/* Abwesenheit bearbeiten */
.mod-card.is-editing { border-left-color: var(--acc); box-shadow: 0 0 0 1px rgba(135, 27, 27, .18), var(--shadow); }

/* ==========================================================
   RESPONSIVE: Stempel-/Koppel-Dialog auf Handy & kleinen Geräten
   ========================================================== */
/* Grundsätzlich: nichts darf breiter als der Bildschirm werden */
.t-wrap > * { min-width: 0; max-width: 100%; }
.t-card { width: 100%; }
.pin-display { flex-wrap: nowrap; }
.pin-display span { flex: 0 1 58px; width: auto; min-width: 0; }
.pin-display.pair span { flex-basis: 50px; }
.numpad button, .btn-stamp { min-width: 0; }

/* Handy hochkant */
@media (max-width: 600px) {
  body.terminal { overflow-x: hidden; overflow-y: auto; }
  .t-wrap {
    grid-template-columns: minmax(0, 1fr); gap: 18px;
    align-content: start; justify-items: stretch;
    padding: max(18px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 12px max(14px, env(safe-area-inset-left));
  }
  .t-side { gap: 4px; }
  .t-brand { margin-bottom: 4px; }
  body.terminal .t-logo { width: min(210px, 58vw); }
  body.terminal .t-sub { font-size: .68rem; letter-spacing: .34em; padding-top: 10px; margin-top: 6px; }
  .t-clock { font-size: clamp(3.2rem, 18vw, 5rem); }
  .t-date { font-size: clamp(.95rem, 4.4vw, 1.15rem); }

  .t-card, body.terminal .t-card { padding: 22px clamp(12px, 4vw, 20px) 18px; }
  .t-title, .h-title { font-size: clamp(1.25rem, 6vw, 1.55rem); margin-bottom: 12px; }
  .t-help { font-size: .95rem; line-height: 1.45; }

  .pin-display { gap: clamp(5px, 2vw, 12px); }
  .pin-display.pair { gap: clamp(4px, 1.6vw, 10px); }
  .pin-display span { height: clamp(46px, 13vw, 62px); font-size: clamp(1.3rem, 6vw, 1.8rem); }

  .t-msg { font-size: .92rem; margin-bottom: 4px; }
  .numpad { gap: clamp(6px, 2.2vw, 10px); margin-bottom: 14px; }
  .numpad button, .t-card .numpad button { height: clamp(50px, 14vw, 66px); font-size: clamp(1.5rem, 7vw, 1.9rem); }
  .numpad .np-fn, .t-card .numpad .np-fn { font-size: 1.3rem; }

  .t-actions { gap: 10px; }
  .btn-stamp { height: clamp(60px, 17vw, 80px); font-size: clamp(.95rem, 4.4vw, 1.2rem); letter-spacing: .08em; }

  .t-qr-box { padding: 10px; }
  .t-qr-box svg { width: min(260px, 64vw); }
  .t-qr-steps { font-size: .92rem; }
  .t-switch { margin-top: 14px; padding: 12px; font-size: .98rem; }

  /* "Verwaltung" nicht mehr über den Tasten, sondern darunter */
  .t-admin {
    position: static; display: block; text-align: center;
    padding: 6px 0 max(16px, env(safe-area-inset-bottom));
  }

  /* Rückmeldung nach dem Stempeln */
  .t-result-inner { padding: 24px 18px; }
  .t-check { width: 88px; height: 88px; font-size: 2.6rem; margin-bottom: 20px; }
  .t-r-greet { font-size: clamp(1.5rem, 7vw, 2.2rem); }
  .t-r-main { font-size: clamp(1.15rem, 5.4vw, 1.5rem); }
  .t-r-sub { font-size: 1rem; }
  .t-r-hint { font-size: .98rem; padding: 12px 14px; }
}

/* Sehr schmale Handys (iPhone SE / mini) */
@media (max-width: 360px) {
  .t-clock { font-size: 3rem; }
  .t-card, body.terminal .t-card { padding: 18px 10px 14px; }
  .btn-stamp { letter-spacing: .04em; }
}

/* Handy quer: wieder zwei Spalten, alles kompakter */
@media (max-height: 520px) and (orientation: landscape) {
  body.terminal { overflow-y: auto; }
  .t-wrap {
    grid-template-columns: minmax(0, 1fr) minmax(0, 400px); gap: 24px;
    align-content: center; justify-items: stretch;
    padding: 12px max(20px, env(safe-area-inset-right)) 12px max(20px, env(safe-area-inset-left));
  }
  .t-side { align-items: center; text-align: center; }
  .t-brand { margin-bottom: 6px; }
  body.terminal .t-logo { width: min(200px, 30vw); }
  .t-clock { font-size: clamp(2.8rem, 9vw, 4.2rem); }
  .t-date { font-size: 1rem; }
  .t-card, body.terminal .t-card { padding: 14px 16px 12px; }
  .t-title { font-size: 1.2rem; margin-bottom: 8px; }
  .t-help { font-size: .85rem; margin: 0 0 8px !important; }
  .pin-display span { height: 42px; font-size: 1.3rem; }
  .t-msg { min-height: 1.2em; font-size: .85rem; margin-bottom: 2px; }
  .numpad { gap: 6px; margin-bottom: 8px; }
  .numpad button, .t-card .numpad button { height: 40px; font-size: 1.3rem; }
  .btn-stamp { height: 46px; font-size: .95rem; }
  .t-qr-box svg { width: min(200px, 60vh); }
  .t-switch { margin-top: 8px; padding: 8px; }
  .t-admin { right: auto; left: max(20px, env(safe-area-inset-left)); bottom: 8px; }
}

/* ---------- Buchung bearbeiten (Verwaltung) auf dem Handy ---------- */
@media (max-width: 600px) {
  .row-dialog {
    width: calc(100vw - 16px); max-width: none; max-height: calc(100dvh - 16px);
    margin: auto auto max(8px, env(safe-area-inset-bottom)); padding: 18px 16px 14px; overflow-y: auto;
  }
  .row-dialog .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
  .row-dialog .form-row .field { min-width: 0; }
  .row-dialog .form-row .field.grow, .row-dialog .rd-dur { grid-column: 1 / -1; }
  .row-dialog .rd-time { width: 100%; font-size: 16px; } /* 16px verhindert Auto-Zoom in iOS */
  .row-dialog input[type=text] { font-size: 16px; }
  .row-dialog .rd-dur output { padding: 0; }
  .row-dialog .rd-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .row-dialog .rd-actions .rd-spacer { display: none; }
  .row-dialog .rd-actions [data-act="save"] { grid-column: 1 / -1; order: -1; }
  .row-dialog .rd-actions .btn { width: 100%; justify-content: center; }
}

/* ---------- Offline-Stempeln ---------- */
.t-offline {
  display: grid; gap: 4px; text-align: center;
  background: #fff4e0; color: #6b4300; border: 1px solid #e3bf86;
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px;
  font-size: .92rem; line-height: 1.35;
}
.t-offline[hidden], .t-pending[hidden] { display: none; }
.t-offline strong { font-size: 1rem; }
.t-pending { text-align: center; margin-top: 8px; font-size: .82rem; color: #6b4300; font-weight: 600; }
body.is-offline .t-switch { display: none; }

/* Meine Stunden am iPad (Personalnummer, nur lesen) */
.t-stunden-btn { margin-top: 14px; }
.t-stunden-btn:disabled { opacity: .4; cursor: default; }
.t-stunden-btn[hidden] { display: none; }
.t-stunden {
  position: fixed; inset: 0; z-index: 9; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--pri-800); animation: fade .2s ease-out;
  padding: max(28px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
}
.t-stunden[hidden] { display: none; }
.t-stunden-inner {
  max-width: 680px; margin: 0 auto; background: var(--card); color: var(--ink);
  border-radius: calc(var(--radius) * 1.6); padding: 28px 32px 24px; box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
}
.t-stunden-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.t-stunden-name { margin: 4px 0 0; font-size: 1.7rem; }
.t-stunden-close {
  flex: none; border: 0; border-radius: var(--radius); padding: 14px 20px; font: inherit; font-size: 1.05rem;
  background: var(--pri-700); color: #fff; cursor: pointer;
}
.t-stunden-close:active { filter: brightness(.95); }
.t-stunden .m-nav button {
  width: 56px; height: 56px; border: 0; border-radius: 50%; background: transparent;
  font-size: 2rem; color: var(--pri-700); cursor: pointer;
}
.t-stunden .m-nav button:active { background: var(--pri-100); }
.t-stunden .m-wk summary { padding: 16px 4px; }
.t-stunden .m-wk-title { font-size: 1.25rem; }
.t-stunden .m-wk-more { font-size: .9rem; }
.t-stunden .m-day { font-size: 1.05rem; }
.t-stunden-hint { font-size: .9rem; margin: 16px 0 0; }
.t-stunden-hint em { color: var(--danger); font-style: normal; font-weight: 600; }

/* Handy: Ergebnis nach dem Stempeln – Knopf auf dunklem Grund gut lesbar, Karte nicht über dem Titel */
.h-result .t-switch.h-link-light,
.h-result a.h-link-light { color: #fff; background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .55); }
.h-result .t-switch.h-link-light:active { background: rgba(255, 255, 255, .14); }
.h-result { margin-top: 18px; }

/* ==========================================================
   FUSSLEISTE (zeit:mark-Logo + Kontakt)
   ========================================================== */
.zm-foot { font-size: .82rem; color: var(--muted); }
.zm-foot-inner {
  max-width: 1200px; margin: 0 auto; padding: 18px 24px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 28px;
}
.zm-foot-left { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.zm-foot-brand { display: inline-flex; line-height: 0; opacity: .85; transition: opacity .15s; }
.zm-foot-brand:hover { opacity: 1; }
.zm-foot-logo { width: 96px; height: auto; display: block; }
.zm-foot-von { letter-spacing: .02em; }
.zm-foot-kontakt { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 20px; }
.zm-foot-text { color: var(--ink); font-weight: 700; }
.zm-foot-kontakt a {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--pri-700); text-decoration: none; white-space: nowrap;
}
.zm-foot-kontakt a:hover { color: var(--acc); }
.zm-foot-kontakt svg {
  width: 15px; height: 15px; flex: none;
  fill: none; stroke: var(--gold); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.zm-foot-kontakt a:hover svg { stroke: var(--acc); }

/* Verwaltung: feine Champagner-Linie wie unter der Kopfzeile */
.zm-foot-voll { background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -1px 0 rgba(184, 150, 106, .25); }
body:not(.login) .zm-foot-voll { margin-top: 8px; }

/* Anmeldung: Karte mittig, Fußleiste darunter */
body.login { flex-direction: column; gap: 22px; }
body.login .zm-foot-voll { background: transparent; border: 0; box-shadow: none; width: 100%; max-width: 620px; }
body.login .zm-foot-inner { justify-content: center; text-align: center; padding: 6px 12px; }
body.login .zm-foot-left, body.login .zm-foot-kontakt { justify-content: center; }

/* Handy-Seiten: kompakt und mittig unter der Karte */
.zm-foot-kompakt .zm-foot-inner {
  max-width: 480px; justify-content: center; text-align: center;
  padding: 0 16px max(22px, env(safe-area-inset-bottom));
}
.zm-foot-kompakt .zm-foot-left { justify-content: center; flex-direction: column; gap: 6px; }
.zm-foot-kompakt .zm-foot-logo { width: 84px; }
body.handy .h-wrap { padding-bottom: 18px; }

/* iPad-Terminal: nur ein dezentes Logo unten links, ohne Links */
.zm-foot-terminal {
  position: fixed; left: 20px; bottom: max(14px, env(safe-area-inset-bottom));
  opacity: .45; pointer-events: none; line-height: 0;
}
.zm-foot-terminal .zm-foot-logo { width: 88px; }
@media (max-width: 600px) {
  .zm-foot-terminal { position: static; text-align: center; padding: 0 0 max(14px, env(safe-area-inset-bottom)); }
  .zm-foot-terminal .zm-foot-logo { display: inline-block; width: 76px; }
  .zm-foot-inner { padding: 16px; justify-content: center; text-align: center; }
  .zm-foot-left, .zm-foot-kontakt { justify-content: center; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .zm-foot-terminal { left: auto; right: max(20px, env(safe-area-inset-right)); bottom: 8px; }
}
@media print { .zm-foot { display: none !important; } }
/* Verwaltung: Fußleiste auch bei kurzen Seiten unten */
body.admin { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
body.admin .a-main { flex: 1 0 auto; width: 100%; }

/* ==========================================================
   TERMINAL-LAYOUT v2.6 (wie Emba-Protec)
   Kopfzeile: Logo | Zeiterfassung ········ Uhr + Datum
   Darunter:  Stempelkarte | Letzte Buchungen
   ========================================================== */
body.terminal {
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh; overflow: hidden;
  --t-pad: clamp(20px, 3.2vw, 56px);
}
.t-head {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 24px;
  margin: 0 var(--t-pad);
  padding: max(18px, env(safe-area-inset-top)) 0 16px;
  border-bottom: 1px solid rgba(184, 150, 106, .45);
}
.t-head-brand { display: flex; align-items: center; gap: 0; min-width: 0; }
.t-head-logo { display: block; height: 48px; width: auto; max-width: 200px; object-fit: contain; }
.t-head-brand .wordmark { font-size: 1.6rem; color: var(--pri-800); }
.t-head-sub {
  margin-left: 18px; padding: 6px 0 6px 18px; border-left: 1px solid var(--gold);
  text-transform: uppercase; letter-spacing: .42em; font-size: .78rem; color: var(--muted); white-space: nowrap;
}
.t-head-time { display: flex; align-items: baseline; gap: 18px; white-space: nowrap; }
body.terminal .t-head .t-clock {
  font-size: clamp(2.8rem, 5.2vw, 4rem); line-height: 1; font-weight: 300; letter-spacing: -.01em; color: var(--ink);
}
body.terminal .t-head .t-date { font-size: clamp(.95rem, 1.5vw, 1.15rem); color: var(--muted); font-weight: 300; letter-spacing: .03em; }

.t-body {
  flex: 1 1 auto; min-height: 0;
  display: grid; grid-template-columns: minmax(380px, 500px) minmax(0, 1fr);
  gap: 0; padding: 0 var(--t-pad) 44px;
}
.t-body > .t-card {
  align-self: center; margin: 24px 0; max-height: calc(100% - 48px); overflow-y: auto; overscroll-behavior: contain;
}
.t-body.is-single { grid-template-columns: minmax(0, 520px); justify-content: center; }

/* Rechte Spalte */
.t-feed {
  display: flex; flex-direction: column; min-height: 0;
  margin-left: clamp(28px, 3.4vw, 64px); padding: 28px 0 0 clamp(28px, 3.4vw, 64px);
  border-left: 1px solid rgba(184, 150, 106, .4);
}
.t-feed-title {
  margin: 0 0 18px; font-size: .78rem; font-weight: 400; text-transform: uppercase;
  letter-spacing: .32em; color: var(--muted);
}
.t-feed-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; align-content: start; }
.t-feed-list:empty { display: none; }
.t-feed-empty[hidden] { display: none; }
.t-fi {
  position: relative; overflow: hidden; cursor: pointer;
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 16px;
  padding: 16px 20px 18px 16px;
  background: var(--card); border: 1px solid rgba(184, 150, 106, .32); border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(60, 44, 28, .04), 0 6px 18px rgba(60, 44, 28, .06);
  animation: t-fi-in .35s cubic-bezier(.2, .8, .2, 1);
  transition: opacity .35s, transform .35s;
}
.t-fi.is-out { opacity: 0; transform: translateX(16px); }
.t-fi-icon {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem; line-height: 1; color: #fff;
}
.t-fi.is-kommen .t-fi-icon { background: var(--pri-800); }
.t-fi.is-gehen .t-fi-icon { background: var(--acc); }
.t-fi-greet { font-size: 1.15rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-fi-meta { font-size: .85rem; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }
.t-fi-hint {
  margin-top: 8px; padding: 6px 10px; font-size: .85rem; line-height: 1.35;
  background: var(--acc-100); color: var(--acc-dark); border-radius: var(--radius);
}
.t-fi-bar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: var(--acc); transform-origin: left;
}
.t-fi.is-kommen .t-fi-bar { background: var(--pri-800); }
@keyframes t-fi-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

.t-feed-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  color: var(--muted); font-size: 1.3rem; font-weight: 300; letter-spacing: .02em; padding-bottom: 8vh;
}
.t-feed-empty svg { width: 64px; height: 64px; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; }

/* Fußzeile/Verwaltungslink nicht über die Karte legen */
body.terminal .zm-foot-terminal { left: var(--t-pad); bottom: max(12px, env(safe-area-inset-bottom)); }
body.terminal .t-admin { right: var(--t-pad); bottom: max(12px, env(safe-area-inset-bottom)); }

/* Niedrige Querformat-Bildschirme (iPad 10" quer, Laptop) */
@media (max-height: 1100px) and (orientation: landscape) {
  .t-head { padding-top: max(12px, env(safe-area-inset-top)); padding-bottom: 12px; }
  .t-head-logo { height: 40px; }
  body.terminal .t-head .t-clock { font-size: clamp(2.4rem, 4.4vw, 3.4rem); }
  .t-body > .t-card { margin: 16px 0; max-height: calc(100% - 32px); }
  .t-feed { padding-top: 20px; }
  .t-fi { padding: 12px 16px 14px 12px; }
  /* Nummernfeld passt ohne Scrollen in die Karte */
  .t-body > .t-card { padding: 20px 28px 16px; }
  .t-body .t-title { margin-bottom: 10px; font-size: 1.45rem; }
  .t-body .pin-display span { height: 54px; }
  .t-body .t-msg { margin-bottom: 4px; }
  .t-body .numpad { gap: 8px; margin-bottom: 12px; }
  .t-body .numpad button { height: 54px; font-size: 1.7rem; }
  .t-body .btn-stamp { height: 64px; font-size: 1.15rem; }
  .t-body .t-switch { margin-top: 10px; padding: 10px; }
  .t-body .t-device { margin-top: 8px; }
}

/* iPad hochkant: Karte oben, Liste darunter */
@media (orientation: portrait) and (min-width: 601px), (max-width: 960px) and (min-width: 601px) {
  body.terminal { overflow-y: auto; height: auto; min-height: 100dvh; }
  .t-body { grid-template-columns: minmax(0, 520px); justify-content: center; align-content: start; padding-bottom: 56px; }
  .t-body > .t-card { margin: 28px 0 8px; max-height: none; overflow: visible; }
  .t-feed { margin: 20px 0 0; padding: 22px 0 0; border-left: 0; border-top: 1px solid rgba(184, 150, 106, .4); }
  .t-feed-empty { padding: 20px 0 8px; flex: none; }
  .t-feed-empty svg { width: 44px; height: 44px; }
}

/* Handy: Kopf zentriert untereinander, Liste ausgeblendet */
@media (max-width: 600px) {
  body.terminal { overflow-y: auto; height: auto; min-height: 100dvh; }
  .t-head { flex-direction: column; gap: 8px; text-align: center; padding-bottom: 12px; }
  .t-head-logo { height: 40px; }
  .t-head-sub { font-size: .66rem; letter-spacing: .32em; margin-left: 12px; padding-left: 12px; }
  .t-head-time { flex-direction: column; align-items: center; gap: 2px; }
  body.terminal .t-head .t-clock { font-size: clamp(2.6rem, 14vw, 3.6rem); }
  .t-body { grid-template-columns: minmax(0, 1fr); padding: 0 max(14px, env(safe-area-inset-left)) 12px; }
  .t-body > .t-card { margin: 16px 0; max-height: none; overflow: visible; }
  .t-feed { display: none; }
  body.terminal .zm-foot-terminal, body.terminal .t-admin { position: static; }
}

/* Handy quer */
@media (max-height: 520px) and (orientation: landscape) {
  body.terminal { overflow-y: auto; height: auto; min-height: 100dvh; }
  .t-head { padding: 8px 0; }
  .t-head-logo { height: 30px; }
  body.terminal .t-head .t-clock { font-size: 2.2rem; }
  .t-body { grid-template-columns: minmax(0, 400px); justify-content: center; }
  .t-body > .t-card { max-height: none; overflow: visible; margin: 10px 0; }
  .t-feed { display: none; }
}
