/* ==========================================================================
   KAIRO · SYSTEM DESIGN & CSS VARIABLES
   ========================================================================== */

:root {
  /* DARK THEME (Default) */
  --bg: #0B0F1A;
  --surface-1: #121829;
  --surface-2: #182036;
  --surface-3: #1F2942;
  --border: #263049;
  --border-soft: #1B2339;
  --text: #F1F5F9;
  --text-dim: #94A3B8;
  --text-muted: #64748B;
  
  --green: #10B981;
  --green-soft: rgba(16, 185, 129, 0.12);
  --red: #EF4444;
  --red-soft: rgba(239, 68, 68, 0.12);
  --blue: #3B82F6;
  --blue-soft: rgba(59, 130, 246, 0.12);
  
  --violet: #8B5CF6;
  --amber: #F59E0B;
  --cyan: #06B6D4;
  --pink: #EC4899;
  
  --glow: rgba(59, 130, 246, 0.15);
  --scrollbar-thumb: #1B2339;
  --scrollbar-hover: #263049;
  
  --gradient-main: linear-gradient(135deg, #3B82F6, #6366F1);
}

[data-theme="light"] {
  /* LIGHT THEME */
  --bg: #F8FAFC;
  --surface-1: #FFFFFF;
  --surface-2: #F1F5F9;
  --surface-3: #E2E8F0;
  --border: #CBD5E1;
  --border-soft: #E2E8F0;
  --text: #0F172A;
  --text-dim: #475569;
  --text-muted: #64748B;
  
  --green: #059669;
  --green-soft: rgba(5, 150, 105, 0.1);
  --red: #DC2626;
  --red-soft: rgba(220, 38, 38, 0.1);
  --blue: #2563EB;
  --blue-soft: rgba(37, 99, 235, 0.1);
  
  --violet: #7C3AED;
  --amber: #D97706;
  --cyan: #0891B2;
  --pink: #D01C74;
  
  --glow: rgba(37, 99, 235, 0.08);
  --scrollbar-thumb: #CBD5E1;
  --scrollbar-hover: #94A3B8;
  
  --gradient-main: linear-gradient(135deg, #2563EB, #4F46E5);
}

/* ==========================================================================
   BASE & RESET
   ========================================================================== */

* {
  box-sizing: border-box;
}

html {
  font-size: 16.5px !important; /* Aumento global de tipografía */
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16.5px;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body {
  min-height: 100vh;
  position: relative;
}

/* Dynamic Radial Glow Background depending on theme */
body::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.8;
  background: 
    radial-gradient(1200px 600px at 85% -10%, rgba(59, 130, 246, 0.07), transparent 60%),
    radial-gradient(800px 500px at -10% 110%, rgba(139, 92, 246, 0.05), transparent 60%);
  transition: opacity 0.3s ease;
}

[data-theme="light"] body::before {
  background: 
    radial-gradient(1200px 600px at 85% -10%, rgba(37, 99, 235, 0.05), transparent 60%),
    radial-gradient(800px 500px at -10% 110%, rgba(124, 58, 237, 0.03), transparent 60%);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 10px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-hover);
}

/* ==========================================================================
   UI COMPONENTS & UTILITIES
   ========================================================================== */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  transition: all 0.2s ease;
}
.chip.pos {
  background: var(--green-soft);
  color: var(--green);
  border-color: rgba(16, 185, 129, 0.25);
}
.chip.neg {
  background: var(--red-soft);
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.25);
}
.chip.info {
  background: var(--blue-soft);
  color: var(--blue);
  border-color: rgba(59, 130, 246, 0.25);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 12.5px;
  font-family: inherit;
}
.btn:hover {
  background: var(--surface-3);
  border-color: var(--scrollbar-hover);
}
.btn:active {
  transform: scale(0.97);
}
.btn.primary {
  background: var(--gradient-main);
  border-color: transparent;
  color: #ffffff;
}
.btn.primary:hover {
  filter: brightness(1.1);
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
}
.btn.ghost:hover {
  background: var(--surface-2);
}
.btn.sm {
  padding: 5px 9px;
  font-size: 11.5px;
}
.btn.danger {
  background: var(--red-soft);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--red);
}
.btn.danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

