/* ===== CUSTOM UTILITIES ===== */
th {
  white-space: nowrap;
  position: relative;
}

.resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 5px;
  cursor: col-resize;
  user-select: none;
  height: 100%;
  z-index: 1;
}

.resizer:hover, .resizing {
  background-color: var(--accent);
}

.table-link {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-style: dashed;
  cursor: pointer;
  transition: var(--transition);
}
.table-link:hover {
  color: var(--accent-hover);
  text-decoration-style: solid;
}

/* ===== DESIGN TOKENS ===== */
:root {
  --bg-body: var(--bg-primary);
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d27;
  --bg-card: #1e2130;
  --bg-hover: #252840;
  --border: #2e3248;
  --accent: #E8820C;
  --accent-hover: #cf7009;
  --accent-light: rgba(232,130,12,0.12);
  --orange: #f59e0b;
  --orange-light: rgba(245,158,11,0.12);
  --green: #10b981;
  --green-light: rgba(16,185,129,0.12);
  --red: #ef4444;
  --red-light: rgba(239,68,68,0.12);
  --purple: #8b5cf6;
  --purple-light: rgba(139,92,246,0.12);
  --text-primary: #e8ecf3;
  --text-secondary: #8892a4;
  --text-muted: #5a6478;
  --sidebar-w: 220px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --transition: all 0.2s ease;
}

body.light-mode {
  --bg-body: var(--bg-primary);
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #f1f5f9;
  --border: #e2e8f0;
  --accent: #E8820C;
  --accent-hover: #cf7009;
  --accent-light: rgba(232,130,12,0.1);
  --orange: #f59e0b;
  --orange-light: rgba(245,158,11,0.1);
  --green: #059669;
  --green-light: rgba(16,185,129,0.1);
  --red: #dc2626;
  --red-light: rgba(239,68,68,0.1);
  --purple: #7c3aed;
  --purple-light: rgba(139,92,246,0.1);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --shadow: 0 4px 12px rgba(0,0,0,0.05);
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.03);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { overflow-anchor: none; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo-img {
  width: 140px;
  height: auto;
  display: block;
  object-fit: contain;
}
.logo-icon { font-size: 1.8rem; }
.logo-name { font-size: 1.2rem; font-weight: 700; color: var(--accent); }
.logo-sub { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.sidebar-nav { 
  flex: 1; 
  padding: 1rem 0.75rem; 
  display: flex; 
  flex-direction: column; 
  gap: 0.25rem; 
  overflow-y: auto;
}
.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}
.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
.nav-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.65rem 0.85rem; border-radius: var(--radius-sm);
  color: var(--text-secondary); text-decoration: none;
  font-weight: 500; transition: var(--transition); cursor: pointer;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-light); color: var(--accent); }
.nav-icon { font-size: 1rem; width: 1.2rem; text-align: center; }
.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid var(--border);
}
.sidebar-footer { padding: 0.6rem 1.25rem; color: var(--text-muted); font-size: 0.72rem; }
.nav-config { border-top: none !important; }

/* Responsive Nav-Preferencias icons/labels */
.icon-mobile { display: none !important; }
.label-mobile { display: none !important; }

/* ===== CONFIG VIEW ===== */
.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
  padding: 1.5rem;
}
.config-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.config-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.config-card-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.config-card-icon svg { width: 1.1rem; height: 1.1rem; stroke: currentColor; stroke-width: 2; }
.config-card-title { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); }
.config-card-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.15rem; }

/* Toggle Switch */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-label { font-size: 0.87rem; font-weight: 500; color: var(--text-primary); }
.toggle-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.1rem; }
.toggle-switch { position: relative; display: inline-block; width: 2.5rem; height: 1.4rem; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: var(--transition);
}
.toggle-track::after {
  content: '';
  position: absolute;
  width: 1rem; height: 1rem;
  left: 0.2rem; top: 0.2rem;
  background: #fff;
  border-radius: 50%;
  transition: var(--transition);
}
.toggle-switch input:checked + .toggle-track { background: var(--accent); }
.toggle-switch input:checked + .toggle-track::after { transform: translateX(1.1rem); }

/* Usuario row */
.usuarios-list { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 1rem; }
.usuario-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}
.usuario-avatar {
  width: 2rem; height: 2rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.8rem;
}
.usuario-name { font-size: 0.85rem; font-weight: 500; color: var(--text-primary); }
.usuario-role { font-size: 0.72rem; color: var(--text-muted); }

/* ===== LUCIDE ICONS ===== */
.nav-icon svg { width: 1rem; height: 1rem; stroke: currentColor; stroke-width: 2; display: block; }
.stat-icon svg { width: 1.3rem; height: 1.3rem; stroke: currentColor; stroke-width: 2; }
.section-icon { width: 0.9rem; height: 0.9rem; stroke: currentColor; stroke-width: 2; vertical-align: middle; margin-right: 0.1rem; }
.btn-icon { width: 0.85rem; height: 0.85rem; stroke: currentColor; stroke-width: 2; vertical-align: middle; }
.action-btn svg { width: 0.95rem; height: 0.95rem; stroke: currentColor; stroke-width: 2; display: block; }

/* ===== TOPBAR Y MENÚ MÓVIL ===== */
.mobile-menu-btn {
  display: none;
  background: none; border: none; color: var(--text-primary);
  cursor: pointer; padding: 0; margin-right: 0.75rem;
}
.mobile-menu-btn svg { width: 1.5rem; height: 1.5rem; stroke: currentColor; stroke-width: 2; }

@media (max-width: 640px) {
  .mobile-menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  .topbar-left { display: flex; align-items: center; }
}

/* ===== MAIN ===== */
.main-wrapper { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* ===== TOPBAR ===== */
.topbar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  display: flex; align-items: center; gap: 1rem;
  position: relative; z-index: 50;
  flex-wrap: wrap;
}
.topbar-left { flex: 0 0 auto; }
.topbar-left h1 { font-size: 1.15rem; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; margin-left: auto; }

/* Role Switcher */
.role-switcher {
  display: flex; align-items: center; gap: 0.6rem;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.3rem 0.6rem 0.3rem 0.85rem;
  flex: 1;
}
.role-label { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; font-weight: 500; }
.role-mode-btns { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.role-mode-btn {
  display: flex; align-items: center; gap: 0.3rem;
  background: none; border: 1px solid transparent;
  color: var(--text-secondary); padding: 0.3rem 0.7rem;
  border-radius: var(--radius-sm); cursor: pointer; font-size: 0.75rem;
  font-weight: 500; font-family: inherit; transition: var(--transition);
}
.role-mode-btn svg { width: 0.8rem; height: 0.8rem; stroke: currentColor; stroke-width: 2; }
.role-mode-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border); }
.role-mode-btn.active { background: var(--accent-light); color: var(--accent); border-color: var(--accent); }

