/* overMind — Basis-Styles + Theme-System.
   Fachlicher Inhalt ist die Zeiterfassung (Abschnitt weiter unten).
   Theme-aware: hell (Default), dunkel via prefers-color-scheme ODER
   data-theme-Attribut (index.php setzt es aus localStorage 'overmindTheme').
   Mobile-first — primärer Client ist die PWA am Handy. */

:root {
    --bg: #f2f0f7;
    --surface: #ffffff;
    --surface-2: #f5f3fa;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e5e2ee;
    --accent: #7c3aed;          /* violet-600 */
    --accent-strong: #6d28d9;   /* violet-700 */
    --accent-text: #ffffff;
    --ok: #16a34a;
    --danger: #dc2626;
    --radius: 14px;
    --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 8px 24px rgba(0, 0, 0, .05);
    /* Globaler Schriftgrößen-Multiplikator (Einstellungen → Schriftgröße, 5 Stufen).
       Alle font-size-Werte sind calc(<px> * var(--fs, 1)); nur die Schrift skaliert, Layout/Abstände bleiben. */
    --fs: 1;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0e0b16;
        --surface: #171226;
        --surface-2: #211a33;
        --text: #f3f1f7;
        --text-muted: #9b97ab;
        --border: #2b2440;
        --accent: #a78bfa;      /* violet-400 — bright on dark */
        --accent-strong: #c4b5fd;
        --accent-text: #2e1065;
        --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
    }
}

/* Explizite Overrides gewinnen in BEIDE Richtungen gegen prefers-color-scheme. */
:root[data-theme="light"] {
    --bg: #f2f0f7; --surface: #fff; --surface-2: #f5f3fa; --text: #0f172a;
    --text-muted: #64748b; --border: #e5e2ee; --accent: #7c3aed; --accent-strong: #6d28d9; --accent-text: #ffffff;
    --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 8px 24px rgba(0, 0, 0, .05);
}
:root[data-theme="dark"] {
    --bg: #0e0b16; --surface: #171226; --surface-2: #211a33; --text: #f3f1f7;
    --text-muted: #9b97ab; --border: #2b2440; --accent: #a78bfa; --accent-strong: #c4b5fd; --accent-text: #2e1065;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }
/* [hidden] muss auch dann greifen, wenn eine Regel display setzt (z.B. #update-banner:display:flex). */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: calc(16px * var(--fs, 1));
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

/* ── Login ── */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card {
    background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 32px 24px; width: 100%; max-width: 360px; text-align: center;
}
.auth-logo img { width: 64px; height: 64px; border-radius: 16px; }
.auth-card h1 { margin: 8px 0 4px; font-size: calc(28px * var(--fs, 1)); }
.auth-sub { margin: 0 0 20px; color: var(--text-muted); font-size: calc(14px * var(--fs, 1)); }
.auth-error { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger);
    padding: 8px 12px; border-radius: 10px; margin-bottom: 14px; font-size: calc(14px * var(--fs, 1)); }
.auth form { display: flex; flex-direction: column; gap: 10px; }
button { font: inherit; cursor: pointer; }
.auth input, .auth button { font: inherit; padding: 12px 14px; border-radius: 10px; }
.auth input { border: 1px solid var(--border); background: var(--surface-2); color: var(--text); }
.auth button { border: none; background: var(--accent); color: var(--accent-text); font-weight: 600; }
.auth button:active { transform: translateY(1px); }

/* ── Buttons ── */
.btn-primary {
    background: var(--accent); color: var(--accent-text); border: none;
    border-radius: 10px; padding: 10px 14px; font-weight: 600; cursor: pointer; font: inherit;
}
.btn-primary:active { transform: translateY(1px); }
.btn-sm {
    background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
    border-radius: 8px; padding: 6px 10px; font-size: calc(13px * var(--fs, 1)); cursor: pointer; font: inherit;
}
.btn-sm:hover { border-color: var(--accent); }
.btn-block { width: 100%; }

/* ── App-Shell ── */
#app-header {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; gap: 12px;
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top));
}
#app-header .brand { font-weight: 700; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.brand-logo { width: 26px; height: 26px; border-radius: 7px; display: inline-block; }
#app-header .spacer { flex: 1; }

