/* Wastey: iOS-Design nach dem Design-Artefakt (Start, Einstellungen, hell und dunkel). Siehe docs/STYLE.md. */
:root {
  color-scheme: light dark;
  --bg: #F2F2F7; --card: #FFFFFF; --label: #000000; --label2: #636366; --sep: rgba(60, 60, 67, .18);
  --accent: #0071E3; --accentShadow: rgba(0, 113, 227, .32); --accentText: #0066CC;
  --done: #1F7A3A; --doneFill: #248A3D; --warn: #FF9500; --red: #D70015; --danger: #D70015;
  --glass: rgba(255, 255, 255, .66); --glassBorder: rgba(255, 255, 255, .8); --scrim: rgba(0, 0, 0, .35);
  --font: -apple-system, 'SF Pro Text', 'SF Pro Display', 'Inter', system-ui, 'Segoe UI', Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000; --card: #1C1C1E; --label: #FFFFFF; --label2: #AEAEB2; --sep: rgba(84, 84, 88, .6);
    --accentShadow: rgba(0, 113, 227, .4); --accentText: #2997FF;
    --done: #30D158; --warn: #FF9F0A; --red: #FF6961; --danger: #FF6961;
    --glass: rgba(58, 58, 60, .55); --glassBorder: rgba(255, 255, 255, .14); --scrim: rgba(0, 0, 0, .55);
  }
}

* { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--label);
  font-family: var(--font); -webkit-font-smoothing: antialiased; line-height: 1.3;
}
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
button, input, a { font: inherit; }
input { font-size: 16px; }                      /* unter 16 px zoomt iOS beim Fokussieren */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Bedienelemente: Rückmeldung beim Drücken, kein graues Aufblitzen, keine Textauswahl */
.tap {
  border: 0; cursor: pointer; text-decoration: none; color: inherit; background: transparent;
  touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: transform .14s ease-out, opacity .2s ease-out, background-color .2s ease-out;
}
.tap:active { transform: scale(.96); }
.tap:focus-visible, .pick:focus-visible + .tap { outline: 3px solid var(--accentText); outline-offset: 2px; }
.tap:disabled { cursor: default; }
.tap:disabled:active { transform: none; }
.glass {
  background: var(--glass); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glassBorder); box-shadow: 0 8px 24px rgba(0, 0, 0, .1);
}
.icon { display: block; flex: none; }

