/* =========================================================================
   MyAutoBudget – Modern fintech dark-theme layout
   ========================================================================= */

:root {
  /* Surface palette */
  --bg:        #07090f;
  --bg-elev:   #0c0f18;
  --panel:     #111520;
  --panel-2:   #171c2a;
  --panel-3:   #1d2335;

  /* Borders */
  --border:    rgba(255, 255, 255, 0.06);
  --border-2:  rgba(255, 255, 255, 0.10);

  /* Ink */
  --ink:       #eaecf5;
  --ink-2:     #b0b7ce;
  --ink-3:     #7a82a0;
  --muted:     #555e78;

  /* Accents */
  --accent:    #8b6cff;
  --accent-glow: rgba(139, 108, 255, 0.35);
  --accent-subtle: rgba(139, 108, 255, 0.10);
  --teal:      #34d4b0;
  --teal-glow: rgba(52, 212, 176, 0.25);

  /* Semantic */
  --pos:       #3dd68c;
  --pos-bg:    rgba(61, 214, 140, 0.08);
  --neg:       #f06060;
  --neg-bg:    rgba(240, 96, 96, 0.08);
  --warn:      #f0b840;
  --warn-bg:   rgba(240, 184, 64, 0.08);

  /* Effects */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow:    0 4px 24px rgba(0, 0, 0, 0.35), 0 1px 4px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
  --radius:    14px;
  --radius-sm: 10px;
  --radius-xs: 6px;

  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Layout */
  --sidebar-w: 228px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  font-family: "Inter", -apple-system, "Segoe UI", system-ui, sans-serif;
  font-feature-settings: "cv11", "ss01";
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.55;
  font-size: 0.9375rem;
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

/* =====================================================================
   SIDEBAR – persistent left navigation
   ===================================================================== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-elev);
  border-right: 1px solid var(--border-2);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
}

.sidebar-header {
  padding: 1.25rem 1.25rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-logo {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #6347e0);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 4px 16px var(--accent-glow);
  flex-shrink: 0;
}

.sidebar-logo .icon { width: 18px; height: 18px; }

.sidebar-brand-text {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0.5rem 0.75rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  color: var(--ink-3);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s ease;
  text-decoration: none;
  position: relative;
  white-space: nowrap;
}

.sidebar-link .icon { flex-shrink: 0; }

.sidebar-link:hover {
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-link.active {
  color: #fff;
  background: rgba(139, 108, 255, 0.12);
}

.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 0.5rem 1rem;
}

.sidebar-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.82rem;
  color: var(--ink-3);
}

.sidebar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--panel-2);
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--border-2);
  flex-shrink: 0;
  text-transform: uppercase;
}


/* =====================================================================
   MAIN CONTENT AREA
   ===================================================================== */
.main {
  --active-sidebar-w: 0px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  background:
    radial-gradient(ellipse 60% 45% at 15% -5%, rgba(139, 108, 255, 0.07), transparent),
    radial-gradient(ellipse 50% 40% at 85%  80%, rgba(52, 212, 176, 0.04), transparent),
    var(--bg);
}

.main.has-sidebar {
  --active-sidebar-w: var(--sidebar-w);
  margin-left: var(--sidebar-w);
}

/* When a page-side image is present, compute its width and offset content */
.main:has(.page-side) {
  --side-img-w: clamp(250px, calc(100vw - var(--active-sidebar-w) - 700px), 600px);
}

.main:has(.page-side) > .topbar,
.main:has(.page-side) > .content,
.main:has(.page-side) > .site-footer {
  margin-right: var(--side-img-w);
}


/* =====================================================================
   TOPBAR
   ===================================================================== */
.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 2rem;
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(7, 9, 15, 0.78);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}

.topbar-title h1 {
  font-size: 1.15rem;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.topbar-subtitle {
  font-size: 0.8rem;
  color: var(--ink-3);
  margin: 0.15rem 0 0;
  font-weight: 400;
}

.nav-spacer { flex: 1; }

/* Brand (shown when no sidebar, e.g. pre-onboarding) */
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #6347e0);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 4px 16px var(--accent-glow);
}

/* Sidebar toggle – only visible on mobile */
.sidebar-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 6px;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  box-shadow: none;
  transition: background 0.15s;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
  filter: none;
  transform: none;
}

