/* ============================================================
   AyC Wallet - Design System
   Finanzas personales y compartidas en CLP (Chile)
   Design Plan: Chilean bill green (#006d4c) as brand anchor
   ============================================================ */

/* CSS Variables - Design Tokens */
.hidden { display: none !important; }

:root {
  /* ---- Color: Base ---- */
  --ink: #0f171e;
  --ink-subtle: #5a6a7a;
  --paper: #f8fafc;
  --paper-elevated: #ffffff;
  --border: #dfe6ed;
  --border-strong: #c8d4df;

  /* ---- Color: Brand - Verde Billete Chileno (CLP $10k/$20k bills) ---- */
  --clp-green: #006d4c;
  --clp-green-dark: #004d33;
  --clp-green-light: #e6f4ef;
  --clp-green-glow: rgba(0, 109, 76, 0.15);

  /* ---- Color: Semánticos Locales (CLP Context) ---- */
  --income: #007a33;
  --income-hover: #00662a;
  --income-light: #e8f5ed;
  --expense: #c02828;
  --expense-hover: #a02020;
  --expense-light: #fdf0f0;
  --shared: #b85c00;
  --shared-hover: #964a00;
  --shared-light: #fff7e8;

  /* ---- Color: Accent - Dorado Monedas CLP ---- */
  --accent-gold: #d4a017;
  --accent-gold-hover: #b88a14;
  --accent-gold-light: #fef9e7;

  /* ---- Color: Warning / Pending ---- */
  --warning: #f59e0b;
  --warning-light: #fef3c7;

  /* ---- Shadows ---- */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.04);
  --shadow-md: 0 4px 8px -2px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.04);
  --shadow-lg: 0 12px 24px -4px rgb(0 0 0 / 0.1), 0 4px 8px -4px rgb(0 0 0 / 0.06);
  --shadow-xl: 0 20px 40px -8px rgb(0 0 0 / 0.12), 0 8px 16px -8px rgb(0 0 0 / 0.08);

  /* ---- Spacing Scale (4px base) ---- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* ---- Border Radius ---- */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-2xl: 28px;
  --radius-full: 9999px;

  /* ---- Transitions ---- */
  --transition-fast: 100ms ease;
  --transition-normal: 200ms ease;
  --transition-slow: 300ms ease;

  /* ---- Typography ---- */
  --font-display: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-ui: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

  /* Type Scale */
  --text-xs: 0.75rem;      /* 12px */
  --text-sm: 0.875rem;     /* 14px */
  --text-base: 1rem;       /* 16px */
  --text-lg: 1.125rem;     /* 18px */
  --text-xl: 1.5rem;       /* 24px */
  --text-2xl: 2rem;        /* 32px */
  --text-3xl: 3rem;        /* 48px */

  /* Line Heights */
  --leading-tight: 1.1;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;

  /* Font Weights */
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* Z-index */
  --z-dropdown: 100;
  --z-sticky: 150;
  --z-modal: 200;
  --z-toast: 300;
  --z-loading: 400;

  /* Chart Colors (CVD accessible) */
  --chart-1: #c02828;  /* expense */
  --chart-2: #006d4c;  /* brand */
  --chart-3: #007a33;  /* income */
  --chart-4: #b85c00;  /* shared */
  --chart-5: #7c3aed;
  --chart-6: #ec4899;
  --chart-7: #0ea5e9;
}

/* Dark Mode - Reduced contrast, desaturated accents, same hierarchy */
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8edf2;
    --ink-subtle: #9aaabd;
    --paper: #0b1218;
    --paper-elevated: #111a22;
    --border: #2a3642;
    --border-strong: #3a4a5a;
    --clp-green-light: rgba(0, 109, 76, 0.15);
    --income-light: rgba(0, 122, 51, 0.15);
    --expense-light: rgba(192, 40, 40, 0.15);
    --shared-light: rgba(184, 92, 0, 0.15);
    --accent-gold-light: rgba(212, 160, 23, 0.15);
    --warning-light: rgba(245, 158, 11, 0.15);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.2);
    --shadow-md: 0 4px 8px -2px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.2);
    --shadow-lg: 0 12px 24px -4px rgb(0 0 0 / 0.4), 0 4px 8px -4px rgb(0 0 0 / 0.2);
    --shadow-xl: 0 20px 40px -8px rgb(0 0 0 / 0.5), 0 8px 16px -8px rgb(0 0 0 / 0.3);
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: var(--font-ui);
  background: var(--paper);
  color: var(--ink);
  line-height: var(--leading-normal);
  min-height: 100vh;
  font-weight: var(--weight-normal);
}

/* Focus Visible - ALL interactive elements */
:focus-visible {
  outline: 2px solid var(--clp-green);
  outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }

/* Selection */
::selection { background: var(--clp-green-light); color: var(--clp-green); }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-subtle); }

/* ============================================================
   Screen Management
   ============================================================ */
.screen { display: none; position: fixed; inset: 0; overflow-y: auto; }
.screen.active { display: block; }

/* Loading Screen */
#loading-screen {
  display: none; flex-direction: column; align-items: center; justify-content: center;
  background: var(--paper-elevated); z-index: var(--z-loading);
}
#loading-screen.active { display: flex; }
.loading-spinner {
  width: 40px; height: 40px; border: 3px solid var(--border);
  border-top-color: var(--clp-green); border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading-screen p { margin-top: var(--space-4); color: var(--ink-subtle); font-size: var(--text-sm); }

/* ============================================================
   Login Screen - Hero con Propuesta de Valor
   ============================================================ */
.login-container {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--space-6) var(--space-4); text-align: center;
}
.login-hero { width: 100%; max-width: 420px; }
.login-logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 72px; height: 72px; border-radius: var(--radius-xl);
  background: var(--clp-green); color: var(--paper-elevated);
  margin-bottom: var(--space-6);
}
.login-logo svg { width: 36px; height: 36px; }
.login-hero h1 {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  color: var(--ink);
  margin-bottom: var(--space-3);
}
.login-subtitle {
  font-size: var(--text-base);
  color: var(--ink-subtle);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-8);
}
.login-subtitle br { display: none; }
@media (max-width: 480px) { .login-subtitle br { display: inline; } }

#google-signin-button { margin-bottom: var(--space-6); }

.login-trust {
  display: flex; justify-content: center; gap: var(--space-6);
  font-size: var(--text-xs);
  color: var(--ink-subtle);
  flex-wrap: wrap;
}
.login-trust span { display: inline-flex; align-items: center; gap: var(--space-1); }

.login-footer {
  margin-top: var(--space-8);
  font-size: var(--text-xs);
  color: var(--ink-subtle);
}
.login-footer a { color: var(--clp-green); text-decoration: none; }
.login-footer a:hover { text-decoration: underline; }

.error-message {
  display: inline-flex; align-items: center; gap: var(--space-2);
  background: var(--expense-light); color: var(--expense);
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
  font-size: var(--text-sm); font-weight: var(--weight-medium);
  margin-bottom: var(--space-4); width: 100%; max-width: 420px;
}
.error-message.hidden { display: none; }

/* ============================================================
   Dashboard Header - Sticky
   ============================================================ */
.dashboard-header {
  position: sticky; top: 0; z-index: var(--z-sticky);
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-4) var(--space-5); background: var(--paper-elevated);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  background: rgba(248, 250, 252, 0.95);
}
@media (prefers-color-scheme: dark) {
  .dashboard-header { background: rgba(11, 18, 24, 0.95); border-bottom-color: var(--border); }
}
.dashboard-header h1 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--ink);
}
#welcome-greeting {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--ink-subtle);
}

