/* Pelli Planner app styles. All colours come from tokens.css. */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
:lang(te) body, body:lang(te) { line-height: 1.65; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--leaf); }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--pasupu); outline-offset: 2px; }

/* ---------- app column ---------- */
.app {
  max-width: 480px;
  min-height: 100%;
  margin: 0 auto;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  position: relative;
}
@media (min-width: 520px) {
  .app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}
.topbar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-block: 10px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--surface); }
.wordmark { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 1.2rem; line-height: 1; color: var(--leaf); text-decoration: none; }
.wordmark .mark { width: 26px; height: 26px; }
.langbtn {
  border: 1px solid var(--line); background: var(--raised); border-radius: 999px;
  padding: 6px 12px; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; min-height: 36px;
}
.main {
  flex: 1;
  display: flex; flex-direction: column; gap: 16px;
  padding-top: 16px;
  padding-bottom: calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.main.no-tabs { padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }

/* ---------- bottom tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  display: flex; justify-content: center;
  background: var(--raised);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
.tabbar-in { display: grid; grid-template-columns: repeat(5, 1fr); width: 100%; max-width: 480px; }
.tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.tab {
  height: var(--tabbar-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: none; border: 0; cursor: pointer; color: var(--ink-soft);
  font-size: var(--fs-xs); font-weight: 600;
}
.tab[aria-current="page"] { color: var(--leaf); }
.tab[aria-current="page"] .ic { stroke-width: 2.2; }
.tab:disabled { opacity: .35; cursor: default; }

/* ---------- banners ---------- */
.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: var(--r-md);
  background: var(--pasupu-soft); color: var(--ink); font-size: var(--fs-sm);
}
.banner b { font-weight: 600; }

/* ---------- generic blocks ---------- */
.card {
  background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0;
}
.card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card-title { margin: 0; font-size: var(--fs-sm); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); }
:lang(te) .card-title { text-transform: none; letter-spacing: 0; font-size: var(--fs-md); }
.muted { color: var(--ink-soft); }
.small { font-size: var(--fs-sm); }
.h1 { font-family: var(--font-display); font-weight: 400; font-size: var(--fs-xl); line-height: 1.2; margin: 0; text-wrap: balance; }
.lead { margin: 0; color: var(--ink-soft); }
.empty { padding: 20px 8px; text-align: center; color: var(--ink-soft); font-size: var(--fs-sm); }
.row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; cursor: pointer; text-decoration: none; text-align: center;
}
.btn-primary { background: var(--leaf); color: var(--on-leaf); }
.btn-wa { background: #1E8E4E; color: #fff; }
.btn-ghost { background: var(--raised); border-color: var(--line); color: var(--ink); }
.btn-danger { background: none; border-color: var(--danger); color: var(--danger); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: var(--fs-sm); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--leaf); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.fab {
  position: fixed; z-index: 24;
  bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom, 0px));
  right: max(16px, calc(50% - 240px + 16px), env(safe-area-inset-right, 0px));
  box-shadow: var(--shadow);
}

/* ---------- home hero ---------- */
.hero { position: relative; overflow: hidden; padding: 0; gap: 0; border-color: var(--leaf-soft); }
.thoranam { display: block; width: 100%; height: 34px; color: var(--leaf); }
.thoranam .flower { fill: var(--pasupu); }
.hero-body { padding: 4px 18px 18px; display: flex; flex-direction: column; gap: 6px; }
.couple { font-family: var(--font-display); font-size: var(--fs-2xl); line-height: 1.1; margin: 0; text-wrap: balance; }
.couple .amp { color: var(--pasupu); }
.hero-meta { color: var(--ink-soft); font-size: var(--fs-sm); }
.countdown { display: flex; align-items: baseline; gap: 8px; margin-top: 6px; }
.countdown .n { font-family: var(--font-display); font-size: 3rem; line-height: 1; color: var(--leaf); font-variant-numeric: tabular-nums; }
.countdown .l { font-weight: 600; color: var(--ink-soft); }