.sidebar-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--ink-2);
  border-radius: 1px;
  transition: all 0.25s var(--ease-out);
}

.nav-user {
  font-size: 0.82rem;
  color: var(--ink-3);
  margin-right: 0.5rem;
}

/* =====================================================================
   CONTENT BODY
   ===================================================================== */
.content {
  flex: 1;
  padding: 1.75rem 2rem 4rem;
}


/* =====================================================================
   PAGE-SIDE IMAGE – fixed right-edge pane
   Scales from 100px to 600px based on available space.
   Hidden when viewport can't give the image at least 100px.
   ===================================================================== */
.page-side {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--side-img-w, 300px);
  z-index: 1;
  background-size: cover;
  background-position: center;
}

/* Darkening overlay for legibility */
.page-side::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(270deg, rgba(7,9,15,0) 60%, rgba(7,9,15,0.55) 100%),
    linear-gradient(180deg, rgba(7,9,15,0.30) 0%, rgba(7,9,15,0.05) 35%, rgba(7,9,15,0.55) 100%);
  pointer-events: none;
}

/* Left border line (matches topbar/sidebar border style) */
.page-side::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 1px;
  z-index: 1;
  background: var(--border-2);
  pointer-events: none;
}

.page-side-label {
  position: absolute;
  bottom: 1.5rem;
  left: 1.25rem;
  right: 1.25rem;
  z-index: 2;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.55);
}

/* Insights overlay floating over the page-side image */
.insights-panel {
  position: absolute;
  top: 1.25rem;
  left: 1.25rem;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.insights-panel::-webkit-scrollbar { width: 4px; }
.insights-panel::-webkit-scrollbar-track { background: transparent; }
.insights-panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.insight-card {
  background: rgba(7, 9, 15, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  color: rgba(255, 255, 255, 0.88);
  flex-shrink: 0;
  opacity: 0;
  transform: translateY(8px);
  animation: insightFadeIn 0.4s ease forwards;
}

.insight-card:nth-child(1) { animation-delay: 0.1s; }
.insight-card:nth-child(2) { animation-delay: 0.22s; }
.insight-card:nth-child(3) { animation-delay: 0.34s; }
.insight-card:nth-child(4) { animation-delay: 0.46s; }
.insight-card:nth-child(5) { animation-delay: 0.58s; }
.insight-card:nth-child(6) { animation-delay: 0.70s; }

@keyframes insightFadeIn {
  to { opacity: 1; transform: translateY(0); }
}

.insight-card-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.25rem;
}

.insight-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.85;
}

