/* assets/css/styles.css */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  color-scheme: light;
  --azul-dark: #1a2e4a;
  --azul: #2980d4;
  --azul-light: #e6f1fb;
  --azul-glow: rgba(41, 128, 212, 0.15);
  --bg: #f0f4f8;
  --bg2: #e8ecf0;
  --blanco: #ffffff;
  --texto: #1a1a1a;
  --texto2: #5a6a7a;
  --texto3: #8a9aaa;
  --borde: rgba(0, 0, 0, 0.1);
  --borde-input: rgba(0, 0, 0, 0.2);
  --rojo: #c0392b;
  --rojo-light: #fcebeb;
  --verde: #27ae60;
  --verde-light: #eaf3de;
  --naranja: #e67e22;
  --naranja-light: #fef3e2;
  --radio: 12px;
  --radio-sm: 8px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --pill-ok-text: #3b6d11;
  --pill-an-text: #a32d2d;
  --alerta-ok: #27ae60;
  --alerta-warn: #e67e22;
  --alerta-danger: #c0392b;
  --scrollbar-track: #e8ecf0;
  --scrollbar-thumb: #c2ccd6;
}

/* ===== TEMA OSCURO ===== */
:root[data-theme="dark"] {
  color-scheme: dark;
  --azul-light: rgba(41, 128, 212, 0.18);
  --bg: #0f1720;
  --bg2: #17212c;
  --blanco: #1c2733;
  --texto: #e8edf3;
  --texto2: #a3b1c2;
  --texto3: #75879b;
  --borde: rgba(255, 255, 255, 0.12);
  --borde-input: rgba(255, 255, 255, 0.2);
  --rojo-light: rgba(192, 57, 43, 0.2);
  --verde-light: rgba(39, 174, 96, 0.2);
  --naranja-light: rgba(230, 126, 34, 0.2);
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.55);
  --pill-ok-text: #6fe3a0;
  --pill-an-text: #ff8f87;
  --alerta-ok: #4ade80;
  --alerta-warn: #fbbf24;
  --alerta-danger: #f87171;
  --scrollbar-track: #17212c;
  --scrollbar-thumb: #34424f;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 13px;
  background: var(--bg);
  color: var(--texto);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  transition: background 0.25s ease, color 0.25s ease;
}

/* Barra de desplazamiento acorde al tema (Chrome/Edge/Firefox) */
* { scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 6px; }

/* ===== LAYOUT ===== */
.app { display: flex; min-height: 100vh; width: 100%; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: 220px;
  background: var(--azul-dark);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  flex-shrink: 0;
  transition: var(--transition);
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 36px; height: 36px;
  background: var(--azul);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.logo-icon svg { width: 20px; height: 20px; fill: #fff; }

.nav-section { padding: 12px 0; flex: 1; overflow-y: auto; }

.nav-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: #4a6a85;
  padding: 12px 20px 6px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  cursor: pointer;
  color: #9ab5cf;
  font-size: 12px; font-weight: 500;
  border-left: 3px solid transparent;
  transition: var(--transition);
  text-decoration: none;
  user-select: none;
}

.nav-item:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.nav-item.active { background: var(--azul-glow); color: #fff; border-left: 3px solid var(--azul); }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-user {
  padding: 14px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex; align-items: center; gap: 10px;
}

.user-avatar-sm {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--azul);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #fff;
  flex-shrink: 0;
}

/* ===== SIDEBAR TOGGLE BUTTON ===== */
.sidebar-toggle-btn {
  width: 26px; height: 26px;
  border: none; border-radius: 6px;
  background: rgba(255,255,255,0.07);
  color: #7a9bbf;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-left: auto;
  padding: 0;
  transition: background 0.2s, color 0.2s;
}
.sidebar-toggle-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }
.sidebar-toggle-btn svg { transition: transform 0.3s cubic-bezier(0.4,0,0.2,1); }

/* ===== SIDEBAR COLLAPSED STATE ===== */
.sidebar.collapsed {
  width: 64px;
}

