/* ===================================================================
   Expense Tracker — styles
   =================================================================== */
:root{
  --bg:#f3f3f1;
  --card:#ffffff;
  --ink:#16181d;
  --muted:#9aa0a6;
  --muted-2:#6b7177;
  --line:#ececec;
  --line-2:#f1f1f0;
  --green:#10a37f;
  --green-d:#0c8c6c;
  --green-bright:#15b884;
  --dark:#1a1b1e;
  --dark-2:#242528;
  --blue:#2f7ed8;
  --blue-soft:#e8f1fb;
  --danger:#d24b4b;
  --radius:16px;
  --shadow:0 1px 2px rgba(16,18,29,.04), 0 6px 24px rgba(16,18,29,.05);
  font-family:'Plus Jakarta Sans', system-ui, sans-serif;
}

*{box-sizing:border-box}
html,body{margin:0}
body{
  background:var(--bg);
  color:var(--ink);
  font-family:'Plus Jakarta Sans', system-ui, sans-serif;
  -webkit-font-smoothing:antialiased;
  font-feature-settings:"tnum" 1;
}
.wrap{max-width:760px;margin:0 auto;padding:40px 20px 80px}
.hidden{display:none !important}
.muted{color:var(--muted)}
.small{font-size:13px}

/* ---------- header ---------- */
.topbar{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:26px}
.brand{display:flex;gap:14px;align-items:flex-start}
.brand-mark{
  width:38px;height:38px;border-radius:11px;flex:none;
  background:var(--green);color:#fff;font-weight:800;font-size:19px;
  display:flex;align-items:center;justify-content:center;
}
.brand h1{font-size:24px;font-weight:800;margin:0;letter-spacing:-.02em}
.brand p{margin:2px 0 0;color:var(--muted-2);font-size:14px}
.brand .who{display:block;color:var(--muted);font-size:13px;margin-top:3px}
.topbar-actions{display:flex;gap:8px}

/* ---------- buttons ---------- */
.btn-ghost{
  display:inline-flex;align-items:center;gap:7px;
  background:#fff;border:1px solid var(--line);border-radius:10px;
  padding:8px 13px;font:inherit;font-size:13.5px;font-weight:600;color:var(--ink);
  cursor:pointer;text-decoration:none;transition:.15s;
}
.btn-ghost:hover{background:#fafafa;border-color:#e0e0e0}
.btn-primary{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  background:var(--green);color:#fff;border:0;border-radius:12px;
  padding:13px 18px;font:inherit;font-weight:700;font-size:15px;cursor:pointer;
  transition:.15s;
}
.btn-primary:hover{background:var(--green-d)}
.btn-primary:active{transform:translateY(1px)}
.btn-primary.full{width:100%}
.btn-dark{
  display:inline-flex;align-items:center;gap:7px;
  background:var(--dark-2);color:#fff;border:1px solid #34363a;border-radius:10px;
  padding:8px 13px;font:inherit;font-size:13.5px;font-weight:600;cursor:pointer;text-decoration:none;
}
.btn-dark:hover{background:#2d2f33}
.ic{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;flex:none}

/* ---------- cards ---------- */
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);
  box-shadow:var(--shadow);padding:22px;margin-bottom:18px}
.card-label{font-size:12px;font-weight:700;letter-spacing:.07em;text-transform:uppercase;color:var(--muted)}