/* User Menu */
.header-right {
  display: flex;
  align-items: center;
}

.user-menu { position: relative; }
.avatar-btn {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--radius-full);
  background: var(--clp-green-light); color: var(--clp-green);
  border: none; cursor: pointer; transition: var(--transition-fast);
  font-weight: var(--weight-semibold); font-size: var(--text-sm);
}
.avatar-btn:hover { background: var(--clp-green); color: var(--paper-elevated); }
.avatar { text-transform: uppercase; letter-spacing: 0.02em; }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 220px;
  background: var(--paper-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden;
  z-index: var(--z-dropdown);
}
.dropdown.hidden { display: none; }
.dropdown-header { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
.dropdown-name { display: block; font-weight: var(--weight-semibold); font-size: var(--text-base); color: var(--ink); }
.dropdown-email { display: block; font-size: var(--text-xs); color: var(--ink-subtle); margin-top: var(--space-1); }
.dropdown-divider { border: none; border-top: 1px solid var(--border); margin: var(--space-1) 0; }
.dropdown-item {
  width: 100%; display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4); background: none; border: none;
  color: var(--ink); font-size: var(--text-sm); font-family: inherit;
  cursor: pointer; transition: var(--transition-fast); text-align: left;
}
.dropdown-item:hover { background: var(--paper); }
.dropdown-item.danger { color: var(--expense); }
.dropdown-item.danger:hover { background: var(--expense-light); }

/* ============================================================
   Main Content
   ============================================================ */
.dashboard-main { padding: var(--space-5); max-width: 1200px; margin: 0 auto; }

/* Section Header */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-4); }
.section-header h2 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--ink);
}

/* ============================================================
   Buttons - Sistema Unificado
   ============================================================ */
.btn-primary, .btn-secondary, .btn-ghost, .btn-link, .icon-btn, .btn-submit {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  font-family: var(--font-ui); font-size: var(--text-sm); font-weight: var(--weight-semibold);
  border-radius: var(--radius-md); cursor: pointer; transition: var(--transition-fast);
  border: none; text-decoration: none; white-space: nowrap;
  min-height: 44px; /* Touch target */
}
.btn-primary { background: var(--clp-green); color: var(--paper-elevated); padding: var(--space-2) var(--space-5); }
.btn-primary:hover { background: var(--clp-green-dark); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: var(--paper-elevated); color: var(--ink); border: 1px solid var(--border); padding: var(--space-2) var(--space-5); }
.btn-secondary:hover { background: var(--paper); border-color: var(--border-strong); }
.btn-ghost { background: transparent; color: var(--ink-subtle); padding: var(--space-2) var(--space-4); }
.btn-ghost:hover { background: var(--paper); color: var(--ink); }
.btn-link { background: none; color: var(--clp-green); padding: var(--space-1) var(--space-2); font-size: var(--text-sm); }
.btn-link:hover { text-decoration: underline; }
.icon-btn { width: 40px; height: 40px; padding: 0; border-radius: var(--radius-full); background: var(--paper-elevated); border: 1px solid var(--border); color: var(--ink-subtle); }
.icon-btn:hover { background: var(--paper); color: var(--ink); border-color: var(--border-strong); }
.btn-wide { flex: 1; }

/* Button sizes */
.btn-sm { padding: var(--space-1) var(--space-3); font-size: var(--text-xs); min-height: 36px; }
.btn-lg { padding: var(--space-3) var(--space-6); font-size: var(--text-base); }

/* Button variants */
.btn-danger { background: var(--expense); color: var(--paper-elevated); }
.btn-danger:hover { background: var(--expense-hover); }
.btn-shared { background: var(--shared); color: var(--paper-elevated); }
.btn-shared:hover { background: var(--shared-hover); }
.btn-gold { background: var(--accent-gold); color: var(--ink); }
.btn-gold:hover { background: var(--accent-gold-hover); }

/* Form Actions */
.form-actions { display: flex; gap: var(--space-3); margin-top: var(--space-8); padding-top: var(--space-6); border-top: 1px solid var(--border); }
.form-actions .btn-secondary { flex: 1; }
.form-actions .btn-primary { flex: 1; }

/* ============================================================
   HERO BALANCE - El Momento Memorable
   ============================================================ */
.balance-hero {
  background: linear-gradient(135deg, var(--clp-green-light) 0%, var(--paper) 100%);
  border: 1px solid var(--clp-green);
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-6);
  text-align: center;
  margin-bottom: var(--space-6);
  position: relative;
  overflow: hidden;
}
.balance-hero::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--clp-green), var(--income), var(--accent-gold));
}
.balance-hero__label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-subtle);
  margin-bottom: var(--space-2);
}
.balance-hero__amount {
  font-family: var(--font-mono);
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  line-height: var(--leading-tight);
  animation: countUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}
.balance-hero__amount.positive { color: var(--income); }
.balance-hero__amount.negative { color: var(--expense); }
@keyframes countUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.balance-hero__breakdown {
  display: flex; justify-content: center; gap: var(--space-3);
  margin-top: var(--space-6); flex-wrap: wrap;
}
.balance-pill {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--paper-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  font-family: var(--font-ui);
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}
.balance-pill:nth-child(1) { animation-delay: 0.1s; }
.balance-pill:nth-child(2) { animation-delay: 0.15s; }
.balance-pill:nth-child(3) { animation-delay: 0.2s; }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.balance-pill__icon { width: 14px; height: 14px; flex-shrink: 0; }
.balance-pill--income { color: var(--income); border-color: var(--income-light); }
.balance-pill--expense { color: var(--expense); border-color: var(--expense-light); }
.balance-pill--shared { color: var(--shared); border-color: var(--shared-light); }
.balance-pill__label { font-weight: var(--weight-medium); color: var(--ink-subtle); }
.balance-pill__value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Empty state for balance hero when no data */
.balance-hero--empty .balance-hero__amount { font-size: var(--text-2xl); color: var(--ink-subtle); }
.balance-hero--empty .balance-hero__breakdown { display: none; }

/* ============================================================
   Quick Actions - Sticky Bottom en Móvil
   ============================================================ */
.quick-actions {
  display: flex; gap: var(--space-3); margin-bottom: var(--space-6);
  padding: 0 var(--space-1);
}
.quick-actions .btn-primary { flex: 1; }
@media (min-width: 768px) {
  .quick-actions { max-width: 400px; margin-left: auto; margin-right: auto; }
}

/* ============================================================
   Bottom Navigation (Mobile)
   ============================================================ */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: var(--z-sticky);
  background: var(--paper-elevated); border-top: 1px solid var(--border);
  padding: var(--space-2) var(--space-3); gap: var(--space-1);
  justify-content: space-around; align-items: center;
}
@media (max-width: 640px) {
  .bottom-nav { display: flex; }
  .dashboard-main { padding-bottom: 88px; }
}
.bottom-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: var(--space-1) var(--space-2); border-radius: var(--radius-md);
  background: transparent; border: none; color: var(--ink-subtle);
  font-size: var(--text-xs); font-family: inherit; cursor: pointer;
  transition: var(--transition-fast); min-width: 60px;
}
.bottom-nav-item:hover { background: var(--paper); color: var(--ink); }
.bottom-nav-item.active { color: var(--clp-green); }
.bottom-nav-item.active svg { color: var(--clp-green); }
.bottom-nav-item svg { width: 22px; height: 22px; }
.bottom-nav-item span { font-weight: var(--weight-semibold); }

