/* =========================================================================
   Stempeluhr — Kiosk & Verwaltung
   Touch-optimiert: große Ziele, hoher Kontrast, ruhige Farbwelt.
   ========================================================================= */
:root {
  --bg: #0f172a;            /* tiefes Marineblau als Kiosk-Hintergrund */
  --bg-soft: #1e293b;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --ink: #0f172a;
  --ink-soft: #475569;
  --muted: #94a3b8;
  --line: #e2e8f0;
  --accent: #4f46e5;       /* Indigo */
  --accent-ink: #ffffff;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --grey: #64748b;
  --grey-soft: #e2e8f0;
  --radius: 18px;
  --radius-lg: 26px;
  --shadow: 0 10px 30px rgba(2, 6, 23, .18);
  --shadow-sm: 0 2px 8px rgba(2, 6, 23, .10);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
button { font-family: inherit; cursor: pointer; }

/* ---------- Kiosk Shell ---------- */
.kiosk {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(79, 70, 229, .35), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(14, 165, 233, .25), transparent 55%),
    var(--bg);
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 34px;
  color: #e2e8f0;
}
.brand { display: flex; align-items: center; gap: 14px; font-size: 22px; font-weight: 700; letter-spacing: .2px; }
.brand .logo {
  width: 46px; height: 46px; border-radius: 13px;
  background: linear-gradient(135deg, #6366f1, #0ea5e9);
  display: grid; place-items: center; font-size: 24px; box-shadow: var(--shadow-sm);
}
.brand small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; }
.clock { text-align: right; line-height: 1; }
.clock .time { font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; }
.clock .date { font-size: 14px; color: var(--muted); margin-top: 6px; text-transform: capitalize; }

.stage { flex: 1; display: grid; place-items: center; padding: 10px 28px 40px; }
.view { width: min(1100px, 96vw); display: none; }
.view.active { display: block; animation: pop .22s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }

.hint { text-align: center; color: var(--muted); margin: 0 0 22px; font-size: 17px; }

/* ---------- Mitarbeiter-Kacheln ---------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 18px;
}
.tile {
  border: none; background: var(--surface); border-radius: var(--radius-lg);
  padding: 26px 18px 20px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.tile:active { transform: scale(.96); }
.avatar {
  width: 84px; height: 84px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; font-size: 30px; font-weight: 700;
  box-shadow: inset 0 0 0 4px rgba(255,255,255,.25);
}
.tile .name { font-size: 19px; font-weight: 700; color: var(--ink); text-align: center; line-height: 1.15; }
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 700; padding: 5px 12px; border-radius: 999px;
}
.badge::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.badge.working { color: var(--green); background: var(--green-soft); }
.badge.break   { color: var(--amber); background: var(--amber-soft); }
.badge.away    { color: var(--grey);  background: var(--grey-soft); }

.empty-state { text-align: center; color: var(--muted); padding: 60px 20px; }
.empty-state a { color: #c7d2fe; }

/* ---------- Karten (PIN / Aktionen / Ergebnis) ---------- */
.card {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 30px; max-width: 560px; margin: 0 auto;
}
.card-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.card-head .avatar { width: 64px; height: 64px; font-size: 24px; }
.card-head .who { font-size: 24px; font-weight: 800; }
.card-head .who small { display: block; font-size: 14px; font-weight: 500; color: var(--ink-soft); }

.iconbtn {
  border: 1px solid var(--line); background: #fff; color: var(--ink-soft);
  width: 52px; height: 52px; border-radius: 14px; font-size: 22px; line-height: 1;
}
.iconbtn:active { background: var(--surface-2); }

