/* Global Font Import - mirrors landing/src/routes/__root.tsx */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Instrument+Serif:ital@0;1&display=swap");

/* ── Mando Design Tokens ───────────────────────────────────────────── */
:root {
  --color-mando-black:   #050505;
  --color-mando-surface: #121212;
  --color-mando-accent:  #00f2ff;
  --radius-executive:    24px;
  /* Accounts/cards KPI ribbons + dual-column chrome: half of executive for tighter corners. */
  --radius-accounts-chrome: calc(var(--radius-executive) * 0.5);
}

/* Centered operation forms (income, transfer, card payment, recurring) — full width up to a cap */
.operation-form-shell {
  width: 100%;
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
}

/* Merged amount + currency prefix (income, expense, transfer forms) */
.amount-currency-group .input-group-text.currency-prefix {
  background: var(--bs-body-bg);
  border-right: none;
  color: var(--bs-body-color);
  font-size: 15px;
  min-width: 3.25rem;
  justify-content: center;
  border-radius: var(--bs-border-radius) 0 0 var(--bs-border-radius);
}
.amount-currency-group .form-control {
  border-left: none;
  font-size: 15px;
  border-radius: 0 var(--bs-border-radius) var(--bs-border-radius) 0;
}
.amount-currency-group .form-control:focus {
  border-left: none;
  box-shadow: none;
}
.amount-currency-group:focus-within .input-group-text {
  border-color: var(--bs-primary);
}
.amount-currency-group:focus-within .form-control {
  border-color: var(--bs-primary);
  box-shadow: none;
}

/* Accounts + cards KPI ribbons and accounts dual-layout chrome (aside, institution cards). */
.accounts-chrome-surface {
  border: 1px solid var(--bs-border-color-translucent);
  border-radius: var(--radius-accounts-chrome);
  /* Light: solid white panels (not page gray / frosted glass). */
  background-color: var(--card);
}