/* Session Badge */
.session-badge {
  display: flex; align-items: center; gap: 0.6rem;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.4rem 0.75rem;
  cursor: pointer; transition: var(--transition);
}
.session-badge:hover { border-color: var(--accent); }
.session-avatar {
  width: 1.8rem; height: 1.8rem; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.75rem; flex-shrink: 0;
}
.session-info { line-height: 1.2; }
.session-name { font-size: 0.82rem; font-weight: 600; color: var(--text-primary); }
.session-role { font-size: 0.7rem; color: var(--text-muted); }

/* Usuarios list in config */
.usuarios-table-wrap { display: flex; flex-direction: column; gap: 0.5rem; }
.usuario-row-full {
  display: flex; align-items: center; gap: 0.85rem;
  padding: 0.75rem 1rem; background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: var(--transition);
}
.usuario-row-full:hover { border-color: var(--accent); }
.usuario-info { flex: 1; }
.usuario-email { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.1rem; }

/* Rol cards in user modal */
.roles-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 0.75rem; }
.rol-card { cursor: pointer; display: block; height: 100%; }
.rol-card input[type=radio] { display: none; }
.rol-card-inner {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem; text-align: center; transition: var(--transition);
  background: var(--bg-card);
  height: 100%; box-sizing: border-box;
}
.rol-card-icon {
  width: 2.5rem; height: 2.5rem; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 0.6rem;
}
.rol-card-icon svg { width: 1.1rem; height: 1.1rem; stroke: currentColor; stroke-width: 2; }
.rol-card-name { font-size: 0.82rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.3rem; }
.rol-card-desc { font-size: 0.7rem; color: var(--text-muted); line-height: 1.4; }
.rol-card input:checked + .rol-card-inner { border-color: var(--accent); background: var(--accent-light); }
.rol-card-inner:hover { border-color: var(--accent); }

/* Sesion user picker */
.sesion-user-btn {
  display: flex; align-items: center; gap: 0.75rem;
  width: 100%; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.75rem 1rem;
  cursor: pointer; transition: var(--transition); margin-bottom: 0.5rem;
  font-family: inherit;
}
.sesion-user-btn:hover { border-color: var(--accent); background: var(--accent-light); }
.sesion-user-btn.current { border-color: var(--accent); background: var(--accent-light); }
.sesion-user-info { flex: 1; text-align: left; }
.sesion-user-name { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.sesion-user-role { font-size: 0.74rem; color: var(--text-muted); margin-top: 0.1rem; }

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--accent); color: #fff;
  border: none; padding: 0.55rem 1.1rem; border-radius: var(--radius-sm);
  font-weight: 600; cursor: pointer; font-size: 0.875rem;
  transition: var(--transition);
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-secondary {
  background: transparent; color: var(--text-secondary);
  border: 1px solid var(--border); padding: 0.55rem 1.1rem; border-radius: var(--radius-sm);
  font-weight: 500; cursor: pointer; font-size: 0.875rem;
  transition: var(--transition);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-secondary.active { background: var(--accent-light); border-color: var(--accent); color: var(--accent); }

.btn-secondary-flex {
  background: transparent; color: var(--text-secondary);
  border: 1px solid var(--border); padding: 0.55rem 1.1rem; border-radius: var(--radius-sm);
  font-weight: 500; cursor: pointer; font-size: 0.875rem;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.btn-secondary-flex:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
  transform: translateY(-1px);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  cursor: pointer;
  font-size: 0.875rem;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.btn-danger:hover {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
  transform: translateY(-1px);
}


/* Clara specific action buttons */
.btn-clara-action {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.4rem !important;
  height: 38px !important;
  border-radius: 8px !important;
  padding: 0 1rem !important;
  font-weight: 600 !important;
  font-size: 0.85rem !important;
  font-family: inherit !important;
  cursor: pointer !important;
  transition: var(--transition) !important;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary) !important;
}
.btn-clara-action.btn-primary {
  background: var(--accent) !important;
  border: none !important;
  color: #fff !important;
}
.btn-clara-icon {
  width: 38px !important;
  height: 38px !important;
  border-radius: 8px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  cursor: pointer !important;
  transition: var(--transition) !important;
  border: 1px solid var(--border) !important;
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
}
.btn-clara-icon:hover, .btn-clara-action:hover {
  border-color: var(--accent) !important;
  color: var(--accent) !important;
}

/* ===== CONTENT ===== */
.content { flex: 1; overflow: hidden; min-height: 0; }
.view { display: none; }
.view.active { display: block; height: 100%; overflow-y: auto; padding: 1.75rem; overflow-anchor: none; }

/* ===== STATS ===== */
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.75rem;
}
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem 1.5rem;
  display: flex; align-items: center; gap: 1rem;
  transition: var(--transition);
}
.stat-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.stat-icon { font-size: 1.5rem; padding: 0.65rem; border-radius: var(--radius-sm); }
.stat-label { font-size: 0.78rem; color: var(--text-secondary); margin-bottom: 0.2rem; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--text-primary); }

#dash-v2 .stat-card {
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 0;
}

/* ===== SECTION HEADER ===== */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.section-header h2 { font-size: 1rem; font-weight: 600; }
.search-bar input {
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-primary); padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm); width: 280px; font-size: 0.85rem;
  transition: var(--transition);
}
.search-bar input:focus { outline: none; border-color: var(--accent); }

/* ===== TABLE ===== */
.table-wrapper {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: auto;
}
@media (min-width: 769px) {
  .table-wrapper {
    max-height: calc(100vh - 240px);
  }
}
.orders-table, .data-table { width: 100%; border-collapse: collapse; min-width: max-content; }
.orders-table thead, .data-table thead { background: var(--bg-secondary); }
.orders-table th, .data-table th {
  padding: 0.75rem 1rem; text-align: left;
  font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-secondary); border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-secondary);
}
.orders-table th[onclick] {
  cursor: pointer;
  transition: var(--transition);
}
.orders-table th[onclick]:hover, .data-table th[onclick]:hover {
  background: var(--bg-hover);
  color: var(--accent);
}
.orders-table tr, .data-table tr { border-bottom: 1px solid var(--border); }
.orders-table td {
  padding: 0.85rem 1rem;
  font-size: 0.875rem; vertical-align: middle;
}
.orders-table tr:last-child { border-bottom: none; }
.orders-table tr:last-child td { border-bottom: none; }
.orders-table tbody tr:hover { background: var(--bg-hover); }
.empty-state { text-align: center; color: var(--text-muted); padding: 2.5rem; }

