:root {
  --bg-canvas: #F8F7F4;
  --bg-surface: #FFFFFF;
  --bg-surface-2: #F2EFE9;
  --bg-surface-hover: #EAE5DC;
  --bg-glass: rgba(248, 247, 244, 0.92);

  --border-subtle: #E6E2DA;
  --border-strong: #D1CBC0;

  --text-primary: #1C1917;
  --text-secondary: #57534E;
  --text-muted: #57534E;

  /* Identidad cromática argentina cálida (WCAG AA >= 4.5:1) */
  --accent-primary: #0369A1;       /* Río */
  --accent-primary-hover: #075985;
  --accent-primary-soft: rgba(3, 105, 161, 0.10);
  --accent-primary-fg: #FFFFFF;

  --accent-yerba: #14532D;         /* Yerba: ingresos / positivo / al día */
  --accent-yerba-bar: #15803D;
  --accent-yerba-soft: rgba(21, 128, 61, 0.11);

  --accent-sol: #92400E;           /* Sol: cuotas / alertas */
  --accent-sol-bar: #D97706;
  --accent-sol-soft: rgba(217, 119, 6, 0.14);

  --accent-ladrillo: #B91C1C;      /* Ladrillo: gastos / deuda / error */
  --accent-ladrillo-bar: #DC2626;
  --accent-ladrillo-soft: rgba(220, 38, 38, 0.10);

  --radius-sm: 9px;
  --radius-md: 13px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(28, 25, 23, 0.06), 0 1px 2px rgba(28, 25, 23, 0.04);
  --shadow-md: 0 10px 28px rgba(28, 25, 23, 0.10), 0 2px 8px rgba(28, 25, 23, 0.05);
  --shadow-fab: 0 6px 18px rgba(3, 105, 161, 0.34);

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --sidebar-width: 264px;
  --bottom-nav-height: 70px;
}

[data-theme="dark"] {
  --bg-canvas: #121619;
  --bg-surface: #1B2126;
  --bg-surface-2: #222930;
  --bg-surface-hover: #2A323A;
  --bg-glass: rgba(18, 22, 25, 0.92);

  --border-subtle: #2A323A;
  --border-strong: #3C4752;

  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #8B9AA9;

  --accent-primary: #38BDF8;
  --accent-primary-hover: #0EA5E9;
  --accent-primary-soft: rgba(56, 189, 248, 0.16);
  --accent-primary-fg: #082F49;

  --accent-yerba: #34D399;
  --accent-yerba-bar: #34D399;
  --accent-yerba-soft: rgba(52, 211, 153, 0.15);

  --accent-sol: #FBBF24;
  --accent-sol-bar: #FBBF24;
  --accent-sol-soft: rgba(251, 191, 36, 0.16);

  --accent-ladrillo: #F87171;
  --accent-ladrillo-bar: #F87171;
  --accent-ladrillo-soft: rgba(248, 113, 113, 0.16);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.45);
  --shadow-fab: 0 6px 20px rgba(56, 189, 248, 0.28);
}

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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}

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

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Boot Loader */
.boot-loader {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-secondary);
  font-size: 0.94rem;
  font-weight: 500;
}

.boot-spinner,
.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid var(--border-strong);
  border-top-color: var(--accent-primary);
  animation: spin 0.75s linear infinite;
}

.spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

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

/* Skeleton loading */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-surface-2) 25%,
    var(--bg-surface-hover) 50%,
    var(--bg-surface-2) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-line {
  height: 14px;
  width: 100%;
}

.skeleton-title {
  height: 28px;
  width: 55%;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* App Shell */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg-canvas);
}

.sidebar {
  display: none;
}

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom) + 18px);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.015em;
  min-width: 0;
}

.topbar-brand-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-mark {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 9px;
  overflow: hidden;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.page-container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Mobile bottom nav: >= 44px touch targets */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
}

.bottom-nav-item {
  min-height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 6px 4px;
  transition: color 0.15s ease;
}

.bottom-nav-item.active {
  color: var(--accent-primary);
}

.bottom-nav-fab {
  width: 48px;
  height: 34px;
  border-radius: var(--radius-full);
  background: var(--accent-primary);
  color: var(--accent-primary-fg);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-fab);
  transition: background-color 0.15s ease;
}

.bottom-nav-item:hover .bottom-nav-fab {
  background: var(--accent-primary-hover);
}

