/* Luminous: the shared presentation for every screen. Domain and layout
   utilities remain in styles.css; all new visual decisions live here. */
:root {
  --canvas: #f6f3fc;
  --surface: #fff;
  --surface-2: #f1edf8;
  --surface-3: #e6e0f0;
  --surface-glass: rgba(255,255,255,.92);
  --text: #292338;
  --text-soft: #6c627c;
  --text-faint: #82768f;
  --line: rgba(86,60,124,.13);
  --brand: #7352c9;
  --brand-hover: #5736ad;
  --brand-soft: #eee7ff;
  --brand-ink: #fff;
  --radius-md: 22px;
  --radius-lg: 28px;
  --shadow-sm: 0 2px 5px #44306906;
  --shadow-md: 0 10px 35px #49316d09;
  --shadow-lg: 0 24px 80px #38204e24;
  --section-accent: #7352c9;
  --section-soft: #eee7ff;
  --section-ink: #fff;
}
[data-theme="dark"] {
  --canvas: #11101a;
  --surface: #1d1b2b;
  --surface-2: #242133;
  --surface-3: #322d45;
  --surface-glass: rgba(27,24,40,.94);
  --surface-hover: #292438;
  --text: #f5f1fc;
  --text-soft: #b7accb;
  --text-faint: #9689ab;
  --line: rgba(204,182,242,.14);
  --brand: #c0a6f5;
  --brand-hover: #d9c5ff;
  --brand-soft: #312743;
  --brand-ink: #20132f;
  --section-accent: #c0a6f5;
  --section-soft: #312743;
  --section-ink: #20132f;
  --shadow-md: 0 14px 36px #05030b24;
}
body[data-section="kitchen"] { --section-accent: #257458; --section-soft: #dff2e8; }
body[data-section="life"] { --section-accent: #a1467a; --section-soft: #f9e3f0; }
body[data-section="prices"] { --section-accent: #98600c; --section-soft: #fbefd7; }
[data-theme="dark"] body[data-section="kitchen"] { --section-accent: #91d8b8; --section-soft: #203a33; }
[data-theme="dark"] body[data-section="life"] { --section-accent: #e5a9d1; --section-soft: #3e293b; }
[data-theme="dark"] body[data-section="prices"] { --section-accent: #ecc485; --section-soft: #3c3225; }
body, [data-theme="dark"] body {
  background:
    radial-gradient(ellipse at 95% 0, color-mix(in srgb,var(--section-accent) 11%,transparent),transparent 46%),
    radial-gradient(ellipse at 0 90%,color-mix(in srgb,var(--brand) 7%,transparent),transparent 42%),var(--canvas);
}
button, input, textarea, select { font-family: var(--font); }
button { touch-action: manipulation; }
button:focus-visible, [data-tx]:focus-visible {
  outline: 3px solid var(--section-accent); outline-offset: 3px;
}
button:disabled { opacity: .5; cursor: wait; }
.topbar { padding-top: calc(18px + env(safe-area-inset-top)); padding-bottom: 12px; gap: 14px; }
.topbar h1 { font-size: clamp(24px,4vw,32px); font-weight: 700; letter-spacing: -.045em; white-space: normal; overflow-wrap: anywhere; }
.eyebrow { color: var(--section-accent); font-size: 11px; font-weight: 600; letter-spacing: .025em; }
.body { gap: 18px; padding-top: 12px; overscroll-behavior-y: contain; }
.iconbtn, .burger, .avatar { border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm); }
.avatar { color: var(--section-accent); background: var(--section-soft); border-color: transparent; }
.card, .list, [data-theme="dark"] .card, [data-theme="dark"] .list {
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  box-shadow: var(--shadow-md); min-width: 0;
}
.card.card-pad, .screen-home .zone-rail .card.card-pad { padding: 20px; border-radius: 22px; }
.card-title, .screen-home .zone-rail .card-title { font-size: 16px; font-weight: 600; }
.card-head { margin-bottom: 14px; gap: 10px; }
.card-head button:not(.iconbtn), .link, .cmp-del { min-height: 44px; min-width: 44px; }
.section-caption { font-size: 12px; line-height: 1.7; color: var(--text-soft); }
.hero, .screen-home .hero, .hero-kitchen,
[data-theme="dark"] .hero, [data-theme="dark"] .hero-kitchen {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: 0; padding: 24px; border-radius: 28px;
  color: var(--text); border: 1px solid color-mix(in srgb,var(--section-accent) 26%,var(--line));
  background: radial-gradient(ellipse at 100% 0,color-mix(in srgb,var(--section-accent) 20%,transparent),transparent 66%),
    linear-gradient(140deg,var(--section-soft),var(--surface));
  box-shadow: var(--shadow-md);
}
.hero > *, .hero-kitchen > * { position: relative; z-index: 1; }
.hero .hero-label, [data-theme="dark"] .hero .hero-label { color: var(--text-soft); opacity: 1; }
.hero .hero-amount, .screen-home .hero-amount { font-size: clamp(34px,9vw,46px); line-height: 1.2; margin-top: 8px; overflow-wrap: anywhere; }
.hero.hero-slim .hero-amount { font-size: clamp(25px,6vw,34px); }
.hero-meta, .screen-home .hero-meta { color: var(--text-soft); opacity: 1; font-size: 12px; line-height: 1.6; }
.hero-stats, .screen-home .hero-stats, [data-theme="dark"] .hero-stats {
  position: relative; inset: auto; margin-top: 22px; padding: 13px 6px;
  border: 1px solid var(--line); border-radius: 18px;
  background: color-mix(in srgb,var(--surface) 75%,transparent); backdrop-filter: none;
}
.hero-stat + .hero-stat { border-color: var(--line); }
.hero-stat .lbl { color: var(--text-soft); opacity: 1; font-size: 12px; }
.hero-stat .val { overflow-wrap: anywhere; }
.hero-kitchen { gap: 24px; }
.hero-kitchen .eyebrow { color: var(--section-accent); }
.hero-row { align-items: center; flex-wrap: wrap; }
.quick { gap: 10px; }
.quick button, .screen-home .quick button, [data-theme="dark"] .quick button {
  min-height: 90px; padding: 12px 4px; gap: 8px; border-radius: 21px;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.quick .qi, .screen-home .quick .qi { width: 36px; height: 36px; border-radius: 13px; }
.quick [data-add-quick="expense"] .qi { color: var(--expense); background: var(--expense-soft); }
.quick [data-add-quick="income"] .qi { color: var(--income); background: var(--income-soft); }
.seg { padding: 4px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-2); }
.seg button, .screen-home .seg button { min-height: 44px; border-radius: 13px; padding: 0 10px; font-weight: 600; }
.seg button[aria-selected="true"], .section-tabs button[aria-selected="true"] {
  color: var(--section-accent); background: var(--surface); box-shadow: 0 2px 8px #00000009;
}
.chip { min-height: 44px; border-radius: 14px; padding: 0 14px; font-size: 12px; }
.chip[aria-pressed="true"] { background: var(--section-soft); color: var(--section-accent); border-color: color-mix(in srgb,var(--section-accent) 32%,transparent); }
.cal-card { padding: 0; border-radius: 22px; }
.weekdays { padding: 15px 0 12px; color: var(--text-soft); }
.calendar, .screen-home .calendar { grid-auto-rows: 76px; }
.day, .screen-home .day { padding: 6px 2px; gap: 3px; }
.day .d, .screen-home .day .d { width: 28px; height: 28px; border-radius: 10px; font-size: 12px; }
.day .amt, .screen-home .day .amt { font-size: 10px; }
.day.today { background: var(--section-soft); }
.day.today .d { background: var(--section-accent); color: var(--section-ink); border-radius: 10px; }
.plan-cal { grid-auto-rows: 110px; }
.life-cal { grid-auto-rows: 84px; }
.row, .stock-row, .task-row { min-height: 82px; padding: 16px; gap: 12px; }
.row .name, .stock-text .name, .task-text .name { white-space: normal; overflow-wrap: anywhere; font-size: 14px; }
.tile, .stock-icon, [data-theme="dark"] .tile, [data-theme="dark"] .stock-icon { background: var(--section-soft); color: var(--section-accent); border-radius: 14px; }
.stock-qty { font-size: 12px; max-width: 94px; white-space: normal; text-align: right; overflow-wrap: anywhere; }
.group-head { margin: 12px 4px 4px; font-size: 12px; }
.totals { gap: 10px; flex-wrap: wrap; }
.totals .val { font-size: clamp(16px,4.3vw,22px); overflow-wrap: anywhere; }
.bar-track { height: 7px; background: var(--surface-3); }
.bar-fill { background: var(--section-accent); }
.recipe-list { display: grid; padding: 10px; gap: 10px; }
.recipe-row { border: 1px solid var(--line); border-radius: 17px; padding: 18px; background: var(--surface-2); }
.recipe-row + .recipe-row { border-top: 1px solid var(--line); }
.recipe-name { font-size: 16px; }
.tick { border-radius: 9px; width: 25px; height: 25px; }
.task-row.is-done { background: color-mix(in srgb,var(--section-soft) 55%,var(--surface)); }
.task-row.is-done .tick { background: var(--section-accent); border-color: var(--section-accent); color: var(--section-ink); }
.note-card { border-top: 3px solid var(--section-accent); }
.note-card.is-pinned { background: linear-gradient(145deg,var(--section-soft),var(--surface)); }
.note-pin { width: 44px; height: 44px; }
.note-body { font-size: 14px; line-height: 1.9; }
.pack { padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface-2); }
.pack-name { font-size: 16px; color: var(--section-accent); }
.pack-grid { gap: 14px; }
.mini > span { font-size: 12px; }
.cmp-line { border-radius: 14px; padding: 14px; gap: 8px; flex-wrap: wrap; }
.cmp-line.win { border: 1px solid var(--income); background: var(--income-soft); }
.field-label { font-size: 12px; font-weight: 600; }
.field input, .field select, .mini input, .inp, .note-input,
[data-theme="dark"] .field input, [data-theme="dark"] .field select {
  min-height: 50px; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 14px; font-size: 16px;
}
.field input:focus, .field select:focus, .mini input:focus, .inp:focus, .note-input:focus {
  outline: 0; border-color: var(--section-accent); box-shadow: 0 0 0 3px var(--section-soft);
}
.field-btn .field-val { width: 100%; margin-left: 0; justify-content: space-between; min-height: 50px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.amount-input { color: var(--section-accent); font-size: clamp(36px,10vw,56px); padding: 20px 8px; }
.is-stack .body > .card:has(> .field) { padding: 20px; }
.is-stack .chips { flex-wrap: wrap; overflow: visible; }
.is-stack .line-8 { flex-wrap: wrap; }
.btn-primary, [data-theme="dark"] .btn-primary, .fab, [data-theme="dark"] .fab {
  position: relative; isolation: isolate; overflow: hidden;
  color: var(--section-ink); background: var(--section-accent);
  border: 1px solid color-mix(in srgb,var(--section-accent) 80%,white); border-radius: 16px;
  box-shadow: 0 7px 20px color-mix(in srgb,var(--section-accent) 18%,transparent);
}
.btn-primary, .btn-secondary, .btn-danger, .btn-surface, .btn-ghost { min-height: 48px; border-radius: 16px; }
.btn-danger { color: #fff; background: #b52f50; }
.fab, [data-theme="dark"] .fab { position: fixed; border-radius: 21px; bottom: calc(104px + env(safe-area-inset-bottom)); }
.actionbar { background: var(--surface-glass); border-top: 1px solid var(--line); padding-top: 14px; }
.actionbar .btn-primary { border-radius: 16px; }
.nav, [data-theme="dark"] .nav {
  background: var(--surface-glass); border: 1px solid var(--line); border-radius: 24px;
  box-shadow: 0 8px 30px #29193c15; backdrop-filter: blur(18px);
}
.nav button { gap: 5px; border-radius: 18px; font-size: 11px; }
.nav button[aria-current="page"], [data-theme="dark"] .nav button[aria-current="page"] { color: var(--section-accent); background: var(--section-soft); box-shadow: none; }
.drawer, [data-theme="dark"] .drawer { background: var(--surface-glass); border-color: var(--line); }
.drawer-list { gap: 10px; }
.drawer-row { border: 1px solid transparent; border-radius: 19px; padding: 12px; }
.drawer-row[aria-current="true"] { border-color: var(--line); background: var(--section-soft); color: var(--section-accent); }
.section-blurb { color: var(--text-soft); line-height: 1.6; }
.sheet, [data-theme="dark"] .sheet, .ask { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); }
.sheet:not(.open) { pointer-events: none; visibility: hidden; }
.sheet.open { visibility: visible; }
.pick-row { min-height: 54px; border-radius: 16px; }
.pick-row[aria-selected="true"] { color: var(--section-accent); background: var(--section-soft); border-color: var(--section-accent); }
.empty, .soon { padding: 38px 22px; border: 1px dashed var(--line); border-radius: 24px; background: var(--surface); line-height: 1.8; }
.banner, .ok-banner { border-radius: 18px; line-height: 1.8; }
/* The prototype stylesheet still contains an older toast that positions every
   message against the viewport. The real app positions the host instead; reset
   the child here so short confirmations stay compact and long errors wrap
   inside the phone rather than spilling past its right edge. */
.toast {
  position: relative;
  inset: auto;
  width: fit-content;
  max-width: 100%;
  align-self: center;
}
.search input, #search { min-height: 48px; font-size: 16px !important; }
/* All decoration is behind content and cannot intercept a click. */
.hero::before, .hero-kitchen::before {
  content: ''; position: absolute; z-index: 0; inset: -70%; pointer-events: none;
  background: linear-gradient(115deg,transparent 45%,#ffffff24 49%,transparent 53%);
  transform: translateX(-45%) rotate(-8deg); animation: luminous-sweep 9s ease-in-out infinite;
}
.hero::after, .hero-kitchen::after, [data-theme="dark"] .hero::after {
  content: ''; position: absolute; z-index: 0; inset: 16px 12px auto auto;
  width: 110px; height: 88px; border: 0; border-radius: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, var(--section-accent) 0 15%,transparent 65%) 20px 5px / 3px 17px no-repeat,
    radial-gradient(ellipse at center, var(--section-accent) 0 15%,transparent 65%) 13px 12px / 17px 3px no-repeat,
    radial-gradient(circle,var(--section-accent) 1px,transparent 2px) 65px 43px / 7px 7px no-repeat,
    radial-gradient(circle,var(--section-accent) 1px,transparent 2px) 85px 17px / 5px 5px no-repeat;
  animation: luminous-twinkle 5s ease-in-out infinite;
}
.btn-primary::after, .fab::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg,transparent 25%,#ffffff30 50%,transparent 75%);
  transform: translateX(-120%); animation: luminous-button 7s ease-in-out infinite;
}
.body .row, .day-section .row { animation: none; }
button { transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease, scale .18s ease; }
button:active:not(:disabled) { scale: .97; }
.bar-fill { transition: width .35s ease; }
.tick { transition: background .2s ease, border-color .2s ease; }
@keyframes luminous-sweep { 0%,25% { transform: translateX(-45%) rotate(-8deg); } 65%,100% { transform: translateX(45%) rotate(-8deg); } }
@keyframes luminous-twinkle { 0%,100% { opacity: .25; transform: scale(.9); } 50% { opacity: .8; transform: scale(1.08); } }
@keyframes luminous-button { 0%,70% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
@media (hover:hover) {
  .quick button:hover, [data-theme="dark"] .quick button:hover, .recipe-row:hover { background: var(--section-soft); border-color: var(--section-accent); }
  .btn-primary:hover, .fab:hover { box-shadow: 0 8px 28px color-mix(in srgb,var(--section-accent) 30%,transparent); }
}
/* Legacy dark rules are component-specific; keep the new selected states
   equally specific so they cannot quietly fall back to the old palette. */
[data-theme="dark"] .seg, [data-theme="dark"] .chip,
[data-theme="dark"] .search input { background: var(--surface-2); color: var(--text); }
[data-theme="dark"] .seg button[aria-selected="true"] { background: var(--surface); color: var(--section-accent); }
[data-theme="dark"] .chip[aria-pressed="true"] { background: var(--section-soft); color: var(--section-accent); }
[data-theme="dark"] .ask, [data-theme="dark"] #pick { background: var(--surface); border-color: var(--line); }
[data-theme="dark"] .amount-input { background: transparent; color: var(--section-accent); }
.page-intro { display: flex; align-items: center; gap: 16px; padding: 20px; background: var(--section-soft); border-radius: 22px; }
.page-intro .intro-icon { display: grid; place-items: center; width: 46px; height: 46px; flex: none; color: var(--section-accent); background: var(--surface); border-radius: 16px; }
.intro-icon svg { width: 24px; height: 24px; }
.page-intro h2 { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.page-intro p { font-size: 12px; color: var(--text-soft); line-height: 1.7; }
.note-grid { display: grid; gap: 14px; }
.note-grid .note-card { min-width: 0; }
.login-screen { overflow-y: auto; padding: max(28px,env(safe-area-inset-top)) 20px max(28px,env(safe-area-inset-bottom)); }
.login-content { width: min(100%,440px); margin: auto; display: grid; gap: 24px; }
.login-brand { display: flex; align-items: center; gap: 12px; font-size: 24px; }
.login-brand > span { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 17px; color: var(--brand-ink); background: var(--brand); }
.login-brand svg { width: 26px; height: 26px; }
.login-welcome { padding: 30px 24px; }
.login-welcome h1 { font-size: clamp(26px,7vw,34px); line-height: 1.45; margin: 14px 0; letter-spacing: -.03em; }
.login-welcome p { font-size: 13px; line-height: 1.9; color: var(--text-soft); }
.login-features { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; }
.login-features > div { display: grid; place-items: center; gap: 9px; padding: 14px 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; font-size: 12px; }
.login-features svg { width: 23px; height: 23px; color: var(--brand); }
.login-privacy { text-align: center; color: var(--text-soft); font-size: 12px; line-height: 1.8; }
#app:has(.login-screen) { padding-left: 0; }
body:has(.login-screen) #drawer, body:has(.login-screen) #drawer-scrim { display: none; }
.wallet-create { border-top: 1px solid var(--line); padding-top: 16px; display: grid; grid-template-columns: 44px minmax(0,1fr); gap: 10px; }
.wallet-create input { width: 100%; min-width: 0; min-height: 48px; padding: 10px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); color: var(--text); font-size: 16px; }
.wallet-create #new-wallet-opening { grid-column: 1 / -1; }
.wallet-create button { grid-column: 1 / -1; }
.screen[data-screen="settings"] input { min-width: 0; }
.screen[data-screen="settings"] .line-12 > div { min-width: 0; overflow-wrap: anywhere; }
.screen[data-screen="settings"] [data-wallet-archive], .screen[data-screen="settings"] [data-signout] { min-width: 44px; min-height: 44px; }
.screen[data-screen="recipes"] .recipe-row .bar-track { margin: 8px 0; }
@media (min-width:1024px) {
  .topbar { padding: 28px 36px 16px; }
  .section-tabs { margin-top: 0; background: var(--surface-2); border-radius: 18px; }
  .body { padding-top: 24px; }
  .fab, [data-theme="dark"] .fab { bottom: 32px; }
  .drawer { padding-top: 36px; }
  .screen.is-stack .body { max-width: 760px; padding-inline: 28px; align-items: stretch; }
  .is-stack .actionbar { left: var(--sidebar); max-width: 760px; padding-inline: 28px; }
}
@media (min-width:1180px) {
  .body { grid-template-columns: minmax(0,1fr) minmax(290px,350px); gap: 20px 28px; }
  .zone-rail { margin-top: 0; }
  .body:has(> .zone-top > .seg) .zone-rail { margin-top: 74px; }
  .day { min-height: 90px; }
  .calendar, .screen-home .calendar { grid-auto-rows: 90px; }
  .plan-cal { grid-auto-rows: 112px; }
  .screen.is-stack .body { display: flex; }
  .recipe-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .note-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .recipe-row .line { flex-wrap: wrap; gap: 6px; }
}
@media (max-width:359px) {
  .body { padding-inline: 12px; }
  .quick { gap: 6px; }
  .hero, .screen-home .hero { padding: 18px; }
  .hero-stat .val, .screen-home .hero-stat .val { font-size: 14px; }
  .card.card-pad, .screen-home .zone-rail .card.card-pad { padding: 15px; }
}
@media (prefers-reduced-motion:reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  button:active:not(:disabled) { scale: 1; transform: none; }
}