.insight-headline {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.insight-detail {
  font-size: 0.7rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
}

/* Tone accent: left border color */
.insight-card[data-tone="positive"] { border-left: 2px solid #34d399; }
.insight-card[data-tone="caution"]  { border-left: 2px solid #fbbf24; }
.insight-card[data-tone="negative"] { border-left: 2px solid #f87171; }
.insight-card[data-tone="neutral"]  { border-left: 2px solid rgba(255,255,255,0.25); }

/* Tone icon colors */
.insight-card[data-tone="positive"] .insight-icon { color: #34d399; }
.insight-card[data-tone="caution"]  .insight-icon { color: #fbbf24; }
.insight-card[data-tone="negative"] .insight-icon { color: #f87171; }
.insight-card[data-tone="neutral"]  .insight-icon { color: rgba(255,255,255,0.5); }

.insights-heading {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 0.15rem;
  flex-shrink: 0;
}

/* Quick-links section – flows inside .insights-panel, pushed to bottom */
.quick-links-section {
  margin-top: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.quick-links-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

/* Each tile mirrors .insight-card styling */
.quick-link-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 0.5rem;
  background: rgba(7, 9, 15, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.88);
  transition: background 0.15s, border-color 0.15s;
  cursor: pointer;
}

.quick-link-tile:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.quick-link-icon {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  object-fit: contain;
  flex-shrink: 0;
}

.quick-link-fallback {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.5rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.quick-link-name {
  font-size: 0.55rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.quick-link-name {
  font-size: 0.6rem;
  line-height: 1.2;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}


/* =====================================================================
   TYPOGRAPHY
   ===================================================================== */
h1 {
  font-size: 1.65rem;
  margin: 0 0 0.2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

h2 {
  font-size: 1.05rem;
  margin: 0 0 0.65rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 0.92rem;
  margin: 0 0 0.45rem;
  font-weight: 600;
}

.subtitle {
  color: var(--ink-3);
  margin: 0 0 1.5rem;
  font-size: 0.88rem;
}

.section-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 2rem 0 0.85rem;
}

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


/* =====================================================================
   CARDS
   ===================================================================== */
.card {
  position: relative;
  background: linear-gradient(170deg, rgba(17, 21, 32, 0.92), rgba(23, 28, 42, 0.88));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow);
}

/* Card accent top line – opt-in only */
.card--accent::before {
  content: "";
  position: absolute;
  top: 0; left: 1.5rem; right: 1.5rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(139,108,255,0.30) 30%, rgba(52,212,176,0.25) 70%, transparent);
}

/* Split card (onboarding form cards) */
.split-card {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 1.5rem;
  align-items: stretch;
  padding: 1.35rem;
  overflow: hidden;
}

.split-card > .split-image {
  position: relative;
  min-height: 260px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background-size: cover;
  background-position: center;
  box-shadow: 0 12px 32px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.04) inset;
}

.split-card > .split-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(7,9,15,0) 40%, rgba(7,9,15,0.6) 100%);
}

.split-card > .split-body { min-width: 0; }

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.card-header .icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent-subtle);
  color: var(--accent);
  flex-shrink: 0;
}

.card-header .icon--teal {
  background: rgba(52, 212, 176, 0.10);
  color: var(--teal);
}

.card-header .icon--pos {
  background: var(--pos-bg);
  color: var(--pos);
}

.card-header .icon--neg {
  background: var(--neg-bg);
  color: var(--neg);
}

.card-header h2 { margin: 0; }
.card-header p { margin: 0.1rem 0 0; color: var(--ink-3); font-size: 0.82rem; }

/* Collapsible card via <details> */
details.card > summary { list-style: none; cursor: pointer; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary .details-chevron { transition: transform 0.2s var(--ease-out); }
details.card[open] > summary .details-chevron { transform: rotate(180deg); }


/* =====================================================================
   HEADLINE CARD – the big transfer amount on the dashboard
   ===================================================================== */
.headline-card {
  position: relative;
  background:
    linear-gradient(135deg, rgba(139,108,255,0.15), rgba(52,212,176,0.06)),
    linear-gradient(170deg, rgba(17,21,32,0.95), rgba(23,28,42,0.90));
  border: 1px solid rgba(139,108,255,0.25);
  border-radius: var(--radius);
  padding: 1.75rem 2rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.headline-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--teal));
}

.headline-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  margin-bottom: 0.75rem;
}

.headline-label .icon {
  width: 16px;
  height: 16px;
}

.headline-amount {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 0 0 0.75rem;
  background: linear-gradient(135deg, #fff 30%, var(--teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.headline-detail {
  color: var(--ink-3);
  font-size: 0.85rem;
  line-height: 1.55;
}

.headline-detail a { color: var(--accent); }
.headline-detail a:hover { text-decoration: underline; }


/* =====================================================================
   GRID HELPERS
   ===================================================================== */
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }


/* =====================================================================
   CTA ROW
   ===================================================================== */
.cta-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.cta-card {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-2);
  background: var(--panel);
  transition: all 0.2s var(--ease-out);
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
}

.cta-card:hover {
  border-color: rgba(139, 108, 255, 0.30);
  background: var(--panel-2);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.cta-card .cta-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent-subtle);
  color: var(--accent);
  flex-shrink: 0;
}

.cta-card .cta-text {
  font-weight: 600;
  font-size: 0.9rem;
}

.cta-card .cta-sub {
  font-size: 0.78rem;
  color: var(--ink-3);
  margin-top: 0.1rem;
}


