/* style.css — Sheetz Wealth Dashboard Design Tokens & Components */

/* ============================================================
   DESIGN TOKENS
   ============================================================ */

:root, [data-theme="light"] {
  /* --- Type Scale (fluid) --- */
  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);
  --text-base: clamp(1rem,     0.9rem  + 0.5vw,  1.125rem);
  --text-lg:   clamp(1.125rem, 0.95rem + 0.85vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1rem    + 1.5vw,  2.25rem);
  --text-2xl:  clamp(2rem,     1.2rem  + 2.5vw,  3.5rem);

  /* --- 4px Spacing System --- */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* --- Surfaces (Light) --- */
  --color-bg:              #f7f6f2;
  --color-surface:         #f9f8f5;
  --color-surface-2:       #fbfbf9;
  --color-surface-offset:  #f3f0ec;
  --color-surface-offset-2: #edeae5;
  --color-surface-dynamic: #e6e4df;
  --color-divider:         #dcd9d5;
  --color-border:          #d4d1ca;

  /* --- Text (Light) --- */
  --color-text:         #28251d;
  --color-text-muted:   #7a7974;
  --color-text-faint:   #bab9b4;
  --color-text-inverse: #f9f8f4;

  /* --- Primary (Hydra Teal) --- */
  --color-primary:           #01696f;
  --color-primary-hover:     #0c4e54;
  --color-primary-active:    #0f3638;
  --color-primary-highlight: #cedcd8;

  /* --- Semantic --- */
  --color-success:           #437a22;
  --color-success-hover:     #2e5c10;
  --color-success-highlight: #d4dfcc;

  --color-error:             #c0392b;
  --color-error-hover:       #a93226;
  --color-error-highlight:   #f5d0cd;

  --color-warning:           #964219;
  --color-warning-highlight: #ddcfc6;

  --color-gold:              #d19900;
  --color-gold-highlight:    #e9e0c6;

  --color-blue:              #006494;
  --color-blue-highlight:    #c6d8e4;

  --color-purple:            #7a39bb;
  --color-purple-highlight:  #dacfde;

  --color-orange:            #da7101;
  --color-orange-highlight:  #e7d7c4;

  /* --- Radii --- */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* --- Transitions --- */
  --transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* --- Shadows --- */
  --shadow-sm: 0 1px 2px oklch(0.2 0.01 80 / 0.06);
  --shadow-md: 0 4px 12px oklch(0.2 0.01 80 / 0.08);
  --shadow-lg: 0 12px 32px oklch(0.2 0.01 80 / 0.12);

  /* --- Font --- */
  --font-body: 'Inter', system-ui, sans-serif;

  /* --- Layout --- */
  --sidebar-width: 220px;
}

/* ============================================================
   DARK MODE (default)
   ============================================================ */
[data-theme="dark"] {
  --color-bg:              #0f0f0e;
  --color-surface:         #161614;
  --color-surface-2:       #1c1b19;
  --color-surface-offset:  #1a1918;
  --color-surface-offset-2: #201f1d;
  --color-surface-dynamic: #2a2927;
  --color-divider:         #232220;
  --color-border:          #333230;

  --color-text:         #d4d3d1;
  --color-text-muted:   #7a7977;
  --color-text-faint:   #4e4d4b;
  --color-text-inverse: #2b2a28;

  --color-primary:           #4f98a3;
  --color-primary-hover:     #227f8b;
  --color-primary-active:    #1a626b;
  --color-primary-highlight: #1e3335;

  --color-success:           #6daa45;
  --color-success-hover:     #4d8f25;
  --color-success-highlight: #1e3020;

  --color-error:             #e05c4a;
  --color-error-hover:       #c94432;
  --color-error-highlight:   #3a1a18;

  --color-warning:           #bb653b;
  --color-warning-highlight: #3a2820;

  --color-gold:              #e8af34;
  --color-gold-highlight:    #2e2614;

  --color-blue:              #5591c7;
  --color-blue-highlight:    #1a2b38;

  --color-purple:            #a86fdf;
  --color-purple-highlight:  #2a1e38;

  --color-orange:            #fdab43;
  --color-orange-highlight:  #2e2012;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.3);
  --shadow-md: 0 4px 12px oklch(0 0 0 / 0.4);
  --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.5);
}

