/* Zeiterfassung: Grundstil. Hell/dunkel per prefers-color-scheme, Touch-Ziele >= 44px, Safe-Area. Funktions-Module bringen ihr eigenes CSS mit (css/<name>.css). */
:root {
  --bg: #f3f5f4; --surface: #ffffff; --surface-2: #eaeeed; --text: #18211f; --muted: #525e5b; --line: #d5dbd9;
  --accent: #0b5e59; --accent-ink: #ffffff; --accent-soft: #d9efec;
  --ok: #17602f; --ok-bg: #dff1e5; --warn: #7a4e00; --warn-bg: #fcefcf; --err: #9c1f25; --err-bg: #fae0e0; --info: #1d4f8a; --info-bg: #dfeaf7;
  --radius: 12px; --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 14px rgba(0, 0, 0, .06);
  --nav-w: 92px; --nav-h: 62px;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1413; --surface: #182120; --surface-2: #212c2a; --text: #e8efed; --muted: #a2b2ae; --line: #2f3c39;
    --accent: #5cd0c6; --accent-ink: #03201d; --accent-soft: #163a37;
    --ok: #7fdc9f; --ok-bg: #153625; --warn: #f2c66b; --warn-bg: #3a2d10; --err: #ff9fa0; --err-bg: #43191c; --info: #8bbcf5; --info-bg: #172a43;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); overscroll-behavior: none; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; padding: var(--sat) var(--sar) 0 var(--sal); height: 100dvh; }
h1 { font-size: 1.3rem; margin: 0; line-height: 1.2; } h2 { font-size: 1.15rem; margin: 0; } h3 { font-size: 1rem; margin: 0 0 .5rem; }
p { margin: .25rem 0; }
a { color: var(--accent); }
.muted { color: var(--muted); } .small { font-size: .85rem; } .strong { font-weight: 700; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* Rahmen */
#shell { height: 100%; display: flex; flex-direction: column-reverse; }
#view { flex: 1 1 auto; min-height: 0; overflow: auto; outline: none; -webkit-overflow-scrolling: touch; }
.nav { display: flex; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: var(--sab); flex: 0 0 auto; }
.nav-brand { display: none; }
.nav-i { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: var(--nav-h); color: var(--muted); text-decoration: none; font-size: .75rem; min-width: 0; }
.nav-i[aria-current="page"] { color: var(--accent); font-weight: 700; box-shadow: inset 0 3px 0 var(--accent); }
.nav-i > span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 480px) { .nav-i { font-size: .66rem; } }
@media (max-width: 767px) { .nav { overflow-x: auto; scrollbar-width: none; } .nav::-webkit-scrollbar { display: none; } .nav-i { flex: 1 0 64px; padding: 0 4px; } }
body[data-mode="auth"] .nav { display: none; }
body[data-mode="auth"] #shell { flex-direction: column; }
@media (min-width: 900px) {
  #shell { flex-direction: row; }
  .nav { flex-direction: column; width: var(--nav-w); border-top: 0; border-right: 1px solid var(--line); padding: 8px 0; }
  .nav-brand { display: flex; justify-content: center; padding: 8px 4px 12px; font-weight: 700; font-size: .7rem; text-align: center; overflow-wrap: anywhere; color: var(--accent); }
  .nav-i { flex: 0 0 auto; width: 100%; min-height: 68px; box-shadow: none !important; }
  .nav-i[aria-current="page"] { background: var(--accent-soft); box-shadow: inset 4px 0 0 var(--accent) !important; }
}
.page { padding: 14px 16px calc(96px + var(--sab)); max-width: 1100px; margin: 0 auto; }
.page-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.page-head .ph-t { flex: 1; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.page > .card { margin-bottom: 12px; }
.ph-row { display: flex; align-items: center; gap: 8px; } .ph-row.wrap, .row-actions.wrap { flex-wrap: wrap; }
.row-actions { display: flex; gap: 10px; align-items: center; margin: 10px 0; }
.banner-inline { padding: 8px 12px; border-radius: 8px; margin: 8px 0; background: var(--info-bg); color: var(--info); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.banner-inline > span { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.banner-inline.warn { background: var(--warn-bg); color: var(--warn); } .banner-inline.err { background: var(--err-bg); color: var(--err); }
.empty { text-align: center; padding: 40px 20px; }

/* Bedienelemente */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; min-width: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; touch-action: manipulation; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--err); color: #fff; border-color: var(--err); }
.btn.small { padding: 0 12px; font-size: .9rem; }
.btn.block { width: 100%; }
.btn.big-btn { min-height: 52px; padding: 0 22px; font-size: 1.05rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; min-height: 44px; padding: 0 6px; }
.link.danger { color: var(--err); }
.input { width: 100%; min-height: 44px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; max-width: 100%; min-width: 0; }
input[type="date"], input[type="time"] { -webkit-appearance: none; appearance: none; display: block; text-align: left; line-height: 1.2; }
input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--accent); }
.form-err { color: var(--err); font-weight: 600; margin: 6px 0; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--surface-2); color: var(--text); white-space: nowrap; min-height: 24px; }
.chip.ok { background: var(--ok-bg); color: var(--ok); } .chip.warn { background: var(--warn-bg); color: var(--warn); } .chip.err { background: var(--err-bg); color: var(--err); }
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; } .tbl th, .tbl td { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; } .tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

/* Dialog und Hinweise */
dialog.modal { border: 0; padding: 0; background: transparent; max-width: 94vw; width: 480px; color: var(--text); }
dialog.modal.wide { width: 640px; }
dialog.modal::backdrop { background: rgba(0, 0, 0, .5); }
.modal-box { background: var(--surface); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; max-height: 90dvh; overflow: hidden; }
.modal-box .modal-body { overflow-y: auto; min-height: 0; flex: 1 1 auto; padding-bottom: 4px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex: none; padding-top: 10px; margin-top: 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--sab) + 12px); display: grid; justify-items: center; gap: 8px; z-index: 50; pointer-events: none; padding: 0 12px; }
.toast { pointer-events: auto; display: flex; gap: 12px; align-items: center; background: #1f2927; color: #fff; padding: 10px 16px; border-radius: 12px; box-shadow: 0 6px 20px rgba(0, 0, 0, .3); max-width: 560px; font-weight: 600; }
.toast.ok { background: #14532d; } .toast.warn { background: #6b4300; } .toast.err { background: #8e1c22; }
@media (min-width: 900px) { .toasts { bottom: 16px; } }

/* Anmeldung */
.auth { max-width: 380px; margin: 0 auto; padding: 48px 16px; }
.auth h1 { margin-bottom: 4px; }
.auth form { display: grid; gap: 12px; margin-top: 18px; }
.auth label { display: grid; gap: 4px; }
.auth label > span { font-size: .85rem; color: var(--muted); }
.langsw { display: flex; gap: 6px; justify-content: flex-end; margin: 8px 0; }
