/* Zeiterfassung – Mobile first */
:root {
  --bg: #f4f4f1;
  --surface: #ffffff;
  --surface-2: #ececE8;
  --text: #18191b;
  --muted: #6c7076;
  --faint: #a3a7ac;
  --line: #e2e2dd;
  --acc: #1d7a53;          /* läuft / Hauptaktion */
  --acc-soft: #dcefe5;
  --on-acc: #ffffff;
  --pause: #b86e12;
  --pause-soft: #f8ead6;
  --plus: #1d7a53;
  --minus: #b5332b;
  --minus-soft: #f7e1df;
  --holiday: #6a55c2;
  --absence: #2f6db5;
  --weekend: #f0f0ec;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 24px rgba(0,0,0,.05);
  --radius: 18px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111213; --surface: #1b1c1e; --surface-2: #26282b; --text: #ececea; --muted: #9b9fa5;
    --faint: #6a6e74; --line: #2b2d30; --acc: #4cc38a; --acc-soft: #183527; --on-acc: #0b2318; --pause: #f0a445;
    --pause-soft: #3a2a14; --plus: #4cc38a; --minus: #ff7d73; --minus-soft: #3d1d1b; --holiday: #a593f5;
    --absence: #6ea8ef; --weekend: #17181a; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111213; --surface: #1b1c1e; --surface-2: #26282b; --text: #ececea; --muted: #9b9fa5;
  --faint: #6a6e74; --line: #2b2d30; --acc: #4cc38a; --acc-soft: #183527; --on-acc: #0b2318; --pause: #f0a445;
  --pause-soft: #3a2a14; --plus: #4cc38a; --minus: #ff7d73; --minus-soft: #3d1d1b; --holiday: #a593f5;
  --absence: #6ea8ef; --weekend: #17181a; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.plus { color: var(--plus); } .minus { color: var(--minus); }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */
#app { min-height: 100%; }
.shell { min-height: 100vh; }
.view {
  max-width: 720px; margin: 0 auto;
  padding: calc(16px + var(--safe-t)) 16px calc(var(--nav-h) + var(--safe-b) + 24px);
}
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 16px; min-height: 40px; }
.view-head h1 { font-size: 28px; line-height: 1.1; margin: 0; letter-spacing: -.02em; }
.view-head .sub { color: var(--muted); font-size: 15px; margin-top: 2px; }

nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
nav.tabs a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 11.5px; font-weight: 600;
}
nav.tabs a svg { width: 24px; height: 24px; }
nav.tabs a.active { color: var(--acc); }
nav.tabs .brand { display: none; }

@media (min-width: 900px) {
  nav.tabs {
    top: 0; right: auto; width: 220px; height: auto; padding: 24px 12px;
    grid-template-columns: 1fr; grid-auto-rows: min-content; gap: 4px;
    border-top: 0; border-right: 1px solid var(--line); background: var(--surface);
  }
  nav.tabs .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; padding: 4px 12px 20px; }
  nav.tabs .brand img { width: 30px; height: 30px; border-radius: 8px; }
  nav.tabs a { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 12px; border-radius: 10px; font-size: 15px; }
  nav.tabs a.active { background: var(--acc-soft); }
  .view { padding: 32px 32px 48px; margin-left: calc(220px + max(0px, (100vw - 220px - 720px) / 2)); margin-right: 0; }
}