/* System preference fallback */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg:              #0f0f0e;
    --color-surface:         #161614;
    --color-surface-2:       #1c1b19;
    --color-surface-offset:  #1a1918;
    --color-surface-offset-2: #201f1d;
    --color-surface-dynamic: #2a2927;
    --color-divider:         #232220;
    --color-border:          #333230;
    --color-text:         #d4d3d1;
    --color-text-muted:   #7a7977;
    --color-text-faint:   #4e4d4b;
    --color-text-inverse: #2b2a28;
    --color-primary:           #4f98a3;
    --color-primary-hover:     #227f8b;
    --color-primary-active:    #1a626b;
    --color-primary-highlight: #1e3335;
    --color-success:           #6daa45;
    --color-success-hover:     #4d8f25;
    --color-success-highlight: #1e3020;
    --color-error:             #e05c4a;
    --color-error-hover:       #c94432;
    --color-error-highlight:   #3a1a18;
    --color-warning:           #bb653b;
    --color-warning-highlight: #3a2820;
    --color-gold:              #e8af34;
    --color-gold-highlight:    #2e2614;
    --color-blue:              #5591c7;
    --color-blue-highlight:    #1a2b38;
    --color-purple:            #a86fdf;
    --color-purple-highlight:  #2a1e38;
    --color-orange:            #fdab43;
    --color-orange-highlight:  #2e2012;
    --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.3);
    --shadow-md: 0 4px 12px oklch(0 0 0 / 0.4);
    --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.5);
  }
}

/* ============================================================
   DASHBOARD LAYOUT — Full Viewport
   ============================================================ */
html, body {
  height: 100%;
  overflow: hidden;
}

body {
  height: 100dvh;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-variant-numeric: lining-nums tabular-nums;
}

/* ============================================================
   APP SHELL GRID (applied to #app-shell)
   ============================================================ */
#app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: 1fr;
  height: 100dvh;
  overflow: hidden;
}

/* Auth wrapper: full viewport centered layout */
#auth-wrapper {
  height: 100dvh;
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  background: var(--color-bg);
  padding: var(--space-6);
}
.sidebar {
  grid-row: 1 / -1;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 20;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-5);
  border-bottom: 1px solid var(--color-divider);
}

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.sidebar-logo-name {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.sidebar-logo-sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.sidebar-nav {
  padding: var(--space-4) var(--space-3);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.nav-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  padding: var(--space-4) var(--space-2) var(--space-2);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: var(--color-surface-dynamic);
  color: var(--color-text);
}

.nav-item.active {
  background: var(--color-primary-highlight);
  color: var(--color-primary);
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item.active svg {
  opacity: 1;
}

.sidebar-footer {
  padding: var(--space-4) var(--space-3);
  border-top: 1px solid var(--color-divider);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.main-wrapper {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-divider);
  background: var(--color-surface);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}

.topbar-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.main-content {
  overflow-y: auto;
  overscroll-behavior: contain;
  flex: 1;
  padding: var(--space-6);
}

/* ============================================================
   VIEWS (hash routing)
   ============================================================ */
.view {
  display: none;
}
.view.active {
  display: block;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  border: 1px solid transparent;
  white-space: nowrap;
  min-height: 36px;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

.btn-secondary {
  background: var(--color-surface-dynamic);
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-surface-offset-2);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: var(--color-border);
}

.btn-ghost:hover {
  background: var(--color-surface-dynamic);
  color: var(--color-text);
}

.btn-danger {
  background: var(--color-error-highlight);
  color: var(--color-error);
  border-color: transparent;
}

.btn-danger:hover {
  background: var(--color-error);
  color: white;
}

.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  min-height: 28px;
}

.btn-icon {
  padding: var(--space-2);
  min-height: 36px;
  min-width: 36px;
  justify-content: center;
}

.btn-connect {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
  width: 100%;
  justify-content: center;
}

.btn-connect:hover {
  background: var(--color-primary-hover);
}

/* ============================================================
   KPI CARDS
   ============================================================ */
/* Combined Net Worth Hero Banner */
.nw-hero-banner {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-8);
  margin-bottom: var(--space-4);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.nw-hero-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--color-primary) 0%, transparent 60%);
  opacity: 0.04;
}