/* ===== BADGES ===== */
.badge {
  display: inline-block; padding: 0.25rem 0.6rem;
  border-radius: 99px; font-size: 0.72rem; font-weight: 600;
}
.badge-servicio-preventivo { background: var(--accent-light); color: var(--accent); }
.badge-garantia { background: var(--purple-light); color: var(--purple); }
.badge-inspeccion { background: rgba(14, 165, 233, 0.12); color: #0ea5e9; }
.badge-entrega-y-puesta-en-marcha { background: var(--green-light); color: var(--green); }
.badge-pre-entrega { background: var(--orange-light); color: var(--orange); }
.badge-entrega-refacciones { background: rgba(244, 63, 94, 0.12); color: #f43f5e; }
.badge-otro { background: var(--bg-hover); color: var(--text-secondary); }
.badge-pendiente { background: var(--red-light); color: var(--red); }
.badge-proceso { background: var(--accent-light); color: var(--accent); }
.badge-completado { background: var(--green-light); color: var(--green); }

/* ===== ACTION BUTTONS ===== */
.action-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary); font-size: 1rem; padding: 0.3rem;
  border-radius: var(--radius-sm); transition: var(--transition);
}
.action-btn:hover { color: var(--accent); background: var(--accent-light); }
.action-btn.del:hover { color: var(--red); background: var(--red-light); }

/* ===== CLIENTES / TECNICOS GRID ===== */
.clientes-grid, .tecnicos-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 1rem;
}
.card-person {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
  transition: var(--transition);
}
.card-person:hover { border-color: var(--accent); }
.card-person-name { font-weight: 600; margin-bottom: 0.3rem; }
.card-person-sub { font-size: 0.78rem; color: var(--text-secondary); }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  z-index: 200; padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius); width: 100%; max-width: 860px;
  max-height: 92vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow);
  animation: slideUp 0.25s ease;
}
@keyframes slideUp {
  from { opacity:0; transform:translateY(20px); }
  to { opacity:1; transform:translateY(0); }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h2 { font-size: 1.1rem; font-weight: 600; }
.modal-close {
  background: none; border: none; color: var(--text-secondary);
  font-size: 1.1rem; cursor: pointer; padding: 0.3rem;
  border-radius: var(--radius-sm); transition: var(--transition);
}
.modal-close:hover { color: var(--red); background: var(--red-light); }
.modal-body { overflow-y: auto; padding: 1.5rem; flex: 1; }

/* ===== FORM ===== */
.form-section { margin-bottom: 1.75rem; }
.form-section-title {
  font-size: 0.82rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--accent); margin-bottom: 0.85rem;
  padding-bottom: 0.5rem; border-bottom: 1px solid var(--border);
}
.form-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem;
}
.form-group { display: flex; flex-direction: column; gap: 0.3rem; }
.form-group.full-width { grid-column: 1/-1; }
.form-group label { font-size: 0.78rem; color: var(--text-secondary); font-weight: 500; }
.form-group input, .form-group textarea, .form-group select {
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-primary); padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm); font-size: 0.875rem;
  font-family: inherit; transition: var(--transition); width: 100%;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  outline: none; border-color: var(--accent);
}
.form-group textarea { resize: vertical; }
.form-group select { cursor: pointer; }

/* Custom form classes for Gastos modal */
.form-input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: inherit;
  transition: var(--transition);
  width: 100%;
}
.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}
.form-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 0.35rem;
  display: block;
}

@media (max-width: 600px) {
  #modal-gasto-overlay .modal-body {
    grid-template-columns: 1fr !important;
    gap: 1.25rem !important;
  }
}


/* Custom elegant select (used outside form-groups like in headers) */
.form-select {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 0.5rem 2.2rem 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238892a4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1em;
}
.form-select:hover {
  border-color: var(--accent);
}
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

.form-actions {
  display: flex; justify-content: flex-end; gap: 0.75rem;
  padding-top: 1rem; border-top: 1px solid var(--border); margin-top: 0.5rem;
}

/* ===== TIPO CHIPS ===== */
.tipo-chips { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.chip { cursor: pointer; }
.chip input[type=radio] { display: none; }
.chip span {
  display: inline-block; padding: 0.45rem 1rem;
  border: 1px solid var(--border); border-radius: 99px;
  font-size: 0.82rem; font-weight: 500; color: var(--text-secondary);
  transition: var(--transition);
}
.chip input[type=radio]:checked + span {
  background: var(--accent-light); color: var(--accent); border-color: var(--accent);
}
.chip span:hover { border-color: var(--accent); color: var(--accent); }

/* ===== REFACCIONES ===== */
.refacciones-cols { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.ref-subtitle { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.5rem; }
.ref-row {
  display: flex; gap: 0.4rem; align-items: center; margin-bottom: 0.4rem; flex-wrap: wrap; padding-bottom: 2px;
}
.ref-row input {
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-primary); padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm); font-size: 0.8rem; flex: 1;
}
.ref-row input:focus { outline: none; border-color: var(--accent); }
.btn-add-ref {
  background: var(--accent-light); color: var(--accent);
  border: 1px dashed var(--accent); padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm); cursor: pointer; font-size: 0.8rem;
  transition: var(--transition); margin-top: 0.25rem;
}
.btn-add-ref:hover { background: var(--accent); color: #fff; }
.btn-del-ref {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 0.9rem; padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm); transition: var(--transition); flex-shrink: 0;
}
.btn-del-ref:hover { color: var(--red); background: var(--red-light); }

/* ===== DÍAS TABS ===== */
.dias-tabs { display: flex; gap: 0.4rem; margin-bottom: 1rem; flex-wrap: wrap; }
.dia-tab {
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-secondary); padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm); cursor: pointer; font-size: 0.82rem;
  font-weight: 500; transition: var(--transition); font-family: inherit;
}
.dia-tab.active { background: var(--accent-light); color: var(--accent); border-color: var(--accent); }
.dia-tab:hover { border-color: var(--accent); color: var(--accent); }
.dia-panel { display: none; }
.dia-panel.active { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }

