/* Zeitkonto · ReproMedia (Designsystem wie Montagezeiten / RIP-Profile) */
:root, [data-theme="light"] {
  --bg: oklch(97.6% 0.004 230);
  --surface: oklch(100% 0 0);
  --surface-2: oklch(96% 0.006 230);
  --surface-3: oklch(92% 0.008 230);
  --border: oklch(89% 0.01 230);
  --border-strong: oklch(78% 0.014 230);
  --text: oklch(22% 0.015 240);
  --text-muted: oklch(44% 0.016 240);
  --text-subtle: oklch(58% 0.014 240);
  --accent: oklch(48% 0.1 235);
  --accent-strong: oklch(41% 0.1 235);
  --accent-soft: oklch(95% 0.03 230);
  --pos: oklch(48% 0.12 150); --pos-soft: oklch(95% 0.04 150);
  --neg: oklch(52% 0.17 25);  --neg-soft: oklch(95.5% 0.03 25);
  --warn: oklch(55% 0.13 70); --warn-soft: oklch(95.5% 0.05 85);
  --abw: oklch(50% 0.09 300); --abw-soft: oklch(95.5% 0.025 300);
  --bad: var(--neg);
  --weekend: oklch(97% 0.004 230);
  --shadow-sm: 0 1px 2px oklch(20% 0.02 240 / 0.06);
  --shadow-md: 0 8px 24px oklch(20% 0.02 240 / 0.12), 0 2px 6px oklch(20% 0.02 240 / 0.06);
}
[data-theme="dark"] {
  --bg: oklch(17% 0.01 240);
  --surface: oklch(21% 0.012 240);
  --surface-2: oklch(25% 0.014 240);
  --surface-3: oklch(29% 0.016 240);
  --border: oklch(31% 0.014 240);
  --border-strong: oklch(40% 0.016 240);
  --text: oklch(94% 0.006 230);
  --text-muted: oklch(76% 0.01 230);
  --text-subtle: oklch(62% 0.01 230);
  --accent: oklch(74% 0.1 230);
  --accent-strong: oklch(82% 0.09 230);
  --accent-soft: oklch(30% 0.04 235);
  --pos: oklch(76% 0.13 150); --pos-soft: oklch(30% 0.05 150);
  --neg: oklch(72% 0.15 25);  --neg-soft: oklch(31% 0.06 25);
  --warn: oklch(80% 0.12 80); --warn-soft: oklch(32% 0.05 80);
  --abw: oklch(78% 0.09 300); --abw-soft: oklch(31% 0.04 300);
  --weekend: oklch(19% 0.01 240);
  --shadow-sm: 0 1px 2px oklch(0% 0 0 / 0.3);
  --shadow-md: 0 8px 24px oklch(0% 0 0 / 0.45);
}
:root {
  --text-xs: 0.75rem; --text-sm: 0.8125rem; --text-base: 0.9375rem; --text-lg: 1.125rem;
  --radius-sm: 6px; --radius-md: 10px; --radius-lg: 14px;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body { background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: var(--text-base); line-height: 1.5; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
code { font-size: 0.85em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.pos { color: var(--pos); } .neg { color: var(--neg); }

/* Header */
.header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem; padding: 0.7rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.brand-mark { width: 34px; height: 34px; color: var(--accent); flex: none; }
.brand-text h1 { margin: 0; font-size: 1.0625rem; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.brand-text p { margin: 0; font-size: var(--text-xs); color: var(--text-muted); white-space: nowrap; }
.tabs { display: flex; gap: 2px; background: var(--surface-2); padding: 3px; border-radius: 9px; margin-left: 1rem; }
.tabs button { border: 0; background: none; padding: 0.35rem 0.85rem; border-radius: 7px; font-size: var(--text-sm); font-weight: 500; color: var(--text-muted); }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); font-weight: 600; }
.header-actions { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }
#empSelect { height: 36px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0 0.6rem; background: var(--surface); font-weight: 600; max-width: 200px; }

.btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 0.9rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); font-size: var(--text-sm); font-weight: 500; white-space: nowrap; transition: background .15s, border-color .15s; text-decoration: none; cursor: pointer; }
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: oklch(99% 0 0); font-weight: 600; }
[data-theme="dark"] .btn.primary { color: oklch(18% 0.02 240); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.ghost { border-color: transparent; color: var(--accent); background: none; }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.small { height: 30px; padding: 0 0.6rem; font-size: var(--text-xs); }
.btn.danger-solid { background: var(--neg); border-color: var(--neg); color: #fff; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-muted); flex: none; }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn svg { width: 17px; height: 17px; }
.row-btn { width: 28px; height: 28px; display: inline-grid; place-items: center; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--text-subtle); }
.row-btn:hover { border-color: var(--border); color: var(--accent); background: var(--surface); }
.row-btn svg { width: 15px; height: 15px; }

.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 280px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-md); padding: 4px; z-index: 30; }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 0.5rem 0.7rem; border: 0; background: none; border-radius: 6px; font-size: var(--text-sm); text-decoration: none; }
.menu a:hover, .menu button:hover { background: var(--surface-2); }

