/* ============================================================
   Zeiterfassung Stylesheet
   ============================================================ */
:root {
    --c-bg: #eef2f7;
    --c-fg: #0f172a;
    --c-muted: #64748b;
    --c-border: #d5dde8;
    --c-border-soft: #e2e8f0;
    --c-card: #ffffff;
    --c-primary: #094e51;
    --c-primary-dark: #0d6669;
    --c-ok: #22c55e;
    --c-warn: #f59e0b;
    --c-err: #ef4444;
    --c-accent: #094e51;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.06);
    --shadow-lg: 0 10px 30px rgba(15,23,42,.10);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--c-bg); color: var(--c-fg); }

/* Landing */
body.landing { min-height: 100vh; display: grid; place-items: center; }
body.landing main { text-align: center; padding: 2rem; }
body.landing h1 { margin: 0 0 .25em; font-size: 2.5rem; }
body.landing .lead { color: var(--c-muted); margin: 0 0 2rem; font-size: 1.1rem; }
body.landing .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem; max-width: 900px; }
body.landing .card { display: flex; flex-direction: column; align-items: center; padding: 2rem; background: var(--c-card); border-radius: var(--radius); text-decoration: none; color: var(--c-fg); box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
body.landing .card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
body.landing .card-icon { font-size: 3rem; margin-bottom: 1rem; }
body.landing .card-title { font-size: 1.3rem; font-weight: 600; }
body.landing .card-sub { color: var(--c-muted); margin-top: .25rem; }

/* ==================== TABLET ==================== */
body.tablet { background: #0f1115; color: #fff; user-select: none; -webkit-user-select: none; overflow: hidden; height: 100vh; }
.tablet-select { display: grid; place-items: center; height: 100vh; padding: 2rem; }
.tablet-select h1 { font-size: 2rem; margin-bottom: 2rem; }
.filiale-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; max-width: 800px; width: 100%; }
.filiale-btn { padding: 2rem; background: #1c1f26; color: #fff; text-decoration: none; border-radius: var(--radius); text-align: center; font-size: 1.2rem; border: 2px solid transparent; transition: border-color .1s; }
.filiale-btn:hover { border-color: var(--c-primary); }

.tablet-header { position: fixed; top: 0; left: 0; right: 0; height: 60px; display: flex; align-items: center; justify-content: space-between; padding: 0 1.5rem; background: #0a0c11; border-bottom: 1px solid #1f2229; z-index: 10; }
.tablet-header .filiale { font-weight: 600; font-size: 1rem; }
.tablet-header .uhr { font-size: 1.4rem; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.tablet-header .wechseln { color: var(--c-muted); text-decoration: none; font-size: .85rem; }

.tablet-main { padding-top: 60px; height: 100vh; display: flex; align-items: center; justify-content: center; }

#pin-screen, #action-screen { width: 100%; max-width: 480px; padding: 1rem; }

.pin-display { display: flex; justify-content: center; gap: 1rem; margin-bottom: 1rem; }
.pin-display .dot { width: 18px; height: 18px; border-radius: 50%; background: #1f2229; border: 2px solid #2c3140; }
.pin-display .dot.filled { background: var(--c-primary); border-color: var(--c-primary); }

.pin-status { text-align: center; font-size: 1.1rem; color: var(--c-muted); margin-bottom: 2rem; height: 1.4em; }
.pin-status.err { color: var(--c-err); }

.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
.pin-key { padding: 1.4rem 0; font-size: 1.8rem; background: #1c1f26; color: #fff; border: 1px solid #2c3140; border-radius: var(--radius); cursor: pointer; touch-action: manipulation; }
.pin-key:active { background: #2c3140; transform: scale(0.98); }
.pin-key.clear { background: #3a1a1a; color: #ff9797; }
.pin-key.ok { background: var(--c-primary); color: #fff; font-weight: 600; }

.greet { text-align: center; margin-bottom: 2rem; }
.greet-name { font-size: 1.8rem; font-weight: 600; }
.greet-status { color: var(--c-muted); margin-top: .5rem; }

.actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.act { padding: 2rem 1rem; font-size: 1.2rem; background: #1c1f26; color: #fff; border: 1px solid #2c3140; border-radius: var(--radius); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: .75rem; touch-action: manipulation; }
.act:active { transform: scale(0.98); }
.act-icon { font-size: 2.5rem; }
.act-kommen { background: linear-gradient(180deg, #1a3d2c, #14301f); }
.act-gehen { background: linear-gradient(180deg, #3d2a1a, #301f14); }
.act-pause-start, .act-pause-ende { background: linear-gradient(180deg, #2a2a3d, #1f1f30); }
.act:disabled { opacity: 0.4; cursor: not-allowed; }

.abbrechen { display: block; margin: 2rem auto 0; padding: .75rem 2rem; background: transparent; color: var(--c-muted); border: 1px solid #2c3140; border-radius: var(--radius); cursor: pointer; }

.toast { position: fixed; bottom: -100px; left: 50%; transform: translateX(-50%); background: #1c1f26; color: #fff; padding: 1rem 2rem; border-radius: var(--radius); font-size: 1.1rem; border: 1px solid #2c3140; transition: bottom .3s; z-index: 100; }
.toast.show { bottom: 2rem; }
.toast.ok { background: #14301f; border-color: #22c55e; }
.toast.err { background: #301414; border-color: #ef4444; }

/* ==================== ADMIN ==================== */
body.admin { display: grid; grid-template-columns: 220px 1fr; grid-template-rows: 56px 1fr; min-height: 100vh; }
.adm-header { grid-column: 1 / -1; background: var(--c-card); border-bottom: 1px solid var(--c-border); display: flex; align-items: center; padding: 0 1.5rem; box-shadow: var(--shadow); }
.adm-header .brand { font-weight: 700; font-size: 1.05rem; }
.adm-header .brand .accent { color: var(--c-primary); }
.adm-header .spacer { flex: 1; }
.adm-header .user { color: var(--c-muted); font-size: .9rem; margin-right: 1rem; }
.adm-header .logout { color: var(--c-muted); text-decoration: none; }

.adm-nav { background: var(--c-card); border-right: 1px solid var(--c-border); padding: 1rem 0; }
.adm-nav a { display: block; padding: .65rem 1.5rem; color: var(--c-fg); text-decoration: none; border-left: 3px solid transparent; font-size: .95rem; }
.adm-nav a:hover { background: var(--c-bg); }
.adm-nav a.active { border-left-color: var(--c-primary); background: var(--c-bg); font-weight: 600; }

.adm-main { padding: 1.5rem 2rem; overflow: auto; }
.adm-main h1 { margin: 0 0 1rem; font-size: 1.5rem; }
.adm-main h2 { margin: 1.5rem 0 .75rem; font-size: 1.15rem; }

.card { background: var(--c-card); border: 1px solid var(--c-border-soft); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); margin-bottom: 1rem; }

/* Formular */
.form-row { display: grid; grid-template-columns: 180px 1fr; gap: 1rem; align-items: center; margin-bottom: .75rem; }
label { color: var(--c-muted); font-size: .9rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea { width: 100%; padding: .55rem .7rem; border: 1px solid var(--c-border); border-radius: 6px; font-size: .95rem; font-family: inherit; background: #fff; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(9,78,81,.18); }
.btn { padding: .6rem 1.2rem; border: 1px solid var(--c-border); background: var(--c-card); border-radius: 6px; font-size: .95rem; cursor: pointer; font-family: inherit; text-decoration: none; color: var(--c-fg); display: inline-block; }
.btn:hover { background: var(--c-bg); }
.btn-primary { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.btn-primary:hover { background: var(--c-primary-dark); }
.btn-sm { padding: .3rem .7rem; font-size: .85rem; }
.btn-danger { color: var(--c-err); border-color: var(--c-err); }
.btn-danger:hover { background: var(--c-err); color: #fff; }

/* Tabelle */
table.data { width: 100%; border-collapse: collapse; background: var(--c-card); border: 1px solid var(--c-border-soft); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.data th, table.data td { padding: .75rem 1rem; text-align: left; border-bottom: 1px solid #f1f5f9; font-size: .9rem; }
table.data th { background: #f8fafc; font-weight: 600; color: var(--c-muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--c-border-soft); }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover { background: #f8fafc; }

.tag { display: inline-block; padding: .15rem .5rem; border-radius: 4px; font-size: .75rem; font-weight: 600; background: var(--c-border); color: var(--c-muted); }
.tag.admin { background: #fee2e2; color: #991b1b; }
.tag.manager { background: #fef3c7; color: #92400e; }
.tag.mitarbeiter { background: #d4f0f0; color: #0d6669; }
.tag.ok { background: #d1fae5; color: #065f46; }
.tag.warn { background: #fef3c7; color: #92400e; }
.tag.err { background: #fee2e2; color: #991b1b; }

.flash { padding: .75rem 1rem; border-radius: 6px; margin-bottom: 1rem; }
.flash.ok { background: #d1fae5; color: #065f46; }
.flash.err { background: #fee2e2; color: #991b1b; }

/* Login */
body.login-bg { display: grid; place-items: center; min-height: 100vh; background: linear-gradient(135deg, #1a1d24, #2c3140); }
.login-box { background: #fff; padding: 2.5rem; border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 100%; max-width: 380px; }
.login-box h1 { margin: 0 0 1.5rem; text-align: center; }
.login-box .form-row { grid-template-columns: 1fr; gap: .3rem; }

/* Dienstplan */
.plan-grid { display: grid; grid-template-columns: 160px repeat(7, 1fr); background: var(--c-card); border: 1px solid var(--c-border); border-radius: var(--radius); overflow: hidden; }
.plan-head { background: var(--c-bg); padding: .5rem; font-size: .8rem; font-weight: 600; color: var(--c-muted); text-align: center; border-bottom: 1px solid var(--c-border); border-right: 1px solid var(--c-border); }
.plan-head.today { background: #fef3c7; color: #92400e; }
.plan-name { padding: .75rem; font-size: .9rem; font-weight: 600; border-bottom: 1px solid var(--c-border); border-right: 1px solid var(--c-border); background: var(--c-bg); }
.plan-cell { min-height: 80px; padding: .35rem; border-bottom: 1px solid var(--c-border); border-right: 1px solid var(--c-border); position: relative; }
.plan-cell.weekend { background: #fafafa; }
.shift { background: #d4f0f0; color: #0d6669; padding: .3rem .5rem; border-radius: 4px; font-size: .8rem; margin-bottom: .25rem; cursor: pointer; }
.shift.geplant { background: #e0e7ff; color: #3730a3; }
.shift.veröffentlicht { background: #d4f0f0; color: #0d6669; }
.shift.tauschangebot { background: #fef3c7; color: #92400e; }
.shift-add { position: absolute; bottom: 4px; right: 4px; opacity: 0; transition: opacity .1s; font-size: 1.2rem; color: var(--c-muted); cursor: pointer; background: #fff; border-radius: 50%; width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid var(--c-border); }
.plan-cell:hover .shift-add { opacity: 1; }

.week-nav { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.week-nav .week-label { font-weight: 600; font-size: 1.1rem; flex: 1; }

/* Statistik */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat { background: var(--c-card); border: 1px solid var(--c-border-soft); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.stat-label { color: var(--c-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 1.8rem; font-weight: 700; margin-top: .25rem; }
.stat-sub { color: var(--c-muted); font-size: .85rem; margin-top: .25rem; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: none; align-items: center; justify-content: center; z-index: 100; }
.modal-bg.show { display: flex; }
.modal { background: #fff; border-radius: var(--radius); padding: 2rem; width: 100%; max-width: 500px; box-shadow: var(--shadow-lg); }
.modal h2 { margin-top: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.5rem; }

@media (max-width: 768px) {
    body.admin { grid-template-columns: 1fr; }
    .adm-nav { display: flex; overflow-x: auto; padding: .5rem; border-right: none; border-bottom: 1px solid var(--c-border); }
    .adm-nav a { border-left: none; border-bottom: 3px solid transparent; padding: .5rem .75rem; white-space: nowrap; }
    .adm-nav a.active { border-left: none; border-bottom-color: var(--c-primary); }
    .form-row { grid-template-columns: 1fr; }
    .plan-grid { grid-template-columns: 120px repeat(7, minmax(70px, 1fr)); overflow-x: auto; }
    .adm-main { padding: 1rem; }
    .stat-row { grid-template-columns: repeat(2, 1fr); }
    .adm-header .user { display: none; }
    #qr-screen video { max-width: 320px !important; }
}
