* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #d64931;
  --primary-dark: #c13d27;
  --primary-light: #e55a42;
  --secondary: #1a237e;
  --secondary-light: #283593;

  --gray-50: #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #e5e5e5;
  --gray-300: #d4d4d4;
  --gray-400: #a3a3a3;
  --gray-500: #737373;
  --gray-600: #525252;
  --gray-700: #404040;
  --gray-800: #262626;
  --gray-900: #171717;

  --bg-main: #ffffff;
  --bg-sidebar: #fafafa;
  --bg-card: #ffffff;
  --bg-light: #f8f9fa;

  --text-dark: #171717;
  --text-gray: #525252;
  --text-light: #a3a3a3;

  --border: #e5e5e5;
  --shadow: rgba(0, 0, 0, 0.04);

  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
}

body {
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 300;
  letter-spacing: -0.01em;
  background: var(--bg-main);
  color: var(--text-dark);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 300;
  letter-spacing: -0.02em;
}

/* Material Symbols */
.material-symbols-outlined {
  font-size: 20px;
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 20;
  vertical-align: middle;
  line-height: 1;
}

.icon-inline {
  font-size: 18px;
  vertical-align: -3px;
  margin-right: 2px;
}

/* Icon sizes per context */
.login-logo-icon .material-symbols-outlined { font-size: 48px; }
.logo-icon .material-symbols-outlined { font-size: 28px; }
.nav-icon .material-symbols-outlined { font-size: 18px; }
.nav-item-level-2 .nav-icon .material-symbols-outlined { font-size: 16px; }
.expense-icon .material-symbols-outlined { font-size: 22px; color: var(--primary); }
.file-upload-icon .material-symbols-outlined { font-size: 32px; }
.empty-state-icon .material-symbols-outlined { font-size: 48px; }
.modal-close .material-symbols-outlined { font-size: 18px; }
.stat-icon .material-symbols-outlined { font-size: 48px; color: var(--primary); }
.stat-card-single .stat-icon .material-symbols-outlined { font-size: 56px; }
.btn .material-symbols-outlined { font-size: 18px; vertical-align: -3px; margin-right: 4px; }
.btn-sm .material-symbols-outlined { font-size: 16px; vertical-align: -3px; margin-right: 0; }

/* Login Page */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-light) 0%, var(--gray-100) 100%);
}

.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 48px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 10px 30px var(--shadow);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.login-logo-img {
  max-width: 180px;
  height: auto;
  margin-bottom: 16px;
}

.login-logo-text {
  font-family: 'Montserrat', sans-serif;
  font-size: 24px;
  font-weight: 400;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.login-logo-subtitle {
  font-size: 12px;
  color: var(--text-gray);
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.login-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #dc2626;
  padding: 12px;
  border-radius: 2px;
  font-size: 13px;
  margin-bottom: 20px;
  text-align: center;
}

/* Sidebar */
.sidebar {
  width: 240px;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  overflow-y: auto;
  z-index: 100;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 2px; }

.sidebar-header {
  padding: 0;
  border-bottom: none;
}

.logo {
  font-family: 'Montserrat', sans-serif;
  font-size: 20px;
  font-weight: 400;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.logo-icon { font-size: 32px; margin-bottom: 8px; }

.sidebar-logo-img {
  max-width: 120px;
  height: auto;
  margin-bottom: 8px;
}

.logo-subtitle {
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-gray);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.nav-section { padding: 24px 0; }

.nav-item {
  display: flex;
  align-items: center;
  padding: 12px 24px;
  color: var(--text-gray);
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border-left: 2px solid transparent;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.nav-item:hover { color: var(--text-dark); background: rgba(0, 0, 0, 0.02); }

.nav-item.active {
  color: var(--primary);
  background: rgba(214, 73, 49, 0.04);
  border-left-color: var(--primary);
  font-weight: 500;
}

.nav-icon { margin-right: 14px; font-size: 16px; }

.nav-item-level-2 {
  padding-left: 52px;
  font-size: 12px;
  opacity: 0.9;
}

.nav-item-level-2 .nav-icon {
  font-size: 14px;
  margin-right: 12px;
}

.nav-separator {
  height: 1px;
  background: var(--border);
  margin: 12px 16px;
  opacity: 0.6;
}

.nav-group-label {
  padding: 16px 24px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-gray);
  opacity: 0.6;
}

.nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: white;
  border-radius: 2px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
}

/* Topbar */
.topbar {
  height: 64px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: fixed;
  top: 0;
  right: 0;
  left: 240px;
  z-index: 90;
}

.mobile-menu-btn {
  display: none;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 2px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-gray);
  transition: all 0.2s;
}
.mobile-menu-btn:hover { background: var(--bg-light); color: var(--text-dark); }

