/* Zeiterfassung – Web-Oberfläche. Handy zuerst, ab 900px mit Seitenleiste. */
:root {
  --bg: #F4F5FA; --surface: #FFFFFF; --surface-alt: #F8F9FC; --border: #E6E8F0;
  --text: #1D1F2C; --muted: #80849A; --accent: #5B5BD6; --accent-hover: #4B4BC4;
  --accent-soft: #ECECFC; --success: #1FA971; --danger: #E5484D; --warning: #F5A524;
  --shadow: 0 4px 24px rgba(20, 20, 60, .07);
  --radius: 16px; --nav-h: 64px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #12131A; --surface: #1C1E28; --surface-alt: #232533; --border: #2C2F3E;
  --text: #ECEDF5; --muted: #8E92A8; --accent: #7C7CF0; --accent-hover: #9090F5;
  --accent-soft: #2A2B4A; --success: #3DD68C; --danger: #FF6369; --warning: #FFB224;
  --shadow: 0 4px 24px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */
#view { padding: 20px 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); max-width: 980px; margin: 0 auto; }
#nav { position: fixed; z-index: 10; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); display: flex; background: var(--surface);
  border-top: 1px solid var(--border); }
#nav .brand { display: none; }
#nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600; }
#nav a.active { color: var(--accent); }
#nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; }

@media (min-width: 900px) {
  #nav { top: 0; right: auto; width: 230px; height: auto; flex-direction: column; padding: 26px 16px;
    border-top: none; border-right: 1px solid var(--border); gap: 4px; }
  #nav .brand { display: flex; align-items: center; gap: 10px; margin: 0 6px 28px; font-weight: 800;
    font-size: 19px; color: var(--accent); }
  #nav .brand img { width: 30px; height: 30px; border-radius: 8px; }
  #nav a { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 11px 14px;
    border-radius: 10px; font-size: 14px; }
  #nav a:hover { background: var(--surface-alt); color: var(--text); }
  #nav a.active { background: var(--accent-soft); }
  #view { margin-left: 230px; padding: 32px 40px 40px; }
  body.no-nav #view { margin-left: auto; }
}

/* ---------- Typografie & Karten ---------- */
h1 { font-size: 26px; margin: 0; font-weight: 700; }
h2 { font-size: 17px; margin: 0 0 12px; font-weight: 600; }
.muted { color: var(--muted); font-size: 13px; }
.pos { color: var(--success); font-weight: 600; } .neg { color: var(--danger); font-weight: 600; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); margin-bottom: 16px; }
.grid .card { margin: 0; }
@media (min-width: 700px) { .grid.four { grid-template-columns: repeat(4, 1fr); } }
.stat .label { font-size: 11px; font-weight: 700; letter-spacing: .4px; color: var(--muted); text-transform: uppercase; }
.stat .value { font-size: 24px; font-weight: 700; margin: 4px 0 2px; white-space: nowrap; }
.stat .sub { font-size: 12px; }

