/* SplitBill: clean fintech look. Inter, indigo brand, soft cards; light and dark themes. */
:root {
    --bg: #f5f6fb; --bg2: #eef0f8; --card: #ffffff; --ink: #0f1222; --ink2: #4a5068; --muted: #8a90a6; --line: #e6e8f1;
    --brand: #4f46e5; --brand2: #7c3aed; --brand-soft: #eef0ff; --pos: #059669; --pos-soft: #e7f7f1; --neg: #e11d48; --neg-soft: #fdebef;
    --warn: #b45309; --shadow: 0 1px 2px rgba(16, 20, 50, .04), 0 8px 24px rgba(16, 20, 50, .06); --shadow-lg: 0 20px 60px rgba(16, 20, 50, .18);
    --r: 16px; --r-sm: 10px; --safe-b: env(safe-area-inset-bottom);
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b0e1a; --bg2: #11152a; --card: #151a2e; --ink: #eef0fa; --ink2: #b4b9d0; --muted: #7d84a3; --line: #252b45;
        --brand: #818cf8; --brand2: #a78bfa; --brand-soft: #1e2246; --pos: #34d399; --pos-soft: #0f2a24; --neg: #fb7185; --neg-soft: #2e1520;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25); --shadow-lg: 0 20px 60px rgba(0, 0, 0, .5);
        color-scheme: dark;
    }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.45 Inter, system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; font-feature-settings: 'tnum' 1, 'cv11' 1; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--pos); } .neg { color: var(--neg); } .muted { color: var(--muted); }

/* Buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 11px 16px; font-weight: 600; transition: transform .08s, background .15s, box-shadow .15s; }
.btn:active { transform: scale(.98); }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand2)); border-color: transparent; color: #fff; box-shadow: 0 6px 18px rgba(79, 70, 229, .32); }
.btn-primary:disabled { opacity: .55; box-shadow: none; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--brand); }
.btn-danger { color: var(--neg); border-color: color-mix(in srgb, var(--neg) 30%, var(--line)); }
.btn-sm { padding: 7px 12px; font-size: 13.5px; border-radius: 10px; }
.btn-block { width: 100%; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink2); }
input, select, textarea { width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 12px 14px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.pw { position: relative; }
.pw input { padding-right: 70px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--brand); font-weight: 600; font-size: 13px; padding: 8px; }
.form-err { margin: -4px 0 12px; color: var(--neg); font-size: 13.5px; font-weight: 500; }
.fine { font-size: 12.5px; color: var(--muted); margin: 12px 0 0; text-align: center; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--bg2); border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 18px; }
.seg-btn { border: 0; background: transparent; border-radius: 9px; padding: 9px 10px; font-weight: 600; font-size: 14px; color: var(--ink2); }
.seg-btn.active { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(16, 20, 50, .12); }

/* Landing */
.landing { min-height: 100vh; background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--brand) 16%, transparent), transparent 60%), radial-gradient(900px 500px at 110% 10%, color-mix(in srgb, var(--brand2) 14%, transparent), transparent 60%), var(--bg); }
.landing-inner { max-width: 520px; margin: 0 auto; padding: max(28px, env(safe-area-inset-top)) 18px 48px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: -.01em; }
.logo-mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--brand), var(--brand2)); position: relative; box-shadow: 0 6px 16px rgba(79, 70, 229, .35); }
.logo-mark::before, .logo-mark::after { content: ''; position: absolute; background: #fff; border-radius: 2px; }
.logo-mark::before { left: 8px; right: 8px; top: 9px; height: 3px; }
.logo-mark::after { left: 8px; width: 7px; bottom: 9px; height: 3px; box-shadow: 8px 0 0 rgba(255, 255, 255, .6); }
.landing h1 { font-size: clamp(30px, 8vw, 40px); line-height: 1.1; letter-spacing: -.03em; margin: 34px 0 12px; font-weight: 800; }
.grad { background: linear-gradient(90deg, var(--brand), var(--brand2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { color: var(--ink2); font-size: 16px; margin: 0 0 24px; }
.auth-card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 18px; box-shadow: var(--shadow); }
.recent { margin-top: 28px; }
.recent h2, .section-h { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 0 0 10px; }
.recent-list { display: grid; gap: 8px; }
.recent-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.recent-item:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.recent-item b { display: block; font-weight: 650; }
.recent-item small { color: var(--muted); }
.recent-item .go { margin-left: auto; color: var(--muted); }
.room-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand2)); flex: none; }
.features { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 14px; }
.features li { display: grid; gap: 2px; padding-left: 16px; border-left: 3px solid color-mix(in srgb, var(--brand) 35%, transparent); }
.features b { font-weight: 650; } .features span { color: var(--ink2); font-size: 14px; }

