/* ============================================================
   Wealth Dashboard — modern-fintech design system
   Dark-first, with a persisted light-mode toggle.
   ============================================================ */
:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* radii */
  --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-xl: 28px;
  --shadow: none;

  /* accent (vivid, solid) */
  --accent: #7c74ff;
  --accent-2: #4d8dff;

  /* semantic gain/loss */
  --pos: #29d391;  --pos-soft: rgba(41,211,145,.14);
  --neg: #ff5f6e;  --neg-soft: rgba(255,95,110,.14);

  /* categorical (validated dataviz dark slots 1-6) */
  --cat-1:#3987e5; --cat-2:#d95926; --cat-3:#199e70; --cat-4:#c98500; --cat-5:#d55181; --cat-6:#9552ea;
}

/* DARK (default) */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0d11;
  --bg-grad: radial-gradient(1200px 600px at 80% -10%, rgba(124,116,255,.10), transparent 60%), #0c0d11;
  --surface: #15161c;
  --surface-2: #1c1e26;
  --surface-hover: #22242e;
  --border: rgba(255,255,255,.08);
  --border-strong: rgba(255,255,255,.14);
  --text: #f4f5f8;
  --text-2: #a3a8b6;
  --text-muted: #6a6f7e;
  --chart-grid: rgba(255,255,255,.06);
}
/* LIGHT */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f5f8;
  --bg-grad: radial-gradient(1200px 600px at 80% -10%, rgba(124,116,255,.10), transparent 60%), #f4f5f8;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --surface-hover: #eef0f5;
  --border: rgba(15,20,40,.09);
  --border-strong: rgba(15,20,40,.16);
  --text: #12141c;
  --text-2: #5a6172;
  --text-muted: #8b91a1;
  --chart-grid: rgba(15,20,40,.07);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg-grad);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
h1,h2,h3 { margin: 0; font-weight: 700; letter-spacing: -.02em; }
button { font-family: inherit; cursor: pointer; }
.tnum { font-variant-numeric: tabular-nums; }

/* ============================================================
   APP SHELL
   ============================================================ */
.shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns .2s cubic-bezier(.4, 0, .2, 1);
}

.sidebar {
  position: sticky; top: 0; height: 100vh;
  padding: 22px 16px;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--surface);
  transition: padding .2s cubic-bezier(.4, 0, .2, 1);
}
.side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 2px 4px 13px; margin-bottom: 13px;
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; text-decoration: none; }
.brand-logo { display: block; height: 26px; width: auto; }
/* colorway follows theme: white artwork on dark, dark artwork on light */
.brand-logo--dark { display: none; }
html[data-theme="light"] .brand-logo--light { display: none; }
html[data-theme="light"] .brand-logo--dark { display: block; }
.product-name { margin: 0 0 18px; padding: 0 8px; font-size: 13px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); }

.sidebar-toggle-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: transparent; border: 1px solid transparent;
  color: var(--text-muted); cursor: pointer;
  padding: 0;
  transition: background .12s, color .12s;
}
.sidebar-toggle-btn:hover { background: var(--surface-hover); color: var(--text); }
.sidebar-toggle-btn svg { width: 17px; height: 17px; }

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 11px;
  color: var(--text-2); font-weight: 600; font-size: 13.5px;
  transition: background .12s, color .12s;
}
.nav a svg { width: 18px; height: 18px; opacity: .85; }
.nav a:hover { background: var(--surface-hover); color: var(--text); }
.nav a.active { background: var(--accent); color: #fff; }
.nav a.active svg { opacity: 1; }

.side-foot { display: flex; flex-direction: column; gap: 10px; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 11px; background: var(--surface-2);
}
.user-chip .av { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); display:grid; place-items:center; color:#fff; font-weight:700; font-size:12px;}
.user-chip .who { font-size: 12.5px; font-weight: 600; }
.user-chip .who a { display:block; color: var(--text-muted); font-weight: 500; font-size: 11px; }
.user-chip .who a:hover { color: var(--text); }

.content { padding: 26px 34px 90px; max-width: 1240px; width: 100%; min-width: 0; }

/* topbar */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.topbar .title h1 { font-size: 26px; }
.topbar .title .crumb { color: var(--text-muted); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.topbar .actions { display: flex; align-items: center; gap: 10px; }

.freshness { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); padding: 7px 12px; border-radius: 999px; }
.freshness .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--pos); box-shadow: 0 0 0 0 var(--pos); animation: pulse 2.4s infinite; }
.freshness.stale .pulse { background: var(--cat-4); animation: none; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(41,211,145,.5)} 70%{box-shadow:0 0 0 7px rgba(41,211,145,0)} 100%{box-shadow:0 0 0 0 rgba(41,211,145,0)} }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: 11px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 600; font-size: 13px; transition: background .12s, transform .05s; }
.btn:hover { background: var(--surface-hover); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); border: none; color: #fff; }
.btn-primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 9px; }
.btn-danger { color: var(--neg); border-color: transparent; background: transparent; }
.btn-danger:hover { background: var(--neg-soft); }
.icon-btn { width: 38px; height: 38px; padding: 0; justify-content: center; border-radius: 11px; }