/* ---------- Karten & Listen ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }
.card + .card, .card + .section-title, .stack > * + * { margin-top: 12px; }
.card.pad { padding: 16px; }
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 24px 4px 8px; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.stats > div { background: var(--surface); padding: 12px 14px; }
.stats .k { font-size: 13px; color: var(--muted); }
.stats .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
@media (min-width: 600px) { .stats.three { grid-template-columns: repeat(3, 1fr); } }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 52px; }
.list > li + li { border-top: 1px solid var(--line); }
.list > li.tap { cursor: pointer; }
.list > li.tap:active { background: var(--surface-2); }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; }
.list .meta { font-size: 13px; color: var(--muted); }
.list .right { text-align: right; font-variant-numeric: tabular-nums; }
.chev { color: var(--faint); flex: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 650; text-decoration: none; color: var(--text);
}
.btn:active { transform: scale(.98); }
.btn.block { display: flex; width: 100%; }
.btn.primary { background: var(--acc); border-color: var(--acc); color: var(--on-acc); }
.btn.dark { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn.pause { background: var(--pause-soft); border-color: transparent; color: var(--pause); }
.btn.danger { color: var(--minus); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--acc); padding: 0 8px; min-height: 40px; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.icon { width: 40px; min-height: 40px; padding: 0; border-radius: 12px; }
.btn svg { width: 20px; height: 20px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.huge { min-height: 76px; font-size: 20px; letter-spacing: .04em; border-radius: 22px; width: 100%; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- Heute ---------- */
.clock-card { padding: 20px 16px 16px; text-align: center; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 99px; font-size: 14px; font-weight: 650; background: var(--surface-2); color: var(--muted); }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.run { background: var(--acc-soft); color: var(--acc); }
.pill.run .dot { animation: pulse 2s ease-in-out infinite; }
.pill.pause { background: var(--pause-soft); color: var(--pause); }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .pill.run .dot { animation: none; } }
.big-time { font-size: clamp(56px, 18vw, 84px); font-weight: 700; letter-spacing: -.04em; line-height: 1.05; margin: 14px 0 2px; font-variant-numeric: tabular-nums; }
.big-time.idle { color: var(--faint); }
.big-time.pausing { color: var(--pause); }
.big-label { color: var(--muted); font-size: 15px; min-height: 22px; }
.remaining { margin-top: 6px; font-size: 15px; font-weight: 600; }
.clock-actions { margin-top: 18px; display: grid; gap: 10px; }
.link-row { text-align: center; margin-top: 8px; }

.banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--minus-soft); color: var(--minus); margin-bottom: 12px; font-weight: 600; font-size: 15px; }
.banner.warn { background: var(--pause-soft); color: var(--pause); }
.banner .grow { flex: 1; }
.banner .btn { color: inherit; border-color: currentColor; background: transparent; }

/* ---------- Segmented ---------- */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 8px 6px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--muted); min-height: 36px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.period-nav { display: flex; align-items: center; justify-content: space-between; margin: 14px 0 12px; gap: 8px; }
.period-nav .label { font-weight: 700; font-size: 18px; text-align: center; flex: 1; }
.period-nav .label small { display: block; font-weight: 500; font-size: 13px; color: var(--muted); }

/* ---------- Kalender Monat ---------- */
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.month-grid .wd { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal-day {
  position: relative; aspect-ratio: 1 / 1.15; border-radius: 12px; border: 1px solid transparent;
  background: var(--surface); padding: 5px 4px; display: flex; flex-direction: column; align-items: center;
  font-size: 11px; line-height: 1.15; cursor: pointer; overflow: hidden; text-align: center;
}
.cal-day.we { background: var(--weekend); }
.cal-day.empty { background: transparent; cursor: default; }
.cal-day .n { font-size: 15px; font-weight: 700; margin-bottom: auto; }
.cal-day.today { border-color: var(--acc); box-shadow: inset 0 0 0 1px var(--acc); }
.cal-day.today .n { color: var(--acc); }
.cal-day .h { font-weight: 650; font-variant-numeric: tabular-nums; }
.cal-day .s { font-variant-numeric: tabular-nums; font-size: 10.5px; }
.cal-day .tag { font-size: 10px; font-weight: 700; color: var(--absence); }
.cal-day .tag.hol { color: var(--holiday); }
.cal-day .flag { position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--minus); }
.cal-day .flag.run { background: var(--acc); }
@media (min-width: 600px) { .cal-day { font-size: 12.5px; aspect-ratio: 1 / .9; padding: 6px; } .cal-day .s { font-size: 12px; } }