/* App shell */
.app { max-width: 1080px; margin: 0 auto; padding-bottom: calc(96px + var(--safe-b)); }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 6px; padding: max(10px, env(safe-area-inset-top)) 12px 10px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; display: grid; place-items: center; color: var(--ink2); }
.icon-btn:hover { background: var(--bg2); }
.icon-btn svg circle { fill: currentColor; stroke: none; }
.room-title { flex: 1; min-width: 0; text-align: center; }
.room-title h1 { margin: 0; font-size: 17px; font-weight: 750; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-btn { border: 0; background: none; padding: 0; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.me-btn b { color: var(--brand); font-weight: 650; }

.summary { margin: 4px 16px 0; border-radius: 22px; padding: 18px; color: #fff; background: linear-gradient(135deg, #4f46e5, #7c3aed 60%, #9333ea); box-shadow: 0 16px 40px rgba(79, 70, 229, .3); position: relative; overflow: hidden; }
.summary::after { content: ''; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .18), transparent 70%); }
.summary .s-label { font-size: 12.5px; opacity: .8; font-weight: 500; }
.summary .s-big { font-size: 32px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin: 2px 0 2px; }
.summary .s-sub { font-size: 13.5px; opacity: .9; }
.summary .s-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.summary .s-grid div { background: rgba(255, 255, 255, .13); border-radius: 12px; padding: 9px 10px; }
.summary .s-grid b { display: block; font-size: 15px; font-weight: 700; }
.summary .s-grid small { font-size: 11.5px; opacity: .8; }
.summary .pill { display: inline-flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, .18); border-radius: 999px; padding: 4px 10px; font-size: 12.5px; font-weight: 600; margin-top: 8px; }

.tabs { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + var(--safe-b)); }
.tab { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; font-size: 11.5px; font-weight: 600; color: var(--muted); border-radius: 10px; }
.tab.active { color: var(--brand); }
.content { padding: 16px; }
.panel { animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.fab { position: fixed; z-index: 21; right: 16px; bottom: calc(76px + var(--safe-b)); display: flex; align-items: center; gap: 8px; border: 0; border-radius: 16px; padding: 14px 18px 14px 16px; color: #fff; font-weight: 700; background: linear-gradient(135deg, var(--brand), var(--brand2)); box-shadow: 0 12px 30px rgba(79, 70, 229, .45); }
.fab:active { transform: scale(.97); }

/* Cards and lists */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px 6px; }
.card-h h2 { margin: 0; font-size: 15px; font-weight: 700; flex: 1; }
.list { list-style: none; margin: 0; padding: 4px 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; width: 100%; text-align: left; background: none; border: 0; border-radius: 0; }
button.row:hover { background: color-mix(in srgb, var(--bg2) 60%, transparent); }
.row + .row { border-top: 1px solid var(--line); }
.row .main { flex: 1; min-width: 0; }
.row .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .end { text-align: right; flex: none; }
.row .end b { display: block; font-weight: 700; }
.row .end small { font-size: 12px; font-weight: 600; }
.day { font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 14px 4px 6px; text-transform: uppercase; letter-spacing: .05em; }
.cat { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-size: 20px; flex: none; }
.av { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff; flex: none; letter-spacing: -.02em; }
.av.sm { width: 28px; height: 28px; font-size: 11.5px; }
.av.lg { width: 48px; height: 48px; font-size: 17px; }
.empty { text-align: center; padding: 42px 20px; color: var(--ink2); }
.empty .em-ico { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; margin: 0 auto 14px; background: var(--brand-soft); color: var(--brand); }
.empty .em-ico svg { width: 30px; height: 30px; }
.empty h3 { margin: 0 0 6px; font-size: 17px; color: var(--ink); }
.empty p { margin: 0 auto 16px; max-width: 320px; font-size: 14px; }
.search { margin-bottom: 4px; }

/* Balances */
.bal-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 12px 16px; }
.bal-row + .bal-row { border-top: 1px solid var(--line); }
.bar { position: relative; height: 8px; border-radius: 99px; background: var(--bg2); margin-top: 7px; overflow: hidden; }
.bar i { position: absolute; top: 0; bottom: 0; border-radius: 99px; }
.bar i.p { left: 50%; background: var(--pos); } .bar i.n { right: 50%; background: var(--neg); }
.bar::after { content: ''; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--muted); opacity: .4; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: var(--brand-soft); color: var(--brand); vertical-align: 2px; margin-left: 4px; }