/* =====================================================================
   HERO (onboarding)
   ===================================================================== */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border-2);
  padding: 2.5rem 2.25rem;
  margin-bottom: 1.5rem;
  background:
    linear-gradient(135deg, rgba(139,108,255,0.22) 0%, rgba(30,27,75,0.40) 50%, rgba(7,9,15,0.70) 100%),
    url("/static/img/calculator_side.jpg");
  background-size: cover;
  background-position: center right;
  box-shadow: var(--shadow-lg);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 80% 20%, rgba(139,108,255,0.25), transparent 45%),
    radial-gradient(circle at 20% 80%, rgba(52,212,176,0.10), transparent 40%);
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(-45deg, rgba(255,255,255,0.015) 0, rgba(255,255,255,0.015) 1px, transparent 1px, transparent 16px);
  pointer-events: none;
}

.hero > * { position: relative; z-index: 1; }
.hero > .hero-text { max-width: 52ch; }

.hero h1 {
  font-size: 2rem;
  margin: 0 0 0.5rem;
  background: linear-gradient(135deg, #fff, var(--ink-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p { color: var(--ink-2); max-width: 52ch; margin: 0; }

.hero-steps {
  display: flex;
  gap: 0.45rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.hero-step {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-3);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
}

.hero-step.done {
  color: var(--pos);
  border-color: rgba(61,214,140,0.30);
  background: var(--pos-bg);
}


/* =====================================================================
   FORMS & BUTTONS
   ===================================================================== */
form.stack { display: grid; gap: 0.75rem; max-width: 560px; }

label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  display: block;
  margin-bottom: 0.3rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

input, select {
  font: inherit;
  font-size: 0.875rem;
  color: var(--ink);
  background: var(--bg-elev);
  border: 1px solid rgba(255,255,255,0.07);
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius-xs);
  outline: none;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

input::placeholder { color: var(--muted); }
input:hover, select:hover { border-color: rgba(255,255,255,0.12); background: rgba(12,15,24,0.9); }

input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle), 0 0 16px rgba(139,108,255,0.08);
  background: rgba(12,15,24,1);
}

input[type="file"] { padding: 0.45rem; }

button, .btn {
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(180deg, var(--accent), #6d4de0);
  border: none;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2), 0 4px 14px rgba(139,108,255,0.20), 0 0 0 1px rgba(255,255,255,0.06) inset;
  transition: all 0.2s var(--ease-out);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

button:hover, .btn:hover {
  filter: brightness(1.1);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2), 0 6px 24px rgba(139,108,255,0.30), 0 0 0 1px rgba(255,255,255,0.08) inset;
  transform: translateY(-1px);
}

button:active, .btn:active { transform: translateY(0); filter: brightness(0.95); }

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: none;
  color: var(--ink-3);
}

.btn-ghost:hover {
  color: var(--ink);
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.12);
  box-shadow: none;
  filter: none;
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(180deg, #e84040, #b92020);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2), 0 4px 16px rgba(232,64,64,0.20);
}

.btn-danger-outline {
  background: transparent;
  color: #e84040;
  border: 1px solid #e84040;
  cursor: pointer;
  padding: 0.55rem 1.2rem;
  border-radius: 0.5rem;
  font-size: 0.92rem;
  font-weight: 500;
}

.btn-danger-outline:hover {
  background: rgba(232, 64, 64, 0.08);
}

.card-danger {
  border-color: rgba(232, 64, 64, 0.25);
}

.card-title-danger {
  color: #e84040;
}

.delete-account-details summary {
  list-style: none;
}

.delete-account-details summary::-webkit-details-marker {
  display: none;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink-3);
  font-size: 0.88rem;
}


/* =====================================================================
   STAT TILES
   ===================================================================== */
.stat {
  position: relative;
  padding: 1rem 1.15rem;
  background: var(--panel);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}

.stat::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--teal));
  opacity: 0.4;
}

.stat:hover { border-color: rgba(255,255,255,0.10); transform: translateY(-2px); }

.stat .label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.stat .value { font-size: 1.4rem; font-weight: 700; margin-top: 0.35rem; letter-spacing: -0.02em; }
.stat .value.pos { color: var(--pos); }
.stat .value.neg { color: var(--neg); }

/* Semantic stat variants */
.stat--pos::before { background: var(--pos); opacity: 0.5; }
.stat--neg::before { background: var(--neg); opacity: 0.5; }
.stat--teal::before { background: var(--teal); opacity: 0.5; }


