/* Stempeluhr-Terminal — abgeleitet aus Mandys Mockups, auf echtes Viewport
   (iPad Querformat / Kiosk) umgestellt. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@700;900&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

.timo-wordmark { font-family: 'DM Sans', 'Inter', system-ui, sans-serif; line-height: 1; letter-spacing: .01em; display: inline-flex; align-items: baseline; }
.timo-wordmark .tw-t { font-weight: 900; }
.timo-wordmark .tw-imo { font-weight: 700; }

:root {
  --header-h: 84px;
  --orange: #C0552A;
  --orange-dim: #7A3518;
  --bg: #111113;
  --surface: #1A1A1E;
  --card: #242428;
  --border: #36363E;
  --txt: #EEEEE8;
  --sub: #9A9A96;
  --muted: #58585A;
  --green: #30D158;
  --green-dim: #1B5C2E;
  --green-bg: #0A1F10;
  --amber: #FFB340;
  --amber-dim: #7A5515;
  --amber-bg: #2C1E06;
  --red: #FF453A;
  --red-dim: #7A1F1A;
  --red-bg: #200806;
}

/* Hell-Theme (spiegelt die dunkle Palette). Akzent (--orange) bleibt gleich;
   die *-dim-Toene dienen als Button-/Flaechengrund und werden hell (pastell),
   damit die kraeftigen Status-Textfarben darauf lesbar bleiben. Default dunkel. */