/* ===== DETALLE MODAL ===== */
.detalle-section { margin-bottom: 1.5rem; }
.detalle-section-title {
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--accent); margin-bottom: 0.75rem;
  padding-bottom: 0.4rem; border-bottom: 1px solid var(--border);
}
.detalle-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 0.75rem; }
.detalle-field { background: var(--bg-card); border-radius: var(--radius-sm); padding: 0.65rem 0.85rem; }
.detalle-label { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 0.2rem; }
.detalle-value { font-size: 0.9rem; font-weight: 500; word-break: break-word; }
.detalle-ref-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.detalle-ref-table th {
  background: var(--bg-card); padding: 0.5rem 0.75rem;
  text-align: left; font-size: 0.72rem; color: var(--text-muted);
  text-transform: uppercase;
}
.detalle-ref-table td { padding: 0.5rem 0.75rem; border-top: 1px solid var(--border); }
.print-only { display: none; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .form-grid { grid-template-columns: repeat(2,1fr); }
  .refacciones-cols { grid-template-columns: 1fr; }
  .detalle-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 640px) {
  .sidebar { 
    transform: translateX(-100%);
    position: fixed;
    z-index: 9999;
    height: 100vh;
    transition: transform 0.3s ease;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  #app-wrapper.visible { padding-left: 0; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .search-bar input { width: 100%; }
}
/* ===== TABLAS RESPONSIVAS (CARD VIEW) ===== */
@media (max-width: 768px) {
  .table-wrapper {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
  }
  .orders-table, .data-table {
    display: block;
    width: 100%;
  }
  .orders-table thead, .data-table thead {
    display: none;
  }
  .orders-table tbody, .data-table tbody {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }
  .orders-table tr, .data-table tr {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-md);
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
  }
  .orders-table td, .data-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    border: none !important;
    border-bottom: 1px solid var(--border-light) !important;
    text-align: right;
  }
  .orders-table td:last-child, .data-table td:last-child {
    border-bottom: none !important;
  }
  .orders-table td::before, .data-table td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    text-align: left;
    margin-right: 1rem;
  }
  .orders-table td[data-label=""]::before, .data-table td[data-label=""]::before {
    display: none;
  }
  /* Estilos para celdas sin data-label o acciones */
  .orders-table td[data-label="Acciones"] > div, .data-table td[data-label="Acciones"] > div {
    width: 100%;
    justify-content: flex-end;
  }
  .empty-state {
    justify-content: center !important;
    text-align: center !important;
  }
  .empty-state::before { display: none !important; }
}