/* ---------- Kalender Jahr ---------- */
.year-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 600px) { .year-grid { grid-template-columns: repeat(3, 1fr); } }
.mini { padding: 10px; }
.mini-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; cursor: pointer; }
.mini-head b { font-size: 14px; }
.mini-head span { font-size: 11.5px; font-variant-numeric: tabular-nums; }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.mini-grid i { aspect-ratio: 1; border-radius: 4px; background: var(--surface-2); font-style: normal; font-size: 9px; display: flex; align-items: center; justify-content: center; color: var(--faint); cursor: pointer; }
.mini-grid i.e { background: transparent; cursor: default; }
.mini-grid i.w { background: var(--acc); color: #fff; }
.mini-grid i.w.lo { background: color-mix(in srgb, var(--acc) 45%, var(--surface-2)); }
.mini-grid i.a { background: var(--absence); color: #fff; }
.mini-grid i.hol { box-shadow: inset 0 0 0 1.5px var(--holiday); }
.mini-grid i.t { outline: 2px solid var(--text); outline-offset: 0; }
.mini-foot { font-size: 11.5px; color: var(--muted); margin-top: 6px; display: flex; justify-content: space-between; }

/* ---------- Woche / Tagesliste ---------- */
.day-row .d { width: 46px; flex: none; text-align: center; }
.day-row .d b { display: block; font-size: 18px; line-height: 1; }
.day-row .d span { font-size: 12px; color: var(--muted); font-weight: 600; }
.day-row.today .d b { color: var(--acc); }
.day-row.off { color: var(--faint); }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 140px; padding: 16px 16px 0; position: relative; }
.bars .bar { flex: 1; position: relative; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bars .bar i { width: 100%; max-width: 40px; border-radius: 8px 8px 3px 3px; background: var(--acc); min-height: 2px; }
.bars .bar i.under { background: color-mix(in srgb, var(--acc) 45%, var(--surface-2)); }
.bars .bar .tl { position: absolute; left: 6%; right: 6%; height: 2px; border-radius: 1px; background: var(--text); opacity: .4; }
.bars-labels { display: flex; gap: 8px; padding: 8px 16px 14px; }
.bars-labels span { flex: 1; text-align: center; font-size: 12px; color: var(--muted); font-weight: 650; line-height: 1.3; }
.bars-labels small { font-weight: 500; font-variant-numeric: tabular-nums; font-size: 11px; }

/* ---------- Tabelle (Desktop-Auswertung) ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.tbl th, table.tbl td { padding: 9px 10px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.tbl th:first-child, table.tbl td:first-child { text-align: left; }
table.tbl td.note { text-align: left; color: var(--muted); white-space: normal; max-width: 200px; }
table.tbl th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
table.tbl tr.off td { color: var(--faint); }
table.tbl tr.tap { cursor: pointer; }
table.tbl tr.tap:hover td { background: var(--surface-2); }
.only-desktop { display: none; }
@media (min-width: 760px) { .only-desktop { display: block; } .only-mobile { display: none; } }

/* ---------- Formulare ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg); font-size: 16px; outline: none; appearance: none; -webkit-appearance: none;
}
select.input { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.input:focus { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); transition: background .15s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + i { background: var(--acc); border-color: var(--acc); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { box-shadow: 0 0 0 3px var(--acc-soft); }

.sched-row { display: flex; align-items: center; gap: 12px; }
.sched-row .wdn { width: 92px; font-weight: 600; }
.sched-row input.input { width: 96px; min-height: 40px; text-align: center; padding: 6px; }
.sched-row.off .wdn, .sched-row.off input { opacity: .45; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 6px 12px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.chip.on { background: var(--acc-soft); border-color: transparent; color: var(--acc); }

/* Arbeitsblöcke im Editor */
.blk { display: grid; grid-template-columns: 1fr auto 1fr 40px; align-items: center; gap: 8px; margin-bottom: 8px; }
.blk .sep { color: var(--muted); }
.timebtn { min-height: 52px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.timebtn.empty { color: var(--faint); font-size: 15px; font-weight: 600; }
.timebtn small { display: block; font-size: 11px; font-weight: 600; color: var(--pause); margin-top: -2px; }
.gap-note { font-size: 12.5px; color: var(--muted); text-align: center; margin: -2px 0 8px; }
.preview { display: flex; justify-content: space-around; padding: 10px; background: var(--surface-2); border-radius: 12px; font-size: 14px; text-align: center; margin: 4px 0 16px; }
.preview b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }

/* ---------- Bottom Sheet ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.38); opacity: 0; transition: opacity .2s; }
.overlay.show { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; max-height: 92vh; overflow-y: auto;
  background: var(--surface); border-radius: 22px 22px 0 0; padding: 8px 16px calc(20px + var(--safe-b));
  transform: translateY(100%); transition: transform .24s cubic-bezier(.2,.8,.2,1);
  overscroll-behavior: contain;
}
.sheet.show { transform: none; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 10px; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sheet-head h2 { font-size: 21px; margin: 0; line-height: 1.2; }
.sheet-head .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
@media (min-width: 760px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: 480px; max-height: 86vh; border-radius: 22px; padding: 18px 22px 22px;
    transform: translate(-50%, -46%); opacity: 0; transition: transform .2s, opacity .2s; }
  .sheet.show { transform: translate(-50%, -50%); opacity: 1; }
  .sheet .grab { display: none; }
}
@media (prefers-reduced-motion: reduce) { .sheet, .overlay { transition: none; } }

.kv { list-style: none; margin: 0 0 16px; padding: 0; }
.kv li { display: flex; justify-content: space-between; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.kv li span:last-child { font-weight: 650; font-variant-numeric: tabular-nums; }
.kv li.strong span { font-weight: 750; }

/* Zeitauswahl: Drehrad */
.wheel-wrap { position: relative; display: flex; justify-content: center; gap: 4px; height: 220px; margin: 8px 0 12px; user-select: none; }
.wheel-wrap::before { content: ""; position: absolute; left: 12%; right: 12%; top: 88px; height: 44px; border-radius: 12px; background: var(--surface-2); z-index: 0; }
.wheel-wrap::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: linear-gradient(var(--surface) 0%, transparent 32%, transparent 68%, var(--surface) 100%); }
.wheel { position: relative; z-index: 1; width: 90px; height: 220px; overflow-y: scroll; scroll-snap-type: y mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.wheel::-webkit-scrollbar { display: none; }
.wheel div { height: 44px; display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 650; scroll-snap-align: center; font-variant-numeric: tabular-nums; }
.wheel .pad { scroll-snap-align: none; }
.wheel-colon { position: relative; z-index: 1; align-self: center; font-size: 26px; font-weight: 700; }
.numpad-input { font-size: 40px !important; text-align: center; font-weight: 700; letter-spacing: .04em; font-variant-numeric: tabular-nums; min-height: 72px !important; }
.numpad-hint { text-align: center; color: var(--muted); font-size: 14px; margin: 8px 0 14px; min-height: 20px; }

/* ---------- Login ---------- */
.login { max-width: 400px; margin: 0 auto; padding: calc(56px + var(--safe-t)) 20px 40px; }
.login .logo { width: 72px; height: 72px; border-radius: 18px; display: block; margin: 0 auto 16px; }
.login h1 { text-align: center; margin: 0 0 4px; font-size: 26px; }
.login p { text-align: center; color: var(--muted); margin: 0 0 28px; }
.err-msg { color: var(--minus); background: var(--minus-soft); border-radius: 12px; padding: 10px 12px; margin-bottom: 14px; font-size: 15px; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); transform: translate(-50%, 20px); z-index: 80;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 15px; font-weight: 600;
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; max-width: calc(100vw - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--minus); color: #fff; }

.empty-state { text-align: center; color: var(--muted); padding: 28px 16px; }
.loading { text-align: center; color: var(--faint); padding: 40px 0; }
.foot-note { text-align: center; color: var(--faint); font-size: 13px; margin-top: 24px; }