#app-main { padding: 16px; display: flex; flex-direction: column; gap: 16px; max-width: 900px; margin-inline: auto; }
/* Platz lassen, damit der FAB die letzte Listenzeile nicht dauerhaft verdeckt. */
#app-main { padding-bottom: calc(16px + 72px + env(safe-area-inset-bottom)); }

h2 { font-size: calc(16px * var(--fs, 1)); margin: 0 0 8px; }
.muted { color: var(--text-muted); font-size: calc(14px * var(--fs, 1)); }

/* ── Screen-Header + Karten ── */
.screen-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.screen-header h2 { margin: 0; font-size: calc(18px * var(--fs, 1)); }
.screen-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card-block { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card-block > h3 { margin: 0 0 10px; font-size: calc(14px * var(--fs, 1)); }
#modal .card-block + .card-block, .sheet .card-block + .card-block { margin-top: 14px; }

/* Hero (Übersicht) */
.hero {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: var(--accent-text); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 20px; display: flex; flex-direction: column; gap: 4px;
}
.hero h2 { margin: 0; font-size: calc(20px * var(--fs, 1)); color: inherit; }
.hero p { margin: 0; opacity: .9; font-size: calc(14px * var(--fs, 1)); }

/* Kachel-Raster (Übersicht) */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tile {
    background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 16px; text-align: left; display: flex; flex-direction: column; gap: 4px;
    border: none; color: var(--text); cursor: pointer; font: inherit;
}
.tile:hover { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.tile-ic { font-size: calc(24px * var(--fs, 1)); }
.tile-num { font-size: calc(26px * var(--fs, 1)); font-weight: 700; }
.tile-lbl { font-size: calc(13px * var(--fs, 1)); color: var(--text-muted); }

/* Zusammenfassungs-/Detail-Zeile */
.dash-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.dash-line:last-child { border-bottom: none; }

/* Gerüst-Hinweis (Platzhalter-Screens) */
.scaffold-note {
    background: var(--surface-2); border: 1px dashed var(--border);
    border-radius: var(--radius); padding: 16px; font-size: calc(14px * var(--fs, 1)); line-height: 1.55;
}
.scaffold-note p { margin: 0 0 10px; }
.scaffold-note p:last-child { margin-bottom: 0; }
.scaffold-note code { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; font-size: .9em; }

/* ── Formulare ── */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: calc(13px * var(--fs, 1)); color: var(--text-muted); }
.field input, .field select, .field textarea {
    font: inherit; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface-2); color: var(--text); width: 100%;
}
.field textarea { resize: vertical; min-height: 64px; }
.field-row { display: flex; gap: 10px; }
.field-row > .field { flex: 1; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* ── FAB: neuer Eintrag (unten links) ── */
.fab {
    position: fixed; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom));
    width: 56px; height: 56px; border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    color: #ffffff; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .28), var(--shadow);
    z-index: 30; transition: transform .15s ease, box-shadow .15s ease;
}
.fab svg { fill: currentColor; display: block; }
.fab:hover { box-shadow: 0 6px 18px rgba(0, 0, 0, .34), var(--shadow); }
.fab:active { transform: scale(.93); }

