/* ============================================================
   Monarch Dashboard — Custom Styles
   Built on top of Pico CSS v2 (dark theme)
   ============================================================ */

/* ── Base overrides ──────────────────────────────────────── */
:root {
  --sidebar-width: 210px;
  --sidebar-bg: #0f1117;
  --sidebar-border: #1e2330;
  --main-bg: #13161f;
  --card-bg: #1a1f2e;
  --card-border: #252c3d;
  --color-positive: #4ade80;
  --color-negative: #f87171;
  --color-accent: #60a5fa;
  --color-muted: #6b7280;
  --color-text: #e2e8f0;
  --color-text-secondary: #94a3b8;
  --radius: 8px;
  --font-mono: 'SF Mono', 'Fira Mono', 'Consolas', monospace;
}

/* Pico dark theme background override */
[data-theme="dark"] {
  --pico-background-color: var(--main-bg);
  --pico-card-background-color: var(--card-bg);
  --pico-card-border-color: var(--card-border);
  --pico-color: var(--color-text);
  --pico-muted-color: var(--color-text-secondary);
  --pico-primary: var(--color-accent);
  --pico-primary-hover: #93c5fd;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--main-bg);
  color: var(--color-text);
  font-size: 14px;
  line-height: 1.6;
}


/* ── Layout ──────────────────────────────────────────────── */
.layout-wrapper {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  min-width: 0;
  padding: 1.75rem 2rem;
  overflow-x: hidden;
}


/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
  padding: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-header {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-accent);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-tagline {
  display: block;
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--color-positive);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 0.2rem;
  opacity: 0.85;
}

.nav-section-label {
  padding: 0.75rem 1.25rem 0.25rem !important;
  font-size: 0.65rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.1em !important;
  color: var(--color-muted) !important;
  display: block !important;
  margin-top: 0.5rem !important;
  border-top: 1px solid var(--sidebar-border);
  padding-top: 0.75rem !important;
}

nav.sidebar ul li:first-child .nav-section-label,
.nav-section-label:first-child {
  border-top: none;
  margin-top: 0 !important;
}

/* Trading section nav links get a subtle green accent when active */
.nav-link--trading.active {
  color: var(--color-positive) !important;
  background: rgba(74,222,128,0.08) !important;
  border-left-color: var(--color-positive) !important;
}

nav.sidebar ul {
  list-style: none;
  margin: 0.5rem 0 !important;
  padding: 0.5rem 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
}

nav.sidebar ul li {
  margin: 0 !important;
  padding: 0 !important;
  display: block !important;
}

nav.sidebar a.nav-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 1.25rem;
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

nav.sidebar a.nav-link:hover {
  color: var(--color-text);
  background: rgba(255,255,255,0.04);
  text-decoration: none;
}

nav.sidebar a.nav-link.active {
  color: var(--color-accent);
  background: rgba(96,165,250,0.08);
  border-left-color: var(--color-accent);
}

.nav-icon {
  font-size: 1rem;
  width: 1.25rem;
  text-align: center;
  flex-shrink: 0;
}


/* ── Page header ─────────────────────────────────────────── */
.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 {
  margin: 0 0 0.15rem;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-text);
}

.page-subtitle {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.875rem;
}

.section-heading {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin: 1.5rem 0 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}


/* ── Cards ───────────────────────────────────────────────── */
article {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

article > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--card-border);
}

.card-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-secondary);
}

.card-link {
  font-size: 0.8rem;
  color: var(--color-accent);
  text-decoration: none;
}

.card-link:hover {
  text-decoration: underline;
}

/* Card grid for top summary row */
.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.card-grid article {
  margin-bottom: 0;
}

.card-full {
  width: 100%;
}

/* Summary cards */
.summary-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

.summary-card--primary {
  border-left: 3px solid var(--color-accent);
}

.summary-card--accent {
  border-left: 3px solid var(--color-positive);
}

.summary-card--danger {
  border-left: 3px solid var(--color-negative);
}

.summary-card header {
  border-bottom: none;
  margin-bottom: 0.5rem;
  padding-bottom: 0;
}

.summary-amount {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

/* Net worth breakdown */
.nw-breakdown {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nw-breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.nw-type {
  color: var(--color-text-secondary);
}


/* ── Charts ──────────────────────────────────────────────── */
.chart-container {
  position: relative;
  height: 260px;
}

.chart-container--small {
  height: 200px;
}

.chart-container--tall {
  height: 320px;
}

.chart-container--doughnut {
  height: 340px;
}

.chart-container--hbar {
  height: auto;
  min-height: 200px;
}

.chart-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}


/* ── Tables ──────────────────────────────────────────────── */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.compact-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.compact-table th {
  padding: 0.5rem 0.75rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--card-border);
  white-space: nowrap;
  background: transparent;
}

