/* Zeiterfassung – Farben als Tokens; Hell/Dunkel über prefers-color-scheme oder data-theme. */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fa;
  --border: #e3e5e9;
  --border-strong: #cfd3d9;
  --text: #191c21;
  --muted: #687080;
  --accent: #a3192e;
  --accent-hover: #8a1426;
  --accent-soft: #fbeef0;
  --on-accent: #ffffff;
  --ok: #1d7a3e;
  --ok-soft: #e7f5ec;
  --warn: #9a6400;
  --warn-soft: #fdf3dc;
  --danger: #c0352b;
  --danger-soft: #fdecea;
  --input: #ffffff;
  --side: #1d2027;
  --side-2: #262a33;
  --side-text: #c9ced8;
  --side-muted: #8a91a0;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 20px 48px rgba(16, 24, 40, 0.18);
  --radius: 10px;
  --radius-sm: 7px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121418;
    --surface: #1b1e24;
    --surface-2: #20242b;
    --border: #2c313a;
    --border-strong: #3b414c;
    --text: #e7e9ee;
    --muted: #9aa1ae;
    --accent: #e25a6e;
    --accent-hover: #ec7586;
    --accent-soft: #35202a;
    --on-accent: #ffffff;
    --ok: #5cc581;
    --ok-soft: #173023;
    --warn: #e0b354;
    --warn-soft: #352b14;
    --danger: #f2837a;
    --danger-soft: #3a1f1d;
    --input: #15181d;
    --side: #0e1013;
    --side-2: #1b1e24;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121418;
  --surface: #1b1e24;
  --surface-2: #20242b;
  --border: #2c313a;
  --border-strong: #3b414c;
  --text: #e7e9ee;
  --muted: #9aa1ae;
  --accent: #e25a6e;
  --accent-hover: #ec7586;
  --accent-soft: #35202a;
  --on-accent: #ffffff;
  --ok: #5cc581;
  --ok-soft: #173023;
  --warn: #e0b354;
  --warn-soft: #352b14;
  --danger: #f2837a;
  --danger-soft: #3a1f1d;
  --input: #15181d;
  --side: #0e1013;
  --side-2: #1b1e24;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