/* Layout */
.view { padding: 1.25rem 1.5rem 3rem; max-width: 1480px; margin: 0 auto; display: grid; gap: 1rem; }
.view.narrow { max-width: 980px; }
.monthbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.month-nav { display: flex; align-items: center; gap: 0.5rem; }
.month-nav h2 { margin: 0 0.25rem; font-size: 1.375rem; letter-spacing: -0.015em; min-width: 9.5ch; text-align: center; }
.month-nav select { height: 36px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0 0.6rem; background: var(--surface); margin-left: 0.5rem; }
.month-meta { font-size: var(--text-sm); color: var(--text-muted); display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 0.6875rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); white-space: nowrap; }
.badge.archiv { background: var(--abw-soft); color: var(--abw); }
.badge.import { background: var(--accent-soft); color: var(--accent-strong); }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0.9rem 1.1rem; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi.accent { background: var(--accent-soft); border-color: transparent; }
.kpi-label { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.kpi-value { font-size: 1.75rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1.15; }
.kpi.accent .kpi-value { color: var(--accent-strong); }
.kpi-sub { font-size: var(--text-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }

.alerts { display: grid; gap: 0.5rem; }
.alert { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.65rem 0.9rem; border-radius: var(--radius-md); background: var(--warn-soft); color: var(--text); font-size: var(--text-sm); }
.alert b { color: var(--warn); }
.alert.info { background: var(--accent-soft); }
.alert.info b { color: var(--accent-strong); }
.alert svg { width: 18px; height: 18px; flex: none; color: var(--warn); margin-top: 1px; }
.alert.info svg { color: var(--accent); }

/* Tabellen */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: auto; }
.table { font-size: var(--text-sm); }
.table th { text-align: left; font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); padding: 0.65rem 0.7rem; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.table td { padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover td { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td.strong { font-weight: 600; }
.table td.day { white-space: nowrap; font-variant-numeric: tabular-nums; }
.table td.day b { display: inline-block; width: 2.2ch; color: var(--text-muted); font-weight: 600; }
.table td.times { white-space: nowrap; font-variant-numeric: tabular-nums; }
.table td.times .x { color: var(--text-subtle); text-decoration: line-through; margin-right: 4px; }
.table td.times .seg + .seg::before { content: " · "; color: var(--text-subtle); }
.table tr.weekend td { background: var(--weekend); color: var(--text-subtle); }
.table tr.weekend td.day b { color: var(--text-subtle); }
.table tr.holiday td { background: var(--abw-soft); }
.table tr.offen td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.table tr.bad td:first-child { box-shadow: inset 3px 0 0 var(--neg); }
.table .act { width: 44px; text-align: right; }
.table td.act { opacity: .45; transition: opacity .15s; }
.table tr:hover td.act, .table tr:focus-within td.act { opacity: 1; }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-bottom: 0; border-top: 1px solid var(--border); }
.dash { color: var(--text-subtle); font-weight: 400; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.chip { font-size: 0.6875rem; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); white-space: nowrap; }
.chip.auto { background: var(--accent-soft); color: var(--accent-strong); }
.chip.ok { background: var(--pos-soft); color: var(--pos); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--neg-soft); color: var(--neg); }
.chip.abw { background: var(--abw-soft); color: var(--abw); }
.chip.man { background: var(--surface-3); color: var(--text); }
.note-txt { color: var(--text-muted); font-size: var(--text-xs); }
.abw-select { height: 28px; border: 1px dashed var(--border-strong); border-radius: 6px; padding: 0 0.4rem; background: var(--surface); font-size: var(--text-xs); color: var(--text-muted); }
.abw-select.set { border-style: solid; color: var(--abw); background: var(--abw-soft); border-color: transparent; font-weight: 600; }
.abw-select.need { border-color: var(--warn); color: var(--warn); }

.empty { padding: 3.5rem 1rem; text-align: center; color: var(--text-muted); }
.empty h3 { margin: 0 0 0.25rem; color: var(--text); font-size: var(--text-lg); }
.empty p { margin: 0 auto 1rem; max-width: 52ch; }
.archive-box { padding: 1.25rem 1.4rem; display: grid; gap: 0.75rem; }
.archive-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.6rem; }
.archive-grid div { background: var(--surface-2); border-radius: var(--radius-md); padding: 0.6rem 0.8rem; }
.archive-grid span { display: block; font-size: 0.6875rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.archive-grid b { font-size: 1.125rem; font-variant-numeric: tabular-nums; }

/* Panels / Einstellungen */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.1rem 1.3rem 1.2rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.panel-head h3 { margin: 0; font-size: var(--text-base); font-weight: 700; }
.panel-sub { margin: 0.3rem 0 1rem; color: var(--text-muted); font-size: var(--text-sm); max-width: 75ch; }
.legend { font-size: var(--text-xs); color: var(--text-muted); display: inline-flex; align-items: center; gap: 6px; }
.lg-bar { width: 10px; height: 10px; border-radius: 2px; background: var(--accent); opacity: .55; display: inline-block; }
.lg-line { width: 16px; height: 3px; border-radius: 2px; background: var(--accent-strong); display: inline-block; margin-left: 8px; }
.chart { margin-top: 0.75rem; width: 100%; }
.chart svg { width: 100%; height: 240px; overflow: visible; }
.chart text { font-size: 10.5px; fill: var(--text-subtle); font-family: var(--font-body); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem 1rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.9rem 1rem; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: var(--text-xs); font-weight: 600; color: var(--text-muted); }
.field input, .field select, .field textarea { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0.45rem 0.6rem; background: var(--surface); min-width: 0; height: 38px; }
.field input:focus, .field select:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field input.invalid { border-color: var(--neg); }
.hint { font-size: 0.6875rem; color: var(--text-subtle); min-height: 1em; }
.checks { display: grid; gap: 0.45rem; margin: 0.9rem 0 0.2rem; }
.check { display: flex; gap: 0.55rem; align-items: flex-start; font-size: var(--text-sm); cursor: pointer; }
.check input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.row-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.emp-list { display: grid; gap: 0.5rem; }
.emp-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr auto; gap: 0.75rem; align-items: end; padding: 0.7rem 0.8rem; background: var(--surface-2); border-radius: var(--radius-md); }
.emp-row .meta { font-size: var(--text-xs); color: var(--text-muted); padding-bottom: 10px; }

