:root {
  --bg-main: #0f172a;
  --bg-surface: #1e293b;
  --bg-card: #1e293b;
  --bg-card-hover: #26354a;
  --border-color: #334155;
  --border-light: #475569;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --income-color: #10b981;
  --income-bg: rgba(16, 185, 129, 0.12);
  --income-border: rgba(16, 185, 129, 0.3);

  --expense-color: #f43f5e;
  --expense-bg: rgba(244, 63, 94, 0.12);
  --expense-border: rgba(244, 63, 94, 0.3);

  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --primary-bg: rgba(59, 130, 246, 0.15);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
}

html {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  box-sizing: border-box;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  width: 100%;
  max-width: 100vw;
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: max(20px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  line-height: 1.5;
  overflow-x: hidden;
}

.app-container {
  max-width: 1200px;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
  box-sizing: border-box;
}

.app-header,
.kpi-grid,
.budget-structure-card,
.daily-budget-card,
.charts-grid,
.chart-card,
.audit-grid,
.audit-card,
.movements-section,
.table-responsive {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Header */
.app-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.brand-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.brand-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary-color);
  background: var(--primary-bg);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.tenant-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
}

.app-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
}

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

.currency-selector-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.currency-selector-box select {
  background: transparent;
  color: var(--text-main);
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

/* Botones Generales */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-primary {
  background: var(--primary-color);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-outline {
  background: var(--bg-surface);
  color: var(--text-muted);
  border-color: var(--border-color);
}

.btn-outline:hover {
  color: var(--text-main);
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

.btn-file {
  margin: 0;
  display: inline-flex;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.775rem;
}

.btn-subtle {
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.btn-subtle:hover {
  color: var(--text-main);
  border-color: var(--text-muted);
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary-color);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.85rem;
  margin-left: 8px;
}

/* Banner de Alerta */
.alert-banner {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #bfdbfe;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
}

/* Barra de Navegación de Período (Mes) */
.period-navigator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 10px 16px;
  width: 100%;
  box-sizing: border-box;
}

.btn-nav {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
  white-space: nowrap;
}

.btn-nav:hover {
  background: var(--border-light);
  border-color: var(--primary-color);
}

.period-display {
  text-align: center;
  flex: 1;
  min-width: 0;
  padding: 0 4px;
}

.period-display h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-main);
  text-transform: capitalize;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#periodSummarySubtitle {
  font-size: 0.8rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, border-color 0.15s;
}

.kpi-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: bold;
}

.income-card .kpi-icon {
  background: var(--income-bg);
  color: var(--income-color);
  border: 1px solid var(--income-border);
}

.expense-card .kpi-icon {
  background: var(--expense-bg);
  color: var(--expense-color);
  border: 1px solid var(--expense-border);
}

.balance-card .kpi-icon {
  background: var(--primary-bg);
  color: var(--primary-color);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.kpi-info {
  display: flex;
  flex-direction: column;
}

.kpi-title {
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-value {
  font-size: 1.65rem;
  font-weight: 700;
  margin: 4px 0 2px;
}

.income-card .kpi-value {
  color: var(--income-color);
}

.expense-card .kpi-value {
  color: var(--expense-color);
}

.kpi-meta {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Gráficos */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

@media (max-width: 900px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.chart-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
}

.chart-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.chart-badge {
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--border-color);
  color: var(--text-main);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.chart-container {
  position: relative;
  height: 280px;
  width: 100%;
}

.doughnut-container {
  display: flex;
  align-items: center;
  justify-content: center;
}

.no-data-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 41, 59, 0.85);
  color: var(--text-dim);
  font-size: 0.9rem;
  border-radius: var(--radius-md);
}

/* Tabla de Movimientos */
.movements-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

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

.section-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title-group h3 {
  font-size: 1.15rem;
  font-weight: 600;
}

.badge {
  background: var(--border-color);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.table-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.input-search, .select-filter {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 7px 12px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  outline: none;
}

.input-search:focus, .select-filter:focus {
  border-color: var(--primary-color);
}

.input-search {
  width: 220px;
}

.table-responsive {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  box-sizing: border-box;
}

.mobile-only-cell {
  display: none !important;
}

.movements-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.movements-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.movements-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.4);
  vertical-align: middle;
}

.movements-table tr:hover td {
  background-color: var(--bg-card-hover);
}

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