/* ---------- Start ---------- */
.home { padding-bottom: calc(160px + env(safe-area-inset-bottom, 0px)); }
.hero { padding: max(44px, calc(env(safe-area-inset-top, 0px) + 20px)) 24px 0; }
.hero-label { font-size: 15px; line-height: 20px; font-weight: 600; color: var(--label2); }
.hero h1 {
  margin-top: 2px; font-size: clamp(44px, 14.5vw, 58px); line-height: 1.07; font-weight: 700; letter-spacing: -.03em;
  overflow-wrap: anywhere; text-wrap: balance;
}
.hero h1.mid { font-size: clamp(38px, 12vw, 48px); }
.hero h1.small { font-size: clamp(30px, 9vw, 36px); letter-spacing: -.025em; }
.hero-line { margin-top: 2px; font-size: 20px; line-height: 26px; letter-spacing: -.01em; color: var(--label2); }
.status {
  margin-top: 14px; min-height: 28px; display: flex; align-items: center; gap: 8px; font-size: 15px; line-height: 20px; font-weight: 600;
}
.status .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--warn); margin: 0 6px; flex: none; }
.status .ok { color: var(--done); }
.status .undo { padding: 0 10px; height: 44px; margin: -8px 0; color: var(--accentText); font-size: 15px; font-weight: 600; }
.badge-pop { animation: pop .32s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.card { margin: 28px 16px 0; background: var(--card); border-radius: 26px; padding: 8px 12px 0; }
.month-head { display: flex; align-items: center; justify-content: space-between; height: 52px; padding-left: 8px; }
.month-head h2 { font-size: 20px; line-height: 24px; letter-spacing: -.02em; font-weight: 400; color: var(--label2); }
.month-head h2 b { font-weight: 700; color: var(--label); }
.month-nav { display: flex; }
.month-nav .tap {
  width: 44px; height: 44px; border-radius: 22px; display: flex; align-items: center; justify-content: center; padding: 0; color: var(--accentText);
}
.month-nav .tap:disabled { opacity: .3; }
.cal { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal th { height: 22px; padding: 0; font-size: 12px; font-weight: 600; color: var(--label2); text-align: center; }
.cal td { padding: 0; height: 48px; text-align: center; vertical-align: middle; font-size: 19px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.d { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 40px; }
.d.next-day { width: 40px; height: 40px; margin: 0 auto; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 600; }
.d.pickup span { font-weight: 600; }
.d.pickup::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accentText); }
.d.missed { color: var(--label2); }
.d.missed::after { content: ''; width: 6px; height: 6px; border-radius: 50%; border: 1.5px solid var(--label2); }
.d.done-day span { color: var(--label2); }
.d.today-day { color: var(--red); font-weight: 700; }
.sep { height: 1px; background: var(--sep); margin: 6px 0 0 8px; }
.count-row { display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 8px; font-size: 17px; letter-spacing: -.01em; }
.count-row b { font-size: 22px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* Symbolleiste unten: weicher Verlauf, darauf die Knöpfe */
.fade {
  position: fixed; left: 0; right: 0; bottom: 0; height: calc(150px + env(safe-area-inset-bottom, 0px)); pointer-events: none; z-index: 5;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  -webkit-mask-image: linear-gradient(to top, #000 40%, transparent); mask-image: linear-gradient(to top, #000 40%, transparent);
  background: linear-gradient(to top, var(--bg) 30%, transparent);
}
.bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; gap: 12px; padding: 0 16px max(20px, env(safe-area-inset-bottom, 0px)); }
.cta {
  flex: 1; height: 56px; border-radius: 28px; font-size: 17px; font-weight: 600; letter-spacing: -.01em; padding: 0;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.cta.primary { background: var(--accent); color: #fff; box-shadow: 0 8px 24px var(--accentShadow), inset 0 1px 0 rgba(255, 255, 255, .3); }
.cta.primary:disabled { opacity: .4; box-shadow: none; }
.cta.done { color: var(--done); }
.round { width: 56px; height: 56px; border-radius: 28px; display: flex; align-items: center; justify-content: center; flex: none; padding: 0; }

/* ---------- Einstellungen ---------- */
.settings { padding: max(44px, calc(env(safe-area-inset-top, 0px) + 12px)) 16px calc(40px + env(safe-area-inset-bottom, 0px)); }
.back { width: 44px; height: 44px; border-radius: 22px; display: flex; align-items: center; justify-content: center; padding: 0; box-shadow: 0 4px 16px rgba(0, 0, 0, .08); }
.settings h1 { margin: 12px 0 0 8px; font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: -.025em; }
.group-label { margin: 24px 0 7px 16px; font-size: 13px; line-height: 18px; color: var(--label2); text-transform: uppercase; }
.group-note { margin: 7px 16px 0; font-size: 13px; line-height: 18px; color: var(--label2); }
.group-note.error { color: var(--danger); }
.list { background: var(--card); border-radius: 26px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; min-height: 52px; font-size: 17px; letter-spacing: -.01em; }
.row + .row, .row + .action, .action + .row { border-top: 1px solid var(--sep); }
.row .main { flex: 1; min-width: 0; }
.row .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 22px; }
.row .sub { font-size: 14px; line-height: 19px; color: var(--label2); }
.row .value { color: var(--label2); font-variant-numeric: tabular-nums; flex: none; }
.row.file { min-height: 64px; }
.file-icon { width: 36px; height: 36px; border-radius: 9px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; }
.row .small-btn { height: 44px; margin: -8px -8px -8px 0; padding: 0 8px; color: var(--accentText); font-size: 15px; font-weight: 600; flex: none; }
.pick { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.pickwrap { position: relative; border-top: 1px solid var(--sep); }
.pickwrap:first-child { border-top: 0; }
.action { position: relative; display: flex; align-items: center; width: 100%; height: 52px; padding: 0 16px; color: var(--accentText); font-size: 17px; letter-spacing: -.01em; text-align: left; }
.list > .action:first-child { border-top: 0; }
.action.danger { color: var(--danger); }
.field { flex: 1; min-width: 0; text-align: right; border: 0; background: transparent; color: var(--label2); padding: 0; height: 28px; outline: none; }
.field:focus { color: var(--label); }
.field::placeholder { color: var(--label2); opacity: .7; }
.row:has(.field:focus-visible) { box-shadow: inset 0 0 0 3px var(--accentText); }
.version { margin: 28px 0 0; text-align: center; font-size: 13px; color: var(--label2); }

/* Hinweis unten und Rückfrage */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); z-index: 20; transform: translate(-50%, 12px); opacity: 0;
  max-width: min(92vw, 420px); padding: 12px 18px; border-radius: 22px; font-size: 15px; font-weight: 500; text-align: center; pointer-events: none;
  transition: opacity .2s ease-out, transform .2s ease-out;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { color: var(--danger); }
dialog.sheet {
  margin: auto 0 0; width: 100%; max-width: 480px; margin-inline: auto; border: 0; padding: 8px 16px max(16px, env(safe-area-inset-bottom, 0px));
  background: transparent; color: var(--label); overflow: visible;
}
dialog.sheet::backdrop { background: var(--scrim); }
.sheet-card { background: var(--card); border-radius: 26px; overflow: hidden; }
.sheet-text { padding: 16px 20px; text-align: center; font-size: 13px; line-height: 18px; color: var(--label2); }
.sheet-text b { display: block; margin-bottom: 2px; font-size: 15px; color: var(--label); }
.sheet .action { justify-content: center; border-top: 1px solid var(--sep); }
.sheet-cancel { margin-top: 8px; border-radius: 26px; background: var(--card); font-weight: 600; justify-content: center; }

/* Fehlerzustand beim Laden */
.state { padding: 120px 32px 0; text-align: center; color: var(--label2); }
.state h1 { font-size: 22px; color: var(--label); margin-bottom: 8px; }
.state .tap { margin-top: 20px; height: 48px; padding: 0 24px; border-radius: 24px; background: var(--accent); color: #fff; font-weight: 600; }

/* ---------- Anmeldung ---------- */
.auth { max-width: 420px; margin: 0 auto; padding: max(64px, calc(env(safe-area-inset-top, 0px) + 32px)) 16px 40px; }
.auth h1 { margin: 0 0 4px 8px; font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: -.025em; }
.auth .lead { margin: 0 0 20px 8px; color: var(--label2); font-size: 17px; }
.auth .field { text-align: left; color: var(--label); height: 28px; }
.auth .row label { width: 120px; flex: none; }
.auth .submit { margin-top: 20px; width: 100%; }
.auth .err { margin: 0 0 14px 8px; color: var(--danger); font-size: 15px; }
.auth .switch { margin-top: 18px; text-align: center; font-size: 15px; }
.auth .switch a { color: var(--accentText); display: inline-block; padding: 12px 8px; }

@media (max-width: 360px) { .file-icon { display: none; } }   /* kleine Handys: Platz für den Dateinamen */

/* Maus: Hover nur dort, wo es Hover gibt (sonst bleibt er nach dem Tippen hängen) */
@media (hover: hover) and (pointer: fine) {
  .cta.primary:hover:not(:disabled) { opacity: .92; }
  .action:hover, .small-btn:hover, .undo:hover { opacity: .75; }
  .auth .switch a:hover { text-decoration: underline; }
}
@media (prefers-reduced-motion: reduce) {
  .tap, .toast { transition: none; }
  .tap:active { transform: none; }
  .badge-pop { animation: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .glass, .fade { background: var(--card) !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
  .fade { background: linear-gradient(to top, var(--bg) 30%, transparent) !important; -webkit-mask-image: none; mask-image: none; }
}
@media (prefers-contrast: more) {
  .glass { background: var(--card); border-color: var(--label2); }
}
