:root {
  --bs-primary: #123D2C;
  --bs-primary-rgb: 18, 61, 44;
  --bg: #F5F6F3;
  --surface: #ffffff;
  --border: #E6E9E4;
  --text: #1c2333;
  --text-muted: #6b7280;
  --primary: #123D2C;
  --primary-dark: #0B2B1E;
  --primary-soft: #E4EDE8;
  --accent: #E3A83E;
  --accent-soft: #FBEED9;
  --gain: #16a34a;
  --gain-soft: #e9f9ef;
  --loss: #dc2626;
  --loss-soft: #fdecec;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
}

html { font-size: 15px; }
@media (min-width: 768px) { html { font-size: 15.5px; } }

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

h1, h2, h3, h4, h5, h6 { color: var(--text); font-weight: 700; }

a { text-decoration: none; }

.gain { color: var(--gain); font-weight: 600; }
.loss { color: var(--loss); font-weight: 600; }
.stale-badge { font-size: .7rem; }

/* ── App shell ─────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 252px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: 1.35rem 1.25rem 1.1rem;
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.brand-title { font-weight: 800; font-size: 1.25rem; letter-spacing: -.02em; line-height: 1.2; color: var(--primary); }

.sidebar-section-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: #a3aab8;
  padding: 1rem 1.25rem .35rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: 0 .75rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem .75rem;
  border-radius: var(--radius-sm);
  color: #4b5468;
  font-size: .875rem;
  font-weight: 500;
  transition: background .12s ease, color .12s ease;
}

.sidebar-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #8890a0;
}
.sidebar-icon svg { width: 100%; height: 100%; }
.sidebar-link.active .sidebar-icon,
.sidebar-link:hover .sidebar-icon { color: var(--primary-dark); }

.sidebar-badge {
  margin-left: auto;
  background: var(--loss);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  line-height: 1;
  padding: .22rem .4rem;
  border-radius: 999px;
  min-width: 1.1rem;
  text-align: center;
}

.sidebar-link:hover {
  background: #EEF1EE;
  color: var(--text);
}

.sidebar-link.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 600;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 1rem 1.1rem;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .65rem;
}

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 700;
  font-size: .85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.sidebar-user-email { font-size: .72rem; color: var(--text-muted); }

.sidebar-signout {
  width: 100%;
  border: 1px solid var(--border);
  background: #fff;
  color: #4b5468;
  border-radius: var(--radius-sm);
  padding: .4rem .6rem;
  font-size: .82rem;
  font-weight: 500;
  text-align: left;
}

.sidebar-signout:hover { background: var(--loss-soft); color: var(--loss); border-color: #f3c9c9; }

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  display: none;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-topbar-title { font-weight: 700; font-size: 1rem; }

.sidebar-toggle {
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

.sidebar-toggle:hover { background: #EEF1EE; color: var(--text); }

.app-content {
  padding: 1.75rem 2rem 3rem;
  max-width: 1400px;
  width: 100%;
}

@media (max-width: 900px) {
  .app-topbar { display: flex; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1030;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 0 0 0 100vmax rgba(15, 20, 34, 0);
  }
  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 0 0 40px rgba(15, 20, 34, .25);
  }
  .app-content { padding: 1.25rem 1rem 2.5rem; }
}

/* ── Guest navbar ──────────────────────────────────────────────────── */
.guest-navbar { background: var(--primary) !important; }
.guest-navbar .navbar-brand {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -.02em;
  color: #fff !important;
}

/* ── Cards ─────────────────────────────────────────────────────────── */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--surface);
}

.card h6 { font-weight: 700; }

.dash-header-eyebrow { font-size: .8rem; color: var(--text-muted); margin-bottom: .1rem; }
.dash-header h2 { letter-spacing: -.02em; }