/* ============================================================
   CARDS / PANELS
   ============================================================ */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.panel + .panel { margin-top: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; gap: 12px; }
.panel-head h2 { font-size: 16px; }
.panel-head .sub { color: var(--text-muted); font-size: 12px; }
.panel-body { padding: 22px; }
.panel-body.flush { padding: 0; }

.grid { display: grid; gap: 20px; }
.grid > .panel + .panel { margin-top: 0; }
.grid-2 { grid-template-columns: 1.5fr 1fr; }
.grid.equal { display: flex; gap: 20px; align-items: stretch; }
.grid.equal > .panel { flex: 1 1 0; min-width: 0; }
.grid.equal > .panel + .panel { margin-top: 0; }
/* rigid, identical vertical rhythm so both tables' heads & rows line up */
.grid.equal .panel-head { height: 61px; padding-top: 0; padding-bottom: 0; }
.grid.equal thead th { height: 44px; padding-top: 0; padding-bottom: 0; vertical-align: middle; }
.grid.equal tbody td { height: 52px; padding-top: 0; padding-bottom: 0; vertical-align: middle; }

/* HERO value card */
.hero {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  box-shadow: var(--shadow); padding: 26px; overflow: hidden; position: relative;
}
.hero .label { color: var(--text-2); font-size: 13px; font-weight: 600; }
.hero .big { font-size: 46px; font-weight: 800; letter-spacing: -.03em; margin: 6px 0 10px; }
.hero .big small { font-size: 24px; color: var(--text-muted); font-weight: 700; }
.delta { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-weight: 700; font-size: 13px; }
.delta.up { color: var(--pos); background: var(--pos-soft); }
.delta.down { color: var(--neg); background: var(--neg-soft); }
.delta svg { width: 13px; height: 13px; }
.hero .delta-row { display: flex; align-items: center; gap: 12px; }
.hero .delta-row .since { color: var(--text-muted); font-size: 12.5px; }

/* range toggle */
.range { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px; gap: 2px; }
.range button, .range a { border: none; background: transparent; color: var(--text-2); font-weight: 700; font-size: 12px; padding: 6px 12px; border-radius: 999px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.range button.active, .range a.active { background: var(--surface-hover); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.2); }


/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 20px; }
.tiles.cols-4 { grid-template-columns: repeat(4, 1fr); }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.tile .t-label { display:flex; align-items:center; gap:8px; color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.tile .t-label .ico { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); }
.tile .t-label .ico svg { width: 14px; height: 14px; opacity: .85; }
.tile .t-value { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin-top: 10px; }
.tile .t-sub { font-size: 12px; margin-top: 3px; color: var(--text-muted); }

/* ============================================================
   ALLOCATION DONUT
   ============================================================ */