.nw-hero-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.nw-hero-value {
  font-size: clamp(2rem, 1.5rem + 3vw, 3.5rem);
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: var(--space-3);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.kpi-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity var(--transition);
}

.kpi-card:hover::before {
  opacity: 1;
}

.kpi-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.kpi-value {
  font-size: clamp(1.4rem, 1rem + 1.5vw, 2rem);
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: var(--space-2);
}

.kpi-value.primary {
  color: var(--color-primary);
  font-size: clamp(1.6rem, 1.2rem + 2vw, 2.4rem);
}

.kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
}

.kpi-delta.positive {
  color: var(--color-success);
  background: var(--color-success-highlight);
}

.kpi-delta.negative {
  color: var(--color-error);
  background: var(--color-error-highlight);
}

.kpi-delta.neutral {
  color: var(--color-text-muted);
  background: var(--color-surface-dynamic);
}

/* ============================================================
   CHART ROW
   ============================================================ */
.chart-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.chart-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  overflow: hidden;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.chart-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

.chart-subtitle {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* Dashboard period bar (above hero banner) */
.dashboard-period-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: var(--space-4);
}

/* Net Worth period toggle */
.nw-period-toggle {
  display: flex;
  background: var(--color-surface-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 2px;
  gap: 2px;
}

.nw-period-btn {
  padding: 4px 10px;
  font-size: var(--text-xs);
  font-family: inherit;
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-radius: calc(var(--radius-md) - 2px);
  cursor: pointer;
  transition: all 180ms ease;
  white-space: nowrap;
}

.nw-period-btn:hover {
  color: var(--color-text);
}

.nw-period-btn.active {
  background: var(--color-surface-2);
  color: var(--color-text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.chart-legend {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.chart-container {
  position: relative;
  height: 220px;
}

.chart-container-donut {
  position: relative;
  height: 200px;
  display: flex;
  justify-content: center;
}

/* ============================================================
   HOLDINGS TABLE
   ============================================================ */
.table-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
  overflow: hidden;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-divider);
  flex-wrap: wrap;
  gap: var(--space-3);
}

.filter-tabs {
  display: flex;
  gap: var(--space-1);
}

.filter-tab {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  background: transparent;
  border: none;
}

.filter-tab:hover {
  background: var(--color-surface-dynamic);
  color: var(--color-text);
}

.filter-tab.active {
  background: var(--color-primary-highlight);
  color: var(--color-primary);
}

.table-scroll {
  overflow-x: auto;
  overscroll-behavior: contain;
}

.holdings-table {
  min-width: 900px;
}

.holdings-table th {
  padding: var(--space-2) var(--space-4);
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  background: var(--color-surface-offset);
  border-bottom: 1px solid var(--color-divider);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  position: sticky;
  top: 0;
}

.holdings-table th:hover {
  color: var(--color-text-muted);
}

.holdings-table th.sort-asc::after { content: ' ↑'; }
.holdings-table th.sort-desc::after { content: ' ↓'; }

.holdings-table td {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-text);
  border-bottom: 1px solid var(--color-divider);
  white-space: nowrap;
}

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

.holdings-table tr:hover td {
  background: var(--color-surface-offset);
}

.holdings-table .totals-row td {
  font-weight: 700;
  background: var(--color-surface-offset-2);
  color: var(--color-text);
  font-size: var(--text-sm);
}

.gain { color: var(--color-success); }
.loss { color: var(--color-error); }

.owner-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.owner-badge.jake {
  background: var(--color-primary-highlight);
  color: var(--color-primary);
}

.owner-badge.wife {
  background: var(--color-purple-highlight);
  color: var(--color-purple);
}

/* ============================================================
   STRATEGY PANEL
   ============================================================ */
.strategy-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-6);
}

