/* Orbit — dark-first design system (Inter body, Chakra Petch display) */

:root {
    --bg: #0B0E1A;
    --bg-glow: radial-gradient(ellipse 90% 45% at 50% -8%, rgba(79, 70, 229, 0.28), transparent 62%);
    --card: #141830;
    --card-raised: #1A2040;
    --border: #232948;
    --text: #E8EAF6;
    --text-dim: #9BA3C7;
    --accent: #A5B4FC;          /* accent as TEXT on dark */
    --accent-solid: #4F46E5;    /* accent as SURFACE (white text, AA) */
    --accent-solid-hover: #4338CA;
    --accent-soft: rgba(129, 140, 248, 0.14);
    --success: #34D399;
    --success-soft: rgba(52, 211, 153, 0.14);
    --warn: #FBBF24;
    --warn-soft: rgba(251, 191, 36, 0.12);
    --danger: #F87171;
    --danger-soft: rgba(248, 113, 113, 0.12);
    --shadow: 0 14px 38px rgba(3, 6, 18, 0.55);
    --radius-card: 20px;
    --radius-input: 14px;
    --radius-pill: 999px;
    --font-body: 'Inter', system-ui, sans-serif;
    --font-display: 'Chakra Petch', 'Inter', sans-serif;
}

[data-theme='light'] {
    --bg: #F4F5FB;
    --bg-glow: radial-gradient(ellipse 90% 45% at 50% -8%, rgba(79, 70, 229, 0.10), transparent 62%);
    --card: #FFFFFF;
    --card-raised: #F0F1FA;
    --border: #E2E5F2;
    --text: #10121D;
    --text-dim: #5B6178;
    --accent: #4F46E5;
    --accent-solid: #4F46E5;
    --accent-solid-hover: #4338CA;
    --accent-soft: #EDEDFC;
    --success: #15803D;
    --success-soft: #E7F6EC;
    --warn: #B45309;
    --warn-soft: #FEF6E0;
    --danger: #DC2626;
    --danger-soft: #FDEBEB;
    --shadow: 0 1px 3px rgba(16, 18, 29, 0.06), 0 6px 18px rgba(16, 18, 29, 0.06);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: var(--bg-glow);
    pointer-events: none;
    z-index: 0;
}

.shell {
    position: relative;
    z-index: 1;
    max-width: 520px;
    margin: 0 auto;
    padding: 0 16px calc(120px + env(safe-area-inset-bottom));
}

/* ---------- Top bar ---------- */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 2px 14px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-mark {
    width: 26px;
    height: 26px;
    color: var(--accent);
}

.brand-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 20px;
    letter-spacing: 0.04em;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text-dim);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { color: var(--text); }

/* ---------- Cards ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow);
    padding: 18px;
    margin-bottom: 14px;
}

.card-kicker {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.hero { text-align: left; }

.hero-amount {
    font-family: var(--font-display);
    font-size: 44px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: 0.01em;
}

.hero-sub {
    color: var(--text-dim);
    font-size: 13.5px;
    margin-top: 6px;
}

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.section-head h2 {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin: 0;
}

.section-meta {
    font-size: 12px;
    color: var(--text-dim);
}

.quiet { color: var(--text-dim); font-size: 13.5px; margin: 6px 0; }
.center { text-align: center; }

/* ---------- Rows ---------- */
.rows { display: flex; flex-direction: column; }

.sub-row, .due-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 4px;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.sub-row:last-child, .due-row:last-child { border-bottom: none; }
.sub-row-paused { opacity: 0.55; }

.row-emoji { font-size: 22px; width: 30px; text-align: center; flex-shrink: 0; }

.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }

.row-name {
    font-weight: 600;
    font-size: 14.5px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.row-meta { font-size: 12px; color: var(--text-dim); }

.row-amount { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }

.row-price {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap;
}

.row-price small { font-size: 11px; color: var(--text-dim); font-weight: 500; }
.row-equiv { font-size: 11px; color: var(--text-dim); }

.rank {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--accent);
    width: 30px;
    text-align: center;
    flex-shrink: 0;
}

/* ---------- Chips & badges ---------- */
.badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    letter-spacing: 0.02em;
}