/* ============================================================
   Account Cards (Carteras/Cuentas)
   ============================================================ */
.accounts-section { margin-bottom: var(--space-8); }
.accounts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space-4); }
@media (max-width: 480px) { .accounts-grid { grid-template-columns: 1fr; } }

.account-card {
  background: var(--paper-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--space-5);
  transition: var(--transition-normal);
  position: relative;
}
.account-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); transform: translateY(-1px); }

.account-card__header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: var(--space-4); }
.account-icon {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: var(--radius-md);
  background: var(--clp-green-light); color: var(--clp-green);
  font-size: 1.25rem; flex-shrink: 0;
}
.account-icon--shared { background: var(--shared-light); color: var(--shared); }
.account-icon--pyme { background: var(--accent-gold-light); color: var(--accent-gold); }

.account-type { display: inline-flex; align-items: center; gap: var(--space-1); padding: var(--space-1) var(--space-2); font-size: var(--text-xs); font-weight: var(--weight-semibold); border-radius: var(--radius-full); text-transform: uppercase; letter-spacing: 0.05em; }
.account-type--personal { background: var(--clp-green-light); color: var(--clp-green); }
.account-type--shared { background: var(--shared-light); color: var(--shared); }
.account-type--pyme { background: var(--accent-gold-light); color: var(--accent-gold); }

.account-name { font-size: var(--text-base); font-weight: var(--weight-semibold); color: var(--ink); margin-bottom: var(--space-1); line-height: var(--leading-tight); }
.account-balance { display: flex; flex-direction: column; gap: var(--space-1); margin-bottom: var(--space-4); }
.balance-label { font-size: var(--text-xs); color: var(--ink-subtle); text-transform: uppercase; letter-spacing: 0.05em; }
.balance-amount { font-family: var(--font-mono); font-size: var(--text-2xl); font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; color: var(--ink); }
.balance-amount.positive { color: var(--income); }
.balance-amount.negative { color: var(--expense); }
.balance-amount.zero { color: var(--ink-subtle); }

/* Sparkline */
.account-sparkline { height: 40px; margin-bottom: var(--space-4); opacity: 0.8; }
.account-sparkline svg { width: 100%; height: 100%; }

.account-actions { display: flex; gap: var(--space-2); padding-top: var(--space-4); border-top: 1px solid var(--border); }
.account-actions .btn-ghost { flex: 1; font-size: var(--text-xs); padding: var(--space-2) var(--space-3); }

.account-empty { grid-column: 1 / -1; text-align: center; padding: var(--space-12) var(--space-4); color: var(--ink-subtle); }
.account-empty svg { width: 64px; height: 64px; margin-bottom: var(--space-4); opacity: 0.4; }
.account-empty p { margin-bottom: var(--space-4); font-size: var(--text-base); }

/* ============================================================
   Transactions List
   ============================================================ */
.transactions-section { margin-bottom: var(--space-8); }
.transactions-list { display: flex; flex-direction: column; gap: var(--space-2); }
.transaction-item {
  display: flex; align-items: center; gap: var(--space-3);
  background: var(--paper-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: var(--space-3) var(--space-4);
  transition: var(--transition-fast); cursor: pointer;
}
.transaction-item:hover { border-color: var(--border-strong); background: var(--paper); transform: translateX(2px); }
.transaction-item:active { transform: translateX(0); }

.transaction-icon {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-md); flex-shrink: 0;
}
.transaction-icon.income { background: var(--income-light); color: var(--income); }
.transaction-icon.expense { background: var(--expense-light); color: var(--expense); }
.transaction-icon.shared { background: var(--shared-light); color: var(--shared); }

.transaction-details { flex: 1; min-width: 0; }
.transaction-description { font-weight: var(--weight-medium); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.transaction-meta { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-1); font-size: var(--text-xs); color: var(--ink-subtle); flex-wrap: wrap; }
.transaction-scope { padding: var(--space-1) var(--space-2); background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: var(--weight-semibold); text-transform: capitalize; }
.transaction-scope.personal { color: var(--clp-green); border-color: var(--clp-green-light); background: var(--clp-green-light); }
.transaction-scope.shared { color: var(--shared); border-color: var(--shared-light); background: var(--shared-light); }
.transaction-account { font-weight: var(--weight-medium); }

.transaction-amount { font-family: var(--font-mono); font-weight: var(--weight-bold); font-size: var(--text-base); font-variant-numeric: tabular-nums; white-space: nowrap; }
.transaction-amount.income { color: var(--income); }
.transaction-amount.expense { color: var(--expense); }

/* Empty State */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: var(--space-10) var(--space-4); color: var(--ink-subtle); }
.empty-state svg { width: 64px; height: 64px; margin-bottom: var(--space-4); opacity: 0.4; }
.empty-state p { margin-bottom: var(--space-4); font-size: var(--text-base); }

/* ============================================================
   Forms - Sistema Unificado
   ============================================================ */
.form-section { margin-bottom: var(--space-6); }
.form-section legend,
.form-section h3 { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--ink-subtle); margin-bottom: var(--space-3); text-transform: uppercase; letter-spacing: 0.05em; }

.field { margin-bottom: var(--space-4); }
.field label { display: block; font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--ink); margin-bottom: var(--space-2); }
.field input, .field select, .field textarea {
  width: 100%; padding: var(--space-3) var(--space-4); font-family: inherit; font-size: var(--text-base);
  background: var(--paper-elevated); border: 1px solid var(--border); border-radius: var(--radius-md);
  color: var(--ink); transition: var(--transition-fast);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--clp-green); box-shadow: 0 0 0 3px var(--clp-green-light); }
.field input::placeholder { color: var(--ink-subtle); }
.field input.error, .field select.error { border-color: var(--expense); }
.field input.error:focus, .field select.error:focus { box-shadow: 0 0 0 3px var(--expense-light); }
.field-hint { font-size: var(--text-xs); color: var(--ink-subtle); margin-top: var(--space-1); }
.field-error { font-size: var(--text-xs); color: var(--expense); margin-top: var(--space-1); display: none; }
.field input.error + .field-error { display: block; }

/* Amount Input - Mono, Large, Formateo en Vivo */
.amount-input-wrapper { position: relative; display: flex; align-items: center; }
.currency-prefix {
  position: absolute; left: var(--space-4); color: var(--ink-subtle);
  font-family: var(--font-mono); font-size: var(--text-lg); font-weight: var(--weight-bold);
  pointer-events: none; z-index: 1;
}
.amount-input {
  width: 100%; padding: var(--space-3) var(--space-4) var(--space-3) calc(var(--space-4) + 1.5rem) !important;
  font-family: var(--font-mono) !important; font-size: var(--text-xl) !important; font-weight: var(--weight-bold) !important;
  font-variant-numeric: tabular-nums; letter-spacing: 0.02em;
  text-align: right;
}
.amount-input::placeholder { color: var(--ink-subtle); font-weight: var(--weight-normal); }