/* ── Icon-Buttons ── */
.icon-btn {
    background: transparent; border: none; color: var(--text); padding: 6px;
    border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn svg { fill: currentColor; display: block; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.small { padding: 4px 6px; font-size: calc(15px * var(--fs, 1)); }
.icon-btn.danger { color: var(--danger); }

/* ── Benachrichtigungs-Glocke ── */
.notif-bell { position: relative; }
.notif-badge {
    position: absolute; top: -2px; right: -2px; min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 999px; background: var(--danger); color: #fff; font-size: 10px; line-height: 16px;
    text-align: center; font-weight: 700;
}
.nav-badge { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
    background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 700; }

/* ── Menü-Drawer + Overlay ── */
.menu-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 40; }
.menu-drawer {
    position: fixed; top: 0; left: 0; bottom: 0; width: 300px; max-width: 85vw;
    background: var(--surface); z-index: 50; transform: translateX(-100%); transition: transform .25s ease;
    display: flex; flex-direction: column; box-shadow: var(--shadow); overflow-y: auto;
    padding-top: env(safe-area-inset-top);
}
.menu-drawer.open { transform: translateX(0); }
.menu-header { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--border); }
.menu-title-group { display: flex; align-items: center; gap: 12px; }
.menu-avatar {
    width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: var(--accent-text);
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: calc(18px * var(--fs, 1)); flex: 0 0 auto;
}
.menu-header h2 { margin: 0; font-size: calc(16px * var(--fs, 1)); }
.menu-role { font-size: calc(12px * var(--fs, 1)); color: var(--text-muted); }
.menu-nav { flex: 1; padding: 8px 0; }
.menu-nav ul { list-style: none; margin: 0; padding: 0; }
.menu-nav a { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: var(--text); text-decoration: none; font-size: calc(15px * var(--fs, 1)); }
.menu-nav a:hover { background: var(--surface-2); }
.menu-nav .mi { width: 22px; text-align: center; }
.menu-nav .chevron { margin-left: auto; transition: transform .2s; font-size: calc(12px * var(--fs, 1)); color: var(--text-muted); }
.menu-nav .chevron.open { transform: rotate(180deg); }
.menu-sep { height: 1px; background: var(--border); margin: 8px 0; }
.menu-logout { color: var(--danger) !important; }
.menu-version { text-align: center; font-size: calc(11px * var(--fs, 1)); color: var(--text-muted); padding: 10px; }

.submenu { background: var(--surface-2); }
.submenu.collapsed { display: none; }
.submenu-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px 12px 40px; font-size: calc(14px * var(--fs, 1)); }
.submenu-label { color: var(--text-muted); }
.submenu ul li a { padding-left: 40px; }

/* Toggle-Switch */
.menu-switch { width: 42px; height: 24px; border-radius: 999px; background: var(--border); position: relative; cursor: pointer; transition: background .2s; flex: 0 0 auto; }
.menu-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
.menu-switch.active { background: var(--accent); }
.menu-switch.active::after { transform: translateX(18px); }
.menu-switch.switch-disabled { opacity: .4; pointer-events: none; }

/* Theme-Buttons */
.theme-buttons { display: flex; gap: 6px; }
.theme-btn { padding: 6px 10px; font-size: calc(13px * var(--fs, 1)); border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 8px; cursor: pointer; }
.theme-btn.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

/* Schriftgrößen-Regler */
.submenu-row-col { flex-direction: column; align-items: stretch; gap: 8px; }
.font-scale-control { display: flex; align-items: center; gap: 10px; }
.font-scale-slider { flex: 1 1 auto; min-width: 0; accent-color: var(--accent); cursor: pointer; }
.fs-tick { color: var(--text-muted); font-weight: 700; line-height: 1; flex: 0 0 auto; }
.fs-tick-min { font-size: 12px; }
.fs-tick-max { font-size: 20px; }