/* ---------- segmented control ---------- */
.seg{display:inline-flex;background:#f4f4f3;border:1px solid var(--line);border-radius:11px;padding:4px;gap:4px;margin:16px 0}
.seg.sub{margin:0}
.seg-btn{
  display:inline-flex;align-items:center;gap:7px;
  border:0;background:transparent;border-radius:8px;padding:9px 14px;
  font:inherit;font-size:14px;font-weight:600;color:var(--muted-2);cursor:pointer;transition:.15s;
}
.seg-btn.active{background:var(--green);color:#fff;box-shadow:0 1px 2px rgba(0,0,0,.12)}
.seg.sub .seg-btn{padding:7px 13px;font-size:13px}

/* ---------- add form ---------- */
.add-grid{display:grid;grid-template-columns:1fr 150px 130px;gap:10px}
.add-extra{margin:12px 0 4px}
.inp{
  width:100%;border:1px solid var(--line);background:#fcfcfc;border-radius:11px;
  padding:13px 14px;font:inherit;font-size:14.5px;color:var(--ink);outline:none;transition:.15s;
}
.inp::placeholder{color:#b4b8bd}
.inp:focus{border-color:var(--green);background:#fff;box-shadow:0 0 0 3px rgba(16,163,127,.12)}
.select{appearance:none;cursor:pointer;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aa0a6' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 12px center;padding-right:32px}
.inp.small{width:90px;text-align:center}
.freq-row{display:flex;align-items:center;gap:10px;color:var(--muted-2);font-size:14px;font-weight:600}
.add-card .btn-primary{margin-top:14px}

/* ---------- entries ---------- */
.list-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px}
.list-card{padding:14px 22px}
.entries{display:flex;flex-direction:column}
.entry{
  display:flex;align-items:center;gap:14px;padding:14px 2px;border-bottom:1px solid var(--line-2);
}
.entry:last-child{border-bottom:0}
.avatar{
  width:34px;height:34px;border-radius:50%;flex:none;
  background:#f1f1ef;color:#7b8086;font-weight:700;font-size:14px;
  display:flex;align-items:center;justify-content:center;text-transform:uppercase;
}
.avatar.var{background:var(--blue-soft);color:var(--blue)}
.entry-main{flex:1;min-width:0}
.entry-name{font-weight:600;font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.entry-sub{font-size:12.5px;color:var(--blue);font-weight:600;margin-top:2px}
.entry-amt{text-align:right;line-height:1.25}
.entry-amt .m{font-weight:700;font-size:15px}
.entry-amt .y{font-size:12.5px;color:var(--muted)}
.entry-acts{display:flex;gap:2px;opacity:.35;transition:.15s}
.entry:hover .entry-acts{opacity:1}
.act{
  width:30px;height:30px;border-radius:8px;border:0;background:transparent;cursor:pointer;
  display:flex;align-items:center;justify-content:center;color:var(--muted-2);
}
.act:hover{background:#f3f3f2;color:var(--ink)}
.act.del:hover{color:var(--danger);background:#fbecec}
.empty{padding:30px 0;text-align:center;color:var(--muted)}

/* ---------- total ---------- */
.total-card{background:var(--dark);border-radius:var(--radius);padding:22px;color:#fff;margin-bottom:20px}
.total-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}
.total-label{font-size:12px;font-weight:700;letter-spacing:.07em;text-transform:uppercase;color:#8b8f95}
.total-tools{display:flex;gap:8px}
.inp.select.dark{background-color:var(--dark-2);border-color:#34363a;color:#fff;font-size:13.5px;padding:8px 30px 8px 12px;border-radius:10px;width:auto}
.total-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.total-box{background:var(--dark-2);border-radius:13px;padding:18px 20px}
.total-box span{display:block;color:#8b8f95;font-size:13px;font-weight:600;margin-bottom:6px}
.total-box strong{font-size:26px;font-weight:800;letter-spacing:-.02em}
.total-box.green{background:var(--green);}
.total-box.green span{color:rgba(255,255,255,.8)}
.total-foot{text-align:center;color:#8b8f95;font-size:13px;margin-top:16px}
.link{background:0;border:0;color:#cfd2d6;font:inherit;font-size:13px;text-decoration:underline;cursor:pointer;padding:0}
.link:hover{color:#fff}

.footer{text-align:center;color:var(--muted);font-size:13px}

/* ---------- modals ---------- */
.modal{position:fixed;inset:0;background:rgba(16,18,29,.45);display:flex;align-items:center;justify-content:center;padding:20px;z-index:50}
.modal-box{background:#fff;border-radius:var(--radius);padding:24px;width:100%;max-width:440px;box-shadow:0 20px 60px rgba(0,0,0,.25);max-height:90vh;overflow:auto}
.modal-box h3{margin:0 0 14px;font-size:18px;font-weight:800}
.fld{display:flex;flex-direction:column;gap:6px;margin-bottom:14px;font-size:13px;font-weight:600;color:var(--muted-2)}
.fld .inp{font-weight:500;color:var(--ink)}
.row2{display:grid;grid-template-columns:1fr 130px;gap:10px}
.modal-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:8px}
.rates-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:14px 0}
.rate-item{display:flex;flex-direction:column;gap:4px}
.rate-item label{font-size:12px;font-weight:700;color:var(--muted-2)}

/* ---------- auth ---------- */
.auth-body{display:flex;align-items:center;justify-content:center;min-height:100vh;padding:20px}
.auth-card{background:#fff;border:1px solid var(--line);border-radius:20px;box-shadow:var(--shadow);padding:32px;width:100%;max-width:400px}
.auth-card .brand{margin-bottom:8px}
.auth-seg{display:flex;width:100%}
.auth-seg .seg-btn{flex:1;justify-content:center}
.full{width:100%}
.alert{background:#fbecec;color:#a23b3b;border:1px solid #f3d6d6;border-radius:10px;padding:11px 13px;font-size:13.5px;font-weight:600;margin-bottom:14px}

/* ---------- toast ---------- */
.toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%);background:var(--dark);color:#fff;
  padding:13px 18px;border-radius:12px;font-size:14px;font-weight:600;box-shadow:0 10px 30px rgba(0,0,0,.3);z-index:60;max-width:90vw}

/* ---------- drag ---------- */
.entry.dragging{opacity:.5}
.entry .grip{cursor:grab;color:#cdd0d4}

/* ---------- responsive ---------- */
@media (max-width:560px){
  .wrap{padding:24px 14px 60px}
  .add-grid{grid-template-columns:1fr;gap:8px}
  .total-grid{grid-template-columns:1fr}
  .brand h1{font-size:20px}
  .seg{flex-wrap:wrap}
  .topbar{flex-direction:column;gap:14px}
}

/* ===================================================================
   Landing / hero (logged-out)
   =================================================================== */
.landing{max-width:820px;margin:0 auto;padding:34px 20px 70px}
.hero-top{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:46px}
.hero{text-align:center}
.badge{display:inline-block;background:#e9f7f1;color:#0c8c6c;border:1px solid #cdeadd;
  font-size:12px;font-weight:800;letter-spacing:.07em;text-transform:uppercase;
  padding:6px 13px;border-radius:999px;margin-bottom:22px}
.hero h2{font-size:44px;line-height:1.08;font-weight:800;letter-spacing:-.03em;margin:0 auto;max-width:560px}
.hero-sub{color:var(--muted-2);font-size:16px;line-height:1.55;max-width:520px;margin:18px auto 0}
.hero-cta{margin-top:30px}
.hero-cta .btn-primary{font-size:16px;padding:15px 26px;border-radius:13px}
.hero-note{color:var(--muted);font-size:13.5px;margin-top:12px}
.pills{display:flex;flex-wrap:wrap;justify-content:center;gap:9px;margin-top:30px}
.pill{display:inline-flex;align-items:center;gap:7px;background:#fff;border:1px solid var(--line);
  border-radius:999px;padding:8px 14px;font-size:13.5px;font-weight:600;color:var(--muted-2)}
.pill .ic{width:15px;height:15px;color:var(--green)}

.preview-label{text-align:center;color:var(--muted);font-size:12px;font-weight:700;
  letter-spacing:.1em;text-transform:uppercase;margin:54px 0 16px}
.preview{position:relative;border-radius:var(--radius);overflow:hidden}
.preview-inner{filter:blur(1.5px);opacity:.5;pointer-events:none;user-select:none}
.preview .list-card{margin-bottom:0;border-bottom-left-radius:0;border-bottom-right-radius:0}
.preview .total-card{border-top-left-radius:0;border-top-right-radius:0;margin-bottom:0}
.preview-mask{position:absolute;inset:0;background:linear-gradient(180deg,rgba(243,243,241,.25),rgba(243,243,241,.65))}
.lock-card{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);
  background:#fff;border:1px solid var(--line);border-radius:18px;box-shadow:0 24px 60px rgba(16,18,29,.18);
  padding:26px 30px;text-align:center;width:min(330px,86%)}
.lock-ico{width:46px;height:46px;border-radius:13px;background:#e9f7f1;color:var(--green);
  display:flex;align-items:center;justify-content:center;margin:0 auto 14px}
.lock-ico .ic{width:22px;height:22px}
.lock-card h3{margin:0 0 6px;font-size:18px;font-weight:800}
.lock-card p{margin:0 0 16px;color:var(--muted-2);font-size:13.5px;line-height:1.5}
.landing-foot{text-align:center;color:var(--muted);font-size:13px;margin-top:26px}

/* auth modal sizing */
.auth-modal .modal-box{max-width:400px}
.auth-modal .brand{margin-bottom:6px}

@media (max-width:560px){
  .hero h2{font-size:32px}
  .hero-top{flex-direction:column;gap:14px}
  .pills{gap:7px}
}

/* ===================================================================
   iOS-style auth sheet
   =================================================================== */
.auth-modal{background:rgba(20,22,28,.34);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}
.auth-modal .modal-box{
  font-family:-apple-system,BlinkMacSystemFont,'Plus Jakarta Sans',system-ui,sans-serif;
  max-width:380px;border:0;border-radius:26px;padding:24px 24px 20px;
  box-shadow:0 30px 80px rgba(0,0,0,.30);
  animation:sheetPop .30s cubic-bezier(.2,.9,.3,1.15);
}
@keyframes sheetPop{from{opacity:0;transform:translateY(10px) scale(.96)}to{opacity:1;transform:none}}

.auth-grabber{width:38px;height:5px;border-radius:3px;background:#e3e3e8;margin:-6px auto 16px}
.auth-head{text-align:center;margin-bottom:20px}
.auth-ico{width:62px;height:62px;border-radius:19px;margin:0 auto 14px;
  background:linear-gradient(155deg,#19c794,#0c8c6c);color:#fff;
  display:flex;align-items:center;justify-content:center;
  box-shadow:0 12px 26px rgba(16,163,127,.38)}
.auth-ico .ic{width:30px;height:30px;stroke-width:2.1}
.auth-head h2{font-size:22px;font-weight:700;letter-spacing:-.02em;margin:0}
.auth-head p{font-size:14px;color:var(--muted-2);margin:6px 0 0;line-height:1.45}

.ios-field{position:relative;margin-bottom:14px}
.ios-field .fic{position:absolute;left:16px;top:50%;transform:translateY(-50%);
  width:19px;height:19px;color:#a6a6ad;pointer-events:none;
  fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.ios-field input{
  width:100%;border:0;background:#f1f1f5;border-radius:15px;
  padding:16px 16px 16px 46px;font:inherit;font-size:16px;color:var(--ink);
  outline:none;-webkit-appearance:none;
  transition:background .15s,box-shadow .15s}
.ios-field input::placeholder{color:#aeaeb4}
.ios-field input:focus{background:#fff;
  box-shadow:0 0 0 4px rgba(16,163,127,.16),inset 0 0 0 1.5px var(--green)}

.auth-modal .btn-primary{border-radius:15px;padding:16px;font-size:16px;font-weight:700;
  box-shadow:0 10px 22px rgba(16,163,127,.30);
  transition:transform .12s ease,box-shadow .15s,background .15s}
.auth-modal .btn-primary:active{transform:scale(.97);box-shadow:0 6px 14px rgba(16,163,127,.26)}
.auth-modal .alert{border-radius:14px;text-align:center;font-size:13.5px}
.auth-modal .hero-note{font-size:12.5px;color:var(--muted);text-align:center;line-height:1.5}
.auth-modal .link{font-size:15px;padding:6px}

@media (max-width:560px){
  .auth-modal{align-items:flex-end;padding:0}
  .auth-modal .modal-box{max-width:none;width:100%;border-radius:26px 26px 0 0;
    padding-bottom:max(28px,env(safe-area-inset-bottom));
    animation:sheetUp .32s cubic-bezier(.2,.9,.3,1.05)}
  @keyframes sheetUp{from{transform:translateY(100%)}to{transform:none}}
}

/* ---- OTP code boxes ---- */
.otp-row{display:flex;gap:8px;justify-content:center;margin:8px 0 16px}
.otp-box{width:46px;height:56px;border:0;background:#f1f1f5;border-radius:13px;
  text-align:center;font-size:24px;font-weight:700;color:var(--ink);outline:none;
  -webkit-appearance:none;transition:background .15s,box-shadow .15s;
  font-family:-apple-system,BlinkMacSystemFont,'Plus Jakarta Sans',system-ui,sans-serif}
.otp-box:focus{background:#fff;box-shadow:0 0 0 4px rgba(16,163,127,.16),inset 0 0 0 1.5px var(--green)}
.otp-box.filled{background:#fff;box-shadow:inset 0 0 0 1.5px #cfe9df}
.otp-row.shake{animation:otpShake .35s}
@keyframes otpShake{0%,100%{transform:translateX(0)}20%,60%{transform:translateX(-6px)}40%,80%{transform:translateX(6px)}}
@media (max-width:380px){.otp-row{gap:6px}.otp-box{width:42px;height:52px;font-size:21px;border-radius:11px}}

/* ---- hero "try it" demo ---- */
.demo-add{display:grid;grid-template-columns:1fr 130px auto;gap:9px;margin-bottom:4px}
.demo-add .inp{font-size:14.5px}
.demo-add .btn-primary{padding:13px 18px;border-radius:12px;white-space:nowrap}
@media (max-width:560px){
  .demo-add{grid-template-columns:1fr 1fr}
  .demo-add .btn-primary{grid-column:1 / -1}
}

/* ===================================================================
   Categories + breakdown
   =================================================================== */
.entry-sub-row{display:flex;align-items:center;gap:8px;margin-top:3px;flex-wrap:wrap}
.cat-tag{display:inline-block;background:#eef1f0;color:#5b6e66;font-size:11.5px;font-weight:700;
  padding:2px 9px;border-radius:999px;letter-spacing:.01em}
.entry-sub-txt{font-size:12.5px;color:var(--blue);font-weight:600}
.big-badge{display:inline-block;vertical-align:middle;background:#fde9c8;color:#9a6a16;
  font-size:10.5px;font-weight:800;letter-spacing:.04em;text-transform:uppercase;
  padding:2px 7px;border-radius:999px;margin-left:6px}

/* breakdown inside the dark total card */
.cat-breakdown{margin-top:16px;border-top:1px solid rgba(255,255,255,.10);padding-top:14px}
.cat-head{font-size:12px;font-weight:700;letter-spacing:.05em;text-transform:uppercase;
  color:#9aa0a6;margin-bottom:12px}
.cat-head strong{color:#fff;font-weight:800;text-transform:none;letter-spacing:0}
.cat-row{margin-bottom:11px}
.cat-row:last-child{margin-bottom:0}
.cat-row-top{display:flex;justify-content:space-between;gap:10px;font-size:13px;
  color:#e7e8ea;font-weight:600;margin-bottom:5px}
.cat-row-top span:last-child{color:#9aa0a6;font-weight:600;white-space:nowrap}
.cat-bar{height:7px;border-radius:5px;background:rgba(255,255,255,.10);overflow:hidden}
.cat-fill{height:100%;border-radius:5px;background:var(--green-bright);min-width:3px;transition:width .4s ease}