.card {
  background: linear-gradient(180deg, var(--surface-1), var(--bg));
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  transition: all 0.3s ease;
}
[data-theme="light"] .card {
  background: var(--surface-1);
  box-shadow: 0 4px 15px rgba(15, 23, 42, 0.04);
}
.card-h {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-b {
  position: relative;
  padding: 16px;
}

canvas {
  display: block;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 500;
  font-size: 13px;
}
.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}
.nav-item.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.12), rgba(139, 92, 246, 0.06));
  color: var(--blue);
  box-shadow: inset 2px 0 0 var(--blue);
  font-weight: 600;
}
[data-theme="light"] .nav-item.active {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.08), rgba(124, 58, 237, 0.04));
  color: var(--blue);
  box-shadow: inset 2px 0 0 var(--blue);
}
.nav-item .count {
  margin-left: auto;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-dim);
}

.acc-card {
  position: relative;
  border-radius: 14px;
  padding: 14px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  border: 1px solid transparent;
  color: white; /* Keep text white inside gradients for accounts */
}
.acc-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.acc-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 60%);
  pointer-events: none;
}

.kpi {
  padding: 16px;
  border-radius: 14px;
  background: var(--surface-1);
  border: 1px solid var(--border-soft);
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}
.kpi:hover {
  border-color: var(--border);
}
.kpi .label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.kpi .value {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-top: 6px;
}

.gauge-wrap {
  position: relative;
  width: 100px;
  height: 100px;
  margin-top: 8px;
}
.gauge-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

table.kai {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
table.kai th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  background: var(--surface-1);
  z-index: 1;
}
table.kai td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
  vertical-align: middle;
}
table.kai tr:not(.day-header):not(.row-total):hover td {
  background: rgba(120, 120, 120, 0.03);
}
table.kai tr.day-header td {
  background: var(--bg);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 8px 12px;
}

.tab {
  padding: 9px 14px;
  border-radius: 8px;
  color: var(--text-dim);
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}
.tab:hover {
  color: var(--text);
}
.tab.active {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.filter-group {
  margin-bottom: 16px;
}
.filter-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-dim);
}
.filter-item:hover {
  background: var(--surface-2);
  color: var(--text);
}
.filter-item input[type="checkbox"] {
  accent-color: var(--blue);
}

.input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 11px;
  color: var(--text);
  font-size: 12.5px;
  font-family: inherit;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--glow);
}

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 40px;
  text-align: center;
  transition: all 0.2s;
  background: var(--surface-1);
  cursor: pointer;
}
.drop-zone:hover, .drop-zone.drag {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.cat-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}
.tag-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 500;
  background: var(--surface-3);
  color: var(--text-dim);
}

.section-view {
  display: none;
  animation: fade 0.25s ease;
}
.section-view.active {
  display: block;
}
@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.progress {
  height: 6px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s ease;
}