/* Category pill */
.cat-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 0.775rem;
  font-weight: 500;
  background: rgba(100, 116, 139, 0.2);
  color: var(--text-main);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.amount-income {
  color: var(--income-color);
  font-weight: 600;
}

.amount-expense {
  color: var(--expense-color);
  font-weight: 600;
}

.type-pill {
  font-size: 0.725rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  display: inline-block;
}

.type-pill-income {
  background: var(--income-bg);
  color: var(--income-color);
}

.type-pill-expense {
  background: var(--expense-bg);
  color: var(--expense-color);
}

/* Badges de Entidad / Cuenta bancaria / Billetera */
.entity-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.entity-santander {
  background: rgba(235, 0, 41, 0.12);
  color: #ff6b6b;
  border: 1px solid rgba(235, 0, 41, 0.35);
}

.entity-mp {
  background: rgba(0, 158, 227, 0.14);
  color: #38bdf8;
  border: 1px solid rgba(0, 158, 227, 0.35);
}

.entity-ciudad {
  background: rgba(245, 158, 11, 0.14);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.entity-cash {
  background: rgba(16, 185, 129, 0.14);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.entity-other {
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.28);
}


/* Botones de acción en tabla */
.action-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  transition: all 0.15s;
}

.action-btn:hover {
  background: var(--border-color);
  color: var(--text-main);
}

.action-btn.delete:hover {
  background: var(--expense-bg);
  color: var(--expense-color);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state p {
  margin-bottom: 12px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  box-shadow: var(--shadow-lg);
  animation: modalFadeIn 0.2s ease-out;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}

.btn-close:hover {
  color: var(--text-main);
}

#movementForm {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.type-selector-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  background: var(--bg-main);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.type-radio {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s;
}

.type-radio input {
  display: none;
}

.type-radio.income-radio:has(input:checked) {
  background: var(--income-color);
  color: #ffffff;
}

.type-radio.expense-radio:has(input:checked) {
  background: var(--expense-color);
  color: #ffffff;
}

.form-row {
  display: flex;
  gap: 12px;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-group input, .form-group select {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 9px 12px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}

.form-group input:focus, .form-group select:focus {
  border-color: var(--primary-color);
}

.input-prefix-box {
  position: relative;
  display: flex;
  align-items: center;
}

.currency-prefix {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-weight: 600;
  pointer-events: none;
}

.input-prefix-box input {
  padding-left: 28px;
  width: 100%;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.hidden {
  display: none !important;
}

/* Estructura del Gasto: Fijos vs Variables (Punto 1) */
.budget-structure-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.structure-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.structure-header h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-main);
}

.structure-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nature-tag {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.tag-fixed {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.35);
}

.tag-variable {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.budget-bar-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.budget-bar {
  height: 18px;
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border-radius: var(--radius-full);
  overflow: hidden;
  display: flex;
  border: 1px solid var(--border-color);
}

.bar-segment {
  height: 100%;
  transition: width 0.4s ease;
}

.bar-fixed {
  background: #6366f1;
}

.bar-variable {
  background: #f59e0b;
}

.bar-savings {
  background: #10b981;
}

.budget-bar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.775rem;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot-fixed { background: #6366f1; }
.dot-variable { background: #f59e0b; }
.dot-savings { background: #10b981; }

.structure-insight-box {
  background: rgba(15, 23, 42, 0.5);
  border-left: 3px solid var(--primary-color);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 10px 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.4;
}

.insight-icon {
  font-size: 1.1rem;
}

/* Insignias de Naturaleza en Tabla */
.nature-badge {
  display: inline-block;
  font-size: 0.725rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
}

.nature-badge-fixed {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.25);
}

.nature-badge-variable {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

/* Presupuesto Diario y Ritmo de Gasto (Punto 2) */
.daily-budget-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.daily-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.daily-header h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-main);
}

.daily-badge {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.daily-badge.warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.35);
}

.daily-badge.danger {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border-color: rgba(244, 63, 94, 0.35);
}

.daily-badge.neutral {
  background: rgba(100, 116, 139, 0.15);
  color: #94a3b8;
  border-color: rgba(100, 116, 139, 0.35);
}

.daily-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.daily-metric-box {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.15s, border-color 0.15s;
}

.daily-metric-box:hover {
  border-color: var(--border-light);
  transform: translateY(-1px);
}

.daily-metric-box.primary-box {
  border-color: rgba(59, 130, 246, 0.45);
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(59, 130, 246, 0.08));
}

