/* Zeiterfassung – Gestaltung (mobil zuerst) */
:root {
  --bg: #f3f2ee; --card: #ffffff; --ink: #1b1d1c; --muted: #6b706c; --line: #e3e1db; --soft: #efede7;
  --acc: #0e6b5c; --acc-2: #0b5a4d; --acc-ink: #ffffff; --acc-soft: #dff0eb;
  --pos: #137a48; --neg: #b3261e; --warn-bg: #fdf0e6; --warn-ink: #8a3b00;
  --t-arbeit: #0e6b5c; --t-urlaub: #c77c00; --t-urlaub_halb: #d99a2b; --t-krank: #c2185b; --t-gleittag: #6d4bc9;
  --t-sonder: #2f6fb3; --t-unbezahlt: #7a7f7c; --t-hol: #2f6fb3; --t-missing: #b3261e;
  --r: 16px; --shadow: 0 1px 2px rgba(20, 30, 25, .05), 0 6px 20px rgba(20, 30, 25, .05);
  --tabs-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111312; --card: #1a1d1c; --ink: #eceeed; --muted: #9aa29e; --line: #2a2e2c; --soft: #222624;
    --acc: #2fb39a; --acc-2: #27a089; --acc-ink: #04201a; --acc-soft: #163a33;
    --pos: #4cc38a; --neg: #ff8a7f; --warn-bg: #3a2614; --warn-ink: #ffc58f;
    --t-arbeit: #2fb39a; --t-urlaub: #f0a92c; --t-urlaub_halb: #f3be5c; --t-krank: #f06292; --t-gleittag: #a68cf0;
    --t-sonder: #6aa5e8; --t-unbezahlt: #9aa29e; --t-hol: #6aa5e8; --t-missing: #ff8a7f;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
}
body.noscroll { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.muted { color: var(--muted); }
.pos { color: var(--pos); } .neg { color: var(--neg); }
.boot { padding: 40vh 16px 0; text-align: center; color: var(--muted); }

/* ---------- Kopf & Navigation ---------- */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  max-width: 640px; margin: 0 auto;
}
.top-title { font-weight: 700; letter-spacing: -.01em; }
.top-bal { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 4px 12px; font-weight: 650; font-size: 14px; cursor: pointer; }
html, body { overflow-x: hidden; }
main { max-width: 640px; margin: 0 auto; padding: 4px 16px calc(var(--tabs-h) + env(safe-area-inset-bottom) + 24px); }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center;
  background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabs button {
  flex: 1; max-width: 160px; height: var(--tabs-h); border: 0; background: none; color: var(--muted); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11.5px; font-weight: 550;
}
.tabs svg, .btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs button.on { color: var(--acc); }