@media (min-width: 768px) {
  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    width: var(--sidebar-width);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    gap: 18px;
  }

  .sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
  }

  .sidebar-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    min-height: 44px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.92rem;
    transition: background-color 0.15s ease, color 0.15s ease;
  }

  .sidebar-link:hover {
    background: var(--bg-surface-2);
    color: var(--text-primary);
  }

  .sidebar-link.active {
    background: var(--accent-primary-soft);
    color: var(--accent-primary);
  }

  .sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
  }

  .topbar {
    display: none;
  }

  .topbar-brand-mobile {
    display: none;
  }

  .bottom-nav {
    display: none;
  }

  .receipt-preview-box {
    top: 20px;
  }

  .main-area {
    padding-bottom: 36px;
  }

  .page-container {
    padding: 26px 32px;
    gap: 22px;
  }
}

/* Typography & Utilities */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.page-title {
  margin: 0;
  font-size: 1.48rem;
  font-weight: 750;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

.page-subtitle {
  margin: 3px 0 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.section-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.mono-num,
.num,
.date-text,
input[inputmode="decimal"],
input[type="number"],
input[type="date"] {
  font-variant-numeric: tabular-nums;
}

.mono-num {
  font-family: var(--font-mono);
  white-space: nowrap;
  flex-shrink: 0;
}

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

.text-small {
  font-size: 0.83rem;
}

.text-rio {
  color: var(--accent-primary);
}

.text-yerba {
  color: var(--accent-yerba);
}

.text-sol {
  color: var(--accent-sol);
}

.text-ladrillo {
  color: var(--accent-ladrillo);
}

/* Cards & Grids */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.card-compact {
  padding: 14px 16px;
}

.card-interactive {
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.card-interactive:hover {
  border-color: var(--border-strong);
  background: var(--bg-surface-2);
}

.card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 640px) {
  .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Metric Cards */
.metric-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.metric-label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  font-weight: 700;
}

.metric-value {
  font-size: 1.6rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.025em;
}

.metric-ars {
  color: var(--accent-ladrillo);
}

.metric-usd {
  color: var(--accent-primary);
}

.metric-positive {
  color: var(--accent-yerba);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.2;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent-primary);
  color: var(--accent-primary-fg);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-primary-hover);
}

.btn-secondary {
  background: var(--bg-surface-2);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-surface-hover);
  border-color: var(--border-strong);
}

.btn-danger {
  background: var(--accent-ladrillo-soft);
  border-color: rgba(220, 38, 38, 0.35);
  color: var(--accent-ladrillo);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(220, 38, 38, 0.18);
}

.btn-danger-solid {
  background: var(--accent-ladrillo);
  color: #FFFFFF;
}

.btn-danger-solid:hover:not(:disabled) {
  filter: brightness(0.92);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  min-height: 36px;
  padding: 6px 10px;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-surface-2);
  color: var(--text-primary);
}

.btn-sm {
  min-height: 36px;
  padding: 6px 11px;
  font-size: 0.83rem;
}

.btn-block {
  width: 100%;
}

/* Quick Chips (Hoy/Ayer, filtros) */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.chip-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.chip-btn.active {
  background: var(--accent-primary-soft);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* Forms */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 600px) {
  .form-row-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .form-row-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.input,
.select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

[data-theme="dark"] .input,
[data-theme="dark"] .select {
  background: var(--bg-surface-2);
}

.input:focus,
.select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-soft);
}

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

.input-hero-amount {
  font-size: 1.35rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-primary);
}

/* Badges & Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.015em;
}

.badge-rio {
  background: var(--accent-primary-soft);
  color: var(--accent-primary);
}

.badge-yerba {
  background: var(--accent-yerba-soft);
  color: var(--accent-yerba);
}

.badge-sol {
  background: var(--accent-sol-soft);
  color: var(--accent-sol);
}

.badge-ladrillo {
  background: var(--accent-ladrillo-soft);
  color: var(--accent-ladrillo);
}

.badge-neutral {
  background: var(--bg-surface-hover);
  color: var(--text-secondary);
}

/* Alerts */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 0.89rem;
  border: 1px solid transparent;
}

.alert-danger {
  background: var(--accent-ladrillo-soft);
  border-color: rgba(220, 38, 38, 0.28);
  color: var(--accent-ladrillo);
}

.alert-warning {
  background: var(--accent-sol-soft);
  border-color: rgba(217, 119, 6, 0.30);
  color: var(--accent-sol);
}

.alert-success {
  background: var(--accent-yerba-soft);
  border-color: rgba(21, 128, 61, 0.28);
  color: var(--accent-yerba);
}

.alert-info {
  background: var(--accent-primary-soft);
  border-color: rgba(2, 132, 199, 0.28);
  color: var(--accent-primary);
}

/* Lists & Rows */
.list-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 12px;
  padding: 12px 14px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease;
}

.list-item:hover {
  border-color: var(--border-strong);
}

.list-item-main {
  flex: 1 1 170px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.list-item-title {
  font-weight: 600;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.list-item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.79rem;
  color: var(--text-secondary);
}

.list-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 18px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-2);
  border: 1px dashed var(--border-strong);
}