.pill-seg {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.pill-seg button {
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 11.5px;
  color: var(--text-dim);
  cursor: pointer;
  border: none;
  background: transparent;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.15s;
}
.pill-seg button:hover {
  color: var(--text);
}
.pill-seg button.active {
  background: var(--surface-3);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  opacity: 0.5;
  user-select: none;
}
.drag-handle:hover {
  opacity: 1;
}
.dragging {
  opacity: 0.4;
  background: var(--surface-2);
}
.drag-over td {
  border-top: 2px solid var(--blue) !important;
}

.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 600;
}
.badge-live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.icon {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

.gradient-text {
  background: linear-gradient(135deg, #60A5FA, #A78BFA);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
[data-theme="light"] .gradient-text {
  background: linear-gradient(135deg, #1D4ED8, #7C3AED);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.month-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 3px;
}
.month-nav button {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.month-nav button:hover {
  background: var(--surface-3);
  color: var(--text);
}
.month-nav .month-label {
  padding: 0 8px;
  font-weight: 600;
  font-size: 13px;
  min-width: 120px;
  text-align: center;
}

/* Account Gradients (Maintained for premium visual identity) */
.ac-cash { background: linear-gradient(135deg, #16A34A, #065F46); }
.ac-checking { background: linear-gradient(135deg, #2563EB, #1E3A8A); }
.ac-savings { background: linear-gradient(135deg, #0891B2, #155E75); }
.ac-cc { background: linear-gradient(135deg, #DC2626, #7F1D1D); }
.ac-wallet { background: linear-gradient(135deg, #D97706, #78350F); }
.ac-crypto { background: linear-gradient(135deg, #7C3AED, #4C1D95); }
.ac-broker { background: linear-gradient(135deg, #475569, #0F172A); }
.ac-paypal { background: linear-gradient(135deg, #0284C7, #0C4A6E); }

.flow-var-pos {
  color: var(--green);
  background: var(--green-soft);
  padding: 2px 7px;
  border-radius: 5px;
  font-weight: 600;
  font-size: 11.5px;
  display: inline-block;
}
.flow-var-neg {
  color: var(--red);
  background: var(--red-soft);
  padding: 2px 7px;
  border-radius: 5px;
  font-weight: 600;
  font-size: 11.5px;
  display: inline-block;
}

.row-total td {
  background: var(--surface-2) !important;
  font-weight: 700;
  border-top: 2px solid var(--border);
}

/* Modals */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  animation: fade 0.2s ease;
}
.modal-bg.open {
  display: flex;
}
.modal {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  max-width: 520px;
  width: 92%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

/* Drawer */
.drawer-bg {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 45;
  display: none;
}
.drawer-bg.open {
  display: block;
}
.drawer {
  position: fixed;
  top: 0;
  right: -500px;
  width: 480px;
  max-width: 100%;
  height: 100vh;
  background: var(--surface-1);
  border-left: 1px solid var(--border);
  z-index: 46;
  transition: right 0.3s ease;
  overflow-y: auto;
  padding: 24px;
}
.drawer.open {
  right: 0;
}

/* Toast Container */
#toastContainer {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  min-width: 280px;
  max-width: 380px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  animation: slideIn 0.3s ease;
  pointer-events: auto;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--blue); }
.toast.warn { border-left: 3px solid var(--amber); }
@keyframes slideIn {
  from {
    transform: translateX(120%);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.toast-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}
.toast-content {
  flex: 1;
  min-width: 0;
}
.toast-title {
  font-weight: 600;
  font-size: 12.5px;
  margin-bottom: 2px;
}
.toast-msg {
  font-size: 11.5px;
  color: var(--text-dim);
}
.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  font-size: 14px;
}

/* Context Menu */
.ctx-menu {
  position: fixed;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 5px;
  min-width: 180px;
  z-index: 80;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  animation: fade 0.12s ease;
}
.ctx-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border-radius: 6px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.ctx-menu button:hover {
  background: var(--surface-3);
}
.ctx-menu button.danger {
  color: var(--red);
}
.ctx-sep {
  height: 1px;
  background: var(--border-soft);
  margin: 4px 0;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state .emoji {
  font-size: 40px;
  margin-bottom: 10px;
}

.dot-divider {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-muted);
  display: inline-block;
  margin: 0 6px;
}

.fx-rate {
  font-variant-numeric: tabular-nums;
}

/* AI Chat Interface */
.chat-container {
  height: 380px;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-user {
  background: var(--gradient-main);
  color: white;
  border-radius: 14px 14px 4px 14px;
  padding: 10px 14px;
  max-width: 80%;
  margin-left: auto;
  font-size: 12.5px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}
.chat-bot {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px 14px 14px 4px;
  padding: 10px 14px;
  max-width: 80%;
  font-size: 12.5px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.notification-item {
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.notification-item:hover {
  background: var(--surface-2);
}
.notification-item.unread {
  border-left: 3px solid var(--blue);
}

.draggable-row {
  cursor: grab;
}
.draggable-row:active {
  cursor: grabbing;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse2 1.5s infinite;
}
@keyframes pulse2 {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Google Button Styling Adjustments */
#googleBtnContainer {
  margin: 15px 0;
  display: flex;
  justify-content: center;
}

/* ==========================================================================
   KAIRO v3.0 — NEW COMPONENTS
   ========================================================================== */

/* --- Accounts Grid (Dashboard, all accounts, horizontal scroll) --- */
.accounts-grid-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}
.accounts-grid-scroll::-webkit-scrollbar {
  height: 4px;
}
.accounts-grid-scroll::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
}

/* Custom Account Card (uses CSS var --acc-color) */
.acc-card-custom {
  min-width: 160px;
  max-width: 160px;
  background: var(--acc-color, #2563EB);
  border-radius: 14px;
  padding: 14px;
  color: #ffffff;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
  border: 1px solid transparent;
  user-select: none;
  flex-shrink: 0;
}
.acc-card-custom::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.14), transparent 60%);
  pointer-events: none;
}
.acc-card-custom:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.acc-card-icon {
  font-size: 22px;
  line-height: 1;
}
.acc-card-currency {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  opacity: 0.7;
  background: rgba(255,255,255,0.15);
  padding: 2px 5px;
  border-radius: 4px;
}

/* Add Account Button */
.acc-card-add {
  min-width: 110px;
  max-width: 110px;
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-muted);
  flex-shrink: 0;
}
.acc-card-add:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-soft);
}

/* --- Icon Picker --- */
.icon-pick-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1.5px solid transparent;
  background: var(--surface-2);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.12s;
  line-height: 1;
}
.icon-pick-btn:hover {
  background: var(--surface-3);
  border-color: var(--border);
}
.icon-pick-btn.selected {
  border-color: var(--blue);
  background: var(--blue-soft);
  box-shadow: 0 0 0 2px rgba(59,130,246,0.2);
}

/* --- Color Picker --- */
.color-pick-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  cursor: pointer;
  transition: all 0.12s;
}
.color-pick-btn:hover {
  transform: scale(1.15);
}
.color-pick-btn.selected {
  border-color: white;
  box-shadow: 0 0 0 2.5px rgba(255,255,255,0.8), 0 0 0 4px rgba(0,0,0,0.15);
  transform: scale(1.1);
}

/* --- Budget inline input --- */
.budget-inline-input {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--text);
  font-size: 12.5px;
  font-family: inherit;
  font-weight: 600;
  text-align: right;
  padding: 3px 6px;
  width: 110px;
  transition: all 0.12s;
  cursor: pointer;
}
.budget-inline-input:hover {
  border-color: var(--border);
  background: var(--surface-2);
}
.budget-inline-input:focus {
  outline: none;
  border-color: var(--blue);
  background: var(--surface-2);
  box-shadow: 0 0 0 3px var(--glow);
  cursor: text;
}

/* --- Transaction Type Tabs --- */
.tx-type-tab {
  flex: 1;
  padding: 8px 12px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.tx-type-tab:hover {
  color: var(--text);
}
.tx-type-tab.active {
  background: var(--surface-1);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
#txTypeTab_expense.active {
  color: var(--red);
  box-shadow: 0 2px 8px rgba(239,68,68,0.15);
}
#txTypeTab_income.active {
  color: var(--green);
  box-shadow: 0 2px 8px rgba(16,185,129,0.15);
}
/* --- Existing tx-type-tab ends --- */
#txTypeTab_transfer.active {
  color: var(--blue);
  box-shadow: 0 2px 8px rgba(59,130,246,0.15);
}

/* ==========================================================================
   KAIRO v4.0 — NEW COMPONENTS
   ========================================================================== */

/* --- Accounts MOSAIC GRID (like image: multi-row grid) --- */
.accounts-mosaic {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.acc-mosaic-card {
  border-radius: 12px;
  padding: 12px;
  color: #fff;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  min-height: 85px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.acc-mosaic-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent 60%);
  pointer-events: none;
}
.acc-mosaic-card:hover {
  transform: translateY(-2px) scale(1.015);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.acc-mosaic-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.acc-mosaic-icon {
  font-size: 18px;
  line-height: 1;
}
.acc-mosaic-currency {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  opacity: 0.75;
  background: rgba(255,255,255,0.18);
  padding: 2px 5px;
  border-radius: 4px;
}
.acc-mosaic-name {
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 6px;
  opacity: 0.9;
}
.acc-mosaic-balance {
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.acc-mosaic-add {
  border-radius: 12px;
  border: 2px dashed var(--border);
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  min-height: 85px;
  color: var(--text-muted);
  transition: all 0.18s;
}
.acc-mosaic-add:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-soft);
}

/* --- Period Picker Panel --- */
.period-picker-wrap {
  position: relative;
}
.period-label-btn {
  display: flex;
  align-items: center;
  cursor: pointer;
  gap: 0;
  user-select: none;
  white-space: nowrap;
}
.period-picker-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  width: 300px;
  z-index: 200;
  overflow: hidden;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity:0; transform: translateX(-50%) translateY(-4px); } to { opacity:1; transform: translateX(-50%) translateY(0); } }

.picker-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-2);
}
.picker-tab {
  padding: 9px 4px;
  font-size: 10px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.12s;
  text-align: center;
}
.picker-tab:hover { color: var(--text); background: var(--surface-3); }
.picker-tab.active { color: var(--blue); background: var(--surface-1); }

.picker-year-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
}
.picker-year-nav button {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}
.picker-year-nav button:hover { background: var(--surface-3); border-color: var(--blue); }

.month-picker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 6px 14px 14px;
}
.month-pick-btn {
  padding: 10px 0;
  border-radius: 10px;
  border: 1.5px solid transparent;
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.12s;
  text-align: center;
}
.month-pick-btn:hover { background: var(--surface-2); color: var(--text); }
.month-pick-btn.selected { background: var(--blue); color: white; border-radius: 12px; box-shadow: 0 2px 10px rgba(59,130,246,0.4); }
.month-pick-btn.today { border-color: var(--blue); color: var(--blue); }

/* --- Filter Section Headers --- */
.filter-section-hd {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 8px 6px 4px;
  display: block;
}
.filter-group-details {
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 4px;
  margin-bottom: 4px;
}
.filter-group-details summary {
  list-style: none;
}
.filter-group-details summary::-webkit-details-marker { display: none; }
.filter-check-list {
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.filter-check-list .filter-item {
  font-size: 11.5px;
  padding: 3px 4px;
  border-radius: 5px;
  gap: 6px;
}
.filter-check-list .filter-item:hover { background: var(--surface-2); }

/* --- AI Quick Analysis Buttons --- */
.ai-quick-btn {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: var(--surface-1);
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.12s;
  display: block;
}
.ai-quick-btn:hover {
  border-color: var(--blue);
  color: var(--text);
  background: var(--surface-2);
  transform: translateX(2px);
}

/* --- Chat Thinking Dots --- */
@keyframes dotBounce { 0%,60%,100%{opacity:.15;transform:translateY(0)} 30%{opacity:1;transform:translateY(-3px)} }
.thinking-dots span {
  display: inline-block;
  font-size: 18px;
  animation: dotBounce 1.2s infinite;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

/* --- Drag handle --- */
.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 14px;
}
.drag-handle:active { cursor: grabbing; }

/* --- Tag Pill --- */
.tag-pill {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  font-size: 10px;
  color: var(--text-dim);
}

/* ==========================================================================
   KAIRO PREMIUM AUTHENTICATION PANEL
   ========================================================================== */
.auth-glow-bg {
  background: radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.15), transparent 50%),
              radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.12), transparent 40%),
              radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.12), transparent 40%),
              #070A13;
}
[data-theme="light"] .auth-glow-bg {
  background: radial-gradient(circle at 50% 50%, rgba(37, 99, 235, 0.08), transparent 50%),
              radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.05), transparent 45%),
              radial-gradient(circle at 90% 80%, rgba(124, 58, 237, 0.06), transparent 45%),
              #F8FAFC;
}
.auth-card {
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  background-color: rgba(18, 24, 41, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
[data-theme="light"] .auth-card {
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  background-color: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.12);
}
.auth-input {
  background: rgba(24, 32, 54, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  transition: all 0.2s ease;
}
[data-theme="light"] .auth-input {
  background: rgba(241, 245, 249, 0.9);
  border: 1px solid rgba(15, 23, 42, 0.12);
  color: var(--text);
}
.auth-input:focus {
  border-color: #6366F1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
  background: rgba(24, 32, 54, 0.9);
  outline: none;
}
[data-theme="light"] .auth-input:focus {
  border-color: #3B82F6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
  background: #FFFFFF;
}
.auth-tab {
  position: relative;
  transition: all 0.25s ease;
}
.auth-tab.active {
  color: #FFFFFF;
}
[data-theme="light"] .auth-tab.active {
  color: #0F172A;
}
.auth-tab.active::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, #3B82F6, #8B5CF6);
  border-radius: 999px;
}
.social-btn {
  background: rgba(24, 32, 54, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  transition: all 0.2s ease;
}
[data-theme="light"] .social-btn {
  background: #FFFFFF;
  border: 1px solid rgba(15, 23, 42, 0.12);
  color: var(--text);
}
.social-btn:hover {
  background: rgba(31, 41, 66, 0.9);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}
[data-theme="light"] .social-btn:hover {
  background: rgba(248, 250, 252, 0.9);
  border-color: rgba(15, 23, 42, 0.2);
  transform: translateY(-1px);
}

/* ============================================================
   MOBILE RESPONSIVE — OPTIMIZACIÓN MÓVIL COMPLETA
   ============================================================ */

/* ---- Bottom Navigation Bar ---- */
.bottom-nav {
  display: none;
}

/* ---- Floating Action Button ---- */
.fab {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gradient-main);
  color: #fff;
  border: none;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
  cursor: pointer;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.fab:active {
  transform: scale(0.92);
}
.fab svg {
  width: 24px;
  height: 24px;
}

/* ---- Mobile Filter Drawer ---- */
.mobile-filter-btn {
  display: none;
}
.filter-drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 60;
}
.filter-drawer-backdrop.open {
  display: block;
}
.filter-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 85vh;
  background: var(--surface-1);
  border-top: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  z-index: 61;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
}
.filter-drawer.open {
  transform: translateY(0);
}
.filter-drawer-handle {
  width: 40px;
  height: 4px;
  background: var(--text-muted);
  border-radius: 4px;
  margin: 0 auto 16px;
}
.filter-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.filter-drawer-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
.filter-drawer-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface-2);
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