/* ===== TICKETS ===== */
.tickets-kanban-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 0.75rem; margin-bottom: 0.25rem;
}
.ticket-filters { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.filter-btn {
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-secondary); padding: 0.4rem 0.9rem;
  border-radius: 99px; cursor: pointer; font-size: 0.8rem;
  font-weight: 500; transition: var(--transition); font-family: inherit;
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn.active { background: var(--accent-light); color: var(--accent); border-color: var(--accent); }

/* Priority badges */
.badge-urgente { background: var(--red-light); color: var(--red); }
.badge-alta { background: rgba(249,115,22,0.12); color: #f97316; }
.badge-media { background: var(--orange-light); color: var(--orange); }
.badge-baja { background: var(--green-light); color: var(--green); }

/* Ticket status */
.badge-abierto { background: var(--orange-light); color: var(--orange); }
.badge-refacciones { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.badge-en-proceso { background: var(--accent-light); color: var(--accent); }
.badge-resuelto { background: var(--green-light); color: var(--green); }
.badge-cerrado { background: rgba(100,116,139,0.15); color: #94a3b8; }
.badge-cerrado-aprobado { background: var(--green-light); color: var(--green); }
.badge-cerrado-rechazado { background: var(--red-light); color: var(--red); }

/* Nav badge counter */
.nav-badge {
  margin-left: auto; background: var(--red);
  color: #fff; border-radius: 99px; font-size: 0.65rem;
  font-weight: 700; padding: 0.1rem 0.45rem;
  min-width: 1.2rem; text-align: center; display: none;
}
.nav-badge.visible { display: inline-block; }

/* ===== CUSTOM FILE UPLOAD ===== */
.custom-file-upload {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 1.5rem 1rem; border: 2px dashed var(--border); border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02); color: var(--text-muted); cursor: pointer;
  transition: var(--transition);
  margin-top: 0.25rem;
}
.custom-file-upload:hover {
  border-color: var(--accent); color: var(--accent); background: var(--accent-light);
}
.custom-file-upload input[type="file"] {
  display: none;
}
.custom-file-upload .file-label-text {
  font-size: 0.8rem; font-weight: 500; text-align: center;
  max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ===== RECEIPT MODAL (TICKET) ===== */
.modal-receipt {
  background: var(--bg-card);
  border-radius: 0 !important; /* Receipts are not rounded */
  box-shadow: 0 10px 40px rgba(0,0,0,0.15), 0 0 0 1px var(--border);
  position: relative;
  border: none !important;
}

.modal-receipt .modal-header {
  border-bottom: 2px dashed var(--border) !important;
  text-align: center;
  padding-bottom: 1.5rem;
}

.modal-receipt .modal-header h2 {
  font-family: monospace;
  font-size: 1.25rem;
  letter-spacing: 1px;
  width: 100%;
}

.modal-receipt .detalle-section {
  border-bottom: 1px dashed var(--border);
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
}

.modal-receipt .detalle-section:last-of-type {
  border-bottom: none;
}

.modal-receipt .detalle-section-title {
  font-family: monospace;
  font-size: 0.85rem;
  letter-spacing: 2px;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 1rem;
}

/* Remove grey boxes from ticket fields so it looks printed on paper */
.modal-receipt .detalle-field {
  background: transparent !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin-bottom: 0.5rem;
}

.modal-receipt .detalle-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}

.modal-receipt .detalle-value {
  font-family: monospace;
  font-size: 0.95rem;
}

.receipt-edge-top, .receipt-edge-bottom {
  position: absolute;
  left: 0; right: 0;
  height: 8px;
  background-size: 16px 16px;
  z-index: 10;
}
.receipt-edge-top {
  top: -8px;
  background-image: linear-gradient(-45deg, var(--bg-card) 8px, transparent 0), linear-gradient(45deg, var(--bg-card) 8px, transparent 0);
  background-position: left bottom;
}
.receipt-edge-bottom {
  bottom: -8px;
  background-image: linear-gradient(135deg, var(--bg-card) 8px, transparent 0), linear-gradient(-135deg, var(--bg-card) 8px, transparent 0);
  background-position: left top;
}

/* ===== CANAL CHIPS (ORIGEN TICKET) ===== */
.canal-chips { display: flex; gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.canal-chip { cursor: pointer; flex: 1; min-width: 120px; }
.canal-chip input[type=radio] { display: none; }
.canal-chip-inner {
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  padding: 1rem 0.75rem; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--bg-card);
  color: var(--text-secondary); font-size: 0.82rem; font-weight: 500;
  transition: var(--transition);
}
.canal-chip-inner svg { width: 1.4rem; height: 1.4rem; stroke: currentColor; stroke-width: 1.75; }
.canal-chip-inner:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.canal-chip input[type=radio]:checked + .canal-chip-inner {
  border-color: var(--accent); color: var(--accent);
  background: var(--accent-light); box-shadow: 0 0 0 2px rgba(232,130,12,0.2);
}
.canal-input-box {
  animation: fadeSlide 0.2s ease;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.85rem 1rem;
  margin-top: 0.25rem;
}
@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== LOGIN SCREEN ===== */
.login-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: #0a0c14;
  display: flex; align-items: center; justify-content: center;
  overflow-y: auto;
}
.login-screen.hidden { display: none; }

.login-bg-grid {
  position: fixed; inset: 0; z-index: 0;
  background-image:
    linear-gradient(rgba(232,130,12,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232,130,12,0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  animation: gridMove 20s linear infinite;
}
@keyframes gridMove {
  from { background-position: 0 0; }
  to { background-position: 48px 48px; }
}

.login-container {
  position: relative; z-index: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  padding: 2.5rem 2rem;
  width: 100%; max-width: 480px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(232,130,12,0.08);
  animation: loginEntrada 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes loginEntrada {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo-wrap { text-align: center; margin-bottom: 2rem; }
.login-logo-img { height: 72px; object-fit: contain; }

.login-title { font-size: 1.5rem; font-weight: 700; text-align: center; margin-bottom: 0.35rem; color: var(--text-primary); }
.login-sub { text-align: center; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1.5rem; }

/* Divider */
.login-divider { display: flex; align-items: center; gap: 0.75rem; color: var(--text-muted); font-size: 0.75rem; margin-bottom: 0.85rem; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.login-setup-btn {
  width: 100%; background: none; border: 1px dashed var(--border);
  color: var(--text-secondary); border-radius: var(--radius-sm);
  padding: 0.6rem; cursor: pointer; font-size: 0.82rem; font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
  transition: var(--transition);
}
.login-setup-btn svg { width: 0.9rem; height: 0.9rem; stroke: currentColor; stroke-width: 2; }
.login-setup-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

/* Back btn */
.login-back-btn {
  display: flex; align-items: center; gap: 0.35rem;
  background: none; border: none; color: var(--text-muted);
  font-size: 0.78rem; cursor: pointer; font-family: inherit;
  margin-bottom: 1.25rem; padding: 0.25rem; transition: var(--transition);
}
.login-back-btn svg { width: 0.8rem; height: 0.8rem; stroke: currentColor; stroke-width: 2; }
.login-back-btn:hover { color: var(--accent); }

.pin-error { color: var(--red); font-size: 0.78rem; min-height: 1.2rem; margin-bottom: 0.75rem; text-align: center; }

/* Create user form inside login */
.login-crear-form { display: flex; flex-direction: column; gap: 0.75rem; }
.login-step-crear .form-group label { font-size: 0.78rem; color: var(--text-secondary); }
.login-step-crear .form-group input,
.login-step-crear .form-group select {
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-primary); padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm); font-size: 0.875rem; font-family: inherit;
  width: 100%; transition: var(--transition);
}
.login-step-crear .form-group input:focus,
.login-step-crear .form-group select:focus { outline: none; border-color: var(--accent); }

/* Logout button */
.logout-btn {
  display: flex; align-items: center; gap: 0.6rem; width: 100%;
  background: none; border: none; color: var(--text-muted);
  padding: 0.6rem 0.85rem; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 0.82rem; font-family: inherit;
  transition: var(--transition); font-weight: 500;
}
.logout-btn svg { width: 0.9rem; height: 0.9rem; stroke: currentColor; stroke-width: 2; }
.logout-btn:hover { background: var(--red-light); color: var(--red); }
.sidebar-version { padding: 0.25rem 0.85rem; font-size: 0.68rem; color: var(--text-muted); }

/* App wrapper visibility */
#app-wrapper { display: none; }
#app-wrapper.visible { display: flex; flex-direction: column; height: 100vh; width: 100%; padding-left: var(--sidebar-w); }

/* ===== CUSTOM COMBOBOX ===== */
.combo-box {
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 0.55rem 0.75rem; border-radius: var(--radius-sm);
  display: flex; justify-content: space-between; align-items: center;
  cursor: pointer; font-size: 0.875rem; color: var(--text-primary);
  transition: var(--transition);
}
.combo-box:hover { border-color: var(--border-hover); }
.combo-box.focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(10, 107, 240, 0.1); }
.combo-menu {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: 0 4px 15px rgba(0,0,0,0.08);
  z-index: 100; display: none; flex-direction: column; overflow: hidden;
}
.combo-menu.open { display: flex; animation: slideDown 0.15s ease; }
.combo-search {
  padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 0.5rem; background: var(--bg-body);
}
.combo-search input {
  border: none; background: transparent; width: 100%; font-size: 0.85rem;
  color: var(--text-primary); outline: none; padding: 0.2rem 0;
}
.combo-options { max-height: 180px; overflow-y: auto; padding: 0.25rem; }
.combo-option {
  padding: 0.5rem 0.75rem; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 0.85rem; color: var(--text-primary); transition: background 0.15s;
}
.combo-option:hover { background: var(--bg-hover); color: var(--accent); }
.combo-add {
  padding: 0.6rem 0.75rem; border-top: 1px solid var(--border); background: var(--bg-hover);
  color: var(--accent); font-size: 0.85rem; font-weight: 500; cursor: pointer;
  display: flex; align-items: center; gap: 0.4rem; transition: background 0.15s;
}
.combo-add:hover { background: var(--blue-light); }

/* ===== PRINT ===== */
@media print {
  @page { margin: 1.5cm; }

  body { 
    background: white !important; 
    margin: 0 !important; 
    padding: 0 !important; 
    -webkit-print-color-adjust: exact !important; 
    print-color-adjust: exact !important; 
    display: block !important; 
    height: auto !important;
    min-height: auto !important;
    overflow: visible !important;
  }

  .sidebar, .main-wrapper, .topbar, .content, .btn-primary, .btn-secondary,
  .modal-header button, .form-actions, #detalle-header-actions { display: none !important; }
  
  .modal-overlay { display: none !important; }
  .modal-overlay.open { 
    display: block !important; 
    position: static !important; 
    background: transparent !important; 
    backdrop-filter: none !important; 
    padding: 0 !important; 
  }
  
  .modal { box-shadow: none !important; border: none !important; max-height: none !important; width: 100% !important; max-width: 100% !important; margin: 0 !important; }
  .modal-body { padding: 0 !important; overflow: visible !important; height: auto !important; max-height: none !important; }
  
  .print-only { display: block; }
  /* Signature print handling */
  #firma-canvas, canvas { display: none !important; }
  .detalle-section button { display: none !important; }
  
  /* Fix Grid Page Breaks */
  .detalle-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 1rem !important;
  }
  .detalle-grid > * {
    flex: 1 1 180px !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
  .detalle-section {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    display: block !important;
  }
}

/* Tooltip styles */
.tooltip-container { position: relative; display: inline-block; }
.tooltip-container .tooltip-box {
  visibility: hidden;
  width: 250px;
  background-color: var(--bg-card);
  color: var(--text-primary);
  text-align: left;
  border-radius: 6px;
  padding: 10px;
  position: absolute;
  z-index: 100;
  bottom: 125%;
  left: 50%;
  margin-left: -125px;
  opacity: 0;
  transition: opacity 0.3s;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  font-size: 0.75rem;
  font-weight: normal;
  pointer-events: none;
}
.tooltip-container .tooltip-box::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: var(--border) transparent transparent transparent;
}
.tooltip-container:hover .tooltip-box {
  visibility: visible;
  opacity: 1;
}


.show-filters { display: flex !important; }

/* ===== CUSTOM COMBOBOX ===== */
.combobox-wrapper {
  position: relative;
}
.combobox-wrapper input {
  width: 100%;
  padding-right: 30px;
}
.combobox-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 9999;
  display: none;
  list-style: none;
  box-shadow: var(--shadow);
  padding: 0.25rem 0;
}
.combobox-list.open {
  display: block;
}
.combobox-list li {
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 0.9rem;
}
.combobox-list li:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}
.rotating {
  animation: spin 1s linear infinite;
}

/* ===== FULLCALENDAR EUROREP THEME ===== */
:root {
  --fc-border-color: var(--border);
  --fc-page-bg-color: transparent;
  --fc-neutral-bg-color: var(--bg-hover);
  --fc-neutral-text-color: var(--text-primary);
  --fc-today-bg-color: rgba(232, 130, 12, 0.05); /* very light accent */
  
  --fc-button-text-color: var(--text-primary);
  --fc-button-bg-color: var(--bg-secondary);
  --fc-button-border-color: var(--border);
  --fc-button-hover-bg-color: var(--bg-hover);
  --fc-button-hover-border-color: var(--border);
  --fc-button-active-bg-color: var(--accent);
  --fc-button-active-border-color: var(--accent);
  
  --fc-event-text-color: #ffffff;
  --fc-event-border-color: transparent;
  
  --fc-daygrid-event-dot-width: 8px;
}

#calendar-container {
  font-family: 'Outfit', sans-serif;
  color: var(--text-primary);
}