.daily-metric-title {
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.daily-metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 2px 0;
}

.primary-box .daily-metric-value {
  color: #60a5fa;
}

.daily-metric-sub {
  font-size: 0.775rem;
  color: var(--text-dim);
}

.daily-advice-box {
  background: rgba(15, 23, 42, 0.5);
  border-left: 3px solid var(--primary-color);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 10px 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.4;
}

/* Auditoría Financiera: Top 5 y Gastos Hormiga (Puntos 3, 4 y 5) */
.audit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 900px) {
  .audit-grid {
    grid-template-columns: 1fr;
  }
}

.audit-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}

.audit-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.audit-header h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Top 5 Lista */
.top5-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.top5-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  transition: border-color 0.15s;
}

.top5-item:hover {
  border-color: var(--border-light);
}

.top5-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.top5-rank {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rank-1 { background: rgba(251, 191, 36, 0.2); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.4); }
.rank-2 { background: rgba(203, 213, 225, 0.2); color: #cbd5e1; border: 1px solid rgba(203, 213, 225, 0.4); }
.rank-3 { background: rgba(249, 115, 22, 0.2); color: #f97316; border: 1px solid rgba(249, 115, 22, 0.4); }
.rank-other { background: rgba(100, 116, 139, 0.2); color: #94a3b8; border: 1px solid rgba(100, 116, 139, 0.3); }

.top5-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.top5-concept {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.top5-sub {
  font-size: 0.725rem;
  color: var(--text-dim);
}

.top5-right {
  text-align: right;
  flex-shrink: 0;
  margin-left: 10px;
}

.top5-amount {
  font-size: 0.925rem;
  font-weight: 700;
  color: var(--expense-color);
}

.top5-pct {
  font-size: 0.725rem;
  color: var(--text-dim);
}

/* Gastos Hormiga */
.hormiga-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.hormiga-stat-box {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hormiga-label {
  font-size: 0.725rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.hormiga-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: #f59e0b;
}

.hormiga-meta {
  font-size: 0.725rem;
  color: var(--text-dim);
}

.hormiga-diagnosis {
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid #f59e0b;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 10px 12px;
  font-size: 0.825rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Comparativa con Mes Anterior */
.comparison-section {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

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

.comparison-header h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
}

.comparison-badge {
  font-size: 0.725rem;
  color: var(--text-dim);
}

.comparison-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.comp-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  max-width: 100%;
  box-sizing: border-box;
  word-break: break-word;
  white-space: normal;
}

.comp-pill.up {
  border-color: rgba(244, 63, 94, 0.4);
  color: #fb7185;
}

.comp-pill.down {
  border-color: rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.comp-pill.same {
  border-color: rgba(100, 116, 139, 0.4);
  color: #94a3b8;
}

.comp-pill.new {
  border-color: rgba(59, 130, 246, 0.4);
  color: #60a5fa;
}

/* ==========================================
   Estilos de Impresión / Guardar en PDF (Punto 6)
   ========================================== */
@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body {
    background: #ffffff !important;
    color: #0f172a !important;
    padding: 0 !important;
  }

  .header-actions,
  .period-navigator button,
  .alert-banner,
  .table-filters,
  .modal-backdrop,
  .action-btn,
  #btnEmptyAdd,
  #btnFilterHormiga {
    display: none !important;
  }

  .app-container {
    max-width: 100% !important;
    gap: 16px !important;
  }

  .app-header {
    border-bottom: 2px solid #e2e8f0 !important;
    padding-bottom: 12px !important;
  }

  .app-header h1 {
    color: #0f172a !important;
    font-size: 1.5rem !important;
  }

  .period-navigator {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
    justify-content: flex-start !important;
    padding: 8px 14px !important;
  }

  .period-display h2 {
    color: #0f172a !important;
    font-size: 1.2rem !important;
    text-align: left !important;
  }

  .kpi-card,
  .budget-structure-card,
  .daily-budget-card,
  .chart-card,
  .audit-card,
  .movements-section {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: none !important;
    color: #0f172a !important;
    page-break-inside: avoid;
  }

  .kpi-title,
  .chart-subtitle,
  .daily-metric-title,
  .hormiga-label {
    color: #64748b !important;
  }

  .kpi-value,
  .daily-metric-value,
  .chart-header h3,
  .audit-header h3,
  .section-title-group h3 {
    color: #0f172a !important;
  }

  .daily-metric-box,
  .top5-item,
  .hormiga-stat-box,
  .structure-insight-box,
  .daily-advice-box,
  .hormiga-diagnosis {
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
    color: #334155 !important;
  }

  .movements-table th {
    color: #475569 !important;
    border-bottom: 2px solid #cbd5e1 !important;
  }

  .movements-table td {
    border-bottom: 1px solid #e2e8f0 !important;
    color: #1e293b !important;
  }

  .cat-badge {
    background: #f1f5f9 !important;
    color: #334155 !important;
    border-color: #cbd5e1 !important;
  }

  .chart-container {
    height: 220px !important;
  }
}

/* ==========================================
   9. Estilos de Autenticación y Cuentas de Usuario
   ========================================== */

.user-profile-box {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.user-info-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.45);
  font-size: 0.85rem;
  font-weight: 600;
  color: #e0e7ff;
  min-width: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.user-email-label {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #ffffff;
  font-weight: 600;
}

.btn-auth-trigger {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2)) !important;
  border: 1px solid rgba(168, 85, 247, 0.5) !important;
  color: #f1f5f9 !important;
  font-weight: 600 !important;
  transition: all 0.2s ease;
}

.btn-auth-trigger:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.35), rgba(168, 85, 247, 0.35)) !important;
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.3);
}