.topbar-welcome {
  font-size: 18px;
  font-weight: 400;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-welcome span { font-weight: 300; color: var(--text-gray); }

.topbar-right { display: flex; gap: 20px; align-items: center; }

.topbar-link {
  font-size: 12px;
  color: var(--text-gray);
  text-decoration: none;
  transition: color 0.2s;
  cursor: pointer;
}
.topbar-link:hover { color: var(--primary); }

.hub-back-btn {
  display: flex; align-items: center; gap: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
}
.hub-back-btn:hover { color: var(--primary); border-color: var(--primary); background: var(--bg-secondary); }
.hub-back-btn .material-symbols-outlined { font-size: 18px; }
@media (max-width: 768px) { .hub-back-label { display: none; } }

.topbar-logo { height: 44px; width: auto; object-fit: contain; cursor: pointer; }
.hub-page .topbar { left: 0; }

/* User avatar menu */
.user-avatar-menu { position: relative; }
.user-avatar-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); color: #fff;
  border: none; cursor: pointer;
  font-size: 13px; font-weight: 600; letter-spacing: 0.5px;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.user-avatar-btn:hover { opacity: 0.85; }
.user-avatar-dropdown {
  display: none; position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 2px; box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  min-width: 180px; z-index: 200; overflow: hidden;
}
.user-avatar-dropdown.open { display: block; }
.user-avatar-dropdown-header {
  padding: 12px 16px 10px; border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--text-muted);
}
.user-avatar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; font-size: 14px; color: var(--text-dark);
  cursor: pointer; transition: background 0.15s; text-decoration: none;
}
.user-avatar-item:hover { background: var(--bg-secondary); }
.user-avatar-item .material-symbols-outlined { font-size: 18px; color: var(--text-muted); }

@media (max-width: 768px) {
  .hub-wrapper { padding: 24px 16px; }
  .hub-title { font-size: 22px; }
  .hub-apps-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .hub-app-card { padding: 4px 0 0; }
}

.user-menu { display: flex; align-items: center; gap: 10px; cursor: pointer; }

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 500;
}

.user-name { font-size: 13px; color: var(--text-dark); }

/* Main Content */
.main-content {
  margin-left: 240px;
  margin-top: 64px;
  padding: 32px 40px;
  min-height: calc(100vh - 64px);
}
.main-content.view-enter {
  animation: viewIn 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes viewIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header { margin-bottom: 32px; }

.page-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 24px;
  font-weight: 400;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.page-subtitle { font-size: 13px; font-weight: 300; color: var(--text-gray); }

/* Stats Row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}
.stats-row-3 { grid-template-columns: repeat(3, 1fr); }

/* Cajas grid (tarjetas) */
.cajas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.caja-card {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 16px;
}
.caja-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.caja-card-name { font-weight: 600; font-size: 15px; flex: 1 1 100%; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.caja-card-usuarios { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.caja-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.caja-stat-label { display: block; font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.caja-stat-value { font-weight: 600; font-size: 14px; }
.caja-stat-saldo { color: var(--primary); }
.caja-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Mi equipo grid (tarjetas) */
.team-grid { display: flex; flex-direction: column; gap: 10px; }
.team-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 12px 16px;
  flex-wrap: wrap;
}
.team-card-name { font-weight: 600; font-size: 14px; }
.team-card-email { font-size: 13px; color: var(--text-muted); }

/* Pestañas Aprobar Gastos (Caja / VISA) */
.aprobacion-gastos-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.aprobacion-gastos-tab {
  position: relative;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 4px;
  margin-right: 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-gray);
  cursor: pointer;
  transition: color 0.15s;
}
.aprobacion-gastos-tab::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  background: var(--primary);
  transform: scaleX(0);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.aprobacion-gastos-tab:hover { color: var(--text-dark); }
.aprobacion-gastos-tab.active {
  color: var(--primary);
}
.aprobacion-gastos-tab.active::after { transform: scaleX(1); }

/* Resumen de meses (Aprobar Gastos) */
.meses-resumen-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}
.mes-resumen-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 12px 16px;
}
.mes-resumen-card--actual {
  border-color: var(--primary);
  background: rgba(214, 73, 49, 0.06);
}
.mes-resumen-card--info { opacity: 0.85; }
.mes-resumen-card-info { min-width: 160px; }
.mes-resumen-card-title {
  font-size: 11px;
  color: var(--text-gray);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}
.mes-resumen-card-mes {
  font-size: 15px;
  font-weight: 600;
  text-transform: capitalize;
}
.mes-resumen-card-stats {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--text-muted);
  flex: 1;
}
.mes-resumen-card-stats strong { color: var(--text-dark); }
.mes-resumen-card-hint {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

.stat-box {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 24px;
  text-align: center;
  transition: all 0.2s;
}

.stat-box:hover { transform: translateY(-2px); box-shadow: 0 4px 8px var(--shadow); }

.stat-box-number {
  font-family: 'Montserrat', sans-serif;
  font-size: 36px;
  font-weight: 200;
  color: var(--text-dark);
  line-height: 1;
  margin-bottom: 8px;
}

.stat-box-label {
  font-size: 12px;
  color: var(--text-gray);
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-box-link {
  font-size: 11px;
  color: var(--primary);
  margin-top: 12px;
  display: inline-block;
  cursor: pointer;
  transition: color 0.2s;
}
.stat-box-link:hover { color: var(--primary-dark); }

/* Action Bar */
.action-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  align-items: center;
  justify-content: space-between;
}
.action-left { display: flex; gap: 12px; }

.btn {
  padding: 10px 18px;
  border-radius: 2px;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dark);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}