/* Type Chips - Reemplaza Radio Buttons */
.type-picker { margin-bottom: var(--space-2); }
.type-chips { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.type-chip {
  flex: 1; min-width: 100px; cursor: pointer; position: relative;
  border: 2px solid var(--border); border-radius: var(--radius-lg);
  background: var(--paper-elevated); padding: var(--space-4) var(--space-3);
  transition: var(--transition-fast); text-align: center;
}
.type-chip:hover { border-color: var(--border-strong); }
.type-chip input { position: absolute; opacity: 0; pointer-events: none; }
.type-chip input:checked + .chip-content { border-color: currentColor; box-shadow: 0 0 0 3px currentColor; }
.type-chip--income .chip-content { color: var(--income); }
.type-chip--income input:checked + .chip-content { box-shadow-color: var(--income-light); border-color: var(--income); }
.type-chip--expense .chip-content { color: var(--expense); }
.type-chip--expense input:checked + .chip-content { box-shadow-color: var(--expense-light); border-color: var(--expense); }
.type-chip--shared .chip-content { color: var(--shared); }
.type-chip--shared input:checked + .chip-content { box-shadow-color: var(--shared-light); border-color: var(--shared); }
.chip-icon { font-size: 1.5rem; display: block; margin-bottom: var(--space-2); }
.chip-label { display: block; font-weight: var(--weight-semibold); font-size: var(--text-base); margin-bottom: var(--space-1); }
.chip-hint { display: block; font-size: var(--text-xs); color: var(--ink-subtle); font-weight: var(--weight-normal); }

/* Select con Balance Visible */
.field select option { padding: var(--space-2) var(--space-3); }
.field select optgroup { font-weight: var(--weight-semibold); color: var(--ink-subtle); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.05em; }

/* Recurring Section - Progressive Disclosure */
.recurring-section { border-top: 1px solid var(--border); padding-top: var(--space-4); margin-top: var(--space-4); }
.recurring-toggle { margin-bottom: var(--space-4); }
.toggle-label { display: flex; align-items: center; justify-content: space-between; cursor: pointer; gap: var(--space-3); }
.toggle-text { font-weight: var(--weight-medium); color: var(--ink); }
.switch { position: relative; width: 48px; height: 28px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; background: var(--border); border-radius: var(--radius-full);
  transition: var(--transition-fast);
}
.slider::before {
  content: ''; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px;
  background: var(--paper-elevated); border-radius: 50%; box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
}
.switch input:checked + .slider { background: var(--clp-green); }
.switch input:checked + .slider::before { transform: translateX(20px); }
.recurring-fields { animation: slideDown 0.2s ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.recurring-fields.hidden { display: none; }

/* Receipt Dropzone - Camera First */
.receipt-dropzone {
  position: relative; border: 2px dashed var(--border); border-radius: var(--radius-lg);
  background: var(--paper); transition: var(--transition-fast); min-height: 120px;
}
.receipt-dropzone:hover, .receipt-dropzone.drag-active { border-color: var(--clp-green); background: var(--clp-green-light); }
.receipt-dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 1; }
.dropzone-prompt { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--space-8) var(--space-4); text-align: center; pointer-events: none; }
.camera-icon { font-size: 2rem; margin-bottom: var(--space-2); }
.dropzone-prompt span { font-weight: var(--weight-medium); color: var(--ink); margin-bottom: var(--space-1); }
.dropzone-prompt small { color: var(--ink-subtle); font-size: var(--text-xs); }
.receipt-previews { display: flex; gap: var(--space-2); padding: var(--space-3); flex-wrap: wrap; }
.receipt-preview-item { position: relative; width: 60px; height: 60px; border-radius: var(--radius-md); overflow: hidden; flex-shrink: 0; }
.receipt-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.receipt-preview-item button { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--expense); color: var(--paper-elevated); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 12px; line-height: 1; opacity: 0; transition: var(--transition-fast); }
.receipt-preview-item:hover button { opacity: 1; }
.receipt-file-names { display: block; margin-top: var(--space-2); font-size: var(--text-xs); color: var(--ink-subtle); }

/* ============================================================
   Modal System
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(11, 18, 24, 0.5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: var(--space-4);
  z-index: var(--z-modal); animation: fadeIn 0.2s ease;
}
.modal-overlay.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { width: 100%; max-width: 440px; background: var(--paper-elevated); border-radius: var(--radius-xl); box-shadow: var(--shadow-xl); overflow: hidden; animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border); }
.modal-header h3 { font-family: var(--font-display); font-size: var(--text-lg); font-weight: var(--weight-semibold); color: var(--ink); }
.modal-form { padding: var(--space-5); }
.modal-form .field { margin-bottom: var(--space-4); }
.modal-form .field:last-of-type { margin-bottom: 0; }
.modal-actions { display: flex; gap: var(--space-3); margin-top: var(--space-6); padding-top: var(--space-4); border-top: 1px solid var(--border); }
.modal-actions .btn-secondary { flex: 1; }
.modal-actions .btn-primary { flex: 1; }

/* ============================================================
   Wallet Detail Modal
   ============================================================ */