/* Desktop shell: keep solid white; navbar keeps frosted strip separately. */
@media (min-width: 992px) {
  body.has-sidebar .accounts-chrome-surface {
    background-color: var(--card);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* Rows inside institution cards inherit the white chrome (list-group defaults to body bg). */
.account-institution-card.accounts-chrome-surface .list-group-item,
.account-institution-card.accounts-chrome-surface .account-row--merged {
  background-color: var(--card);
  border-color: var(--bs-border-color-translucent);
}

.dark .account-institution-card.accounts-chrome-surface .list-group-item,
[data-bs-theme="dark"] .account-institution-card.accounts-chrome-surface .list-group-item,
.dark .account-institution-card.accounts-chrome-surface .account-row--merged,
[data-bs-theme="dark"] .account-institution-card.accounts-chrome-surface .account-row--merged {
  background-color: transparent;
}

/* Dark: match fixed sidebar rail + dark navbar strip (not main content bg). */
.dark .accounts-chrome-surface,
[data-bs-theme="dark"] .accounts-chrome-surface {
  background: var(--sidebar-bg) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-color: var(--hairline-strong);
  box-shadow: none;
}

.card.account-institution-card.accounts-chrome-surface {
  --bs-card-bg: var(--card);
  background-color: var(--card);
  --bs-card-border-color: var(--bs-border-color-translucent);
  /* Win over later global `.card { border-radius: calc(var(--radius) + 4px); }` so left column matches aside chrome. */
  border-radius: var(--radius-accounts-chrome);
}

.dark .card.account-institution-card.accounts-chrome-surface,
[data-bs-theme="dark"] .card.account-institution-card.accounts-chrome-surface {
  --bs-card-bg: transparent;
  background-color: transparent;
}

/* Header row hover: readable on navy chrome (dark) vs tertiary (light). */
.dark .account-institution-card .account-group-toggle:hover,
[data-bs-theme="dark"] .account-institution-card .account-group-toggle:hover {
  background-color: rgba(255, 255, 255, 0.06) !important;
}

/* Reserve scrollbar gutter so clientWidth stays stable when pane height toggles overflow (settings HTMX). */
html {
  scrollbar-gutter: stable;
}

body {
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
}

/* --- Premium Form & Input Refinements --- */
.input-group {
  transition: all 0.2s ease;
}

.form-control, .form-select, .input-group-text {
  border-color: var(--bs-border-color);
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
  transition: all 0.2s ease;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .input-group-text {
  background-color: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.1);
}

/* Make native <select> popups follow the dark theme. `color-scheme: dark` is
   the primary cross-browser switch; explicit option rules are a safety net for
   Chromium where author colors still apply to the popup. */
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] select {
  color-scheme: dark;
}

[data-bs-theme="dark"] .form-select option {
  background-color: var(--color-surface, #161b22);
  color: var(--bs-body-color);
}

[data-bs-theme="dark"] .form-select option:checked {
  background-color: rgba(0, 85, 255, 0.35);
  color: #ffffff;
}

[data-bs-theme="dark"] .bg-light {
  background-color: rgba(255, 255, 255, 0.05) !important;
  color: var(--bs-body-color) !important;
}

[data-bs-theme="dark"] .input-group.border {
  border-color: rgba(255, 255, 255, 0.1) !important;
}

.form-control:focus {
  border-color: var(--color-success);
  box-shadow: 0 0 0 0.25rem rgba(0, 85, 255, 0.15);
}

/* Search bar specific integration */
.search-input-group {
  border: 1px solid var(--bs-border-color);
  background: var(--bs-body-tertiary-bg);
  transition: border-color 0.2s, box-shadow 0.2s;
}

[data-bs-theme="dark"] .search-input-group {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.search-input-group:focus-within {
  border-color: var(--color-success) !important;
  box-shadow: 0 0 0 0.25rem rgba(0, 85, 255, 0.15) !important;
}

/* Global Card Refinements */
.card {
  box-shadow: none !important;
  border: 0.1px solid var(--bs-border-color-translucent) !important;
}

.glass-card {
  background: rgba(255, 255, 255, 0.7) !important;
  backdrop-filter: blur(10px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(10px) saturate(180%) !important;
  border: 1px solid rgba(209, 213, 219, 0.3) !important;
}

[data-bs-theme="dark"] .glass-card {
  background: rgba(10, 37, 64, 0.55) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.card > .card-header:first-child {
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
}

.fs-blog-content {
  font-size: 1.125rem !important; /* Middle ground between fs-5 (1.25rem) and fs-6 (1rem) */
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fab-pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(0, 85, 255, 0.4);
  }
  70% {
    transform: scale(1.04);
    box-shadow: 0 0 0 12px rgba(0, 85, 255, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(0, 85, 255, 0);
  }
}

.fade-in {
  animation: fadeIn 0.4s ease-out forwards;
}

/* Accounts/cards KPI chrome: slide only — opacity fade shows page bg through white panels. */
.fade-in--chrome-pages {
  animation: fadeInChromePage 0.4s ease-out forwards;
}

@keyframes fadeInChromePage {
  from {
    transform: translateY(6px);
  }
  to {
    transform: translateY(0);
  }
}

/* Utility Classes */
.hover-lift {
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.hover-lift:hover {
  transform: translateY(-5px);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* Icon refinement */
.bi {
  vertical-align: -0.125em;
}

/* Icon Shapes for dashboard/analytics */
.icon-shape {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

.icon-shape-sm {
  width: 48px;
  height: 48px;
}

.icon-shape-md {
  width: 64px;
  height: 64px;
}

.icon-shape-lg {
  width: 80px;
  height: 80px;
}

/* --- Global Dashboard Theme Overrides --- */

:root {
  /* === Landing-aligned design tokens (OKLCH, copied from landing/src/styles.css) === */
  --radius: 0.5rem;

  --background: oklch(0.985 0.004 250);
  --foreground: oklch(0.18 0.04 255);

  --card: oklch(1 0 0);
  --card-foreground: oklch(0.18 0.04 255);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.18 0.04 255);

  --primary: oklch(0.18 0.04 255);              /* oxford navy */
  --primary-foreground: oklch(0.985 0.004 250);

  --secondary: oklch(0.955 0.008 250);
  --secondary-foreground: oklch(0.18 0.04 255);

  --muted: oklch(0.955 0.008 250);
  --muted-foreground: oklch(0.48 0.02 255);

  --accent: oklch(0.94 0.012 250);
  --accent-foreground: oklch(0.18 0.04 255);

  --destructive: oklch(0.55 0.22 27);
  --destructive-foreground: oklch(0.985 0.004 250);

  --border: oklch(0.18 0.04 255 / 0.08);
  --input: oklch(0.18 0.04 255 / 0.12);
  --ring: oklch(0.18 0.04 255);

  --surface: oklch(0.16 0.04 255);              /* oxford midnight (auth marketing rail) */
  --surface-foreground: oklch(0.97 0.005 250);
  --hairline: oklch(0.18 0.04 255 / 0.08);
  --hairline-strong: oklch(0.18 0.04 255 / 0.16);

  --gold: oklch(0.62 0.22 260);                 /* electric cobalt — single accent */

  /* sRGB triplets for Bootstrap helpers that need rgb() (subtle bgs, focus rings, etc.) */
  --primary-rgb: 26, 36, 64;
  --gold-rgb: 63, 93, 255;
  --destructive-rgb: 220, 53, 69;
  --foreground-rgb: 26, 36, 64;
  --background-rgb: 248, 249, 251;
  --muted-fg-rgb: 96, 106, 132;

  /* Legacy aliases used by older selectors elsewhere in this file */
  --color-primary: var(--primary);
  --color-secondary: var(--gold);
  --color-success: var(--gold);
  --color-danger: var(--destructive);
  --color-warning: oklch(0.78 0.16 80);
  --color-accent: var(--gold);
  --color-accent2: var(--gold);
  --bg-color: var(--background);
  --surface-color: var(--card);
  --text-main: var(--foreground);
  --border-color: var(--border);

  /* === Bootstrap variable mapping === */
  --bs-primary: var(--primary);
  --bs-primary-rgb: var(--primary-rgb);
  --bs-primary-text-emphasis: var(--primary);
  --bs-primary-bg-subtle: var(--accent);
  --bs-primary-border-subtle: var(--hairline-strong);

  --bs-info: var(--gold);
  --bs-info-rgb: var(--gold-rgb);

  --bs-secondary: var(--muted-foreground);

  --bs-success: var(--gold);
  --bs-success-rgb: var(--gold-rgb);

  --bs-danger: var(--destructive);
  --bs-danger-rgb: var(--destructive-rgb);

  --bs-warning: oklch(0.78 0.16 80);
  --bs-warning-rgb: 224, 168, 60;

  --bs-body-bg: var(--background);
  --bs-body-bg-rgb: var(--background-rgb);
  --bs-body-color: var(--foreground);
  --bs-body-color-rgb: var(--foreground-rgb);
  --bs-tertiary-bg: var(--secondary);
  --bs-border-color: var(--border);
  --bs-border-color-translucent: var(--border);
  --bs-emphasis-color: var(--primary);
  --bs-link-color: var(--gold);
  --bs-link-hover-color: var(--primary);
  --bs-border-radius: var(--radius);

  /* Sidebar variables (compact rail; nav + greeting) */
  --sidebar-width: 250px;
  --sidebar-collapsed-width: 85px;
  --sidebar-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --sidebar-bg: #0a1131;
  --sidebar-border: var(--bs-border-color);
}

/* --- App page header (sidebar-linked pages; flat on body surface) --- */
.app-page-header {
  background: transparent;
  color: var(--foreground);
  border: none;
  border-radius: 0;
  padding: 0 0 0.25rem;
  box-shadow: none;
}

.app-page-header__breadcrumb {
  color: var(--muted-foreground) !important;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.app-nav-breadcrumb__dot {
  line-height: 1;
}

.navbar__breadcrumb {
  font-weight: 500;
  letter-spacing: 0.02em;
}

.app-page-header__desc {
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--muted-foreground);
  max-width: 52rem;
}

.app-page-header__top:has(.analytics-page-header-toolbar) {
  justify-content: center !important;
}

.app-page-header__toolbar:has(.analytics-page-header-toolbar) {
  justify-content: center !important;
}

/* Year in Review: full viewport (undo sidebar shell body padding + main container max-width). */
body.yir-immersive main.container {
  max-width: none !important;
  width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding: 0 !important;
  min-height: 100vh;
  position: relative;
}

@media (min-width: 992px) {
  body.yir-immersive.has-sidebar,
  body.yir-immersive.has-sidebar.sidebar-collapsed {
    padding-left: 0 !important;
    padding-top: 0 !important;
  }

  body.yir-immersive.has-sidebar.demo-mode {
    padding-top: 0 !important;
  }
}

.app-page-header .btn-primary {
  box-shadow: 0 2px 10px color-mix(in oklch, var(--primary) 28%, transparent);
}

.app-page-header .app-page-header-input-group .input-group-text,
.app-page-header .app-page-header-input-group .form-select,
.app-page-header .app-page-header-input-group .form-control {
  background: var(--bs-tertiary-bg);
  border-color: var(--border);
  color: var(--foreground);
}

.app-page-header .app-page-header-input-group .form-select:focus,
.app-page-header .app-page-header-input-group .form-control:focus {
  border-color: color-mix(in oklch, var(--primary) 55%, var(--border));
  box-shadow: 0 0 0 0.2rem color-mix(in oklch, var(--primary) 22%, transparent);
}

.app-page-header .app-page-header-input-group .input-group-text {
  color: var(--muted-foreground);
}

/* Calendar toolbar: full-width search on xs */
.calendar-toolbar-search-group {
  min-width: 160px;
  max-width: 220px;
}

.app-page-header__toolbar:has(.calendar-toolbar-row) {
  flex: 1 1 0%;
  min-width: 0;
  justify-content: stretch;
}

.calendar-toolbar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 0.5rem;
  row-gap: 0.5rem;
  width: 100%;
  min-width: 0;
}

.calendar-toolbar-row__search {
  justify-self: start;
  width: 100%;
  max-width: 28rem;
}

.calendar-toolbar-row__month {
  justify-self: center;
}

.calendar-toolbar-row__spacer {
  min-width: 0;
}

@media (max-width: 575.98px) {
  .calendar-toolbar-search-group {
    min-width: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  .calendar-toolbar-row {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }

  .calendar-toolbar-row__month {
    justify-self: center;
    order: -1;
  }

  .calendar-toolbar-row__spacer {
    display: none;
  }
}

/* Pricing page: fluid price display */
.pricing-amount {
  font-size: clamp(1.4rem, 4vw, 1.75rem);
}

/* --- Sidebar Styles --- */
.sidebar {
  width: var(--sidebar-width);
  max-width: var(--sidebar-width);
  min-width: 0;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1040;
  background: var(--sidebar-bg) !important;
  color: var(--surface-foreground);
  border-right: 1px solid var(--hairline-strong);
  transition: var(--sidebar-transition);
  /* Allow profile Popper menu to extend past the rail; nav scroll stays in .sidebar-content */
  overflow-x: visible;
  overflow-y: hidden;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.18);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-sizing: border-box;
}

body.demo-mode .sidebar {
  top: 40px;
  height: calc(100vh - 40px);
}

/* Always-dark rail: light-on-surface tokens inside the sidebar (both app themes) */
.sidebar,
.sidebar .nav-link,
.sidebar .brand-text {
  color: var(--surface-foreground);
}

.sidebar .nav-link {
  padding: 0.6rem 0.85rem;
  margin: 0 0.5rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  border-left: 0;
  border-radius: 10px;
  font-weight: 500;
  font-size: 0.925rem;
  opacity: 1;
  color: color-mix(in oklch, var(--surface-foreground) 82%, transparent);
}

.sidebar .nav-link:hover {
  background: color-mix(in oklch, var(--surface-foreground) 7%, transparent);
  color: var(--surface-foreground);
}

.sidebar .nav-link.active {
  background: color-mix(in oklch, var(--gold) 14%, transparent);
  color: var(--gold);
  border-left: 0;
  border-radius: 10px;
  font-weight: 600;
}

.sidebar .nav-link.active i {
  color: var(--gold);
}

.sidebar .sidebar-toggle {
  background: color-mix(in oklch, var(--surface-foreground) 8%, transparent);
  border: 1px solid color-mix(in oklch, var(--surface-foreground) 14%, transparent);
  color: var(--surface-foreground) !important;
}

.sidebar .sidebar-toggle:hover {
  background: color-mix(in oklch, var(--surface-foreground) 14%, transparent);
}

.sidebar .sidebar-section-title {
  color: color-mix(in oklch, var(--surface-foreground) 55%, transparent);
}

/* Sidebar Brand Area */
.sidebar-header {
  min-width: 0;
}

.sidebar-brand {
  letter-spacing: -0.02em;
  transition: all 0.2s ease;
  min-width: 0;
}

.sidebar-brand:hover {
  opacity: 0.8;
}

/* Collapsed State */
.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .sidebar-section,
.sidebar.collapsed .sidebar-footer .nav-text,
.sidebar.collapsed .sidebar-brand span,
.sidebar.collapsed hr {
  display: none !important;
}

.sidebar.collapsed .sidebar-header {
  justify-content: center;
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin-left: -4px; /* Slight adjustment for the logo when collapsed */
}

.sidebar.collapsed .sidebar-brand {
  justify-content: center;
  width: 100%;
  padding: 0 !important;
}

/* Account type status dots */
.account-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #6c757d; /* Default Other */
  transition: all 0.2s ease;
}

.type-bank .account-dot, 
.type-cash .account-dot { background-color: #0055ff; }
.type-digital_wallet .account-dot { background-color: #0abde3; }
.type-investment .account-dot, 
.type-fixed_deposit .account-dot { background-color: #6610f2; }
.type-credit_card .account-dot { background-color: #fd7e14; }
.type-card .account-dot { background-color: #20c997; }

.sidebar.collapsed .account-item .account-dot {
  margin-right: 0 !important;
  width: 10px;
  height: 10px;
}

.sidebar.collapsed .nav-link i {
  margin: 0 !important;
  font-size: 1.3rem;
}

.sidebar-toggle {
  background: rgba(var(--bs-primary-rgb), 0.05);
  border: 1px solid rgba(var(--bs-primary-rgb), 0.1);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  cursor: pointer;
  color: var(--bs-primary) !important;
}

/* Match header collapse chevron and profile dropdown chevron (same hit target + glyph size). */
.sidebar .sidebar-toggle > i,
.sidebar-profile-ribbon > i {
  font-size: 1.125rem;
  line-height: 1;
}

.sidebar-toggle:hover {
  background: rgba(var(--bs-primary-rgb), 0.15);
  transform: scale(1.1);
}

.sidebar.collapsed .sidebar-toggle {
  position: fixed;
  left: calc(var(--sidebar-collapsed-width) - 14px);
  top: 28px;
  background: color-mix(in oklch, var(--surface-foreground) 10%, var(--surface));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  border: 1px solid color-mix(in oklch, var(--surface-foreground) 18%, transparent);
  color: var(--surface-foreground) !important;
  z-index: 1085; /* Above main / navbar stacking; fixed so rail does not gain horizontal overflow */
  width: 28px;
  height: 28px;
}

body.demo-mode.has-sidebar.sidebar-collapsed .sidebar-toggle {
  top: 68px; /* 40px demo banner + header alignment with prior 28px rail */
}

.sidebar.collapsed .sidebar-toggle i {
  display: inline-block;
}

.sidebar.collapsed .sidebar-header {
  justify-content: center;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.sidebar.collapsed .nav-link {
  justify-content: center;
  padding: 0.65rem 0 !important;
  margin: 0.15rem 0.45rem !important;
  border-radius: 10px;
}

.sidebar.collapsed .sidebar-content {
  padding-left: 0 !important;
  padding-right: 0 !important;
  overflow-x: hidden !important;
}

/* Flex child must shrink so .sidebar-content keeps its own vertical scroll without expanding #sidebar */
.sidebar > .sidebar-content {
  min-height: 0;
}

.sidebar.collapsed .collapse {
  display: none !important;
}

.sidebar .nav-link i {
  font-size: 1.15rem;
  transition: transform 0.2s ease;
  width: 20px;
  display: inline-block;
  text-align: center;
}

/* Sidebar Divider */
.sidebar hr {
  margin: 1.5rem 0 1rem 0 !important;
  opacity: 0.45;
  border-top: 1px solid color-mix(in oklch, var(--surface-foreground) 14%, transparent);
}

/* Sidebar Sections (Accounts) */
.sidebar-section {
  transition: opacity 0.2s ease;
}

.sidebar.collapsed .sidebar-section {
  opacity: 0;
  pointer-events: none;
  height: 0;
  margin: 0 !important;
  overflow: hidden;
}

.sidebar-section {
  margin-top: 0.5rem;
}

.sidebar-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--bs-secondary-color);
  opacity: 0.6;
}

.sidebar .nav-link.account-item {
  color: color-mix(in oklch, var(--surface-foreground) 78%, transparent);
  transition: all 0.2s ease;
  padding-left: 1rem;
  /* Extra space before the sidebar border so balances do not sit flush on the divider */
  padding-right: 2rem;
  flex-direction: row;
  flex-wrap: nowrap;
}

.sidebar .nav-link.account-item:hover {
  background: color-mix(in oklch, var(--surface-foreground) 8%, transparent) !important;
  color: var(--surface-foreground) !important;
}

.account-name {
  flex: 1;
  min-width: 0;
  font-weight: 500;
}

/* Sidebar accounts: one line (name + balance); name truncates when space is tight. */
.sidebar .sidebar-account-name-group {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
}

.account-balance {
  white-space: nowrap;
  flex-shrink: 0;
  font-family: var(--bs-font-monospace);
  font-weight: 600;
}

.sidebar .nav-link.account-item .account-balance {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.sidebar-section .nav-link.small .text-primary {
  border-top: 1px solid rgba(var(--bs-primary-rgb), 0.1);
  padding-top: 0.5rem;
  margin-top: 0.25rem;
  width: 100%;
}
.sidebar-footer {
  padding: 0.85rem 0 1rem;
  margin-top: 0.35rem;
  border-top: 1px solid color-mix(in oklch, var(--surface-foreground) 14%, transparent);
  background: transparent;
  box-shadow: none;
}

/* Muted line uses Bootstrap's body-secondary; on the dark rail that reads as mud-on-navy in light app theme. */
.sidebar-footer .text-body-secondary {
  color: color-mix(in oklch, var(--surface-foreground) 72%, transparent) !important;
}

.sidebar-profile-trigger.no-arrow.dropdown-toggle::after {
  display: none;
}

.sidebar-profile-trigger {
  border-left: 0;
  border-radius: 10px;
  opacity: 0.9;
}

.sidebar-footer .sidebar-profile-trigger {
  opacity: 1;
  gap: 0;
}

/* Narrow hit box ~5% vs full rail; collapsed rail keeps width: auto from rule below */
.sidebar:not(.collapsed) .sidebar-footer .sidebar-profile-trigger {
  width: 95% !important;
  max-width: 95%;
  margin-inline: auto;
  box-sizing: border-box;
}

.sidebar-footer .sidebar-profile-avatar {
  margin-inline-end: 10px;
  margin-inline-start: -15px;
}

.sidebar.collapsed .sidebar-profile-avatar {
  margin-inline-end: 0;
  margin-inline-start: 0;
}

.sidebar-profile-trigger:hover {
  background: color-mix(in oklch, var(--surface-foreground) 8%, transparent);
  opacity: 1;
}

.sidebar-profile-ribbon {
  box-sizing: border-box;
  width: 28px;
  height: 28px;
  margin-inline-start: 20px; /* 10px gap from text + 15px nudge toward rail edge */
  border-radius: 50%;
  background: color-mix(in oklch, var(--surface-foreground) 8%, transparent);
  border: 1px solid color-mix(in oklch, var(--surface-foreground) 14%, transparent);
  color: var(--surface-foreground) !important;
  line-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.sidebar-profile-ribbon i {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  margin: 0;
  transition: transform 0.2s ease;
}

.sidebar-profile-trigger[aria-expanded="true"] .sidebar-profile-ribbon i {
  transform: rotate(180deg);
}

.sidebar-profile-trigger:hover .sidebar-profile-ribbon {
  background: color-mix(in oklch, var(--surface-foreground) 14%, transparent);
  transform: scale(1.1);
}

.sidebar-profile-trigger:hover .sidebar-profile-ribbon i {
  color: var(--surface-foreground) !important;
}

.sidebar.collapsed .sidebar-profile-ribbon {
  display: none !important;
}

.sidebar-profile-dropdown .dropdown-menu {
  z-index: 1080;
}

/* Match settings rail / profile tray: sidebar profile dropdown items */
.sidebar .dropdown-menu-profile .dropdown-item {
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  line-height: 1.35;
}

/* Desktop "Operación" sliding capsule: tray absolutely expands left; cluster width = pill only */
.navbar-operation-cluster {
  position: relative;
  flex-shrink: 0;
  --navbar-op-spring: cubic-bezier(0.22, 1, 0.36, 1);
  --navbar-op-spring-out: cubic-bezier(0.4, 0, 1, 1);
}

.navbar-operation-cluster.is-open {
  z-index: 1085;
}

.navbar-operation-links.navbar-operation-tray {
  position: absolute;
  right: 100%;
  top: 50%;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.25rem;
  margin-right: 0.5rem;
  max-width: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  overflow: hidden;
  padding-block: 0;
  padding-inline: 0;
  white-space: nowrap;
  transform: translate(12px, -50%);
  background: rgba(var(--bs-body-bg-rgb), 0.72);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid transparent;
  box-shadow: none;
  transition:
    max-width 0.26s var(--navbar-op-spring-out),
    opacity 0.16s var(--navbar-op-spring-out),
    transform 0.22s var(--navbar-op-spring-out),
    visibility 0s linear 0.24s,
    padding-block 0.2s var(--navbar-op-spring-out),
    padding-inline 0.2s var(--navbar-op-spring-out),
    border-color 0.15s ease,
    box-shadow 0.18s ease;
}

.navbar-operation-cluster.is-open .navbar-operation-links.navbar-operation-tray {
  /* 24rem (~384px) clipped 4 Spanish labels + icons; cap to viewport with headroom */
  max-width: min(52rem, calc(100vw - 10rem));
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  padding-block: 0.375rem;
  padding-inline: 0.625rem;
  border-color: rgba(var(--bs-border-color-rgb), 0.45);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  transform: translate(0, -50%);
  transition:
    max-width 0.45s var(--navbar-op-spring),
    opacity 0.32s var(--navbar-op-spring),
    transform 0.42s var(--navbar-op-spring),
    visibility 0s linear 0s,
    padding-block 0.36s var(--navbar-op-spring),
    padding-inline 0.36s var(--navbar-op-spring),
    border-color 0.2s ease,
    box-shadow 0.28s ease;
}

.navbar-operation-link,
.navbar-operation-link span {
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  line-height: 1.35;
  white-space: nowrap;
}

.navbar-operation-link {
  opacity: 0;
  transform: translateX(12px);
  transition:
    opacity 0.22s var(--navbar-op-spring-out),
    transform 0.26s var(--navbar-op-spring-out);
  transition-delay: 0ms;
}

.navbar-operation-cluster.is-open .navbar-operation-link {
  opacity: 1;
  transform: translateX(0);
  transition:
    opacity 0.28s var(--navbar-op-spring),
    transform 0.34s var(--navbar-op-spring);
}

.navbar-operation-cluster.is-open .navbar-operation-link:nth-child(1) {
  transition-delay: 0s;
}

.navbar-operation-cluster.is-open .navbar-operation-link:nth-child(2) {
  transition-delay: 0.05s;
}

.navbar-operation-cluster.is-open .navbar-operation-link:nth-child(3) {
  transition-delay: 0.1s;
}

.navbar-operation-cluster.is-open .navbar-operation-link:nth-child(4) {
  transition-delay: 0.15s;
}

.navbar-operation-toggle-icons {
  position: relative;
  width: 1em;
  height: 1em;
}

.navbar-operation-toggle-icon {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  line-height: 1;
  transition: opacity 0.22s var(--navbar-op-spring);
}

.navbar-operation-toggle-icon--plus {
  opacity: 1;
}

.navbar-operation-toggle-icon--chev {
  opacity: 0;
}

.navbar-operation-cluster.is-open .navbar-operation-toggle-icon--plus {
  opacity: 0;
}

.navbar-operation-cluster.is-open .navbar-operation-toggle-icon--chev {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .navbar-operation-links.navbar-operation-tray,
  .navbar-operation-cluster.is-open .navbar-operation-links.navbar-operation-tray,
  .navbar-operation-link,
  .navbar-operation-cluster.is-open .navbar-operation-link,
  .navbar-operation-toggle-icon,
  .navbar-operation-cluster.is-open .navbar-operation-toggle-icon--plus,
  .navbar-operation-cluster.is-open .navbar-operation-toggle-icon--chev {
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }

  .navbar-operation-cluster.is-open .navbar-operation-link:nth-child(2),
  .navbar-operation-cluster.is-open .navbar-operation-link:nth-child(3),
  .navbar-operation-cluster.is-open .navbar-operation-link:nth-child(4) {
    transition-delay: 0ms !important;
  }
}

.navbar-operation-link:hover {
  background-color: var(--bs-primary-bg-subtle);
  color: var(--bs-primary-text-emphasis);
}

.navbar-operation-link:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 1px;
}

/* Mobile add sheet: same label rhythm as profile-style rows */
#addActionsSheet .list-group-item-action span {
  font-weight: 500;
  font-size: 0.9rem;
  font-family: inherit;
  line-height: 1.35;
}

.sidebar.collapsed .sidebar-profile-text {
  display: none !important;
}

.sidebar.collapsed .sidebar-profile-trigger {
  justify-content: center !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin-left: 0;
  margin-right: 0;
  max-width: 100%;
  width: auto !important;
}

.sidebar.collapsed .sidebar-footer {
  padding-left: 0;
  padding-right: 0;
  overflow-x: clip;
  max-width: 100%;
  min-width: 0;
}

.sidebar.collapsed .sidebar-profile-dropdown {
  display: flex;
  justify-content: center;
  width: 100%;
  min-width: 0;
  padding-left: 0 !important;
  padding-right: 0 !important;
  overflow-x: clip;
  max-width: 100%;
}

/* Top Navbar Adjustments */
.navbar.sticky-top {
  background: rgba(var(--bs-body-bg-rgb), 0.8) !important;
  backdrop-filter: blur(15px) saturate(180%);
  -webkit-backdrop-filter: blur(15px) saturate(180%);
  border-bottom: 1px solid rgba(var(--bs-border-color-rgb), 0.05) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02) !important;
  height: 64px;
  display: flex;
  align-items: center;
}

/* Layout Adjustments for Desktop */
@media (min-width: 992px) {
  body.has-sidebar {
    padding-left: var(--sidebar-width);
    padding-top: 64px;
    transition: padding-left var(--sidebar-transition), padding-top var(--sidebar-transition);
  }

  body.has-sidebar.demo-mode {
    padding-top: 104px; /* 64px navbar + 40px demo banner */
  }

  body.has-sidebar main {
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
  }

  /* Match main.container horizontal inset so navbar breadcrumb lines up with page chrome (e.g. liquidity-ribbon) */
  body.has-sidebar .navbar.navbar-expand-lg > .container {
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
  }

  body.has-sidebar.sidebar-collapsed main {
    position: relative;
    z-index: 0;
  }

  @media (min-width: 1400px) {
    body.has-sidebar main {
      padding-left: 3rem !important;
      padding-right: 3rem !important;
    }

    body.has-sidebar .navbar.navbar-expand-lg > .container {
      padding-left: 3rem !important;
      padding-right: 3rem !important;
    }
  }

  body.has-sidebar.sidebar-collapsed {
    padding-left: var(--sidebar-collapsed-width);
  }

  body.has-sidebar .navbar.sticky-top {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    width: auto;
    transition: all var(--sidebar-transition);
    z-index: 1020;
    background: rgba(var(--bs-body-bg-rgb), 0.7) !important;
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
  }

  /* Offset navbar in demo mode when banner is present */
  body.demo-mode.has-sidebar .navbar.sticky-top {
    top: 40px;
  }

  /* Dark theme: top bar matches fixed sidebar rail (same bg + hairline as #sidebar) */
  .dark body.has-sidebar .navbar.sticky-top,
  [data-bs-theme="dark"] body.has-sidebar .navbar.sticky-top {
    background: var(--sidebar-bg) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-bottom: 1px solid var(--hairline-strong) !important;
    box-shadow: none;
    color: var(--surface-foreground);
  }

  .dark body.has-sidebar .navbar.navbar-expand-lg .navbar__breadcrumb .app-nav-breadcrumb__page.text-body-secondary,
  [data-bs-theme="dark"]
    body.has-sidebar
    .navbar.navbar-expand-lg
    .navbar__breadcrumb
    .app-nav-breadcrumb__page.text-body-secondary {
    color: color-mix(in oklch, var(--surface-foreground) 72%, transparent) !important;
  }

  .dark body.has-sidebar .navbar.navbar-expand-lg .app-nav-breadcrumb__dot.text-primary,
  [data-bs-theme="dark"] body.has-sidebar .navbar.navbar-expand-lg .app-nav-breadcrumb__dot.text-primary {
    color: var(--gold) !important;
  }

  .dark body.has-sidebar .navbar.navbar-expand-lg .nav-link,
  [data-bs-theme="dark"] body.has-sidebar .navbar.navbar-expand-lg .nav-link {
    color: color-mix(in oklch, var(--surface-foreground) 88%, transparent);
  }

  .dark body.has-sidebar .navbar.navbar-expand-lg .nav-link:hover,
  [data-bs-theme="dark"] body.has-sidebar .navbar.navbar-expand-lg .nav-link:hover {
    color: var(--surface-foreground);
  }

  .dark body.has-sidebar .navbar.navbar-expand-lg .btn-outline-secondary,
  [data-bs-theme="dark"] body.has-sidebar .navbar.navbar-expand-lg .btn-outline-secondary {
    --bs-btn-color: color-mix(in oklch, var(--surface-foreground) 90%, transparent);
    --bs-btn-border-color: color-mix(in oklch, var(--surface-foreground) 28%, transparent);
    --bs-btn-hover-bg: color-mix(in oklch, var(--surface-foreground) 12%, transparent);
    --bs-btn-hover-border-color: color-mix(in oklch, var(--surface-foreground) 36%, transparent);
    --bs-btn-hover-color: var(--surface-foreground);
    --bs-btn-active-bg: color-mix(in oklch, var(--surface-foreground) 16%, transparent);
    --bs-btn-active-border-color: color-mix(in oklch, var(--surface-foreground) 40%, transparent);
    --bs-btn-active-color: var(--surface-foreground);
  }

  body.has-sidebar.sidebar-collapsed .navbar.sticky-top {
    left: var(--sidebar-collapsed-width);
  }

  .settings-card-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .settings-card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08) !important;
    background: rgba(var(--bs-primary-rgb), 0.02);
  }

  .no-scrollbar::-webkit-scrollbar {
    display: none;
  }
  .no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  /* When demo banner is present */
  body.has-sidebar.demo-mode .navbar.sticky-top {
    top: 40px !important;
  }
}

/* Override Bootstrap form check/switch colors */
.form-check-input:checked {
  background-color: #0055ff;
  border-color: #0055ff;
}

.text-teal {
  color: #0055ff !important;
}

.text-coral {
  color: #E05C45 !important;
}

.text-amber {
  color: #D4831A !important;
}

/* Payment Method Badges */
.payment-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: capitalize;
}

.pay-cash { background-color: rgba(0, 85, 255, 0.1); color: #0055ff; }
.pay-card { background-color: rgba(55, 138, 221, 0.1); color: #378ADD; }
.pay-bank { background-color: rgba(0, 163, 255, 0.15); color: #0055ff; }
.pay-digital_wallet { background-color: rgba(10, 189, 227, 0.12); color: #0abde3; }
.pay-credit-card { background-color: rgba(55, 138, 221, 0.1); color: #378ADD; }
.pay-debit-card { background-color: rgba(133, 183, 235, 0.15); color: #378ADD; }
.pay-upi { background-color: rgba(212, 131, 26, 0.1); color: #D4831A; }
.pay-netbanking { background-color: rgba(0, 163, 255, 0.15); color: #0055ff; }

[data-bs-theme="dark"] .pay-cash { background-color: rgba(0, 85, 255, 0.2); color: #a8d8ff; }
[data-bs-theme="dark"] .pay-card { background-color: rgba(55, 138, 221, 0.2); color: #85B7EB; }
[data-bs-theme="dark"] .pay-bank { background-color: rgba(0, 163, 255, 0.25); color: #a8d8ff; }
[data-bs-theme="dark"] .pay-digital_wallet { background-color: rgba(10, 189, 227, 0.22); color: #7bedfd; }
[data-bs-theme="dark"] .pay-credit-card { background-color: rgba(55, 138, 221, 0.2); color: #85B7EB; }
[data-bs-theme="dark"] .pay-debit-card { background-color: rgba(133, 183, 235, 0.25); color: #85B7EB; }
[data-bs-theme="dark"] .pay-upi { background-color: rgba(212, 131, 26, 0.2); color: #F4B44E; }
[data-bs-theme="dark"] .pay-netbanking { background-color: rgba(0, 163, 255, 0.25); color: #a8d8ff; }

/* Dashboard Soft Badges */
.badge-soft {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 50rem;
  font-size: 0.75rem;
  font-weight: 500;
  border: none;
  transition: all 0.2s ease;
}

.badge-soft-primary {
  background-color: rgba(0, 85, 255, 0.08);
  color: #0055ff;
}

[data-bs-theme="dark"] .badge-soft-primary {
  background-color: rgba(0, 85, 255, 0.15);
  color: #a8d8ff;
}

.badge-soft-secondary {
  background-color: rgba(158, 157, 154, 0.1);
  color: #9E9D9A;
}

.badge-soft-success {
  background-color: rgba(0, 85, 255, 0.1);
  color: #0055ff;
}

.badge-soft-danger {
  background-color: rgba(224, 92, 69, 0.1);
  color: #E05C45;
}

.badge-soft-info {
  background-color: rgba(61, 122, 138, 0.1);
  color: #3d7a8a;
}

[data-bs-theme="dark"] .badge-soft-secondary {
  background-color: rgba(255, 255, 255, 0.08);
  color: #adb5bd;
}

[data-bs-theme="dark"] .badge-soft-success {
  background-color: rgba(0, 85, 255, 0.2);
  color: #a8d8ff;
}

[data-bs-theme="dark"] .badge-soft-danger {
  background-color: rgba(224, 92, 69, 0.2);
  color: #F49C8C;
}

[data-bs-theme="dark"] .badge-soft-info {
  background-color: rgba(61, 122, 138, 0.2);
  color: #8db5c0;
}

/* Bootstrap `.text-bg-primary` hard-codes white text. In dark theme this project
   remaps `--bs-primary` (and `--bs-primary-rgb`) to a near-white tone, so white
   text on a near-white badge becomes unreadable. Restore contrast by switching
   to the deep-navy `--primary-foreground` used by other primary surfaces. */
[data-bs-theme="dark"] .text-bg-primary {
  color: var(--primary-foreground) !important;
}

/* Solid `.badge.bg-primary` inherits the same near-white `--bs-primary` background in
   dark theme but keeps Bootstrap’s default light badge text — same fix as `.text-bg-primary`. */
[data-bs-theme="dark"] .badge.bg-primary {
  color: var(--primary-foreground) !important;
}

/* Account form (BANK): Yape/Plin overlay Sí/No — neutral pills, clear checked state in dark mode */
.account-overlay-yesno .btn-outline-secondary {
  min-width: 3.25rem;
}

[data-bs-theme="light"] .account-overlay-yesno .btn-check:checked + .btn-outline-secondary {
  background-color: rgba(0, 85, 255, 0.14) !important;
  border-color: #0055ff !important;
  color: #0f172a !important;
}

[data-bs-theme="dark"] .account-overlay-yesno .btn-outline-secondary {
  color: var(--bs-body-color);
  border-color: rgba(255, 255, 255, 0.22);
  background-color: rgba(255, 255, 255, 0.04);
}

[data-bs-theme="dark"] .account-overlay-yesno .btn-outline-secondary:hover {
  color: var(--bs-body-color);
  border-color: rgba(255, 255, 255, 0.35);
  background-color: rgba(255, 255, 255, 0.09);
}

[data-bs-theme="dark"] .account-overlay-yesno .btn-check:checked + .btn-outline-secondary {
  background-color: rgba(96, 165, 250, 0.30) !important;
  border-color: #60a5fa !important;
  color: #f8fafc !important;
}

.form-check-input:focus {
  border-color: #0055ff;
  box-shadow: 0 0 0 0.25rem rgba(0, 85, 255, 0.25);
}

/* Override Bootstrap button component colors via design tokens */
.btn-primary {
  --bs-btn-bg: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-color: var(--primary-foreground);
  --bs-btn-hover-bg: color-mix(in oklch, var(--primary) 90%, var(--gold));
  --bs-btn-hover-border-color: var(--primary);
  --bs-btn-hover-color: var(--primary-foreground);
  --bs-btn-active-bg: var(--gold);
  --bs-btn-active-border-color: var(--gold);
  --bs-btn-active-color: var(--primary-foreground);
  --bs-btn-disabled-bg: var(--primary);
  --bs-btn-disabled-border-color: var(--primary);
  --bs-btn-disabled-color: var(--primary-foreground);
}
.btn-outline-primary {
  --bs-btn-color: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-bg: var(--primary);
  --bs-btn-hover-border-color: var(--primary);
  --bs-btn-hover-color: var(--primary-foreground);
  --bs-btn-active-bg: var(--primary);
  --bs-btn-active-border-color: var(--primary);
  --bs-btn-disabled-color: var(--primary);
  --bs-btn-disabled-border-color: var(--primary);
}
.btn-outline-danger {
  --bs-btn-color: var(--destructive);
  --bs-btn-border-color: var(--destructive);
  --bs-btn-hover-bg: var(--destructive);
  --bs-btn-hover-border-color: var(--destructive);
  --bs-btn-active-bg: var(--destructive);
  --bs-btn-active-border-color: var(--destructive);
  --bs-btn-disabled-color: var(--destructive);
  --bs-btn-disabled-border-color: var(--destructive);
}
.btn-outline-success {
  --bs-btn-color: var(--gold);
  --bs-btn-border-color: var(--gold);
  --bs-btn-hover-bg: var(--gold);
  --bs-btn-hover-border-color: var(--gold);
  --bs-btn-active-bg: var(--gold);
  --bs-btn-active-border-color: var(--gold);
}

/* === Dark mode (driven by EITHER .dark class OR data-bs-theme="dark") === */
.dark,
[data-bs-theme="dark"] {
  --background: oklch(0.14 0.04 255);
  --foreground: oklch(0.97 0.005 250);

  --card: oklch(0.18 0.04 255);
  --card-foreground: oklch(0.97 0.005 250);
  --popover: oklch(0.18 0.04 255);
  --popover-foreground: oklch(0.97 0.005 250);

  --primary: oklch(0.97 0.005 250);
  --primary-foreground: oklch(0.14 0.04 255);

  --secondary: oklch(0.22 0.03 255);
  --secondary-foreground: oklch(0.97 0.005 250);

  --muted: oklch(0.22 0.03 255);
  --muted-foreground: oklch(0.72 0.02 255);

  --accent: oklch(0.22 0.03 255);
  --accent-foreground: oklch(0.97 0.005 250);

  --destructive: oklch(0.7 0.19 22);
  --destructive-foreground: oklch(0.97 0.005 250);

  --border: oklch(1 0 0 / 0.1);
  --input: oklch(1 0 0 / 0.15);
  --ring: oklch(0.70 0.20 255);

  --surface: oklch(0.10 0.04 255);
  --surface-foreground: oklch(0.97 0.005 250);
  --hairline: oklch(1 0 0 / 0.10);
  --hairline-strong: oklch(1 0 0 / 0.22);

  --gold: oklch(0.72 0.18 255);

  --primary-rgb: 245, 246, 249;
  --gold-rgb: 110, 140, 255;
  --destructive-rgb: 244, 156, 140;
  --foreground-rgb: 245, 246, 249;
  --background-rgb: 16, 22, 41;
  --muted-fg-rgb: 168, 178, 196;

  /* Legacy aliases used by older selectors */
  --color-primary: var(--gold);
  --color-background: var(--background);
  --color-surface: var(--card);
  --color-text: var(--foreground);
  --color-success: var(--gold);
  --color-danger: var(--destructive);
  --color-warning: oklch(0.78 0.16 80);
}

/* Navbar Unification */
/* Navbar & Footer Unification */
[data-bs-theme="dark"] .navbar,
[data-bs-theme="dark"] footer {
  background-color: rgba(5, 25, 45, 0.92) !important;
  backdrop-filter: blur(10px);
  border-color: rgba(255, 255, 255, 0.06) !important;
}

[data-bs-theme="dark"] .navbar {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
  background-color: rgba(5, 25, 45, 0.88) !important;
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
}

/* User profile dropdown (desktop) + navbar inline operation links: readable hover/focus in dark mode */
[data-bs-theme="dark"] .dropdown-menu-profile .dropdown-item,
[data-bs-theme="dark"] .navbar-operation-link {
  transition:
    color 0.2s ease,
    background-color 0.2s ease,
    opacity 0.22s cubic-bezier(0.4, 0, 1, 1),
    transform 0.26s cubic-bezier(0.4, 0, 1, 1);
}

[data-bs-theme="dark"] .dropdown-menu-profile .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-menu-profile .dropdown-item:focus,
[data-bs-theme="dark"] .dropdown-menu-profile .dropdown-item:focus-visible,
[data-bs-theme="dark"] .navbar-operation-link:hover,
[data-bs-theme="dark"] .navbar-operation-link:focus,
[data-bs-theme="dark"] .navbar-operation-link:focus-visible {
  background-color: rgba(30, 58, 138, 0.3) !important;
  color: #60a5fa !important;
}

[data-bs-theme="dark"] .dropdown-menu-profile .dropdown-item:hover i,
[data-bs-theme="dark"] .dropdown-menu-profile .dropdown-item:focus i,
[data-bs-theme="dark"] .dropdown-menu-profile .dropdown-item:focus-visible i,
[data-bs-theme="dark"] .navbar-operation-link:hover i,
[data-bs-theme="dark"] .navbar-operation-link:focus i,
[data-bs-theme="dark"] .navbar-operation-link:focus-visible i {
  color: #60a5fa !important;
}

[data-bs-theme="dark"] .navbar-operation-tray {
  background: rgba(5, 25, 45, 0.82);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

[data-bs-theme="dark"] .navbar-operation-cluster.is-open .navbar-operation-tray {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
}

[data-bs-theme="dark"] .dropdown-menu-profile .dropdown-item.text-danger:hover,
[data-bs-theme="dark"] .dropdown-menu-profile .dropdown-item.text-danger:focus,
[data-bs-theme="dark"] .dropdown-menu-profile .dropdown-item.text-danger:focus-visible {
  color: #60a5fa !important;
}

[data-bs-theme="dark"] .dropdown-menu-profile .dropdown-divider {
  border-top-color: #334155;
  opacity: 1;
}

/* Onboarding: headings use --ink from :root; override in dark for readable contrast */
[data-bs-theme="dark"] .onboarding-step h1,
[data-bs-theme="dark"] .onboarding-step h2 {
  color: var(--color-text) !important;
}

[data-bs-theme="dark"] #skip-container .btn-link:hover,
[data-bs-theme="dark"] #skip-container .btn-link:focus,
[data-bs-theme="dark"] #skip-container .btn-link:focus-visible {
  color: #60a5fa !important;
}

[data-bs-theme="dark"] footer {
  border-top: 1px solid rgba(255, 255, 255, 0.05) !important;
}

/* Ensure Main Content stays above Footer stacking context */
main {
  position: relative;
  z-index: 5;
}

footer {
  position: relative;
  z-index: 1;
}


[data-bs-theme="dark"] .card {
  background-color: var(--color-surface);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Settings HTMX pane: surface cards like desktop top navbar (uses --sidebar-bg in dark + sidebar shell). */
.dark body.has-sidebar #settings-pane .card,
[data-bs-theme="dark"] body.has-sidebar #settings-pane .card {
  background-color: var(--sidebar-bg);
  border: 1px solid var(--hairline-strong);
}

/* PWA Install Banner Dark Mode */
[data-bs-theme="dark"] #installAppContainer {
  background-color: var(--color-surface) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* Navbar */
.bg-custom-dark {
  background-color: var(--color-primary) !important;
}

/* Primary Button */
.btn-primary {
  background-color: #0055ff;
  border: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  color: #fff;
}
.btn-primary:hover,
.btn-primary:active,
.btn-primary:focus {
  background-color: #0044cc;
  box-shadow: 0 4px 12px rgba(0, 85, 255, 0.25);
}

/* Success Button (Forest Green) */
.btn-success {
  background-color: #0055ff;
  border: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  color: #fff;
}
.btn-success:hover,
.btn-success:active,
.btn-success:focus {
  background-color: #0044cc;
  box-shadow: 0 4px 12px rgba(0, 85, 255, 0.25);
}

/* Danger Button (Warm Red) */
.btn-danger {
  background-color: var(--color-danger);
  border: 1px solid var(--color-danger);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
}
.btn-danger:hover,
.btn-danger:active,
.btn-danger:focus {
  background-color: #A63C28;
  border-color: #962c1b;
  color: #fff;
}

/* Links */
a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}
a:hover {
  color: var(--color-success);
}

/* Outline Buttons (for secondary actions) */
.btn-outline-primary {
  color: var(--color-success);
  border-color: var(--color-success);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
}
.btn-outline-primary:hover,
.btn-outline-primary:active {
  background-color: #0055ff !important;
  border: 1px solid #0055ff !important;
  color: #fff !important;
}

.btn-outline-secondary {
  color: var(--color-primary);
  border-color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
}
.btn-outline-secondary:hover,
.btn-outline-secondary:active {
  background-color: var(--color-primary) !important;
  border-color: var(--color-primary) !important;
  color: #fff !important;
}

/* Specific Link Overrides */
.btn-link {
  color: var(--color-success); /* Forest Green for actions */
  text-decoration: none;
}
.btn-link:hover {
  color: #04342C;
}

/* Navbar Links */
.nav-link {
  color: var(--color-primary);
  height: 38px !important; /* Force standard height */
  font-weight: 400; /* Regular weight */
  font-size: 1rem; /* Consistent size */
}
.nav-link:hover,
.nav-link.active {
  color: var(--color-success) !important;
}

.nav-link.active {
  font-weight: 500; /* Heavier only for active state */
}

/* Pagination */
.page-link {
  color: var(--color-primary);
}
.page-link:hover {
  color: var(--color-success);
  background-color: #f0f4fa;
  border-color: #d5dee8;
}
.page-item.active .page-link {
  background-color: var(--color-success); /* Forest Green selected page */
  border-color: var(--color-success);
  color: #fff;
}

/* Sidebar / List Group Active State */
.list-group-item.active {
  background-color: var(--color-success); /* Forest Green */
  border-color: var(--color-success);
}

/* Text Colors */
.text-primary {
  color: var(--color-success) !important; /* Forest Green to match Primary Buttons */
}
.text-secondary {
  color: var(--color-primary) !important; /* Warm Ink Black for secondary text */
}
.text-success {
  color: var(--color-success) !important;
}
.text-danger {
  color: var(--color-danger) !important;
}
.text-warning {
  color: var(--color-warning) !important;
}
 
/* Override Bootstrap Dropdown Active State */
.dropdown-item.active, 
.dropdown-item:active {
    background-color: var(--bs-primary) !important;
    color: #fff !important;
}

.dropdown-item:focus{
    background-color: var(--bs-primary-bg-subtle);
    color: #fff !important;
}

.dropdown-item:hover {
    background-color: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
}

/* Accent Text Utility */
.text-gradient-primary {
  color: #0055ff !important;
  -webkit-text-fill-color: #0055ff !important;
  display: inline-block;
}

/* Dark Mode Overrides */
[data-bs-theme="dark"] .nav-link {
  color: #ffffff; /* White for dark mode */
}
[data-bs-theme="dark"] .nav-link:hover,
[data-bs-theme="dark"] .nav-link.active {
  color: var(--color-success) !important; /* Forest Green for hover/active */
}

/* Small Buttons height override */
.btn-sm {
  height: 31px !important;
  padding-top: 0;
  padding-bottom: 0;
}

/* Donation Button Styling */
.donation-btn {
  background-color: rgba(224, 123, 57, 0.1);
  border: 1px solid rgba(224, 123, 57, 0.3);
  color: var(--color-warning) !important;
  font-weight: 600 !important;
  transition: all 0.3s ease;
}

.donation-btn:hover {
  background-color: rgba(224, 123, 57, 0.18);
  border-color: var(--color-warning);
  transform: scale(1.05);
}

[data-bs-theme="dark"] .donation-btn {
  background-color: rgba(224, 123, 57, 0.18);
}

/* Fix for gray background behind inputs in Expense Form (Dark Mode) */
[data-bs-theme="dark"] #formset-table,
[data-bs-theme="dark"] #formset-table th,
[data-bs-theme="dark"] #formset-table td {
  background-color: transparent !important;
  --bs-table-bg: transparent !important;
  color: var(--color-text); /* Ensure text remains visible */
}

/* Ensure table borders don't look weird if they exist (though it is table-borderless) */
[data-bs-theme="dark"] #formset-table th {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1); /* Subtle separator for header */
}

/* --- Mobile Responsive Formset Table --- */
@media (max-width: 768px) {
  #formset-table thead {
    display: none;
  }

  #formset-table tbody,
  #formset-table tr,
  #formset-table td {
    display: block;
    width: 100%;
  }

  #formset-table tr {
    margin-bottom: 1.5rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.75rem;
    padding: 1.25rem;
    background-color: rgba(var(--bs-body-bg-rgb), 0.5); /* Slight separation */
    position: relative;
  }

  #formset-table td {
    padding: 0.5rem 0;
    border: none;
  }

  /* Add labels visually for context if needed, but placeholders help. 
       Let's ensure the delete button is well positioned. */
  #formset-table td:last-child {
    text-align: right;
    margin-top: 0.5rem;
    border-top: 1px dashed var(--bs-border-color);
    padding-top: 0.75rem;
  }

  /* Make the remove button look more like a distinct action on mobile */
  .remove-row,
  .delete-row {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
  }
}
/* --- Driver.js Tutorial Theme Customization --- */

/* Default (Light Mode) */
.driver-popover {
  background-color: var(--surface-color) !important;
  color: var(--text-main) !important;
  border-radius: 12px !important;
  padding: 15px !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
  border: 1px solid rgba(0, 0, 0, 0.05) !important;
}

.driver-popover-title {
  font-family: "DM Sans", sans-serif !important;
  font-weight: 600 !important;
  font-size: 1.1rem !important;
  margin-bottom: 8px !important;
  color: var(--color-primary) !important;
}

.driver-popover-description {
  font-family: "Inter", sans-serif !important;
  font-size: 0.95rem !important;
  line-height: 1.5 !important;
  color: #495057 !important;
  margin-bottom: 0 !important;
}

/* Tutorial Buttons */
.driver-popover-footer button {
  border-radius: 6px !important;
  text-shadow: none !important;
  font-size: 0.85rem !important;
  padding: 6px 14px !important;
  font-weight: 500 !important;
}

.driver-popover-next-btn {
  background-color: var(--color-success) !important; /* Forest Green */
  color: white !important;
  border: none !important;
}

.driver-popover-prev-btn {
  background-color: transparent !important;
  color: var(--text-main) !important;
  border: 1px solid #dee2e6 !important;
}

.driver-popover-close-btn {
  color: var(--text-main) !important;
}

/* Dark Mode Overrides */
[data-bs-theme="dark"] .driver-popover {
  background-color: #1e2126 !important; /* Slightly lighter than surface for popover */
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5) !important;
}

[data-bs-theme="dark"] .driver-popover-title {
  color: white !important;
}

[data-bs-theme="dark"] .driver-popover-description {
  color: #adb5bd !important;
}

[data-bs-theme="dark"] .driver-popover-prev-btn {
  color: #e9ecef !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-bs-theme="dark"] .driver-popover-close-btn {
  color: #adb5bd !important;
}

[data-bs-theme="dark"] .driver-popover-close-btn:hover {
  color: white !important;
}

/* Speed up Driver.js animations */
.driver-active-element,
.driver-popover {
  transition-duration: 0.1s !important;
}

/* Theme-aware Image Utility Classes */
[data-bs-theme="dark"] .img-light {
  display: none !important;
}

[data-bs-theme="light"] .img-dark {
  display: none !important;
}

.navbar .dropdown-menu {
  z-index: 1050 !important; /* Ensure it sits above navbar */
}

/* Global dropdown fix for mobile & desktop overlay */
.dropdown-menu {
  z-index: 3000 !important; /* Above everything including footer (0) and mobile UI (1030-1080) */
}

/* Ensure transaction list items don't clip dropdowns */
.list-group-item, .list-group {
    overflow: visible !important;
}


/* Ensure Navbar sits above filters (which have z-index: 1040) but below modals (1055) */
/* Essential because backdrop-filter in dark mode creates a new stacking context */
/* Sticky Navbar Glassmorphism and Z-index */
.navbar.sticky-top {
  background-color: rgba(var(--bs-tertiary-bg-rgb), 0.8) !important;
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  z-index: 1050;
  transition: all 0.3s ease;
}

[data-bs-theme="dark"] .navbar.sticky-top {
  background-color: rgba(var(--color-surface-rgb, 26, 29, 33), 0.8) !important;
}

/* Social Share Buttons */
.btn-social {
  color: white !important;
  border: none;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.btn-social:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  opacity: 0.9;
}

.btn-twitter {
  background-color: #000000;
} /* X / Twitter */
.btn-linkedin {
  background-color: #0077b5;
}
.btn-facebook {
  background-color: #1877f2;
}
.btn-whatsapp {
  background-color: #25d366;
}
.btn-reddit {
  background-color: #ff4500;
}

/* Blog Content Typography */
.blog-content h1,
.blog-content h2,
.blog-content h3,
.blog-content h4,
.blog-content h5,
.blog-content h6 {
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

/* Fix for first element */
.blog-content > *:first-child {
  margin-top: 0;
}

/* Dashboard Category List Redesign */
.category-list-item {
  transition: background-color 0.2s;
  border-radius: 8px;
}
.category-list-item:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

.category-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

/* Progress Bars */
.progress-bar {
  --bs-progress-bar-bg: #0055ff;
}
.progress-thin {
  height: 6px;
  border-radius: 3px;
  background-color: rgba(255, 255, 255, 0.1);
}
[data-bs-theme="light"] .progress-thin {
  background-color: rgba(0, 0, 0, 0.05);
}

/* Category Colors (cycling) - Flat solid colors */
.cat-color-0 {
  background-color: #0055ff;
} /* Forest Green */
.cat-color-1 {
  background-color: #D4831A;
} /* Warm Amber */
.cat-color-2 {
  background-color: #E05C45;
} /* Warm Red */
.cat-color-3 {
  background-color: #8b6f47;
} /* Warm Brown */
.cat-color-4 {
  background-color: #6b8f71;
} /* Sage Green */

/* Progress Bar Animation */
@keyframes progress-fill {
  from {
    width: 0;
  }
  to {
    width: var(--progress-width, 100%);
  }
}

.progress-animate .progress-bar {
  animation: progress-fill 1s ease-out forwards;
}

.progress {
  overflow: hidden;
}

/* Semantic Progress Bar Colors - Premium Palette */
.progress-gradient-success {
  background-color: #0055ff;
}
.progress-gradient-warning {
  background-color: #D4831A;
}
.progress-gradient-danger {
  background-color: #E05C45;
}
.progress-gradient-teal {
  background-color: #0055ff;
}

/* Fix for Multiselect Dropdown Visibility */
.multiselect-container.dropdown-menu {
  z-index: 2000 !important;
}

/* Fix: Remove chevron/caret from dropdown option items */
.multiselect-container .multiselect-option::after,
.multiselect-container .multiselect-all::after,
.multiselect-container .dropdown-item::after {
  display: none !important;
  content: none !important;
}

/* Fix: Ensure radio inputs in single-select dropdown look correct */
.multiselect-container .form-check-input[type="radio"] {
  appearance: auto !important;
  -webkit-appearance: auto !important;
  background-image: none !important;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  vertical-align: middle;
  cursor: pointer;
}

/* Fix for Mobile Dropdown Clipping (tablet + phone: matches lg-off chrome) */
@media (max-width: 991.98px) {
  /* Removed overflow: visible override for general .table-responsive to allow scrolling */

  #formset-table tr {
    position: static !important; /* Allow absolute dropdowns to escape the row/card */
    overflow: visible !important;
  }
}

/* Ensure multiselect dropdown is always above other elements */
.multiselect-native-select .btn-group {
  position: relative;
}

.multiselect-native-select .btn-group:hover,
.multiselect-native-select .btn-group:focus-within,
.multiselect-native-select .btn-group.show {
  z-index: 1055 !important; /* Elevate only the active dropdown to escape sibling stacking overlap */
}

/* Fix for overlapping rows in formsets on mobile */
.form-row {
  z-index: 1;
}

.form-row:focus-within {
  z-index: 1050; /* Bring current row to front when focused */
}




/* --- Mobile App Specific Styles --- */
/* These classes are toggled via JavaScript when running inside Capacitor */
.is-mobile-app .non-mobile-app {
  display: none !important;
}

.mobile-app-only {
  display: none;
}

.is-mobile-app .mobile-app-only {
  display: block;
}

/* Safe area padding for the navbar with a 44px fallback for iOS notches */
.is-mobile-app .navbar {
  padding-top: calc(env(safe-area-inset-top, 44px) + 0.5rem) !important;
}

.is-mobile-app .navbar-brand {
    padding-top: 0.5rem;
}

/* Ensure the body and main content respect safe areas */
.is-mobile-app body {
  padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px) + 1rem) !important;
}

.is-mobile-app main {
  padding-top: calc(env(safe-area-inset-top, 44px) + 0.5rem) !important; /* The navbar already has safe-area-inset-top */
}

/* Specific fix for authenticated users where the top navbar is hidden on mobile */
.is-mobile-app.is-authenticated main {
    padding-top: calc(env(safe-area-inset-top, 20px) + 0.75rem) !important;
}

/* Adjust sticky top position if needed */
.is-mobile-app .navbar.sticky-top {
  top: 0;
}

/* --- Visual Payment Method Selector --- */
.payment-method-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.payment-method-item {
  flex: 0 0 calc(20% - 12px);
  min-width: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 8px;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  background: transparent;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.payment-method-item:hover {
  background: rgba(0,0,0,0.02);
  transform: translateY(-2px);
}

.payment-method-item .icon-wrapper {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: #f0f2f5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin-bottom: 8px;
  transition: all 0.3s ease;
}

.payment-method-item .label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-color);
  text-align: center;
}

/* Selected State */
.payment-method-item.active {
  background: transparent;
}

.payment-method-item.active .icon-wrapper {
  background-color: #0055ff;
  color: white;
  transform: scale(1.1);
}

.payment-method-item.active .label {
  color: var(--color-primary);
  font-weight: 600;
}

[data-bs-theme="dark"] .payment-method-item {
  border-color: rgba(255,255,255,0.1);
  background: transparent;
}

[data-bs-theme="dark"] .payment-method-item .icon-wrapper {
  background: rgba(255,255,255,0.1);
}

[data-bs-theme="dark"] .payment-method-item:hover {
  background: rgba(255,255,255,0.04);
}

[data-bs-theme="dark"] .payment-method-item.active {
  background: transparent;
}

/* Responsive adjustment for small screens */
@media (max-width: 576px) {
  .payment-method-item {
    flex: 1 1 calc(33.333% - 12px);
  }
}

/* --- Compact Version for Formsets --- */
.payment-method-selector.compact {
  gap: 4px;
  justify-content: flex-start;
}

/* One-line layout inside modals */
.modal .payment-method-selector {
  flex-wrap: nowrap;
  gap: 6px;
}

.modal .payment-method-item {
  min-width: 0;
  flex: 1 1 0;
  padding: 10px 4px;
}

.modal .payment-method-item .icon-wrapper {
  width: 38px;
  height: 38px;
  font-size: 1.1rem;
}

.modal .payment-method-item .label {
  font-size: 0.7rem;
}

.payment-method-selector.compact .payment-method-item {
  flex: 0 0 auto;
  min-width: 40px;
  padding: 6px;
  border-radius: 8px;
}

.payment-method-selector.compact .icon-wrapper {
  width: 28px;
  height: 28px;
  font-size: 1rem;
  margin-bottom: 2px;
}

.payment-method-selector.compact .label {
  display: none; /* Hide label in compact mode to save space */
}

/* Tooltip for compact mode */
.payment-method-selector.compact .payment-method-item:hover::after {
  content: attr(data-value);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  white-space: nowrap;
  z-index: 10;
}

/* --- Card-based Bulk Add Layout --- */
#formset-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.form-card {
  background: var(--surface-color);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.04);
  transition: all 0.3s ease;
  position: relative;
}

.form-card:hover {
  box-shadow: 0 8px 30px rgba(0,0,0,0.08);
  border-color: rgba(0, 85, 255, 0.2);
}

.form-card .form-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.form-card .form-control, 
.form-card .form-select {
  border-radius: 10px;
  padding: 0.5rem 0.8rem;
  font-size: 0.9rem;
  border: 1.5px solid rgba(0,0,0,0.05);
  background-color: #fcfdfe;
}

.form-card .form-control:focus,
.form-card .form-select:focus {
  border-color: #0055ff;
  background-color: #fff;
  box-shadow: 0 0 0 4px rgba(0, 85, 255, 0.1);
}

.remove-item-container {
  border-top: 1px dashed rgba(0,0,0,0.1);
  margin-top: 1rem;
  padding-top: 1rem;
  text-align: center;
}

.remove-item-btn {
  color: #ff4d6d;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.remove-item-btn:hover {
  color: #ff0033;
  transform: scale(1.05);
}

[data-bs-theme="dark"] .form-card {
  border-color: rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.03);
}

[data-bs-theme="dark"] .form-card .form-control,
[data-bs-theme="dark"] .form-card .form-select {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
}

/* --- Mobile Optimizations for Bulk Add --- */
@media (max-width: 576px) {
  #formset-container {
    gap: 1rem;
  }

  .form-card {
    padding: 1rem;
    border-radius: 16px;
  }

  .form-card .form-label {
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
  }

  .form-card .form-control, 
  .form-card .form-select {
    padding: 0.5rem 0.75rem;
    font-size: 16px; /* Prevents iOS/Mobile zoom on focus */
    border-radius: 10px;
  }

  .remove-item-btn {
    font-size: 0.8rem;
  }
}

/* --- Compact Payment Selector for Cards (Desktop & Mobile Sync) --- */
.form-card .payment-method-selector,
.payment-method-selector.horizontal {
  gap: 0;
  flex-wrap: nowrap;
  overflow-x: hidden;
  padding-bottom: 0;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.form-card .payment-method-selector::-webkit-scrollbar,
.payment-method-selector.horizontal::-webkit-scrollbar {
  display: none;
}

.form-card .payment-method-item,
.payment-method-selector.horizontal .payment-method-item {
  flex: 1;
  min-width: 0;
  padding: 10px 2px;
  border-radius: 12px;
  box-shadow: none;
  border: none;
}

.form-card .payment-method-item .icon-wrapper,
.payment-method-selector.horizontal .payment-method-item .icon-wrapper {
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  border-radius: 10px;
  margin-bottom: 8px;
}

.form-card .payment-method-item .label,
.payment-method-selector.horizontal .payment-method-item .label {
  font-size: 0.7rem;
  white-space: normal;
  word-break: break-word;
  line-height: 1.1;
  text-align: center;
}

@media (max-width: 576px) {
  .form-card .payment-method-selector {
    overflow-x: hidden;
  }

  .form-card .payment-method-item {
    min-width: 0;
    flex: 1;
    padding: 6px 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: transparent !important;
    box-shadow: none !important;
  }
  
  .form-card .payment-method-item:hover {
    background: transparent !important;
    transform: none;
  }
  
  .form-card .payment-method-item.active {
    background: transparent !important;
  }
  
  .form-card .payment-method-item .icon-wrapper {
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
    border-radius: 12px;
    margin-bottom: 6px;
  }
  
  .form-card .payment-method-item .label {
    font-size: 0.7rem;
    margin-top: 0;
    font-weight: 700;
    white-space: normal;
    line-height: 1.1;
    word-break: break-word;
  }
}

/* --- Sticky Action Bar --- */
.sticky-action-bar {
  position: sticky;
  bottom: 1.5rem;
  margin: 2rem 0 1rem;
  z-index: 1020;
  display: flex;
  justify-content: center;
}

.sticky-action-bar .action-bar-content {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0.75rem 1.5rem;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 100px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

[data-bs-theme="dark"] .sticky-action-bar .action-bar-content {
  background: rgba(18, 18, 18, 0.85);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

@media (max-width: 576px) {
  .sticky-action-bar {
    bottom: 0;
    margin: 2rem calc(var(--bs-gutter-x) * -0.5) 0;
    justify-content: stretch;
  }
  
  .sticky-action-bar .action-bar-content {
    width: 100%;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    padding: 1rem;
    justify-content: center;
  }
  
  .sticky-action-bar .btn {
    flex: 1;
    padding: 0.75rem 0.5rem;
    font-size: 0.9rem;
  }
}

/* --- Global input zoom prevention (tablet + phone; bottom padding is in navbar.html for auth) --- */
@media screen and (max-width: 991.98px) {
  input[type="text"],
  input[type="number"],
  input[type="date"],
  input[type="email"],
  input[type="password"],
  select,
  textarea,
  .form-control,
  .form-select {
    font-size: 16px !important; /* Force 16px to prevent auto-zoom on mobile focus */
  }
}

/* --- Mobile Bottom Navigation --- */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(70px + env(safe-area-inset-bottom, 0px));
  background: rgba(var(--bs-body-bg-rgb), 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--bs-border-color-translucent);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 1090 !important; /* Higher than offcanvas (1080) to stay visible */
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -8px 25px rgba(0,0,0,0.1);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--bs-secondary);
  text-decoration: none;
  flex: 1;
  height: 100%;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  border: none;
  background: transparent;
  padding: 0;
}

.mobile-nav-item i {
  font-size: 1.35rem;
  height: 24px; /* Fixed height for consistent alignment */
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0;
  transition: transform 0.2s ease;
}

.mobile-nav-item span {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.mobile-nav-item.active {
  color: var(--color-success); /* Forest Green to match desktop */
}

.mobile-nav-item.active i {
  transform: translateY(-2px);
  color: inherit;
}

/* --- Floating Action Button (FAB) --- */
.mobile-fab {
  position: relative;
  top: -20px;
  width: 65px;
  height: 65px;
  z-index: 1060;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fab-icon {
  width: 58px;
  height: 58px;
  background-color: #0055ff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--bs-body-bg);
  color: white;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: fab-pulse 2.5s infinite;
}

.fab-icon i {
  font-size: 1.8rem;
}

.mobile-fab:active .fab-icon {
  transform: scale(0.9) translateY(4px);
  box-shadow: 0 4px 8px rgba(0, 85, 255, 0.2);
}

[data-bs-theme="dark"] .mobile-bottom-nav {
  background: rgba(33, 37, 41, 0.9);
  border-top-color: rgba(255, 255, 255, 0.08);
}

[data-bs-theme="dark"] .fab-icon {
  border-color: #212529;
}

/* --- Mobile Bottom Sheet (Offcanvas) --- */
.mobile-bottom-sheet {
  height: auto !important;
  max-height: calc(85vh - (70px + env(safe-area-inset-bottom, 0px)));
  margin-bottom: calc(70px + env(safe-area-inset-bottom, 0px)) !important; /* Sit exactly above bottom nav */
  padding-bottom: 1rem !important;
  padding-left: env(safe-area-inset-left, 0px) !important;
  padding-right: env(safe-area-inset-right, 0px) !important;
  border-top-left-radius: 32px !important;
  border-top-right-radius: 32px !important;
  background: rgba(var(--bs-body-bg-rgb), 0.98) !important;
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-top: 1px solid rgba(var(--bs-border-color-rgb), 0.1) !important;
  box-shadow: 0 -20px 50px rgba(0,0,0,0.1);
  z-index: 1080 !important;
}

.profile-avatar {
  background-color: rgba(0, 85, 255, 0.08);
  transition: all 0.3s ease;
}

[data-bs-theme="dark"] .profile-avatar {
  background-color: rgba(0, 85, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.1) !important;
}

.mobile-bottom-sheet .offcanvas-header {
  padding: 1.5rem 1.75rem 1rem;
}

/* Utilities */
.min-width-0 {
  min-width: 0 !important;
}
.overflow-hidden {
  overflow: hidden !important;
}

.mobile-bottom-sheet .list-group-item {
  background: transparent;
  padding: 0.6rem 1.75rem;
  border: none !important; /* Remove loud horizontal lines */
  transition: all 0.2s ease;
  font-weight: 500;
  font-size: 1rem;
  display: flex !important;
  align-items: center;
  gap: 1rem;
}

.mobile-bottom-sheet .list-group-item:active {
  background-color: rgba(var(--bs-primary-rgb), 0.05);
  transform: scale(0.98);
}

.mobile-bottom-sheet .list-group-item i {
  font-size: 1.4rem;
  width: 28px;
  text-align: center;
}

[data-bs-theme="dark"] .mobile-bottom-sheet {
  background: rgba(30, 34, 38, 0.98) !important;
  box-shadow: 0 -20px 60px rgba(0,0,0,0.5);
}

.no-caret::after {
    display: none !important;
}

/* --- Premium Net Worth Card --- */
.nw-accent-line {
  height: 4px;
  width: 100%;
  background: var(--bs-primary);
  border-radius: 10px;
  margin: 1.5rem 0;
  opacity: 0.8;
}

.account-item-premium {
  display: flex;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  transition: all 0.2s ease;
  position: relative;
}

.account-item-premium:last-child {
  border-bottom: none;
}

.account-item-premium:hover {
  background: rgba(0,0,0,0.02);
  transform: translateX(4px);
}

.account-status-bar {
  width: 3px;
  height: 32px;
  border-radius: 4px;
  margin-right: 1.25rem;
  flex-shrink: 0;
}

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

.account-name-bold {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--bs-body-color);
  margin-bottom: 2px;
  display: block;
}

.account-type-subtext {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #6c757d;
  letter-spacing: 0.05em;
}

.account-amount-bold {
  font-weight: 700;
  font-size: 1rem;
  margin-left: 1rem;
  flex-shrink: 0;
}

.text-negative {
  color: #ae2012 !important;
}

/* Dark mode adjustments */
[data-bs-theme="dark"] .account-item-premium {
  border-bottom-color: rgba(255,255,255,0.05);
}

[data-bs-theme="dark"] .account-item-premium:hover {
  background: rgba(255,255,255,0.03);
}

[data-bs-theme="dark"] .account-type-subtext {
  color: #adb5bd;
}

/* --- Demo welcome modal (Orb-style light card; works on dark dashboard theme) --- */
.demo-welcome-modal__dialog {
  max-width: 380px;
  width: min(380px, calc(100vw - 2rem));
  margin-inline: auto;
}

.demo-welcome-modal .modal-content.demo-welcome-modal__shell {
  position: relative;
  border-radius: 1.5rem;
  background-color: #fff !important;
  color: #0a0a0a !important;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow:
    0 40px 90px -24px rgba(15, 23, 42, 0.14),
    0 18px 36px -14px rgba(15, 23, 42, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.85) inset;
  overflow: hidden;
}

.demo-welcome-modal .modal-content.demo-welcome-modal__shell::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse 88% 72% at 0% 100%,
    rgba(34, 211, 238, 0.16) 0%,
    rgba(103, 232, 249, 0.07) 42%,
    transparent 68%
  );
}

.demo-welcome-modal__body {
  position: relative;
  z-index: 1;
  padding: 2rem 2rem 2.125rem;
  background: transparent !important;
  color: #0a0a0a !important;
  text-align: left;
}

.demo-welcome-modal__header {
  margin-bottom: 2.75rem;
}

.demo-welcome-modal__close {
  flex-shrink: 0;
  margin-top: 0.125rem;
  opacity: 0.38;
  padding: 0.5rem;
}

.demo-welcome-modal__close:hover,
.demo-welcome-modal__close:focus {
  opacity: 0.72;
}

.demo-welcome-modal__wordmark {
  font-family:
    "DM Sans",
    "Inter",
    system-ui,
    sans-serif;
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  color: #0a0a0a;
}

.demo-welcome-modal__title {
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  font-size: 1.625rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: #0a0a0a;
  margin: 0;
}

.demo-welcome-modal__lede {
  font-family:
    "DM Sans",
    "Inter",
    system-ui,
    sans-serif;
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.75;
  color: #475569;
  margin-top: 1.25rem;
  margin-bottom: 0;
  max-width: none;
}

.demo-welcome-modal__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 2.25rem;
}

.demo-welcome-modal__cta {
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.5625rem 1.125rem;
  border-radius: 0.5rem;
  border: none;
  background: #0a0a0a;
  color: #fff !important;
  width: auto;
  align-self: flex-end;
}

.demo-welcome-modal__cta:hover,
.demo-welcome-modal__cta:focus-visible {
  background: #262626;
  color: #fff !important;
}

.demo-welcome-modal__cta:focus-visible {
  box-shadow: 0 0 0 3px rgba(0, 85, 255, 0.35);
}

body.demo-welcome-modal-open .modal-backdrop.show {
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background-color: rgba(15, 23, 42, 0.45) !important;
}

/* =============================================================
   Frictionless Layout & Authority Tone
   Appended last so it overrides earlier component-level rules.
   Mirrors the landing's typographic rhythm (Inter + Instrument
   Serif, ss01/cv11 features, eyebrow tracking) and density
   (hairline borders, no zebra tables, airy form rhythm).
   ============================================================= */

:root {
  --leading-tight: 1.15;
  --leading-snug: 1.3;
  --leading-normal: 1.55;
  --leading-relaxed: 1.7;
  --tracking-tight: -0.02em;
  --tracking-normal: 0;
  --tracking-wide: 0.04em;
  --tracking-eyebrow: 0.18em;
  --ledger-amount-font: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
}

body {
  line-height: var(--leading-normal);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, .h1, h2, .h2, h3, .h3 {
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  font-weight: 600;
}

h4, .h4, h5, .h5, h6, .h6 {
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
  font-weight: 600;
}

.font-serif {
  font-family: "Instrument Serif", ui-serif, Georgia, serif;
  font-feature-settings: "liga", "dlig";
  letter-spacing: 0;
}

.eyebrow,
.text-eyebrow {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-eyebrow);
  color: var(--muted-foreground);
}

.num,
.tabular {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum", "ss01";
}

.accounts-op-main {
  display: flex;
  flex-wrap: nowrap;
  align-items: baseline;
  min-width: 0;
  overflow: hidden;
}

.accounts-op-meta:empty,
.accounts-op-date:empty {
  display: none;
}

.accounts-op-meta:not(:empty)::before,
.accounts-op-date:not(:empty)::before {
  content: "·";
  margin: 0 0.65rem;
  color: var(--bs-secondary-color);
}

.accounts-op-amount {
  font-family: var(--ledger-amount-font);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum", "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
}

/* --- Tables: drop the loud stripe, use hairline borders, airier cells --- */
:root {
  --bs-table-striped-bg: transparent;
  --bs-table-border-color: var(--border);
  --bs-table-hover-bg: color-mix(in oklch, var(--accent) 60%, transparent);
}

.table {
  --bs-table-bg: transparent;
  margin-bottom: 0;
  color: var(--foreground);
}

.table > :not(caption) > * > * {
  padding: 0.875rem 1rem;
  border-bottom-color: var(--border);
}

.table > thead > tr > th {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-eyebrow);
  color: var(--muted-foreground);
  border-bottom: 1px solid var(--hairline-strong);
  background: transparent;
}

.table > tbody > tr:last-child > td {
  border-bottom: 0;
}

/* --- Forms: airier inputs, eyebrow labels, hairline borders --- */
.form-control,
.form-select {
  padding: 0.75rem 1rem;
  line-height: var(--leading-snug);
  border-radius: var(--radius);
  border-color: var(--input);
  background-color: var(--card);
  color: var(--foreground);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 18%, transparent);
}

.form-control-lg,
.form-select-lg,
.form-control-xl {
  padding: 0.9rem 1.1rem;
  font-size: 1rem;
}

.form-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-eyebrow);
  color: var(--muted-foreground);
  margin-bottom: 0.5rem;
}