.fc-theme-standard td, .fc-theme-standard th {
  border-color: var(--border) !important;
}

.fc-scrollgrid {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.fc-header-toolbar {
  margin-bottom: 1.5rem !important;
  padding: 0.5rem 0;
}

.fc .fc-toolbar-title {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.fc .fc-button {
  text-transform: capitalize;
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.4rem 0.8rem;
  box-shadow: none !important;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.fc .fc-button-primary:not(:disabled).fc-button-active, 
.fc .fc-button-primary:not(:disabled):active {
  background-color: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.fc-event {
  border-radius: 4px !important;
  padding: 2px 4px;
  border: none !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.fc-event:hover {
  transform: translateY(-1px);
  opacity: 0.9;
}

.fc-day-today {
  background: var(--bg-hover) !important;
}

.fc-col-header-cell-cushion {
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 0.8rem;
  padding: 0.5rem !important;
}

.fc-daygrid-day-number {
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.5rem !important;
}

.fc .fc-day-other .fc-daygrid-day-top {
  opacity: 0.3;
}

/* ===== FULLCALENDAR LIST VIEW PREMIUM STYLES ===== */
.fc-list {
  background: var(--bg-card) !important;
  border-color: var(--border) !important;
  border-radius: var(--radius-sm) !important;
  overflow: hidden !important;
}

.fc-list-empty {
  background: var(--bg-card) !important;
  padding: 3rem 1rem !important;
  text-align: center !important;
}

.fc-list-empty-cushion {
  color: var(--text-secondary) !important;
  font-family: 'Outfit', sans-serif !important;
  font-size: 0.95rem !important;
  font-weight: 500 !important;
}

.fc-list-day-cushion {
  background: var(--bg-hover) !important;
  color: var(--text-primary) !important;
  font-weight: 600 !important;
  padding: 0.6rem 1rem !important;
}

.fc-list-event {
  background: var(--bg-card) !important;
  transition: background 0.15s ease !important;
}

.fc-list-event:hover {
  background: var(--bg-hover) !important;
}

.fc-list-event-title a {
  color: var(--text-primary) !important;
  font-weight: 500 !important;
  text-decoration: none !important;
}

.fc-list-event-time {
  color: var(--text-secondary) !important;
  font-weight: 600 !important;
}

.fc-list-table {
  border-color: var(--border) !important;
}

.fc-list-day {
  border-color: var(--border) !important;
}

/* ===== SYNC STATUS INDICATOR ===== */
.sync-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm, 6px);
  background: var(--bg-card, #141722);
  border: 1px solid var(--border, #2d3142);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.2s ease;
  user-select: none;
  height: 36px;
  color: var(--text-secondary);
}

.sync-status-indicator:hover {
  background: var(--bg-hover, #1b1f2f);
  border-color: var(--border-hover, #3d435f);
}

.sync-status-indicator.status-online {
  color: #10b981 !important; /* Premium green */
  border-color: rgba(16, 185, 129, 0.2) !important;
  background: rgba(16, 185, 129, 0.05) !important;
}
.sync-status-indicator.status-online:hover {
  background: rgba(16, 185, 129, 0.1) !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
}

.sync-status-indicator.status-syncing {
  color: #f59e0b !important; /* Warm orange */
  border-color: rgba(245, 158, 11, 0.2) !important;
  background: rgba(245, 158, 11, 0.05) !important;
}
.sync-status-indicator.status-syncing:hover {
  background: rgba(245, 158, 11, 0.1) !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
}

.sync-status-indicator.status-offline {
  color: #ef4444 !important; /* Alert red */
  border-color: rgba(239, 68, 68, 0.2) !important;
  background: rgba(239, 68, 68, 0.05) !important;
}
.sync-status-indicator.status-offline:hover {
  background: rgba(239, 68, 68, 0.1) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
}

.sync-pending-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 9px;
  background: var(--accent, #e8820c);
  color: #ffffff !important;
  margin-left: 2px;
  animation: pulseBadge 2s infinite;
}

@keyframes pulseBadge {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(232, 130, 12, 0.4); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 5px rgba(232, 130, 12, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(232, 130, 12, 0); }
}

/* Mobile Optimizations for Forms, Layout & Dashboard Grids */
.dashboard-grid {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}
.dashboard-grid.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}
.dashboard-grid.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}
.dashboard-grid.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

@media screen and (max-width: 1024px) {
  .dashboard-grid.grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media screen and (max-width: 768px) {
  /* Turn sidebar into fixed bottom tab navigation on mobile */
  .sidebar {
    transform: none !important;
    position: fixed !important;
    bottom: 0 !important;
    top: auto !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: calc(60px + env(safe-area-inset-bottom, 0px)) !important;
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
    flex-direction: row !important;
    background: var(--bg-secondary) !important;
    border-top: 1px solid var(--border) !important;
    border-right: none !important;
    border-left: none !important;
    z-index: 9999 !important;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15) !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.25rem !important;
    padding: 0 0.5rem !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-width: none !important;
    -webkit-overflow-scrolling: touch !important;
  }
  .sidebar::-webkit-scrollbar {
    display: none !important;
  }
  .sidebar-logo {
    display: none !important;
  }
  .sidebar-nav {
    display: contents !important;
  }
  .sidebar-nav::-webkit-scrollbar {
    display: none !important;
  }
  .sidebar-bottom {
    display: contents !important;
  }
  .sidebar-footer {
    display: none !important;
  }
  .nav-item {
    flex: 1 1 0% !important;
    min-width: 72px !important;
    max-width: 140px !important;
    display: flex;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    height: 100% !important;
    padding: 0.4rem 0.2rem !important;
    margin: 0 !important;
    gap: 2px !important;
    border-radius: var(--radius-sm) !important;
    font-size: 0.65rem !important;
    text-align: center !important;
    position: relative !important;
  }
  .nav-item span:not(.nav-icon) {
    font-size: 0.62rem !important;
    max-width: 100% !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-align: center !important;
    line-height: 1.1 !important;
  }
  .nav-icon {
    margin: 0 !important;
    font-size: 1.1rem !important;
    width: auto !important;
    height: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .nav-icon svg, .nav-icon i {
    width: 1.25rem !important;
    height: 1.25rem !important;
  }
  /* Show/hide specific elements for mobile profile */
  .icon-desktop { display: none !important; }
  .label-desktop { display: none !important; }
  .icon-mobile { display: block !important; }
  .label-mobile { display: inline-block !important; }

  .nav-badge {
    position: absolute !important;
    top: 4px !important;
    right: 14px !important;
    margin: 0 !important;
    font-size: 0.6rem !important;
    padding: 1px 4px !important;
  }
  #app-wrapper.visible {
    padding-left: 0 !important;
  }
  
  .mobile-menu-btn {
    display: none !important;
  }
  .topbar-left {
    display: flex;
    align-items: center;
  }

  .dashboard-grid.grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
  .dashboard-grid.grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .topbar {
    padding: 0.5rem 1rem !important;
    gap: 0.5rem !important;
    flex-wrap: nowrap !important;
    height: 56px !important;
    align-items: center !important;
    justify-content: space-between !important;
  }
  
  .topbar-right {
    gap: 0.4rem !important;
    width: auto !important;
    margin-left: auto !important;
    flex-wrap: nowrap !important;
    justify-content: flex-end !important;
    align-items: center !important;
  }

  .topbar-left {
    display: flex !important;
    align-items: center !important;
    min-width: 0 !important;
    flex: 1 !important;
    margin-right: 0.5rem !important;
  }

  .topbar-left h1 {
    font-size: 1rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    flex: 1 !important;
  }

  /* Hide texts and details on mobile */
  #sync-status-indicator #sync-status-text {
    display: none !important;
  }
  .session-badge .session-info,
  .session-badge i[data-lucide="chevron-down"] {
    display: none !important;
  }
  .topbar-right .btn-text {
    display: none !important;
  }
  .role-switcher {
    display: none !important;
  }

  /* Make indicators/badges/buttons circular and compact */
  #sync-status-indicator {
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    justify-content: center !important;
    display: inline-flex !important;
    align-items: center !important;
    position: relative !important;
  }
  #sync-status-indicator .sync-pending-badge {
    position: absolute !important;
    top: -3px !important;
    right: -3px !important;
    margin: 0 !important;
    padding: 2px 5px !important;
    font-size: 0.65rem !important;
    line-height: 1 !important;
    border-radius: 999px !important;
  }
  .session-badge {
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    justify-content: center !important;
    display: inline-flex !important;
    align-items: center !important;
    border: 1px solid var(--border) !important;
  }
  .session-badge .session-avatar {
    margin: 0 !important;
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.85rem !important;
    border-radius: 50% !important;
  }
  #topbar-actions {
    display: flex !important;
    gap: 0.4rem !important;
  }
  #topbar-actions button {
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    display: inline-flex;
    align-items: center !important;
    justify-content: center !important;
    min-height: auto !important;
  }
  #topbar-actions button .btn-icon {
    margin: 0 !important;
    width: 18px !important;
    height: 18px !important;
  }

  /* Force view padding adjustment for 56px topbar and bottom navigation bar */
  .view.active {
    padding: 1.5rem 1rem calc(60px + env(safe-area-inset-bottom, 0px) + 1.5rem) 1rem !important;
  }

  /* Stack form actions on smaller mobile screens */
  .form-actions {
    flex-direction: column-reverse !important;
    gap: 0.5rem !important;
  }
  .form-actions button {
    width: 100% !important;
  }


  /* Make signature canvas responsive on mobile screens */
  canvas[id$="-canvas"] {
    width: 100% !important;
    max-width: 100% !important;
    height: 160px !important;
    touch-action: none; /* Crucial to prevent page scrolling while signing */
  }

  /* Improve form margins and touch target sizes for technician's thumb */
  .form-control, select, .combo-box, button {
    min-height: 44px; /* Standard mobile touch-target minimum */
    font-size: 16px !important; /* Prevents auto-zoom on iOS Safari */
  }
  
  .modal-body {
    padding: 1rem !important;
  }

  /* Tab scrolling and selections */
  .dia-tabs-scroller {
    display: flex;
    overflow-x: auto;
    gap: 0.35rem;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
  }

  .dia-tab {
    flex: 0 0 auto;
    padding: 0.6rem 1rem !important;
    font-size: 0.9rem !important;
  }

  /* Mobile FullCalendar Optimizations */
  .fc .fc-header-toolbar {
    display: grid !important;
    grid-template-areas:
      "title title"
      "nav views" !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.75rem !important;
    align-items: center !important;
    justify-content: center !important;
    margin-bottom: 1rem !important;
  }
  .fc .fc-toolbar-chunk:nth-child(1) {
    grid-area: nav !important;
    justify-self: start !important;
  }
  .fc .fc-toolbar-chunk:nth-child(2) {
    grid-area: title !important;
    justify-self: center !important;
  }
  .fc .fc-toolbar-chunk:nth-child(3) {
    grid-area: views !important;
    justify-self: end !important;
  }
  .fc .fc-toolbar-chunk {
    display: flex !important;
    align-items: center !important;
    gap: 0.25rem !important;
    flex-wrap: nowrap !important;
  }
  .fc .fc-button {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.75rem !important;
    min-height: auto !important; /* Override standard touch target minimum for calendar controls */
  }
  .fc .fc-toolbar-title {
    font-size: 1.1rem !important;
    text-align: center !important;
  }
  #calendar-container {
    padding: 0.5rem !important;
  }
}