/* Modals */
.modal-overlay { position: fixed; inset: 0; background: oklch(15% 0.02 240 / 0.5); display: grid; place-items: center; z-index: 50; padding: 1rem; }
.modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); width: min(680px, 100%); max-height: calc(100vh - 2rem); overflow-y: auto; padding: 1.4rem 1.5rem; }
.modal.narrow { width: min(440px, 100%); }
.modal h2 { margin: 0; font-size: var(--text-lg); }
.modal-sub { margin: 0.2rem 0 0.9rem; color: var(--text-muted); font-size: var(--text-sm); }
.raw { font-size: var(--text-sm); background: var(--surface-2); border-radius: var(--radius-md); padding: 0.55rem 0.8rem; font-variant-numeric: tabular-nums; }
.raw span { color: var(--text-muted); margin-right: 0.4rem; }
.block { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0.6rem 1rem 0.9rem; margin: 0.9rem 0 0; }
.block legend { padding: 0 6px; font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); }
.block .checks { margin-top: 0.3rem; }
.seg-list { display: grid; gap: 0.4rem; margin: 0.6rem 0 0.4rem; }
.seg { display: flex; gap: 0.5rem; align-items: center; }
.seg input { height: 36px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0 0.5rem; background: var(--surface); width: 120px; }
.seg span { color: var(--text-muted); }
.preview { margin-top: 1rem; display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.4rem; }
.preview div { background: var(--surface-2); border-radius: 8px; padding: 0.4rem 0.6rem; font-size: 0.6875rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.preview b { display: block; font-size: var(--text-base); color: var(--text); text-transform: none; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.form-error { color: var(--neg); font-size: var(--text-sm); margin: 0.75rem 0 0; }
.modal-actions { display: flex; justify-content: flex-end; align-items: center; gap: 0.5rem; margin-top: 1.25rem; }
.modal-actions.left { justify-content: flex-start; margin-top: 1rem; }
.spacer { flex: 1; }
.import-list { display: grid; gap: 0.4rem; max-height: 50vh; overflow: auto; }
.imp { display: grid; grid-template-columns: 1fr auto; gap: 0.5rem; align-items: center; padding: 0.55rem 0.8rem; background: var(--surface-2); border-radius: var(--radius-md); font-size: var(--text-sm); }
.imp small { display: block; color: var(--text-muted); font-size: var(--text-xs); }

.dropzone { position: fixed; inset: 0; z-index: 70; background: oklch(30% 0.06 235 / 0.55); display: grid; place-items: center; pointer-events: none; }
.dropzone div { background: var(--surface); border: 2px dashed var(--accent); border-radius: 18px; padding: 2.2rem 3rem; font-size: 1.25rem; font-weight: 700; text-align: center; color: var(--accent-strong); }
.dropzone small { display: block; font-size: var(--text-sm); color: var(--text-muted); font-weight: 500; margin-top: 4px; }
.toast { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 0.6rem 1rem; border-radius: var(--radius-md); font-size: var(--text-sm); box-shadow: var(--shadow-md); z-index: 80; max-width: calc(100vw - 2rem); }
.skeleton { height: 14px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; margin: 12px 16px; }
@keyframes sk { to { background-position: -200% 0; } }
#printArea { display: none; }


/* ===== Version 2: Anmeldung, Rollen, Meldungen, Protokoll ===== */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: radial-gradient(1200px 500px at 50% -10%, var(--accent-soft), transparent), var(--bg); }
.auth-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-md); padding: 2rem 1.8rem 1.6rem; display: grid; gap: 0.8rem; }
.auth-logo { width: 46px; height: 46px; color: var(--accent); }
.auth-card h1 { margin: 0; font-size: 1.5rem; letter-spacing: -0.02em; }
.auth-sub { margin: -0.5rem 0 0.4rem; color: var(--text-muted); font-size: var(--text-sm); }
.btn.wide { width: 100%; justify-content: center; height: 42px; font-size: var(--text-base); }
.hint.center { text-align: center; }
.user-btn { display: inline-flex; align-items: center; gap: 0.45rem; height: 36px; padding: 0 0.6rem 0 0.25rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: var(--text-sm); font-weight: 500; }
.user-btn:hover { background: var(--surface-2); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; font-size: 0.6875rem; font-weight: 700; flex: none; }
.user-name { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-head { padding: 0.5rem 0.7rem 0.6rem; border-bottom: 1px solid var(--border); margin-bottom: 4px; display: grid; font-size: var(--text-sm); }
.menu-head span { font-size: var(--text-xs); color: var(--text-muted); }
body.is-user .admin-only { display: none !important; }
.count-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--neg); color: #fff; font-size: 0.625rem; font-weight: 700; margin-left: 4px; }
.badge.ok { background: var(--pos-soft); color: var(--pos); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.chip.flagged { background: var(--neg-soft); color: var(--neg); }
.table tr.reported td:first-child { box-shadow: inset 3px 0 0 var(--neg); }
.table.readonly tbody tr.clickable { cursor: default; }
.table.readonly tbody tr.clickable:hover td { background: inherit; }
.statusbar { display: flex; align-items: center; gap: 0.8rem; padding: 0.75rem 1rem; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); }
.statusbar.ok { background: var(--pos-soft); border-color: transparent; }
.statusbar.warn { background: var(--warn-soft); border-color: transparent; }
.sb-ico svg { width: 24px; height: 24px; display: block; }
.sb-ico.ok { color: var(--pos); } .sb-ico.warn { color: var(--warn); }
.sb-text { flex: 1; font-size: var(--text-sm); }
.sb-text small { display: block; color: var(--text-muted); font-size: var(--text-xs); margin-top: 1px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.archive-grid { margin-bottom: 0.5rem; }
.table tfoot .archive-grid b { font-size: 1.05rem; }
.archive-note { font-weight: 400; margin: 0.25rem 0 0; }
.rep-list { display: grid; gap: 0.5rem; }
.rep { display: flex; gap: 1rem; align-items: flex-start; padding: 0.75rem 0.9rem; border-radius: var(--radius-md); background: var(--surface-2); border-left: 3px solid var(--neg); }
.rep.erledigt { border-left-color: var(--pos); }
.rep-main { flex: 1; min-width: 0; }
.rep-head { display: flex; flex-wrap: wrap; gap: 0.4rem 0.6rem; align-items: center; font-size: var(--text-sm); }
.rep-text { margin: 0.35rem 0 0; font-size: var(--text-sm); white-space: pre-wrap; }
.rep-answer { margin: 0.35rem 0 0; font-size: var(--text-sm); color: var(--text-muted); }
.rep-act { display: flex; gap: 0.4rem; flex: none; }
.rep-inline { display: grid; gap: 0.4rem; margin-bottom: 0.6rem; }
.rep-inline .alert svg, #dayConfirmed svg { color: var(--neg); }
#dayConfirmed { margin-bottom: 0.6rem; }
.empty.small { padding: 2rem 1rem; }
.seg-toggle { display: inline-flex; background: var(--surface-2); padding: 3px; border-radius: 8px; gap: 2px; }
.seg-toggle button { border: 0; background: none; padding: 0.25rem 0.7rem; border-radius: 6px; font-size: var(--text-xs); font-weight: 600; color: var(--text-muted); }
.seg-toggle button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.filters { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.filters select { height: 36px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0 0.6rem; background: var(--surface); }
.search { position: relative; flex: 1; min-width: 220px; max-width: 420px; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-subtle); }
.search input { width: 100%; height: 36px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0 0.6rem 0 2rem; background: var(--surface); }
.count { font-size: var(--text-xs); color: var(--text-muted); margin-left: auto; }
.nowrap { white-space: nowrap; }
.table td.details { min-width: 320px; color: var(--text-muted); }
.emp-row { grid-template-columns: 1.2fr 0.8fr 1.6fr auto; }
.emp-model { display: grid; gap: 1px; padding-bottom: 4px; min-width: 0; }
.emp-model .lbl { font-size: var(--text-xs); font-weight: 600; color: var(--text-muted); }
.emp-model b { font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.emp-model small { font-size: var(--text-xs); color: var(--text-subtle); }
.emp-btns { display: flex; gap: 0.3rem; padding-bottom: 3px; }
.user-list { display: grid; gap: 0.4rem; }
.user-row { display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 0.8rem; background: var(--surface-2); border-radius: var(--radius-md); }
.user-row.inactive { opacity: .55; }
.user-info { flex: 1; min-width: 0; display: grid; font-size: var(--text-sm); }
.user-info small { color: var(--text-muted); font-size: var(--text-xs); }
.grid.one { grid-template-columns: 1fr; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--accent); font-size: inherit; text-decoration: underline; cursor: pointer; }
.field textarea { height: auto; resize: vertical; font: inherit; }
.model-head, .model-row { display: grid; grid-template-columns: 1.3fr 1fr 0.7fr 0.9fr 0.9fr 5.5rem; gap: 0.5rem; align-items: center; }
.model-head { font-size: var(--text-xs); font-weight: 600; color: var(--text-muted); margin-bottom: 0.3rem; }
.model-rows { display: grid; gap: 0.4rem; margin-bottom: 0.6rem; }
.model-row input, .model-row select { height: 36px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0 0.45rem; background: var(--surface); min-width: 0; width: 100%; }
.model-first { font-size: var(--text-sm); color: var(--text-muted); }
.model-soll { font-variant-numeric: tabular-nums; font-weight: 600; }
.imp.newemp { background: var(--accent-soft); }
.imp select { height: 32px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0 0.4rem; background: var(--surface); }

@media (max-width: 1100px) {
  .header { flex-wrap: wrap; }
  .tabs { order: 3; margin-left: 0; width: 100%; }
  .tabs button { flex: 1; }
}
@media (max-width: 900px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .header { padding: 0.6rem 1rem; }
  .brand-text p { display: none; }
  .view { padding: 1rem; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .emp-row { grid-template-columns: 1fr 1fr; }
  .preview { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 760px) {
  .user-name { display: none; }
  .model-head { display: none; }
  .model-row { grid-template-columns: 1fr 1fr 1fr; }
  .rep { flex-direction: column; }
  .statusbar { flex-wrap: wrap; }
}
@media (max-width: 560px) {
  .tabs { overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  body.is-admin .tabs button { flex: none; }
  .grid, .grid3 { grid-template-columns: 1fr; }
  .header-actions { width: 100%; flex-wrap: wrap; }
  #empSelect { flex: 1; max-width: none; }
  #importBtn { width: 100%; justify-content: center; order: 5; }
  .kpi-value { font-size: 1.35rem; }
  .month-nav h2 { font-size: 1.125rem; }
  .month-nav select { display: none; }
}

@media print {
  @page { size: A4 portrait; margin: 11mm 12mm; }
  body { background: #fff; color: #000; font-size: 8.5pt; }
  .app, .auth, .modal-overlay, .toast, .dropzone { display: none !important; }
  #printArea { display: block !important; }
  #printArea .ppage { break-after: page; page-break-after: always; }
  #printArea .ppage:last-child { break-after: auto; page-break-after: auto; }
  #printArea h1 { font-size: 14pt; margin: 0; }
  #printArea .ph { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1.6pt solid #000; padding-bottom: 3pt; margin-bottom: 6pt; }
  #printArea small { color: #444; }
  #printArea table { width: 100%; border-collapse: collapse; }
  #printArea th, #printArea td { border-bottom: 0.4pt solid #bbb; padding: 1.6pt 4pt; text-align: left; vertical-align: top; }
  #printArea th { background: #eee; font-size: 7pt; text-transform: uppercase; }
  #printArea .num { text-align: right; white-space: nowrap; }
  #printArea .nowrap { white-space: nowrap; }
  #printArea tr.we td { color: #777; background: #f6f6f6; }
  #printArea tr.empty-day td { color: #999; }
  #printArea tfoot td { font-weight: 700; border-top: 1pt solid #000; }
  #printArea .pfoot { break-inside: avoid; }
  #printArea .sum { margin-top: 8pt; width: 58%; margin-left: auto; }
  #printArea .sum td { border-bottom: 0.4pt solid #ccc; }
  #printArea .sum tr.total td { font-weight: 700; border-top: 1.2pt solid #000; border-bottom: 0; }
  #printArea .pnote { font-size: 7.5pt; color: #555; margin: 4pt 0 0; }
  #printArea .pconf { font-size: 8pt; margin: 6pt 0 0; text-align: right; }
  #printArea .pconf.open { color: #777; }
  #printArea .sign { display: flex; gap: 30mm; margin-top: 14mm; }
  #printArea .sign div { flex: 1; border-top: 0.6pt solid #000; padding-top: 3pt; font-size: 7.5pt; color: #444; }
  #printArea tr { break-inside: avoid; }
}

/* v2.1 – Wochenend-/Feiertagsarbeit rot, Mail, Passwort vergessen */
.table tr.offday td { background: var(--neg-soft); }
.table tr.offday td:first-child { box-shadow: inset 3px 0 0 var(--neg); }
.table tr.offday td.day b, .table tr.offday td.day small { color: var(--neg); }
.form-ok { margin: 0; padding: 10px 12px; border-radius: var(--radius-md, 8px); background: var(--pos-soft, #e6f4ea); color: var(--pos); font-size: var(--text-sm); }
.auth-links { display: flex; justify-content: center; gap: 16px; margin-top: 4px; }
.inline-input { width: 220px; max-width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-md, 8px); background: var(--surface); color: var(--text); font: inherit; }
.span2 { grid-column: span 2; }
@media (max-width: 760px) { .span2 { grid-column: auto; } }
#printArea tr.offday td { background: #fbe1e1 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
#printArea tr.offday td:first-child { box-shadow: inset 3px 0 0 #c0392b; }

.check small.hint { display: block; margin-top: 2px; }

/* v2.2 – Benachrichtigung */
.sb-notify { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-left: auto; }
.nf-state { font-size: var(--text-xs); color: var(--text-muted); }
.nf-state.none, .nf-state.stale { color: var(--warn); font-weight: 600; }
.statusbar.ok .nf-state.stale { color: var(--warn); }
#notifyBtn svg { width: 15px; height: 15px; margin-right: 4px; vertical-align: -2px; }
.field.inline { display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 0.6rem; margin-bottom: 0.6rem; }
.field.inline label { margin: 0; }
.field.inline select { width: auto; }
@media (max-width: 560px) { .sb-notify { margin-left: 0; width: 100%; justify-content: space-between; } }

/* v2.2 – automatischer Abschluss */
.statusbar.closed { background: var(--abw-soft); border-color: transparent; }
.sb-ico.closed { color: var(--abw); }
.sb-text b.frist { color: var(--warn); }

/* Zweck fuer Fruehbeginn/Mehrarbeit */
button.chip { border: 0; font-family: inherit; cursor: pointer; line-height: 1.5; }
.chip.begr { white-space: normal; max-width: 340px; text-align: left; background: var(--surface-2); color: var(--text); font-weight: 500; }
.chip.begr b { font-weight: 700; }
.chip.begr.ack { background: var(--pos-soft, var(--surface-2)); }
.chip.need-begr { background: var(--neg-soft); color: var(--neg); outline: 1px dashed currentColor; outline-offset: -1px; }
button.chip:hover { filter: brightness(0.96); }
button.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ack-mark { font-size: 0.625rem; text-transform: uppercase; letter-spacing: .03em; color: var(--pos, inherit); margin-left: 4px; }
.ack-open { font-size: 0.625rem; text-transform: uppercase; letter-spacing: .03em; color: var(--neg); margin-left: 4px; }
.bg-state { font-size: var(--text-sm, .875rem); color: var(--text-muted); margin: 4px 0 10px; }
@media print { .chip.need-begr { outline: 0; } }
.chip.night { background: oklch(93% 0.03 270); color: oklch(42% 0.1 270); }
[data-theme="dark"] .chip.night { background: oklch(32% 0.05 270); color: oklch(85% 0.06 270); }

/* ================= Dashboard ================= */
#view-dashboard { display: flex; flex-direction: column; gap: 1rem; }
#view-dashboard[hidden] { display: none; }
.db-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem; align-items: start; }
.db-list { display: flex; flex-direction: column; margin-top: 0.6rem; max-height: 420px; overflow: auto; }
.db-item { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "chip who go" "chip sub go"; column-gap: 0.75rem; row-gap: 1px; align-items: center;
  text-align: left; width: 100%; padding: 0.55rem 0.4rem; border: 0; border-top: 1px solid var(--border); background: none; color: var(--text); font: inherit; cursor: pointer; border-radius: 0; }
.db-item:first-child { border-top: 0; }
.db-item:hover { background: var(--surface-2); }
.db-item.static { cursor: default; grid-template-areas: "chip who btn" "chip sub btn"; }
.db-item.static:hover { background: none; }
.db-item > .chip { grid-area: chip; justify-self: start; }
.db-item > .db-who { grid-area: who; font-size: var(--text-sm); min-width: 0; }
.db-item > .db-sub { grid-area: sub; font-size: var(--text-xs); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.db-item > .db-go { grid-area: go; color: var(--text-faint, var(--text-muted)); font-size: 1.2rem; }
.db-item > .btn { grid-area: btn; }
.db-item .chip { min-width: 0; }
.db-scroll { overflow-x: auto; margin-top: 0.6rem; }
.db-matrix td, .db-matrix th { white-space: nowrap; }
.st-cell { font: inherit; font-size: var(--text-xs); font-weight: 600; border: 0; border-radius: 6px; padding: 3px 8px; cursor: pointer; background: var(--surface-2); color: var(--text-muted); }
.st-cell:hover { outline: 2px solid var(--border-strong); }
.st-ok { background: var(--pos-soft); color: var(--pos); }
.st-warn { background: var(--warn-soft); color: var(--warn); }
.st-due { background: var(--neg-soft, var(--warn-soft)); color: var(--neg); }
.st-flagged { background: var(--neg-soft, var(--warn-soft)); color: var(--neg); }
.st-hidden { background: var(--accent-soft); color: var(--accent-strong); }
.st-archiv { background: var(--abw-soft); color: var(--abw); }
.db-fristen h4, .db-zweck h4 { margin: 1rem 0 0.3rem; font-size: var(--text-sm); }
.db-thr { font-size: var(--text-xs); color: var(--text-muted); display: inline-flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.db-thr input { width: 4.2rem; padding: 2px 6px; font: inherit; font-size: var(--text-xs); }
#dbKonten tfoot td { border-top: 2px solid var(--border-strong); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
.spark { width: 120px; height: 28px; display: block; }
.warn-t { color: var(--warn); font-weight: 700; }
.db-zweck { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.zw-row { display: grid; grid-template-columns: minmax(9rem, 14rem) 1fr 2.5rem; gap: 0.6rem; align-items: center; font-size: var(--text-xs); padding: 3px 0; }
.zw-row b { text-align: right; font-variant-numeric: tabular-nums; }
.zw-bar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.zw-bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.zw-bar i.alt { background: var(--text-muted); opacity: .5; }
.zw-bar i.none { background: var(--warn); }
tr.flash td { animation: flash 1.8s ease-out; }
@keyframes flash { 0% { background: var(--accent-soft); } 100% { background: transparent; } }
@media (max-width: 1000px) { .db-grid, .db-zweck { grid-template-columns: 1fr; } }
@media print { #view-dashboard { display: none !important; } }
.tabs button { white-space: nowrap; }
.brand { flex-shrink: 0; }
@media (max-width: 1500px) { .tabs button { padding: 0.35rem 0.6rem; } .tabs { margin-left: 0.6rem; } }
@media (max-width: 1440px) { .brand-text p { display: none; } }
.db-item.static > .db-sub { white-space: normal; }
@media (max-width: 640px) {
  .db-item { grid-template-columns: 1fr auto; grid-template-areas: "chip go" "who go" "sub go"; row-gap: 3px; }
  .db-item.static { grid-template-areas: "chip btn" "who btn" "sub btn"; }
  .db-item > .db-sub { white-space: normal; }
  .zw-row { grid-template-columns: 8rem 1fr 2rem; }
}
.db-thr input { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: 6px; }
.db-filter { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0.6rem 1rem; }
.db-filter label { display: inline-flex; align-items: center; gap: 0.4rem; font-size: var(--text-xs); font-weight: 600; color: var(--text-muted); }
.db-filter select { font: inherit; font-size: var(--text-sm); font-weight: 500; padding: 4px 8px; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: 6px; max-width: 14rem; }
#dbKontenSub { font-weight: 400; margin-left: 0.4rem; }
@media (max-width: 640px) { .db-filter label { width: 100%; justify-content: space-between; } .db-filter select { flex: 1; max-width: none; } }
.db-fnote { margin-left: auto; font-size: var(--text-xs); color: var(--text-muted); }
.db-fsaved { font-size: var(--text-xs); font-weight: 600; color: var(--pos); }
.emp-row.retired { opacity: .75; }
.emp-retired { margin-top: 0.8rem; border-top: 1px solid var(--border); padding-top: 0.6rem; }
.emp-retired summary { cursor: pointer; font-size: var(--text-sm); font-weight: 600; color: var(--text-muted); padding: 0.3rem 0; }
.emp-btns { flex-wrap: wrap; align-items: center; }
.at-list { margin: 0.8rem 0 0.4rem; padding-left: 1.1rem; font-size: var(--text-sm); color: var(--text-muted); display: grid; gap: 0.3rem; }
.at-saldo { font-size: var(--text-sm); margin: 0.6rem 0 0; }

/* ================= Klärung ================= */
.chip.kl { background: oklch(94% 0.04 300); color: oklch(42% 0.12 300); border: 0; cursor: pointer; font: inherit; font-size: 0.6875rem; font-weight: 600; padding: 1px 7px; border-radius: 999px; }
.chip.kl.answered { background: var(--pos-soft); color: var(--pos); }
[data-theme="dark"] .chip.kl { background: oklch(32% 0.06 300); color: oklch(85% 0.07 300); }
.kl-bar .nf-state.bad { color: var(--neg); }
.klr-list { display: flex; flex-direction: column; gap: 0.5rem; margin: 0.6rem 0; max-height: 60vh; overflow: auto; }
.klr-row { display: grid; grid-template-columns: 8rem 1fr 1.3fr auto; gap: 0.8rem; align-items: start; padding: 0.6rem 0.7rem; border: 1px solid var(--border); border-radius: var(--radius-md); }
.klr-day small, .klr-col small { display: block; font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; }
.klr-col { font-size: var(--text-sm); }
.klr-col .lbl { display: block; font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.klr-col.new b { color: var(--accent-strong); }
.klr-dec { display: flex; flex-direction: column; gap: 4px; font-size: var(--text-sm); }
.klu-list { display: flex; flex-direction: column; gap: 1rem; }
.klu .panel-head { margin-bottom: 0.3rem; }
.klu-day { border-top: 1px solid var(--border); padding: 0.9rem 0; display: flex; flex-direction: column; gap: 0.5rem; }
.klu-head { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.klu-raw { font-size: var(--text-sm); color: var(--text-muted); }
.klu-mode { display: flex; gap: 1.2rem; flex-wrap: wrap; font-size: var(--text-sm); }
.klu-segs { display: flex; flex-direction: column; gap: 0.4rem; }
.klu-segs .seg { display: flex; gap: 0.5rem; align-items: center; }
.klu-segs input[type=time], .klu-abw select { font: inherit; padding: 5px 8px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: var(--text); }
.klu-begr-in { background: var(--warn-soft); border-radius: var(--radius-md); padding: 0.6rem 0.8rem; font-size: var(--text-sm); display: flex; flex-direction: column; gap: 0.5rem; }
.klu-sent { font-size: var(--text-sm); }
@media (max-width: 760px) { .klr-row { grid-template-columns: 1fr; } }

/* ================= E-Mail-Vorlagen ================= */
.tpl-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0.4rem 0 1rem; }
.tpl-tab { font: inherit; font-size: var(--text-sm); padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.tpl-tab:hover { border-color: var(--border-strong); }
.tpl-tab.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tpl-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn, #c98a12); display: inline-block; }
.tpl-tab.on .tpl-dot { background: #fff; }
.tpl-form { display: flex; flex-direction: column; gap: 0.8rem; }
.tpl-form textarea { font: inherit; font-size: var(--text-sm); line-height: 1.5; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: var(--text); resize: vertical; width: 100%; box-sizing: border-box; }
.tpl-desc { margin: 0; font-size: var(--text-sm); color: var(--text-muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tpl-bs-head { font-weight: 600; font-size: var(--text-sm); margin: 0.2rem 0 0.5rem; }
.tpl-bs-head .hint { font-weight: 400; }
#tplBausteine { display: flex; flex-direction: column; gap: 0.6rem; border-left: 3px solid var(--border); padding-left: 0.8rem; }
#tplBausteine:empty { display: none; }
#tplBausteine label code, .tpl-var { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.75rem; }
.tpl-vars { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tpl-vars .lbl, .tpl-prev-head .lbl { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
#tplVars { display: contents; }
.tpl-var { border: 1px solid var(--border); background: var(--surface-2, var(--bg)); color: var(--text); cursor: pointer; padding: 2px 8px; border-radius: 999px; }
.tpl-var:hover { border-color: var(--accent); color: var(--accent-strong); }
.tpl-var.bs { border-style: dashed; }
.tpl-preview { margin-top: 1.2rem; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.tpl-prev-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2, var(--bg)); }
.tpl-subj { font-weight: 600; font-size: var(--text-sm); }
#tplFrame { width: 100%; height: 620px; border: 0; background: #f3f6f8; display: block; }
.tpl-bs-lbl { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.tpl-bs-lbl .check.small { font-size: var(--text-xs); color: var(--text-muted); white-space: nowrap; }
/* Einstellungen: Spalte nie breiter als der Bildschirm */
#view-einstellungen { grid-template-columns: minmax(0, 1fr); }
#view-einstellungen > * { min-width: 0; }
@media (max-width: 640px) { .user-row { flex-wrap: wrap; } .user-info { min-width: 0; } }
#view-einstellungen .modal-actions { flex-wrap: wrap; }
.tpl-form .field input:not([type=checkbox]) { box-sizing: border-box; width: 100%; max-width: 100%; }
.ver-bar { max-width: 1200px; margin: 0.8rem auto 0; width: calc(100% - 2rem); box-sizing: border-box; }