/* Logo area: ocultar imagen y texto, centrar solo el botón */
.sidebar.collapsed .sidebar-logo {
  justify-content: center;
  padding: 17px 0;
  gap: 0;
}
.sidebar.collapsed .sidebar-logo img      { display: none; }
.sidebar.collapsed .sidebar-logo-text     { display: none; }
.sidebar.collapsed .sidebar-toggle-btn    { margin-left: 0; }
.sidebar.collapsed .sidebar-toggle-btn svg { transform: rotate(180deg); }

/* Ocultar encabezados de grupo (!important para anular el inline display:flex) */
.sidebar.collapsed .nav-group-header {
  display: none !important;
}

/* Forzar apertura de todos los grupos cuando está colapsado */
.sidebar.collapsed .nav-group-items {
  max-height: 400px !important;
}

/* Separador sutil entre grupos */
.sidebar.collapsed .nav-group {
  padding: 3px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.sidebar.collapsed .nav-group:last-child { border-bottom: none; }

/* Ítems: solo ícono centrado */
.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 11px 0;
  position: relative;
}
.sidebar.collapsed .nav-item span { display: none; }

/* Usuario: solo avatar centrado */
.sidebar.collapsed .sidebar-user    { justify-content: center; padding: 14px 0; }
.sidebar.collapsed .sidebar-user-info { display: none; }

/* Tooltip via JS (ver toggleSidebar en app.js) — no ::after para evitar clipping */
#sidebarTooltip {
  position: fixed;
  background: #1e3a54;
  color: #ddeeff;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 7px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  z-index: 9999;
  border: 1px solid rgba(255,255,255,0.1);
  transform: translateY(-50%);
}

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

/* ===== TOPBAR ===== */
.topbar {
  background: linear-gradient(135deg, var(--azul) 0%, #1a6bb5 100%);
  padding: 20px 28px 32px;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.topbar-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.topbar-sub { font-size: 13px; color: #aad4f5; }

.user-pill {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, 0.12);
  padding: 7px 14px; border-radius: 20px;
  cursor: pointer; transition: var(--transition);
  backdrop-filter: blur(4px);
}

.user-pill:hover { background: rgba(255, 255, 255, 0.22); }

/* ===== CONTENT ===== */
.content { padding: 0 28px 28px; flex: 1; }

/* ===== DASHBOARD CARDS ===== */
.cards-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: -20px;
  margin-bottom: 24px;
}

.mcard {
  background: var(--blanco);
  border-radius: var(--radio);
  border: 0.5px solid var(--borde);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow);
}

.mcard:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.mcard::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  border-radius: 0 2px 2px 0;
}

.mcard:nth-child(1)::before { background: var(--azul); }
.mcard:nth-child(2)::before { background: var(--verde); }
.mcard:nth-child(3)::before { background: var(--naranja); }
.mcard:nth-child(4)::before { background: var(--rojo); }

.mcard-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--texto2);
  margin-bottom: 8px;
}

.mcard-value {
  font-size: 28px; font-weight: 800;
  color: var(--texto);
  line-height: 1;
  margin-bottom: 4px;
}

.mcard-sub { font-size: 12px; color: var(--texto3); }

.mcard-icon {
  position: absolute;
  right: 16px; top: 50%;
  transform: translateY(-50%);
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0.15;
}

.mcard-icon svg { width: 28px; height: 28px; fill: currentColor; }

.mcard:nth-child(1) .mcard-icon { color: var(--azul); }
.mcard:nth-child(2) .mcard-icon { color: var(--verde); }
.mcard:nth-child(3) .mcard-icon { color: var(--naranja); }
.mcard:nth-child(4) .mcard-icon { color: var(--rojo); }

/* ===== MODULE CARDS ===== */
.modules-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.module-card {
  background: var(--blanco);
  border-radius: var(--radio);
  border: 0.5px solid var(--borde);
  padding: 20px;
  display: flex; align-items: center; gap: 16px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
}