@media screen and (max-width: 576px) {
  .dashboard-grid.grid-2,
  .dashboard-grid.grid-3,
  .dashboard-grid.grid-4 {
    grid-template-columns: 1fr;
  }

  .modal-overlay {
    padding: 0.5rem !important;
    align-items: flex-start !important;
    overflow-y: auto !important;
  }
  
  .modal {
    max-height: calc(100vh - 3rem) !important;
    max-height: calc(100svh - 3rem) !important;
    margin-top: 1.5rem !important;
    margin-bottom: 1.5rem !important;
  }

  /* Prevent modal header from shrinking on compressed screens */
  .modal-header {
    flex-shrink: 0 !important;
  }

  /* Improve detail modal header layout on small mobile screens */
  #modal-detalle .modal-header {
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.75rem !important;
    padding: 1rem !important;
  }
  
  #modal-detalle #detalle-title {
    font-size: 1.15rem !important;
    line-height: 1.2 !important;
    padding-right: 2.5rem !important; /* Leave space for the close button */
    word-break: break-word !important;
    margin: 0 !important;
  }
  
  #modal-detalle #detalle-header-actions {
    width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
    align-items: center !important;
  }

  /* Position close button absolutely in the top-right corner */
  #modal-detalle #detalle-header-actions .modal-close {
    position: absolute !important;
    top: 0.85rem !important;
    right: 1rem !important;
    width: 36px !important;
    height: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: auto !important;
    margin: 0 !important;
    font-size: 1.25rem !important;
    background: none !important;
    border: none !important;
    color: var(--text-secondary) !important;
    border-radius: var(--radius-sm) !important;
    transition: var(--transition) !important;
  }
  
  #modal-detalle #detalle-header-actions .modal-close:hover {
    color: var(--red) !important;
    background: var(--red-light) !important;
  }

  /* Make header action buttons expand and fit comfortably */
  #modal-detalle #detalle-header-actions button:not(.modal-close) {
    flex: 1 1 auto !important;
    font-size: 0.8rem !important;
    min-height: 38px !important; /* Slightly more compact but highly touchable */
    padding: 0.4rem 0.8rem !important;
    justify-content: center !important;
    white-space: nowrap !important;
  }
}