/* Allauth account hub (account/base.html): sentence-case labels + roomier help (password rules, etc.) */
.account-auth-card .form-label {
  text-transform: none;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
  font-weight: 600;
  color: var(--bs-body-color);
  line-height: 1.45;
}

.account-auth-card .form-text {
  line-height: 1.55;
  word-break: break-word;
  margin-top: 0.6rem;
  font-size: 0.875rem;
}

.account-auth-card .form-text ul {
  padding-left: 1.25rem;
  margin-bottom: 0;
  margin-top: 0.35rem;
}

.account-auth-card .account-auth-lead {
  font-size: 0.95rem;
  line-height: 1.55;
  max-width: min(48rem, 100%);
}

.account-auth-card .password_change > .mb-4 {
  margin-bottom: 1.5rem !important;
}

.form-text {
  color: var(--muted-foreground);
  font-size: 0.8125rem;
  line-height: var(--leading-snug);
}

/* Field group rhythm — bump from default 1rem to 1.25rem so groups breathe */
form .mb-3 {
  margin-bottom: 1.25rem !important;
}

/* --- Cards & containers: generous padding, hairline borders, no heavy shadows --- */
.card {
  border-color: var(--border);
  border-radius: calc(var(--radius) + 4px);
  background-color: var(--card);
  color: var(--card-foreground);
  box-shadow: none;
}