.module-card:hover {
  border-color: var(--azul);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.module-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.module-icon svg { width: 24px; height: 24px; fill: #fff; }

.module-name { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.module-desc { font-size: 11px; color: var(--texto2); }

/* ===== CHART & TABLE ===== */
.chart-card, .table-card {
  background: var(--blanco);
  border-radius: var(--radio);
  border: 0.5px solid var(--borde);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.table-card { margin-bottom: 0; }

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

.card-title { font-size: 15px; font-weight: 700; color: var(--texto); }

.card-badge {
  font-size: 11px; font-weight: 500;
  background: var(--azul-light); color: var(--azul);
  padding: 3px 10px; border-radius: 10px;
}

.chart-wrap { height: 200px; position: relative; }

.bottom-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

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

.data-table th {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  color: var(--texto2); padding: 0 8px 10px;
  border-bottom: 0.5px solid var(--borde); text-align: left; white-space: nowrap;
}

.data-table td { padding: 10px 8px; border-bottom: 0.5px solid var(--borde); color: var(--texto); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg); }

.pill { display: inline-block; font-size: 10px; font-weight: 600; padding: 3px 10px; border-radius: 10px; }
.pill-ok { background: var(--verde-light); color: var(--pill-ok-text); }
.pill-an { background: var(--rojo-light); color: var(--pill-an-text); }
.pill-pend { background: var(--naranja-light); color: var(--alerta-warn); }
.pill-rech { background: var(--rojo-light); color: var(--pill-an-text); }

.mono { font-family: 'Courier New', monospace; font-size: 11px; }
.empty-cell { color: var(--texto3); text-align: center; padding: 24px 8px !important; }

/* ===== BOLETA FORM ===== */
.boleta-card {
  background: var(--blanco);
  border-radius: var(--radio);
  border: 0.5px solid var(--borde);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.boleta-header-strip {
  background: var(--azul-dark);
  padding: 14px 24px;
  display: grid; grid-template-columns: 100px 1fr 180px; gap: 12px; align-items: center;
}

.logo-box-small {
  border: 2px solid #fff;
  padding: 4px 8px; text-align: center;
}

.logo-box-small .lb { font-size: 14px; font-weight: 700; letter-spacing: 2px; color: #fff; line-height: 1; }
.logo-box-small .ls { font-size: 7px; letter-spacing: .15em; color: #aad4f5; }

.org-mid { text-align: center; }
.org-mid .ot { font-size: 11px; font-weight: 600; text-transform: uppercase; color: #fff; line-height: 1.3; }
.org-mid .oa { font-size: 8px; color: #aad4f5; margin-top: 3px; line-height: 1.5; }

.num-right { text-align: right; }
.num-right .nt { font-size: 11px; font-weight: 600; text-transform: uppercase; color: #fff; }
.num-right .nn { font-size: 12px; color: #aad4f5; margin-top: 2px; font-family: monospace; font-weight: 700; }
.num-right .rtn { font-size: 9px; color: #7a9bbf; margin-top: 2px; }

.boleta-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }

.section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--texto2); margin-bottom: 4px; padding-bottom: 6px;
  border-bottom: 1px solid var(--borde);
}

.fields-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fields-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.field { display: flex; flex-direction: column; gap: 4px; }
.field.full { grid-column: 1 / -1; }

.field label { font-size: 11px; font-weight: 600; color: var(--texto2); }
.req { color: var(--rojo); margin-left: 2px; }

.field input {
  font-family: inherit; font-size: 12px;
  border: 0.5px solid var(--borde-input); border-radius: var(--radio-sm);
  padding: 8px 12px; background: var(--blanco); color: var(--texto); outline: none;
  transition: var(--transition);
}

.field input:focus { border: 1px solid var(--azul); box-shadow: 0 0 0 3px var(--azul-glow); }
.field input.err { border: 1px solid var(--rojo); background: var(--rojo-light); }

/* Provider search */
.provider-search-wrap { position: relative; }

.provider-dropdown {
  display: none;
  position: absolute; top: 100%; left: 0; right: 0;
  background: var(--blanco);
  border: 1px solid var(--borde);
  border-radius: var(--radio-sm);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  max-height: 200px; overflow-y: auto;
}

.provider-dropdown.show { display: block; }

.provider-dropdown-item {
  padding: 10px 12px;
  cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 0.5px solid var(--borde);
  transition: background 0.15s;
}

.provider-dropdown-item:hover { background: var(--bg); }
.provider-dropdown-item:last-child { border-bottom: none; }

/* Exonerado box */
.exo-box {
  border: 0.5px solid var(--borde);
  border-radius: var(--radio-sm);
  display: grid; grid-template-columns: 1fr 1fr 1fr;
}

.exo-cell { padding: 10px 14px; border-right: 0.5px solid var(--borde); }
.exo-cell:last-child { border-right: none; }
.exo-cell label { display: block; font-size: 10px; font-weight: 600; color: var(--texto2); margin-bottom: 4px; }
.exo-cell input {
  border: none; outline: none; font-size: 11px; width: 100%;
  color: var(--texto); background: transparent; font-family: inherit;
  border-bottom: 0.5px dotted var(--borde-input); padding: 4px 0;
}

/* Items table */
.items-wrapper { border: 0.5px solid var(--borde); border-radius: var(--radio-sm); overflow: hidden; }

.items-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.items-table thead tr { background: var(--azul-dark); }
.items-table th {
  padding: 10px 10px; text-align: center;
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: #aad4f5; border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.items-table th:first-child { text-align: left; padding-left: 12px; }
.items-table th:last-child { border-right: none; background: #111d2b; }

.items-table td { padding: 4px 6px; border-bottom: 0.5px solid var(--borde); border-right: 0.5px solid var(--borde); }
.items-table td:last-child { border-right: none; }
.items-table td input { border: none; outline: none; font-size: 12px; width: 100%; font-family: inherit; background: transparent; color: var(--texto); padding: 6px 4px; }
.items-table td input:focus { background: var(--bg); border-radius: 4px; }
.items-table td.r input { text-align: right; }
.items-table .foot-row td { background: var(--bg2); font-size: 11px; }
.items-table .total-row td { background: var(--azul-dark); color: #fff; font-weight: 600; font-size: 13px; padding: 10px; }

.rm-btn {
  background: none; border: none; cursor: pointer;
  color: var(--texto3); font-size: 16px; padding: 4px 8px; border-radius: 4px;
  transition: var(--transition);
}

.rm-btn:hover { color: var(--rojo); background: var(--rojo-light); }

.add-btn {
  font-size: 12px; color: var(--azul); border: none; background: none;
  cursor: pointer; padding: 8px 0; font-family: inherit; font-weight: 500;
}

.add-btn:hover { text-decoration: underline; }

/* Actions */
.actions {
  display: flex; gap: 10px; padding: 16px 24px;
  border-top: 0.5px solid var(--borde);
  background: var(--bg2);
  flex-wrap: wrap;
}

.btn-primary {
  background: var(--azul); color: #fff; border: none;
  padding: 10px 24px; font-size: 12px; font-weight: 600;
  cursor: pointer; border-radius: var(--radio-sm); font-family: inherit;
  transition: var(--transition);
}

.btn-primary:hover { background: #1a6bb5; transform: translateY(-1px); }

.btn-secondary {
  background: var(--blanco); color: var(--texto);
  border: 0.5px solid var(--borde-input);
  padding: 10px 24px; font-size: 12px; font-weight: 600;
  cursor: pointer; border-radius: var(--radio-sm); font-family: inherit;
  transition: var(--transition);
}

.btn-secondary:hover { background: var(--bg); }

.btn-danger {
  background: var(--rojo); color: #fff; border: none;
  padding: 10px 24px; font-size: 12px; font-weight: 600;
  cursor: pointer; border-radius: var(--radio-sm); font-family: inherit;
}

.btn-danger:hover { background: #a93226; }

/* ===== MODAL ===== */
.modal-overlay {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.55); z-index: 999;
  align-items: center; justify-content: center;
  backdrop-filter: blur(2px);
}

.modal-overlay.open { display: flex; }

.modal-box {
  background: var(--blanco); color: var(--texto); border: 2px solid var(--azul-dark);
  border-radius: var(--radio); width: 90%; max-width: 430px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease-out;
}

@keyframes modalIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-head {
  background: var(--rojo); color: #fff; padding: 14px 18px;
  display: flex; justify-content: space-between; align-items: center;
  border-radius: 10px 10px 0 0;
}

.modal-head h3 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.modal-close { background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; line-height: 1; }
.modal-body { padding: 20px; }

.modal-num {
  font-family: monospace; font-size: 12px; font-weight: 700;
  background: var(--bg2); padding: 8px 12px; border-radius: 6px;
  margin-bottom: 14px; border: 0.5px solid var(--borde);
}

.modal-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; display: block; }
.modal-textarea {
  width: 100%; border: 1px solid var(--borde-input); border-radius: 6px;
  padding: 10px; font-size: 12px; font-family: inherit; resize: vertical;
  min-height: 80px; outline: none; transition: var(--transition);
  background: var(--blanco); color: var(--texto);
}

.modal-textarea:focus { border-color: var(--rojo); }

.modal-footer {
  padding: 14px 18px; border-top: 0.5px solid var(--borde);
  display: flex; gap: 8px; justify-content: flex-end; background: var(--bg2);
  border-radius: 0 0 10px 10px;
}

/* ===== LIST TABLE ===== */
.list-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; flex-wrap: wrap; gap: 12px;
}

.list-filters { display: flex; gap: 8px; }

.filter-btn {
  padding: 6px 14px; font-size: 11px; font-weight: 600;
  border: 0.5px solid var(--borde); border-radius: 20px;
  background: var(--blanco); cursor: pointer; font-family: inherit;
  color: var(--texto2); transition: var(--transition);
}

.filter-btn.active { background: var(--azul); color: #fff; border-color: var(--azul); }
.filter-btn:hover:not(.active) { border-color: var(--azul); color: var(--azul); }

.search-box {
  display: flex; align-items: center; gap: 8px;
  border: 0.5px solid var(--borde); border-radius: var(--radio-sm);
  padding: 6px 12px; background: var(--blanco);
}

.search-box input {
  border: none; outline: none; font-size: 12px; width: 180px;
  font-family: inherit; background: transparent;
}

.list-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.list-table th {
  background: var(--azul-dark); color: #fff; padding: 10px 12px;
  text-align: left; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
}

.list-table td { padding: 10px 12px; border-bottom: 0.5px solid var(--borde); vertical-align: middle; }
.list-table tr:hover td { background: var(--bg2); }

.list-btn {
  background: none; border: 0.5px solid var(--borde-input); color: var(--texto);
  border-radius: 5px; font-size: 10px; padding: 4px 10px;
  cursor: pointer; font-family: inherit; transition: var(--transition);
  display: inline-flex; align-items: center; gap: 4px;
}
.list-btn svg { flex-shrink: 0; }
.list-btn.icon-only { padding: 6px; width: 26px; height: 26px; justify-content: center; }

.list-btn:hover { background: var(--azul-dark); color: #fff; border-color: var(--azul-dark); }

.list-btn.view { background: var(--azul-light); color: var(--azul); border-color: transparent; }
.list-btn.view:hover { background: var(--azul); color: #fff; }

.list-btn.edit { background: var(--naranja-light); color: var(--alerta-warn); border-color: transparent; }
.list-btn.edit:hover { background: var(--alerta-warn); color: #fff; }

.list-btn.red { background: var(--rojo-light); border-color: var(--rojo); color: var(--pill-an-text); }
.list-btn.red:hover { background: var(--rojo); color: #fff; }

/* ===== REPORTE ===== */
.reporte-card {
  background: var(--blanco);
  border-radius: var(--radio);
  border: 0.5px solid var(--borde);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.reporte-config {
  padding: 16px 22px; border-bottom: 0.5px solid var(--borde);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--bg);
}

.reporte-config label { font-size: 12px; font-weight: 600; color: var(--texto2); }
.reporte-config input {
  border: 0.5px solid var(--borde-input); border-radius: 6px;
  padding: 6px 10px; font-size: 13px; font-family: inherit; width: 150px;
  background: var(--blanco); color: var(--texto);
}

.prov-cards { padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; }

.prov-card {
  border: 0.5px solid var(--borde); border-radius: var(--radio);
  overflow: hidden; transition: var(--transition);
  box-shadow: var(--shadow);
}

.prov-card:hover { box-shadow: var(--shadow-lg); }

.prov-card-head {
  background: var(--azul-dark); color: #fff;
  padding: 14px 18px; display: flex; justify-content: space-between; align-items: center;
}

.prov-card-head .pname { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }

.prov-card-body { padding: 16px 18px; background: var(--blanco); }

.prog-bar-wrap { background: var(--bg2); height: 10px; border-radius: 99px; margin: 8px 0; overflow: hidden; }
.prog-bar { height: 100%; border-radius: 99px; transition: width 0.6s ease; }

.prov-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }

.stat-box {
  border: 0.5px solid var(--borde); border-radius: 8px; padding: 10px; text-align: center;
  background: var(--bg);
}

.stat-box .sv { font-size: 16px; font-weight: 700; display: block; margin-bottom: 2px; }
.stat-box .sl { font-size: 9px; color: var(--texto2); text-transform: uppercase; letter-spacing: .04em; }

.alerta-tag {
  display: inline-block; font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; padding: 3px 10px; border-radius: 4px; border: 1px solid;
}

.alerta-ok { color: var(--alerta-ok); border-color: var(--alerta-ok); background: var(--verde-light); }
.alerta-warn { color: var(--alerta-warn); border-color: var(--alerta-warn); background: var(--naranja-light); }
.alerta-danger { color: var(--alerta-danger); border-color: var(--alerta-danger); background: var(--rojo-light); }

/* ===== TOAST ===== */
.toast-stack {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column-reverse; gap: 12px;
  z-index: 9999; pointer-events: none;
}

.toast {
  position: relative; overflow: hidden;
  display: flex; align-items: flex-start; gap: 12px;
  width: 340px; max-width: calc(100vw - 48px);
  background: var(--verde-light); color: var(--texto);
  padding: 14px 40px 14px 16px; border-radius: var(--radio-sm);
  border: 1px solid rgba(39, 174, 96, 0.25);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  pointer-events: auto;
  animation: toastIn 0.28s cubic-bezier(.34,1.56,.64,1);
}

.toast.leaving { animation: toastOut 0.22s ease-in forwards; }

.toast.error { background: var(--rojo-light); border-color: rgba(192, 57, 43, 0.25); }
.toast.warn  { background: var(--naranja-light); border-color: rgba(230, 126, 34, 0.25); }
.toast.info  { background: var(--azul-light); border-color: rgba(41, 128, 212, 0.25); }

.toast-icon {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--verde); color: #fff;
  font-size: 14px; font-weight: 700;
}

.toast.error .toast-icon { background: var(--rojo); color: #fff; }
.toast.warn  .toast-icon { background: var(--naranja); color: #fff; }
.toast.info  .toast-icon { background: var(--azul); color: #fff; }

.toast-body { flex: 1; min-width: 0; }
.toast-title { font-size: 13px; font-weight: 700; margin-bottom: 2px; color: var(--verde); }
.toast.error .toast-title { color: var(--rojo); }
.toast.warn  .toast-title { color: var(--naranja); }
.toast.info  .toast-title { color: var(--azul); }
.toast-msg { font-size: 12px; font-weight: 500; color: var(--texto2); line-height: 1.4; }

.toast-close {
  position: absolute; top: 10px; right: 10px;
  width: 20px; height: 20px; border: none; border-radius: 50%;
  background: var(--bg2); color: var(--texto3);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; line-height: 1; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.toast-close:hover { background: var(--borde); color: var(--texto); }

@keyframes toastIn {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes toastOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(24px); opacity: 0; }
}

/* ===== FLOATING REMINDER (resumen de pendientes) ===== */
.reminder-card {
  position: fixed; bottom: 28px; right: 28px; z-index: 9998;
  width: 330px; max-width: calc(100vw - 48px);
  background: var(--azul-light); border-radius: var(--radio-sm);
  border: 1px solid rgba(41, 128, 212, 0.25);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  transform: translateY(130%) scale(0.97); opacity: 0;
  transition: transform 0.35s cubic-bezier(.34,1.56,.64,1), opacity 0.35s ease-out;
}
.reminder-card.show { transform: translateY(0) scale(1); opacity: 1; }

.reminder-header { display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px; }

.reminder-bell {
  position: relative; flex-shrink: 0;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--azul); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.reminder-bell-badge {
  position: absolute; top: -5px; right: -5px;
  background: var(--rojo); color: #fff; border-radius: 50%;
  width: 18px; height: 18px; font-size: 10px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}

.reminder-header-text { flex: 1; min-width: 0; }
.reminder-title { font-size: 15px; font-weight: 700; color: var(--azul); line-height: 1.3; }
.reminder-sub { font-size: 11px; color: var(--texto2); margin-top: 2px; }

.reminder-close {
  flex-shrink: 0; width: 24px; height: 24px; border: none; border-radius: 50%;
  background: var(--bg2); color: var(--texto3);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; cursor: pointer; transition: background 0.15s, color 0.15s;
}
.reminder-close:hover { background: var(--borde); color: var(--texto); }

.reminder-items { padding: 4px 12px 14px; display: flex; flex-direction: column; gap: 6px; }

.reminder-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px; text-decoration: none;
  transition: background 0.15s;
}
.reminder-item:hover { background: rgba(255, 255, 255, 0.35); }

.reminder-item-badge {
  flex-shrink: 0; min-width: 24px; height: 24px; padding: 0 5px;
  border-radius: 50%; border: 1.5px solid;
  background: var(--blanco);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800;
}

.reminder-item-label { font-size: 13px; font-weight: 600; color: var(--texto); }

/* ===== BOLETA FOOTER ===== */
.boleta-footer {
  font-size: 8px; color: var(--texto3); padding: 10px 24px;
  border-top: 0.5px solid var(--borde); background: var(--bg2);
  display: flex; justify-content: space-between; align-items: flex-end;
}

/* ===== LOGIN ===== */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--azul-dark) 0%, var(--azul) 100%);
  padding: 20px;
}

.login-card {
  background: var(--blanco);
  border-radius: 16px;
  padding: 20px 28px;
  width: 100%; max-width: 380px;
  box-shadow: var(--shadow-lg);
}

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

/* ===== LOGO LOGIN ===== */
.login-logo .logo-icon-lg {
  width: 140px; height: 140px;
  background: transparent;
  border-radius: 0;
  border: none;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 8px;
  overflow: hidden;
}

.login-logo .logo-icon-lg img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.login-logo h1 { font-size: 20px; font-weight: 700; color: var(--azul-dark); margin-top: 4px; }
.login-logo p { font-size: 12px; color: var(--texto3); margin-top: 4px; }

.login-field { margin-bottom: 16px; }
.login-field label { display: block; font-size: 12px; font-weight: 600; color: var(--texto2); margin-bottom: 6px; }

.login-field input {
  width: 100%; padding: 12px 14px;
  border: 0.5px solid var(--borde-input); border-radius: var(--radio-sm);
  font-size: 13px; font-family: inherit; outline: none;
  transition: var(--transition);
  background: var(--blanco); color: var(--texto);
}

.login-field input:focus { border-color: var(--azul); box-shadow: 0 0 0 3px var(--azul-glow); }

.login-btn {
  width: 100%; padding: 14px;
  background: var(--azul); color: #fff; border: none;
  border-radius: var(--radio-sm); font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: var(--transition);
}

.login-btn:hover { background: #1a6bb5; }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.login-error {
  background: var(--rojo-light); color: var(--rojo);
  padding: 10px 14px; border-radius: var(--radio-sm);
  font-size: 12px; font-weight: 500; margin-bottom: 16px;
  display: none;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-220px); }
  .main { margin-left: 0; }
  .cards-row { grid-template-columns: repeat(2, 1fr); }
  .bottom-row { grid-template-columns: 1fr; }
  .modules-row { grid-template-columns: repeat(2, 1fr); }
  .boleta-header-strip { grid-template-columns: 80px 1fr; }
  .num-right { display: none; }
}

@media (max-width: 540px) {
  .cards-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .modules-row { grid-template-columns: 1fr; }
  .topbar { padding: 16px 16px 28px; }
  .content { padding: 0 14px 20px; }
  .mcard-value { font-size: 22px; }
  .fields-grid, .fields-grid-3 { grid-template-columns: 1fr; }
  .exo-box { grid-template-columns: 1fr; }
  .exo-cell { border-right: none; border-bottom: 0.5px solid var(--borde); }
  .bottom-row { grid-template-columns: 1fr; }
}