* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif; background: #f0f2f5; color: #222; font-size: 15px; }

/* ---------- Themes ---------- */
.theme-navy  { --brand: #1F3864; --brand-2: #2E5FA3; --brand-dark: #162d52; --soft: #BDD3F5; --tint: #EEF2F8; --tile-bg: #f5f8ff; --tile-border: #d0ddf5; --tile-hover: #e4edff; --tile-inr: #5a7ab5; }
.theme-plum  { --brand: #4A1942; --brand-2: #7B2D73; --brand-dark: #3a1133; --soft: #E8C8E5; --tint: #F3EAF2; --tile-bg: #fbf5fa; --tile-border: #ead3e7; --tile-hover: #f5e4f2; --tile-inr: #8d5a87; }

/* ---------- Tab bar ---------- */
.tabbar { position: sticky; top: 0; z-index: 300; display: flex; align-items: stretch; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.12); height: 46px; }
.tabbar > button { flex: 1; border: none; background: #fff; padding: 0 8px; font: 600 14px/1 inherit; font-family: inherit; color: #666; cursor: pointer; border-bottom: 3px solid transparent; }
.tabbar > button[data-tab="amit"].active    { color: #1F3864; border-bottom-color: #1F3864; }
.tabbar > button[data-tab="parents"].active { color: #4A1942; border-bottom-color: #4A1942; }
.logout-form { display: flex; align-items: center; padding: 0 8px; }
.logout-btn { border: 1px solid #ccc; background: #fff; color: #555; border-radius: 6px; padding: 6px 10px; font: 600 12px inherit; font-family: inherit; cursor: pointer; }
.logout-btn:hover { background: #f3f3f3; }
.tab { display: none; }
.tab.active { display: block; }

/* ---------- Header ---------- */
.header { background: var(--brand); color: #fff; padding: 20px 16px 16px; }
.header h1 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.header .meta { font-size: 13px; opacity: 0.8; }
.history { margin-top: 10px; display: flex; align-items: center; gap: 8px; font-size: 12px; }
.history label { opacity: 0.8; }
.history select { font: inherit; padding: 4px 6px; border-radius: 6px; border: none; max-width: 70%; }
.nw-box { background: var(--brand-2); padding: 16px; display: flex; justify-content: space-between; align-items: center; }
.nw-box .gbp { font-size: 28px; font-weight: 700; color: #fff; }
.nw-box .inr { font-size: 15px; color: var(--soft); margin-top: 2px; }
.nw-box .label { font-size: 11px; color: var(--soft); text-transform: uppercase; letter-spacing: 1px; }
.nw-box .fx { text-align: right; }
.nw-box .fx-rate { color: #fff; font-size: 18px; font-weight: 600; }

/* ---------- Sections ---------- */
section { margin: 12px 10px; background: #fff; border-radius: 0; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.sec-header { width: 100%; background: var(--brand); color: #fff; border: none; padding: 10px 14px; font: 600 14px inherit; font-family: inherit; letter-spacing: 0.3px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; text-align: left; }
.sec-header:hover { background: var(--brand-dark); }
.sec-header.static { cursor: default; }
.sec-header.static:hover { background: var(--brand); }
.sec-body { overflow: hidden; max-height: 4000px; transition: max-height 0.35s ease; }
.sec-body.collapsed { max-height: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: var(--tint); color: var(--brand); padding: 8px 10px; text-align: right; font-weight: 600; font-size: 11px; text-transform: uppercase; white-space: nowrap; }
th:first-child { text-align: left; }
td { padding: 9px 10px; text-align: right; border-bottom: 1px solid #f0f0f0; white-space: nowrap; }
td:first-child { text-align: left; font-weight: 500; white-space: normal; min-width: 110px; }
tr:last-child td { border-bottom: none; }
tr.total td { background: var(--tint); font-weight: 700; border-top: 2px solid var(--brand); }
.gain { color: #1a7a3a; }
.loss { color: #c0392b; }
.star { color: #f39c12; }
.muted { color: #888; font-size: 12px; padding: 8px 14px; }

/* ---------- Net-worth tiles (sticky under the tab bar) ---------- */
.sec-nw { position: sticky; top: 46px; z-index: 100; margin: 0; border-radius: 0; box-shadow: 0 2px 8px rgba(0,0,0,0.15); overflow: visible; }
.sec-nw .sec-body { overflow: visible; }
.tiles { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; }
.tile { position: relative; display: block; background: var(--tile-bg); border: 1.5px solid var(--tile-border); border-radius: 0; padding: 12px 10px; cursor: pointer; text-align: left; min-width: 100px; font-family: inherit; transition: background 0.15s, transform 0.1s; }
.tile:hover { background: var(--tile-hover); transform: scale(1.02); }
.tile:active { transform: scale(0.98); }
.tile > span { display: block; }
.tile-label { font-size: 11px; color: var(--brand); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 6px; }
.tile-gbp { font-size: 17px; font-weight: 700; color: var(--brand); }
.tile-inr { font-size: 11px; color: var(--tile-inr); margin-top: 2px; }
.tile:hover::after { content: attr(data-pct); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; white-space: nowrap; pointer-events: none; z-index: 9999; }
.tile:hover::before { content: ''; position: absolute; bottom: calc(100% + 1px); left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: var(--brand); pointer-events: none; z-index: 9999; }

footer { text-align: center; padding: 16px; font-size: 11px; color: #999; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, #1F3864 0%, #2E5FA3 60%, #4A1942 100%); padding: 16px; }
.login-card { background: #fff; width: 100%; max-width: 360px; border-radius: 14px; padding: 28px 24px; box-shadow: 0 10px 30px rgba(0,0,0,0.25); }
.login-brand { font-size: 34px; text-align: center; }
.login-card h1 { font-size: 20px; text-align: center; color: #1F3864; margin-top: 6px; }
.login-sub { text-align: center; color: #777; font-size: 13px; margin: 4px 0 18px; }
.login-card label { display: block; font-size: 12px; font-weight: 600; color: #1F3864; margin: 12px 0 4px; }
.login-card input { width: 100%; padding: 11px 12px; border: 1.5px solid #d0ddf5; border-radius: 8px; font-size: 15px; font-family: inherit; }
.login-card input:focus { outline: none; border-color: #2E5FA3; box-shadow: 0 0 0 3px rgba(46,95,163,0.15); }
.login-card button { width: 100%; margin-top: 20px; padding: 12px; background: #1F3864; color: #fff; border: none; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit; }
.login-card button:hover { background: #162d52; }
.login-error { background: #fdecea; color: #a12a1e; border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.login-info { background: #eef2f8; color: #1F3864; border-radius: 8px; padding: 10px 12px; font-size: 13px; }

/* ---------- Notification area (e.g. upcoming interest payments) ---------- */
.notice { margin: 12px 10px 0; background: #fffaf0; border: 1.5px solid #f0d58c; border-left: 5px solid #e0a800; }
.notice-title { padding: 10px 12px 6px; font-weight: 700; font-size: 14px; color: #7a5600; }
.notice table { background: transparent; }
.notice th { background: #fdf0cc; color: #7a5600; }
.notice .muted { padding: 6px 12px 10px; }