.btn:hover:not(:disabled) {
  background: var(--bg-light);
  border-color: var(--gray-300);
}

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

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-success {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
  border-color: #b91c1c;
}

.btn-success:hover:not(:disabled) {
  background: #047857;
  border-color: #047857;
}

.btn-warning:hover:not(:disabled) {
  background: #b45309;
  border-color: #b45309;
}

/* Filter Bar */
.filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
  padding: 20px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 2px;
}

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

.filter-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-gray);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-input, .filter-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 13px;
  font-family: inherit;
  background: var(--bg-card);
}

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

/* Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 2px;
  margin-bottom: 24px;
  overflow: hidden;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-dark);
}

.card-count {
  font-size: 12px;
  color: var(--text-gray);
  font-weight: 300;
}

.card-body { padding: 24px; }

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table thead th {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-gray);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--bg-light);
  white-space: nowrap;
}

.table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dark);
  vertical-align: middle;
}

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

.table tbody tr:hover {
  background: rgba(214, 73, 49, 0.02);
}

.table-animated tbody tr {
  opacity: 0;
  animation: rowIn 0.2s ease forwards;
}
.table-animated tbody tr:nth-child(1) { animation-delay: 0.00s; }
.table-animated tbody tr:nth-child(2) { animation-delay: 0.02s; }
.table-animated tbody tr:nth-child(3) { animation-delay: 0.04s; }
.table-animated tbody tr:nth-child(n+4) { animation-delay: 0.06s; }

.table-compact tbody td,
.table-compact thead th {
  padding-top: 10px;
  padding-bottom: 10px;
}

.cell-muted {
  color: var(--text-gray);
  font-size: 12px;
}

.cell-strong {
  font-family: 'Montserrat', sans-serif;
  font-weight: 500;
}

/* Expense Table */
.expense-table { }

.expense-row {
  display: grid;
  grid-template-columns: 48px 2fr 1.5fr 1fr 1fr 120px;
  gap: 16px;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  cursor: pointer;
}
.expense-row:not(.expense-row-form):not(.expense-row-editing) {
  opacity: 0;
  animation: rowIn 0.25s ease forwards;
}
.no-row-anim .expense-row {
  opacity: 1 !important;
  animation: none !important;
}
@keyframes rowIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.expense-table .expense-row:nth-child(1) { animation-delay: 0.00s; }
.expense-table .expense-row:nth-child(2) { animation-delay: 0.02s; }
.expense-table .expense-row:nth-child(3) { animation-delay: 0.04s; }
.expense-table .expense-row:nth-child(4) { animation-delay: 0.06s; }
.expense-table .expense-row:nth-child(5) { animation-delay: 0.08s; }
.expense-table .expense-row:nth-child(n+6) { animation-delay: 0.10s; }

.expense-row-km {
  grid-template-columns: 48px 2fr 1.3fr 0.9fr 1fr 0.9fr 120px;
}
.expense-row-aprobacion {
  grid-template-columns: 38px 2fr 1.4fr 1fr 1fr 120px 120px;
}
.expense-row-km-aprobacion {
  grid-template-columns: 38px 2fr 1.3fr 0.9fr 1fr 0.9fr 120px 120px;
}
.expense-row-selected {
  background: rgba(214, 73, 49, 0.06);
}

.expense-row:hover { background: rgba(214, 73, 49, 0.02); }
.expense-row:last-child { border-bottom: none; }

/* User-facing list grids (no icon column, factura column for gastos) */
.expense-row.expense-row-user { grid-template-columns: 2fr 1.5fr 1fr 1fr 80px 120px; }
.expense-row.expense-row-km-user { grid-template-columns: 2fr 1.5fr 1fr 1.3fr 1fr 120px; }

/* Column header row */
.expense-row-header {
  display: grid;
  grid-template-columns: 2fr 1.5fr 1fr 1fr 80px 120px;
  gap: 16px;
  padding: 6px 20px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-light);
}
.expense-row-header.expense-row-header-km { grid-template-columns: 2fr 1.5fr 1fr 1.3fr 1fr 120px; }
.expense-row-header.expense-row-header-aprobacion { grid-template-columns: 38px 2fr 1.4fr 1fr 1fr 120px 120px; }
.expense-row-header.expense-row-header-km-aprobacion { grid-template-columns: 38px 2fr 1.3fr 0.9fr 1fr 0.9fr 120px 120px; }
.req-star { color: #dc2626; }

.expense-select-cell {
  display: flex;
  align-items: center;
  justify-content: center;
}

.expense-row-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.expense-actions-inline {
  display: flex;
  justify-content: flex-end;
}

.bulk-toolbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-light);
}

.bulk-toolbar-select-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dark);
  user-select: none;
}

.bulk-toolbar-meta {
  font-size: 12px;
  color: var(--text-gray);
}

.bulk-toolbar-actions {
  display: flex;
  gap: 8px;
}

.expense-row-form { background: var(--bg-light); cursor: default !important; }
.expense-row-form:hover { background: var(--bg-light) !important; }
.expense-row-editing { background: var(--bg-light); cursor: default !important; }
.expense-row-editing:hover { background: var(--bg-light) !important; }

