
:root{
  --turq:#0f9fa2; --turq-dark:#087b7e; --turq-soft:#e6f7f7; --ink:#182224;
  --muted:#6b7779; --bg:#f6f9f9; --card:#ffffff; --line:#dfe8e8;
  --green:#2f8f57; --yellow:#b8860b; --red:#c83e3e; --blue:#2876b8; --gray:#7b8588;
  --shadow:0 8px 24px rgba(10,70,72,.08);
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%;background:var(--bg)}
body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif;background:var(--bg);color:var(--ink);font-size:18px}
button,input,select{font:inherit}
button{cursor:pointer}
.hidden{display:none!important}
.splash{position:fixed;inset:0;z-index:1000;background:linear-gradient(180deg,#fbffff 0%,#e9f9f9 56%,#bceced 100%);display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:30px}
.splash-icon{width:min(58vw,270px);border-radius:28%;box-shadow:0 16px 38px rgba(6,92,96,.15)}
.splash-brand{margin-top:18px;font-family:Georgia,serif;font-size:48px;letter-spacing:3px;color:var(--turq-dark)}
.splash-sub{font-size:25px;font-weight:800;color:var(--turq-dark)}
.splash-love{margin-top:34px;font-size:21px;font-weight:700;color:#4f6062}
.app{max-width:760px;margin:0 auto;min-height:100vh;padding-bottom:98px}
.topbar{display:flex;justify-content:space-between;align-items:center;padding:calc(16px + env(safe-area-inset-top)) 16px 12px;background:rgba(246,249,249,.96);position:sticky;top:0;z-index:20;border-bottom:1px solid var(--line);backdrop-filter:blur(16px)}
.greeting{font-size:18px;color:var(--muted);font-weight:700}
.brand{font-family:Georgia,serif;font-size:32px;letter-spacing:2px;color:var(--turq-dark);font-weight:700}
.subtitle{font-size:18px;font-weight:800}
.mini-logo{width:60px;height:60px;border-radius:18px;box-shadow:var(--shadow)}
.view{display:none;padding:14px}
.view.active{display:block}
.page-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:4px 0 14px}
.page-head h1{margin:0;font-size:28px}
.section-card,.cycle-card,.analysis-card{background:var(--card);border:1px solid var(--line);border-radius:22px;padding:17px;box-shadow:var(--shadow);margin-bottom:14px}
.section-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}
.section-head h2{margin:0;font-size:23px}
.cycle-label{font-weight:900;font-size:22px}
.cycle-date{color:var(--muted);margin:3px 0 14px}
.money-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:9px}
.metric{background:#f8fbfb;border-radius:16px;padding:12px 8px;text-align:center;border:1px solid #e6eeee}
.metric .n{display:block;font-size:22px;font-weight:900;margin-top:4px}
.metric .l{font-size:15px;color:var(--muted);font-weight:700}
.progress{height:12px;background:#e8efef;border-radius:999px;overflow:hidden;margin-top:14px}
.progress>i{display:block;height:100%;background:var(--turq);border-radius:999px;transition:width .25s ease}
.quick-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:14px}
.quick{min-height:82px;border:0;border-radius:20px;background:#fff;box-shadow:var(--shadow);font-size:28px;font-weight:900;color:var(--ink);display:flex;align-items:center;justify-content:center;gap:10px;padding:12px}
.quick span{font-size:18px}
.quick.primary{background:var(--turq);color:white}
.balance-grid{display:grid;grid-template-columns:1fr 1fr;gap:9px}
.balance{border:1px solid var(--line);border-radius:17px;padding:12px;background:#fbfdfd}
.balance .title{font-size:16px;font-weight:800;color:#445254}
.balance .amount{font-size:23px;font-weight:900;margin-top:5px}
.reminder{background:#fff9e8;border:1px solid #f0dc9f;border-radius:17px;padding:12px;margin-bottom:9px;font-weight:700}
.bottom-nav{position:fixed;bottom:0;left:0;right:0;z-index:30;background:rgba(255,255,255,.96);border-top:1px solid var(--line);display:grid;grid-template-columns:repeat(5,1fr);padding:7px max(8px,calc((100vw - 760px)/2 + 8px)) calc(7px + env(safe-area-inset-bottom));backdrop-filter:blur(18px)}
.nav-btn{border:0;background:transparent;font-size:23px;color:#617073;padding:6px 2px;min-height:58px}
.nav-btn span{display:block;font-size:12px;font-weight:800;margin-top:2px}
.nav-btn.active{color:var(--turq-dark)}
.backdrop{position:fixed;inset:0;z-index:100;background:rgba(0,0,0,.38);display:flex;align-items:flex-end;justify-content:center}
.sheet{width:min(760px,100%);background:#fff;border-radius:28px 28px 0 0;max-height:94vh;overflow:auto;padding:16px 15px calc(24px + env(safe-area-inset-bottom));box-shadow:0 -14px 50px rgba(0,0,0,.2)}
.sheet-head{display:flex;justify-content:space-between;align-items:center;position:sticky;top:-16px;background:#fff;padding:12px 0 10px;z-index:3}
.sheet-head h2{margin:0;font-size:27px}
.icon-btn{border:0;background:#eef3f3;width:48px;height:48px;border-radius:50%;font-size:25px}
.field{margin:13px 0}
.field label{display:block;font-size:18px;font-weight:900;margin-bottom:6px}
.input,.select{width:100%;border:1.5px solid #cddada;background:#fff;border-radius:15px;min-height:56px;padding:10px 12px;font-size:21px;color:var(--ink)}
.input.big{font-size:31px;font-weight:900;text-align:center}
.row{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.categories{display:grid;grid-template-columns:repeat(3,1fr);gap:9px}
.cat{min-height:92px;border:1.5px solid #d9e5e5;border-radius:17px;background:#fbfefe;padding:8px 5px;font-weight:900;font-size:15px;color:var(--ink)}
.cat .ico{display:block;font-size:27px;margin-bottom:4px}
.cat.selected{border-color:var(--turq);background:var(--turq-soft);color:var(--turq-dark)}
.choice-grid{display:grid;grid-template-columns:1fr 1fr;gap:9px}
.choice{min-height:58px;border:1.5px solid #d4e1e1;background:#fff;border-radius:15px;font-weight:900}
.choice.selected{background:var(--turq-soft);border-color:var(--turq);color:var(--turq-dark)}
.save-bar{position:sticky;bottom:-24px;background:linear-gradient(transparent,#fff 20%);padding-top:24px;margin-top:15px}
.btn{width:100%;border:0;border-radius:17px;min-height:58px;font-weight:900;padding:11px 14px}
.btn.primary{background:var(--turq);color:#fff}
.btn.secondary{background:#edf2f2;color:var(--ink)}
.btn.danger{background:#fff0f0;color:#a92f2f;border:1px solid #f2caca}
.btn-row{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.error{color:var(--red);font-size:15px;font-weight:800;margin-top:5px}
.hint{color:var(--muted);font-size:15px;line-height:1.5}
.status{display:inline-flex;align-items:center;border-radius:999px;padding:5px 9px;font-size:14px;font-weight:900}
.status.green{background:#eaf6ee;color:var(--green)}
.status.yellow{background:#fff6d9;color:#8f6900}
.status.red{background:#ffeded;color:var(--red)}
.status.blue{background:#e9f3fb;color:var(--blue)}
.status.gray{background:#eef1f1;color:var(--gray)}
.category-row{border:1px solid var(--line);border-radius:18px;padding:13px;margin:9px 0;background:#fff}
.category-top{display:flex;justify-content:space-between;gap:10px;align-items:center}
.category-name{font-weight:900;font-size:19px}
.category-money{font-weight:900}
.mini-progress{height:8px;background:#edf1f1;border-radius:999px;overflow:hidden;margin-top:10px}
.mini-progress i{display:block;height:100%;background:var(--turq)}
.insight{border-right:4px solid var(--turq);padding:9px 12px;background:#f5fbfb;border-radius:12px;margin:7px 0}
.compact-select{border:1px solid var(--line);border-radius:12px;background:#fff;padding:8px 10px;max-width:46%}
.search-wrap{margin-bottom:10px}
.search-wrap input{width:100%;min-height:54px;border-radius:17px;border:1px solid var(--line);padding:10px 14px;font-size:19px}
.chips{display:flex;gap:7px;overflow:auto;padding-bottom:8px}
.chip{white-space:nowrap;border:1px solid var(--line);background:#fff;border-radius:999px;padding:8px 12px;font-weight:800}
.chip.active{background:var(--turq);color:white;border-color:var(--turq)}
.day-group{margin:14px 0}
.day-title{font-size:18px;font-weight:900;color:#516062;margin:0 4px 7px}
.tx{display:flex;justify-content:space-between;gap:10px;align-items:center;background:#fff;border:1px solid var(--line);border-radius:16px;padding:12px;margin:7px 0}
.tx-main{font-weight:900}
.tx-sub{color:var(--muted);font-size:15px;margin-top:3px}
.tx-amt{font-size:20px;font-weight:900;white-space:nowrap}
.cycle-archive{background:#fff;border:1px solid var(--line);border-radius:18px;padding:14px;margin:10px 0}
.settings-group{background:#fff;border:1px solid var(--line);border-radius:20px;margin-bottom:12px;overflow:hidden}
.settings-group h2{font-size:20px;margin:0;padding:14px;border-bottom:1px solid var(--line)}
.settings-item{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:14px;border-bottom:1px solid #edf2f2;background:#fff}
.settings-item:last-child{border-bottom:0}
.settings-item button{border:0;background:transparent;color:var(--turq-dark);font-weight:900}
.toast{position:fixed;z-index:200;left:50%;transform:translateX(-50%);bottom:calc(86px + env(safe-area-inset-bottom));background:#1e2b2c;color:#fff;border-radius:14px;padding:11px 15px;box-shadow:0 8px 24px rgba(0,0,0,.25);font-weight:800}
.toast button{border:0;background:transparent;color:#8fe5e7;font-weight:900;margin-right:8px}
.calc{display:grid;grid-template-columns:repeat(4,1fr);gap:7px;margin-top:8px}
.calc button{border:0;background:#eff5f5;border-radius:12px;min-height:44px;font-weight:900}
@media (max-width:390px){
  body{font-size:17px}
  .categories{gap:7px}
  .cat{font-size:14px;min-height:88px}
  .money-grid{grid-template-columns:1fr}
}
@media (min-width:700px){.app{border-left:1px solid var(--line);border-right:1px solid var(--line)}}

/* Approved category visual language */
.cat[data-cat="house"]{background:#eef8ef;border-color:#cfe6d1}
.cat[data-cat="pharmacy"]{background:#eef6fb;border-color:#d0e2ee}
.cat[data-cat="jazz"]{background:#fff;border:2px solid #222;color:#111}
.cat[data-cat="water"]{background:#edf8fb;border-color:#cae7ee}
.cat[data-cat="bills"]{background:#fff9e9;border-color:#eedda7}
.cat[data-cat="personal"]{background:#fff1f5;border-color:#f0d2dc}
.cat[data-cat="gifts"]{background:#f7f0fb;border-color:#dfcdef}
.cat[data-cat="subs"]{background:#f1f1fb;border-color:#d3d3ed}
.cat[data-cat="helper"]{background:#eef9f7;border-color:#cfe7e2}
.cat[data-cat="guard"]{background:#f7f2ed;border-color:#dfd0c2}
.cat[data-cat="tax"]{background:#f3f4f4;border-color:#daddde}
.cat[data-cat="other"]{background:#fafafa;border-color:#dedede}

/* Build 004 - real-device onboarding fixes */
.backdrop.onboarding{
  align-items:stretch;
  background:#f6f9f9;
  padding:0;
}
.backdrop.onboarding .sheet{
  width:100%;
  max-width:760px;
  max-height:none;
  min-height:100vh;
  border-radius:0;
  box-shadow:none;
  margin:0 auto;
  padding:calc(18px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
}
.backdrop.onboarding .sheet-head{
  position:static;
  padding:0 0 10px;
  background:transparent;
}
.wizard-step{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:8px;
}
.wizard-step .step-count{
  color:var(--muted);
  font-size:15px;
  font-weight:800;
}
.wizard-title{font-size:29px!important}
.wizard-back{
  border:0;
  background:#edf4f4;
  min-width:78px;
  min-height:46px;
  border-radius:14px;
  color:var(--turq-dark);
  font-weight:900;
}
.field label{margin-bottom:10px}
.cat .ico{font-size:29px}
.display-date{
  width:100%;
  min-height:58px;
  border:1.5px solid #cddada;
  background:#fff;
  border-radius:15px;
  padding:12px 14px;
  font-size:21px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  color:var(--ink);
  font-weight:800;
}
.display-date small{color:var(--muted);font-weight:700}
.hidden-date-picker{
  position:absolute;
  opacity:0;
  width:1px;
  height:1px;
  left:-9999px;
}
.bill-note{
  background:var(--turq-soft);
  border:1px solid #cfe8e8;
  border-radius:14px;
  padding:10px 12px;
  color:#456;
  font-size:15px;
  font-weight:700;
  margin-bottom:12px;
}

/* Build 005 - iPhone Safari date control reliability */
.native-date{
  appearance:auto;
  -webkit-appearance:auto;
  direction:ltr;
  text-align:right;
  min-height:62px;
  font-size:21px;
  padding:12px 14px;
  background:#fff;
}
.native-date::-webkit-date-and-time-value{
  text-align:right;
  min-height:1.4em;
}
.native-date::-webkit-calendar-picker-indicator{
  opacity:1;
  width:28px;
  height:28px;
  cursor:pointer;
}

/* Build 006 - exceptional MEDO first launch */
.greeting{
  display:flex;
  align-items:center;
  gap:8px;
  color:var(--muted);
  font-size:18px;
  font-weight:700;
}
.greeting-lily{
  width:30px;
  height:30px;
  object-fit:contain;
  flex:0 0 auto;
}
.final-medo-start{
  min-height:68px;
  font-size:22px;
  letter-spacing:.3px;
  background:linear-gradient(135deg,#0f9fa2,#0b878a);
  box-shadow:0 10px 24px rgba(15,159,162,.22);
}
.first-welcome{
  min-height:calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  padding:32px 24px;
  background:
    radial-gradient(circle at 50% 25%,rgba(255,255,255,.95),rgba(255,255,255,.55) 30%,transparent 60%),
    linear-gradient(180deg,#faffff 0%,#e8f8f8 58%,#c7eeee 100%);
  transition:opacity .55s ease, transform .55s ease;
}
.first-welcome.welcome-exit{
  opacity:0;
  transform:scale(.985);
}
.welcome-lily{
  width:130px;
  height:130px;
  object-fit:contain;
  margin-bottom:8px;
  animation:welcomeLily .8s ease both;
}
.welcome-brand{
  font-family:Georgia,serif;
  font-size:48px;
  letter-spacing:3px;
  color:var(--turq-dark);
  font-weight:700;
  animation:welcomeFade .7s .12s ease both;
}
.welcome-hi{
  margin-top:10px;
  font-size:27px;
  font-weight:900;
  color:#273638;
  animation:welcomeFade .7s .22s ease both;
}
.welcome-message{
  margin-top:28px;
  font-size:23px;
  line-height:1.8;
  font-weight:800;
  color:#405356;
  animation:welcomeFade .7s .34s ease both;
}
.welcome-sign{
  margin-top:18px;
  font-size:18px;
  font-weight:800;
  color:var(--turq-dark);
  animation:welcomeFade .7s .44s ease both;
}
.welcome-start{
  margin-top:36px;
  max-width:360px;
  min-height:68px;
  font-size:23px;
  background:linear-gradient(135deg,#0f9fa2,#087b7e)!important;
  box-shadow:0 12px 28px rgba(8,123,126,.24);
  animation:welcomeFade .7s .55s ease both;
}
@keyframes welcomeLily{
  from{opacity:0;transform:translateY(10px) scale(.94)}
  to{opacity:1;transform:translateY(0) scale(1)}
}
@keyframes welcomeFade{
  from{opacity:0;transform:translateY(8px)}
  to{opacity:1;transform:translateY(0)}
}
.first-dashboard #cycleCard,
.first-dashboard .quick-grid,
.first-dashboard #remindersBox,
.first-dashboard .section-card{
  opacity:0;
  transform:translateY(8px);
  animation:dashboardReveal .45s ease forwards;
}
.first-dashboard .quick-grid{animation-delay:.15s}
.first-dashboard #remindersBox{animation-delay:.28s}
.first-dashboard .section-card{animation-delay:.38s}
@keyframes dashboardReveal{
  to{opacity:1;transform:translateY(0)}
}
@media (prefers-reduced-motion:reduce){
  .welcome-lily,.welcome-brand,.welcome-hi,.welcome-message,.welcome-sign,.welcome-start,
  .first-dashboard #cycleCard,.first-dashboard .quick-grid,.first-dashboard #remindersBox,.first-dashboard .section-card{
    animation:none!important;
    transition:none!important;
    opacity:1!important;
    transform:none!important;
  }
}

/* Build 007 — Mom simplified guided experience */
.simplified-cycle .simple-month-spend,.simplified-cycle .home-transfer{display:flex;justify-content:space-between;align-items:center;padding:14px 0;border-top:1px solid var(--line);font-size:18px}
.simplified-cycle .simple-month-spend{margin-top:12px}.simplified-cycle b{font-size:21px;color:var(--turq-dark)}
.guided-title{font-size:22px;font-weight:900;margin:18px 0 12px;color:var(--ink)}
.next-step{padding-top:8px}
.guided-categories{grid-template-columns:repeat(2,1fr);gap:12px}
.cat{position:relative;transition:transform .16s ease,border-color .16s ease,background .16s ease,box-shadow .16s ease}
.cat .cat-check{display:none;position:absolute;top:7px;left:9px;width:25px;height:25px;border-radius:50%;background:var(--turq-dark);color:white;align-items:center;justify-content:center;font-size:16px}
.cat.selected{background:#d9f5f3!important;border:3px solid var(--turq-dark)!important;color:#075f62!important;box-shadow:0 7px 18px rgba(8,123,126,.18);transform:translateY(-1px)}
.cat.selected .cat-check{display:flex}
.choice.selected{background:#d9f5f3;border:3px solid var(--turq-dark);color:#075f62;box-shadow:0 5px 14px rgba(8,123,126,.14)}
.budget-status{margin:16px 0;padding:16px;border-radius:18px;background:#f2fbfb;border:1.5px solid #bfe4e3}
.budget-status h3{margin:0 0 10px;font-size:20px}.budget-status>div{display:flex;justify-content:space-between;gap:12px;padding:7px 0;font-size:17px}.budget-status b{color:var(--turq-dark)}
.budget-status .reserve-line{border-top:1px solid #cfe7e6;margin-top:5px;padding-top:12px}.budget-status .over-line{display:block;color:#9b2d30;font-weight:900}
.cat[data-cat="buildingServices"]{background:#eef8f8;border-color:#c7e4e3}
.welcome-lily{width:165px!important;height:165px!important;filter:drop-shadow(0 8px 14px rgba(8,123,126,.12))}
@media(max-width:390px){.guided-categories{grid-template-columns:repeat(2,1fr)}.cat{min-height:100px}}

/* Build 008 — clean financial model and executive UX */
.home-kpi{display:flex;justify-content:space-between;align-items:center;padding:13px 0;border-top:1px solid var(--line);gap:14px}
.home-kpi:first-of-type{margin-top:10px}.home-kpi b{font-size:22px;color:var(--turq-dark);white-space:nowrap}.home-kpi.future{background:#f4fbfb;margin:8px -6px 0;padding:12px 8px;border-radius:14px;border-top:0}.over-line{color:var(--red);font-weight:900;margin-top:8px}.reserve-inline{display:flex;justify-content:space-between;gap:12px;padding-top:10px;margin-top:10px;border-top:1px solid var(--line)}
.substep-box{margin:18px 0 8px;padding:16px;border:1.5px dashed var(--turq);border-radius:18px;background:#fbffff}.substep-title{font-size:19px;font-weight:900;margin-bottom:12px;text-align:center}.summary-box{background:#f8fbfb;border:1px solid var(--line);border-radius:18px;padding:15px;margin:12px 0;line-height:1.9}.alert-card{background:#fff1f2;border:1px solid #f2c9ce;border-radius:18px;padding:16px;margin:12px 0;color:#8c2e36}.executive-top{display:grid;grid-template-columns:1fr 1fr;border:1px solid var(--line);border-radius:18px;overflow:hidden;margin:12px 0}.executive-top>div{padding:16px;text-align:center;background:#fbfdfd}.executive-top>div+div{border-right:1px solid var(--line)}.executive-top span{display:block;color:var(--muted);font-weight:800}.executive-top b{display:block;font-size:27px;color:var(--turq-dark);margin-top:6px}.smart-card{border:1px solid var(--line);border-radius:18px;padding:15px;margin:12px 0;background:#fff}.smart-card h3{margin:0 0 8px}.smart-card.alert{background:#fff5f6;border-color:#f1cfd3}.smart-card.insight-card{background:#f4f8ff;border-color:#dbe6f5}.smart-card.suggestion{background:#f3fbf5;border-color:#d8eadc}.compact-performance{margin-top:8px}.compact-performance>span{display:block;margin:4px 0}.table-wrap{overflow:auto}.table-wrap table{width:100%;border-collapse:collapse;font-size:15px}.table-wrap th,.table-wrap td{border-bottom:1px solid var(--line);padding:10px 8px;text-align:right;white-space:nowrap}.comparison{display:grid;grid-template-columns:1fr 1fr;gap:10px}.comparison>div{background:#f7fbfb;border:1px solid var(--line);border-radius:16px;padding:15px;text-align:center}.comparison b{display:block;font-size:22px;margin-top:7px}.big-number{font-size:30px;font-weight:900;color:var(--turq-dark);margin:10px 0}.read-only{opacity:.92}.btn:disabled{opacity:.6;cursor:default}
@media(max-width:390px){.home-kpi{font-size:16px}.home-kpi b{font-size:19px}.executive-top{grid-template-columns:1fr}.executive-top>div+div{border-right:0;border-top:1px solid var(--line)}}
