:root {
  color-scheme: light;
  --bg: #f6f0e7;
  --surface: #fffdf9;
  --surface-2: #efe4d6;
  --ink: #2f211a;
  --muted: #786b63;
  --brand: #70482f;
  --brand-2: #9b6541;
  --brand-soft: #ead6c2;
  --line: rgba(67, 45, 33, 0.12);
  --danger: #9a4d49;
  --danger-soft: #f6e6e4;
  --success: #407260;
  --success-soft: #dfede7;
  --amber: #9a6a26;
  --amber-soft: #f6ecd9;
  --shadow: 0 18px 46px rgba(68, 43, 29, 0.1);
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1b1715;
  --surface: #27211e;
  --surface-2: #342a25;
  --ink: #fff8ef;
  --muted: #c1b5ab;
  --brand: #cf946b;
  --brand-2: #e4ae84;
  --brand-soft: #493428;
  --line: rgba(255, 246, 236, 0.1);
  --danger: #e09a94;
  --danger-soft: #462c2a;
  --success: #8bc5ad;
  --success-soft: #273c34;
  --amber: #e4b86e;
  --amber-soft: #443723;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 84% 6%, rgba(184, 132, 92, 0.16), transparent 27rem),
    radial-gradient(circle at 5% 88%, rgba(114, 145, 126, 0.11), transparent 25rem),
    var(--bg);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; }