.strategy-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-divider);
}

.strategy-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

.strategy-timestamp {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

.strategy-body {
  padding: var(--space-5);
}

.strategy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-3);
}

.strategy-item {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-surface-offset);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.strategy-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

.strategy-icon.teal { background: var(--color-primary-highlight); color: var(--color-primary); }
.strategy-icon.gold { background: var(--color-gold-highlight); color: var(--color-gold); }
.strategy-icon.blue { background: var(--color-blue-highlight); color: var(--color-blue); }
.strategy-icon.warning { background: var(--color-warning-highlight); color: var(--color-warning); }
.strategy-icon.success { background: var(--color-success-highlight); color: var(--color-success); }
.strategy-icon.error { background: var(--color-error-highlight); color: var(--color-error); }

.strategy-item-content h4 {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-1);
}

.strategy-item-content p {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.5;
  max-width: none;
}

/* ============================================================
   ACCOUNTS VIEW
   ============================================================ */
.accounts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-4);
}

.account-section-title {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
  margin-top: var(--space-5);
}

.account-section-title:first-child { margin-top: 0; }

.account-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
}

.account-institution-logo {
  width: 40px;
  height: 40px;
  background: var(--color-surface-dynamic);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-primary);
  flex-shrink: 0;
}

.account-info {
  flex: 1;
  min-width: 0;
}

.account-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 2px;
}

.account-institution {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}

.account-balance {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.account-type {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  background: var(--color-surface-dynamic);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.account-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

/* ============================================================
   SETTINGS VIEW
   ============================================================ */
.settings-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-5);
  max-width: 640px;
}

.settings-section-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-divider);
}

.settings-section-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

.settings-section-sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

.settings-body {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  letter-spacing: 0.03em;
}

.form-input {
  background: var(--color-surface-offset);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text);
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

.form-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-primary), transparent 80%);
}

.form-input::placeholder {
  color: var(--color-text-faint);
}

.form-select {
  background: var(--color-surface-offset);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text);
  width: 100%;
  cursor: pointer;
}

.form-actions {
  display: flex;
  gap: var(--space-3);
  padding-top: var(--space-2);
}

/* ============================================================
   AUTH VIEWS (Setup & Login)
   ============================================================ */
.auth-wrapper {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  padding: var(--space-6);
}

.auth-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}

.auth-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-2);
  letter-spacing: -0.01em;
}

.auth-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.auth-error {
  background: var(--color-error-highlight);
  color: var(--color-error);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  font-weight: 500;
  display: none;
}

.auth-error.visible { display: block; }

/* ============================================================
   STRATEGIES VIEW
   ============================================================ */
.strategies-header {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
}

.strategies-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.strategy-entry {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.strategy-entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-divider);
  cursor: pointer;
  transition: background var(--transition);
}

.strategy-entry-header:hover {
  background: var(--color-surface-offset);
}

.strategy-entry-body {
  padding: var(--space-5);
  display: none;
}

.strategy-entry-body.open { display: block; }

/* ============================================================
   SKELETON LOADERS
   ============================================================ */
@keyframes skeleton-shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-surface-dynamic) 25%,
    var(--color-surface-offset-2) 50%,
    var(--color-surface-dynamic) 75%
  );
  background-size: 400px 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 12px;
  width: 60%;
  margin-bottom: var(--space-2);
}

.skeleton-value {
  height: 28px;
  width: 80%;
}