.badge-muted { background: var(--card-raised); color: var(--text-dim); border: 1px solid var(--border); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-leak { background: var(--danger-soft); color: var(--danger); }

.due-chip {
    font-size: 11.5px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    background: var(--card-raised);
    color: var(--text-dim);
    white-space: nowrap;
}

.due-chip-soon { background: var(--accent-soft); color: var(--accent); }
.due-chip-hot { background: var(--warn-soft); color: var(--warn); }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--card-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 5px 12px;
    font-size: 12.5px;
}

/* ---------- Special cards ---------- */
.trial-card { border-color: rgba(251, 191, 36, 0.35); }
.warn-text { color: var(--warn); }
.trial-line { margin: 4px 0 0; font-size: 14px; line-height: 1.5; }

.leak-card { border-color: rgba(248, 113, 113, 0.3); }
.leak-text { color: var(--danger); }
.leak-card p { margin: 4px 0 10px; font-size: 14px; line-height: 1.5; }
.leak-names { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }

/* ---------- Insights ---------- */
.bars { display: flex; flex-direction: column; gap: 10px; }

.bar-row {
    display: grid;
    grid-template-columns: 118px 1fr auto;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.bar-track {
    height: 8px;
    border-radius: var(--radius-pill);
    background: var(--card-raised);
    overflow: hidden;
}

.bar-fill {
    display: block;
    height: 100%;
    border-radius: var(--radius-pill);
    background: linear-gradient(90deg, rgba(129, 140, 248, 0.55), var(--accent-solid));
}

[data-theme='light'] .bar-fill {
    background: linear-gradient(90deg, rgba(79, 70, 229, 0.45), var(--accent-solid));
}

.bar-value { font-family: var(--font-display); font-size: 12.5px; font-weight: 600; white-space: nowrap; }

.sim-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 4px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.sim-row:last-child { border-bottom: none; }
.sim-row input { width: 18px; height: 18px; accent-color: var(--accent-solid); flex-shrink: 0; }
.sim-row-on .row-name { color: var(--accent); }

.sim-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-input);
    background: var(--card-raised);
    color: var(--text-dim);
    font-size: 13.5px;
}

.sim-total-on { background: var(--success-soft); color: var(--success); }
.sim-total strong { font-family: var(--font-display); }

/* ---------- Buttons ---------- */
.btn-primary {
    font: inherit;
    font-weight: 600;
    background: var(--accent-solid);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-pill);
    padding: 12px 22px;
    cursor: pointer;
}

.btn-primary:hover { background: var(--accent-solid-hover); }

.btn-ghost {
    font: inherit;
    font-weight: 600;
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 11px 20px;
    cursor: pointer;
}

.btn-ghost:hover { background: var(--accent-soft); }

.btn-danger-ghost {
    font: inherit;
    font-weight: 600;
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 11px 20px;
    cursor: pointer;
}

.btn-danger-ghost:hover { background: var(--danger-soft); }

/* ---------- Empty states ---------- */
.empty-hero {
    text-align: center;
    padding: 44px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.empty-orbit { width: 96px; height: 96px; color: var(--accent); opacity: 0.85; margin-bottom: 6px; }
.empty-hero h1 { font-family: var(--font-display); font-size: 22px; margin: 0; }
.empty-hero p { color: var(--text-dim); font-size: 14px; line-height: 1.55; margin: 0 0 10px; max-width: 320px; }
.empty-mini { text-align: center; padding: 30px 20px; }
.empty-mini .btn-primary { margin-top: 10px; }

/* ---------- Search ---------- */
.search-wrap { margin-bottom: 14px; }

.input {
    font: inherit;
    width: 100%;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    color: var(--text);
    padding: 11px 14px;
}

.input:focus {
    outline: none;
    border-color: var(--accent-solid);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-input { border-radius: var(--radius-pill); }

/* ---------- Bottom nav & FAB ---------- */
.bottom-nav {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(14px + env(safe-area-inset-bottom));
    display: flex;
    gap: 4px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 6px;
    box-shadow: var(--shadow);
    z-index: 30;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    min-width: 76px;
    padding: 8px 14px;
    border: none;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--text-dim);
    font-family: inherit;
    font-size: 10.5px;
    font-weight: 600;
    cursor: pointer;
}

.nav-item svg { width: 21px; height: 21px; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }

.fab {
    position: fixed;
    right: max(18px, calc(50% - 260px + 18px));
    bottom: calc(92px + env(safe-area-inset-bottom));
    width: 56px;
    height: 56px;
    border-radius: var(--radius-pill);
    border: none;
    background: var(--accent-solid);
    color: #fff;
    box-shadow: 0 10px 26px rgba(79, 70, 229, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 30;
}

.fab svg { width: 24px; height: 24px; }
.fab:hover { background: var(--accent-solid-hover); }

/* ---------- Overlay / sheet ---------- */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 6, 16, 0.66);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 50;
}