button, label { -webkit-user-select: none; user-select: none; }
button { color: inherit; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
[hidden] { display: none !important; }

.app-shell {
  width: min(100%, 760px);
  min-height: 100dvh;
  margin: 0 auto;
  position: relative;
  padding: 0 22px calc(108px + var(--safe-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(28px, env(safe-area-inset-top)) 2px 22px;
}
.topbar h1, .page-heading h2 { margin: 3px 0 0; font-size: clamp(1.8rem, 7vw, 2.35rem); letter-spacing: -0.04em; }
.eyebrow, .mini-label { margin: 0; color: var(--brand-2); font-size: 0.76rem; font-weight: 800; letter-spacing: 0.02em; }
.icon-button {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  cursor: pointer;
}
.sync-button { position: relative; }
.sync-button.syncing svg { animation: float-sync 1s ease-in-out infinite; }
.sync-dot { position: absolute; top: 8px; left: 8px; width: 8px; height: 8px; border: 2px solid var(--surface); border-radius: 50%; background: var(--muted); }
.sync-dot.ready { background: var(--success); }
.sync-dot.pending { background: var(--amber); }
@keyframes float-sync { 50% { transform: translateY(-3px); } }

.network-banner {
  position: fixed;
  z-index: 50;
  inset: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  background: #2d2723;
  color: #fffaf3;
  font-size: 0.8rem;
  font-weight: 700;
}
.network-banner svg { width: 18px; height: 18px; }
.network-banner:not([hidden]) ~ .app-shell .topbar { padding-top: calc(66px + env(safe-area-inset-top)); }

.view { display: none; animation: view-in 0.3s ease; }
.view.active { display: block; }
@keyframes view-in { from { opacity: 0; transform: translateY(7px); } }

.hero-card {
  min-height: 210px;
  display: grid;
  grid-template-columns: 1fr 118px;
  align-items: center;
  gap: 22px;
  overflow: hidden;
  position: relative;
  padding: 30px;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 8% 120%, rgba(255,255,255,.24), transparent 45%),
    linear-gradient(135deg, #573825, #85563a 70%, #a26e4b);
  color: #fff8ef;
  box-shadow: var(--shadow);
}
.hero-card::after { content: ""; position: absolute; width: 180px; height: 180px; left: -70px; top: -80px; border: 1px solid rgba(255,255,255,.2); border-radius: 50%; }
.hero-kicker { font-size: 0.78rem; opacity: .78; font-weight: 700; }
.hero-card h2 { max-width: 380px; margin: 10px 0 8px; font-size: clamp(1.65rem, 6vw, 2.55rem); line-height: 1.25; letter-spacing: -0.045em; }
.hero-card p { margin: 0; color: rgba(255,255,255,.73); font-size: 0.9rem; line-height: 1.7; }
.progress-orbit { position: relative; width: 112px; height: 112px; display: grid; place-items: center; }
.progress-orbit svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); stroke-width: 3; }
.progress-orbit strong { font-size: 1.25rem; }
.orbit-track { fill: none; stroke: rgba(255,255,255,.17); }
.orbit-value { fill: none; stroke: #f6d0ac; stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset .5s ease; }

.now-card {
  margin: 20px 0 30px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(140deg, var(--surface), color-mix(in srgb, var(--surface-2) 50%, var(--surface)));
  box-shadow: 0 10px 28px rgba(73, 46, 31, .06);
}
.now-card p, .sheet-lead { margin: 10px 0 18px; color: var(--muted); font-size: .9rem; line-height: 1.7; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 15px; }
.section-heading.compact { margin: 0; }
.section-heading h2 { margin: 3px 0 0; font-size: 1.35rem; letter-spacing: -.025em; }
.feature-icon, .settings-icon { display: inline-grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; border-radius: 15px; background: var(--brand-soft); color: var(--brand); }
.feature-icon svg, .settings-icon svg { width: 21px; height: 21px; }
.section-block { margin: 30px 0; }
.text-button { border: 0; padding: 4px; background: none; color: var(--brand); font-size: .82rem; font-weight: 800; cursor: pointer; }
.text-button.centered { display: block; margin: 13px auto 0; }
.count-pill { min-width: 34px; padding: 6px 10px; text-align: center; border-radius: 99px; background: var(--surface-2); color: var(--brand); font-size: .82rem; font-weight: 800; }

.matrix-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.matrix-card { position: relative; min-height: 126px; overflow: hidden; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; padding: 17px; border: 1px solid var(--line); border-radius: 22px; cursor: pointer; text-align: right; transition: transform .2s ease, box-shadow .2s ease; }
.matrix-card:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(70,45,30,.08); }
.matrix-card strong { font-size: 1.05rem; }
.matrix-card small { display: block; margin-top: 4px; color: var(--muted); font-size: .7rem; }
.matrix-card .matrix-count { font-size: 1.75rem; line-height: 1; font-weight: 900; }
.matrix-card.now { background: var(--danger-soft); color: var(--danger); }
.matrix-card.plan { background: var(--amber-soft); color: var(--amber); }
.matrix-card.quick { background: var(--success-soft); color: var(--success); }
.matrix-card.later { background: var(--surface); color: var(--muted); }

.rescue-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; margin: 28px 0; padding: 18px; border-radius: var(--radius-lg); background: var(--brand); color: #fff9f2; box-shadow: var(--shadow); }
.rescue-card h2 { margin: 0 0 4px; font-size: 1.05rem; }
.rescue-card p { margin: 0; font-size: .75rem; color: rgba(255,255,255,.72); }
.rescue-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: rgba(255,255,255,.12); font-size: 1.5rem; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 11px 18px; border: 0; border-radius: 16px; font-weight: 800; cursor: pointer; transition: transform .15s ease, filter .15s ease; }
.button:active { transform: scale(.98); }
.button svg { width: 19px; height: 19px; }
.button-primary { background: var(--brand); color: #fffaf4; box-shadow: 0 10px 20px rgba(91,56,36,.16); }
.button-secondary { background: var(--brand-soft); color: var(--brand); }
.button-light { min-height: 40px; padding: 8px 13px; background: #fff8ee; color: #583824; font-size: .75rem; }
.button-small { min-height: 40px; padding: 8px 13px; font-size: .78rem; }
.full { width: 100%; }

.task-list { display: grid; gap: 11px; }
.task-list.roomy { margin-top: 20px; }
.task-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 13px; min-height: 80px; padding: 14px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); transition: opacity .2s ease, transform .2s ease; }
.task-card.completed { opacity: .58; }
.task-card.completed .task-title { text-decoration: line-through; }
.task-check { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface-2); color: transparent; cursor: pointer; }
.task-check svg { width: 20px; height: 20px; stroke-width: 2.5; }
.task-card.completed .task-check { background: var(--success); color: white; border-color: transparent; }
.task-body { min-width: 0; }
.task-title { display: block; margin-bottom: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .95rem; }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--muted); font-size: .68rem; }
.task-meta span { display: inline-flex; align-items: center; gap: 4px; }
.task-meta svg { width: 14px; height: 14px; }
.quadrant-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.quadrant-dot.now { background: var(--danger); }
.quadrant-dot.plan { background: var(--amber); }
.quadrant-dot.quick { background: var(--success); }
.task-menu { display: flex; gap: 2px; }
.task-menu button { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); cursor: pointer; }
.task-menu button:hover { background: var(--surface-2); color: var(--ink); }
.task-menu svg { width: 17px; height: 17px; }
.empty-state { padding: 34px 20px; border: 1px dashed color-mix(in srgb, var(--brand) 32%, transparent); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--surface) 68%, transparent); text-align: center; }
.empty-state .empty-icon { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 13px; border-radius: 18px; background: var(--brand-soft); color: var(--brand); font-size: 1.6rem; }
.empty-state h3 { margin: 0 0 6px; font-size: 1rem; }
.empty-state p { margin: 0 0 15px; color: var(--muted); font-size: .8rem; line-height: 1.7; }