/* ===== CONTROL DE GASTOS & CLARA STYLES ===== */
.badge-g-pendiente { background: var(--orange-light); color: var(--orange); }
.badge-g-aprobado { background: var(--green-light); color: var(--green); }
.badge-g-rechazado { background: var(--red-light); color: var(--red); }

.badge-metodo-clara { background: rgba(139, 92, 246, 0.12); color: #a78bfa; border: 1px solid rgba(139, 92, 246, 0.2); }
.badge-metodo-reembolso { background: rgba(100, 116, 139, 0.15); color: #94a3b8; border: 1px solid rgba(100, 116, 139, 0.2); }

body.light-mode .badge-metodo-clara { background: rgba(124, 58, 237, 0.08); color: #6d28d9; border: 1px solid rgba(124, 58, 237, 0.15); }
body.light-mode .badge-metodo-reembolso { background: rgba(100, 116, 139, 0.08); color: #475569; border: 1px solid rgba(100, 116, 139, 0.15); }

/* Clara transactions cards layout */
.clara-txs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.clara-tx-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.clara-tx-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: #a78bfa; /* Clara purple */
}

.clara-tx-card:hover {
  transform: translateY(-2px);
  border-color: #a78bfa;
  box-shadow: var(--shadow);
}

.clara-tx-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.clara-tx-merchant {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text-primary);
  word-break: break-word;
}

.clara-tx-amount {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text-primary);
}

.clara-tx-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 1rem;
}

.clara-tx-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  margin-top: 0.5rem;
}

/* Responsive expenses card layout (used on mobile instead of table) */
.gastos-mobile-cards {
  display: none;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.gasto-mobile-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.gasto-mobile-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gasto-mobile-card-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.gasto-mobile-card-value {
  font-weight: 600;
  font-size: 0.85rem;
}

.gasto-mobile-card-desc {
  font-size: 0.85rem;
  color: var(--text-primary);
  background: var(--bg-primary);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  margin-top: 0.25rem;
  border: 1px solid var(--border);
}

/* Media query to switch table/cards and general mobile overrides */
@media screen and (max-width: 768px) {
  .gastos-desktop-table {
    display: none !important;
  }
  .gastos-mobile-cards {
    display: flex !important;
  }

  /* Scrollable view-toggle tabs on mobile globally */
  .view-toggle {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 0.35rem !important;
    margin: 0 !important;
    padding: 0.3rem !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
  }
  .view-toggle::-webkit-scrollbar {
    display: none; /* Safari/Chrome */
  }
  .view-toggle button {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
    font-size: 0.8rem !important;
    padding: 0.45rem 0.85rem !important;
  }

  /* Stack KPIs / Stats in 1 column to prevent overflow */
  #view-gastos .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
    width: 100% !important;
  }
  #view-gastos .stat-card {
    padding: 1rem !important;
  }
  #view-gastos .stat-value {
    font-size: 1.5rem !important;
  }

  /* Wrap main header actions dynamically */
  #view-gastos .section-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.75rem !important;
  }
  #view-gastos .section-header div {
    width: 100% !important;
    justify-content: space-between !important;
  }
  #view-gastos .section-header button {
    flex: 1 !important;
    font-size: 0.8rem !important;
    padding: 0.5rem !important;
  }

  /* Search and select inputs stretching on mobile */
  #view-gastos .search-bar-container {
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 0.75rem !important;
    gap: 0.5rem !important;
  }
  #view-gastos .search-bar {
    width: 100% !important;
    min-width: 100% !important;
  }
  #view-gastos #filter-gasto-estado {
    width: 100% !important;
    min-width: 100% !important;
  }
  
  /* Ensure page content has correct padding and behaves well */
  .view {
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }
}