.compact-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
  color: var(--color-text);
}

.compact-table tbody tr:last-child td {
  border-bottom: none;
}

.compact-table tbody tr:hover td {
  background: rgba(255,255,255,0.025);
}

.compact-table .text-right {
  text-align: right;
}

.compact-table .text-center {
  text-align: center;
}

/* Table column sizing hints */
.col-date     { white-space: nowrap; width: 7rem; }
.col-merchant { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-account  { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-category { white-space: nowrap; }
.col-amount   { white-space: nowrap; font-family: var(--font-mono); }


/* ── Amount colors ───────────────────────────────────────── */
.amount-positive { color: var(--color-positive) !important; }
.amount-negative { color: var(--color-negative) !important; }


/* ── Utility ─────────────────────────────────────────────── */
.text-muted   { color: var(--color-muted); }
.text-right   { text-align: right; }
.text-center  { text-align: center; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  background: rgba(255,255,255,0.07);
  border-radius: 4px;
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.loading-state {
  padding: 2rem;
  color: var(--color-muted);
  font-size: 0.9rem;
}


/* ── Transaction table summary + pagination ──────────────── */
.table-summary {
  padding: 0.6rem 0.75rem;
  font-size: 0.82rem;
  color: var(--color-muted);
  border-bottom: 1px solid var(--card-border);
  margin-bottom: 0;
}

.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.5rem 0.25rem;
  gap: 1rem;
}

.pagination-info {
  font-size: 0.82rem;
}

.pagination-buttons {
  display: flex;
  gap: 0.5rem;
}

.pagination-buttons button {
  padding: 0.35rem 0.9rem;
  font-size: 0.82rem;
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.pagination-buttons button:not([disabled]):hover {
  background: rgba(255,255,255,0.05);
  color: var(--color-text);
}

.pagination-buttons button[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}


/* ── Filter / search bar ─────────────────────────────────── */
.filter-card {
  padding: 1rem 1.5rem;
  margin-bottom: 1.25rem;
}

.filter-card header {
  display: none; /* no header needed */
}

.search-row {
  margin-bottom: 0.75rem;
}

.search-row input[type="search"] {
  width: 100%;
  padding: 0.55rem 0.9rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  color: var(--color-text);
  font-size: 0.9rem;
}

.search-row input[type="search"]:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px rgba(96,165,250,0.15);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 120px;
  flex: 1;
}

.filter-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
}

.filter-field select,
.filter-field input[type="date"],
.filter-field input[type="number"] {
  padding: 0.4rem 0.65rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  color: var(--color-text);
  font-size: 0.84rem;
}

.filter-field select:focus,
.filter-field input:focus {
  outline: none;
  border-color: var(--color-accent);
}

/* hide select arrow on some browsers to keep style consistent */
.filter-field select {
  appearance: auto;
}


/* ── Spending page — time range buttons ──────────────────── */
.time-range-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.time-btn {
  padding: 0.35rem 1rem;
  border: 1px solid var(--card-border);
  border-radius: 20px;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.time-btn:hover {
  background: rgba(255,255,255,0.05);
  color: var(--color-text);
}

.time-btn.active {
  background: rgba(96,165,250,0.12);
  border-color: var(--color-accent);
  color: var(--color-accent);
}


/* ── Recurring page ──────────────────────────────────────── */
.legend-row {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1rem;
  font-size: 0.82rem;
  color: var(--color-text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-dot--monthly    { background: var(--color-accent); }
.legend-dot--occasional { background: #a78bfa; }

.frequency-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.4rem;
  flex-shrink: 0;
}

.dot-monthly    { background: var(--color-accent); }
.dot-occasional { background: #a78bfa; }

.row-monthly td    { border-left: 2px solid var(--color-accent); }
.row-occasional td { border-left: 2px solid #a78bfa; }

/* Only first td gets the left border */
.row-monthly td:not(:first-child),
.row-occasional td:not(:first-child) {
  border-left: none;
}

.months-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 600;
}

.months-badge--high {
  background: rgba(96,165,250,0.15);
  color: var(--color-accent);
}

.months-badge--low {
  background: rgba(167,139,250,0.15);
  color: #a78bfa;
}


/* ── Debt page ───────────────────────────────────────────── */
.type-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 0.4rem;
}

.type-indicator--credit { background: #f472b6; }
.type-indicator--loan   { background: #60a5fa; }

.type-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: capitalize;
}

.type-badge--credit {
  background: rgba(244,114,182,0.15);
  color: #f472b6;
}

.type-badge--loan {
  background: rgba(96,165,250,0.15);
  color: #60a5fa;
}


/* ── Holdings page ───────────────────────────────────────── */
.ticker-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  background: rgba(96,165,250,0.12);
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--color-accent);
  letter-spacing: 0.04em;
}

.gain-pct {
  font-size: 0.78rem;
  margin-left: 0.3rem;
  opacity: 0.8;
}


/* ── Budget page ─────────────────────────────────────────── */
.budget-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.budget-group-totals {
  display: flex;
  gap: 1.25rem;
  font-size: 0.85rem;
}

.budget-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-top: 0.25rem;
}

.budget-row {
  padding: 0.75rem;
  border-radius: 6px;
  background: rgba(255,255,255,0.02);
  border: 1px solid transparent;
  transition: border-color 0.15s;
}

.budget-row--over {
  background: rgba(248,113,113,0.05);
  border-color: rgba(248,113,113,0.2);
}

.budget-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  gap: 0.5rem;
}

.budget-category-name {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.over-budget-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: var(--color-negative);
  color: #fff;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.budget-row-amounts {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.budget-divider {
  opacity: 0.4;
}

.budget-pct {
  font-size: 0.78rem;
  margin-left: 0.25rem;
}

/* Progress bar */
.progress-track {
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
  min-width: 2px;
}

.progress-fill--ok   { background: var(--color-positive); }
.progress-fill--over { background: var(--color-negative); }

.budget-remaining {
  font-size: 0.78rem;
  margin-top: 0.35rem;
}


/* ── Account cards ───────────────────────────────────────── */
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}