.skeleton-row {
  height: 40px;
  width: 100%;
  margin-bottom: var(--space-2);
}

/* ============================================================
   EMPTY STATES
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-8);
  text-align: center;
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  background: var(--color-surface-dynamic);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
  color: var(--color-text-faint);
}

.empty-state-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.empty-state-description {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  max-width: 280px;
  margin-bottom: var(--space-5);
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.toast {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  animation: toast-in 240ms cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 320px;
}

.toast.success { border-left: 3px solid var(--color-success); }
.toast.error { border-left: 3px solid var(--color-error); }
.toast.info { border-left: 3px solid var(--color-primary); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   THEME TOGGLE
   ============================================================ */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  transition: background var(--transition), color var(--transition);
  border: 1px solid var(--color-border);
  background: var(--color-surface-offset);
}

.theme-toggle:hover {
  background: var(--color-surface-dynamic);
  color: var(--color-text);
}

/* ============================================================
   ALLOCATION SUMMARY (in strategies view)
   ============================================================ */
.allocation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.alloc-item {
  background: var(--color-surface-offset);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  text-align: center;
}

.alloc-pct {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
}

.alloc-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* ============================================================
   SECTION HEADERS
   ============================================================ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.section-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.section-sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* ============================================================
   LOADING OVERLAY
   ============================================================ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  flex-direction: column;
  gap: var(--space-4);
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.spinner-sm {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

/* ============================================================
   RESPONSIVE — MOBILE (Bottom Tab Bar)
   ============================================================ */
@media (max-width: 768px) {
  /* App shell: single column, full viewport height */
  #app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }

  /* Sidebar → fixed bottom tab bar */
  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    height: auto;
    z-index: 100;
    flex-direction: row;
    align-items: stretch;
    overflow: visible;
    border-right: none;
    border-top: 1px solid var(--color-border);
    border-bottom: none;
    background: var(--color-surface);
    padding: 0;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
  }

  .sidebar-logo { display: none; }
  .sidebar-logo-sub { display: none; }
  .sidebar-footer { display: none; }
  .nav-label { display: none; }

  .sidebar-nav {
    flex-direction: row;
    padding: 0;
    gap: 0;
    flex: 1;
    justify-content: space-around;
    overflow: visible;
  }

  .nav-item {
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 4px 6px;
    font-size: 10px;
    min-width: 0;
    border-radius: 0;
    text-align: center;
    width: auto;
  }

  .nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
  }

  .nav-text {
    font-size: 10px;
    line-height: 1.2;
  }

  .nav-item.active {
    background: none;
    color: var(--color-primary);
  }

  /* Main content needs bottom padding for tab bar */
  .main-wrapper {
    padding-bottom: 64px;
  }

  /* Topbar adjustments */
  .topbar {
    padding: var(--space-3) var(--space-4);
  }

  .topbar-title {
    font-size: var(--text-sm);
  }

  .main-content {
    padding: var(--space-4);
  }

  /* Hero banner — smaller on mobile */
  .nw-hero-banner {
    padding: var(--space-4) var(--space-5);
    margin-bottom: var(--space-3);
  }

  .nw-hero-value {
    font-size: var(--text-xl) !important;
  }

  /* Period bar centered on mobile */
  .dashboard-period-bar {
    justify-content: center;
    margin-bottom: var(--space-3);
  }

  /* Asset split row: stack vertically */
  .asset-split-row {
    grid-template-columns: 1fr !important;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
  }

  .asset-split-card {
    padding: var(--space-4) var(--space-5);
  }

  /* KPI & Chart grids */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }

  .chart-row {
    grid-template-columns: 1fr;
  }

  /* Section headers stack on mobile */
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }

  .section-header > div:last-child {
    width: 100%;
  }

  .section-header > div:last-child .btn {
    flex: 1;
  }

  /* Table smooth scroll on iOS */
  .table-scroll {
    -webkit-overflow-scrolling: touch;
  }

  /* Home details grid */
  .home-details-grid {
    grid-template-columns: 1fr;
  }

  .home-summary-row {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Mortgage analysis grid */
  .mortgage-analysis-grid {
    grid-template-columns: 1fr;
  }

  .mortgage-panel:first-child {
    border-right: none;
    border-bottom: 1px solid var(--color-divider);
  }

  /* Mortgage form grid (settings) */
  .mortgage-form-grid {
    grid-template-columns: 1fr !important;
  }

  /* Refinance options */
  .refi-options {
    grid-template-columns: 1fr;
  }

  /* Equity bar label stacks on narrow screens */
  .mortgage-equity-bar-label {
    flex-direction: column;
    gap: var(--space-1);
  }

  /* Auth wrapper */
  #auth-wrapper {
    padding: var(--space-4);
  }

  .auth-card {
    padding: var(--space-5);
    max-width: 100%;
  }

  /* Connect modal — ensure inner card doesn't overflow */
  #connect-modal > .auth-card {
    margin: var(--space-4);
    max-width: calc(100vw - 2 * var(--space-4));
  }
}