.auth-dialog {
  max-width: 440px !important;
}

.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
  gap: 8px;
}

.auth-tab {
  flex: 1;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-tab:hover {
  color: var(--text-main);
}

.auth-tab.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 4px 6px;
}

.auth-error-banner {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  line-height: 1.4;
}

/* ==========================================
   Estilos de Carga Universal (Excel, PDF, CSV)
   ========================================== */

.btn-highlight-import {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(99, 102, 241, 0.25)) !important;
  border: 1px solid rgba(99, 102, 241, 0.5) !important;
  color: #e0e7ff !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25) !important;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.btn-highlight-import:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.4), rgba(99, 102, 241, 0.4)) !important;
  border-color: rgba(99, 102, 241, 0.8) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35) !important;
}

/* Overlay de Arrastrar y Soltar (Drag & Drop) */
.dropzone-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  pointer-events: none;
  animation: fadeIn 0.15s ease-out;
}

.dropzone-card {
  background: var(--bg-surface);
  border: 2px dashed #6366f1;
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  text-align: center;
  max-width: 520px;
  width: 90%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  pointer-events: auto;
  transform: scale(1.02);
  transition: transform 0.2s;
}

.dropzone-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
  animation: bounce 1s infinite alternate;
}

@keyframes bounce {
  0% { transform: translateY(0); }
  100% { transform: translateY(-8px); }
}

.dropzone-card h3 {
  font-size: 1.4rem;
  color: var(--text-main);
  margin-bottom: 8px;
}

.dropzone-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 16px;
}

.dropzone-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
}

.dropzone-badge {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #c7d2fe;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

.dropzone-note {
  display: block;
  font-size: 0.8rem;
  color: #10b981;
  font-weight: 500;
}

/* Toast de Notificación / Procesamiento */
.import-feedback-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--primary-color);
  color: var(--text-main);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 10001;
  display: flex;
  align-items: center;
  gap: 10px;
}

.import-spinner {
  display: inline-block;
  animation: spin 1s linear infinite;
}

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

/* Blindaje de alineación y centrado para la generación de informe PDF */
.html2pdf__overlay {
  left: 0 !important;
  top: 0 !important;
}

.html2pdf__container {
  left: 0 !important;
  right: auto !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}

/* Contenedor y botón de alternancia para campos de contraseña */
.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-input-wrapper input {
  width: 100%;
  padding-right: 44px !important;
}

.password-toggle-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  user-select: none;
  transition: opacity 0.2s, transform 0.15s;
}

.password-toggle-btn:hover {
  opacity: 0.8;
  transform: translateY(-50%) scale(1.1);
}

/* ==========================================
   10. Adaptabilidad Responsive Móvil y Orientación
   ========================================== */