.wallet-detail-modal { max-width: 900px; max-height: 92vh; display: flex; flex-direction: column; }
.wallet-detail-modal .modal-header > div { display: grid; gap: var(--space-1); }
.wallet-detail-modal .modal-header h3 { margin: 0; }
.wallet-detail-content { padding: var(--space-5); overflow-y: auto; flex: 1; }
.wallet-detail-balance { display: flex; justify-content: space-between; align-items: center; padding: var(--space-4); border-radius: var(--radius-md); background: var(--paper); border: 1px solid var(--border); margin-bottom: var(--space-4); }
.wallet-detail-balance span { color: var(--ink-subtle); font-size: var(--text-sm); }
.wallet-detail-balance strong { font-family: var(--font-mono); font-size: var(--text-xl); font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; }
.wallet-detail-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); margin: var(--space-4) 0; }
@media (max-width: 600px) { .wallet-detail-kpis { grid-template-columns: 1fr; } }
.wallet-detail-kpis article { display: grid; gap: var(--space-2); min-width: 0; padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--paper); }
.wallet-detail-kpis span { color: var(--ink-subtle); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.05em; }
.wallet-detail-kpis strong { font-family: var(--font-mono); font-size: var(--text-lg); font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.wallet-detail-kpis article:first-child strong { color: var(--income); }
.wallet-detail-kpis article:nth-child(2) strong { color: var(--expense); }
.wallet-detail-kpis article:nth-child(3) strong { color: var(--shared); }
.wallet-detail-period-note { margin: calc(-1 * var(--space-2)) 0 var(--space-3); color: var(--ink-subtle); font-size: var(--text-xs); }
.wallet-detail-section { border-top: 1px solid var(--border); padding: var(--space-4) 0; }
.wallet-detail-section h4 { font-family: var(--font-display); font-size: var(--text-base); font-weight: var(--weight-semibold); margin: 0 0 var(--space-3); color: var(--ink); }
.wallet-detail-section .section-header { margin-bottom: var(--space-3); }
.wallet-chart-legend { display: flex; gap: var(--space-4); color: var(--ink-subtle); font-size: var(--text-xs); margin: var(--space-3) 0; }
.wallet-chart-legend span { display: inline-flex; align-items: center; gap: var(--space-2); }
.wallet-chart-legend i { width: 9px; height: 9px; border-radius: 50%; }
.income-dot { background: var(--income); }
.expense-dot { background: var(--expense); }
.wallet-month-chart { height: 180px; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--space-3); border-bottom: 1px solid var(--border); padding: var(--space-2) var(--space-2) 0; }
@media (max-width: 600px) { .wallet-month-chart { gap: var(--space-1); } }
.wallet-month-column { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: var(--space-2); min-width: 0; }
.wallet-month-bars { height: 145px; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 4px; }
.wallet-month-bars span { width: min(30%, 20px); min-height: 0; border-radius: 4px 4px 0 0; }
.wallet-month-bars .income-bar { background: var(--income); }
.wallet-month-bars .expense-bar { background: var(--expense); }
.wallet-month-column small { color: var(--ink-subtle); font-size: var(--text-xs); text-transform: capitalize; }
.wallet-detail-transactions, .wallet-detail-subscriptions { display: grid; gap: var(--space-2); }
.wallet-detail-tx, .wallet-detail-subscriptions article { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--border); text-align: left; background: transparent; color: inherit; cursor: pointer; border-left: 0; border-right: 0; border-top: 0; }
.wallet-detail-tx:hover { background: var(--paper); border-radius: var(--radius-sm); }
.wallet-detail-tx > span, .wallet-detail-subscriptions article > span { display: grid; gap: var(--space-1); min-width: 0; }
.wallet-detail-tx strong, .wallet-detail-subscriptions strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wallet-detail-tx small, .wallet-detail-subscriptions small { color: var(--ink-subtle); font-size: var(--text-xs); }
.wallet-detail-tx b, .wallet-detail-subscriptions b { white-space: nowrap; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: var(--text-sm); }
.wallet-detail-tx b.positive { color: var(--income); }
.wallet-detail-tx b.negative { color: var(--expense); }
.wallet-subscription-alert { display: grid; gap: var(--space-1); margin: var(--space-3) 0; padding: var(--space-3); border: 1px solid var(--expense); border-radius: var(--radius-md); background: var(--expense-light); color: var(--expense); }
.wallet-subscription-alert span { font-size: var(--text-sm); }
.wallet-detail-subscriptions article.subscription-insufficient { border-left: 3px solid var(--expense); padding-left: var(--space-2); }
.wallet-recurring-cancel { flex: 0 0 auto; border: 1px solid var(--expense); border-radius: var(--radius-sm); background: transparent; color: var(--expense); padding: var(--space-1) var(--space-2); font-size: var(--text-xs); font-family: inherit; cursor: pointer; }
.wallet-recurring-cancel:disabled { opacity: .55; cursor: wait; }
.subscriptions-intro { max-width: 760px; margin: 0 auto var(--space-4); color: var(--ink-subtle); font-size: var(--text-sm); }
.subscriptions-list { display: grid; gap: var(--space-3); max-width: 900px; margin: 0 auto; }
.subscriptions-empty { padding: var(--space-6); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--paper); text-align: center; }
.subscriptions-empty p { color: var(--ink-subtle); }
.subscription-card { display: grid; gap: var(--space-3); padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--paper-elevated); }
.subscription-card-main { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.subscription-card h2 { margin: 0; font-size: var(--text-base); font-weight: var(--weight-semibold); }
.subscription-card p { margin: var(--space-1) 0; color: var(--ink-subtle); font-size: var(--text-sm); }
.subscription-card small { color: var(--ink-subtle); font-size: var(--text-xs); }
.subscription-state { flex: 0 0 auto; padding: var(--space-1) var(--space-2); border-radius: var(--radius-full); background: var(--income-light); color: var(--income); font-size: var(--text-xs); font-weight: var(--weight-semibold); }
.subscription-ended .subscription-state { background: var(--paper); color: var(--ink-subtle); }
.subscription-card-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-2); border-top: 1px solid var(--border); padding-top: var(--space-3); }
.subscription-card-actions button { padding: var(--space-2) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-sm); background: transparent; color: var(--ink); font: inherit; font-size: var(--text-xs); cursor: pointer; }
.subscription-card-actions .danger { border-color: var(--expense); color: var(--expense); }
.subscription-card-actions button:disabled { opacity: .55; cursor: wait; }
.wallet-detail-count { color: var(--ink-subtle); font-size: var(--text-xs); }
.transaction-receipt-picker { width: fit-content; }
.transaction-form .receipt-file-names { display: block; margin-top: var(--space-2); white-space: normal; }
.wallet-actions { flex-wrap: wrap; }
.wallet-actions .btn-wallet-edit { font-size: var(--text-xs); }

/* ============================================================
   PyME Workspace
   ============================================================ */
.pyme-main { max-width: 1180px; }
.pyme-panel { margin-bottom: var(--space-5); padding: var(--space-5); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--paper-elevated); }
.pyme-panel h2, .pyme-panel h3 { font-family: var(--font-display); margin: 0 0 var(--space-3); color: var(--ink); }
.pyme-panel h2 { font-size: var(--text-lg); font-weight: var(--weight-semibold); }
.pyme-panel h3 { font-size: var(--text-base); font-weight: var(--weight-semibold); }
.pyme-panel p { color: var(--ink-subtle); font-size: var(--text-sm); }
.pyme-toolbar { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.pyme-toolbar select { min-width: 220px; }
.pyme-section-nav { display: flex; gap: var(--space-1); margin: 0 0 var(--space-4); padding: 0 0 var(--space-2); overflow-x: auto; border-bottom: 1px solid var(--border); }
.pyme-section-nav button { flex: 0 0 auto; padding: var(--space-2) var(--space-3); border: 0; border-radius: var(--radius-md); background: transparent; color: var(--ink-subtle); font: inherit; font-size: var(--text-sm); font-weight: var(--weight-medium); cursor: pointer; transition: var(--transition-fast); white-space: nowrap; }
.pyme-section-nav button:hover { background: var(--paper); color: var(--clp-green); }
.pyme-section-nav button.active { background: var(--clp-green-light); color: var(--clp-green); box-shadow: inset 0 -2px var(--clp-green); }
.pyme-page { animation: pymePageIn .18s ease-out; }
.pyme-page > .pyme-panel:last-child { margin-bottom: var(--space-5); }
@keyframes pymePageIn { from { opacity: .5; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }

/* PyME KPIs */
.pyme-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-4); flex-wrap: wrap; gap: var(--space-3); }
.pyme-heading h2 { margin: var(--space-1) 0 0; }
.pyme-eyebrow, .pyme-role { color: var(--ink-subtle); font-size: var(--text-xs); font-weight: var(--weight-semibold); text-transform: uppercase; letter-spacing: 0.05em; }
.pyme-role { padding: var(--space-2) var(--space-3); border-radius: var(--radius-full); background: var(--paper); border: 1px solid var(--border); }
.pyme-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-3); margin-bottom: var(--space-5); }
@media (max-width: 760px) { .pyme-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .pyme-metrics { grid-template-columns: 1fr; } }
.pyme-metrics article { display: grid; gap: var(--space-2); padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--paper-elevated); }
.pyme-metrics span { color: var(--ink-subtle); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.05em; }
.pyme-metrics strong { font-family: var(--font-mono); font-size: var(--text-xl); font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pyme-metrics article:first-child strong { color: var(--income); }
.pyme-metrics article:nth-child(2) strong { color: var(--expense); }
.pyme-metrics article:nth-child(3) strong.positive { color: var(--income); }
.pyme-metrics article:nth-child(3) strong.negative { color: var(--expense); }
.pyme-metrics article:nth-child(4) strong { color: var(--shared); }

/* Charts */
.pyme-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
@media (max-width: 760px) { .pyme-charts { grid-template-columns: 1fr; } }
.pyme-chart-legend { display: flex; align-items: center; gap: 6px; color: var(--ink-subtle); font-size: var(--text-xs); white-space: nowrap; }
.pyme-chart-legend i { width: 9px; height: 9px; border-radius: 50%; }
.pyme-chart-legend .income-key { background: var(--income); }
.pyme-chart-legend .expense-key { background: var(--expense); margin-left: 6px; }
.pyme-month-chart { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); align-items: end; gap: var(--space-3); height: 210px; padding: var(--space-3) 0 0; }
@media (max-width: 520px) { .pyme-month-chart { height: 170px; gap: var(--space-1); } }
.pyme-month-column { display: grid; grid-template-rows: 1fr auto; gap: var(--space-2); height: 100%; text-align: center; }
.pyme-month-column > small { color: var(--ink-subtle); font-size: var(--text-xs); text-transform: capitalize; }
.pyme-bars { display: flex; align-items: end; justify-content: center; gap: 6px; height: 100%; border-bottom: 1px solid var(--border); }
.pyme-bars span { width: min(24px, 32%); min-height: 0; border-radius: 5px 5px 0 0; transition: height .2s ease; }
.pyme-bars .income-bar { background: var(--income); }
.pyme-bars .expense-bar { background: var(--expense); }
.pyme-category-chart { display: grid; gap: var(--space-3); }
.pyme-category-chart > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px var(--space-2); align-items: center; font-size: var(--text-sm); }
.pyme-category-chart > div > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.pyme-category-chart b { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: var(--text-sm); color: var(--expense); }
.pyme-category-chart i { grid-column: 1 / -1; height: 6px; overflow: hidden; border-radius: 99px; background: var(--paper); }
.pyme-category-chart i span { display: block; height: 100%; border-radius: inherit; background: var(--expense); }