/* ---- Touch & Scroll Improvements ---- */
.accounts-grid-scroll,
.card-b {
  -webkit-overflow-scrolling: touch;
}
.accounts-grid-scroll {
  scroll-snap-type: x mandatory;
  scroll-padding: 8px;
}
.accounts-grid-scroll .acc-card-custom {
  scroll-snap-align: start;
}
.modal-content,
.drawer {
  overscroll-behavior: contain;
}

/* ============================================================
   @media (max-width: 768px) — TABLET & MOBILE
   ============================================================ */
@media (max-width: 768px) {
  /* -- Base Typography -- */
  body {
    font-size: 15px;
  }

  /* -- Bottom Nav -- */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--surface-1);
    border-top: 1px solid var(--border);
    z-index: 45;
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom, 0);
    align-items: center;
    justify-content: space-around;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }
  [data-theme="light"] .bottom-nav {
    background: rgba(255,255,255,0.92);
  }
  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 12px;
    border-radius: 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    transition: color 0.15s, background 0.15s;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    min-width: 56px;
  }
  .bottom-nav-item svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.8;
  }
  .bottom-nav-item.active {
    color: var(--blue);
    background: var(--blue-soft);
  }

  /* -- FAB -- */
  .fab {
    display: flex;
    bottom: 80px;
  }
  .fab.fab-hidden {
    transform: translateY(100px);
    opacity: 0;
    pointer-events: none;
  }

  /* -- Main content padding for bottom nav -- */
  .main-scroll-area {
    padding-bottom: 80px !important;
  }

  /* -- Mobile Filter Button -- */
  .mobile-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
  }
  .mobile-filter-btn svg {
    width: 16px;
    height: 16px;
  }
  .desktop-filter-sidebar {
    display: none !important;
  }

  /* -- Cards -- */
  .card {
    border-radius: 12px;
  }
  .card-h {
    padding: 12px 14px;
    font-size: 13px;
  }
  .card-b {
    padding: 12px 14px;
  }

  /* -- KPIs -- */
  .kpi {
    padding: 14px;
  }
  .kpi .value {
    font-size: 26px;
  }
  .kpi .label {
    font-size: 10.5px;
  }

  /* -- Buttons & Tap Targets -- */
  .btn {
    min-height: 44px;
    padding: 10px 18px;
    font-size: 13.5px;
  }
  .btn.sm {
    min-height: 38px;
    padding: 8px 14px;
  }
  .nav-item {
    padding: 12px 16px;
    font-size: 14px;
  }

  /* -- Chips -- */
  .chip {
    padding: 6px 12px;
    font-size: 12px;
  }

  /* -- Drawers / Modals -- */
  .drawer {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 0;
  }
  .modal-content {
    width: 95vw !important;
    max-width: 95vw !important;
    max-height: 90vh;
    border-radius: 16px;
    margin: auto;
  }

  /* -- Period Picker -- */
  .period-picker-panel {
    width: calc(100vw - 32px);
    left: 16px !important;
    right: 16px !important;
    max-width: none;
  }

  /* -- Toasts -- */
  .toast {
    min-width: auto;
    max-width: none;
  }
  #toastContainer {
    left: 16px !important;
    right: 16px !important;
    bottom: 80px !important;
  }

  /* -- Account Cards -- */
  .acc-card-custom {
    min-width: 140px;
    max-width: 140px;
  }
  .accounts-mosaic {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
  }
  .acc-mosaic-card {
    min-height: 72px;
    padding: 10px;
    border-radius: 10px;
  }
  .acc-mosaic-card .acc-mosaic-icon {
    font-size: 16px;
  }
  .acc-mosaic-card .acc-mosaic-name {
    font-size: 12px;
  }
  .acc-mosaic-card .acc-mosaic-balance {
    font-size: 14px;
  }

  /* -- Chat -- */
  .chat-container {
    height: 260px;
  }
  #chatCard {
    height: 420px !important;
  }

  /* -- Tables -- */
  table {
    font-size: 12.5px;
  }
  th, td {
    padding: 10px 8px;
  }
  .hide-mobile {
    display: none !important;
  }

  /* -- Context Menu → Bottom Sheet -- */
  .context-menu {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    border-radius: 16px 16px 0 0;
    min-width: 100% !important;
    max-height: 60vh;
    overflow-y: auto;
    padding: 8px 0;
    animation: slideUpSheet 0.25s ease;
  }

  /* -- Month Navigator -- */
  .month-nav .month-label {
    min-width: 100px;
    font-size: 13px;
  }

  /* -- Budget Input -- */
  .budget-inline-input {
    width: 90px;
  }

  /* -- Pill Segments -- */
  .pill-seg {
    gap: 2px;
    padding: 3px;
  }
  .pill-seg .pill {
    padding: 7px 12px;
    font-size: 12px;
  }

  /* -- Login Container -- */
  .login-card {
    width: 95vw !important;
    max-width: 400px;
    padding: 24px 20px !important;
  }

  /* -- Import/Export format tables -- */
  .format-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ============================================================
   @media (max-width: 480px) — SMALL MOBILE
   ============================================================ */