/* Tablets y Móviles (< 768px) */
@media (max-width: 768px) {
  body {
    padding: 12px 10px;
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }

  .app-container {
    gap: 16px;
  }

  .app-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding-bottom: 14px;
  }

  .app-header h1 {
    font-size: 1.45rem;
  }

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

  #btnNewMovement {
    width: 100%;
    order: -1;
    padding: 10px 16px;
    font-size: 0.95rem;
  }

  #btnLoginOpen {
    width: 100%;
    order: -2;
    padding: 10px 16px;
    font-size: 0.95rem;
  }

  .header-actions .btn,
  .header-actions .currency-selector-box {
    font-size: 0.8rem;
    padding: 7px 11px;
    flex-grow: 1;
    text-align: center;
    justify-content: center;
  }

  .user-profile-box {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .user-info-chip {
    flex: 1;
    min-width: 0;
    max-width: none;
    padding: 7px 12px;
  }

  .user-email-label {
    max-width: 100%;
    font-size: 0.85rem;
    color: #ffffff;
    font-weight: 600;
  }

  #btnSyncCloud {
    padding: 7px 10px;
    font-size: 0.85rem;
    flex-shrink: 0;
    flex-grow: 0;
  }

  #btnSyncCloud #syncStatusText {
    display: none;
  }

  #btnLogout {
    padding: 7px 10px;
    font-size: 0.85rem;
    flex-shrink: 0;
    flex-grow: 0;
  }

  .kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
  }

  .kpi-card {
    padding: 14px 16px;
    gap: 12px;
  }

  .kpi-value {
    font-size: 1.45rem;
  }

  .period-navigator {
    padding: 8px 12px;
    gap: 8px;
  }

  .period-display h2 {
    font-size: 1.15rem;
  }

  .btn-nav {
    width: 36px;
    height: 36px;
    font-size: 0.95rem;
  }

  /* Sección de Movimientos y Filtros */
  .section-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .section-title-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }

  .table-filters {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .input-search {
    grid-column: 1 / -1;
    width: 100% !important;
  }

  .select-filter {
    width: 100%;
  }

  .daily-metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .chart-container {
    height: 240px;
  }

  /* Movimientos Móviles: Tarjetas tipo App Bancaria (Opción A) */
  .table-responsive {
    overflow-x: visible;
  }

  .desktop-only-cell {
    display: none !important;
  }

  .mobile-only-cell {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
  }

  .movements-table thead {
    display: none !important;
  }

  .movements-table,
  .movements-table tbody {
    display: block !important;
    width: 100% !important;
  }

  .movements-table tr {
    display: block !important;
    width: 100% !important;
    margin-bottom: 10px;
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
  }

  .movements-table tr:hover td {
    background-color: transparent !important;
  }

  .card-movement {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
  }

  .card-movement:hover {
    border-color: var(--border-light);
  }

  .card-movement-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 0.775rem;
    color: var(--text-dim);
    flex-wrap: wrap;
  }

  .card-movement-date {
    font-weight: 600;
    color: var(--text-muted);
  }

  .card-movement-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
  }

  .card-movement-middle {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    padding: 2px 0;
  }

  .card-movement-desc {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    word-break: break-word;
    flex: 1;
    min-width: 0;
    line-height: 1.35;
  }

  .card-movement-amount {
    font-size: 1.05rem;
    font-weight: 700;
    white-space: nowrap;
    text-align: right;
    flex-shrink: 0;
  }

  .card-movement-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
  }

  .card-movement-actions {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .card-movement-actions .action-btn {
    padding: 5px 9px;
    font-size: 0.775rem;
    border-radius: var(--radius-sm);
    background: var(--bg-main);
    border: 1px solid var(--border-color);
  }

  /* Auditoría Financiera en Tablets/Móviles */
  .audit-card {
    padding: 14px 16px;
    gap: 12px;
  }

  .audit-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  #top5ConcentrationBadge {
    white-space: normal;
    word-break: break-word;
    max-width: 100%;
  }

  .comparison-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}