.sprite { position: absolute; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
h1, h2 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 24px; font-weight: 600; }
h2 { font-size: 16px; font-weight: 600; }
code { font-family: "Cascadia Mono", Consolas, ui-monospace, monospace; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ms-logo { width: 18px; height: 18px; flex: none; }

/* --- Formularfelder --- */
label { display: block; margin-bottom: 14px; font-size: 13px; font-weight: 500; }
input, select {
  display: block;
  width: 100%;
  height: 40px;
  margin-top: 6px;
  padding: 0 12px;
  font: inherit;
  color: var(--text);
  background: var(--input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.12s, box-shadow 0.12s;
}
input::placeholder { color: var(--muted); opacity: 0.7; }
input:hover, select:hover { border-color: var(--muted); }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label.check { display: flex; align-items: center; gap: 10px; font-weight: 400; }
label.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.msg { min-height: 0; margin: 0 0 12px; color: var(--danger); font-size: 13px; }
.msg:empty { display: none; }
.msg.ok { color: var(--ok); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn.primary { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.small .i { width: 16px; height: 16px; }
.btn.block { width: 100%; }
.btn.danger { color: var(--danger); }
.btn.primary.danger-fill { color: #fff; background: var(--danger); border-color: var(--danger); }
.btn.primary.danger-fill:hover { background: color-mix(in srgb, var(--danger) 85%, #000); }
.btn.sso { height: 46px; font-weight: 600; background: var(--surface); }
button:focus-visible, a:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.linkish { padding: 0; font: inherit; color: var(--accent); background: none; border: 0; cursor: pointer; }
.linkish:hover { text-decoration: underline; }

/* --- Pillen / Avatare --- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; font-size: 12px; font-weight: 600; border-radius: 99px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.pill.ok { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.pill.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.pill.danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.pill.accent { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.live .dot { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none; font-size: 13px; font-weight: 700; color: #fff; border-radius: 50%; background: var(--avatar, #6b7280); }
.avatar.xl { width: 64px; height: 64px; font-size: 22px; }
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person-text { min-width: 0; }
.person-text strong { display: block; font-weight: 600; }
.person-text small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }

/* --- Anmeldung --- */
.auth { display: grid; grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.1fr); min-height: 100vh; }
.auth-brand { display: flex; flex-direction: column; justify-content: space-between; padding: 40px 48px; color: #f3f4f6; background: var(--side); }
.auth-brand .logo { color: #fff; }
.auth-claim h2 { font-size: 30px; font-weight: 600; line-height: 1.25; letter-spacing: -0.02em; margin-bottom: 28px; }
.auth-claim ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; color: #c9ced8; }
.auth-claim li { display: flex; align-items: center; gap: 12px; }
.auth-claim li .i { width: 22px; height: 22px; padding: 3px; color: #fff; background: var(--accent); border-radius: 50%; stroke-width: 2.4; }
.auth-legal { margin: 0; color: #8a91a0; font-size: 12px; }
.auth-main { position: relative; display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { margin-bottom: 6px; }
.auth-card .lead { margin: 0 0 24px; color: var(--muted); }
.auth-main > .theme-toggle { position: absolute; top: 16px; right: 16px; color: var(--muted); }
#restart { display: block; margin: 20px auto 0; font-size: 13px; }
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
#pw-login { margin-top: 16px; }
.step-badge { display: inline-block; margin-bottom: 12px; padding: 3px 10px; font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 99px; }
.setup-steps { list-style: none; counter-reset: s; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.setup-steps li { counter-increment: s; display: grid; grid-template-columns: 26px 1fr; column-gap: 10px; }
.setup-steps li::before { content: counter(s); grid-row: span 2; display: grid; place-items: center; width: 26px; height: 26px; font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 50%; }
.setup-steps span { color: var(--muted); font-size: 13px; }
.qr-box { display: grid; justify-items: center; gap: 10px; margin-bottom: 18px; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.qr { width: 176px; height: 176px; background: #fff; border-radius: 6px; }
.manual { width: 100%; font-size: 13px; text-align: center; }
.manual summary { color: var(--accent); cursor: pointer; }
.key { display: block; margin-top: 8px; padding: 8px; font-size: 14px; letter-spacing: 0.06em; background: var(--surface-2); border-radius: 6px; user-select: all; overflow-wrap: anywhere; }
input.otp { height: 56px; margin-bottom: 16px; font-size: 26px; font-weight: 600; letter-spacing: 0.5em; text-align: center; font-variant-numeric: tabular-nums; padding-left: 0.5em; }
label input.otp { margin-bottom: 0; }
.totp-icon { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 16px; color: var(--accent); background: var(--accent-soft); border-radius: 14px; }
.totp-icon .i { width: 26px; height: 26px; }

/* --- Rahmen der Anwendung --- */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 20px 12px 12px; color: var(--side-text); background: var(--side); }
.logo { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.sidebar .logo { padding: 0 8px 20px; color: #fff; }
.logo-mark { display: grid; place-items: center; width: 32px; height: 32px; color: #fff; background: var(--accent); border-radius: 8px; }
.logo-mark .i { stroke-width: 2.2; }
#tabs { display: flex; flex-direction: column; gap: 2px; flex: 1; }
#tabs button { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; font: inherit; color: var(--side-text); text-align: left; background: none; border: 0; border-radius: var(--radius-sm); cursor: pointer; }
#tabs button:hover { color: #fff; background: var(--side-2); }
#tabs button.active { color: #fff; background: var(--side-2); box-shadow: inset 3px 0 0 var(--accent); }
.nav-label { padding: 18px 12px 6px; color: var(--side-muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.sidebar-foot { display: flex; align-items: center; gap: 4px; padding-top: 12px; border-top: 1px solid var(--side-2); }
.sidebar-foot .icon-btn { color: var(--side-muted); }
.sidebar-foot .icon-btn:hover { color: #fff; background: var(--side-2); }
.me { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 4px; }
.me-text { min-width: 0; line-height: 1.25; }
.me-text strong { display: block; color: #fff; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text small { color: var(--side-muted); font-size: 12px; }
.workspace { min-width: 0; padding: 32px 40px 64px; }
.tab { max-width: 1120px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.head-actions select { width: auto; min-width: 200px; margin: 0; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 20px; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.period { display: inline-flex; align-items: center; gap: 4px; }
.period strong { min-width: 130px; text-align: center; }
.period .icon-btn { color: var(--muted); }

/* --- Dashboard --- */
.dash { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.dash:has(#clock[hidden]) { grid-template-columns: 1fr; }
.clock { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 24px; }
.clock.running { border-color: color-mix(in srgb, var(--ok) 35%, var(--border)); }
.timer { margin: 10px 0 2px; font-size: 40px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.clock-btn { height: 52px; padding: 0 26px; font-size: 15px; border-radius: 26px; color: #fff; background: var(--ok); border-color: var(--ok); }
.clock-btn:hover { background: color-mix(in srgb, var(--ok) 85%, #000); }
.clock-btn.stop { background: var(--danger); border-color: var(--danger); }
.clock-btn.stop:hover { background: color-mix(in srgb, var(--danger) 85%, #000); }
.clock-btn .i { fill: currentColor; stroke: none; }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.dash:has(#clock[hidden]) .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi { display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 20px; }
.kpi-label { color: var(--muted); font-size: 13px; }
.kpi-value { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

/* --- Tabellen --- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { padding: 10px 16px; font-size: 12px; font-weight: 600; text-align: left; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table .act { width: 1%; white-space: nowrap; text-align: right; }
.table tfoot td { font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 0; }
.table tr.week td { padding-top: 8px; padding-bottom: 8px; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--bg); }
.table tr.clickable { cursor: pointer; }
.table td.empty { padding: 48px 16px; text-align: center; color: var(--muted); }
.table td.details { max-width: 340px; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.date-cell strong { display: block; font-weight: 600; }
.date-cell small { color: var(--muted); font-size: 12px; }
.row-actions { display: inline-flex; gap: 2px; }
.row-actions .icon-btn { width: 32px; height: 32px; color: var(--muted); }
.row-actions .icon-btn:hover { color: var(--text); }
.row-actions .icon-btn.del:hover { color: var(--danger); background: var(--danger-soft); }
.bar { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.bar-track { flex: 1; height: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 99px; }
.bar span { width: 64px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* --- Mein Konto --- */
.account-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.account-grid .card + .card { margin-top: 0; }
.account-grid h2 { margin-bottom: 14px; }
.profile { display: flex; align-items: center; gap: 18px; }
.profile h2 { margin-bottom: 0; font-size: 20px; }
.profile .pill { margin-top: 8px; }
.sec-list { list-style: none; margin: 0 0 12px; padding: 0; }
.sec-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.sec-list li span:nth-child(2) { flex: 1; }
.sec-list .i { color: var(--muted); }
.segmented { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; }
.segmented button { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; font: inherit; font-size: 13px; font-weight: 500; color: var(--muted); background: none; border: 0; border-radius: 7px; cursor: pointer; }
.segmented button .i { width: 16px; height: 16px; }
.segmented button.active { color: var(--text); background: var(--surface); box-shadow: var(--shadow); }

/* --- Dialoge / Meldungen --- */
.dialog { width: min(480px, calc(100vw - 32px)); padding: 0; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); }
.dialog.small { width: min(400px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(10, 12, 16, 0.5); }
.dialog header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 0; }
.dialog header .icon-btn { color: var(--muted); margin: -6px -8px -6px 0; }
.dialog-body { padding: 16px 20px 4px; }
.dialog-body > .sub:first-child { margin: -8px 0 14px; }
.dialog footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 20px; }
.user-tools { margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--border); }
.tool-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.secret { display: block; margin: 12px 0; padding: 14px; font-size: 22px; letter-spacing: 0.08em; text-align: center; background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 8px; user-select: all; }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: grid; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 240px; max-width: 380px; padding: 12px 16px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--ok); border-radius: 8px; box-shadow: var(--shadow-lg); animation: toast-in 0.18s ease-out; }
.toast.error { border-left-color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* --- Schmale Bildschirme --- */
@media (max-width: 1000px) {
  .dash { grid-template-columns: 1fr; }
  .account-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: 20px 24px; }
  .auth-claim, .auth-legal { display: none; }
  .auth-main { align-items: flex-start; padding: 32px 16px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; }
  .sidebar .logo { padding: 0 8px; flex: 1; }
  .sidebar-foot { padding: 0; border: 0; }
  .me { display: none; }
  #tabs { order: 3; flex: 0 0 100%; flex-direction: row; overflow-x: auto; margin-top: 8px; }
  #tabs button { flex: none; height: 36px; }
  #tabs button.active { box-shadow: inset 0 -2px 0 var(--accent); }
  .nav-label { display: none; }
  .workspace { padding: 20px 16px 48px; }
  .page-head { align-items: flex-start; }
  .head-actions, .head-actions select { width: 100%; }
  .head-actions .btn { flex: 1; }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 18px; }
  .clock { flex-direction: column; align-items: stretch; }
  .clock-btn { width: 100%; }
  .timer { font-size: 34px; }
  .table th, .table td { padding: 10px 12px; }
  .two { grid-template-columns: 1fr; }
}