@media (max-width: 480px) {
  body {
    font-size: 14.5px;
  }

  /* Prevent iOS auto-zoom on inputs */
  input, select, textarea {
    font-size: 16px !important;
  }

  .kpi .value {
    font-size: 22px;
  }

  .modal-content {
    width: 100vw !important;
    max-width: 100vw !important;
    max-height: 100vh;
    border-radius: 0;
    height: 100vh;
  }

  .drawer {
    height: 100vh;
  }

  .card {
    border-radius: 10px;
  }

  .acc-card-custom {
    min-width: 130px;
    max-width: 130px;
  }

  .accounts-mosaic {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }

  .chat-container {
    height: 220px;
  }

  .bottom-nav {
    height: 60px;
  }
  .bottom-nav-item {
    font-size: 9px;
    padding: 4px 8px;
    min-width: 48px;
  }
  .bottom-nav-item svg {
    width: 20px;
    height: 20px;
  }

  .fab {
    width: 52px;
    height: 52px;
    bottom: 74px;
    right: 16px;
  }

  .period-picker-panel {
    left: 8px !important;
    right: 8px !important;
    width: calc(100vw - 16px);
  }

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

/* ---- Slide Up animation for context menu bottom sheet ---- */
@keyframes slideUpSheet {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ---- Safe area for notched devices ---- */
@supports (padding: env(safe-area-inset-bottom)) {
  .bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
  }
  .fab {
    bottom: calc(80px + env(safe-area-inset-bottom));
  }
  @media (max-width: 480px) {
    .fab {
      bottom: calc(74px + env(safe-area-inset-bottom));
    }
  }
}

/* ============================================================
   AUMENTO GENERAL DE FUENTES & AJUSTES DE NAVEGACIÓN
   ============================================================ */

/* Aumentos de fuentes específicas para escritorio */
.nav-item {
  font-size: 15px !important;
  padding: 10px 14px !important;
}
.btn {
  font-size: 15px !important;
  padding: 8px 14px !important;
}
.btn.sm {
  font-size: 13px !important;
  padding: 6px 10px !important;
}
.kpi .value {
  font-size: 36px !important;
}
.kpi .label {
  font-size: 13px !important;
}
table.kai th {
  font-size: 12px !important;
  padding: 11px 14px !important;
}
table.kai td {
  font-size: 15px !important;
  padding: 12px 14px !important;
}
.card-h {
  padding: 16px 20px !important;
}
.card-h .text-sm {
  font-size: 16px !important;
}
.card-h .text-xs {
  font-size: 13px !important;
}
.input, select, textarea {
  font-size: 14.5px !important;
  padding: 9px 12px !important;
}
.tab {
  font-size: 14.5px !important;
  padding: 10px 16px !important;
}
.chip {
  font-size: 13px !important;
  padding: 4px 10px !important;
}
.acc-mosaic-card .mosaic-name {
  font-size: 13.5px !important;
}
.acc-mosaic-card .mosaic-bal {
  font-size: 15px !important;
}

/* Ajustes de Navegación Horizontal en el Header */
header .nav-item {
  box-shadow: none !important;
  border-radius: 8px !important;
}
header .nav-item.active {
  background: var(--blue-soft) !important;
  color: var(--blue) !important;
  box-shadow: none !important;
}
[data-theme="light"] header .nav-item.active {
  background: var(--blue-soft) !important;
  color: var(--blue) !important;
  box-shadow: none !important;
}

/* Modificaciones responsivas para móviles y escala de fuentes global */
@media (max-width: 768px) {
  .bottom-nav-item {
    font-size: 12.5px !important;
  }
  .bottom-nav-item svg {
    width: 26px !important;
    height: 26px !important;
  }
  .fab {
    width: 60px !important;
    height: 60px !important;
  }
  table.kai td, table.kai th {
    font-size: 14px !important;
  }
  .acc-mosaic-card .mosaic-name {
    font-size: 12.5px !important;
  }
  .acc-mosaic-card .mosaic-bal {
    font-size: 13.5px !important;
  }
}

/* ============================================================
   AUMENTO GLOBAL DE TIPOGRAFÍA — COMPLETO Y RESPONSIVO
   ============================================================ */
html {
  font-size: 18.5px !important; /* Incremento global masivo */
}

@media (max-width: 768px) {
  html {
    font-size: 17px !important;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 16.5px !important;
  }
}

/* Forzar que las letras de fondo, textos pequeños y leyendas tengan un tamaño aumentado */
.text-xs, 
.text-[9px], 
.text-[10px], 
.text-[11px], 
.text-[12px],
.text-muted,
.text-dim,
[class*="text-[9px]"],
[class*="text-[10px]"],
[class*="text-[11px]"],
[class*="text-[12px]"],
.card-b .text-xs,
.kpi .label,
#crumb,
.toast,
.table th,
.table td,
th, 
td,
span.count,
label,
placeholder,
.bg-amber-500\/10,
.bg-blue-500\/10 {
  font-size: 0.85rem !important; /* Forzar legibilidad excelente */
}

/* Forzar que los textos medianos y cuerpo de tarjetas tengan el tamaño escalado */
.text-sm,
[class*="text-sm"],
.nav-item,
input,
select,
textarea,
.btn,
.card-b,
p {
  font-size: 1rem !important;
}

/* Forzar tamaño para encabezados y KPIs */
.kpi .value {
  font-size: 1.8rem !important; /* Más grande y visible */
  font-weight: 800 !important;
}
.kpi .label {
  font-size: 0.85rem !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Títulos principales */
.text-lg, [class*="text-lg"] { font-size: 1.2rem !important; }
.text-xl, [class*="text-xl"] { font-size: 1.35rem !important; }
.text-2xl, [class*="text-2xl"] { font-size: 1.6rem !important; }
.text-3xl, [class*="text-3xl"] { font-size: 1.9rem !important; }

/* Evitar auto-zoom molesto en iOS */
@media (max-width: 480px) {
  input, select, textarea {
    font-size: 16px !important;
  }
}

/* Ocultar barra de desplazamiento en menús horizontales */
.no-scrollbar::-webkit-scrollbar {
  display: none !important;
}
.no-scrollbar {
  -ms-overflow-style: none !important;  /* IE/Edge */
  scrollbar-width: none !important;  /* Firefox */
}

/* ============================================================
   ESTILOS DE DICTADO POR VOZ Y PROCESAMIENTO INTELIGENTE
   ============================================================ */
.voice-recording {
  background-color: #EF4444 !important;
  color: #FFFFFF !important;
  animation: pulse-red 1.5s infinite !important;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.5) !important;
}

@keyframes pulse-red {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }
  70% {
    transform: scale(1.05);
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

#txProcessingBanner {
  transition: all 0.3s ease-in-out;
}

/* ---- Category Search Dropdown ---- */
#txCategoryWrapper {
  position: relative;
}
.cat-search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 250px;
  overflow-y: auto;
  z-index: 999;
  background-color: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
  margin-top: 4px;
}
[data-theme="light"] .cat-search-dropdown {
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.1);
}
.cat-search-group {
  padding: 6px 12px;
  font-size: 11px !important;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  background-color: var(--surface-2);
  border-top: 1px solid var(--border);
}
.cat-search-group:first-child {
  border-top: none;
}
.cat-search-item {
  padding: 8px 12px;
  font-size: 14px !important;
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.cat-search-item:hover {
  background-color: var(--blue-soft);
  color: var(--blue);
}.cat-search-empty {
  padding: 12px;
  font-size: 14px !important;
  color: var(--text-dim);
  text-align: center;
}

/* ---- Floating Action Button for IA Kairo ---- */
.ai-fab {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6, #3b82f6);
  color: #fff;
  border: none;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
  cursor: pointer;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.ai-fab:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 24px rgba(139, 92, 246, 0.6);
}
.ai-fab:active {
  transform: scale(0.95);
}
.ai-fab svg {
  width: 24px;
  height: 24px;
}
.ai-fab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background-color: #ef4444;
  color: white;
  font-size: 8px;
  font-weight: 800;
  padding: 2px 4px;
  border-radius: 6px;
  border: 1px solid var(--surface-1);
}

@media (max-width: 768px) {
  .ai-fab {
    bottom: 150px;
    right: 20px;
  }
}

@media (max-width: 480px) {
  .ai-fab {
    bottom: 138px;
    right: 16px;
  }
}

@supports (padding: env(safe-area-inset-bottom)) {
  @media (max-width: 768px) {
    .ai-fab {
      bottom: calc(150px + env(safe-area-inset-bottom));
    }
  }
  @media (max-width: 480px) {
    .ai-fab {
      bottom: calc(138px + env(safe-area-inset-bottom));
    }
  }
}