/* Progress Bar */
.progress-track {
  width: 100%;
  height: 9px;
  background: var(--bg-surface-2);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--accent-yerba-bar);
  transition: width 0.25s ease;
}

.progress-fill.warning {
  background: var(--accent-sol-bar);
}

.progress-fill.danger {
  background: var(--accent-ladrillo-bar);
}

/* Auth Screen */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  background: radial-gradient(circle at top right, var(--accent-primary-soft), transparent 45%),
    var(--bg-canvas);
}

.auth-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 26px 22px;
  box-shadow: var(--shadow-md);
}

/* Scanner & Side-by-side Fallback */
.scanner-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}

@media (min-width: 860px) {
  .scanner-split.has-preview {
    grid-template-columns: minmax(280px, 380px) 1fr;
  }
}

.capture-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 22px 16px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-surface-2);
  text-align: center;
}

.capture-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.receipt-preview-box {
  position: sticky;
  top: 72px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.receipt-preview-img {
  width: 100%;
  max-height: 460px;
  object-fit: contain;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
}

/* Installment preview */
.schedule-preview {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.schedule-list {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.schedule-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 6px 8px;
  border-radius: 7px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

/* Segmented Tabs & Theme Switcher */
.tabs,
.theme-switcher {
  display: inline-flex;
  padding: 4px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  gap: 4px;
}

.theme-switcher {
  width: 100%;
}

.tab-btn,
.theme-btn {
  padding: 7px 12px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 600;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.theme-btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.auth-inline-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 4px;
  font-weight: 600;
}

.tab-btn.active,
.theme-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* Period Selector */
.period-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 4px 8px;
  box-shadow: var(--shadow-sm);
}

.invite-code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-surface-2);
  border: 1.5px solid var(--accent-primary);
  border-radius: var(--radius-md);
}

.invite-code-text {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-primary);
}

/* Subnav pills for Ajustes / Cuentas / Presupuesto / Hogar */
.subnav-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.subnav-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.subnav-pill:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.subnav-pill.active {
  background: var(--accent-primary-soft);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* Toasts */
.toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  left: 16px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

@media (min-width: 640px) {
  .toast-stack {
    left: auto;
    max-width: 390px;
  }
}

.toast {
  pointer-events: auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md);
  font-size: 0.88rem;
  font-weight: 500;
}

.toast-success {
  border-left: 4px solid var(--accent-yerba);
}

.toast-warning {
  border-left: 4px solid var(--accent-sol);
}

.toast-error {
  border-left: 4px solid var(--accent-ladrillo);
}

/* Confirmation Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(18, 22, 25, 0.58);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-dialog {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

@media (max-width: 767px) {
  .btn-sm,
  .btn-ghost,
  .chip-btn,
  .subnav-pill,
  .theme-btn,
  .tab-btn {
    min-height: 44px;
  }

  .btn-ghost {
    min-width: 44px;
  }

  .topbar-actions .btn-ghost {
    min-width: 44px;
    padding: 6px 10px;
  }
}

/* Public Landing */
.landing-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-canvas);
  color: var(--text-primary);
}

.landing-container {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 20px;
}

.landing-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.landing-header-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 8px;
  padding-bottom: 8px;
}

.landing-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  text-decoration: none;
}

.landing-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.landing-locale-wrap {
  max-width: 240px;
}

.landing-hero {
  padding: 56px 0 36px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  max-width: 760px;
}

.landing-hero-title {
  margin: 0;
  font-size: clamp(1.85rem, 4vw, 2.75rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.landing-hero-subtitle {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.landing-hero-ctas {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.landing-section {
  padding: 28px 0;
}

.landing-section-title {
  margin: 0 0 16px;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.landing-feature-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.landing-feature-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--accent-primary-soft);
  color: var(--accent-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.landing-pricing-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.landing-check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
}

.landing-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
  padding: 22px 0;
  background: var(--bg-surface);
}

.landing-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.landing-footer-links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-weight: 600;
}

/* Guided Onboarding */
.onboarding-card {
  border-color: var(--accent-primary);
}

.onboarding-progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.onboarding-progress-wrap .progress-track {
  flex: 1;
}

.onboarding-step-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

/* Native SVG Charts */
.chart-donut-layout {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.chart-donut-svg-wrap {
  position: relative;
  width: 160px;
  height: 160px;
  margin: 0 auto;
}

.chart-donut-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.chart-donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  padding: 24px;
}

.chart-legend-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.chart-legend-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chart-legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.86rem;
}

.chart-legend-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.chart-bar-svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-bar-group {
  cursor: pointer;
}

.chart-trend-readout {
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 640px) {
  .landing-hero {
    padding: 32px 0 22px;
  }

  .landing-locale-wrap {
    width: 100%;
    max-width: none;
  }

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