.page-heading { margin: 6px 0 20px; }
.search-glyph { font-size: 1.7rem; line-height: 1; transform: rotate(-15deg); }
.search-wrap { margin-bottom: 14px; }
.search-wrap input, .full-field input, .full-field textarea, .form-grid input, .form-grid select, #recovery-code-input { width: 100%; border: 1px solid var(--line); border-radius: 15px; padding: 13px 14px; background: var(--surface); color: var(--ink); outline: none; }
input:focus, textarea:focus, select:focus { border-color: color-mix(in srgb, var(--brand) 60%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-soft) 55%, transparent); }
.filter-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-chip { flex: 0 0 auto; min-height: 38px; padding: 8px 15px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--muted); font-size: .78rem; font-weight: 700; cursor: pointer; }
.filter-chip.active { background: var(--brand); color: white; border-color: var(--brand); }

.routine-summary { display: flex; align-items: center; justify-content: space-around; margin: 16px 0 18px; padding: 22px; border-radius: var(--radius-lg); background: var(--brand); color: white; }
.routine-summary div:not(.summary-divider) { display: grid; gap: 5px; text-align: center; }
.routine-summary span { font-size: .72rem; opacity: .68; }
.routine-summary strong { font-size: 1.35rem; }
.summary-divider { width: 1px; height: 42px; background: rgba(255,255,255,.2); }
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 22px; padding: 13px 9px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.week-day { display: grid; justify-items: center; gap: 7px; font-size: .65rem; color: var(--muted); }
.week-day b { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 12px; font-size: .75rem; color: var(--ink); }
.week-day.today b { background: var(--brand); color: white; }
.routine-list { display: grid; gap: 12px; }
.routine-card { display: grid; grid-template-columns: auto 1fr auto; gap: 13px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.routine-emoji { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 16px; background: var(--brand-soft); font-size: 1.35rem; }
.routine-card h3 { margin: 0 0 5px; font-size: .95rem; }
.routine-card p { margin: 0; color: var(--muted); font-size: .7rem; }
.routine-done { width: 46px; height: 46px; border: 0; border-radius: 15px; background: var(--surface-2); color: var(--muted); font-size: 1.2rem; cursor: pointer; }
.routine-done.done { background: var(--success); color: white; }

.settings-card { display: flex; align-items: center; gap: 13px; padding: 17px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.settings-card h3 { margin: 0 0 4px; font-size: .95rem; }
.settings-card p { margin: 0; color: var(--muted); font-size: .7rem; line-height: 1.5; }
.grow { flex: 1; }
.settings-group { margin-top: 26px; }
.settings-group > h3 { margin: 0 6px 10px; color: var(--muted); font-size: .75rem; }
.settings-row { width: 100%; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 13px; padding: 15px; border: 0; border-bottom: 1px solid var(--line); background: var(--surface); text-align: right; cursor: pointer; }
.settings-row:first-of-type { border-radius: 20px 20px 0 0; }
.settings-row:last-of-type { border: 0; border-radius: 0 0 20px 20px; }
.settings-row:only-of-type { border-radius: 20px; }
.settings-row strong, .settings-row small { display: block; }
.settings-row strong { margin-bottom: 4px; font-size: .86rem; }
.settings-row small { color: var(--muted); font-size: .68rem; }
.row-chevron { width: 18px; color: var(--muted); transform: rotate(180deg); }
.file-row { color: inherit; }
.privacy-note { margin: 24px 12px 0; color: var(--muted); font-size: .7rem; line-height: 1.8; text-align: center; }

.bottom-nav {
  position: fixed;
  z-index: 30;
  right: 50%;
  bottom: 0;
  transform: translateX(50%);
  width: min(100%, 760px);
  height: calc(78px + var(--safe-bottom));
  display: grid;
  grid-template-columns: 1fr 1fr 68px 1fr 1fr;
  align-items: start;
  padding: 9px 14px var(--safe-bottom);
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}
.nav-item { display: grid; justify-items: center; gap: 3px; padding: 4px; border: 0; background: transparent; color: var(--muted); font-size: .62rem; font-weight: 700; cursor: pointer; }
.nav-item svg { width: 23px; height: 23px; }
.nav-item.active { color: var(--brand); }
.add-button { display: grid; place-items: center; width: 60px; height: 60px; margin: -28px auto 0; border: 6px solid var(--bg); border-radius: 21px; background: var(--brand); color: white; box-shadow: 0 10px 25px rgba(80, 49, 31, .28); cursor: pointer; }
.add-button svg { width: 27px; height: 27px; }

dialog { color: var(--ink); }
dialog::backdrop { background: rgba(28, 20, 16, .5); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.sheet-dialog { width: min(100%, 760px); max-width: none; max-height: 92dvh; margin: auto auto 0; padding: 0; border: 0; border-radius: 30px 30px 0 0; background: transparent; }
.sheet-dialog[open] { animation: sheet-up .28s ease; }
@keyframes sheet-up { from { transform: translateY(50px); opacity: .7; } }
.sheet { max-height: 92dvh; overflow-y: auto; padding: 12px 22px calc(28px + var(--safe-bottom)); border-radius: 30px 30px 0 0; background: var(--bg); }
.sheet-handle { width: 44px; height: 5px; margin: 2px auto 18px; border-radius: 99px; background: var(--line); }
.sheet-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.sheet-header h2 { margin: 3px 0 0; font-size: 1.5rem; }
.smart-entry { overflow: hidden; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.smart-entry textarea { width: 100%; min-height: 88px; resize: vertical; padding: 16px; border: 0; background: transparent; color: var(--ink); outline: 0; line-height: 1.7; }
.smart-actions { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.smart-action { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 50px; border: 0; border-left: 1px solid var(--line); background: transparent; color: var(--brand); font-size: .75rem; font-weight: 800; cursor: pointer; }
.smart-action:first-child { border-left: 0; }
.smart-action svg { width: 18px; height: 18px; }
.smart-action.listening { background: var(--danger-soft); color: var(--danger); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .65; } }
.ocr-progress { padding: 10px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: .72rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.form-grid label, .full-field { display: grid; gap: 7px; color: var(--muted); font-size: .72rem; font-weight: 700; }
.form-grid select { appearance: none; }
.choice-fieldset { margin: 18px 0; padding: 0; border: 0; }
.choice-fieldset legend { margin-bottom: 8px; color: var(--muted); font-size: .72rem; font-weight: 700; }
.segmented { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px; padding: 4px; border-radius: 15px; background: var(--surface-2); }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 10px; border-radius: 12px; text-align: center; color: var(--muted); font-size: .78rem; font-weight: 800; }
.segmented input:checked + span { background: var(--surface); color: var(--brand); box-shadow: 0 3px 10px rgba(60,40,28,.08); }
.full-field { margin: 14px 0 18px; }
.full-field textarea { resize: vertical; }
.option-grid { display: grid; gap: 8px; }
.option-grid.four { grid-template-columns: repeat(4, 1fr); }
.option-grid.three { grid-template-columns: repeat(3, 1fr); }
.option-grid button { min-height: 44px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--muted); font-size: .76rem; font-weight: 800; cursor: pointer; }
.option-grid button.active { background: var(--brand); color: white; border-color: var(--brand); }
.focus-result { margin-top: 16px; padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.focus-result .focus-tag { display: inline-block; margin-bottom: 8px; padding: 5px 9px; border-radius: 99px; background: var(--brand-soft); color: var(--brand); font-size: .65rem; font-weight: 800; }
.focus-result h3 { margin: 0 0 7px; font-size: 1.1rem; }
.focus-result p { margin: 0 0 14px; color: var(--muted); font-size: .75rem; line-height: 1.6; }
.rescue-preview { display: grid; gap: 8px; margin: 14px 0 20px; }
.rescue-preview div { display: flex; justify-content: space-between; gap: 16px; padding: 12px; border-radius: 14px; background: var(--surface); font-size: .76rem; }
.rescue-preview span { color: var(--muted); }
.days-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.days-grid label { cursor: pointer; }
.days-grid input { position: absolute; opacity: 0; }
.days-grid span { display: grid; place-items: center; height: 40px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--muted); font-size: .75rem; }
.days-grid input:checked + span { background: var(--brand); color: white; border-color: var(--brand); }
.or-line { display: flex; align-items: center; gap: 10px; margin: 17px 0; color: var(--muted); font-size: .7rem; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.recovery-result { margin-top: 15px; padding: 15px; border-radius: 16px; background: var(--success-soft); color: var(--success); font-size: .75rem; line-height: 1.7; word-break: break-all; }

.onboarding-dialog { width: min(calc(100% - 30px), 440px); padding: 0; border: 0; border-radius: 30px; background: transparent; }
.onboarding-card { padding: 30px; border-radius: 30px; background: var(--bg); text-align: center; }
.brand-mark { display: grid; place-items: center; width: 76px; height: 76px; margin: 0 auto 18px; border-radius: 25px; background: var(--brand); color: white; font-size: 1.9rem; font-weight: 900; box-shadow: var(--shadow); }
.onboarding-card h2 { margin: 3px 0 10px; font-size: 2rem; }
.onboarding-card > p { margin: 0 auto 22px; color: var(--muted); font-size: .86rem; line-height: 1.8; }
.onboarding-card ul { display: grid; gap: 11px; margin: 0 0 22px; padding: 0; list-style: none; text-align: right; }
.onboarding-card li { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .76rem; }
.onboarding-card li span { display: grid; place-items: center; flex: 0 0 auto; width: 28px; height: 28px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); font-weight: 900; }

.toast { position: fixed; z-index: 100; right: 50%; bottom: calc(96px + var(--safe-bottom)); transform: translate(50%, 25px); width: max-content; max-width: calc(100% - 40px); padding: 12px 17px; border-radius: 14px; background: #28221f; color: white; box-shadow: var(--shadow); font-size: .75rem; font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.show { opacity: 1; transform: translate(50%, 0); }

@media (min-width: 761px) {
  body { padding: 24px 0; }
  .app-shell { min-height: calc(100dvh - 48px); border: 1px solid var(--line); border-radius: 36px; background: color-mix(in srgb, var(--bg) 90%, transparent); box-shadow: 0 30px 80px rgba(57,37,26,.12); }
  .bottom-nav { bottom: 24px; border: 1px solid var(--line); border-radius: 0 0 36px 36px; }
  .sheet-dialog { width: min(680px, calc(100% - 40px)); margin: auto; border-radius: 30px; }
  .sheet { border-radius: 30px; }
}

@media (max-width: 480px) {
  .app-shell { padding-inline: 16px; }
  .hero-card { min-height: 190px; grid-template-columns: 1fr 92px; padding: 23px 20px; }
  .hero-card h2 { font-size: 1.65rem; }
  .progress-orbit { width: 90px; height: 90px; }
  .matrix-card { min-height: 118px; padding: 15px; }
  .rescue-card { grid-template-columns: auto 1fr; }
  .rescue-card .button { grid-column: 1 / -1; }
  .form-grid { grid-template-columns: 1fr; }
  .sheet { padding-inline: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