/* Metrics */
.pyme-metrics article small { color: var(--ink-subtle); font-size: var(--text-xs); }
.pyme-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
@media (max-width: 760px) { .pyme-columns { grid-template-columns: 1fr; } }
.pyme-inline-form, .pyme-form { display: grid; gap: var(--space-3); }
.pyme-inline-form { grid-template-columns: repeat(2, minmax(0, 1fr)) auto; align-items: end; }
@media (max-width: 520px) { .pyme-inline-form { grid-template-columns: 1fr; } }
.pyme-form label, .pyme-inline-form label, .pyme-invite-form label { display: grid; gap: var(--space-2); color: var(--ink-subtle); font-size: var(--text-xs); font-weight: var(--weight-semibold); text-transform: uppercase; letter-spacing: 0.05em; }
.pyme-form input, .pyme-form select, .pyme-inline-form input, .pyme-invite-form textarea, .pyme-payout-form select { width: 100%; min-width: 0; padding: var(--space-3); border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--paper); color: var(--ink); font: inherit; font-size: var(--text-sm); }
.pyme-form > button { justify-self: start; }
.pyme-members, .pyme-entries { display: grid; gap: var(--space-2); }
.pyme-members article, .pyme-entries article, .pyme-invitation { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.pyme-members article > div, .pyme-entries article > span, .pyme-invitation > span { display: grid; gap: var(--space-1); min-width: 0; }
.pyme-members small, .pyme-entries small, .pyme-invitation small { color: var(--ink-subtle); font-size: var(--text-xs); overflow-wrap: anywhere; }
.pyme-payout-form { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-2); }
.pyme-payout-form label { flex-basis: 100%; color: var(--ink-subtle); font-size: var(--text-xs); }
.pyme-payout-form select { width: auto; max-width: 220px; padding: var(--space-2); font-size: var(--text-sm); }
.pyme-payout-form .btn-secondary { padding: var(--space-2) var(--space-3); }
.pyme-invite-form { display: flex; align-items: end; gap: var(--space-3); margin-top: var(--space-4); }
@media (max-width: 520px) { .pyme-invite-form { align-items: stretch; flex-direction: column; } }
.pyme-invite-form label { flex: 1; }
.pyme-entries article b { white-space: nowrap; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.pyme-entries article b.positive { color: var(--income); }
.pyme-entries article b.negative { color: var(--expense); }
.pyme-invitation { margin: 0; }
.pyme-panel h4 { font-family: var(--font-display); margin: var(--space-4) 0 var(--space-2); font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--ink); }
.pyme-category-list, .pyme-recurring-list { display: grid; gap: var(--space-2); margin: var(--space-3) 0 var(--space-4); }
.pyme-category-list article, .pyme-recurring-list article { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--border); }
.pyme-recurring-list { display: grid; margin-top: var(--space-3); }
.pyme-recurring-list article > span { display: grid; gap: var(--space-1); min-width: 0; }
.pyme-recurring-list small { color: var(--ink-subtle); font-size: var(--text-xs); }
.pyme-recurring-list b { white-space: nowrap; font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--expense); }
.pyme-recurring-remove { border: 0; background: transparent; color: var(--expense); cursor: pointer; font: inherit; font-size: var(--text-xs); font-weight: var(--weight-medium); }
.pyme-costing-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pyme-cost-item-form { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: var(--space-3) 0; }
@media (max-width: 520px) { .pyme-costing-form, .pyme-cost-item-form { grid-template-columns: 1fr; } }
.pyme-cost-item-form > button { align-self: end; }
.pyme-costing-form > button { grid-column: 1 / -1; }
.pyme-costing-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); margin-top: var(--space-4); }
@media (max-width: 480px) { .pyme-costing-results { grid-template-columns: 1fr; } }
.pyme-costing-results article { display: grid; gap: var(--space-2); padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--paper); }
.pyme-costing-results span { color: var(--ink-subtle); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.05em; }
.pyme-costing-results strong { font-family: var(--font-mono); font-size: var(--text-lg); font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pyme-risk-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); }
@media (max-width: 760px) { .pyme-risk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .pyme-risk-grid { grid-template-columns: 1fr; } }
.pyme-risk-grid article { display: grid; gap: var(--space-2); padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--paper); }
.pyme-risk-grid article > span, .pyme-risk-grid article > small { color: var(--ink-subtle); font-size: var(--text-xs); }
.pyme-risk-grid article > small { line-height: 1.45; }
.pyme-risk-grid strong { font-family: var(--font-mono); font-size: var(--text-lg); font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pyme-alert { margin-top: var(--space-3); padding: var(--space-3); border-radius: var(--radius-md); background: var(--expense-light); color: var(--expense); border: 1px solid var(--expense); }
.pyme-commitment-track { height: 7px; overflow: hidden; border-radius: 99px; background: var(--border); margin-top: var(--space-2); }
.pyme-commitment-track span { display: block; height: 100%; border-radius: inherit; background: var(--income); transition: width 0.3s ease; }
.pyme-commitment-track span.negative { background: var(--expense); }
.pyme-expense-alert { display: grid; gap: var(--space-1); margin-bottom: var(--space-4); padding: var(--space-3); border: 1px solid var(--expense); border-radius: var(--radius-md); background: var(--expense-light); color: var(--expense); }
.pyme-expense-alert span, .pyme-expense-alert small { font-size: var(--text-sm); }
.pyme-expense-alert small { color: var(--ink-subtle); }
.pyme-panel .section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-3); }
.pyme-panel .section-header > div { display: flex; flex-direction: column; gap: var(--space-1); }
.pyme-panel .section-header h3 { margin: 0; }
.pyme-panel .section-header small { color: var(--ink-subtle); font-size: var(--text-xs); }

/* ============================================================
   Transaction Detail Modal
   ============================================================ */