@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .home-summary-row {
    grid-template-columns: 1fr;
  }

  .nw-hero-value {
    font-size: var(--text-lg) !important;
  }

  .nw-hero-banner {
    padding: var(--space-3) var(--space-4);
  }

  .main-content {
    padding: var(--space-3);
  }

  .asset-split-card {
    padding: var(--space-3) var(--space-4);
  }
}

/* ============================================================
   ASSET SPLIT HERO ROW
   ============================================================ */
.asset-split-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.asset-split-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  position: relative;
  overflow: hidden;
}

.asset-split-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.asset-split-liquid::after  { background: var(--color-primary); }
.asset-split-home::after    { background: var(--color-gold); }
.asset-split-retirement::after { background: var(--color-purple); }

.asset-split-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.asset-split-liquid .asset-split-icon {
  background: var(--color-primary-highlight);
  color: var(--color-primary);
}

.asset-split-home .asset-split-icon {
  background: var(--color-gold-highlight);
  color: var(--color-gold);
}

.asset-split-retirement .asset-split-icon {
  background: var(--color-purple-highlight);
  color: var(--color-purple);
}

.asset-split-content {
  min-width: 0;
  flex: 1;
}

.asset-split-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
}

.asset-split-value {
  font-size: clamp(1.3rem, 0.9rem + 1.8vw, 2rem);
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}

.asset-split-sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 900px) {
  .asset-split-row {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   MORTGAGE SECTION
   ============================================================ */
.mortgage-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
  overflow: hidden;
}

.mortgage-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-divider);
}

/* Mortgage KPI row */
.mortgage-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: var(--space-1);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-divider);
}

.mortgage-kpi {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-surface-offset);
}

.mortgage-kpi-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
}

.mortgage-kpi-value {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

/* Equity bar */
.mortgage-equity-bar-wrap {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-divider);
}

.mortgage-equity-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.mortgage-equity-bar {
  height: 8px;
  background: var(--color-error-highlight);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.mortgage-equity-bar-fill {
  height: 100%;
  background: var(--color-success);
  border-radius: var(--radius-full);
  transition: width 600ms cubic-bezier(0.16,1,0.3,1);
}

/* Two-column analysis grid */
.mortgage-analysis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.mortgage-panel {
  padding: var(--space-5);
}

.mortgage-panel:first-child {
  border-right: 1px solid var(--color-divider);
}

.mortgage-panel-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-4);
}

/* mortgage-analysis-grid responsive handled in main RESPONSIVE block */

/* Refinance rates row */
.refi-rate-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-offset);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.refi-rate-item {
  text-align: center;
  flex: 1;
  min-width: 60px;
}

.refi-rate-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: 2px;
}