/* =====================================================================
   TABLES
   ===================================================================== */
.table-wrap {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

table { width: 100%; border-collapse: collapse; }

th, td {
  text-align: left;
  padding: 0.6rem 0.85rem;
  font-size: 0.875rem;
}

thead th {
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  font-weight: 500;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-2);
}

tbody td { border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: rgba(255, 255, 255, 0.025); }

/* Alternating row tint */
tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.012); }
tbody tr:nth-child(even):hover { background: rgba(255, 255, 255, 0.035); }

.pos { color: var(--pos); }
.neg { color: var(--neg); }
.muted { color: var(--ink-3); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--ink-3);
}

.pill.debt   { color: #fca5a5; border-color: rgba(248,113,113,0.25); background: rgba(248,113,113,0.07); }
.pill.float  { color: #93c5fd; border-color: rgba(147,197,253,0.25); background: rgba(147,197,253,0.07); }
.pill.high_yield { color: #86efac; border-color: rgba(134,239,172,0.25); background: rgba(134,239,172,0.07); }
.pill.asset  { color: #fcd34d; border-color: rgba(252,211,77,0.25); background: rgba(252,211,77,0.07); }


/* =====================================================================
   PROGRESS BAR
   ===================================================================== */
.progress-bar {
  height: 6px;
  background: var(--panel-3);
  border-radius: 3px;
  overflow: hidden;
  flex: 1;
  min-width: 60px;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.8s var(--ease-out);
  min-width: 2px;
}

.progress-bar-fill.high { background: var(--pos); }
.progress-bar-fill.mid  { background: var(--teal); }

.progress-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.progress-pct {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-3);
  min-width: 2.5rem;
  text-align: right;
}


/* =====================================================================
   CALLOUT & MISC
   ===================================================================== */
.divider { height: 1px; background: var(--border-2); margin: 1.25rem 0; }

.callout {
  border-left: 3px solid var(--accent);
  background: var(--accent-subtle);
  padding: 0.85rem 1.15rem;
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  color: var(--ink-2);
  font-size: 0.88rem;
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

.callout.pos { border-color: var(--pos); background: var(--pos-bg); }
.callout.neg { border-color: var(--neg); background: var(--neg-bg); }

.empty { text-align: center; color: var(--muted); padding: 1.5rem 1rem; font-size: 0.88rem; }
.inline-form { display: inline; }
.row-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1rem; }


/* =====================================================================
   ICONS
   ===================================================================== */
svg.icon {
  width: 18px; height: 18px;
  stroke: currentColor; fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}
svg.icon.lg { width: 22px; height: 22px; }


/* =====================================================================
   DETAILS / SUMMARY
   ===================================================================== */
details { border-top: 1px solid var(--border); padding-top: 1rem; }

details > summary {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ink-2);
  font-size: 0.88rem;
  padding: 0.35rem 0;
  transition: color 0.15s;
  list-style: none;
}

details > summary::-webkit-details-marker { display: none; }
details > summary::marker { content: ""; }

details > summary::before {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  border-radius: 6px;
  background: var(--accent-subtle);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
}

details[open] > summary::before { content: "\2212"; }
details > summary:hover { color: var(--ink); }


/* =====================================================================
   SUB-TAB NAVIGATION (Manage page)
   ===================================================================== */
.tab-bar {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }

.tab-bar button {
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--ink-3);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.45rem 0.85rem;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  transition: all 0.2s var(--ease-out);
  cursor: pointer;
}

.tab-bar button:hover { color: var(--ink); background: rgba(255,255,255,0.04); filter: none; transform: none; }
.tab-bar button.active { color: #fff; background: var(--accent); box-shadow: 0 2px 10px var(--accent-glow); filter: none; transform: none; }

.tab-panel { display: none; animation: tabFadeIn 0.25s var(--ease-out); }
.tab-panel.active { display: block; }

@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* =====================================================================
   INLINE EDIT ROWS (manage page forms)
   ===================================================================== */
.edit-row {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-xs);
  margin-bottom: 0.35rem;
  transition: background 0.12s;
}

.edit-row:nth-child(odd) {
  background: rgba(255, 255, 255, 0.015);
}

.edit-row:hover {
  background: rgba(255, 255, 255, 0.03);
}


/* =====================================================================
   DAY SCHEDULE (dashboard day-by-day)
   ===================================================================== */
.day-row { transition: background 0.12s; }
.day-row.is-today {
  background: rgba(139, 108, 255, 0.06) !important;
  border-left: 3px solid var(--accent);
}

.day-row.is-today td:first-child { padding-left: calc(0.85rem - 3px); }


/* =====================================================================
   CHART CARD
   ===================================================================== */
.chart-card canvas {
  margin-top: 0.5rem;
}


/* =====================================================================
   HINT TOOLTIP – floating contextual help on hover
   ===================================================================== */
.hint-tooltip {
  position: fixed;
  z-index: 9999;
  max-width: 280px;
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
  background: rgba(17, 21, 32, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-2);
  box-shadow: var(--shadow-lg);
  color: var(--ink-2);
  font-size: 0.78rem;
  line-height: 1.5;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.hint-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.hint-tooltip::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(90deg, var(--accent), var(--teal));
  opacity: 0.6;
}


/* =====================================================================
   SCROLLBAR & SELECTION
   ===================================================================== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.14); }
::selection { background: rgba(139,108,255,0.30); color: #fff; }


/* =====================================================================
   ANIMATIONS
   ===================================================================== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.animate-in {
  animation: fadeInUp 0.4s var(--ease-out) both;
}

.animate-in:nth-child(2) { animation-delay: 0.05s; }
.animate-in:nth-child(3) { animation-delay: 0.10s; }
.animate-in:nth-child(4) { animation-delay: 0.15s; }
.animate-in:nth-child(5) { animation-delay: 0.20s; }
.animate-in:nth-child(6) { animation-delay: 0.25s; }
.animate-in:nth-child(7) { animation-delay: 0.30s; }
.animate-in:nth-child(8) { animation-delay: 0.35s; }


/* =====================================================================
   HIDE PAGE-SIDE IMAGE when viewport is too narrow
   With sidebar (228px) + content min (700px) + image min (250px) = 1178px
   ===================================================================== */
@media (max-width: 1200px) {
  .page-side { display: none; }
  .main:has(.page-side) > .topbar,
  .main:has(.page-side) > .content,
  .main:has(.page-side) > .site-footer { margin-right: 0; }
}


/* =====================================================================
   MOBILE LAYOUT  (< 769px)
   Sidebar becomes bottom tab bar
   ===================================================================== */
@media (max-width: 768px) {
  .sidebar {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 62px;
    flex-direction: row;
    border-right: none;
    border-top: 1px solid var(--border-2);
    background: rgba(12, 15, 24, 0.96);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    padding: 0;
  }

  .sidebar-header,
  .sidebar-footer,
  .sidebar-divider { display: none; }

  .sidebar-nav {
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    padding: 0 0.5rem;
    gap: 0;
  }

  .sidebar-link {
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.45rem 0.65rem;
    font-size: 0.62rem;
    text-align: center;
    border-radius: 8px;
  }

  .sidebar-link .icon { width: 20px; height: 20px; }

  .sidebar-link.active::before { display: none; }

  .main.has-sidebar {
    --active-sidebar-w: 0px;
    margin-left: 0;
    padding-bottom: 62px;
  }

  .page-side { display: none; }
  .main:has(.page-side) > .topbar,
  .main:has(.page-side) > .content,
  .main:has(.page-side) > .site-footer { margin-right: 0; }

  .topbar {
    padding: 0.75rem 1rem;
  }

  .topbar-title h1 { font-size: 1rem; }

  .content {
    padding: 1.25rem 1rem 3rem;
  }

  h1 { font-size: 1.35rem; }

  .headline-amount { font-size: 2rem; }
  .headline-card { padding: 1.25rem; }

  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }

  .stat .value { font-size: 1.2rem; }

  .split-card { grid-template-columns: 1fr; }
  .split-card > .split-image { min-height: 140px; }

  .tab-bar button { padding: 0.4rem 0.65rem; font-size: 0.78rem; }

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


/* =====================================================================
   TABLET TWEAKS (769px – 1024px)
   ===================================================================== */
@media (min-width: 769px) and (max-width: 1024px) {
  :root {
    --sidebar-w: 200px;
  }

  .content {
    padding: 1.5rem 1.5rem 3rem;
    max-width: 100%;
  }

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

  .sidebar-link {
    font-size: 0.82rem;
    padding: 0.55rem 0.65rem;
  }
}


/* =====================================================================
   WIDE SCREEN  (> 1400px)
   ===================================================================== */
@media (min-width: 1400px) {
  .content {
    padding-left: 2.5rem;
    padding-right: 2.5rem;
  }
}

/* =====================================================================
   WIZARD PROGRESS BAR
   ===================================================================== */
.wizard-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 1.5rem auto 2rem;
  max-width: 700px;
}
.wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  text-decoration: none;
  color: var(--muted);
  transition: color 0.2s;
  flex-shrink: 0;
}
.wizard-step.active { color: var(--accent); }
.wizard-step.done { color: var(--pos); }
.wizard-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  border: 2px solid var(--border-2);
  background: var(--panel);
  transition: all 0.2s;
}
.wizard-step.active .wizard-dot {
  border-color: var(--accent);
  background: var(--accent-subtle);
  color: var(--accent);
}
.wizard-step.done .wizard-dot {
  border-color: var(--pos);
  background: rgba(61, 214, 140, 0.1);
  color: var(--pos);
}
.wizard-dot .icon { width: 16px; height: 16px; }
.wizard-label { font-size: 0.75rem; font-weight: 500; }
.wizard-line {
  flex: 1;
  height: 2px;
  background: var(--border-2);
  min-width: 24px;
  max-width: 80px;
  margin: 0 0.25rem;
  margin-bottom: 1.4rem;
  transition: background 0.2s;
}
.wizard-line.done { background: var(--pos); }