.card-body {
  padding: 1.5rem;
}

.card-header,
.card-footer {
  background: transparent;
  border-color: var(--border);
  padding: 1rem 1.5rem;
}

/* --- Pills: match the landing's nav CTA shape --- */
.btn {
  border-radius: 9999px;
  padding: 0.5rem 1.1rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.btn-lg,
.btn-xl {
  padding: 0.75rem 1.5rem;
}

.btn-sm {
  padding: 0.375rem 0.85rem;
}

/* Hairline dividers everywhere */
hr {
  border-top-color: var(--hairline);
  opacity: 1;
}

/* Section spacing helper for marketing/static pages (about, contact, security, etc.) */
.section {
  padding-block: clamp(2.5rem, 6vw, 5rem);
}

/* --- In-app settings shell (Cursor-style rail) --- */
.settings-app-rail-inner {
  min-width: 220px;
  max-width: 260px;
}

.settings-app-nav__divider {
  margin: 0.65rem 0.5rem 0.35rem;
  border: 0;
  border-top: 1px solid var(--bs-border-color);
  opacity: 0.85;
}

.settings-app-nav__divider--risk {
  border-top-color: rgba(var(--bs-danger-rgb), 0.35);
  opacity: 1;
}

.settings-app-nav__link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.65rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--bs-body-color);
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.settings-app-nav__link > i {
  flex: 0 0 1.5rem;
  width: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  line-height: 1;
}