/* Teléfonos Móviles Estrechos (< 480px, ej. Android 360px-412px) */
@media (max-width: 480px) {
  body {
    padding: 10px 8px;
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(8px, env(safe-area-inset-right));
  }

  .app-header h1 {
    font-size: 1.25rem;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .kpi-card {
    padding: 12px 14px;
  }

  .kpi-icon {
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
  }

  .kpi-value {
    font-size: 1.35rem;
  }

  .period-navigator {
    padding: 8px;
    gap: 6px;
  }

  .period-display h2 {
    font-size: 1.05rem;
  }

  .btn-nav {
    width: 34px;
    height: 34px;
    font-size: 0.9rem;
    padding: 0;
  }

  .table-filters {
    grid-template-columns: 1fr;
  }

  .daily-metrics-grid {
    grid-template-columns: 1fr;
  }

  .hormiga-stats-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .structure-header,
  .daily-header,
  .audit-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .audit-card {
    padding: 12px 14px;
    gap: 10px;
  }

  .audit-header h3 {
    font-size: 1.05rem;
  }

  #btnFilterHormiga {
    width: 100%;
  }

  .comparison-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .comp-pill {
    font-size: 0.72rem;
    padding: 3px 8px;
    gap: 4px;
  }

  .top5-item {
    padding: 8px 10px;
    gap: 8px;
  }

  .top5-concept {
    font-size: 0.8rem;
  }

  .top5-amount {
    font-size: 0.85rem;
  }

  .top5-pct {
    font-size: 0.675rem;
  }

  .structure-badges {
    width: 100%;
    justify-content: flex-start;
  }

  .form-row {
    flex-direction: column;
    gap: 10px;
  }

  .type-selector-group {
    gap: 6px;
  }

  .type-radio {
    padding: 8px;
    font-size: 0.825rem;
  }

  .modal-dialog {
    border-radius: var(--radius-md);
  }

  #movementForm, .auth-form {
    padding: 14px;
    gap: 12px;
  }
}

/* Dispositivos Móviles en Modo Horizontal / Landscape (altura < 550px) */
@media (orientation: landscape) and (max-height: 550px) {
  body {
    padding: 8px 12px;
    padding-top: max(6px, env(safe-area-inset-top));
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  .app-container {
    gap: 12px;
  }

  .app-header {
    padding-bottom: 8px;
    gap: 8px;
  }

  .app-header h1 {
    font-size: 1.25rem;
  }

  .brand-row {
    margin-bottom: 2px;
  }

  .header-actions {
    gap: 6px;
  }

  .header-actions .btn,
  .header-actions .currency-selector-box {
    padding: 5px 9px;
    font-size: 0.775rem;
  }

  #btnNewMovement {
    padding: 6px 12px;
    font-size: 0.825rem;
    width: auto;
    order: 0;
  }

  .period-navigator {
    padding: 6px 12px;
  }

  .period-display h2 {
    font-size: 1.1rem;
  }

  .btn-nav {
    width: 34px;
    height: 34px;
    font-size: 0.9rem;
    padding: 0;
  }

  .kpi-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 8px;
  }

  .kpi-card {
    padding: 8px 10px;
    gap: 8px;
  }

  .kpi-icon {
    width: 34px;
    height: 34px;
    font-size: 1.1rem;
  }

  .kpi-title {
    font-size: 0.7rem;
  }

  .kpi-value {
    font-size: 1.15rem;
  }

  .charts-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px;
  }

  .audit-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px;
  }

  .chart-card {
    padding: 10px 14px;
  }

  .chart-header {
    margin-bottom: 6px;
  }

  .chart-container {
    height: 175px !important;
  }

  .budget-structure-card,
  .daily-budget-card,
  .audit-card,
  .movements-section {
    padding: 12px 14px;
    gap: 10px;
  }

  .daily-metrics-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .daily-metric-box {
    padding: 8px 10px;
  }

  .daily-metric-value {
    font-size: 1.15rem;
  }

  /* Modales optimizados para pantalla horizontal */
  .modal-dialog {
    max-height: 94dvh;
    border-radius: var(--radius-md);
  }

  .modal-header {
    padding: 10px 14px;
  }

  #movementForm, .auth-form {
    padding: 10px 14px;
    gap: 10px;
  }

  .form-group label {
    font-size: 0.725rem;
  }

  .form-group input, .form-group select {
    padding: 6px 10px;
    font-size: 0.85rem;
  }

  .modal-footer {
    padding-top: 8px;
    margin-top: 4px;
  }

  /* Movimientos Móviles en Landscape: Tarjetas en 2 columnas compactas */
  .desktop-only-cell {
    display: none !important;
  }

  .mobile-only-cell {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
  }

  .movements-table thead {
    display: none !important;
  }

  .movements-table,
  .movements-table tbody {
    display: block !important;
    width: 100% !important;
  }

  .movements-table tbody {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  .movements-table tr {
    display: block !important;
    width: 100% !important;
    margin-bottom: 0 !important;
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
  }

  .movements-table tr:hover td {
    background-color: transparent !important;
  }
}