.alloc { display: flex; align-items: center; gap: 26px; }
.alloc .donut { position: relative; flex-shrink: 0; }
.alloc .donut .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.alloc .donut .center .c-big { font-size: 20px; font-weight: 800; }
.alloc .donut .center .c-lbl { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.alloc .legend { display: flex; flex-direction: column; gap: 11px; flex: 1; }
.alloc .legend .row { display: flex; align-items: center; gap: 10px; font-size: 13px; cursor: default; padding: 4px 6px; border-radius: 8px; transition: background .12s;}
.alloc .legend .row:hover { background: var(--surface-hover); }
.alloc .legend .dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.alloc .legend .nm { font-weight: 600; }
.alloc .legend .vv { margin-left: auto; color: var(--text-2); font-weight: 600; }
.alloc .legend .pc { width: 46px; text-align: right; color: var(--text-muted); }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; color: var(--text-muted); font-weight: 700; font-size: 11px;
  text-transform: uppercase; letter-spacing: .05em; padding: 12px 16px;
  border-bottom: 1px solid var(--border); white-space: nowrap; user-select: none;
}
thead th.num { text-align: right; }
tbody td { padding: 14px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
td.wrap { white-space: normal; }
tbody tr { transition: background .1s; }
.rows-link tbody tr { cursor: pointer; }
.rows-link tbody tr:hover { background: var(--surface-hover); }
tbody tr:last-child td { border-bottom: none; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

.asset { display: flex; align-items: center; gap: 12px; }
.asset .logo { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; flex-shrink: 0; }
.asset .nm { font-weight: 700; }
.asset .isin { color: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.pos { color: var(--pos); } .neg { color: var(--neg); }
.chg { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; justify-content: flex-end; }
.chg svg { width: 11px; height: 11px; }

/* row actions */
.row-actions { display: flex; gap: 4px; justify-content: flex-end; align-items: center; }
.row-actions form { margin: 0; }

/* ============================================================
   HOLDINGS MANAGE MODE
   The Holdings page is read-only until the "Manage" toggle in the
   panel head is pressed; then the Edit/Delete column and the add
   form are revealed.
   ============================================================ */
.col-manage { display: none; }
#holdingsRoot.managing .col-manage { display: table-cell; }
#holdingsRoot #add { display: none; }
#holdingsRoot.managing #add { display: block; }
.hcard .card-actions { display: none; }
#holdingsRoot.managing .hcard .card-actions { display: flex; gap: 6px; margin-top: 2px; }
#manageBtn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

/* ============================================================
   MOBILE CARD LIST (holdings on small screens)
   Compact 2×2 metric grid: row 1 = value / gain-loss,
   row 2 = price / change — saves two rows per holding.
   ============================================================ */
.card-list { display: none; flex-direction: column; }
.hcard { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 11px; }
.hcard:last-child { border-bottom: none; }
.hcard .top { display: flex; align-items: center; gap: 11px; }
.hcard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 14px; }
.hcard-grid .m { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hcard-grid .m .k { color: var(--text-muted); font-size: 11px; letter-spacing: .01em; }
.hcard-grid .m .v { font-size: 14px; line-height: 1.25; }
.hcard-grid .m .v.strong { font-weight: 700; }

/* ============================================================
   FORMS
   ============================================================ */
label.field { display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
input, select { font: inherit; padding: 11px 13px; border: 1px solid var(--border-strong); border-radius: 11px; background: var(--surface-2); color: var(--text); width: 100%; }
input::placeholder { color: var(--text-muted); }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,116,255,.25); }
input[readonly] { color: var(--text-2); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; }

.badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; background: var(--surface-2); color: var(--text-2); }
.badge-admin { background: rgba(124,116,255,.18); color: var(--accent); }
.badge-user { background: var(--surface-2); color: var(--text-2); }
.badge.pos { background: var(--pos-soft); color: var(--pos); }
.badge.neg { background: var(--neg-soft); color: var(--neg); }

/* empty state */
.empty { text-align: center; padding: 56px 24px; }
.empty .ico { width: 60px; height: 60px; border-radius: 18px; background: var(--surface-2); display: grid; place-items: center; margin: 0 auto 16px; }
.empty .ico svg { width: 28px; height: 28px; color: var(--accent); }
.empty h3 { font-size: 18px; }
.empty p { color: var(--text-2); max-width: 340px; margin: 8px auto 20px; }

.alert { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; font-size: 13px; font-weight: 600; margin-bottom: 18px; }
.alert svg { width: 16px; height: 16px; flex-shrink: 0; }
.alert-warn, .alert-error { background: var(--neg-soft); color: var(--neg); }
.alert-ok { background: var(--pos-soft); color: var(--pos); }
.alert-info { background: rgba(124,116,255,.14); color: var(--accent); border: 1px solid rgba(124,116,255,.24); }

.note, .hint { color: var(--text-2); font-size: 13px; }
.note { margin: 0; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; padding: 2px 7px; font-size: 12.5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* chart tooltip */
.chart-box { position: relative; }
.tooltip { position: absolute; pointer-events: none; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 10px; padding: 8px 11px; font-size: 12px; box-shadow: var(--shadow); opacity: 0; transition: opacity .1s; z-index: 5; white-space: nowrap; }
.tooltip .tt-d { color: var(--text-muted); font-size: 11px; }
.tooltip .tt-v { font-weight: 800; font-size: 14px; }

/* detail specifics */
.detail-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.detail-head .logo { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-weight: 800; font-size: 18px; color: #fff; }
.detail-head h1 { font-size: 24px; }
.detail-head .meta { color: var(--text-muted); font-size: 12.5px; font-weight: 600; letter-spacing: .02em; }

/* detail tabs + dividend view */
.tabs { display: flex; gap: 26px; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.tab { border: none; background: transparent; color: var(--text-2); font-weight: 700; font-size: 14.5px; padding: 12px 2px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.chart-toolbar { display: flex; justify-content: flex-start; margin-bottom: 16px; }
tr.year-row td { background: var(--surface-2); font-weight: 700; }
tr.year-row:hover td { background: var(--surface-2); }
tr.pay-row td:first-child { padding-left: 28px; color: var(--text-2); }

/* ============================================================
   LOGIN (standalone page)
   ============================================================ */
body.auth-page { display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow); padding: 36px 32px; }
.login-card .brand { justify-content: center; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.login-card .brand-logo { height: 40px; }
.login-card .product-name { text-align: center; padding: 0; margin-bottom: 4px; font-size: 15px; }
.login-card h2 { text-align: center; font-size: 20px; margin-bottom: 6px; }
.login-card p.hint { text-align: center; color: var(--text-2); font-size: 13px; margin: 0 0 24px; }
.login-card form { display: flex; flex-direction: column; gap: 16px; }
.login-card .btn-primary { justify-content: center; padding: 13px; font-size: 14px; }

/* ============================================================
   COLLAPSED SIDEBAR (Desktop/Tablet)
   ============================================================ */
@media (min-width: 641px) {
  html.sidebar-collapsed .shell { grid-template-columns: 76px minmax(0, 1fr); }
  html.sidebar-collapsed .sidebar { padding: 20px 10px; align-items: center; }
  html.sidebar-collapsed .side-head { flex-direction: column; align-items: center; gap: 8px; border-bottom: none; margin-bottom: 8px; padding: 4px 0 0; }
  html.sidebar-collapsed .brand { justify-content: flex-start; gap: 0; padding: 0; margin-bottom: 0; width: 44px; overflow: hidden; border-bottom: none; }
  html.sidebar-collapsed .brand-logo { height: 32px; max-width: none; }
  html.sidebar-collapsed .sidebar-toggle-btn { width: 34px; height: 34px; }
  html.sidebar-collapsed .product-name { display: none; }
  html.sidebar-collapsed .nav a { justify-content: center; gap: 0; font-size: 0; padding: 12px 0; width: 100%; }
  html.sidebar-collapsed .nav a span { display: none; }
  html.sidebar-collapsed .nav a svg { width: 21px; height: 21px; }
  html.sidebar-collapsed .side-foot { align-items: stretch; width: 100%; }
  html.sidebar-collapsed .side-foot .btn { justify-content: center !important; gap: 0; font-size: 0; padding: 10px 0; }
  html.sidebar-collapsed .side-foot .btn span { display: none; }
  html.sidebar-collapsed .side-foot .btn svg { width: 18px; height: 18px; }
  html.sidebar-collapsed .user-chip { justify-content: center; padding: 8px; }
  html.sidebar-collapsed .user-chip .who { display: none; }
}

/* ============================================================
   BOTTOM NAV (mobile)
   ============================================================ */
.bottomnav { display: none; }

/* ============================================================
   DIVIDENDS PAGE
   ============================================================ */
.div-container {
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.div-month-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.div-month-header {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-2);
  padding: 8px 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  align-self: center;
  letter-spacing: -.01em;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.div-month-header .sum {
  color: var(--text);
  font-weight: 800;
  margin-left: 4px;
}
.div-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.div-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s, border-color .12s;
  position: relative;
  user-select: none;
}
.div-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
  border-left-color: var(--accent);
}
.div-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
}
.div-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.div-card-amount {
  font-size: 22px;
  font-weight: 800;
  color: var(--pos);
  text-align: center;
  margin: 10px 0 6px;
  letter-spacing: -.02em;
}
.div-card-bottom {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-size: 13px;
  color: var(--text-muted);
}
.div-card-chevron {
  position: absolute;
  right: 0;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s ease;
  color: var(--text-muted);
}
.div-card-chevron svg {
  width: 16px !important;
  height: 16px !important;
  max-width: 16px !important;
  max-height: 16px !important;
  display: block;
}
.div-card.open .div-card-chevron {
  transform: rotate(180deg);
  color: var(--accent);
}
.div-card-details {
  display: none;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.div-card.open .div-card-details {
  display: block;
}
.div-detail-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.div-detail-table {
  width: 100%;
  border-collapse: collapse;
}
.div-detail-table tr {
  border-bottom: 1px solid var(--border);
}
.div-detail-table tr:last-child {
  border-bottom: none;
}
.div-detail-table td {
  padding: 9px 14px;
  font-size: 13px;
  border: none;
}
.div-detail-table td.lbl {
  color: var(--text-2);
  font-weight: 500;
  width: 50%;
}
.div-detail-table td.val {
  text-align: right;
  color: var(--text);
  font-weight: 600;
}
.div-detail-table tr.highlight-row {
  background: rgba(41, 211, 145, 0.05);
}
.div-detail-table tr.highlight-row td.total-val {
  color: var(--pos);
  font-weight: 800;
  font-size: 14px;
}
.div-detail-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-hover);
  font-size: 12px;
  color: var(--text-muted);
}
.div-detail-foot .btn {
  padding: 4px 10px;
  font-size: 12px;
}

/* dividend history table */
tr.year-row {
  background: var(--surface-2);
  font-weight: 700;
  color: var(--text);
  border-top: 1px solid var(--border-strong);
}
tr.year-row td {
  padding-top: 12px;
  padding-bottom: 12px;
  font-size: 13.5px;
}
tr.pay-row td {
  color: var(--text-2);
  font-size: 13px;
  padding-left: 24px;
}
tr.pay-row:hover td {
  background: var(--surface-hover);
}


/* ============================================================
   RESPONSIVE
   ============================================================ */

/* ---- TABLET: 641–1024px — collapse sidebar to an icon rail,
   keep tables, stack the wide two-column blocks ---- */
@media (min-width: 641px) and (max-width: 1024px) {
  .shell { grid-template-columns: 76px minmax(0, 1fr); }
  .sidebar { padding: 20px 10px; align-items: center; }
  .side-head { flex-direction: column; align-items: center; gap: 8px; border-bottom: none; margin-bottom: 8px; padding: 4px 0 0; }
  .side-head .sidebar-toggle-btn { display: none; }
  .brand { justify-content: flex-start; gap: 0; padding: 0; margin-bottom: 0; width: 44px; overflow: hidden; border-bottom: none; }
  .brand-logo { height: 32px; max-width: none; }
  .product-name { display: none; }
  .nav a { justify-content: center; gap: 0; font-size: 0; padding: 12px 0; }
  .nav a span { display: none; }
  .nav a svg { width: 21px; height: 21px; }
  .side-foot { align-items: stretch; }
  .side-foot .btn { justify-content: center !important; gap: 0; font-size: 0; padding: 10px 0; }
  .side-foot .btn span { display: none; }
  .side-foot .btn svg { width: 18px; height: 18px; }
  .user-chip { justify-content: center; padding: 8px; }
  .user-chip .who { display: none; }

  .content { padding: 22px 22px 40px; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid.equal { flex-direction: column; }
  .grid.equal > .panel { flex: 0 0 auto; }
  .tiles { grid-template-columns: repeat(2, 1fr) !important; }
  .hero .big { font-size: 40px; }
  .topbar .title h1 { font-size: 23px; }
}

/* ---- PHONE: ≤640px — bottom nav, card lists instead of tables ---- */
@media (max-width: 640px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .content { padding: 18px 16px 96px; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid.equal { flex-direction: column; }
  .grid.equal > .panel { flex: 0 0 auto; }
  .tiles { grid-template-columns: 1fr !important; }
  .tiles.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .tiles.cols-4 .t-value { font-size: 18px; }
  .table-wrap.has-cards { display: none; }
  .card-list { display: flex; }
  .alloc { flex-direction: column; align-items: stretch; }
  .alloc .donut { align-self: center; }
  .form-grid { grid-template-columns: 1fr; }
  .topbar .title h1 { font-size: 22px; }
  .hero .big { font-size: 38px; }
  .detail-head { flex-wrap: wrap; }
  .detail-head h1 { font-size: 20px; }
  .detail-head .logo { width: 44px; height: 44px; }
  .detail-head .freshness { order: 3; flex: 1 1 100%; justify-content: center; }

  .bottomnav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    background: var(--surface); border-top: 1px solid var(--border);
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    justify-content: space-around;
  }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--text-muted); font-size: 10.5px; font-weight: 600; padding: 4px 14px; border-radius: 10px; }
  .bottomnav a svg { width: 21px; height: 21px; }
  .bottomnav a.active { color: var(--accent); }
}