/* PIN */
.pin-dots { display: flex; justify-content: center; gap: 16px; margin: 6px 0 26px; height: 24px; }
.pin-dots .dot { width: 18px; height: 18px; border-radius: 50%; background: var(--surface-2); border: 2px solid var(--line); transition: .12s; }
.pin-dots .dot.filled { background: var(--accent); border-color: var(--accent); transform: scale(1.05); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.key {
  border: 1px solid var(--line); background: #fff; border-radius: 18px;
  font-size: 30px; font-weight: 700; color: var(--ink);
  height: 78px; display: grid; place-items: center;
  transition: transform .08s ease, background .12s;
}
.key:active { transform: scale(.94); background: var(--surface-2); }
.key.wide { grid-column: span 1; }
.key.ok { background: var(--accent); color: #fff; border-color: var(--accent); }
.key.ok:disabled { opacity: .45; }
.key.ghost { color: var(--ink-soft); font-size: 24px; }

.msg { text-align: center; min-height: 24px; margin: 16px 0 0; font-weight: 600; }
.msg.error { color: var(--red); }
.shake { animation: shake .35s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-9px)} 40%{transform:translateX(9px)} 60%{transform:translateX(-6px)} 80%{transform:translateX(6px)} }

/* Aktionsknöpfe */
.actions { display: grid; gap: 14px; margin-top: 8px; }
.bigbtn {
  border: none; border-radius: 20px; padding: 24px; font-size: 24px; font-weight: 800;
  color: #fff; display: flex; align-items: center; justify-content: center; gap: 14px;
  box-shadow: var(--shadow-sm); transition: transform .1s ease;
}
.bigbtn:active { transform: scale(.97); }
.bigbtn .ic { font-size: 26px; }
.bigbtn.in    { background: var(--green); }
.bigbtn.out   { background: var(--red); }
.bigbtn.brk   { background: var(--amber); }
.bigbtn.end   { background: var(--green); }
.linkbtn { background: none; border: none; color: var(--ink-soft); font-size: 16px; padding: 14px; text-decoration: underline; }
.today-chip {
  text-align: center; margin: 0 0 18px; color: var(--ink-soft); font-size: 16px;
}
.today-chip b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* Ergebnis */
.result { text-align: center; padding: 18px 10px; }
.result .check {
  width: 110px; height: 110px; border-radius: 50%; margin: 0 auto 20px;
  display: grid; place-items: center; font-size: 60px; color: #fff;
  background: var(--green); animation: popcheck .4s ease;
}
.result .check.out { background: var(--red); }
.result .check.brk { background: var(--amber); }
@keyframes popcheck { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.result h2 { font-size: 30px; margin: 0 0 6px; }
.result p { color: var(--ink-soft); font-size: 18px; margin: 4px 0; }
.result .big-time { font-size: 22px; font-weight: 800; }

/* Zeit-nachtragen-Formular (Kiosk) */
.na-field { display: block; text-align: left; font-size: 13px; color: var(--ink-soft); font-weight: 600; margin-bottom: 12px; }
.na-field input { width: 100%; margin-top: 5px; padding: 13px 12px; border: 1px solid var(--line); border-radius: 12px; font-size: 18px; font-family: inherit; }
.na-row { display: flex; gap: 12px; }
.na-row .na-field { flex: 1; }
.msg.ok { color: var(--green); }

.gearlink { color: var(--muted); text-decoration: none; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; }
.gearlink:hover { background: rgba(255,255,255,.06); color: #cbd5e1; }

/* =========================================================================
   Verwaltung
   ========================================================================= */
.admin { min-height: 100vh; background: var(--surface-2); color: var(--ink); }
.admin-top {
  background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 14px 24px;
  position: sticky; top: 0; z-index: 5;
}
.admin-top .brand { color: var(--ink); font-size: 18px; }
.admin-top .brand small { color: var(--muted); }
.tabs { display: flex; gap: 6px; }
.tab { border: none; background: none; padding: 10px 16px; border-radius: 10px; font-size: 15px; font-weight: 600; color: var(--ink-soft); }
.tab.active { background: var(--accent); color: #fff; }
.admin-main { max-width: 1080px; margin: 0 auto; padding: 24px; }
.panel { display: none; }
.panel.active { display: block; animation: pop .2s ease; }

.kpis { display: flex; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; min-width: 150px; box-shadow: var(--shadow-sm); }
.kpi .v { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }

table.grid { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
table.grid th, table.grid td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 15px; }
table.grid th { background: var(--surface); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
table.grid tr:last-child td { border-bottom: none; }
table.grid tbody tr:hover { background: #fafbff; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.working { color: var(--green); background: var(--green-soft); }
.pill.break { color: var(--amber); background: var(--amber-soft); }
.pill.away { color: var(--grey); background: var(--grey-soft); }
.tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }

.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 10px 16px; border-radius: 11px; font-size: 14px; font-weight: 600; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--red); border-color: var(--red-soft); }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 9px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

label.field { display: block; margin-bottom: 12px; font-size: 13px; color: var(--ink-soft); font-weight: 600; }
label.field input, label.field select { width: 100%; margin-top: 5px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; font-size: 15px; font-family: inherit; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }

/* Modal */
.overlay { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: none; place-items: center; z-index: 20; padding: 20px; }
.overlay.open { display: grid; }
.modal { background: #fff; border-radius: var(--radius-lg); padding: 24px; width: min(460px, 96vw); box-shadow: var(--shadow); max-height: 92vh; overflow: auto; }
.modal h3 { margin: 0 0 16px; font-size: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background:
    radial-gradient(900px 500px at 80% -10%, rgba(79,70,229,.25), transparent 60%), var(--surface-2); }
.login-card { background: #fff; padding: 34px; border-radius: var(--radius-lg); box-shadow: var(--shadow); width: min(360px, 92vw); text-align: center; }
.login-card h1 { font-size: 22px; margin: 6px 0 4px; }
.login-card p { color: var(--muted); margin: 0 0 20px; font-size: 14px; }
.login-card input { width: 100%; text-align: center; font-size: 26px; letter-spacing: .3em; padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
.login-card .btn { width: 100%; margin-top: 14px; padding: 14px; font-size: 16px; }
.login-card .err { color: var(--red); min-height: 20px; margin-top: 10px; font-size: 14px; font-weight: 600; }

.notice { background: var(--amber-soft); color: #92400e; border-radius: 12px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.mt { margin-top: 16px; }

/* Sollarbeitszeit-Editor (Mitarbeiter-Dialog) */
.sched { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 12px; background: var(--surface-2); }
.sched-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 700; color: var(--ink-soft); margin-bottom: 8px; }
.sched-head #schedTotal { font-weight: 800; color: var(--accent); }
.sched-table { width: 100%; border-collapse: collapse; }
.sched-table th { font-size: 11px; color: var(--muted); font-weight: 600; text-align: center; padding: 2px; }
.sched-table td { padding: 2px 3px; }
.sched-table td.day { font-size: 12px; font-weight: 700; color: var(--ink-soft); width: 26px; }
.sched-table input[type=time] { width: 100%; padding: 5px 4px; border: 1px solid var(--line); border-radius: 7px; font-size: 12px; font-family: inherit; }
.sched-table tr.off input { opacity: .45; }
.sched-sep { color: var(--muted); text-align: center; width: 8px; font-size: 11px; }

/* Saldo-Färbung in der Auswertung */
.saldo-pos { color: var(--green); font-weight: 700; }
.saldo-neg { color: var(--red); font-weight: 700; }

/* Freigaben */
.appr-badge { background: var(--red); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; margin-left: 2px; }
.tab.active .appr-badge { background: #fff; color: var(--accent); }
.st-pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.st-pending { color: var(--amber); background: var(--amber-soft); }
.st-approved { color: var(--green); background: var(--green-soft); }
.st-rejected { color: var(--red); background: var(--red-soft); }
.src-auto { font-size: 11px; color: var(--amber); border: 1px solid var(--amber-soft); border-radius: 6px; padding: 1px 6px; }

@media (max-width: 640px) {
  .clock .time { font-size: 30px; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .key { height: 66px; font-size: 26px; }
}