/* ── Sync-Indikator ── */
.sync-indicator { display: flex; align-items: center; gap: 6px; cursor: pointer; padding: 4px 8px; border-radius: 999px; }
.sync-indicator svg { width: 20px; height: 20px; display: block; fill: currentColor; }
.sync-label { font-size: calc(12px * var(--fs, 1)); max-width: 0; overflow: hidden; white-space: nowrap; opacity: 0; transition: max-width .3s, opacity .3s; }
.sync-label.visible { max-width: 130px; opacity: 1; }
.sync-online { color: #22c55e; } .sync-offline { color: #9ca3af; }
.sync-pending { color: #f97316; } .sync-syncing { color: #eab308; } .sync-forced { color: #a855f7; }
.sync-syncing svg { animation: pn-spin 1.2s linear infinite; }
@keyframes pn-spin { to { transform: rotate(360deg); } }

/* ── Queue-Panel ── */
.queue-panel {
    position: fixed; top: calc(54px + env(safe-area-inset-top)); right: 8px;
    width: 320px; max-width: calc(100vw - 16px); background: var(--surface);
    border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
    z-index: 60; padding: 12px; max-height: 75vh; overflow-y: auto; font-size: calc(14px * var(--fs, 1));
}
.queue-offline-toggle { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; background: var(--surface-2); border-radius: 10px; margin-bottom: 10px; cursor: pointer; }
.queue-title { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; font-weight: 600; margin-bottom: 10px; }
.queue-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.queue-dot.green { background: #22c55e; } .queue-dot.orange { background: #f97316; }
.queue-dot.red { background: #ef4444; } .queue-dot.yellow { background: #eab308; } .queue-dot.blue { background: #3b82f6; }
.queue-storage { margin-left: auto; font-size: calc(12px * var(--fs, 1)); color: var(--text-muted); font-weight: 400; }
.queue-net { flex-basis: 100%; text-align: right; font-size: calc(11px * var(--fs, 1)); color: var(--text-muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.queue-section { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.queue-item { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.queue-item.error { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.queue-item-icon { font-size: calc(16px * var(--fs, 1)); }
.queue-item-info { flex: 1; min-width: 0; }
.queue-item-action { font-weight: 500; }
.queue-item-err { font-size: calc(12px * var(--fs, 1)); color: var(--danger); word-break: break-word; }
.queue-item-retry { background: transparent; border: none; color: var(--accent); cursor: pointer; font-size: calc(18px * var(--fs, 1)); }
.queue-empty { color: var(--text-muted); text-align: center; padding: 16px 0; }
.queue-actions { display: flex; flex-direction: column; gap: 6px; }
.queue-actions button { width: 100%; padding: 9px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: calc(13px * var(--fs, 1)); }
.queue-actions button.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }

/* ── Modal ── */
#modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 70; }
#modal {
    position: fixed; z-index: 80; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 480px; max-width: calc(100vw - 24px); max-height: 85vh; overflow-y: auto;
    background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 20px;
}
#modal h2 { margin-top: 0; }
.modal-close { position: absolute; top: 12px; right: 12px; background: transparent; border: none; font-size: calc(18px * var(--fs, 1)); color: var(--text-muted); cursor: pointer; }

/* ── Admin-Karten (Benutzer) ── */
.admin-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.admin-card { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.admin-card-body { display: flex; gap: 12px; align-items: center; }
.admin-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: var(--accent-text); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: calc(18px * var(--fs, 1)); flex: 0 0 auto; }
.admin-card-right { flex: 1; min-width: 0; }
.admin-card-head { display: flex; align-items: center; gap: 8px; }
.admin-name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-badge { font-size: calc(12px * var(--fs, 1)); color: var(--text-muted); }
.admin-edit-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.admin-edit-form input, .admin-role-select { flex: 1; min-width: 130px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }

/* ── App-Einstellungen ── */
.settings-list { display: flex; flex-direction: column; gap: 14px; }
.settings-list h3 { margin: 6px 0 0; font-size: calc(14px * var(--fs, 1)); }
.settings-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.acl-check { flex-direction: row; align-items: center; justify-content: space-between; }
.acl-check > span { color: var(--text); }

/* ── Profil: Emoji-Presets ── */
.emoji-field { display: flex; align-items: center; gap: 10px; }
.emoji-field input { width: 90px; text-align: center; font-size: calc(22px * var(--fs, 1)); }
.emoji-preview { font-size: calc(15px * var(--fs, 1)); color: var(--text-muted); }
.emoji-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-preset { width: 40px; height: 40px; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; font-size: calc(20px * var(--fs, 1)); cursor: pointer; }
.emoji-preset.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 15%, transparent); }

/* ── Notification-Center ── */
.listing-sticky { position: sticky; top: calc(52px + env(safe-area-inset-top)); z-index: 5; background: var(--bg); padding-bottom: 8px; }
.listing-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.listing-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.notif-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.notif-item { display: flex; align-items: flex-start; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.notif-ic { font-size: calc(18px * var(--fs, 1)); flex: 0 0 auto; }
.notif-main { flex: 1; min-width: 0; }
.notif-title { font-weight: 600; }
.notif-body-text { font-size: calc(13px * var(--fs, 1)); color: var(--text-muted); }
.notif-time { font-size: calc(11px * var(--fs, 1)); color: var(--text-muted); margin-top: 2px; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; margin-top: 6px; }
.notif-dismiss { flex: 0 0 auto; }
.notif-group-h { margin: 0 0 8px; font-size: calc(14px * var(--fs, 1)); }
.notif-pref { padding: 12px 0; border-bottom: 1px solid var(--border); }
.notif-pref:last-child { border-bottom: none; }
.notif-pref-head { display: flex; align-items: flex-start; gap: 10px; }
.notif-pref-info { flex: 1; min-width: 0; }
.notif-pref-label { font-weight: 600; }
.notif-pref-desc { font-size: calc(12px * var(--fs, 1)); }
.notif-pref-toggles { display: flex; gap: 18px; margin-top: 8px; padding-left: 28px; }
.notif-tg { display: flex; align-items: center; gap: 8px; font-size: calc(13px * var(--fs, 1)); }
.notif-pref-params { margin-top: 10px; padding-left: 28px; display: flex; flex-direction: column; gap: 8px; }
.notif-param { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: calc(13px * var(--fs, 1)); }
.notif-param input, .notif-param select { font: inherit; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text); max-width: 55%; }

/* ── Zeiterfassung ── */
/* Segmentierter Umschalter (Zeitraum, Tagestyp). BEWUSST nicht .theme-btn wiederverwenden —
   darauf hängt ein globaler Handler, der das Farbschema umstellen würde. */
.seg { display: inline-flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg-wrap { flex-wrap: wrap; }
.seg-btn {
    border: none; background: transparent; color: var(--text-muted); font: inherit;
    font-size: calc(13px * var(--fs, 1)); padding: 6px 10px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.seg-btn.active { background: var(--accent); color: var(--accent-text); font-weight: 600; }

.pos { color: var(--ok); }
.neg { color: var(--danger); }
.tile-wide { grid-column: 1 / -1; }
.tile-sub { font-size: calc(13px * var(--fs, 1)); font-weight: 400; color: var(--text-muted); }

/* Stempeluhr */
.stamp-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stamp-bar.running { border-left: 4px solid var(--accent); }
.stamp-title { font-weight: 600; }
.time-member { margin: 0; }
.time-actions { flex-wrap: wrap; }

/* Tagesliste — zwei Zeilen statt breiter Tabelle (mobile-first, kein Seiten-Scroll) */
.time-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.time-row { padding: 10px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.time-row:last-child { border-bottom: none; }
.time-row.weekend { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.time-row.today { box-shadow: inset 3px 0 0 var(--accent); padding-left: 8px; }
.time-row.pending { opacity: .55; }
.time-row-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.time-date { min-width: 74px; font-size: calc(14px * var(--fs, 1)); }
.time-date strong { color: var(--text-muted); font-weight: 600; margin-right: 2px; }
.time-saldo { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.time-row-sub { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px; font-size: calc(12px * var(--fs, 1)); color: var(--text-muted); }
.time-row-sub .sep { opacity: .5; }
.time-acc { font-variant-numeric: tabular-nums; }

.day-badge { display: inline-block; font-size: calc(11px * var(--fs, 1)); padding: 1px 8px; border-radius: 999px;
    border: 1px solid var(--border); background: var(--surface-2); color: var(--text-muted); white-space: nowrap; }
.day-badge--vacation { background: color-mix(in srgb, #0ea5e9 18%, transparent); color: #0369a1; border-color: transparent; }
.day-badge--sick     { background: color-mix(in srgb, #f59e0b 18%, transparent); color: #b45309; border-color: transparent; }
.day-badge--holiday  { background: color-mix(in srgb, #a855f7 18%, transparent); color: #7e22ce; border-color: transparent; }
.day-badge--flex_off { background: color-mix(in srgb, #6366f1 18%, transparent); color: #4338ca; border-color: transparent; }
.day-badge--open     { background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--ok); border-color: transparent; }
.day-badge--missing  { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); border-color: transparent; }
@media (prefers-color-scheme: dark) {
    .day-badge--vacation { color: #7dd3fc; } .day-badge--sick { color: #fcd34d; }
    .day-badge--holiday { color: #d8b4fe; }  .day-badge--flex_off { color: #a5b4fc; }
}
:root[data-theme="dark"] .day-badge--vacation { color: #7dd3fc; }
:root[data-theme="dark"] .day-badge--sick { color: #fcd34d; }
:root[data-theme="dark"] .day-badge--holiday { color: #d8b4fe; }
:root[data-theme="dark"] .day-badge--flex_off { color: #a5b4fc; }

/* Live-Vorschau im Tagesformular */
.time-preview { display: flex; flex-wrap: wrap; gap: 10px 16px; background: var(--surface-2); border-radius: 10px;
    padding: 10px 12px; font-size: calc(13px * var(--fs, 1)); color: var(--text-muted); }
.time-preview strong { color: var(--text); font-variant-numeric: tabular-nums; }
.time-preview-note { flex-basis: 100%; }

/* Wochenvorlage */
.week-grid { display: flex; flex-direction: column; gap: 6px; }
.week-row { display: grid; grid-template-columns: 28px repeat(3, 1fr); gap: 6px; align-items: end; }
.week-row input { font: inherit; font-size: calc(13px * var(--fs, 1)); padding: 7px 8px; border: 1px solid var(--border);
    border-radius: 8px; background: var(--surface-2); color: var(--text); width: 100%; min-width: 0; }
.week-day { font-size: calc(12px * var(--fs, 1)); color: var(--text-muted); font-weight: 600; padding-bottom: 8px; }
.wk-f { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
/* Spaltenüberschriften nur einmal — in der ersten Zeile. */
.wk-f > span { display: none; font-size: calc(11px * var(--fs, 1)); color: var(--text-muted); }
.week-row:first-child .wk-f > span { display: block; }

/* Zeiträume im Tagesformular (mehrfaches Ein-/Ausstempeln) */
.span-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.span-row { display: grid; grid-template-columns: 1fr 1fr 34px; gap: 6px; align-items: end; }
.span-row input { font: inherit; font-size: calc(14px * var(--fs, 1)); padding: 8px; border: 1px solid var(--border);
    border-radius: 8px; background: var(--surface-2); color: var(--text); width: 100%; min-width: 0; }
.span-row:first-child .wk-f > span { display: block; }
.span-row .sp-del { align-self: end; margin-bottom: 2px; }
/* Stempelleiste: „Bearbeiten" + „Kommen jetzt" nebeneinander */
.stamp-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Meilenstein-/Urlaubslisten */
.ms-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ms-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 8px 0; border-bottom: 1px solid var(--border); font-size: calc(14px * var(--fs, 1)); }
.ms-list li:last-child { border-bottom: none; }

/* Verlaufsdiagramm (Inline-SVG) */
.time-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.ch-grid { stroke: var(--border); stroke-width: 1; }
.ch-grid.zero { stroke: var(--text-muted); stroke-dasharray: 4 3; }
.ch-lbl { fill: var(--text-muted); font-size: 10px; }
.ch-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.ch-proj { stroke-dasharray: 6 4; opacity: .75; }
.ch-dot { fill: var(--accent); }
.ch-ms { stroke: #a855f7; stroke-width: 1.5; stroke-dasharray: 3 3; }
.ch-ms-lbl { fill: #a855f7; font-size: 10px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 8px 0 12px; font-size: calc(12px * var(--fs, 1)); color: var(--text-muted); }
.chart-legend i { display: inline-block; width: 18px; border-top: 2.5px solid var(--accent); vertical-align: middle; margin-right: 4px; }
.chart-legend i.dashed { border-top-style: dashed; }
.chart-legend i.ms { border-top: 2px dashed #a855f7; }

/* ── Mobile: Modal als Bottom-Sheet ── */
@media (max-width: 600px) {
    #modal {
        top: auto; bottom: 0; left: 0; transform: none;
        width: 100%; max-width: 100%; max-height: 90vh;
        border-radius: 18px 18px 0 0; padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }
    .queue-panel { right: 8px; left: 8px; width: auto; }
    .tiles { grid-template-columns: repeat(2, 1fr); }
    /* Wochenvorlage: 3 Eingaben nebeneinander sind zu eng → Kommen/Gehen oben,
       Soll in der zweiten Zeile über die volle Breite. */
    .week-row { grid-template-columns: 28px 1fr 1fr; row-gap: 4px; }
    .week-row .wk-f:nth-of-type(3) { grid-column: 2 / span 2; }
    .week-day { grid-row: span 2; align-self: center; padding-bottom: 0; }
    .time-date { min-width: 66px; }
}
