/* =========================================================
   Nexari design system
   ========================================================= */
:root {
  --ink: #0B1220;
  --ink-2: #1F2937;
  --muted: #64748B;
  --muted-2: #94A3B8;
  --line: #E6EAF0;
  --line-2: #F1F4F8;
  --bg: #F6F8FB;
  --surface: #FFFFFF;
  --navy: #0B1F3A;
  --navy-2: #12305A;
  --accent: #0EA5A4;
  --accent-2: #0B8A89;
  --accent-soft: #E6F7F7;
  --success: #15803D;
  --success-soft: #E8F6EE;
  --warning: #B45309;
  --warning-soft: #FDF3E3;
  --danger: #B91C1C;
  --danger-soft: #FDECEC;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
  --shadow-lg: 0 20px 50px rgba(11, 31, 58, .18);
  --sidebar-w: 256px;
  --bottom-nav-h: 68px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  background: var(--surface);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4, h5, h6 { color: var(--ink); font-weight: 700; letter-spacing: -.02em; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { color: var(--accent); }
.text-muted { color: var(--muted) !important; }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------- Buttons ---------- */
.btn { font-weight: 600; border-radius: var(--radius-sm); padding: .7rem 1.15rem; font-size: .95rem; transition: all .15s ease; }
.btn-sm { padding: .45rem .8rem; font-size: .85rem; border-radius: 8px; }
.btn-lg { padding: .9rem 1.5rem; font-size: 1rem; border-radius: 12px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover, .btn-primary:focus { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.btn-primary:disabled { background: #9CCFCF; border-color: #9CCFCF; }
.btn-dark { background: var(--navy); border-color: var(--navy); }
.btn-dark:hover { background: var(--navy-2); border-color: var(--navy-2); }
.btn-light { background: var(--line-2); border-color: var(--line-2); color: var(--ink); }
.btn-light:hover { background: var(--line); border-color: var(--line); }
.btn-outline { background: transparent; border: 1.5px solid var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--ink); color: var(--ink); }
.btn-ghost-light { background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.2); }
.btn-ghost-light:hover { background: rgba(255,255,255,.18); color: #fff; }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); border: none; }
.btn-danger-soft:hover { background: #F9D9D9; color: var(--danger); }
.btn-success-soft { background: var(--success-soft); color: var(--success); border: none; }
.btn-success-soft:hover { background: #D3EEDD; color: var(--success); }

/* ---------- Forms ---------- */
.form-label { font-size: .85rem; font-weight: 600; color: var(--ink-2); margin-bottom: .4rem; }
.form-control, .form-select {
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: .75rem .9rem; font-size: .95rem; color: var(--ink); background-color: var(--surface);
}
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(14,165,164,.12); }
.form-text { color: var(--muted); font-size: .8rem; }
.input-amount { font-size: 1.35rem; font-weight: 700; letter-spacing: -.01em; }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }

/* ---------- Cards & primitives ---------- */
.card-x {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 1.25rem;
}
.card-x + .card-x { margin-top: 1rem; }
.card-title-x { font-size: 1rem; font-weight: 700; margin: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.card-head a { font-size: .85rem; font-weight: 600; }

.badge-soft { display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .6rem; border-radius: 999px; font-size: .74rem; font-weight: 600; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger); }
.badge-muted   { background: var(--line-2); color: var(--muted); }
.badge-accent  { background: var(--accent-soft); color: var(--accent-2); }

.demo-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--warning-soft); color: var(--warning);
  border: 1px solid #F5DDB5; border-radius: 999px; padding: .2rem .65rem;
  font-size: .72rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase;
}
.demo-banner {
  background: var(--warning-soft); color: var(--warning); text-align: center;
  font-size: .82rem; font-weight: 600; padding: .5rem 1rem; border-bottom: 1px solid #F5DDB5;
}

.kv { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; font-size: .9rem; border-bottom: 1px dashed var(--line); }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--muted); }
.kv span:last-child { font-weight: 600; text-align: right; }
.kv.total span { color: var(--ink); font-weight: 700; font-size: 1rem; }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty i { font-size: 2rem; color: var(--muted-2); display: block; margin-bottom: .5rem; }

.alert { border-radius: var(--radius-sm); border: 0; font-size: .9rem; }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-danger  { background: var(--danger-soft);  color: var(--danger); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }
.alert-info    { background: var(--accent-soft);  color: var(--accent-2); }