.account-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  padding: 0.75rem 0.9rem;
}

.account-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 0.15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-institution {
  font-size: 0.75rem;
  margin-bottom: 0.4rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-balance {
  font-size: 0.95rem;
  font-weight: 700;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}


/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .layout-wrapper {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--sidebar-border);
  }

  .sidebar-header {
    display: flex !important;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: none;
  }

  .sidebar-tagline {
    display: none;
  }

  nav.sidebar ul {
    display: flex !important;
    flex-direction: row !important;
    margin: 0 !important;
    padding: 0 !important;
    white-space: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-section-label {
    display: none !important;
  }

  nav.sidebar ul li {
    display: inline-block !important;
  }

  nav.sidebar a.nav-link {
    border-left: none;
    border-bottom: 3px solid transparent;
    padding: 0.6rem 0.75rem;
    font-size: 0.78rem;
    gap: 0.3rem;
  }

  nav.sidebar a.nav-link.active {
    border-bottom-color: var(--color-accent);
    border-left-color: transparent;
  }

  .nav-icon {
    font-size: 0.85rem;
  }

  .main-content {
    padding: 1rem;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .filter-row {
    flex-direction: column;
  }

  .filter-field {
    min-width: unset;
    flex: none;
    width: 100%;
  }

  .budget-group-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .chart-container--doughnut {
    height: 280px;
  }

  .budget-row-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .time-range-bar {
    flex-wrap: wrap;
  }

  .summary-amount {
    font-size: 1.5rem;
  }

  .account-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── valueVibes assistant (floating bot widget) ──────────── */
#vv-bot-btn {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1000;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: var(--color-accent);
  color: #0f1117;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s ease, background 0.15s ease;
  padding: 0;
  margin: 0;
}
#vv-bot-btn:hover { transform: scale(1.07); background: #93c5fd; }
#vv-bot-btn.vv-open { background: var(--card-bg); color: var(--color-accent); }

#vv-bot-panel {
  position: fixed;
  right: 22px;
  bottom: 88px;
  z-index: 1000;
  width: min(400px, calc(100vw - 44px));
  height: min(560px, calc(100vh - 130px));
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
#vv-bot-panel header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--card-border);
  line-height: 1.25;
}
#vv-bot-panel header small { color: var(--color-text-secondary); }
.vv-bot-iconbtn {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 6px;
  margin: 0;
  width: auto;
}
.vv-bot-iconbtn:hover { color: var(--color-text); }

#vv-bot-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.vv-bubble {
  max-width: 88%;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.45;
  overflow-wrap: break-word;
}
.vv-bubble code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: rgba(0, 0, 0, 0.35);
  padding: 1px 5px;
  border-radius: 4px;
}
.vv-user {
  align-self: flex-end;
  background: var(--color-accent);
  color: #0f1117;
  border-bottom-right-radius: 4px;
}
.vv-user code { background: rgba(255, 255, 255, 0.3); color: inherit; }
.vv-assistant {
  align-self: flex-start;
  background: var(--main-bg);
  border: 1px solid var(--card-border);
  color: var(--color-text);
  border-bottom-left-radius: 4px;
}
.vv-error { border-color: var(--color-negative); color: var(--color-negative); }