html[data-theme="light"] {
  --orange-dim: #F1DFD4;
  --bg: #F4F4F1;
  --surface: #FFFFFF;
  --card: #FFFFFF;
  --border: #E5E4DE;
  --txt: #1C1C1E;
  --sub: #63636B;
  --muted: #9A9AA0;
  --green: #1E9E4A;
  --green-dim: #DCF5E4;
  --green-bg: #DCF5E4;
  --amber: #B7791F;
  --amber-dim: #FBEFD6;
  --amber-bg: #FBEFD6;
  --red: #D93A2F;
  --red-dim: #FBE0DE;
  --red-bg: #FBE0DE;
}
/* Hartkodierte Dunkel-Werte → helle Entsprechungen. */
html[data-theme="light"] .avatar { background: #ECEBE6; }
html[data-theme="light"] .tile.gone .avatar { background: #EEEDE8; }
html[data-theme="light"] .tile.in { border-color: #BFE6CC; }
html[data-theme="light"] .tile.pause { border-color: #EEDDB0; }
html[data-theme="light"] .u-badge.offen { background: var(--amber-bg); }
html[data-theme="light"] .u-badge.bewilligt { background: var(--green-bg); }
html[data-theme="light"] .u-badge.abgelehnt { background: var(--red-bg); }
html[data-theme="light"] .u-flash.ok { background: var(--green-bg); }
html[data-theme="light"] .u-flash.err { background: var(--red-bg); }

html, body {
  width: 100vw;
  height: 100vh;
  background: var(--bg);
  color: var(--txt);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ══ HEADER ══ */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: 0 26px;
  background: var(--surface);
  border-bottom: 3px solid var(--orange);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-badge {
  width: 44px; height: 44px; border-radius: 10px; overflow: hidden;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.brand-badge svg { width: 100%; height: 100%; display: block; }
.brand-text { display: flex; flex-direction: column; gap: 1px; }
.brand-eyebrow {
  font-size: 10px; font-weight: 600; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--muted);
}
.brand-title { font-size: 16px; font-weight: 700; color: var(--txt); letter-spacing: 0.03em; }
.header-right { display: flex; align-items: center; gap: 18px; }
.header-time { text-align: right; }

/* ══ Hell/Dunkel-Umschalter ══ */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0;
  background: transparent; border: 1.5px solid var(--border);
  color: var(--sub); cursor: pointer; font-family: inherit; padding: 0;
}
.theme-toggle:active { transform: scale(0.94); }
.theme-toggle svg { width: 22px; height: 22px; display: block; }
.theme-toggle .ic-moon { display: none; }
html[data-theme="light"] .theme-toggle .ic-sun { display: none; }
html[data-theme="light"] .theme-toggle .ic-moon { display: block; }
.theme-toggle.floating { position: fixed; top: 16px; right: 16px; z-index: 200; background: var(--card); }

.clock {
  font-size: 42px; font-weight: 300; letter-spacing: 0.04em; color: var(--txt);
  line-height: 1; font-variant-numeric: tabular-nums;
}
.clock-date { font-size: 12px; color: var(--sub); letter-spacing: 0.07em; margin-top: 2px; white-space: nowrap; }

/* ══ MAIN (Auswahl) ══ */
.main {
  height: calc(100vh - var(--header-h));
  display: flex;
  flex-direction: column;
  padding: 16px 22px 12px;
  gap: 12px;
}
.section-label {
  text-align: center; font-size: 11px; font-weight: 700; letter-spacing: 0.25em;
  text-transform: uppercase; color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  grid-auto-rows: 1fr;
  gap: 11px;
  flex: 1;
  overflow-y: auto;
  align-content: start;
}

.tile {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 9px; padding: 18px 10px 16px; position: relative;
  cursor: pointer; text-decoration: none; min-height: 168px;
  transition: transform .08s ease, border-color .08s ease;
}
.tile:active { transform: scale(0.97); }
.tile::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  border-radius: 12px 12px 0 0; background: transparent;
}
.tile.in { border-color: #1B3D22; }
.tile.in::after { background: var(--green); }
.tile.pause { border-color: #3A2508; }
.tile.pause::after { background: var(--amber); }
.tile.gone { opacity: 0.45; }

.avatar {
  width: 76px; height: 76px; border-radius: 50%;
  background: #2C2830; color: var(--sub);
  font-size: 21px; font-weight: 800; letter-spacing: 0.03em;
  display: flex; align-items: center; justify-content: center;
  position: relative; flex-shrink: 0;
}
.tile.in .avatar { background: var(--green-bg); color: var(--green); outline: 2px solid var(--green); }
.tile.pause .avatar { background: var(--amber-bg); color: var(--amber); outline: 2px solid var(--amber); }
.tile.gone .avatar { background: #1E1E22; color: var(--muted); }
.status-dot {
  position: absolute; bottom: 2px; right: 2px; width: 16px; height: 16px;
  border-radius: 50%; border: 3px solid var(--card); display: none;
}
.tile.in .status-dot { display: block; background: var(--green); }
.tile.pause .status-dot { display: block; background: var(--amber); }

.emp-name { font-size: 18px; font-weight: 700; color: var(--txt); text-align: center; line-height: 1.2; }
.emp-role { font-size: 11px; font-weight: 600; color: var(--sub); text-transform: uppercase; letter-spacing: 0.1em; }
.emp-since { font-size: 12px; font-weight: 600; text-align: center; margin-top: 2px; }
.tile.in .emp-since { color: var(--green); }
.tile.pause .emp-since { color: var(--amber); }
.tile.gone .emp-since, .tile:not(.in):not(.pause):not(.gone) .emp-since { color: var(--muted); }

/* ══ FOOTER (Legende) ══ */
.footer {
  display: flex; align-items: center; justify-content: center; gap: 24px;
  padding-top: 10px; border-top: 1px solid var(--border);
}
.legend { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; }
.l-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.l-count { font-weight: 800; margin-left: 3px; }
.footer-sep { width: 1px; height: 13px; background: var(--border); }
.total-label { margin-left: auto; font-size: 11px; color: var(--muted); letter-spacing: 0.08em; }

/* ══ STEMPEL-SCREEN ══ */
.stamp-main {
  height: calc(100vh - var(--header-h));
  display: grid; grid-template-columns: 1fr 1.15fr;
}
.panel-left {
  display: flex; flex-direction: column; align-items: center;
  padding: 18px 22px 22px 26px; border-right: 1px solid var(--border);
}
.back-link {
  align-self: flex-start; display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); text-decoration: none; padding: 8px 4px;
}
.back-link svg { width: 15px; height: 15px; }
.center-content {
  display: flex; flex-direction: column; align-items: center; gap: 22px;
  flex: 1; justify-content: center; width: 100%; padding-bottom: 16px;
}
.employee-card {
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  padding: 22px 28px 20px; background: var(--card);
  border: 1.5px solid var(--border); border-radius: 14px; width: 100%; max-width: 280px;
}
.avatar-lg {
  width: 88px; height: 88px; border-radius: 50%;
  background: var(--orange); color: #fff; font-size: 26px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.employee-card .emp-name { font-size: 22px; }
.actions { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 300px; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 11px;
  padding: 20px 20px; border-radius: 12px; font-size: 16px; font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase; border: 2px solid; cursor: pointer;
  background: transparent; font-family: inherit; width: 100%;
}
.btn svg { width: 20px; height: 20px; }
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.28; cursor: not-allowed; }
.btn-kommen { background: var(--green-dim); color: var(--green); border-color: var(--green); }
.btn-pause  { background: var(--amber-dim); color: var(--amber); border-color: var(--amber); }
.btn-gehen  { background: var(--red-dim); color: var(--red); border-color: var(--red); }

.status-hint {
  font-size: 12px; color: var(--sub); text-align: center; letter-spacing: 0.05em;
}

.panel-right {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 20px 28px; background: var(--surface);
}
.status-big {
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
}
.status-ring {
  width: 120px; height: 120px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 4px solid var(--border); background: var(--card);
}
.status-ring.anwesend { border-color: var(--green); background: var(--green-bg); color: var(--green); }
.status-ring.pause { border-color: var(--amber); background: var(--amber-bg); color: var(--amber); }
.status-ring.gone, .status-ring.keine { border-color: var(--muted); color: var(--muted); }
.status-ring svg { width: 56px; height: 56px; }
.status-word { font-size: 20px; font-weight: 700; }
.status-detail { font-size: 13px; color: var(--sub); }
.today-box {
  margin-top: 18px; display: flex; gap: 28px; background: var(--card);
  border: 1px solid var(--border); border-radius: 12px; padding: 16px 28px;
}
.today-item { text-align: center; }
.today-num { font-size: 28px; font-weight: 300; font-variant-numeric: tabular-nums; }
.today-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); margin-top: 4px; }

/* ══ BESTAETIGUNG / FEHLER ══ */
.confirm-wrap {
  height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--green-bg);
}
.confirm-wrap.error { background: var(--red-bg); }
.confirm-card {
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  width: 100%; max-width: 420px; padding: 40px;
}
.check-icon {
  width: 110px; height: 110px; border-radius: 50%;
  background: var(--green-dim); border: 3px solid var(--green);
  display: flex; align-items: center; justify-content: center;
}
.confirm-wrap.error .check-icon { background: var(--red-dim); border-color: var(--red); }
.check-icon svg { width: 60px; height: 60px; }
.confirm-action {
  font-size: 13px; font-weight: 700; letter-spacing: 0.25em; text-transform: uppercase;
  color: var(--green); text-align: center;
}
.confirm-wrap.error .confirm-action { color: var(--red); }
.confirm-greeting { font-size: 30px; font-weight: 700; color: var(--txt); text-align: center; line-height: 1.3; }
.confirm-time {
  display: flex; align-items: center; gap: 8px; background: rgba(48,209,88,0.12);
  border: 1px solid var(--green-dim); border-radius: 10px; padding: 12px 26px;
  font-size: 30px; font-weight: 300; color: var(--green); font-variant-numeric: tabular-nums;
}
.confirm-time-label { font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--green); opacity: 0.7; }
.confirm-msg { font-size: 16px; color: var(--sub); text-align: center; line-height: 1.4; }
.countdown-bar { width: 100%; max-width: 320px; height: 4px; background: var(--green-dim); border-radius: 2px; overflow: hidden; margin-top: 8px; }
.confirm-wrap.error .countdown-bar { background: var(--red-dim); }
.countdown-fill { height: 100%; width: 100%; background: var(--green); border-radius: 2px; transform-origin: left; }
.confirm-wrap.error .countdown-fill { background: var(--red); }
.confirm-return { font-size: 11px; color: var(--muted); letter-spacing: 0.08em; text-align: center; }

/* ══ PIN-Pad ══ */
.pin-overlay {
  position: fixed; inset: 0; background: rgba(10,10,12,0.94);
  display: none; align-items: center; justify-content: center; z-index: 50;
}
.pin-overlay.show { display: flex; }
.pin-box { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.pin-title { font-size: 16px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--sub); }
.pin-dots { display: flex; gap: 14px; }
.pin-dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--muted); }
.pin-dot.filled { background: var(--orange); border-color: var(--orange); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 84px); gap: 12px; }
.pin-key {
  height: 72px; border-radius: 12px; background: var(--card); border: 1.5px solid var(--border);
  color: var(--txt); font-size: 26px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.pin-key:active { background: var(--surface); }
.pin-key.wide { grid-column: span 1; font-size: 14px; }

/* ══ URLAUB (Terminal) ═══════════════════════════════════════════ */
.urlaub-wrap { max-width: 760px; margin: 0 auto; padding: 22px; height: calc(100% - 62px); overflow-y: auto; }
.urlaub-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.u-card { background: var(--card); border: 1.5px solid var(--border); border-radius: 14px; padding: 20px; }
.u-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 14px; letter-spacing: .02em; }
.rest-big { font-size: 54px; font-weight: 800; color: var(--green); line-height: 1; font-variant-numeric: tabular-nums; }
.rest-lbl { font-size: 13px; color: var(--sub); margin-top: 6px; }
.rest-meta { margin-top: 16px; font-size: 13px; color: var(--sub); line-height: 1.9; }
.rest-meta b { color: var(--txt); font-weight: 700; }
.u-field { margin-bottom: 14px; }
.u-field label { display: block; font-size: 12px; color: var(--sub); margin-bottom: 6px; letter-spacing: .04em; text-transform: uppercase; }
.u-field input, .u-field select, .u-field textarea {
  width: 100%; background: var(--surface); border: 1.5px solid var(--border); border-radius: 10px;
  color: var(--txt); font-size: 18px; font-family: inherit; padding: 13px 14px;
}
.u-field textarea { resize: none; font-size: 15px; }
.u-btn { width: 100%; padding: 16px; border: none; border-radius: 12px; background: var(--orange); color: #fff;
  font-size: 18px; font-weight: 700; font-family: inherit; cursor: pointer; }