/* =========================================================
   Landing page
   ========================================================= */
.site-nav { position: sticky; top: 0; z-index: 1030; background: rgba(255,255,255,.85); backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.site-nav.scrolled { border-bottom-color: var(--line); }
.site-nav .container { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.2rem; color: var(--ink); letter-spacing: -.02em; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), var(--navy)); display: grid; place-items: center; color: #fff; font-size: .95rem; }
.site-links { display: flex; gap: .25rem; }
.site-links a { color: var(--ink-2); font-weight: 500; font-size: .92rem; padding: .5rem .8rem; border-radius: 8px; }
.site-links a:hover { background: var(--line-2); color: var(--ink); }
@media (max-width: 991.98px) { .site-links { display: none; } }

.hero { position: relative; overflow: hidden; padding: 5rem 0 4rem; background: radial-gradient(1200px 500px at 85% -10%, rgba(14,165,164,.14), transparent 60%), radial-gradient(900px 400px at -10% 10%, rgba(11,31,58,.07), transparent 60%); }
.eyebrow { display: inline-flex; align-items: center; gap: .5rem; font-size: .8rem; font-weight: 600; color: var(--accent-2); background: var(--accent-soft); padding: .35rem .8rem; border-radius: 999px; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.08; letter-spacing: -.035em; margin: 1.25rem 0 1rem; }
.hero h1 .grad { background: linear-gradient(90deg, var(--accent), var(--navy-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 1.12rem; color: var(--muted); max-width: 34rem; }
.hero-cta { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 2rem; }
.hero-trust { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-top: 2rem; color: var(--muted); font-size: .88rem; }
.hero-trust i { color: var(--accent); margin-right: .35rem; }

/* Phone mockup in hero */
.phone { width: 300px; max-width: 100%; margin: 0 auto; border-radius: 40px; padding: 12px; background: #0B1220; box-shadow: var(--shadow-lg); }
.phone-screen { border-radius: 30px; overflow: hidden; background: var(--bg); }
.phone-top { padding: 1.4rem 1.1rem 1rem; }
.phone-balance { background: linear-gradient(140deg, var(--navy) 0%, var(--navy-2) 60%, #0E6E7A 100%); color: #fff; border-radius: 18px; padding: 1.1rem; }
.phone-balance small { opacity: .7; font-size: .7rem; }
.phone-balance .amt { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; }
.phone-row { display: flex; align-items: center; gap: .7rem; background: #fff; border-radius: 12px; padding: .65rem .75rem; margin: .5rem 1.1rem; font-size: .75rem; box-shadow: var(--shadow-sm); }
.phone-row .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-2); }
.phone-nav { display: flex; justify-content: space-around; background: #fff; padding: .7rem 0 .9rem; margin-top: 1rem; border-top: 1px solid var(--line); color: var(--muted-2); font-size: 1.1rem; }
.phone-nav .on { color: var(--accent); }

.section { padding: 5rem 0; }
.section-alt { background: var(--bg); }
.section-head { max-width: 40rem; margin: 0 auto 3rem; text-align: center; }
.section-head h2 { font-size: clamp(1.7rem, 3.5vw, 2.4rem); margin: .75rem 0; }
.section-head p { color: var(--muted); font-size: 1.05rem; }

.feature { padding: 1.5rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); height: 100%; transition: transform .2s, box-shadow .2s; }
.feature:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.feature .ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-2); font-size: 1.3rem; margin-bottom: 1rem; }
.feature h3 { font-size: 1.05rem; margin-bottom: .4rem; }
.feature p { color: var(--muted); font-size: .92rem; margin: 0; }

.step { position: relative; padding-left: 3.5rem; }
.step-num { position: absolute; left: 0; top: 0; width: 40px; height: 40px; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 700; display: grid; place-items: center; }
.step h3 { font-size: 1.05rem; margin-bottom: .3rem; }
.step p { color: var(--muted); font-size: .92rem; margin: 0; }

.plan-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.75rem; height: 100%; display: flex; flex-direction: column; }
.plan-card.featured { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(14,165,164,.08), var(--shadow); }
.plan-card .ribbon { position: absolute; top: -12px; right: 1.25rem; background: var(--accent); color: #fff; font-size: .72rem; font-weight: 700; padding: .3rem .7rem; border-radius: 999px; }
.plan-name { font-size: .85rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.plan-rate { font-size: 2.6rem; font-weight: 800; letter-spacing: -.03em; margin: .5rem 0 .25rem; }
.plan-rate small { font-size: .95rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.plan-list { list-style: none; padding: 0; margin: 1.25rem 0 1.5rem; flex: 1; }
.plan-list li { display: flex; gap: .6rem; padding: .45rem 0; font-size: .92rem; color: var(--ink-2); }
.plan-list i { color: var(--accent); }

.faq .accordion-item { border: 1px solid var(--line); border-radius: var(--radius) !important; margin-bottom: .75rem; overflow: hidden; }
.faq .accordion-button { font-weight: 600; padding: 1.1rem 1.25rem; }
.faq .accordion-button:not(.collapsed) { background: var(--surface); color: var(--ink); box-shadow: none; }
.faq .accordion-button:focus { box-shadow: none; }
.faq .accordion-body { color: var(--muted); padding-top: 0; }

.cta-band { background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 55%, #0E6E7A 100%); border-radius: var(--radius-lg); padding: 3.5rem 2rem; color: #fff; text-align: center; }
.cta-band h2 { color: #fff; font-size: clamp(1.6rem, 3.5vw, 2.2rem); }
.cta-band p { color: rgba(255,255,255,.75); }

.site-footer { border-top: 1px solid var(--line); padding: 3rem 0 2rem; font-size: .9rem; color: var(--muted); }
.site-footer h4 { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink); margin-bottom: 1rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: .5rem; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--ink); }

/* =========================================================
   Auth pages
   ========================================================= */
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: linear-gradient(150deg, var(--navy) 0%, var(--navy-2) 60%, #0E6E7A 100%); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h2 { color: #fff; font-size: 2rem; max-width: 24rem; }
.auth-side p { color: rgba(255,255,255,.7); max-width: 26rem; }
.auth-side .brand { color: #fff; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 1.75rem; margin-bottom: .35rem; }
@media (max-width: 991.98px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-main { align-items: flex-start; padding-top: 3rem; }
}

/* =========================================================
   App shell (user + admin)
   ========================================================= */
.app-body { background: var(--bg); }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--surface);
  border-right: 1px solid var(--line); padding: 1.25rem 1rem; display: flex; flex-direction: column; z-index: 1040;
}
.sidebar .brand { padding: .25rem .5rem 1.5rem; }
.side-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2); padding: 1rem .75rem .5rem; }
.side-link { display: flex; align-items: center; gap: .75rem; padding: .65rem .75rem; border-radius: 10px; color: var(--ink-2); font-weight: 500; font-size: .93rem; margin-bottom: 2px; }
.side-link i { font-size: 1.1rem; color: var(--muted); width: 1.25rem; text-align: center; }
.side-link:hover { background: var(--line-2); color: var(--ink); }
.side-link.active { background: var(--accent-soft); color: var(--accent-2); font-weight: 600; }
.side-link.active i { color: var(--accent-2); }
.side-link .count { margin-left: auto; background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700; border-radius: 999px; padding: .05rem .45rem; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 1rem; }
.side-user { display: flex; align-items: center; gap: .7rem; padding: .5rem; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--navy-2)); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex-shrink: 0; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.3rem; }
.side-user .who { min-width: 0; }
.side-user .who strong { display: block; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .who small { color: var(--muted); font-size: .76rem; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; }
.main-inner { max-width: 1120px; padding: 2rem 2rem 3rem; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-head h1 { font-size: 1.6rem; margin: 0; }
.page-head p { color: var(--muted); margin: .2rem 0 0; font-size: .92rem; }

/* Balance hero card */
.balance-card {
  position: relative; overflow: hidden; color: #fff; border-radius: var(--radius-lg); padding: 1.5rem;
  background: linear-gradient(140deg, var(--navy) 0%, var(--navy-2) 55%, #0E6E7A 100%);
  box-shadow: 0 12px 30px rgba(11,31,58,.22);
}
.balance-card::after { content: ''; position: absolute; width: 260px; height: 260px; right: -80px; top: -110px; border-radius: 50%; background: rgba(255,255,255,.06); }
.balance-card .label { font-size: .82rem; color: rgba(255,255,255,.7); font-weight: 500; }
.balance-card .amount { font-size: clamp(1.9rem, 6vw, 2.5rem); font-weight: 800; letter-spacing: -.03em; margin: .25rem 0 1rem; }
.balance-card .meta { display: flex; gap: 1.5rem; flex-wrap: wrap; font-size: .82rem; color: rgba(255,255,255,.75); }
.balance-card .meta strong { color: #fff; display: block; font-size: 1rem; }

/* Quick actions */
.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; margin: 1.25rem 0; }
.qa { display: flex; flex-direction: column; align-items: center; gap: .45rem; color: var(--ink-2); font-size: .8rem; font-weight: 600; text-align: center; }
.qa:hover { color: var(--ink); }
.qa .ic { width: 54px; height: 54px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; font-size: 1.3rem; color: var(--accent-2); box-shadow: var(--shadow-sm); transition: transform .15s; }
.qa:active .ic { transform: scale(.94); }

/* Stats */
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; height: 100%; }
.stat .s-label { display: flex; align-items: center; gap: .5rem; font-size: .8rem; color: var(--muted); font-weight: 500; }
.stat .s-label i { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-2); font-size: .9rem; }
.stat .s-value { font-size: 1.35rem; font-weight: 700; margin-top: .6rem; letter-spacing: -.02em; }
.stat .s-sub { font-size: .78rem; color: var(--muted); }

/* Transaction list */
.tx-list { list-style: none; margin: 0; padding: 0; }
.tx { display: flex; align-items: center; gap: .85rem; padding: .85rem 0; border-bottom: 1px solid var(--line-2); }
.tx:last-child { border-bottom: 0; }
.tx .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--line-2); color: var(--ink-2); font-size: 1.05rem; flex-shrink: 0; }
.tx .ic.credit { background: var(--success-soft); color: var(--success); }
.tx .body { flex: 1; min-width: 0; }
.tx .title { font-weight: 600; font-size: .92rem; }
.tx .sub { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx .amt { text-align: right; font-weight: 700; font-size: .92rem; white-space: nowrap; }
.tx .amt.credit { color: var(--success); }
.tx .amt small { display: block; margin-top: .15rem; }

/* Investment progress */
.inv { padding: 1rem 0; border-bottom: 1px solid var(--line-2); }
.inv:last-child { border-bottom: 0; }
.progress { height: 6px; border-radius: 999px; background: var(--line-2); }
.progress-bar { background: var(--accent); border-radius: 999px; }

/* Plan picker in app */
.plan-pick { display: block; cursor: pointer; }
.plan-pick input { position: absolute; opacity: 0; }
.plan-pick .plan-card { transition: border-color .15s, box-shadow .15s; }
.plan-pick input:checked + .plan-card { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(14,165,164,.12); }

/* Segmented tabs */
.seg { display: inline-flex; background: var(--line-2); border-radius: 12px; padding: 4px; width: 100%; }
.seg a, .seg button { flex: 1; text-align: center; padding: .55rem .8rem; border-radius: 9px; font-weight: 600; font-size: .88rem; color: var(--muted); border: 0; background: transparent; }
.seg .on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.ref-box { display: flex; gap: .5rem; }
.ref-box input { flex: 1; min-width: 0; font-family: ui-monospace, Menlo, monospace; font-size: .85rem; background: var(--line-2); }

.list-menu { list-style: none; padding: 0; margin: 0; }
.list-menu a, .list-menu button { display: flex; align-items: center; gap: .85rem; padding: .95rem .25rem; border-bottom: 1px solid var(--line-2); color: var(--ink); font-weight: 500; width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; }
.list-menu li:last-child a, .list-menu li:last-child button { border-bottom: 0; }
.list-menu i.lead { width: 36px; height: 36px; border-radius: 10px; background: var(--line-2); display: grid; place-items: center; color: var(--ink-2); }
.list-menu .bi-chevron-right { margin-left: auto; color: var(--muted-2); }

/* Bottom navigation (mobile) */
.bottom-nav { display: none; }

/* Toast */
.toast-x { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink); color: #fff; padding: .7rem 1.1rem; border-radius: 12px; font-size: .88rem; font-weight: 500; z-index: 2000; transition: all .2s ease; box-shadow: var(--shadow-lg); }
.toast-x.show { opacity: 1; transform: translate(-50%, 0); }

/* Tables (admin) */
.table-x { width: 100%; font-size: .9rem; margin: 0; }
.table-x th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: .75rem 1rem; background: var(--line-2); border: 0; white-space: nowrap; }
.table-x td { padding: .85rem 1rem; border-top: 1px solid var(--line-2); vertical-align: middle; }
.table-x tr:hover td { background: #FAFBFD; }
.table-card { padding: 0; overflow: hidden; }
.table-card .card-head { padding: 1.1rem 1.25rem 0; }
.cell-user { display: flex; align-items: center; gap: .65rem; }
.cell-user .avatar { width: 32px; height: 32px; font-size: .72rem; }
.cell-user small { display: block; color: var(--muted); font-size: .76rem; }

.filter-bar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.filter-bar .form-control, .filter-bar .form-select { padding: .5rem .75rem; font-size: .88rem; width: auto; }
.pill-tabs { display: flex; gap: .35rem; flex-wrap: wrap; }
.pill-tabs a { padding: .4rem .85rem; border-radius: 999px; font-size: .84rem; font-weight: 600; color: var(--muted); background: var(--surface); border: 1px solid var(--line); }
.pill-tabs a.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.admin-topbar { display: none; }
.sidebar-dark { background: var(--navy); border-right: 0; }
.sidebar-dark .brand, .sidebar-dark .side-user .who strong { color: #fff; }
.sidebar-dark .side-label { color: rgba(255,255,255,.4); }
.sidebar-dark .side-link { color: rgba(255,255,255,.75); }
.sidebar-dark .side-link i { color: rgba(255,255,255,.5); }
.sidebar-dark .side-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-dark .side-link.active { background: rgba(14,165,164,.2); color: #fff; }
.sidebar-dark .side-link.active i { color: #5EE0DF; }
.sidebar-dark .side-foot { border-top-color: rgba(255,255,255,.1); }
.sidebar-dark .side-user .who small { color: rgba(255,255,255,.5); }

.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: .5rem; }
.bar-chart .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .4rem; height: 100%; justify-content: flex-end; }
.bar-chart .bar span { width: 100%; max-width: 34px; border-radius: 6px 6px 2px 2px; background: var(--accent); min-height: 3px; }
.bar-chart .bar small { font-size: .7rem; color: var(--muted); }

/* ---------- Mobile app feel ---------- */
@media (max-width: 991.98px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .main-inner { padding: calc(1rem + env(safe-area-inset-top)) 1rem calc(var(--bottom-nav-h) + 1.5rem + env(safe-area-inset-bottom)); }
  .page-head h1 { font-size: 1.35rem; }
  .card-x { padding: 1.1rem; border-radius: 16px; }

  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1050;
    height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255,255,255,.94); backdrop-filter: saturate(180%) blur(14px);
    border-top: 1px solid var(--line);
  }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted-2); font-size: .68rem; font-weight: 600; position: relative; }
  .bottom-nav a i { font-size: 1.3rem; line-height: 1; }
  .bottom-nav a.active { color: var(--accent-2); }
  .bottom-nav a.active::before { content: ''; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 4px 4px; background: var(--accent); }
  .bottom-nav .fab i { width: 46px; height: 46px; margin-top: -22px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; font-size: 1.35rem; box-shadow: 0 8px 18px rgba(14,165,164,.4); border: 4px solid var(--bg); box-sizing: content-box; }
  .toast-x { bottom: calc(var(--bottom-nav-h) + 16px + env(safe-area-inset-bottom)); }

  /* Admin keeps a compact bar on mobile with an off-canvas menu */
  .admin-shell .sidebar { display: flex; transform: translateX(-100%); transition: transform .25s ease; }
  .admin-shell .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .admin-shell .main-inner { padding: 1rem 1rem 2rem; }
  .admin-topbar { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 1030; height: 58px; padding: 0 1rem; background: var(--navy); color: #fff; }
  .admin-topbar .brand { color: #fff; font-size: 1.05rem; }
  .admin-topbar button { background: none; border: 0; color: #fff; font-size: 1.5rem; }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(11,18,32,.45); z-index: 1035; display: none; }
  .sidebar-backdrop.show { display: block; }

  .table-x .hide-sm { display: none; }
}
@media (min-width: 992px) {
  .mobile-only { display: none !important; }
}
@media (max-width: 991.98px) {
  .desktop-only { display: none !important; }
}

/* Toggle buttons (btn-check) */
.seg .btn { border: 0; color: var(--muted); background: transparent; }
.seg .btn-check:checked + .btn { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.day-toggle { min-width: 3.25rem; }
.btn-check:checked + .day-toggle { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Admin "log in as user" banner */
.impersonate-bar {
  position: sticky; top: 0; z-index: 1060; display: flex; align-items: center; justify-content: center; gap: .75rem;
  background: var(--ink); color: #fff; font-size: .82rem; padding: .4rem 1rem; padding-top: calc(.4rem + env(safe-area-inset-top));
}
.impersonate-bar .btn { padding: .2rem .7rem; font-size: .78rem; }
@media (min-width: 992px) {
  .impersonate-bar { margin-left: var(--sidebar-w); }
}

/* Audit log */
.audit-details { line-height: 1.6; min-width: 220px; word-break: break-word; }
.audit-details .bi { color: var(--muted-2); }

/* Withdrawal countdown */
.wd-countdown {
  position: relative; overflow: hidden; color: #fff; border-radius: var(--radius-lg); padding: 1.1rem 1.2rem; margin-bottom: 1rem;
  background: linear-gradient(140deg, #0B1F3A 0%, #12305A 60%, #0E6E7A 100%); box-shadow: 0 10px 26px rgba(11,31,58,.2);
}
.wd-countdown .wd-label { font-size: .78rem; font-weight: 600; color: rgba(255,255,255,.75); }
.wd-countdown .wd-amount { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; margin-top: .15rem; }
.wd-countdown .wd-meta { font-size: .72rem; color: rgba(255,255,255,.6); }
.wd-countdown .wd-time { font-size: clamp(1.5rem, 6vw, 2rem); font-weight: 800; letter-spacing: .02em; line-height: 1.1; }
.wd-countdown .wd-bar { height: 6px; border-radius: 999px; background: rgba(255,255,255,.15); margin: .9rem 0 .6rem; overflow: hidden; }
.wd-countdown .wd-bar span { display: block; height: 100%; border-radius: 999px; background: #5EE0DF; transition: width 1s linear; }
.wd-countdown .wd-note { font-size: .78rem; color: rgba(255,255,255,.8); }
.wd-countdown.is-due { background: linear-gradient(140deg, #14532D 0%, #15803D 100%); }
.wd-countdown.is-due .wd-bar span { background: #BBF7D0; }
.wd-left { font-size: .74rem; font-weight: 600; }

/* Two wallets: available (withdrawable) + deposit (investing only) */
.wallets { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem; }
.wallets .balance-card .amount { margin-bottom: .75rem; }
.wallet-tag { display: inline-flex; align-items: center; gap: .25rem; font-size: .68rem; font-weight: 600; padding: .2rem .55rem; border-radius: 999px; background: rgba(255,255,255,.14); color: #fff; white-space: nowrap; }
.wallet-card {
  display: flex; flex-direction: column; justify-content: space-between; gap: .35rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.25rem 1.5rem;
  color: var(--ink); box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s;
}
.wallet-card:hover { color: var(--ink); border-color: var(--accent); box-shadow: var(--shadow); }
.wallet-card .label { font-size: .82rem; color: var(--muted); font-weight: 500; }
.wallet-card .amount { font-size: clamp(1.4rem, 5vw, 1.75rem); font-weight: 800; letter-spacing: -.03em; }
.wallet-card .wallet-tag { background: var(--accent-soft); color: var(--accent-2); }
.wallet-pill { display: inline-flex; align-items: center; gap: .4rem; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: .35rem .8rem; font-size: .85rem; }
.wallet-pill strong { font-variant-numeric: tabular-nums; }
.wallet-pill .bi { color: var(--accent-2); }
.wallet-pill.on { border-color: var(--accent); background: var(--accent-soft); }
@media (max-width: 575.98px) {
  .wallets { grid-template-columns: 1fr; gap: .75rem; }
  .wallet-card { padding: 1rem 1.1rem; }
}

/* Investment "Pay from" options */
.fund-options { display: grid; gap: .5rem; }
.fund-option { display: block; cursor: pointer; margin: 0; }
.fund-option input { position: absolute; opacity: 0; }
.fund-option .fund-body { display: flex; align-items: center; gap: .75rem; padding: .7rem .85rem; border: 1.5px solid var(--line); border-radius: var(--radius-sm); transition: border-color .15s, background .15s; }
.fund-option .fund-body > .bi { font-size: 1.1rem; color: var(--accent-2); }
.fund-option strong { display: block; font-size: .9rem; }
.fund-option small { display: block; color: var(--muted); font-size: .75rem; }
.fund-option input:checked + .fund-body { border-color: var(--accent); background: var(--accent-soft); }
.fund-option input:focus-visible + .fund-body { box-shadow: 0 0 0 4px rgba(14,165,164,.15); }