.transaction-detail-modal { max-width: 760px; max-height: 90vh; display: flex; flex-direction: column; }
.transaction-detail-actions { position: relative; display: flex; align-items: center; gap: var(--space-2); }
.transaction-flag-button { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border: 1px solid var(--expense); border-radius: var(--radius-md); background: var(--expense-light); color: var(--expense); cursor: pointer; transition: var(--transition-fast); }
.transaction-flag-button:hover { background: var(--expense); color: #fff; }
.transaction-flag-button svg { width: 20px; height: 20px; }
.transaction-delete-menu { position: absolute; z-index: 5; top: calc(100% + 6px); right: 42px; min-width: 190px; padding: var(--space-1); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--paper-elevated); box-shadow: var(--shadow-lg); }
.transaction-delete-action { width: 100%; padding: var(--space-2) var(--space-3); border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--expense); text-align: left; font: inherit; font-weight: var(--weight-semibold); cursor: pointer; }
.transaction-delete-action:hover { background: var(--expense-light); }
.transaction-detail-body { padding: var(--space-5); overflow-y: auto; flex: 1; }
.transaction-detail-amount { display: flex; justify-content: space-between; align-items: center; padding: var(--space-4); border-radius: var(--radius-md); background: var(--paper); border: 1px solid var(--border); margin-bottom: var(--space-4); }
.transaction-detail-amount span { color: var(--ink-subtle); font-weight: var(--weight-semibold); font-size: var(--text-sm); }
.transaction-detail-amount strong { font-family: var(--font-mono); font-size: var(--text-xl); font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; }
.transaction-detail-amount.income strong { color: var(--income); }
.transaction-detail-amount.expense strong { color: var(--expense); }
.transaction-detail-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); padding: var(--space-5) 0; }
@media (max-width: 600px) { .transaction-detail-fields { grid-template-columns: 1fr; } }
.transaction-detail-fields dt { color: var(--ink-subtle); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: var(--space-1); }
.transaction-detail-fields dd { font-weight: var(--weight-medium); overflow-wrap: anywhere; color: var(--ink); }
.receipt-section { border-top: 1px solid var(--border); padding-top: var(--space-5); }
.receipt-section-heading { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); margin-bottom: var(--space-4); }
@media (max-width: 600px) { .receipt-section-heading { align-items: flex-start; flex-direction: column; } }
.receipt-section-heading h4 { font-family: var(--font-display); font-size: var(--text-base); font-weight: var(--weight-semibold); }
.receipt-section-heading span { color: var(--ink-subtle); font-size: var(--text-xs); }
.receipt-upload-form { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); }
@media (max-width: 600px) { .receipt-upload-form { flex-wrap: wrap; } }
.receipt-file-picker { position: relative; flex: 0 0 auto; display: inline-flex; align-items: center; padding: var(--space-2) var(--space-3); border: 1px solid var(--border-strong); border-radius: var(--radius-md); font-size: var(--text-sm); font-weight: var(--weight-semibold); cursor: pointer; }
.receipt-file-picker input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.receipt-file-names { color: var(--ink-subtle); font-size: var(--text-xs); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 600px) { .receipt-file-names { flex-basis: calc(100% - 150px); } }
.receipt-upload-form .btn-primary { flex: 0 0 auto; }
.receipt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--space-3); }
.receipt-card { min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--paper-elevated); }
.receipt-preview { display: block; height: 150px; background: var(--paper); }
.receipt-preview img { width: 100%; height: 100%; object-fit: cover; }
.receipt-card-footer { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); padding: var(--space-2); }
.receipt-card-footer span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-xs); color: var(--ink-subtle); }
.receipt-remove { border: 0; background: none; color: var(--expense); font-size: var(--text-xs); font-weight: var(--weight-medium); cursor: pointer; padding: var(--space-1); }
.receipt-empty { color: var(--ink-subtle); font-size: var(--text-sm); padding: var(--space-2) 0; text-align: center; }

/* ============================================================
   Toasts
   ============================================================ */
.toast-container { position: fixed; bottom: var(--space-5); right: var(--space-5); display: flex; flex-direction: column; gap: var(--space-2); z-index: var(--z-toast); max-width: 360px; }
.toast { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--paper-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes slideInRight { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
.toast.success { border-left: 4px solid var(--income); }
.toast.error { border-left: 4px solid var(--expense); }
.toast.warning { border-left: 4px solid var(--shared); }
.toast.info { border-left: 4px solid var(--clp-green); }
.toast-content { flex: 1; min-width: 0; }
.toast-title { font-weight: var(--weight-semibold); font-size: var(--text-sm); color: var(--ink); }
.toast-message { font-size: var(--text-xs); color: var(--ink-subtle); margin-top: var(--space-1); }
.toast-close { flex-shrink: 0; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border: none; background: none; color: var(--ink-subtle); cursor: pointer; border-radius: var(--radius-sm); }
.toast-close:hover { background: var(--paper); color: var(--ink); }

/* Badge */
.badge { display: inline-flex; align-items: center; padding: var(--space-1) var(--space-2); font-size: var(--text-xs); font-weight: var(--weight-semibold); border-radius: var(--radius-full); text-transform: uppercase; letter-spacing: 0.05em; }
.badge.hidden { display: none; }
.badge-primary { background: var(--clp-green-light); color: var(--clp-green); }
.badge-success { background: var(--income-light); color: var(--income); }
.badge-danger { background: var(--expense-light); color: var(--expense); }
.badge-shared { background: var(--shared-light); color: var(--shared); }

/* Chart Containers */
.chart-container { width: 100%; height: 220px; }
.chart-svg { width: 100%; height: 100%; }
.chart-empty { display: flex; align-items: center; justify-content: center; height: 220px; color: var(--ink-subtle); font-size: var(--text-sm); text-align: center; padding: var(--space-4); }
.chart-tooltip { position: fixed; background: var(--paper-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-3); box-shadow: var(--shadow-lg); pointer-events: none; opacity: 0; transition: opacity 0.15s ease; z-index: 1000; min-width: 160px; }
.chart-tooltip.visible { opacity: 1; }
.chart-tooltip-title { font-weight: var(--weight-semibold); font-size: var(--text-xs); margin-bottom: var(--space-2); padding-bottom: var(--space-2); border-bottom: 1px solid var(--border); color: var(--ink); }
.chart-tooltip-row { display: flex; justify-content: space-between; gap: var(--space-3); font-size: var(--text-xs); }
.chart-tooltip-row:not(:last-child) { margin-bottom: var(--space-1); }
.chart-tooltip-label { color: var(--ink-subtle); }
.chart-tooltip-value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: var(--weight-semibold); }
.chart-tooltip-value.income { color: var(--income); }
.chart-tooltip-value.expense { color: var(--expense); }

/* Chart Styles */
.chart-bar { transition: fill 150ms ease; }
.chart-bar:hover { filter: brightness(1.1); }
.chart-line { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart-line.income { stroke: var(--income); }
.chart-line.expense { stroke: var(--expense); }
.chart-line.balance { stroke: var(--clp-green); }
.chart-point { r: 4; transition: r 150ms ease; cursor: pointer; }
.chart-point:hover { r: 7; }
.chart-point.income { fill: var(--income); stroke: var(--income); }
.chart-point.expense { fill: var(--expense); stroke: var(--expense); }
.chart-point.balance { fill: var(--clp-green); stroke: var(--clp-green); }
.chart-area { fill-opacity: 0.15; }
.chart-area.negative { fill: var(--expense); }
.chart-area:not(.negative) { fill: var(--income); }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-legend-color { rx: 2; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 640px) {
  .dashboard-header { padding: var(--space-3) var(--space-4); }
  .dashboard-main { padding: var(--space-4); }
  .balance-hero { padding: var(--space-6) var(--space-4); }
  .balance-hero__amount { font-size: var(--text-2xl); }
  .accounts-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .quick-actions { flex-direction: column; }
  .type-chips { flex-direction: column; }
}

/* ============================================================
   Print
   ============================================================ */
@media print {
  .dashboard-header, .quick-actions, .form-actions, .modal-overlay, .toast-container { display: none !important; }
  .screen { position: static; display: block !important; }
  body { background: var(--paper); }
}

/* ============================================================
   Reports & Feedback System
   ============================================================ */
.reports-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.reports-category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.reports-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-full);
  background: var(--paper);
  color: var(--ink-subtle);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition-fast);
}