.settings-app-nav__link:hover {
  background-color: var(--bs-tertiary-bg);
  color: var(--bs-body-color);
}

.settings-app-nav__link:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 2px;
}

.settings-app-nav__link.is-active {
  background-color: var(--bs-primary-bg-subtle);
  color: var(--bs-primary);
}

.settings-app-nav__link--plain {
  opacity: 0.95;
}

.settings-app-nav__link--danger {
  color: var(--bs-danger);
}

.settings-app-nav__link--danger:hover {
  background-color: rgba(var(--bs-danger-rgb), 0.08);
  color: var(--bs-danger);
}

.settings-app-nav__link--danger.is-active {
  background-color: rgba(var(--bs-danger-rgb), 0.12);
}

.settings-app-pane {
  min-height: 200px;
}

/* Access — GitHub-style sign-in method rows */
.settings-signin-row__icon {
  flex: 0 0 1.5rem;
  width: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  line-height: 1;
}

.settings-signin-row .form-switch .form-check-input {
  width: 2.5rem;
  height: 1.35rem;
  cursor: pointer;
}

.settings-signin-row__inner {
  flex-wrap: wrap;
}

.settings-signin-row__label-group {
  flex: 0 1 auto;
  min-width: 0;
}

.settings-signin-row__label-group .settings-signin-row__body {
  flex: 0 1 auto;
  min-width: 0;
}