.sheet {
    width: 100%;
    max-width: 520px;
    max-height: 88dvh;
    overflow-y: auto;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 24px 24px 0 0;
    padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 14px;
}

@media (min-width: 560px) {
    .overlay { align-items: center; padding: 20px; }
    .sheet { border-radius: 24px; }
}

.sheet-title {
    font-family: var(--font-display);
    font-size: 18px;
    margin: 0;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--text-dim); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field small { font-size: 11.5px; }

.seg-group { display: flex; gap: 6px; flex-wrap: wrap; }

.seg {
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
}

.seg-on {
    background: var(--accent-solid);
    border-color: var(--accent-solid);
    color: #fff;
}

.stack { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }

.sheet-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.spacer { flex: 1; }

.form-error {
    margin: 0;
    padding: 10px 14px;
    border-radius: var(--radius-input);
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 13px;
}

.about-line { font-size: 11.5px; }

/* ---------- Snackbar ---------- */
.snackbar {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(88px + env(safe-area-inset-bottom));
    background: var(--card-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow);
    padding: 11px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 13.5px;
    z-index: 60;
    max-width: min(92vw, 480px);
}

.snackbar button {
    font: inherit;
    font-weight: 700;
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    padding: 0;
}

/* ---------- Onboarding ---------- */
.ob-screen {
    min-height: 92dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 12px;
    padding: 24px 10px;
}

.ob-brand { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); }
.ob-icon { width: 84px; height: 84px; color: var(--accent); margin-bottom: 6px; }
.ob-title { font-family: var(--font-display); font-size: 24px; margin: 0; }
.ob-desc { color: var(--text-dim); font-size: 14.5px; line-height: 1.6; max-width: 330px; margin: 0; }
.ob-lang { justify-content: center; }
.ob-dots { display: flex; gap: 7px; margin: 8px 0 4px; }
.ob-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border); }
.ob-dot-on { background: var(--accent); }
.ob-actions { display: flex; flex-direction: column; gap: 10px; width: min(300px, 90%); }
.ob-actions .btn-primary, .ob-actions .btn-ghost { width: 100%; }

/* ---------- Orbit Pro ---------- */
.pro-head { display: flex; align-items: center; gap: 10px; }
.pro-mark { width: 26px; height: 26px; color: var(--accent); }
.pro-tag { margin: 0; color: var(--text-dim); font-size: 14px; }

.pro-feats {
    margin: 0;
    padding: 0 0 0 2px;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 9px;
    font-size: 14px;
}

.pro-feats li { padding-left: 26px; position: relative; line-height: 1.45; }
.pro-feats li::before { content: '✦'; position: absolute; left: 4px; color: var(--accent); }

.pro-buy { text-align: center; text-decoration: none; display: block; }
.pro-buy[disabled] { opacity: 0.55; cursor: default; }
.pro-license-row { display: flex; gap: 8px; }
.pro-license-row .input { flex: 1; }
.badge-pro { background: var(--accent-soft); color: var(--accent); }

.locked-card { border-style: dashed; }
.locked-card .btn-ghost { margin-top: 8px; }

/* ---------- Price rises ---------- */
.rise-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 4px;
    border-bottom: 1px solid var(--border);
}

.rise-row:last-child { border-bottom: none; }
.rise-delta { font-family: var(--font-display); font-size: 12px; font-weight: 600; text-align: right; }
.rise-up { color: var(--danger); }
.rise-down { color: var(--success); }