/* ── Wizard navigation buttons ── */
.wizard-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--ink-2);
  border: 1px solid var(--border-2);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}
.btn-secondary:hover { background: var(--panel-3); }

/* ── Explanation definition list ── */
.explain-list { margin: 0.5rem 0 0; padding: 0; }
.explain-list dt {
  font-weight: 600;
  color: var(--ink);
  margin-top: 0.75rem;
  font-size: 0.9rem;
}
.explain-list dd {
  margin: 0.15rem 0 0 0;
  color: var(--ink-2);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* ── Sidebar logout button ── */
.sidebar-logout-btn {
  width: 100%;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--ink-3);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}
.sidebar-logout-btn:hover {
  background: var(--panel-2);
  color: var(--ink);
  border-color: var(--border-2);
}

/* --- Profile page --------------------------------------------------------- */
.profile-container {
  max-width: 560px;
}
.profile-form .form-group {
  margin-bottom: 1.25rem;
}
.profile-form .form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 0.4rem;
}
.profile-form .form-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--ink);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.15s;
}
.profile-form .form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.flash {
  border-radius: var(--radius-xs);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  line-height: 1.4;
}
.flash-success {
  background: rgba(61, 214, 140, 0.1);
  border: 1px solid var(--pos);
  color: #88ffbb;
}
.flash-error {
  background: rgba(240, 96, 96, 0.1);
  border: 1px solid var(--neg);
  color: #ff9999;
}
.sidebar-profile-link {
  text-decoration: none;
  color: inherit;
  transition: opacity 0.15s;
}
.sidebar-profile-link:hover {
  opacity: 0.8;
}