.refi-rate-value {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

.refi-rate-value.positive {
  color: var(--color-success);
}

.refi-rate-arrow {
  color: var(--color-text-faint);
  font-size: var(--text-base);
  flex-shrink: 0;
}

/* Refinance option cards */
.refi-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.refi-option {
  background: var(--color-surface-offset);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  border: 1px solid var(--color-border);
}

.refi-option-header {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-divider);
}

.refi-stat {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
  font-variant-numeric: tabular-nums;
}

.refi-stat span:last-child {
  font-weight: 600;
  color: var(--color-text);
}

.refi-recommendation {
  font-size: var(--text-xs);
  font-weight: 700;
  margin-top: var(--space-3);
  padding: 3px var(--space-2);
  border-radius: var(--radius-sm);
  text-align: center;
  background: var(--color-surface-dynamic);
}

/* Sale Proceeds table */
.sale-proceeds-table {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.sale-proceeds-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-xs);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-divider);
  font-variant-numeric: tabular-nums;
}

.sale-proceeds-row:last-child {
  border-bottom: none;
}

.sale-proceeds-label {
  color: var(--color-text-muted);
}

.sale-proceeds-amount {
  font-weight: 600;
  color: var(--color-text);
}

.sale-proceeds-amount.negative {
  color: var(--color-error);
}

.sale-proceeds-amount.positive {
  color: var(--color-success);
}

.sale-proceeds-total {
  padding-top: var(--space-3);
  margin-top: var(--space-2);
  border-top: 2px solid var(--color-border) !important;
}

.sale-proceeds-total .sale-proceeds-label {
  font-weight: 700;
  color: var(--color-text);
  font-size: var(--text-sm);
}

.sale-proceeds-total .sale-proceeds-amount {
  font-size: var(--text-sm);
}

/* positive / negative helpers used in refi stats */
.positive { color: var(--color-success) !important; }
.negative { color: var(--color-error) !important; }

/* ============================================================
   ZILLOW SOURCE ROW
   ============================================================ */

.zillow-source-row {
  margin-bottom: var(--space-4);
}

.zillow-source {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: oklch(0.35 0.04 220 / 0.3);
  border: 1px solid oklch(0.45 0.06 220 / 0.3);
  border-radius: var(--radius-md);
}

.zillow-badge {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text);
}

.zillow-badge strong {
  color: var(--color-success);
}

.zillow-meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-left: var(--space-2);
}

.zillow-updated {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

[data-theme="light"] .zillow-source {
  background: oklch(0.92 0.02 220 / 0.3);
  border-color: oklch(0.85 0.03 220 / 0.3);
}

/* ============================================================
   INTERACTIVE ELEMENTS (KPI Click, Chart Click)
   ============================================================ */

.kpi-clickable {
  cursor: pointer;
  transition: border-color 180ms cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.kpi-clickable:hover {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary);
}

.kpi-clickable.kpi-active {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary);
}

#allocation-chart {
  cursor: pointer;
}

/* ============================================================
   HOME VIEW (Mortgage / Zillow Tab)
   ============================================================ */
.home-summary-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.home-summary-tile {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  text-align: center;
}

.home-summary-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.home-summary-value {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.home-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.home-details-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.home-details-card-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-divider);
}

.home-detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-divider);
}

.home-detail-item:last-child {
  border-bottom: none;
}

.home-detail-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.home-detail-value {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

.home-equity-bar-wrap {
  margin-bottom: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.home-equity-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.home-equity-bar {
  height: 10px;
  background: var(--color-error-highlight);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.home-equity-bar-fill {
  height: 100%;
  background: var(--color-success);
  border-radius: var(--radius-full);
  transition: width 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

.home-zillow-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
}

.home-zillow-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.home-zillow-details {
  display: flex;
  gap: var(--space-6);
  flex-wrap: wrap;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.home-zillow-details span {
  font-weight: 600;
  color: var(--color-text);
}

/* home-details-grid responsive handled in main RESPONSIVE block */

/* home-summary-row 480px responsive handled in main RESPONSIVE block */