/* Settle up */
.settle-hero { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; padding: 16px; }
.settle-hero .big { white-space: nowrap; }
.settle-hero .big { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.saving { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--pos); background: var(--pos-soft); padding: 4px 10px; border-radius: 99px; }
.tx { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 14px 16px; }
.tx + .tx { border-top: 1px solid var(--line); }
.tx .who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tx .who .names { min-width: 0; }
.tx .who b { font-weight: 650; }
.tx .arrow { color: var(--muted); display: grid; place-items: center; }
.tx .arrow svg { width: 18px; height: 18px; }
.tx .amt { font-size: 17px; font-weight: 800; }
.tx .acts { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.tx.me-in { background: linear-gradient(90deg, var(--pos-soft), transparent 70%); }
.tx.me-out { background: linear-gradient(90deg, var(--neg-soft), transparent 70%); }
.how { font-size: 13.5px; color: var(--ink2); padding: 14px 16px; }
.how p { margin: 0 0 8px; }
.done-badge { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 14px; background: var(--pos-soft); color: var(--pos); }
.done-badge svg { width: 34px; height: 34px; stroke-width: 2.5; }

/* Sheet (modal) */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(10, 12, 30, .45); backdrop-filter: blur(2px); animation: fade-in .2s ease; }
.sheet { position: relative; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; background: var(--card); border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg); padding: 8px 18px calc(18px + var(--safe-b)); animation: up .25s cubic-bezier(.2, .9, .25, 1); overscroll-behavior: contain; }
.sheet::before { content: ''; display: block; width: 40px; height: 5px; border-radius: 99px; background: var(--line); margin: 4px auto 10px; }
@keyframes up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } }
.sheet-h { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.sheet-h h2 { margin: 0; font-size: 19px; font-weight: 750; flex: 1; letter-spacing: -.01em; }
.sheet-foot { position: sticky; bottom: calc(-18px - var(--safe-b)); margin: 18px -18px calc(-18px - var(--safe-b)); padding: 12px 18px calc(12px + var(--safe-b)); background: color-mix(in srgb, var(--card) 94%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--line); display: flex; gap: 10px; }
.sheet-foot .btn-primary { flex: 1; }
.amount-in { display: flex; align-items: baseline; justify-content: center; gap: 6px; padding: 10px 0 18px; }
.amount-in .cur { font-size: 26px; font-weight: 700; color: var(--muted); }
.amount-in input { border: 0; box-shadow: none !important; background: transparent; font-size: 44px; font-weight: 800; letter-spacing: -.03em; text-align: left; width: 3ch; min-width: 2ch; max-width: 70vw; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 6px 12px 6px 6px; font-size: 14px; font-weight: 600; }
.chip.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.chip .av { width: 26px; height: 26px; font-size: 11px; }
.chip.cat-chip { padding: 7px 12px; }
.split-list { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.split-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 10px 12px; }
.split-row + .split-row { border-top: 1px solid var(--line); }
.split-row input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--brand); margin: 0; }
.split-row .in { width: 110px; padding: 8px 10px; text-align: right; }
.split-row .share { font-weight: 650; color: var(--ink2); min-width: 80px; text-align: right; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; }
.stepper button { border: 0; background: none; width: 32px; height: 32px; font-size: 18px; color: var(--brand); }
.stepper span { min-width: 26px; text-align: center; font-weight: 700; }
.split-foot { display: flex; justify-content: space-between; font-size: 13px; padding: 8px 2px 0; color: var(--muted); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.label { font-size: 13px; font-weight: 600; color: var(--ink2); margin: 0 0 8px; display: block; }
.block { margin-bottom: 18px; }
.who-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-bottom: 16px; }
.who-btn { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); font-weight: 600; }
.who-btn:hover { border-color: var(--brand); }
.who-btn.on { border-color: var(--brand); background: var(--brand-soft); }
.menu-list { display: grid; gap: 6px; }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 13px 12px; border-radius: 12px; border: 0; background: none; text-align: left; font-weight: 600; width: 100%; }
.menu-item:hover { background: var(--bg2); }
.menu-item small { display: block; font-weight: 500; color: var(--muted); font-size: 12.5px; }
.menu-item.danger { color: var(--neg); }
.share-box { background: var(--bg2); border-radius: 14px; padding: 14px; margin-bottom: 14px; font-size: 14px; }
.share-box .k { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.share-box .v { font-weight: 700; font-size: 16px; word-break: break-all; margin-bottom: 8px; }

.toast { position: fixed; z-index: 60; left: 50%; bottom: calc(150px + var(--safe-b)); transform: translateX(-50%); background: #111427; color: #fff; padding: 11px 18px; border-radius: 12px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px); animation: up .2s ease; }
.offline { position: fixed; z-index: 30; top: 0; left: 0; right: 0; padding: calc(6px + env(safe-area-inset-top)) 12px 6px; text-align: center; font-size: 13px; font-weight: 600; background: #b45309; color: #fff; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, .4); border-top-color: #fff; animation: rot .7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
.skeleton { height: 64px; border-radius: 12px; margin: 8px 16px; background: linear-gradient(90deg, var(--bg2), color-mix(in srgb, var(--bg2) 50%, var(--card)), var(--bg2)); background-size: 200% 100%; animation: sk 1.2s linear infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* Desktop: tabs on top, two columns (bills | balances + settle up), centred sheets. */
@media (min-width: 900px) {
    .app { padding-bottom: 40px; }
    .topbar { padding: 16px 24px 12px; }
    .room-title { text-align: left; padding-left: 4px; }
    .room-title h1 { font-size: 22px; }
    .summary { margin: 4px 24px 0; padding: 22px 24px; display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 18px; }
    .summary .s-grid { margin-top: 0; grid-template-columns: repeat(3, 150px); }
    .tabs { position: static; display: flex; gap: 6px; background: none; backdrop-filter: none; border: 0; padding: 18px 24px 0; }
    .tab { flex-direction: row; gap: 8px; padding: 9px 14px; font-size: 14px; border-radius: 10px; }
    .tab svg { width: 18px; height: 18px; }
    .tab.active { background: var(--card); box-shadow: var(--shadow); }
    .content { padding: 16px 24px; }
    .fab { bottom: 28px; right: max(28px, calc((100vw - 1080px) / 2 + 24px)); }
    .sheet-wrap { align-items: center; }
    .sheet { border-radius: 22px; max-height: 88vh; padding-top: 18px; }
    .sheet::before { display: none; }
    .toast { bottom: 40px; }
}
.bar.plain::after { display: none; }

/* Multi-currency: the bill's currency under the amount, and the exchange-rates card on Settle up. */
.cur-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin: -8px 0 18px; flex-wrap: wrap; }
.cur-row select { width: auto; max-width: 240px; padding: 7px 10px; border-radius: 99px; font-size: 13.5px; font-weight: 600; background: var(--bg2); border-color: transparent; }
.cur-row span { font-size: 13px; font-weight: 600; }
.rate-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-top: 10px; }
.rate { display: flex; justify-content: space-between; gap: 8px; background: var(--bg2); border-radius: 10px; padding: 8px 10px; font-size: 13.5px; }
.card.rates.locked { border-color: color-mix(in srgb, var(--pos) 45%, var(--line)); }