.expense-mobile-card {
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--bg-card);
  padding: 14px;
  margin: 10px 10px 0;
}

.expense-mobile-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.expense-mobile-fields-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.expense-mobile-label {
  font-size: 11px;
  color: var(--text-gray);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.expense-mobile-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 10px;
}

.expense-mobile-meta-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}

.expense-mobile-actions {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.km-mobile-card .expense-category {
  margin-bottom: 4px;
}

.km-mobile-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 10px;
}

.km-mobile-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.km-mobile-label {
  font-size: 11px;
  color: var(--text-gray);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.km-mobile-value {
  font-size: 14px;
  color: var(--text-dark);
  line-height: 1.35;
  word-break: break-word;
}

.km-mobile-distance {
  font-size: 15px;
  line-height: 1.35;
}

.km-mobile-actions .badge {
  align-self: flex-start;
}

.km-mobile-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.km-mobile-buttons .btn {
  justify-content: center;
}

.expense-mobile-create-row {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-light);
}

.list-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 16px 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.list-filters-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  flex: 1;
}

.list-filters-grid-km {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.list-create-box-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 16px 0;
  padding: 10px 12px;
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-bottom: none;
  border-radius: 2px 2px 0 0;
  background: rgba(16, 185, 129, 0.08);
  font-size: 12px;
  font-weight: 600;
  color: #047857;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.list-create-box-header .material-symbols-outlined {
  font-size: 18px;
}

.list-create-row {
  margin: 0 16px;
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 0 0 2px 2px;
  background: rgba(16, 185, 129, 0.04) !important;
}

.row-input {
  height: 32px;
  padding: 0 8px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 2px;
  width: 100%;
  box-sizing: border-box;
  background: white;
  color: var(--text-dark);
  font-family: inherit;
}
.row-input:focus { outline: none; border-color: var(--primary); }

.expense-icon {
  width: 40px;
  height: 40px;
  border-radius: 2px;
  background: var(--bg-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border: 1px solid var(--border);
}

.expense-category { font-size: 14px; font-weight: 500; color: var(--text-dark); margin-bottom: 2px; }
.expense-description { font-size: 12px; color: var(--text-gray); font-weight: 300; }
.expense-center { font-size: 13px; color: var(--text-gray); }

.expense-amount {
  font-family: 'Montserrat', sans-serif;
  font-size: 18px;
  font-weight: 400;
  color: var(--text-dark);
}

.expense-date { font-size: 12px; color: var(--text-gray); font-weight: 300; }

.badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-borrador {
  background: rgba(251, 191, 36, 0.15);
  color: #92400e;
  border: 1px solid rgba(251, 191, 36, 0.4);
}

.badge-pendiente {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-aprobado, .badge-aprobado_delegado, .badge-aprobado_gestion, .badge-aprobado_direccion {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-cerrado {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-rechazado, .badge-devuelto_gestion {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-rechazados {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 2px;
  padding: 12px 16px;
  color: #dc2626;
  font-size: 14px;
  margin-bottom: 16px;
}
.alert-rechazados .material-symbols-outlined { font-size: 20px; flex-shrink: 0; }

.expense-row-rechazado { border-left: 3px solid #dc2626; }
.expense-motivo-rechazo {
  font-size: 12px;
  color: #dc2626;
  margin-top: 2px;
  font-style: italic;
}
.detail-motivo-rechazo {
  color: #dc2626;
  font-style: italic;
  background: rgba(239, 68, 68, 0.06);
  padding: 8px 12px;
  border-radius: 2px;
  border-left: 3px solid #dc2626;
}

.badge-success {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Badges de Roles */
.badge-admin {
  background: rgba(214, 73, 49, 0.1);
  color: #d64931;
  border: 1px solid rgba(214, 73, 49, 0.3);
}

.badge-direccion {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-control_gestion {
  background: rgba(139, 92, 246, 0.1);
  color: #7c3aed;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.badge-delegado {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-comercial {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Usuario Inactivo */
.usuario-inactivo {
  opacity: 0.6;
}

.usuario-inactivo td {
  text-decoration: line-through;
  color: #9ca3af;
}

/* Form */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

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

.form-group.full-width { grid-column: 1 / -1; }

.form-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-gray);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-label.required::after { content: '*'; color: var(--danger); margin-left: 4px; }

.form-input, .form-select, .form-textarea {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 13px;
  font-weight: 300;
  font-family: inherit;
  transition: border-color 0.2s;
}

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

.form-textarea { min-height: 100px; resize: vertical; }

/* Searchable centro dropdown */
.centro-search-wrapper { position: relative; }
.centro-search-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--primary);
  border-top: none;
  border-radius: 0 0 2px 2px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 200;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.centro-search-dropdown.open { display: block; }
.centro-search-option {
  padding: 9px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-dark);
  border-bottom: 1px solid var(--border);
}
.centro-search-option:last-child { border-bottom: none; }
.centro-search-option:hover, .centro-search-option.focused { background: rgba(214,73,49,0.06); color: var(--primary); }
.centro-search-option .centro-delegacion { font-size: 11px; color: var(--text-gray); }

.file-upload-wrapper {
  border: 2px dashed var(--border);
  border-radius: 2px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.file-upload-wrapper:hover {
  border-color: var(--primary);
  background: rgba(214, 73, 49, 0.02);
}

.file-upload-wrapper input[type="file"] {
  display: none;
}

.file-upload-icon { font-size: 32px; margin-bottom: 12px; color: var(--text-light); }
.file-upload-text { font-size: 13px; color: var(--text-gray); margin-bottom: 4px; }
.file-upload-hint { font-size: 11px; color: var(--text-light); }
.file-upload-name {
  font-size: 12px;
  color: var(--primary);
  margin-top: 8px;
  font-weight: 500;
}

.form-actions {
  margin-top: 32px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-card);
  border-radius: 2px;
  border: 1px solid var(--border);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-large {
  max-width: 640px;
  width: 95%;
}

.modal-overlay.closing { animation: modalOut 0.18s ease forwards; pointer-events: none; }
.modal-overlay.closing .modal { animation: modalContentOut 0.18s cubic-bezier(0.4, 0, 0.2, 1) forwards; }

@keyframes modalOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes modalContentOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(12px); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.modal-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 18px;
  font-weight: 500;
  color: var(--text-dark);
}

.modal-close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 2px;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-gray);
  transition: all 0.2s;
}
.modal-close:hover { background: var(--bg-light); color: var(--text-dark); }

.modal-body { padding: 24px; }

.detail-grid { display: grid; gap: 20px; }
.detail-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }

.detail-item { display: flex; flex-direction: column; gap: 6px; }

.detail-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-gray);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-value { font-size: 14px; font-weight: 400; color: var(--text-dark); }
.detail-value.large { font-family: 'Montserrat', sans-serif; font-size: 28px; font-weight: 300; }

.factura-preview {
  margin-top: 12px;
}

.factura-preview img {
  max-width: 100%;
  border-radius: 2px;
  border: 1px solid var(--border);
}

/* Hover preview para facturas en tablas */
.factura-thumb {
  display: inline-block;
  position: relative;
  cursor: zoom-in;
}

.factura-thumb img {
  height: 40px;
  width: auto;
  border-radius: 2px;
  border: 1px solid var(--border);
  display: block;
}

#factura-hover-popup {
  display: none;
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  border-radius: 2px;
  border: 2px solid var(--border);
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  background: white;
  padding: 4px;
  max-width: 420px;
  max-height: 420px;
}

#factura-hover-popup img {
  max-width: 412px;
  max-height: 412px;
  border-radius: 2px;
  display: block;
}