/* ── Site Footer ── */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 1.5rem 2rem;
  margin-top: auto;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}
.site-footer-links {
  display: flex;
  gap: 1.25rem;
}
.site-footer-links a {
  color: var(--ink-3);
  text-decoration: none;
  transition: color 0.15s;
}
.site-footer-links a:hover {
  color: var(--ink);
}

/* ── Legal document pages ── */
.legal-doc {
  max-width: 48rem;
  line-height: 1.75;
  color: var(--ink-2);
}
.legal-doc h2 {
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  font-size: 1.05rem;
  color: var(--ink);
}
.legal-doc p {
  margin-bottom: 1rem;
}
.legal-doc ul {
  margin: 0.5rem 0 1rem 1.5rem;
  padding: 0;
}
.legal-doc ul li {
  margin-bottom: 0.5rem;
}
.legal-doc a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.legal-doc a:hover {
  color: var(--ink);
}
.legal-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

/* ============================================================================
   LANGUAGE SWITCHER STYLES
   ============================================================================ */

.lang-switcher {
  position: relative;
  display: inline-block;
}

.lang-switcher-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  background-color: transparent;
  border: 1px solid var(--ink-3);
  color: var(--ink-3);
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-switcher-btn:hover {
  border-color: var(--ink-2);
  color: var(--ink-2);
}