.settings-signin-row__label-group .settings-signin-row__action {
  margin-inline-start: 130px;
  white-space: nowrap;
  flex-shrink: 0;
}

@media (max-width: 575.98px) {
  .settings-signin-row__inner {
    row-gap: 0.75rem;
  }

  .settings-signin-row__label-group {
    flex: 1 1 calc(100% - 2.25rem);
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .settings-signin-row__label-group .settings-signin-row__action {
    margin-inline-start: 30px;
  }

  .settings-signin-row__toggle {
    margin-inline-start: auto;
  }
}

.settings-delete-row {
  border: 1px solid var(--bs-border-color);
  transition: background-color 0.15s ease;
}

.settings-delete-row:hover {
  background-color: var(--bs-tertiary-bg);
}

.settings-delete-row:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 2px;
}

.account-delete-confirm {
  max-width: 32rem;
}

.settings-app-offcanvas .settings-app-nav__link {
  padding: 0.55rem 0.75rem;
}

/* Profile — base currency info popover (Apple-style sheet) */
.profile-currency-info-btn {
  line-height: 1;
  min-width: 1.25rem;
  opacity: 0.5;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.profile-currency-info-btn:hover,
.profile-currency-info-btn:focus-visible {
  opacity: 1;
}

.profile-currency-info-btn[aria-describedby] {
  opacity: 1;
  color: var(--bs-primary);
}

.profile-currency-info-icon {
  font-size: 0.875rem;
  color: var(--bs-secondary-color);
}

.profile-currency-info-btn[aria-describedby] .profile-currency-info-icon {
  color: var(--bs-primary);
}

.popover.popover-profile-currency,
.popover.popover-profile-currency-root {
  --bs-popover-max-width: min(21.5rem, calc(100vw - 2rem));
  position: fixed !important;
  left: var(--pc-popover-left, -10000px) !important;
  top: var(--pc-popover-top, -10000px) !important;
  transform: none !important;
  margin: 0 !important;
  max-height: none;
  --bs-popover-border-width: 0;
  --bs-popover-body-padding-x: 0;
  --bs-popover-body-padding-y: 0;
  --pc-popover-surface: #ffffff;
  --pc-popover-border: rgba(0, 0, 0, 0.08);
  --bs-popover-bg: transparent;
  --pc-popover-shadow:
    0 0 0 1px var(--pc-popover-border),
    0 10px 28px rgba(15, 23, 42, 0.12),
    0 2px 6px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
  width: max-content;
  max-width: min(21.5rem, calc(100vw - 2rem));
  height: auto !important;
  min-height: 0 !important;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* Shell can be taller than the card; do not block clicks on the form below. */
  pointer-events: none;
}

[data-bs-theme="dark"] .popover.popover-profile-currency,
[data-bs-theme="dark"] .popover.popover-profile-currency-root {
  --pc-popover-surface: var(--bs-body-bg);
  --pc-popover-border: rgba(255, 255, 255, 0.12);
  --bs-popover-bg: transparent;
  --pc-popover-shadow:
    0 0 0 1px var(--pc-popover-border),
    0 12px 36px rgba(0, 0, 0, 0.5),
    0 2px 8px rgba(0, 0, 0, 0.35);
}

.popover.popover-profile-currency > .popover-arrow::before,
.popover.popover-profile-currency-root > .popover-arrow::before {
  border-color: transparent;
}

.popover.popover-profile-currency.popover-profile-currency--form-aligned.bs-popover-top
  > .popover-arrow,
.popover.popover-profile-currency-root.popover-profile-currency--form-aligned.bs-popover-top
  > .popover-arrow {
  left: var(--pc-popover-arrow-left, 1.25rem) !important;
  right: auto !important;
  transform: none !important;
}

.popover.popover-profile-currency.bs-popover-top > .popover-arrow::before,
.popover.popover-profile-currency-root.bs-popover-top > .popover-arrow::before {
  border-bottom-color: var(--pc-popover-border);
}

.popover.popover-profile-currency.bs-popover-top > .popover-arrow::after,
.popover.popover-profile-currency-root.bs-popover-top > .popover-arrow::after {
  border-bottom-color: var(--pc-popover-surface);
}

.popover.popover-profile-currency.bs-popover-bottom > .popover-arrow::before,
.popover.popover-profile-currency-root.bs-popover-bottom > .popover-arrow::before {
  border-top-color: var(--pc-popover-border);
}

.popover.popover-profile-currency.bs-popover-bottom > .popover-arrow::after,
.popover.popover-profile-currency-root.bs-popover-bottom > .popover-arrow::after {
  border-top-color: var(--pc-popover-surface);
}

.popover-profile-currency .profile-currency-popover,
.popover-profile-currency-root .profile-currency-popover {
  flex: 0 0 auto;
  width: 100%;
  height: auto !important;
  min-height: 0 !important;
  max-height: none;
  pointer-events: auto;
  padding: 0;
  background-color: var(--pc-popover-surface);
  color: var(--bs-body-color);
  border: none;
  border-radius: 20px;
  box-shadow: var(--pc-popover-shadow);
  overflow: hidden;
}

.profile-currency-popover__inner {
  padding: 0.875rem 1rem 0.75rem;
}

.profile-currency-popover__header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.625rem;
}