.vv-dots { display: inline-flex; gap: 4px; padding: 2px 0; }
.vv-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-text-secondary);
  animation: vv-blink 1.2s infinite both;
}
.vv-dots i:nth-child(2) { animation-delay: 0.2s; }
.vv-dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes vv-blink {
  0%, 80%, 100% { opacity: 0.25; }
  40% { opacity: 1; }
}

#vv-bot-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--card-border);
  background: var(--sidebar-bg);
  align-items: flex-end;
}
#vv-bot-form textarea {
  flex: 1;
  resize: none;
  margin: 0;
  padding: 8px 10px;
  font-size: 0.85rem;
  background: var(--main-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  color: var(--color-text);
  max-height: 120px;
}
#vv-bot-form textarea:focus {
  border-color: var(--color-accent);
  box-shadow: none;
  outline: none;
}
#vv-bot-send {
  width: 38px;
  height: 38px;
  margin: 0;
  padding: 0;
  border-radius: var(--radius);
  border: none;
  background: var(--color-accent);
  color: #0f1117;
  cursor: pointer;
  font-size: 1rem;
  flex-shrink: 0;
}
#vv-bot-send:disabled { opacity: 0.5; cursor: default; }

/* ── Accounts page (Monarch-style) ───────────────────────── */
.accounts-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1.2rem;
  align-items: start;
}
@media (max-width: 1100px) {
  .accounts-layout { grid-template-columns: 1fr; }
}

.acct-networth-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
}
.acct-networth-amount {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0.15rem 0 0.2rem;
}
.acct-change {
  font-size: 0.82rem;
  font-weight: 600;
}
.acct-change.up { color: var(--color-positive); }
.acct-change.down { color: var(--color-negative); }
.acct-change-label {
  font-size: 0.75rem;
  color: var(--color-muted);
  margin-left: 0.35rem;
}
.acct-range { display: flex; gap: 4px; }
.acct-range-btn {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--card-border);
  color: var(--color-text-secondary);
  font-size: 0.78rem;
  text-decoration: none;
}
.acct-range-btn.active {
  background: var(--color-accent);
  color: #0f1117;
  border-color: var(--color-accent);
}
.acct-range-btn:hover { color: var(--color-text); }
.acct-range-btn.active:hover { color: #0f1117; }

.acct-group {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  margin-bottom: 0.7rem;
  padding: 0;
}
.acct-group summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.1rem;
  cursor: pointer;
  list-style: none;
}
.acct-group summary::-webkit-details-marker { display: none; }
.acct-group-title {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-weight: 600;
}
.acct-caret {
  display: inline-block;
  color: var(--color-muted);
  transition: transform 0.15s ease;
}
.acct-group[open] .acct-caret { transform: rotate(90deg); }
.acct-group-total { font-weight: 700; white-space: nowrap; }

.acct-list {
  list-style: none;
  margin: 0;
  padding: 0 0 0.3rem;
  border-top: 1px solid var(--card-border);
}
.acct-list li {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.65rem 1.1rem;
}
.acct-list li + li { border-top: 1px solid rgba(37, 44, 61, 0.5); }
.acct-dot {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #0f1117;
  flex-shrink: 0;
}
.acct-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.acct-name {
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.acct-inst { font-size: 0.74rem; color: var(--color-muted); }
.acct-spark { flex-shrink: 0; opacity: 0.8; }
.acct-balance {
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.acct-summary {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  position: sticky;
  top: 1rem;
}
.acct-summary header { margin-bottom: 0.6rem; }
.acct-summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 0.45rem;
}
.acct-bar {
  display: flex;
  height: 9px;
  border-radius: 5px;
  overflow: hidden;
  gap: 2px;
  margin-bottom: 0.6rem;
  background: rgba(37, 44, 61, 0.4);
}
.acct-bar span { display: block; height: 100%; min-width: 3px; }
.acct-summary-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.82rem;
}
.acct-summary-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.22rem 0;
  color: var(--color-text-secondary);
}
.acct-summary-list li span {
  margin-left: auto;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}
.acct-summary-list i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.acct-csv {
  display: block;
  text-align: center;
  margin-top: 1.1rem;
  font-size: 0.82rem;
  color: var(--color-accent);
  text-decoration: none;
}
.acct-csv:hover { text-decoration: underline; }