/* ---------- Karten ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin: 12px 0; box-shadow: var(--shadow); }
.card-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-title h2 { font-size: 17px; letter-spacing: -.01em; }
.card-title .muted { font-size: 13px; }
.card.list { padding: 4px 0; }

.hero { background: var(--acc); color: var(--acc-ink); border-radius: calc(var(--r) + 4px); padding: 18px 18px 16px; margin: 8px 0 12px; }
.hero-label { font-size: 13px; font-weight: 600; opacity: .85; text-transform: uppercase; letter-spacing: .06em; }
.hero-val { font-size: 52px; font-weight: 750; letter-spacing: -.03em; line-height: 1.05; margin: 4px 0 14px; }
.hero-val small { font-size: 18px; font-weight: 600; opacity: .8; letter-spacing: 0; }
.hero-sub { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border-top: 1px solid color-mix(in srgb, var(--acc-ink) 22%, transparent); padding-top: 12px; }
.hero-sub small { display: block; font-size: 12px; opacity: .8; }
.hero-sub b { font-size: 18px; font-weight: 700; }
.hero-note { margin-top: 10px; font-size: 13px; opacity: .85; }

.alert { display: block; width: 100%; text-align: left; background: var(--warn-bg); color: var(--warn-ink); border-color: transparent; cursor: pointer; }
.alert b { display: block; }
.alert span { font-size: 14px; }
.welcome { background: var(--acc-soft); border-color: transparent; }
.welcome p { margin: 8px 0 0; }

/* ---------- Buttons & Formulare ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-weight: 600; cursor: pointer;
  touch-action: manipulation;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--acc); color: var(--acc-ink); border-color: var(--acc); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--acc); }
.btn.danger { color: var(--neg); }
.btn.big { min-height: 52px; font-size: 17px; width: 100%; }
.btn.block { width: 100%; margin-top: 8px; }
.btn.small { min-height: 40px; padding: 0 12px; font-size: 14px; }
.btn.icon { width: 44px; padding: 0; font-size: 22px; }
.btn.icon.small { width: 32px; min-height: 32px; font-size: 14px; }

.stack { display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 550; color: var(--muted); }
label small { font-weight: 400; }
input, select {
  height: 46px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); padding: 0 12px;
  color: var(--ink); font-size: 16px; width: 100%; min-width: 0;
}
input:focus, select:focus { outline: 2px solid var(--acc); outline-offset: 0; border-color: transparent; }
input[type="time"], input[type="date"] { -webkit-appearance: none; appearance: none; }
input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--acc); flex: none; margin: 0; }
label.check { flex-direction: row; align-items: flex-start; gap: 10px; color: var(--ink); font-weight: 450; font-size: 15px; }
label.inline { flex-direction: row; align-items: center; gap: 8px; }
label.inline input { height: 38px; width: auto; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.row2 .btn { width: 100%; }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
.note { font-size: 14px; background: var(--soft); border-radius: 10px; padding: 10px 12px; margin: 0; }
.note.warn { background: var(--warn-bg); color: var(--warn-ink); }
.err { color: var(--neg); margin: 0; font-size: 14px; }
details summary { cursor: pointer; color: var(--acc); font-weight: 600; font-size: 14px; }
.hol-list { list-style: none; padding: 0; margin: 8px 0 0; font-size: 14px; }
.hol-list li { display: flex; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.hol-list span { color: var(--muted); width: 110px; flex: none; }

/* ---------- Tageseditor ---------- */
.ed-head { margin-bottom: 12px; }
.ed-date { font-weight: 700; font-size: 17px; margin-bottom: 4px; }
.ed-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.chip {
  --tc: var(--t-arbeit);
  border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 600;
  cursor: pointer; touch-action: manipulation; min-height: 38px;
}
.chip.on { background: var(--tc); border-color: var(--tc); color: #fff; }
.chip.mini { padding: 4px 10px; min-height: 32px; font-size: 13px; }
.times { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 12px; }
@media (min-width: 560px) { .times { grid-template-columns: 1fr 1fr; } }
.tf { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 550; color: var(--muted); }
.tf-wide, .times .hint { grid-column: 1 / -1; }
.tf-row { display: flex; gap: 6px; }
.tf-row input { flex: 1; min-width: 0; font-size: 20px; font-weight: 650; text-align: center; padding: 0 6px; }
.brk { display: flex; align-items: center; gap: 8px; }
.brk input { width: 90px; flex: none; text-align: center; font-size: 18px; font-weight: 650; }
.brk .unit { color: var(--muted); font-weight: 500; }
.brk-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.note-f { margin-bottom: 8px; }
.ed-sum .sum-row { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 15px; padding: 8px 0; }
.ed-sum .note { margin-top: 6px; }
.ed-foot { display: flex; justify-content: space-between; align-items: center; min-height: 44px; }
.save-state { font-size: 13px; color: var(--muted); }

.btn.clock { width: 100%; min-height: 64px; border-radius: 16px; flex-direction: column; gap: 0; margin-bottom: 14px; font-size: 20px; }
.btn.clock small { font-size: 13px; font-weight: 500; opacity: .85; }
.btn.clock.go { background: var(--acc); color: var(--acc-ink); border-color: var(--acc); }
.btn.clock.stop { background: var(--ink); color: var(--bg); border-color: var(--ink); margin: 0; width: 130px; flex: none; }
.running { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--acc-soft); border-radius: 16px; padding: 10px 10px 10px 16px; margin-bottom: 14px; }
.running small { display: block; color: var(--muted); font-size: 13px; }
.running { flex-direction: column; align-items: stretch; padding: 12px; gap: 10px; }
.running.paused { background: var(--warn-bg); }
.run-info { padding: 2px 4px 0; }
.run-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.run-btns .btn.clock { width: auto; margin: 0; min-height: 56px; font-size: 18px; }
.btn.clock.pause { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn.again { width: 100%; margin: -4px 0 10px; }
.running b { font-size: 26px; letter-spacing: -.02em; }

/* ---------- Tageszeilen ---------- */
.list { display: flex; flex-direction: column; }
.drow {
  --tc: transparent;
  display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 8px; width: 100%; min-height: 52px;
  padding: 8px 16px 8px 13px; border: 0; border-left: 3px solid var(--tc); border-bottom: 1px solid var(--line);
  background: none; text-align: left; cursor: pointer; font-size: 15px;
}
.drow.wm { grid-template-columns: 92px 1fr auto; }
.card .list .drow, .sheet .list .drow { padding-left: 13px; }
.drow:last-child { border-bottom: 0; }
.drow:active { background: var(--soft); }
.drow.off .d-date, .drow.before { color: var(--muted); }
.drow.off { background: color-mix(in srgb, var(--soft) 55%, transparent); }
.drow.today { background: var(--acc-soft); }
.drow.today .d-date b { color: var(--acc); }
.d-date b { display: inline-block; width: 26px; font-weight: 700; }
.d-mid { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
.d-note { width: 100%; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-right { display: flex; align-items: center; gap: 6px; font-weight: 650; white-space: nowrap; }
.tag { --tc: var(--t-arbeit); display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; color: var(--tc); background: color-mix(in srgb, var(--tc) 14%, transparent); }
.warn-dot { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--warn-bg); color: var(--warn-ink); font-style: normal; font-size: 12px; font-weight: 800; }
.t-arbeit { --tc: var(--t-arbeit); } .t-urlaub { --tc: var(--t-urlaub); } .t-urlaub_halb { --tc: var(--t-urlaub_halb); }
.t-krank { --tc: var(--t-krank); } .t-gleittag { --tc: var(--t-gleittag); } .t-sonder { --tc: var(--t-sonder); }
.t-unbezahlt { --tc: var(--t-unbezahlt); } .t-hol { --tc: var(--t-hol); } .t-missing { --tc: var(--t-missing); }
.drow.t-arbeit { --tc: transparent; }

/* ---------- Monat & Auswertung ---------- */
.mhead { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 4px; }
.mhead h2 { font-size: 22px; letter-spacing: -.02em; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 12px; }
.stats small { display: block; font-size: 11.5px; color: var(--muted); }
.stats b { font-size: 17px; }
.mtools { display: flex; gap: 8px; flex-wrap: wrap; }
.legend { text-align: center; font-size: 13px; color: var(--muted); }
.kv > div { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.kv > div span { color: var(--muted); }
.kv > div.total { border-bottom: 0; font-size: 17px; }
.kv > div.total span { color: var(--ink); font-weight: 650; }
.tbl-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: right; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.tbl td { text-align: right; padding: 9px 4px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl tbody tr { cursor: pointer; }
.tbl tfoot td { font-weight: 700; border-bottom: 0; }

/* ---------- Einstellungen ---------- */
.tgt { padding: 10px 0 14px; border-bottom: 1px solid var(--line); }
.tgt:first-child { padding-top: 0; }
.tgt-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; font-size: 14px; }
.tgt-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.tgt-days label { gap: 3px; align-items: center; font-size: 12px; }
.tgt-days input { height: 40px; padding: 0 2px; text-align: center; font-size: 14px; }
.carry { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.savebar { position: sticky; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 8px); z-index: 5; }
.savebar .btn { box-shadow: 0 6px 24px rgba(0, 0, 0, .18); }

/* ---------- Bottom-Sheet ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; }
.sheet-bg { position: absolute; inset: 0; background: rgba(10, 14, 12, .45); opacity: 0; transition: opacity .18s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--card); border-radius: 20px 20px 0 0; padding: 0 16px calc(env(safe-area-inset-bottom) + 20px);
  transform: translateY(100%); transition: transform .22s cubic-bezier(.2, .8, .2, 1); max-width: 640px; margin: 0 auto;
}
.sheet-wrap.open .sheet-bg { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-head { position: sticky; top: 0; background: var(--card); display: flex; align-items: center; justify-content: space-between; padding: 14px 0 10px; z-index: 2; }
.sheet-head h3 { font-size: 17px; }
.sheet-body > .stack, .sheet-body > .list { margin-top: 4px; }
.sheet .list { margin: 12px -16px 0; border-top: 1px solid var(--line); }

/* ---------- Anmeldung ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 24px; box-shadow: var(--shadow); }
.auth-card h2 { font-size: 18px; margin: 4px 0 12px; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.brand img { width: 52px; height: 52px; border-radius: 12px; }
.brand h1 { font-size: 22px; letter-spacing: -.02em; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.checks { list-style: none; padding: 0; margin: 0 0 16px; font-size: 15px; }
.checks li { display: flex; gap: 10px; padding: 6px 0; }
.checks li > span { font-weight: 800; width: 16px; }
.checks li.ok > span { color: var(--pos); } .checks li.bad > span { color: var(--neg); }
.checks small { display: block; color: var(--muted); font-size: 13px; }

/* ---------- Hinweis-Toast ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 16px); z-index: 60;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 550;
  max-width: calc(100% - 32px); box-shadow: 0 8px 30px rgba(0, 0, 0, .25);
}
.toast.err { background: var(--neg); color: #fff; }

@media (max-width: 380px) {
  .hero-val { font-size: 44px; }
  .stats b { font-size: 15px; }
  .btn.clock.stop { width: 110px; }
}
@media (min-width: 700px) {
  .tabs { justify-content: center; }
}

/* ---------- Zugangsschlüssel ---------- */
.keys { display: flex; flex-direction: column; }
.key-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.key-row:last-child { border-bottom: 0; }
.key-row small { display: block; color: var(--muted); font-size: 12.5px; }
.key-new { border-top: 1px solid var(--line); padding-top: 12px; }
.key-new input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; }