.u-btn:active { filter: brightness(.92); }
.u-list { list-style: none; }
.u-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.u-list li:last-child { border-bottom: none; }
.u-badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; letter-spacing: .05em; text-transform: uppercase; }
.u-badge.offen { background: #2C1E06; color: var(--amber); }
.u-badge.bewilligt { background: #0C2B16; color: var(--green); }
.u-badge.abgelehnt { background: #2E1210; color: var(--red); }
.u-hint { color: var(--muted); font-size: 13px; text-align: center; padding: 16px 0; }
.u-topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.u-topbar .emp { font-size: 20px; font-weight: 700; }
.u-flash { border-radius: 10px; padding: 12px 15px; margin-bottom: 16px; font-size: 15px; }
.u-flash.ok { background: #0C2B16; color: var(--green); }
.u-flash.err { background: #2E1210; color: var(--red); }
.urlaub-link { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 18px; padding: 14px 16px; border-radius: 12px; background: var(--card);
  border: 1.5px solid var(--border); color: var(--txt); text-decoration: none; font-size: 15px; font-weight: 600; }
.urlaub-link:active { background: var(--surface); }
.urlaub-rest { font-size: 13px; color: var(--sub); font-weight: 500; }
.urlaub-rest b { color: var(--green); font-weight: 800; font-size: 16px; }