.modal-actions {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* Toasts */
.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  min-width: 280px;
  max-width: 420px;
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 2px;
  background: var(--bg-card);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-dark);
  animation: slideToastIn 0.2s ease;
}

.toast-success { border-left-color: var(--success); animation: slideToastIn 0.2s ease, toastPulse 0.4s ease 0.2s; }
.toast-error { border-left-color: var(--danger); animation: slideToastIn 0.2s ease, toastPulseError 0.4s ease 0.2s; }
.toast-info { border-left-color: var(--info); }

@keyframes toastPulse {
  0%, 100% { box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08); }
  50% { box-shadow: 0 10px 24px rgba(16, 185, 129, 0.3); }
}
@keyframes toastPulseError {
  0%, 100% { box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08); }
  50% { box-shadow: 0 10px 24px rgba(239, 68, 68, 0.3); }
}

@keyframes slideToastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== SOLICITUDES ========== */
.sol-section-title {
  font-size: 11px; font-weight: 700; color: var(--text-light);
  text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 18px;
}
.sol-autofill-badge {
  display: inline-flex; align-items: center; background: #f0fdf4;
  border: 1px solid #bbf7d0; color: #16a34a; font-size: 11px; font-weight: 500;
  padding: 1px 7px; border-radius: 999px; margin-left: 6px; vertical-align: middle;
}
.sol-tab {
  display: flex; align-items: center; gap: 6px; padding: 8px 18px;
  border-radius: 2px; font-size: 14px; font-weight: 500;
  background: transparent; color: var(--text-muted); border: none;
  transition: all 0.2s;
}
.sol-tab-active-red  { background: var(--primary) !important; color: #fff !important; }
.sol-tab-active-blue { background: #2563eb !important; color: #fff !important; }

/* Marcas */
.sol-marca-chip {
  padding: 6px 14px; border-radius: 2px; border: 1.5px solid var(--border);
  font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s;
  background: #fff; color: var(--text-muted);
}
.sol-marca-chip:hover { border-color: var(--primary); color: var(--primary); }
.sol-marca-chip.selected { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Contadores */
.sol-counter-btn {
  width: 26px; height: 26px; border-radius: 2px; border: 1.5px solid var(--border);
  background: #fff; cursor: pointer; font-size: 16px; font-weight: 600;
  color: var(--text-muted); display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; user-select: none; line-height: 1;
}
.sol-counter-btn:hover { border-color: #2563eb; color: #2563eb; background: #eff6ff; }
.sol-counter-val { min-width: 24px; text-align: center; font-size: 15px; font-weight: 700; }
.sol-pack-card {
  flex: 1; border: 1.5px solid var(--border); border-radius: 2px;
  padding: 12px 14px; display: flex; align-items: center; justify-content: space-between;
  background: #fafafa;
}
.sol-cartucho-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1.5px solid var(--border); border-radius: 2px; background: #fafafa;
}

/* Tabla de tinta plana */
.sol-tinta-lista { display: flex; flex-direction: column; gap: 0; }
.sol-tinta-row {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 4px; border-bottom: 1px solid var(--border);
}
.sol-tinta-row:last-child { border-bottom: none; }
.sol-tinta-dots { display: flex; gap: 4px; flex-shrink: 0; width: 52px; }
.sol-tinta-dots i { width: 13px; height: 13px; border-radius: 2px; display: block; }
.sol-tinta-label { flex: 1; font-size: 14px; font-weight: 500; color: var(--text-dark); }
.sol-tinta-counter { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Tarjetas de recursos (medios) */
.sol-resource-card {
  border: 2px solid var(--border); border-radius: 2px; padding: 16px;
  cursor: pointer; transition: all 0.2s; background: #fafafa; user-select: none;
}
.sol-resource-card:hover { border-color: #93c5fd; background: #f0f7ff; }
.sol-resource-card.sol-card-active { border-color: #2563eb; background: #eff6ff; box-shadow: 0 0 0 2px #2563eb22; }
.sol-card-icon { transition: color 0.2s; }
.sol-resource-card.sol-card-active .sol-card-icon { color: #2563eb; }
.sol-card-toggle {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border);
  background: #fff; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; flex-shrink: 0;
}
.sol-radio-pill {
  flex: 1; text-align: center; padding: 7px 8px; border-radius: 2px;
  border: 1.5px solid #bfdbfe; font-size: 13px; font-weight: 500; color: #3b82f6;
  cursor: pointer; transition: all 0.15s; background: #fff;
}
.sol-radio-pill:hover { border-color: #2563eb; }
.sol-radio-pill.selected { background: #2563eb; border-color: #2563eb; color: #fff; }
.sol-card-full { border: 2px solid var(--border); border-radius: 2px; padding: 16px; background: #fafafa; }

/* Urgencia chips */
.sol-urgencia-chip {
  padding: 7px 16px; border-radius: 999px; border: 1.5px solid var(--border);
  font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.15s;
  background: #fff; color: var(--text-muted);
}
.sol-urgencia-chip:hover { border-color: #9ca3af; color: var(--text-dark); }

/* Grid 2 columnas para formulario */
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .form-row-2 { grid-template-columns: 1fr; } }

/* Hub — página completa sin sidebar */
.hub-page { min-height: 100vh; background: var(--bg-secondary); }
.hub-body { display: flex; align-items: flex-start; padding-top: 64px; }
.hub-main { flex: 1; min-width: 0; }
.hub-main.view-enter { animation: viewIn 0.22s cubic-bezier(0.4, 0, 0.2, 1); }

.hub-notif-panel {
  width: 300px;
  flex-shrink: 0;
  background: var(--bg-primary);
  border-left: 1px solid var(--border);
  min-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
}
.hub-notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
  position: sticky;
  top: 64px;
  background: var(--bg-primary);
  z-index: 1;
}
.hub-notif-lista { flex: 1; overflow-y: auto; padding: 8px 0; }
.hub-notif-item {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.hub-notif-item--unread { background: #eff6ff; }
.hub-notif-item--unread .hub-notif-item-title { color: #1d4ed8; }
.hub-notif-item-body { flex: 1; min-width: 0; }
.hub-notif-item-title { font-weight: 600; margin-bottom: 2px; }
.hub-notif-item-msg { color: var(--text-muted); font-size: 12px; line-height: 1.4; margin-bottom: 4px; }
.hub-notif-item-date { color: var(--text-muted); font-size: 11px; }

@media (max-width: 768px) {
  .hub-notif-panel { display: none; }
}

/* ── LAB ── */
.lab-page { min-height: 100vh; background: var(--bg-secondary); }
.lab-page .topbar { left: 0; }
.lab-body { display: flex; padding-top: 64px; min-height: calc(100vh - 64px); }
.lab-sidebar { width: 220px; min-width: 220px; background: var(--bg-primary); border-right: 1px solid var(--border); padding: 12px 0; }
.lab-nav-section { padding: 8px 20px 4px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.lab-nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 20px; cursor: pointer; font-size: 13px; color: var(--text-secondary); border-radius: 0; transition: background .15s; }
.lab-nav-item:hover { background: var(--bg-secondary); color: var(--text-primary); }
.lab-nav-item.active { color: var(--primary); font-weight: 500; background: color-mix(in srgb, var(--primary) 8%, transparent); border-right: 2px solid var(--primary); }
.lab-nav-item .material-symbols-outlined { font-size: 18px; }
.lab-main { flex: 1; padding: 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 24px; }

.lab-ocr-hint { display: inline-block; font-size: 11px; font-weight: 500; margin-top: 2px; }
.lab-ocr-hint-ok   { color: #059669; }
.lab-ocr-hint-warn { color: #d97706; }

@keyframes ocrFillOk   { 0%,100% { box-shadow: none; } 30% { box-shadow: 0 0 0 2px #6ee7b7; } }
@keyframes ocrFillWarn { 0%,100% { box-shadow: none; } 30% { box-shadow: 0 0 0 2px #fcd34d; } }
.ocr-filled-ok   { animation: ocrFillOk   3s ease; }
.ocr-filled-warn { animation: ocrFillWarn 3s ease; }

/* Lab: Nuevo Kilometraje — dropdown autocomplete */
.lab-km-dropdown {
  position: absolute; top: calc(100% + 2px); left: 0; right: 0; z-index: 200;
  background: var(--bg-primary); border: 1px solid var(--border);
  border-radius: 6px; box-shadow: 0 4px 16px rgba(0,0,0,.14);
  max-height: 240px; overflow-y: auto;
}
.lab-km-dd-item {
  padding: 8px 12px; cursor: pointer; font-size: 12px; line-height: 1.4;
  border-bottom: 1px solid var(--border); color: var(--text-primary);
}
.lab-km-dd-item:last-child { border-bottom: none; }
.lab-km-dd-item:hover { background: var(--bg-secondary); }
.lab-km-dd-manual { color: #d97706; border-top: 1px solid var(--border); }
.lab-km-dd-msg { padding: 8px 12px; font-size: 12px; color: var(--text-muted); }

.hub-wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px;
  flex: 1;
}
.hub-header { text-align: center; margin-bottom: 48px; }
.hub-title { font-size: 28px; font-weight: 700; color: var(--text-dark); margin-bottom: 8px; }
.hub-subtitle { font-size: 15px; color: var(--text-muted); }
.hub-apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 24px;
}
.hub-app-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  padding: 8px 4px 0;
  opacity: 0;
  animation: hubCardIn 0.35s ease forwards;
}
.hub-apps-grid .hub-app-card:nth-child(1) { animation-delay: 0.02s; }
.hub-apps-grid .hub-app-card:nth-child(2) { animation-delay: 0.06s; }
.hub-apps-grid .hub-app-card:nth-child(3) { animation-delay: 0.10s; }
.hub-apps-grid .hub-app-card:nth-child(4) { animation-delay: 0.14s; }
.hub-apps-grid .hub-app-card:nth-child(5) { animation-delay: 0.18s; }
.hub-apps-grid .hub-app-card:nth-child(6) { animation-delay: 0.22s; }
.hub-apps-grid .hub-app-card:nth-child(n+7) { animation-delay: 0.26s; }
@keyframes hubCardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.hub-app-icon {
  width: 56px; height: 56px;
  border-radius: 2px;
  background: var(--hub-color, var(--primary));
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  transition: transform 0.2s ease;
}
.hub-app-card:hover .hub-app-icon { transform: scale(1.08); }
.hub-app-icon .material-symbols-outlined { font-size: 28px; color: #fff; }
.hub-app-name { font-size: 15px; font-weight: 700; color: var(--text-dark); margin-bottom: 4px; }
.hub-app-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; flex: 1; margin-bottom: 14px; }
.hub-app-bar {
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: var(--border);
  transform: scaleX(0.6);
  transition: background 0.2s, box-shadow 0.2s, transform 0.2s ease;
}
.hub-app-card:hover .hub-app-bar,
.hub-app-card:active .hub-app-bar {
  background: var(--hub-color, var(--primary));
  box-shadow: 0 0 12px var(--hub-color, var(--primary));
  transform: scaleX(1);
}
.hub-app-card--admin .hub-app-icon { background: #6b7280; }

/* Desktop-only message */
.desktop-only-msg {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 24px;
  gap: 12px;
  color: var(--text-muted);
}
.desktop-only-msg .material-symbols-outlined { font-size: 56px; opacity: 0.35; }
.desktop-only-msg h3 { font-size: 18px; font-weight: 600; color: var(--text-dark); margin: 0; }
.desktop-only-msg p { font-size: 14px; margin: 0; }

/* Empty */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state-icon { font-size: 48px; opacity: 0.2; margin-bottom: 16px; }
.empty-state-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 18px;
  font-weight: 400;
  color: var(--text-dark);
  margin-bottom: 8px;
}
.empty-state-text { font-size: 13px; color: var(--text-gray); font-weight: 300; }

/* Sidebar overlay for mobile */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.38);
  z-index: 95;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.sidebar-overlay.open { opacity: 1; pointer-events: auto; }

/* Responsive */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-240px); box-shadow: 0 20px 40px rgba(0,0,0,0.12); }
  .sidebar.open { transform: translateX(0); }

  .topbar { left: 0; padding: 0 16px; }
  .main-content { margin-left: 0; padding: 24px 18px; }

  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .stats-row-3 { grid-template-columns: repeat(2, 1fr); }
  .mobile-menu-btn { display: inline-flex; }
}

@media (max-width: 768px) {
  .stats-row { grid-template-columns: 1fr; }
  .stats-row-3 { grid-template-columns: 1fr; }
  .cajas-grid { grid-template-columns: 1fr; }
  .expense-row { grid-template-columns: 1fr; gap: 12px; }
  .expense-row.expense-row-aprobacion { grid-template-columns: 1fr; }
  .expense-row.expense-row-km-aprobacion { grid-template-columns: 1fr; }
  .expense-row.expense-row-user,
  .expense-row.expense-row-km-user {
    grid-template-columns: 1fr !important;
    align-items: stretch;
  }
  .expense-row-header { display: none; }
  .bulk-toolbar {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
  }
  .bulk-toolbar-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .expense-actions-inline { justify-content: flex-start; }
  .expense-select-cell { justify-content: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
  .detail-row { grid-template-columns: 1fr; }
  .form-actions { justify-content: stretch; flex-wrap: wrap; }
  .form-actions .btn { width: 100%; justify-content: center; }

  .mobile-fullscreen-form {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    margin: 0;
    border-radius: 0;
    border: none;
    display: flex;
    flex-direction: column;
  }

  .mobile-fullscreen-form .modal-header,
  .mobile-fullscreen-form .modal-actions {
    flex-shrink: 0;
  }

  .mobile-fullscreen-form .modal-body {
    flex: 1;
    overflow-y: auto;
  }

  .list-filters { display: none; }
  .list-filters-box { display: none; }
  .list-create-box-header { display: none; }
}

@media (max-width: 480px) {
  .expense-mobile-fields-two { grid-template-columns: 1fr; }
  .km-mobile-buttons { grid-template-columns: 1fr; }
}

/* Loading */
.loading {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
.rotating {
  animation: spin 1s linear infinite;
  display: inline-block;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-top: 24px;
}

.stat-card {
  background: white;
  border-radius: 2px;
  padding: 32px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  gap: 20px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Selector de tasa de refresco — segmented control con cuadrado deslizante */
.refresh-rate-selector {
  position: relative;
  display: inline-flex;
  background: var(--bg-secondary);
  border-radius: 2px;
  padding: 3px;
}
.refresh-rate-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 46px;
  height: calc(100% - 6px);
  background: var(--primary);
  border-radius: 2px;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 0;
}
.refresh-rate-opt {
  position: relative;
  z-index: 1;
  width: 46px;
  margin-right: 4px;
  padding: 7px 0;
  text-align: center;
  border: none;
  background: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 2px;
  font-family: inherit;
  transition: color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.refresh-rate-opt:last-child { margin-right: 0; }
.refresh-rate-opt.active { color: #fff; }

.stat-icon {
  font-size: 48px;
  opacity: 0.9;
}

.stat-content {
  flex: 1;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 14px;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

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

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

  .stat-card {
    padding: 24px;
  }

  .stat-icon {
    font-size: 36px;
  }

  .stat-value {
    font-size: 24px;
  }
}

/* Single Stat Card */
.stat-card-single {
  background: white;
  border-radius: 2px;
  padding: 32px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 24px;
  max-width: 500px;
}

.stat-card-single .stat-icon {
  font-size: 56px;
  opacity: 0.9;
}

.stat-card-single .stat-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--primary);
}

/* File Size Styles */
.file-size-large {
  color: #dc2626 !important;
  font-weight: 600;
}

.badge-info {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
}

/* Link in table */
.table a {
  color: var(--primary);
  text-decoration: none;
  word-break: break-all;
}

.table a:hover {
  text-decoration: underline;
}

/* ── Notificaciones ── */
.notif-bell-wrap {
  position: relative;
}

.notif-bell-btn {
  position: relative;
  padding: 10px 8px;
  background: transparent;
  border: 1px solid var(--border);
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
}

.notif-inbox {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-height: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 2px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.notif-inbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.notif-inbox-list {
  overflow-y: auto;
  flex: 1;
}

.notif-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 32px 16px;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

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

.notif-item--unread {
  background: rgba(229, 65, 74, 0.05);
  border-left: 3px solid var(--primary);
}

.notif-item-body {
  flex: 1;
  min-width: 0;
}

.notif-item-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 2px;
}

.notif-item-msg {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  word-break: break-word;
}

.notif-item-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.notif-item-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.notif-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  color: var(--text-muted);
  border-radius: 2px;
  display: flex;
  align-items: center;
}

.notif-action-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.notif-action-btn .material-symbols-outlined {
  font-size: 16px;
}

/* Contenido renderizado desde Markdown (manuales de ayuda) — el reset global de margin:0
   deja los párrafos/títulos pegados, aquí se restituye el espaciado natural */
.markdown-body p { margin: 0 0 12px 0; line-height: 1.5; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { margin: 20px 0 10px 0; line-height: 1.3; }
.markdown-body h1:first-child, .markdown-body h2:first-child, .markdown-body h3:first-child { margin-top: 0; }
.markdown-body ul, .markdown-body ol { margin: 0 0 12px 0; padding-left: 22px; }
.markdown-body li { margin-bottom: 4px; }
.markdown-body blockquote { margin: 0 0 12px 0; padding-left: 12px; border-left: 3px solid var(--border); color: var(--text-muted); }
.markdown-body code { background: var(--bg-secondary); padding: 2px 5px; border-radius: 2px; font-size: 0.9em; }
.markdown-body pre { background: var(--bg-secondary); padding: 10px; border-radius: 2px; overflow-x: auto; margin: 0 0 12px 0; }
.markdown-body a { color: var(--primary); }
