/* ===== Anyah Investment Tracker — styles ===== */
:root {
  --navy: #0b3d5b;
  --navy-2: #0f4d72;
  --teal: #0f9e8e;
  --gold: #e8a33d;
  --bg: #f3f5f8;
  --card: #ffffff;
  --ink: #14202b;
  --muted: #6a7783;
  --line: #e5e9ef;
  --red: #d64545;
  --amber: #e08a1e;
  --green: #1f9d55;
  --shadow: 0 2px 10px rgba(16, 42, 67, 0.08);
  --radius: 16px;
  --tab-h: 66px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1116; --card: #151c24; --ink: #e8edf2; --muted: #93a1ad;
    --line: #232d38; --navy: #0e5a86; --shadow: 0 2px 12px rgba(0,0,0,0.4);
  }
}
:root[data-theme="light"] { --bg:#f3f5f8; --card:#fff; --ink:#14202b; --muted:#6a7783; --line:#e5e9ef; }
:root[data-theme="dark"]  { --bg:#0c1116; --card:#151c24; --ink:#e8edf2; --muted:#93a1ad; --line:#232d38; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.45;
  max-width: 520px; margin: 0 auto; min-height: 100vh;
}
a { color: var(--navy-2); text-decoration: none; }
@media (prefers-color-scheme: dark) { a { color: #6cc4ff; } }

.screen { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 16px); min-height: 100vh; }
.body { padding: 14px 16px; display: flex; flex-direction: column; gap: 14px; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 12px) 14px 12px;
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  color: #fff; box-shadow: var(--shadow);
}
.topbar-title { font-weight: 700; font-size: 18px; flex: 1; }
.brand-dot, .logo-badge {
  display: grid; place-items: center; font-weight: 800;
  background: var(--gold); color: #3a2a06; border-radius: 10px;
}
.brand-dot { width: 30px; height: 30px; font-size: 16px; }
.hbtn {
  background: rgba(255,255,255,0.16); color: #fff; border: 0;
  width: 34px; height: 34px; border-radius: 10px; font-size: 20px; cursor: pointer;
}
.hbtn.back { font-size: 26px; line-height: 1; }

/* cards */
.card {
  background: var(--card); border-radius: var(--radius); padding: 14px;
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
.card.soft { background: color-mix(in srgb, var(--navy) 6%, var(--card)); }
.card.info { border-left: 3px solid var(--teal); }
.card-h { font-weight: 700; margin-bottom: 8px; font-size: 15px; }
.card-h.sub { margin-top: 8px; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.section-h { margin: 6px 2px -4px; font-size: 15px; color: var(--muted); font-weight: 700; }
.muted { color: var(--muted); }
.muted.pad { padding: 8px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 12px; padding: 12px 16px; font-size: 15px; font-weight: 600;
  cursor: pointer; background: var(--line); color: var(--ink); text-align: center;
}
.btn.primary { background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn.danger { background: transparent; border: 1px solid var(--red); color: var(--red); }
.btn.link { background: transparent; color: var(--navy-2); font-weight: 600; }
.btn.block { width: 100%; }
.btn.sm { padding: 8px 14px; font-size: 13px; }

/* Auto-fetch promo (Mutual Funds / Stocks) */
.fetch-promo {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  margin: 4px 0 12px; padding: 12px 14px; border-radius: 14px;
  border: 1px dashed var(--teal);
  background: color-mix(in srgb, var(--teal) 8%, transparent);
}
.fetch-promo .fp-txt { flex: 1; display: flex; flex-direction: column; }
.fetch-promo .fp-txt b { font-size: 14px; }
.fetch-promo .fp-txt span { font-size: 12px; color: var(--muted); }
.fetch-promo .btn { flex: none; }
.fetch-card .scan-illus { display: block; text-align: center; }
.fetch-card .badge { display: block; width: fit-content; margin: 0 auto 10px; }
.fnote { font-size: 11px; color: var(--muted); font-style: normal; }

/* Nominee rows (name / relation / share% / remove) */
.nom-row { display: grid; grid-template-columns: 1fr 0.8fr 54px 34px; gap: 6px; align-items: center; margin-bottom: 6px; }
.nom-row input { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; background: #fff; }
.nom-row input:focus { outline: 2px solid var(--teal); border-color: transparent; }
.nom-del { border: 0; background: var(--line); color: var(--muted); border-radius: 9px; height: 38px; cursor: pointer; font-size: 14px; }
.nom-del:active { transform: scale(.94); }
.plist { margin: 6px 0 0 18px; padding: 0; line-height: 1.5; }
.plist li { margin-bottom: 4px; }

/* Multi-page capture previews + missing-field highlight */
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.thumb { position: relative; width: 74px; height: 74px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #f4f6f8; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-x { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border: 0; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; line-height: 1; cursor: pointer; }
.fld.need input, .fld.need select { border-color: var(--amber); background: color-mix(in srgb, var(--amber) 10%, #fff); }
.fld.need > span::after { content: ' • needs input'; color: var(--amber); font-weight: 600; }
.miss-banner { background: color-mix(in srgb, var(--amber) 14%, transparent); border: 1px solid var(--amber); border-radius: 12px; padding: 10px 12px; font-size: 13px; margin-bottom: 10px; }
.miss-banner.ok { background: color-mix(in srgb, var(--teal) 12%, transparent); border-color: var(--teal); }

/* Plan picker (3-tier upgrade) */
.plan-cards { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.plan-card { display: block; text-decoration: none; color: var(--ink);
  border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: #fff; }
.plan-card:active { transform: scale(.99); }
.plan-card .pc-top { display: flex; align-items: baseline; justify-content: space-between; }
.plan-card .pc-top b { font-size: 16px; }
.pc-price { font-size: 20px; font-weight: 800; color: var(--navy-2); }
.pc-price i { font-size: 12px; font-weight: 600; color: var(--muted); font-style: normal; }
.pc-quota { font-size: 12px; color: var(--muted); margin-top: 2px; }
.pc-cta { margin-top: 8px; font-size: 13px; font-weight: 700; color: #1f9d55;
  background: color-mix(in srgb, #1f9d55 12%, transparent); border-radius: 9px; padding: 7px; text-align: center; }

/* Fund search (free AMFI-powered picker in the Add Mutual Fund form) */
.fund-search { position: relative; }
.fund-results {
  border: 1px solid var(--line); border-radius: 12px; margin-top: 6px;
  max-height: 260px; overflow-y: auto; background: var(--card, #fff);
}
.fund-opt {
  display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left;
  background: transparent; border: 0; border-bottom: 1px solid var(--line);
  padding: 10px 12px; cursor: pointer;
}
.fund-opt:last-child { border-bottom: 0; }
.fund-opt:hover, .fund-opt:focus { background: color-mix(in srgb, var(--teal) 10%, transparent); }
.fund-opt b { font-size: 13px; line-height: 1.3; }
.fund-opt span { font-size: 11px; color: var(--muted); }
.fund-empty { padding: 12px; font-size: 13px; color: var(--muted); }
#navHint, #priceHint { color: var(--teal); font-weight: 600; }
.btn.primary input { display: none; }
.row-btns { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.row-btns .btn { flex: 1; min-width: 130px; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 10px; box-shadow: var(--shadow); }
.tile-label { font-size: 11px; color: var(--muted); }
.tile-value { font-size: 20px; font-weight: 800; margin: 4px 0 2px; }
.tile-sub { font-size: 10.5px; color: var(--muted); }
.tile.blue  { border-top: 3px solid var(--navy); }
.tile.teal  { border-top: 3px solid var(--teal); }
.tile.amber { border-top: 3px solid var(--amber); }
.tile.grey  { border-top: 3px solid var(--line); }
.tile.green { border-top: 3px solid var(--green); }

/* asset-type picker */
.asset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.asset-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px 10px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); font-size: 14px; font-weight: 600; color: var(--ink); cursor: pointer; }
.asset-tile .ai { font-size: 30px; }
.asset-tile:active { transform: scale(0.98); }
.asset-head { font-size: 15px; margin-bottom: 4px; }

/* per-type tab strip */
.atabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px; margin: 0 -2px 4px; scrollbar-width: none; }
.atabs::-webkit-scrollbar { display: none; }
.atab { flex: 0 0 auto; padding: 8px 14px; border-radius: 20px; background: var(--card); border: 1px solid var(--line); color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; text-decoration: none; }
.atab.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.type-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 2px; }
.type-head h2 { font-size: 18px; margin: 0; }
.type-head span { font-size: 12.5px; }
.type-head .btn { padding: 9px 12px; font-size: 13px; }
.add-btns { display: flex; gap: 8px; flex: none; }

/* portfolio split + gains */
.split-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.split-row:last-child { border-bottom: 0; }
.split-row span { flex: 1; }
.split-row small { color: var(--muted); min-width: 22px; text-align: right; }
.pos { color: var(--green); }
.neg { color: var(--red); }

/* policy list / cards */
.pol-list { display: flex; flex-direction: column; gap: 12px; }
.pol-card { cursor: pointer; transition: transform .06s ease; }
.pol-card:active { transform: scale(0.99); }
.pol-top { display: flex; align-items: center; gap: 10px; }
.pol-logo {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--teal), var(--navy-2));
  flex: none;
}
.pol-logo.lg { width: 52px; height: 52px; font-size: 22px; }
.pol-logo.sm { width: 34px; height: 34px; font-size: 15px; }
.pol-id { flex: 1; min-width: 0; }
.pol-id b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pol-id span { font-size: 12.5px; color: var(--muted); }
.pol-irr { text-align: right; }
.pol-irr b { display: block; font-size: 18px; color: var(--teal); }
.pol-irr span { font-size: 10px; color: var(--muted); }
.pol-meta { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; margin: 12px 0 8px; }
.pol-meta span { display: block; font-size: 11px; color: var(--muted); }
.pol-meta b { font-size: 14px; }
.pol-foot { margin-top: 8px; }

.progress { height: 7px; background: var(--line); border-radius: 6px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--teal), var(--gold)); }
.progress-cap { font-size: 11.5px; color: var(--muted); margin-top: 5px; }

.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; }
.badge.red { background: color-mix(in srgb, var(--red) 15%, transparent); color: var(--red); }
.badge.amber { background: color-mix(in srgb, var(--amber) 18%, transparent); color: var(--amber); }
.badge.grey { background: var(--line); color: var(--muted); }

/* detail */
.pol-photo { width: 100%; border-radius: 14px; margin-bottom: 4px; border: 1px solid var(--line); }
.pol-photo.sm { max-height: 180px; object-fit: cover; }
.detail-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.detail-head b { display: block; }
.irr-hero { text-align: center; padding: 10px; border-radius: 12px; background: color-mix(in srgb, var(--teal) 10%, var(--card)); }
.irr-hero span { display: block; font-size: 12px; color: var(--muted); }
.irr-hero b { font-size: 34px; color: var(--teal); }
.irr-hero small { display: block; font-size: 11px; color: var(--muted); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.kv b, .kv a { text-align: right; }
.irdai { border: 1px dashed var(--gold); }

/* reminders */
.rem-row, .rem-card { display: flex; align-items: center; gap: 10px; }
.rem-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.rem-row:last-child { border-bottom: 0; }
.rem-card { margin: 0; }
.rem-ico { font-size: 18px; }
.rem-ico.big { font-size: 24px; }
.rem-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rem-main b { font-size: 14px; }
.rem-main span { font-size: 12px; color: var(--muted); }
.rem-when { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.rem-row.overdue .rem-when, .rem-card.overdue .rem-when { color: var(--red); }
.rem-row.soon .rem-when, .rem-card.soon .rem-when { color: var(--amber); }
.rem-card { cursor: pointer; }

/* support & family rows */
.sup-row, .fam-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.sup-row:last-child, .fam-row:last-child { border-bottom: 0; }
.sup-main { flex: 1; min-width: 0; }
.sup-main b { display: block; font-size: 14px; }
.sup-main span { font-size: 12px; color: var(--muted); }
.sup-actions { display: flex; gap: 6px; }
.chip { font-size: 12px; font-weight: 600; padding: 6px 10px; border-radius: 18px; background: var(--line); color: var(--ink); }
.chip.danger { background: transparent; border: 1px solid var(--red); color: var(--red); cursor: pointer; }

/* forms */
.form { display: flex; flex-direction: column; gap: 10px; }
.fld { display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.fld > span { color: var(--muted); font-weight: 600; }
.fld input, .fld select {
  padding: 12px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--card); color: var(--ink); font-size: 15px; width: 100%;
}
.fld input:focus, .fld select:focus { outline: 2px solid var(--teal); border-color: transparent; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* scan card */
.scan-card { text-align: center; }
.scan-illus { font-size: 46px; }
.scan-card h3 { margin: 6px 0; }
.scanning { text-align: center; padding: 24px 0; }
.spinner {
  width: 44px; height: 44px; margin: 0 auto 14px; border-radius: 50%;
  border: 4px solid var(--line); border-top-color: var(--teal); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* login */
.login { padding: 0 18px calc(var(--tab-h)); display: flex; flex-direction: column; justify-content: center; min-height: 100vh; gap: 18px; }
.login-hero { text-align: center; }
.logo-badge { width: 66px; height: 66px; border-radius: 18px; font-size: 34px; margin: 0 auto 14px; }
.login-hero h1 { font-size: 24px; margin: 0 0 6px; }
.tagline { color: var(--muted); margin: 0; }
.login-card { display: flex; flex-direction: column; gap: 12px; }
.fineprint { font-size: 11px; color: var(--muted); margin: 2px 0 0; }
.or-line { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 2px 0; }
.or-line::before, .or-line::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.hint { font-size: 12px; color: var(--muted); }
.hint.warn { color: var(--amber); }
.hint.center { text-align: center; }

/* empty state */
.empty { text-align: center; padding: 40px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-ico { font-size: 48px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + 18px); transform: translateX(-50%) translateY(10px);
  background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 24px; font-size: 13.5px;
  font-weight: 600; box-shadow: var(--shadow); z-index: 50; opacity: 0; transition: all .25s ease; max-width: 90%;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* upgrade modal */
.modal-bg { position: fixed; inset: 0; background: rgba(11,33,43,0.55); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--card); border-radius: 18px; padding: 22px 20px; max-width: 360px; width: 100%; text-align: center; box-shadow: var(--shadow); }
.modal-ico { font-size: 42px; }
.modal h3 { margin: 6px 0; }
.price-tag { font-size: 30px; font-weight: 800; color: var(--teal); margin: 12px 0; }
.price-tag span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }

/* tab bar */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 520px;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: flex; align-items: stretch; background: var(--card); border-top: 1px solid var(--line);
  z-index: 30; box-shadow: 0 -2px 12px rgba(16,42,67,0.06);
}
.tab {
  flex: 1; border: 0; background: transparent; color: var(--muted); font-size: 10.5px; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer;
}
.tab .ico { font-size: 20px; }
.tab.active { color: var(--navy-2); }
@media (prefers-color-scheme: dark) { .tab.active { color: #6cc4ff; } }
.tab-add .ico {
  background: linear-gradient(135deg, var(--gold), #f0b95e); color: #3a2a06; width: 42px; height: 42px;
  border-radius: 14px; display: grid; place-items: center; font-size: 24px; margin-top: -14px;
  box-shadow: var(--shadow);
}
.tab-add { color: var(--ink); }