/* ---------- Knöpfe ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px;
  padding: 0 16px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface);
  font-weight: 600; font-size: 14px; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; }
.btn.icon { width: 42px; padding: 0; font-size: 18px; }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }

/* ---------- Stempeluhr ---------- */
.clock { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.clock button { position: relative; width: 220px; height: 220px; border: none; background: none; padding: 0; cursor: pointer; }
.clock svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.clock .track { fill: none; stroke: var(--border); stroke-width: 12; }
.clock .bar { fill: none; stroke: var(--accent); stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset .6s; }
.clock .bar.done { stroke: var(--success); }
.clock .core { fill: var(--accent); transition: fill .2s, r .2s; }
.clock button.running .core { fill: var(--danger); }
.clock button:active .core { r: 76; }
.clock .face { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; color: #fff; pointer-events: none; }
.clock .face b { font-size: 36px; } .clock .face span { font-size: 14px; font-weight: 600; }

/* ---------- Wochenbalken ---------- */
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; height: 170px; align-items: end; }
.bars .col { display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; gap: 6px; }
.bars .track { position: relative; width: 100%; max-width: 34px; flex: 1; background: var(--surface-alt);
  border-radius: 8px; overflow: hidden; }
.bars .fill { position: absolute; left: 0; right: 0; bottom: 0; background: var(--accent); border-radius: 8px; }
.bars .fill.done { background: var(--success); }
.bars .target { position: absolute; left: -2px; right: -2px; border-top: 2px dashed var(--muted); opacity: .6; }
.bars .lbl { font-size: 11px; color: var(--muted); } .bars .lbl.today { color: var(--accent); font-weight: 700; }
.bars .val { font-size: 10px; color: var(--muted); height: 13px; }

/* ---------- Tagesliste ---------- */
.days { list-style: none; margin: 0; padding: 0; }
.days li { display: grid; grid-template-columns: 46px 1fr auto; gap: 10px; align-items: center; padding: 11px 6px;
  border-bottom: 1px solid var(--border); cursor: pointer; border-radius: 10px; }
.days li:hover { background: var(--surface-alt); }
.days li.off { color: var(--muted); }
.days li.today { background: var(--accent-soft); }
.days .date b { display: block; font-size: 16px; } .days .date span { font-size: 11px; color: var(--muted); }
.days .times { font-size: 13px; } .days .tag { font-size: 12px; color: var(--accent); font-weight: 600; }
.days .sum { text-align: right; font-size: 13px; } .days .sum b { display: block; font-size: 15px; }

/* ---------- Formulare ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
input[type=text], input[type=password], input[type=date], input[type=time], select {
  width: 100%; min-height: 46px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface-alt); font-size: 16px; outline: none; }
input:focus, select:focus { border-color: var(--accent); }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.stepper { display: flex; align-items: center; min-height: 46px; border: 1px solid var(--border);
  border-radius: 11px; background: var(--surface-alt); padding: 0 3px; }
.stepper:focus-within { border-color: var(--accent); }
.stepper button { width: 38px; height: 38px; flex: none; border: none; background: none; border-radius: 8px;
  font-size: 20px; font-weight: 600; color: var(--muted); cursor: pointer; touch-action: manipulation; }
.stepper button:active { background: var(--accent); color: #fff; }
.stepper input { flex: 1; min-width: 0; width: 100%; border: none; background: none; text-align: center; font-weight: 700;
  font-size: 16px; min-height: 40px; padding: 0; }
.stepper.disabled { opacity: .45; pointer-events: none; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: center; }
@media (max-width: 480px) {
  .pair { gap: 5px; }
  .pair .stepper button { width: 30px; }
}
.weekrow { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--border); }
/* minmax(0, …): Spalten dürfen schmaler werden als die Zeitfelder es von sich aus wollen */
.weekrow .times { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
/* Handy: Beginn | Ende nebeneinander, Pause darunter über die volle Breite */
@media (max-width: 600px) {
  .weekrow .times { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .weekrow .times > :nth-child(3) { grid-column: 1 / -1; }
}
/* Pfeil/Uhr-Symbol der Zeitfelder (z. B. Samsung Internet) ausblenden – Antippen öffnet trotzdem die Auswahl */
.stepper input[type=time] { -webkit-appearance: none; appearance: none; }
.stepper input[type=time]::-webkit-calendar-picker-indicator { display: none; }
.weekrow .top { display: flex; align-items: center; justify-content: space-between; }
@media (min-width: 1150px) {
  .weekrow { grid-template-columns: 150px 1fr 60px; align-items: center; }
  .weekrow .top { display: contents; }
  .weekrow .times { order: 2; }
  .weekrow .top b { order: 3; }   /* Name | Zeiten | Soll */
}
.export-actions { display: grid; gap: 10px; }
.export-actions a.btn { text-decoration: none; color: inherit; }
.export-actions a.btn.primary { color: #fff; }
.seg { display: inline-flex; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 11px; padding: 3px; }
.seg button { border: none; background: none; padding: 8px 16px; border-radius: 8px; font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--accent); color: #fff; }

/* ---------- Bottom-Sheet & Toast ---------- */
#sheet-backdrop { position: fixed; inset: 0; background: rgba(10, 10, 25, .45); z-index: 20; }
#sheet { position: fixed; z-index: 21; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow: auto;
  background: var(--bg); border-radius: 20px 20px 0 0; padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
  animation: up .22s ease-out; }
#sheet h2 { font-size: 20px; }
#sheet p { white-space: pre-line; }
@media (min-width: 700px) {
  #sheet { left: 50%; top: 50%; bottom: auto; width: 480px; transform: translate(-50%, -50%);
    border-radius: 18px; animation: none; }
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
#toast { position: fixed; z-index: 30; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: 12px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow); max-width: 90vw; }
.error { color: var(--danger); font-size: 13px; font-weight: 600; min-height: 18px; margin: 4px 0 8px; }

/* ---------- Login ---------- */
.login { max-width: 380px; margin: 10vh auto 0; text-align: center; }
.login img { width: 84px; height: 84px; border-radius: 22px; box-shadow: var(--shadow); margin-bottom: 14px; }
.login .card { text-align: left; margin-top: 22px; }
.bio { min-height: 54px; font-size: 16px; }
.bio-icon { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.keys { list-style: none; padding: 0; margin: 0 0 12px; }
.keys li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.keys li .spacer { flex: 1; }