/* Hero balance card */
.hero-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.6rem;
  border-radius: 20px;
  color: #fff;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(227, 168, 62, .22) 0%, rgba(227, 168, 62, 0) 55%),
    linear-gradient(160deg, #1A5040 0%, var(--primary) 55%, var(--primary-dark) 100%);
  box-shadow: 0 12px 32px -12px rgba(11, 43, 30, .45);
}
.hero-label { font-size: .8rem; font-weight: 500; color: rgba(255, 255, 255, .72); }
.hero-icon {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, .1);
  color: var(--accent);
}
.hero-icon svg { width: 18px; height: 18px; }
.hero-value {
  margin-top: 1rem;
  font-size: 2.35rem;
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.hero-value-sub { margin-top: .25rem; font-size: 1.35rem; color: rgba(255, 255, 255, .8); }
.hero-pill {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .3rem .65rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, .12);
}
.hero-pill.up   { color: #8BE3A9; }
.hero-pill.down { color: #FFA8A8; }
.hero-pill-tag { color: rgba(255, 255, 255, .6); font-weight: 500; }
.hero-footer {
  margin-top: auto;
  padding-top: 1.25rem;
  font-size: .78rem;
  color: rgba(255, 255, 255, .6);
}

/* KPI tiles */
.kpi-card {
  height: 100%;
  padding: 1.1rem 1.2rem;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: box-shadow .15s ease, transform .15s ease;
}
.kpi-card:hover { box-shadow: 0 6px 20px -8px rgba(16, 24, 40, .15); transform: translateY(-1px); }
.kpi-card-warn { border-color: #f3c9c9; }
.kpi-icon {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px;
  margin-bottom: .85rem;
}
.kpi-icon svg { width: 18px; height: 18px; }
.kpi-icon-green   { background: var(--primary-soft); color: var(--primary); }
.kpi-icon-gold    { background: var(--accent-soft);  color: #B07A1E; }
.kpi-icon-neutral { background: #EEF1EE;             color: #4b5468; }
.kpi-icon-up      { background: var(--gain-soft);    color: var(--gain); }
.kpi-icon-down    { background: var(--loss-soft);    color: var(--loss); }
.kpi-label { font-size: .78rem; font-weight: 500; color: var(--text-muted); margin-bottom: .2rem; }
.kpi-value {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.kpi-value.gain { color: var(--gain); }
.kpi-value.loss { color: var(--loss); }
.kpi-value-sub { font-size: .95rem; font-weight: 600; color: var(--text-muted); }

/* Detail-page summary strip: one card, metrics separated by hairline dividers */
.stat-strip {
  display: grid;
  grid-template-columns: 1.5fr repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.stat-strip-item { background: var(--surface); padding: 1.1rem 1.35rem; }
.stat-strip-label {
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: .4rem;
}
.stat-strip-value {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.stat-strip-value.gain { color: var(--gain); }
.stat-strip-value.loss { color: var(--loss); }
.stat-strip-item.primary .stat-strip-value { font-size: 1.75rem; color: var(--primary); }
.stat-strip-meta { margin-top: .3rem; font-size: .78rem; color: var(--text-muted); }
.stat-strip-meta.gain { color: var(--gain); }
.stat-strip-meta.loss { color: var(--loss); }
.stat-strip-action { cursor: pointer; transition: background .12s ease; }
.stat-strip-action:hover { background: #F6F8F5; }
.stat-pill {
  display: inline-block;
  margin-top: .45rem;
  padding: .18rem .55rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.stat-pill.up   { background: var(--gain-soft); color: var(--gain); }
.stat-pill.down { background: var(--loss-soft); color: var(--loss); }

@media (max-width: 991px) {
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .stat-strip-item.primary { grid-column: 1 / -1; }
}

/* ── Tables ────────────────────────────────────────────────────────── */
.table { color: var(--text); }
.table thead.table-light th {
  background: #F7F8F6 !important;
  color: var(--text-muted);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.table td, .table th { vertical-align: middle; border-color: var(--border); }
.table-hover tbody tr:hover { background: #F6F8F5; }

/* ── Charts ────────────────────────────────────────────────────────── */
.chart-card { transition: box-shadow .15s ease; }
.chart-card:hover { box-shadow: 0 4px 16px rgba(16, 24, 40, .08); }

.chart-badge {
  font-size: .7rem;
  font-weight: 600;
  color: var(--text-muted);
  background: #EEF1EE;
  padding: .25rem .6rem;
  border-radius: 999px;
}

.chart-wrap {
  position: relative;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chart-wrap canvas { max-height: 100%; }

.mover-row { padding: .3rem .4rem; margin: 0 -.4rem; border-radius: var(--radius-sm); transition: background .12s ease; }
.mover-row:hover { background: #F6F8F5; }

/* ── Badges / buttons ──────────────────────────────────────────────── */
.badge.bg-light { background: #EEF1EE !important; }

.btn { font-weight: 500; border-radius: var(--radius-sm); }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); }

/* ── Nav tabs ──────────────────────────────────────────────────────── */
.nav-tabs { border-bottom: 1px solid var(--border); }
.nav-tabs .nav-link { border: none; color: var(--text-muted); font-weight: 600; font-size: .875rem; }
.nav-tabs .nav-link.active { color: var(--primary-dark); border-bottom: 2px solid var(--primary); background: transparent; }

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem rgba(18, 61, 44, .25);
}
.form-control:focus { border-color: #7FA894; }

/* ── Holdings list (dashboard) ───────────────────────────────────── */
.holdings-card { padding: 0; overflow: hidden; }
.holdings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.35rem;
}

.seg-tabs {
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: #EEF1EE;
}
.seg-tab {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .85rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: background .12s ease, color .12s ease;
}
.seg-tab:hover { color: var(--text); }
.seg-tab.active { background: var(--surface); color: var(--primary); box-shadow: 0 1px 2px rgba(16, 24, 40, .08); }
.seg-count {
  min-width: 1.25rem;
  padding: .05rem .4rem;
  border-radius: 999px;
  font-size: .7rem;
  text-align: center;
  background: rgba(18, 61, 44, .08);
  color: inherit;
}

.holdings-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.holdings-table th {
  padding: .6rem 1.35rem;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: #F7F8F6;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.holdings-table td {
  padding: .85rem 1.35rem;
  vertical-align: middle;
  border-bottom: 1px solid #F0F2EF;
}
.holdings-table tbody tr { cursor: pointer; transition: background .12s ease; }
.holdings-table tbody tr:hover { background: #F6F8F5; }
.holdings-table tfoot td { background: #F7F8F6; border-bottom: 0; font-weight: 600; }

.h-stock { display: flex; align-items: center; gap: .8rem; min-width: 210px; }
.h-avatar {
  width: 38px; height: 38px;
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.h-tone-0 { background: var(--primary-soft); color: var(--primary); }
.h-tone-1 { background: var(--accent-soft);  color: #9A6A17; }
.h-tone-2 { background: #E6EFF2;             color: #3F6473; }
.h-tone-3 { background: #F1ECE6;             color: #7A5F43; }
.h-tone-4 { background: #EAEFE3;             color: #56703A; }
.h-stock-text { min-width: 0; }
.h-symbol { font-weight: 700; color: var(--text); line-height: 1.2; }
.h-company {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .8rem;
  color: var(--text-muted);
}
.h-meta { font-size: .72rem; color: #9AA1AC; }

.h-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.h-strong { font-weight: 700; color: var(--text); }
.h-sub { margin-top: .1rem; font-size: .75rem; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.h-sub.gain { color: var(--gain); font-weight: 500; }
.h-sub.loss { color: var(--loss); font-weight: 500; }
.h-stale {
  display: inline-block;
  width: 7px; height: 7px;
  margin-left: .3rem;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
}

.h-return {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.h-return.up   { background: var(--gain-soft); color: var(--gain); }
.h-return.down { background: var(--loss-soft); color: var(--loss); }

.h-weight-col { width: 170px; }
.h-weight { display: flex; align-items: center; gap: .6rem; }
.h-weight-track { flex: 1; height: 6px; border-radius: 999px; background: #EEF1EE; overflow: hidden; }
.h-weight-bar { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), #3E8E6A); }
.h-weight .h-num { font-size: .78rem; color: var(--text-muted); min-width: 3rem; text-align: right; }

@media (max-width: 1199px) {
  .h-weight-col { width: auto; }
  .h-weight-track { display: none; }
  .holdings-table th, .holdings-table td { padding-left: 1rem; padding-right: 1rem; }
}

/* ── Page header (list pages) ────────────────────────────────────── */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.page-title { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: .2rem; }
.page-sub { font-size: .875rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.page-cta { padding: .55rem 1.1rem; font-weight: 600; }

/* ── Portfolio cards ─────────────────────────────────────────────── */
.pf-card {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1.35rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
}
.pf-card:hover { transform: translateY(-2px); border-color: #D5DDD7; box-shadow: 0 10px 28px -12px rgba(16, 24, 40, .18); }
.pf-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: .85rem; }
.pf-market {
  padding: .15rem .55rem;
  border-radius: 6px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
}
.pf-market-ngx { background: var(--primary-soft); color: var(--primary); }
.pf-market-us  { background: #E6EFF2; color: #3F6473; }
.pf-default {
  padding: .15rem .55rem;
  border-radius: 6px;
  font-size: .68rem;
  font-weight: 600;
  background: var(--accent-soft);
  color: #9A6A17;
}
.pf-menu { position: relative; z-index: 2; }
.pf-menu-btn {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
}
.pf-menu-btn:hover, .pf-menu-btn[aria-expanded="true"] { background: #EEF1EE; color: var(--text); }
.pf-name { font-size: 1.1rem; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.pf-name:hover { color: var(--primary); }
.pf-desc {
  font-size: .82rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 1rem;
}
.pf-value { font-size: 1.75rem; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.pf-change { display: flex; align-items: center; gap: .5rem; margin: .4rem 0 1.1rem; min-height: 1.6rem; font-size: .8rem; font-variant-numeric: tabular-nums; }
.pf-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid #F0F2EF;
}
.pf-stat-label { font-size: .72rem; color: var(--text-muted); margin-bottom: .1rem; }
.pf-stat-value { font-size: .9rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.pf-add {
  width: 100%;
  height: 100%;
  min-height: 230px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  border: 1.5px dashed #CFD8D2;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.pf-add:hover { background: var(--primary-soft); border-color: #9DB9A9; color: var(--primary); }
.pf-add-icon {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: .35rem;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 1.35rem;
  line-height: 1;
  color: var(--primary);
}
.pf-add-title { font-weight: 700; color: var(--text); }
.pf-add-sub { font-size: .8rem; }

/* Market choice in the create dialog */
.market-options { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.market-option { position: relative; cursor: pointer; margin: 0; }
.market-option input { position: absolute; opacity: 0; pointer-events: none; }
.market-option-body {
  display: flex;
  flex-direction: column;
  padding: .75rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .12s ease, background .12s ease;
}
.market-option-title { font-weight: 700; }
.market-option-sub { font-size: .78rem; color: var(--text-muted); }
.market-option input:checked + .market-option-body { border-color: var(--primary); background: var(--primary-soft); }
.market-option input:focus-visible + .market-option-body { box-shadow: 0 0 0 .2rem rgba(18, 61, 44, .2); }

/* ── Market prices ───────────────────────────────────────────────── */
.flash {
  margin-bottom: 1.25rem;
  padding: .7rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
}
.flash-ok   { background: var(--gain-soft); color: #15803d; }
.flash-warn { background: var(--accent-soft); color: #8A5D12; }

.movers-card {
  height: 100%;
  padding: 1rem 1.2rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.movers-title { display: flex; align-items: center; gap: .5rem; font-size: .8rem; font-weight: 600; color: var(--text-muted); margin-bottom: .75rem; }
.movers-title .dot { width: 8px; height: 8px; border-radius: 50%; }
.movers-title .dot.up   { background: var(--gain); }
.movers-title .dot.down { background: var(--loss); }
.movers-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .5rem; }
.mover {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: .6rem .75rem;
  border-radius: var(--radius-sm);
  background: #F7F8F6;
  color: var(--text);
  transition: background .12s ease;
}
.mover:hover { background: #EEF1EE; color: var(--text); }
.mover-symbol { font-weight: 700; font-size: .85rem; }
.mover-price { font-size: .78rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.mover .h-return { align-self: flex-start; margin-top: .2rem; }

a.seg-tab { text-decoration: none; }

.search-box {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-width: 260px;
  height: 38px;
  padding: 0 .75rem;
  border: 1px solid #DCE1DA;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.search-box:focus-within { border-color: #7FA894; box-shadow: 0 0 0 .2rem rgba(18, 61, 44, .12); }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: .875rem; color: var(--text); }
.search-clear { color: var(--text-muted); font-size: .8rem; }
.search-clear:hover { color: var(--text); }

.row-action {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  transition: background .12s ease, color .12s ease;
}
.row-action:hover { background: var(--primary-soft); color: var(--primary); }

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1.35rem;
  border-top: 1px solid var(--border);
}
.pager-info { font-size: .8rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }

@media (max-width: 575px) {
  .search-box { min-width: 0; width: 100%; }
}

/* ── Detail page actions & shared bits ───────────────────────────── */
.back-link { display: inline-block; margin-bottom: .35rem; font-size: .82rem; font-weight: 500; color: var(--text-muted); }
.back-link:hover { color: var(--primary); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem .9rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow);
}
.btn-ghost:hover, .btn-ghost.show { background: #F6F8F5; border-color: #D5DDD7; color: var(--text); }
.btn-icon { display: inline-flex; width: 16px; height: 16px; color: var(--text-muted); }
.btn-icon svg { width: 100%; height: 100%; }

.menu-rich { min-width: 270px; padding: .4rem; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 16px 40px -16px rgba(16, 24, 40, .25); }
.menu-rich .dropdown-item { display: flex; align-items: flex-start; gap: .7rem; padding: .6rem .7rem; border-radius: 8px; white-space: normal; }
.menu-rich .dropdown-item:hover, .menu-rich .dropdown-item:focus { background: #F6F8F5; color: var(--text); }
.menu-icon {
  flex-shrink: 0;
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
}
.menu-icon svg { width: 17px; height: 17px; }
.menu-title { display: block; font-size: .875rem; font-weight: 600; }
.menu-sub { display: block; font-size: .75rem; color: var(--text-muted); }

.flash-error { background: var(--loss-soft); color: var(--loss); }

.review-card { border-color: #E9D8B4; }
.review-card .holdings-head { background: #FFFBF3; border-bottom: 1px solid #F1E6CF; }
.holdings-table tr.row-warn td { background: #FFFAF0; }
.review-table tbody tr { cursor: default; }

.status-pill, .type-pill {
  display: inline-block;
  padding: .15rem .6rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}
.status-pill.ok    { background: var(--gain-soft); color: #15803d; }
.status-pill.warn  { background: var(--accent-soft); color: #8A5D12; }
.status-pill.muted { background: #EEF1EE; color: var(--text-muted); }
.type-pill.buy  { background: var(--primary-soft); color: var(--primary); }
.type-pill.sell { background: #F6ECEC; color: #9F3A38; }

.holdings-table td a.h-symbol { color: var(--text); }
.holdings-table td a.h-symbol:hover { color: var(--primary); }

.empty-state { padding: 2.5rem 1.5rem; text-align: center; }
.empty-title { font-weight: 700; margin-bottom: .2rem; }
.empty-sub { font-size: .85rem; color: var(--text-muted); }

.file-icon { display: inline-flex; width: 18px; height: 18px; color: var(--text-muted); flex-shrink: 0; }
.file-icon svg { width: 100%; height: 100%; }

.row-action-danger:hover { background: var(--loss-soft); color: var(--loss); }
.row-action svg { width: 16px; height: 16px; }

.cash-balance { padding: .8rem 1rem; margin-bottom: 1rem; border-radius: var(--radius-sm); background: #F7F8F6; }

/* ── Stock detail, watchlist, alerts, dividends ──────────────────── */
.h-avatar-lg { width: 48px; height: 48px; border-radius: 12px; font-size: .9rem; }
.sector-tag { margin-left: .35rem; font-size: .78rem; color: var(--text-muted); }
.sector-tag::before { content: "· "; }

.holdings-table tbody tr.no-hover { cursor: default; }
.holdings-table tbody tr.no-hover:hover { background: transparent; }
.holdings-table tbody tr.row-done td { opacity: .72; }
.holdings-table tbody tr.row-done:hover td { opacity: 1; }

.alert-progress-col { width: 190px; }
.alert-progress-col .h-weight { margin-bottom: .25rem; }
.h-weight-bar.reached { background: var(--gain); }

.stat-strip-3 { grid-template-columns: 1.5fr 1fr 1fr; }
.stat-strip-4 { grid-template-columns: 1.4fr 1fr 1fr 1fr; }

.import-dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  padding: 1rem;
  border: 1.5px dashed #C9D3CC;
  border-radius: var(--radius-sm);
  background: #FAFBFA;
  cursor: text;
  caret-color: transparent;
  text-align: center;
  transition: border-color .12s ease, background .12s ease;
}
.import-dropzone:hover, .import-dropzone:focus-visible { border-color: var(--primary); background: var(--primary-soft); outline: none; }
.import-dropzone.is-dragover { border-color: var(--primary); background: var(--primary-soft); }
.import-dropzone-hint { color: var(--text-muted); font-size: .85rem; max-width: 320px; }
.import-dropzone-icon { display: inline-flex; width: 28px; height: 28px; color: var(--text-muted); margin-bottom: .4rem; }
.import-dropzone-icon svg { width: 100%; height: 100%; }
.btn-link-inline { background: none; border: none; padding: 0; color: var(--primary); text-decoration: underline; font-size: inherit; cursor: pointer; }
.import-preview { max-width: 100%; max-height: 220px; border-radius: var(--radius-sm); }

.callout {
  padding: .75rem 1rem;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: #FFFBF3;
  font-size: .82rem;
  color: #6B5A3A;
}

@media (max-width: 1199px) {
  .alert-progress-col { width: auto; min-width: 120px; }
  .alert-progress-col .h-weight-track { display: block; }
}
@media (max-width: 991px) {
  .stat-strip-3 { grid-template-columns: repeat(2, 1fr); }
  .stat-strip-4 { grid-template-columns: repeat(2, 1fr); }
}

/* ── Getting-started checklist (dashboard) ───────────────────────── */
.onboard-card {
  padding: 1.5rem 1.6rem;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.onboard-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.onboard-title { font-weight: 700; margin-bottom: .2rem; }
.onboard-sub { margin: 0; font-size: .875rem; color: var(--text-muted); }
.onboard-progress { display: flex; align-items: center; gap: .6rem; font-size: .8rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.onboard-progress-track { width: 120px; height: 6px; border-radius: 999px; background: #EEF1EE; overflow: hidden; }
.onboard-progress-bar { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), #3E8E6A); transition: width .3s ease; }

.onboard-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.onboard-step {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #FAFBF9;
}
.onboard-step.current { border-color: #B9CFC2; background: var(--primary-soft); }
.onboard-check {
  flex-shrink: 0;
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1.5px solid #CFD8D2;
  background: var(--surface);
  font-size: .85rem;
  font-weight: 700;
  color: var(--text-muted);
}
.onboard-step.current .onboard-check { border-color: var(--primary); color: var(--primary); }
.onboard-step.done .onboard-check { border-color: var(--gain); background: var(--gain); color: #fff; }
.onboard-step.done .onboard-step-title { color: var(--text-muted); text-decoration: line-through; text-decoration-color: #B9C1BB; }
.onboard-body { flex: 1; min-width: 220px; }
.onboard-step-title { font-weight: 700; }
.onboard-step-sub { font-size: .82rem; color: var(--text-muted); }
.onboard-optional {
  margin-left: .35rem;
  padding: .05rem .45rem;
  border-radius: 6px;
  background: #EEF1EE;
  font-size: .68rem;
  font-weight: 600;
  color: var(--text-muted);
  vertical-align: middle;
}
.onboard-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ── Modals ──────────────────────────────────────────────────────── */
.modal-content { border: 0; border-radius: 18px; box-shadow: 0 24px 60px -20px rgba(16, 24, 40, .35); }
.modal-header { border-bottom: 0; padding: 1.35rem 1.5rem .5rem; }
.modal-title { font-weight: 700; letter-spacing: -.01em; }
.modal-body { padding: .75rem 1.5rem; }
.modal-footer { border-top: 0; padding: .5rem 1.5rem 1.35rem; }
.modal-body .form-label { font-size: .85rem; font-weight: 600; }
.modal-body .form-control, .modal-body .form-select { border-radius: var(--radius-sm); border-color: #DCE1DA; padding: .55rem .8rem; }
.btn-light { background: #EEF1EE; border-color: #EEF1EE; }
.btn-light:hover { background: #E3E8E4; border-color: #E3E8E4; }

/* ── Auth (login / register) ─────────────────────────────────────── */
.auth-body { background: var(--surface); }

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 100vh;
}

.auth-aside {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 2.5rem 3rem;
  color: #fff;
  background:
    radial-gradient(90% 60% at 100% 0%, rgba(227, 168, 62, .18) 0%, rgba(227, 168, 62, 0) 60%),
    linear-gradient(165deg, #1A5040 0%, var(--primary) 50%, var(--primary-dark) 100%);
}

.auth-brand, .auth-brand-mobile {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -.02em;
}
.auth-brand { color: #fff; }
.auth-brand:hover { color: #fff; }
.auth-brand img, .auth-brand-mobile img { width: 38px; height: 38px; }

.auth-pitch { margin: auto 0; max-width: 460px; padding: 2.5rem 0; }
.auth-pitch h1 {
  color: #fff;
  font-size: 2.35rem;
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.15;
  margin-bottom: .9rem;
}
.auth-pitch p { color: rgba(255, 255, 255, .72); font-size: 1rem; margin-bottom: 2rem; }

.auth-preview {
  padding: 1.25rem 1.35rem 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .12);
  backdrop-filter: blur(6px);
  margin-bottom: 2rem;
}
.auth-preview-label { font-size: .75rem; color: rgba(255, 255, 255, .6); }
.auth-preview-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  margin: .15rem 0 .5rem;
}
.auth-preview-pill {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  color: #8BE3A9;
  background: rgba(255, 255, 255, .1);
}
.auth-preview-chart { display: block; width: 100%; height: 80px; margin-top: .75rem; }

.auth-features { list-style: none; padding: 0; margin: 0; }
.auth-features li {
  position: relative;
  padding-left: 1.75rem;
  margin-bottom: .7rem;
  font-size: .9rem;
  color: rgba(255, 255, 255, .85);
}
.auth-features li::before {
  content: "";
  position: absolute;
  left: 0; top: .2rem;
  width: 1.1rem; height: 1.1rem;
  border-radius: 50%;
  background: rgba(227, 168, 62, .18)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4.5 8.2 7 10.5l4.5-5' stroke='%23E3A83E' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / 70% no-repeat;
}

.auth-aside-footer { font-size: .78rem; color: rgba(255, 255, 255, .5); }

.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
}
.auth-form { width: 100%; max-width: 400px; }
.auth-brand-mobile { display: none; color: var(--primary); margin-bottom: 2rem; }

.auth-title { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: .35rem; }
.auth-subtitle { color: var(--text-muted); margin-bottom: 2rem; }
.auth-label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .4rem; color: var(--text); }
.auth-input {
  height: 46px;
  border-radius: var(--radius-sm);
  border-color: #DCE1DA;
  padding: .5rem .9rem;
}
.auth-input::placeholder { color: #A3AAB2; }
.auth-submit { width: 100%; height: 46px; font-weight: 600; }
.auth-error {
  padding: .75rem 1rem;
  margin-bottom: 1.25rem;
  border-radius: var(--radius-sm);
  background: var(--loss-soft);
  color: var(--loss);
  font-size: .85rem;
}
.auth-error ul { margin: 0; padding: 0; list-style: none; }
.auth-switch { margin-top: 1.75rem; text-align: center; font-size: .9rem; color: var(--text-muted); }
.auth-switch a { color: var(--primary); font-weight: 600; }
.auth-switch a:hover { text-decoration: underline; }

@media (max-width: 991px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-brand-mobile { display: inline-flex; }
  .auth-body { background: var(--bg); }
}