.profile-currency-popover__glyph {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(var(--bs-primary-rgb), 0.14), rgba(var(--bs-primary-rgb), 0.06));
  color: var(--bs-primary);
  font-size: 1.05rem;
}

.profile-currency-popover__headcopy {
  min-width: 0;
}

.profile-currency-popover-title {
  margin: 0 0 0.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.25;
  color: var(--bs-body-color);
}

.profile-currency-popover-lead {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--bs-secondary-color);
}

.profile-currency-popover-notes {
  list-style: none;
  margin: 0;
  padding: 0.625rem 0 0;
  border-top: 1px solid var(--pc-popover-border);
}

.profile-currency-popover-notes__item {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.375rem 0;
}

.profile-currency-popover-notes__item:first-child {
  padding-top: 0.5rem;
}

.profile-currency-popover-notes__item:last-child {
  padding-bottom: 0;
}

.profile-currency-popover-notes__icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  margin-top: 0.05rem;
  border-radius: 50%;
  background: rgba(var(--bs-body-color-rgb, 33, 37, 41), 0.06);
  color: var(--bs-secondary-color);
  font-size: 0.7rem;
}

[data-bs-theme="dark"] .profile-currency-popover-notes__icon {
  background: rgba(255, 255, 255, 0.08);
}

.profile-currency-popover-notes__text {
  font-size: 0.8125rem;
  line-height: 1.45;
  letter-spacing: -0.008em;
  color: var(--bs-secondary-color);
}

.popover.popover-profile-currency.popover-profile-currency--aligning,
.popover.popover-profile-currency-root.popover-profile-currency--aligning {
  visibility: hidden !important;
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  .popover.popover-profile-currency.show:not(.popover-profile-currency--aligning),
  .popover.popover-profile-currency-root.show:not(.popover-profile-currency--aligning) {
    animation: profile-currency-popover-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  }
}

@keyframes profile-currency-popover-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.sessions-list__status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sessions-list__status-dot--active {
  background-color: var(--bs-success);
}

.sessions-list__status-dot--stale {
  background-color: var(--bs-secondary);
}