.reports-chip:hover {
  background: var(--paper-elevated);
  color: var(--ink);
}

.reports-chip.active {
  background: var(--clp-green);
  color: #ffffff;
  border-color: var(--clp-green);
}

.reports-chip .chip-count {
  font-size: var(--text-xs);
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.25);
}

.reports-list-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.report-card {
  background: var(--paper-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.report-card:hover {
  border-color: var(--border-strong);
}

.report-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.report-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge-tag {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-bug {
  background: var(--expense-light);
  color: var(--expense);
  border: 1px solid var(--expense);
}

.badge-error {
  background: var(--shared-light);
  color: var(--shared);
  border: 1px solid var(--shared);
}

.badge-suggestion {
  background: var(--income-light);
  color: var(--income);
  border: 1px solid var(--income);
}

.badge-other {
  background: var(--brand-light);
  color: var(--clp-green);
  border: 1px solid var(--clp-green);
}

.badge-status {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
}

.badge-status-open {
  background: var(--brand-light);
  color: var(--clp-green);
  border: 1px solid var(--clp-green);
}

.badge-status-in_progress {
  background: var(--shared-light);
  color: var(--shared);
  border: 1px solid var(--shared);
}

.badge-status-resolved {
  background: var(--income-light);
  color: var(--income);
  border: 1px solid var(--income);
}

.badge-status-closed {
  background: var(--ink-subtle-light);
  color: var(--ink-subtle);
  border: 1px solid var(--border);
}

.report-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--ink);
  margin: 0.25rem 0;
}

.report-description {
  font-size: var(--text-sm);
  color: var(--ink-subtle);
  line-height: 1.5;
  white-space: pre-wrap;
}

.report-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: var(--text-xs);
  color: var(--ink-subtle);
}

.report-user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.report-user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--paper);
}

.report-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.report-status-select {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  padding: 0.25rem 0.5rem;
  cursor: pointer;
}

.btn-delete-report {
  background: transparent;
  border: none;
  color: var(--expense);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: opacity 0.2s;
}

.btn-delete-report:hover {
  opacity: 0.7;
}

/* ============================================================
   Admin Dashboard Specific
   ============================================================ */
.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.admin-kpi-card {
  background: var(--paper-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.admin-kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  background: var(--clp-green-light);
  color: var(--clp-green);
}

.admin-kpi-info span {
  font-size: var(--text-xs);
  color: var(--ink-subtle);
  text-transform: uppercase;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.05em;
}

.admin-kpi-info strong {
  display: block;
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--ink);
  margin-top: 0.2rem;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.admin-section {
  margin-bottom: 2.5rem;
}

.admin-users-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.admin-search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 280px;
  max-width: 100%;
}

.admin-search-icon {
  position: absolute;
  left: 0.75rem;
  color: var(--ink-subtle);
  pointer-events: none;
}

.admin-search-input {
  width: 100%;
  padding: 0.45rem 2rem 0.45rem 2.25rem;
  font-size: var(--text-xs);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--ink);
  transition: var(--transition-fast);
}

.admin-search-input:focus {
  outline: none;
  background: var(--paper-elevated);
  border-color: var(--clp-green);
  box-shadow: 0 0 0 2px var(--clp-green-light);
}

.admin-search-input::placeholder {
  color: var(--ink-subtle);
}

.admin-search-clear {
  position: absolute;
  right: 0.45rem;
  background: transparent;
  border: none;
  color: var(--ink-subtle);
  cursor: pointer;
  padding: 0.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease;
}

.admin-search-clear:hover {
  color: var(--ink);
}

.admin-users-table-container {
  overflow-x: auto;
  background: var(--paper-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: var(--text-sm);
}

.admin-table th {
  padding: 0.85rem 1rem;
  font-size: var(--text-xs);
  color: var(--ink-subtle);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  background: var(--paper);
}

.admin-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.admin-table tr:hover td {
  background: var(--paper);
}

.role-badge {
  display: inline-block;
  font-size: var(--text-xs);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-weight: var(--weight-semibold);
}

.role-badge.admin {
  background: var(--clp-green-light);
  color: var(--clp-green);
  border: 1px solid var(--clp-green);
}

.role-badge.user {
  background: var(--ink-subtle-light);
  color: var(--ink-subtle);
  border: 1px solid var(--border);
}

/* ============================================================
   PLANNING MODULE (Ahorros Compartidos y Gastos Comunes)
   ============================================================ */

.planning-invitations-banner {
  background: var(--clp-green-light);
  border: 1px solid var(--clp-green);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.planning-invitations-header {
  font-size: var(--text-sm);
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.planning-invitations-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.planning-invitation-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.planning-invitation-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.planning-invitation-icon {
  font-size: 1.5rem;
}

.planning-invitation-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.planning-tabs-nav {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  background: var(--paper);
  padding: 0.35rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.planning-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1rem;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--ink-subtle);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
}

.planning-tab-btn:hover {
  color: var(--ink);
  background: var(--paper-elevated);
}

.planning-tab-btn.active {
  color: #fff;
  background: var(--clp-green);
  box-shadow: 0 2px 8px var(--clp-green-light);
}

.planning-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.planning-kpi-card {
  background: var(--paper-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.planning-kpi-label {
  font-size: var(--text-xs);
  color: var(--ink-subtle);
  text-transform: uppercase;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.05em;
}

.planning-kpi-card strong {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--ink);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.planning-kpi-progress {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 0.25rem;
}

.planning-kpi-progress-fill {
  height: 100%;
  background: var(--income);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.planning-goals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.planning-goal-card {
  background: var(--paper-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.planning-goal-card:hover {
  border-color: var(--clp-green);
  transform: translateY(-2px);
}

.planning-goal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.planning-goal-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.planning-goal-icon {
  font-size: 1.75rem;
  background: var(--paper);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}

.planning-goal-amounts {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.planning-goal-saved {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--income);
}

.planning-goal-target {
  font-size: var(--text-xs);
  color: var(--ink-subtle);
}

.planning-goal-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.planning-goal-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.planning-goal-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--clp-green), var(--income));
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.planning-goal-participants {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.participant-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.5rem;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--ink-subtle);
}

.planning-goal-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.75rem;
}

.planning-expense-groups-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  padding: 0.85rem 1.15rem;
  background: var(--paper-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.planning-balances-section {
  background: var(--paper-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.planning-balances-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.planning-balances-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.balance-card-pill {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.balance-card-pill.creditor {
  background: var(--income-light);
  border-color: var(--income);
}

.balance-card-pill.debtor {
  background: var(--expense-light);
  border-color: var(--expense);
}

.balance-card-pill.even {
  background: var(--paper);
}

.balance-card-pill strong {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}

.balance-card-pill .balance-val {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.balance-card-pill.creditor .balance-val {
  color: var(--income);
}

.balance-card-pill.debtor .balance-val {
  color: var(--expense);
}

.balance-card-pill.even .balance-val {
  color: var(--ink-subtle);
}

.planning-settlements-box {
  background: var(--paper);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.settlement-suggestion-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-xs);
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}

.settlement-suggestion-item:last-child {
  border-bottom: none;
}