/* ---------- money ---------- */
.figs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fig { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fig .k { font-size: var(--fs-xs); color: var(--ink-soft); font-weight: 600; }
.fig .v { font-size: var(--fs-lg); font-weight: 700; font-variant-numeric: tabular-nums; }
.fig.due .v { color: var(--warn); }
.meter { height: 10px; border-radius: 999px; background: var(--leaf-soft); overflow: hidden; display: flex; }
.meter > span { display: block; height: 100%; }
.meter .paid { background: var(--leaf); }
.meter .booked { background: color-mix(in srgb, var(--leaf) 45%, transparent); }
.meter.over .booked { background: var(--warn); }
.split { display: flex; height: 28px; border-radius: var(--r-sm); overflow: hidden; gap: 2px; }
.split > span { display: flex; align-items: center; padding: 0 8px; color: #fff; font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; min-width: 0; overflow: hidden; }
.split .b { background: var(--bride); }
.split .g { background: var(--groom); }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.legend > div { display: flex; flex-direction: column; min-width: 0; }
.legend .k { font-size: var(--fs-xs); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.legend .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot.b { background: var(--bride); } .dot.g { background: var(--groom); } .dot.s { background: var(--shared); }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); min-width: 0; }
.li:first-child { border-top: 0; }
.li-main { flex: 1; min-width: 0; }
.li-title { font-weight: 600; overflow-wrap: anywhere; }
.li-sub { font-size: var(--fs-sm); color: var(--ink-soft); }
.li-amt { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.li-amt .a { font-weight: 700; }
.li-amt .p { font-size: var(--fs-xs); color: var(--ink-soft); }
.li.tap { cursor: pointer; }
.li.tap:active { background: var(--leaf-soft); }

.chip { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.chip.b { background: var(--bride-soft); color: var(--bride); }
.chip.g { background: var(--groom-soft); color: var(--groom); }
.chip.s { background: var(--leaf-soft); color: var(--leaf); }
.chip.lock { background: var(--pasupu-soft); color: var(--ink); }
.chip .ic { width: 12px; height: 12px; stroke-width: 2.4; }
.chip.warn { background: var(--pasupu-soft); color: var(--warn); }

/* ---------- segmented control ---------- */
.seg { display: flex; background: var(--leaf-soft); border-radius: 999px; padding: 3px; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button {
  flex: 1 0 auto; border: 0; background: none; border-radius: 999px; padding: 8px 12px; min-height: 38px;
  font-size: var(--fs-sm); font-weight: 600; color: var(--ink-soft); cursor: pointer; white-space: nowrap;
}
.seg button[aria-pressed="true"] { background: var(--raised); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.seg button[aria-pressed="true"].b { color: var(--bride); }
.seg button[aria-pressed="true"].g { color: var(--groom); }

/* ---------- budget ---------- */
.cat { display: flex; flex-direction: column; gap: 0; }
.cat-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-bottom: 4px; }
.cat-h h3 { margin: 0; font-size: var(--fs-md); font-weight: 700; }
.cat-h .t { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink-soft); font-size: var(--fs-sm); }
.addchips { display: flex; flex-wrap: wrap; gap: 8px; }
.addchip { border: 1px dashed var(--line); background: none; border-radius: 999px; padding: 6px 12px; font-size: var(--fs-sm); cursor: pointer; color: var(--ink-soft); }
.kumar {
  display: flex; gap: 12px; align-items: center; text-decoration: none; color: var(--ink);
  border: 1px solid var(--pasupu); background: var(--pasupu-soft); border-radius: var(--r-md); padding: 12px;
}
.kumar .ic { color: var(--leaf); width: 26px; height: 26px; }
.kumar b { display: block; font-weight: 700; }
.kumar span { font-size: var(--fs-xs); color: var(--ink-soft); }

/* ---------- events ---------- */
.ev { display: flex; gap: 14px; align-items: flex-start; }
.ev-date { width: 52px; flex: none; text-align: center; border-radius: var(--r-md); background: var(--leaf-soft); color: var(--leaf); padding: 6px 0; }
.ev-date .d { font-family: var(--font-display); font-size: 1.5rem; line-height: 1; }
.ev-date .m { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; }
.ev-date.tbd { background: var(--line); color: var(--ink-soft); }
.ev-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ev-name { font-weight: 700; font-size: var(--fs-md); overflow-wrap: anywhere; }
.ev.muhurtham .ev-date { background: var(--pasupu); color: #3A2A00; }
.progress { height: 4px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--leaf); }
.checks { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.check { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--leaf); flex: none; }
.check.done span { text-decoration: line-through; color: var(--ink-soft); }
.addrow { display: flex; gap: 8px; }
.addrow input { flex: 1; min-width: 0; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .lbl { font-size: var(--fs-sm); font-weight: 600; }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--raised); font-size: 16px;
}
.input:focus { border-color: var(--leaf); outline: none; box-shadow: 0 0 0 3px var(--leaf-soft); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.money-in { position: relative; }
.money-in::before { content: "₹"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-soft); }
.money-in .input { padding-left: 26px; font-variant-numeric: tabular-nums; }
.toggle { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); cursor: pointer; }
.toggle input { width: 22px; height: 22px; margin: 0; accent-color: var(--leaf); flex: none; }
.toggle.disabled { opacity: .5; cursor: default; }
.err { color: var(--danger); font-size: var(--fs-sm); margin: 0; }
.range { width: 100%; accent-color: var(--bride); }

/* ---------- bottom sheet ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(10, 20, 15, .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 480px; max-height: 92%; overflow-y: auto;
  background: var(--surface); border-radius: 20px 20px 0 0;
  padding-top: 8px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 14px;
  animation: up .22s ease-out;
}
@keyframes up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 4px; }
.sheet-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-h h2 { margin: 0; font-size: var(--fs-lg); }
.iconbtn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--leaf-soft); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink); }
.sheet-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.sheet-actions .btn { flex: 1; }

/* ---------- start ---------- */
.intro { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
.intro .h1 { font-size: 2rem; }
.benefits { display: grid; gap: 8px; margin: 4px 0 0; padding: 0; list-style: none; }
.benefits li { display: flex; gap: 10px; align-items: flex-start; font-size: var(--fs-sm); }
.benefits .ic { width: 18px; height: 18px; color: var(--leaf); margin-top: 2px; stroke-width: 2.4; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice label { display: flex; align-items: center; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--raised); cursor: pointer; font-size: var(--fs-sm); min-height: 46px; }
.choice input { accent-color: var(--leaf); margin: 0; }
.choice label:has(input:checked) { border-color: var(--leaf); background: var(--leaf-soft); }

/* ---------- family ---------- */
.link-card { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.link-card:first-of-type { border-top: 0; }
.link-card .row .btn { flex: 1; }
.link-off { opacity: .55; }

/* ---------- elder view ---------- */
.elder { font-size: 1.25rem; gap: 20px; }
.elder .couple { font-size: 2.6rem; }
.elder .big-date { font-family: var(--font-display); font-size: 1.9rem; color: var(--leaf); }
.elder .ev-row { display: flex; flex-direction: column; gap: 2px; padding: 14px 0; border-top: 1px solid var(--line); }
.elder .ev-row b { font-size: 1.35rem; }
.elder .ev-row span { color: var(--ink-soft); font-size: 1.1rem; }

/* ---------- footer, toast ---------- */
.foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; font-size: var(--fs-xs); color: var(--ink-soft); padding-top: 8px; }
.foot a { color: var(--ink-soft); }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none; z-index: 60;
  background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 999px; font-size: var(--fs-sm); font-weight: 600;
  transition: opacity .2s, transform .2s; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%); }
.loading { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--ink-soft); padding: 40px; }

@media (prefers-reduced-motion: reduce) {
  .sheet { animation: none; }
  .toast { transition: none; }
}
