/* Familienzentrale – ohne Build-Schritt. Ziel: Safari ab iPadOS 15 (kein CSS-Nesting, kein color-mix). */
:root {
  --bg: #f6f4ef;
  --card: #ffffff;
  --card-2: #f0ede6;
  --text: #22252a;
  --muted: #6b6f76;
  --line: #e2ddd3;
  --accent: #2f6f6a;
  --accent-text: #ffffff;
  --accent-soft: #dcebe8;
  --danger: #c0392b;
  --warn: #b26b00;
  --warn-soft: #fff1d6;
  --ok: #2e8b57;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 14px rgba(0, 0, 0, .05);
  --radius: 16px;
  --tap: 48px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181c;
    --card: #1f2329;
    --card-2: #272c33;
    --text: #eceef1;
    --muted: #9aa0a8;
    --line: #333941;
    --accent: #5fb3ab;
    --accent-text: #0d1f1d;
    --accent-soft: #23403d;
    --warn-soft: #3a2e17;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
h1 { font-size: 1.7rem; margin: 0 0 .6rem; }
h2 { font-size: 1.15rem; margin: 0 0 .6rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
p { margin: .4rem 0; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9rem; word-break: break-all; }
.hidden { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.empty { color: var(--muted); padding: .8rem 0; margin: 0; }
.warn { color: var(--warn); }
.pos { color: var(--ok); }
.neg { color: var(--danger); }
.notes { white-space: pre-wrap; background: var(--card-2); border-radius: 10px; padding: .6rem .8rem; }

/* ------------------------------------------------------------ Buttons & Formulare */
button, input, select, textarea { font: inherit; color: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: var(--tap); padding: 0 1.1rem; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  cursor: pointer; text-decoration: none; font-weight: 600; white-space: nowrap;
  -webkit-user-select: none; user-select: none;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.small { min-height: 44px; padding: 0 .8rem; font-size: .9rem; }
.btn.big { min-height: 56px; font-size: 1.1rem; }
.btn.block { width: 100%; }
.btn.icon { width: var(--tap); padding: 0; font-size: 1.5rem; }
.icon-btn {
  min-width: 44px; min-height: 44px; border: 0; background: transparent; border-radius: 10px;
  cursor: pointer; font-size: 1.1rem; color: var(--muted); display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--card-2); }

.form { display: flex; flex-direction: column; gap: .8rem; }
.field { display: flex; flex-direction: column; gap: .3rem; flex: 1; min-width: 0; }
.field .label { font-weight: 600; font-size: .9rem; }
.hint { color: var(--muted); font-size: .82rem; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; min-height: var(--tap); padding: .55rem .8rem; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); font-size: 16px; /* verhindert iOS-Zoom */
  -webkit-appearance: none; appearance: none;
}
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 2rem;
}
textarea { min-height: 80px; resize: vertical; }
/* getrennte Regeln: Safari < 15.4 kennt :focus-visible nicht und würde sonst die ganze Liste verwerfen */
input:focus, select:focus, textarea:focus { outline: 3px solid var(--accent); outline-offset: 1px; }
.btn:focus-visible, button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.check { display: flex; align-items: center; gap: .6rem; min-height: 44px; cursor: pointer; }
.check input { width: 24px; height: 24px; accent-color: var(--accent); }
.row { display: flex; gap: .8rem; flex-wrap: wrap; align-items: flex-end; }
.row.center { align-items: center; }
.row-tight { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.stack { display: flex; flex-direction: column; gap: .6rem; }

.color-picker { display: flex; flex-wrap: wrap; gap: .5rem; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .6); }
.swatch.on { border-color: var(--text); }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chips.tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; max-width: 100%; }
.chips.filter { margin-bottom: .8rem; }
.chip {
  --c: var(--accent);
  display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: 0 .9rem;
  border-radius: 999px; border: 2px solid var(--line); background: var(--card); cursor: pointer; font-weight: 600; white-space: nowrap;
}
.chip .avatar { margin-left: -.45rem; }
.chip.on { border-color: var(--c); background: var(--c); color: #fff; }
.chip .count { background: rgba(0, 0, 0, .15); border-radius: 999px; padding: 0 .45rem; font-size: .8rem; }
.pill { display: inline-block; font-size: .75rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; background: var(--card-2); color: var(--muted); margin-left: .4rem; text-decoration: none; }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.seg { display: inline-flex; background: var(--card-2); border-radius: 12px; padding: 3px; }
.seg button { min-height: 42px; border: 0; background: transparent; padding: 0 1rem; border-radius: 10px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.badge { background: var(--danger); color: #fff; border-radius: 999px; font-size: .7rem; font-weight: 700; padding: 0 .4rem; min-width: 1.2rem; text-align: center; position: absolute; top: 4px; right: 10px; }

/* ------------------------------------------------------------ Avatare */
.avatar {
  --c: #888; --s: 40px;
  width: var(--s); height: var(--s); flex: 0 0 var(--s);
  border-radius: 50%; background: var(--c); color: #fff; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; overflow: hidden;
  font-size: calc(var(--s) * .45); line-height: 1; box-shadow: 0 0 0 2px var(--card);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.xs { --s: 24px; }
.avatar.sm { --s: 34px; }
.avatar.md { --s: 44px; }
.avatar.lg { --s: 80px; }
.avatar.xl { --s: 110px; box-shadow: 0 0 0 4px var(--c); }

/* ------------------------------------------------------------ Start-Bildschirme */
.center-screen {
  min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
}
.card { background: var(--card); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); margin-bottom: 1rem; min-width: 0; }
.card.narrow { width: 100%; max-width: 480px; }
.card.highlight { border: 2px solid var(--warn); }
.picker-wrap { text-align: center; width: 100%; max-width: 900px; }
.picker { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.5rem; margin: 1.5rem 0 2rem; }
.picker-item {
  border: 0; background: transparent; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: .7rem;
  font-size: 1.15rem; font-weight: 600; padding: .5rem; border-radius: 20px; min-width: 130px;
}
.picker-item:active { transform: scale(.96); }
.pin-box { display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.pin-dots { display: flex; gap: .8rem; min-height: 24px; margin: .3rem 0 .8rem; }
.pin-dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--muted); }
.pin-dots span.on { background: var(--text); border-color: var(--text); }
.pin-dots.shake { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.pin-pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 12px; }
.pin-key { height: 76px; border-radius: 50%; border: 1px solid var(--line); background: var(--card-2); font-size: 1.7rem; font-weight: 600; cursor: pointer; }
.pin-key:active { background: var(--accent-soft); }
.pin-key.ok { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

/* ------------------------------------------------------------ Layout */
.shell {
  display: grid; height: 100vh; height: 100dvh;
  grid-template-columns: 1fr; grid-template-rows: auto 1fr auto;
  grid-template-areas: "top" "main" "nav";
}
.topbar {
  grid-area: top; display: flex; align-items: center; gap: .8rem;
  padding: calc(.5rem + var(--safe-top)) calc(1rem + var(--safe-right)) .5rem calc(1rem + var(--safe-left));
  background: var(--card); border-bottom: 1px solid var(--line);
}
.brand-name { font-weight: 800; font-size: 1.1rem; }
.clock { flex: 1; text-align: center; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-btn { display: flex; align-items: center; gap: .5rem; border: 0; background: var(--card-2); border-radius: 999px; padding: 4px 12px 4px 4px; cursor: pointer; min-height: 44px; font-weight: 600; }
.content {
  grid-area: main; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 1rem calc(1rem + var(--safe-right)) 1.5rem calc(1rem + var(--safe-left));
}
.nav {
  grid-area: nav; display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch;
  background: var(--card); border-top: 1px solid var(--line); padding-bottom: var(--safe-bottom);
}
.nav-item {
  position: relative; flex: 1 0 68px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; min-height: 58px; padding: 6px 4px; text-decoration: none; color: var(--muted); font-size: .72rem; font-weight: 600;
}
.nav-icon { font-size: 1.45rem; line-height: 1; }
.nav-item.active { color: var(--accent); }
.nav-item.active .nav-icon { transform: scale(1.1); }
.nav-more { display: none; border: 0; background: transparent; font: inherit; cursor: pointer; }
@media (max-width: 759px) {
  .nav { overflow-x: hidden; }
  .nav-item { flex: 1 1 0; min-width: 0; }
  .nav-item.secondary { display: none; }
  .nav-more { display: flex; }
}
.more-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
.more-grid .btn { min-height: 64px; font-size: 1.05rem; justify-content: flex-start; }
.more-grid .btn.active { border-color: var(--accent); color: var(--accent); }

@media (min-width: 760px) {
  .shell { grid-template-columns: 96px 1fr; grid-template-rows: auto 1fr; grid-template-areas: "nav top" "nav main"; }
  .nav { flex-direction: column; overflow-x: hidden; overflow-y: auto; border-top: 0; border-right: 1px solid var(--line); padding: calc(.5rem + var(--safe-top)) 0 calc(.5rem + var(--safe-bottom)) var(--safe-left); }
  .nav-item { flex: 0 0 auto; min-height: 76px; font-size: .78rem; }
  .nav-item.active { background: var(--accent-soft); }
  .content { padding: 1.2rem 1.4rem 2rem; }
}
@media (max-width: 520px) {
  .me-name, .brand-name { display: none; }
  .clock { text-align: left; font-size: .9rem; }
  .content { padding: .8rem calc(.7rem + var(--safe-right)) 1.2rem calc(.7rem + var(--safe-left)); }
  .card { padding: .9rem; }
}

.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.toolbar-title { flex: 1; margin: 0 .4rem; min-width: 10rem; }
.toolbar > .btn.primary { margin-left: auto; }

/* ------------------------------------------------------------ Aufgaben-Zeilen */
.task-row, .item-row { display: flex; align-items: center; gap: .7rem; padding: .45rem 0; border-bottom: 1px solid var(--line); min-height: 56px; }
.task-row:last-child, .item-row:last-child { border-bottom: 0; }
.task-main { flex: 1; min-width: 0; }
.task-title { font-weight: 600; overflow-wrap: break-word; }
.task-meta { color: var(--muted); font-size: .82rem; display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.task-meta .who { display: inline-flex; align-items: center; gap: .3rem; }
.is-done .task-title, .is-done .item-text { text-decoration: line-through; color: var(--muted); }
.overdue .task-title { color: var(--warn); }
.pts { font-weight: 800; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: .2rem .65rem; font-size: .9rem; white-space: nowrap; }
.tick {
  --c: var(--accent);
  width: 48px; height: 48px; flex: 0 0 48px; border-radius: 14px; border: 3px solid var(--c); background: transparent;
  color: #fff; font-size: 1.5rem; font-weight: 800; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.tick.done { background: var(--c); }
.tick.pending { background: var(--warn-soft); color: var(--warn); border-style: dashed; font-size: 1.2rem; }
.tick:active { transform: scale(.92); }
.item-text { flex: 1; overflow-wrap: break-word; font-size: 1.05rem; }
.add-row { display: flex; gap: .5rem; margin: .4rem 0 .6rem; }
.list-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .4rem; }
.list-head h2 { margin: 0; }
.list-card { max-width: 760px; }

.people { display: flex; flex-direction: column; gap: 1rem; }
.people.cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; align-items: start; }
.people.cols .card { margin: 0; }
.person { border-left: 5px solid var(--c); padding-left: .8rem; }
.person-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .2rem; }
.person-head .muted { margin-left: auto; font-size: .85rem; }

/* ------------------------------------------------------------ Heute (Wanddisplay) */
.today-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.today-grid .col { min-width: 0; }
@media (max-width: 759px) {
  .today-grid .col.wide { order: -1; }
  .today-date { display: none; }
}
.today-date { font-size: 1.5rem; font-weight: 800; margin: 0 0 .8rem; }
@media (min-width: 1000px) {
  .today-grid { grid-template-columns: minmax(260px, 1fr) minmax(360px, 1.6fr) minmax(240px, 1fr); }
}
@media (min-width: 760px) and (max-width: 999px) {
  .today-grid { grid-template-columns: 1fr 1fr; }
  .today-grid .col.wide { grid-column: 1 / -1; order: -1; }
}
.event-line { display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border-left: 5px solid var(--c); background: var(--card-2); border-radius: 10px; margin-bottom: .5rem; min-height: 52px; }
.ev-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ev-time { font-weight: 700; font-size: .8rem; color: var(--muted); }
.ev-title { font-weight: 600; overflow-wrap: break-word; }
.ev-who { display: flex; flex-shrink: 0; }
.ev-who .avatar + .avatar { margin-left: -8px; }
.meal-line { display: flex; flex-direction: column; padding: .4rem 0; border-bottom: 1px solid var(--line); }
.meal-line:last-child { border-bottom: 0; }
.lb-line { display: grid; grid-template-columns: 2rem auto minmax(4rem, 7rem) 1fr auto; align-items: center; gap: .6rem; padding: .35rem 0; }
.lb-line.big { grid-template-columns: 2.2rem auto minmax(5rem, 9rem) 1fr auto; padding: .5rem 0; }
.lb-sub { grid-column: 3 / -1; margin-top: -.5rem; }
.rank { text-align: center; font-weight: 800; font-size: 1.1rem; }
.lb-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-val { font-size: 1.2rem; min-width: 2.5rem; text-align: right; font-variant-numeric: tabular-nums; }
.bar { height: 12px; background: var(--card-2); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 999px; transition: width .4s; }
.leaderboard { max-width: 900px; }
.journal-row { display: flex; align-items: center; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid var(--line); min-height: 48px; }
.jr-day { min-width: 5.5rem; }
.jr-reason { flex: 1; overflow-wrap: break-word; }

/* ------------------------------------------------------------ Kalender */
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.dow { text-align: center; font-weight: 700; color: var(--muted); font-size: .85rem; padding: .2rem 0; }
.day {
  min-height: 96px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 4px;
  display: flex; flex-direction: column; gap: 2px; align-items: stretch; text-align: left; cursor: pointer; overflow: hidden;
}
.day.other { opacity: .45; }
.day.today { border: 2px solid var(--accent); }
.day-num { font-weight: 700; font-size: .9rem; padding: 0 2px; }
.day.today .day-num { color: var(--accent); }
.chip-ev { display: block; font-size: .72rem; line-height: 1.25; padding: 1px 4px; border-radius: 5px; background: var(--c); color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.more { font-size: .7rem; color: var(--muted); padding-left: 3px; }
@media (max-width: 600px) {
  .day { min-height: 58px; }
  .chip-ev { font-size: 0; height: 6px; padding: 0; }
  .chip-ev b { display: none; }
}
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .6rem; }
@media (max-width: 900px) { .week-grid { grid-template-columns: 1fr; } }
.week-day { background: var(--card); border-radius: 12px; padding: .5rem; box-shadow: var(--shadow); min-height: 120px; }
.week-day.today { outline: 2px solid var(--accent); }
.week-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .3rem; }
.event-card {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: left; width: 100%;
  border: 0; border-left: 5px solid var(--c); background: var(--card-2); border-radius: 10px; padding: .45rem .6rem; margin-bottom: .4rem; cursor: pointer; min-height: 48px;
}
.event-card .ev-time { min-width: 0; }

/* ------------------------------------------------------------ Essensplan */
.meal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .8rem; }
@media (min-width: 1100px) { .meal-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
.meal-day { margin: 0; padding: .7rem; }
.meal-day.today { outline: 2px solid var(--accent); }
.meal-day h3 { margin: 0 0 .4rem; }
.meal-cell {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: left; min-height: 64px;
  border: 1px solid var(--line); background: var(--card-2); border-radius: 10px; padding: .4rem .6rem; margin-bottom: .4rem; cursor: pointer;
}
.meal-cell.empty-cell { background: transparent; border-style: dashed; color: var(--muted); }
.meal-cell:disabled { cursor: default; }
.slot { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.meal-title { font-weight: 600; overflow-wrap: break-word; }
.ingredients { margin: 0; padding-left: 1.2rem; }

/* ------------------------------------------------------------ Stundenplan */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.schedule { --c: var(--accent); width: 100%; border-collapse: separate; border-spacing: 4px; min-width: 520px; table-layout: fixed; }
.schedule col.period-col { width: 6.5rem; }
.schedule th { font-size: .85rem; color: var(--muted); padding: .3rem; }
.schedule th.today { color: var(--accent); }
.schedule th.period { text-align: left; white-space: nowrap; }
.schedule th.period small { display: block; font-weight: 400; font-size: .72rem; }
.schedule td { background: var(--card-2); border-radius: 10px; height: 56px; padding: .3rem .5rem; vertical-align: middle; text-align: center; }
.schedule td.filled { background: var(--c); color: #fff; }
.schedule td.today { box-shadow: inset 0 0 0 2px var(--accent); }
.schedule td.editable { cursor: pointer; }
.schedule td small { display: block; opacity: .85; font-size: .72rem; }
.schedule .subject { font-weight: 700; }
.schedule tr.now th.period { color: var(--accent); }
.schedule tr.now td.today { box-shadow: inset 0 0 0 3px var(--warn); }
.period-row { align-items: center; flex-wrap: nowrap; }
.period-no { width: 2rem; font-weight: 700; }

/* ------------------------------------------------------------ Verwaltung */
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; align-items: start; }
.two-col .card { margin: 0; }
.menu-list { display: flex; flex-direction: column; gap: .6rem; }
.avatar-edit { display: flex; }

/* ------------------------------------------------------------ Modal & Toast */
.overlay {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0, 0, 0, .45); z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: calc(12px + var(--safe-top)) 12px calc(12px + var(--safe-bottom));
  animation: fade .15s;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--card); border-radius: 20px; width: 100%; max-width: 520px; max-height: 100%;
  display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
}
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: .8rem .8rem .3rem 1.2rem; }
.modal-head h2 { margin: 0; }
.modal-body { padding: .5rem 1.2rem 1rem; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal-actions { display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; padding: .8rem 1.2rem 1rem; border-top: 1px solid var(--line); }
.modal-actions .btn.danger { margin-right: auto; }
@media (max-width: 520px) {
  .overlay { align-items: flex-end; padding: 0; }
  .modal { border-radius: 20px 20px 0 0; max-height: 92vh; padding-bottom: var(--safe-bottom); }
  .pin-pad { grid-template-columns: repeat(3, 70px); }
  .pin-key { height: 70px; }
}
#toasts { position: fixed; left: 50%; bottom: calc(80px + var(--safe-bottom)); transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: .5rem; align-items: center; pointer-events: none; width: max-content; max-width: 92vw; }
.toast { background: #22252a; color: #fff; padding: .7rem 1.1rem; border-radius: 12px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); font-weight: 600; transition: opacity .4s, transform .4s; text-align: center; }
.toast.error { background: var(--danger); }
.toast.out { opacity: 0; transform: translateY(10px); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