.lang-switcher-btn .icon {
  width: 1rem;
  height: 1rem;
}

.lang-switcher-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  background-color: var(--panel-2);
  border: 1px solid var(--ink-3);
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 200;
  min-width: 180px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: all 0.2s ease;
}

.lang-switcher-dropdown.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.lang-option {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--ink-2);
  font-size: 0.85rem;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.lang-option:hover {
  background-color: rgba(var(--accent-rgb), 0.08);
}

.lang-option.active {
  color: var(--accent);
  font-weight: 600;
  background-color: rgba(var(--accent-rgb), 0.06);
}

.lang-option-en {
  font-size: 0.75rem;
  color: var(--ink-3);
}

.mkt-lang-btn {
  /* Inherits .lang-switcher-btn styles; override if needed */
}

/* ============================================================================
   RTL SUPPORT - Right-to-Left Layout Fixes
   ============================================================================ */

/* Sidebar positioning and borders */
[dir="rtl"] .sidebar {
  right: 0;
  left: auto;
  border-right: none;
  border-left: 1px solid var(--border-2);
}

/* Main content margin adjustment */
[dir="rtl"] .main.has-sidebar {
  margin-left: 0;
  margin-right: var(--sidebar-w);
}

/* Active sidebar link indicator */
[dir="rtl"] .sidebar-link.active::before {
  left: auto;
  right: 0;
  border-radius: 3px 0 0 3px;
}

/* Page-side panel: moves from right edge to left edge */
[dir="rtl"] .page-side {
  right: auto;
  left: 0;
}

/* Page-side border line: moves from left edge to right edge of the panel */
[dir="rtl"] .page-side::before {
  left: auto;
  right: 0;
}

/* Content offset: swap margin-right for margin-left when page-side is on the left */
[dir="rtl"] .main:has(.page-side) > .topbar,
[dir="rtl"] .main:has(.page-side) > .content,
[dir="rtl"] .main:has(.page-side) > .site-footer {
  margin-right: 0;
  margin-left: var(--side-img-w);
}

/* Table alignment */
[dir="rtl"] th,
[dir="rtl"] td {
  text-align: right;
}

/* Callout styling */
[dir="rtl"] .callout {
  border-left: none;
  border-right: 4px solid var(--accent);
  border-radius: 0 4px 4px 0;
}

/* Today indicator in calendar */
[dir="rtl"] .day-row.is-today {
  border-left: none;
  border-right: 3px solid var(--accent);
  padding-left: 0;
  padding-right: 1rem;
}

/* Insight card tone indicators */
[dir="rtl"] .insight-card[data-tone] {
  border-left: none;
  border-right: 4px solid;
}

/* Progress percentage text */
[dir="rtl"] .progress-pct {
  text-align: left;
}

/* Row action alignment in RTL */
[dir="rtl"] .row-actions {
  justify-content: flex-start;
}

/* ---------- RTL responsive overrides ---------- */

/* Hide page-side: zero out the LEFT margin (not right) in RTL */
@media (max-width: 1200px) {
  [dir="rtl"] .main:has(.page-side) > .topbar,
  [dir="rtl"] .main:has(.page-side) > .content,
  [dir="rtl"] .main:has(.page-side) > .site-footer { margin-left: 0; }
}

/* Mobile: sidebar is a bottom bar — reset RTL sidebar overrides */
@media (max-width: 768px) {
  [dir="rtl"] .sidebar {
    right: auto;
    left: 0;
    border-left: none;
    border-right: none;
  }

  [dir="rtl"] .main.has-sidebar {
    margin-right: 0;
  }

  [dir="rtl"] .main:has(.page-side) > .topbar,
  [dir="rtl"] .main:has(.page-side) > .content,
  [dir="rtl"] .main:has(.page-side) > .site-footer { margin-left: 0; }
}
