@import url("../fonts/inter/inter.css");

:root {
  /* Fuerza controles de formulario en modo claro: sin esto, un SO en modo oscuro
     pinta los inputs nativos (fechas, numeros) con fondo oscuro y texto claro. */
  color-scheme: light;
  accent-color: #b54747;
  --bg: #954043;
  --card-bg: #e8e3df;
  --card-bg-alt: #ffffff;
  --input-bg: #f5f5f5;
  --input-border: #e0e0e0;
  --text-dark: #666;
  --text-muted: #5f6673;
  --text-strong: #444;
  --btn-bg: #b54747;
  --btn-hover: #9e3c3c;
  --accent: #b54747;
  --accent-strong: #8e3a3d;
  --danger: #c0392b;
  --danger-hover: #a93226;
  --info: #3498db;
  --info-hover: #2980b9;
  --surface-hover: #f1eaea;
  --notification-hover: #fdf6f6;
  --surface-soft: #fafafa;
  --overlay: rgba(0, 0, 0, 0.32);
  --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.12);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.18);
  --shadow-modal: 0 20px 35px rgba(0, 0, 0, 0.3);
  /* Sombra sutil de campos. Varias hojas la usan desde los tokens; queda acá
     como valor por defecto para las páginas que no la definen. */
  --input-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-panel: 18px;
  --radius-pill: 999px;
  --accent-soft: #f3e6e2;
  --accent-tint: #fbf0ef;
  --success: #2f7a4b;
  --success-soft: #e8f1ea;
  --success-text: #1f5a35;
  --warning: #d88f2d;
  --warning-soft: #fff3cd;
  --warning-text: #856404;
  --danger-soft: #f8d7da;
  --danger-text: #721c24;
  --info-soft: #d1ecf1;
  --info-text: #0c5460;
  --shadow-dropdown: 0 10px 25px rgba(0, 0, 0, 0.12);
  --shadow-toast: 0 10px 30px rgba(0, 0, 0, 0.2);
  --z-nav: 100;
  --z-dropdown: 1000;
  --z-modal: 1300;
  --z-confirm: 1400;
  --z-toast: 1500;
  --page-card-width: 1380px;
  --card-surface: var(--surface-soft);
  --card-border: var(--input-border);
  --text-subtle: var(--text-muted);
  --accent-light: var(--accent-tint);
  --accent-subtle: var(--accent-soft);
  --success-bg: var(--success-soft);
  --warning-bg: var(--warning-soft);
  --danger-bg: var(--danger-soft);
  --shadow-hover: var(--shadow-card);
  --radius-card: 25px;
  --transition-fast: 0.2s;
}

.toast-stack {
  position: fixed;
  top: 96px;
  right: 24px;
  width: min(420px, calc(100vw - 32px));
  z-index: var(--z-toast);
  display: grid;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--card-bg-alt);
  color: var(--text-strong);
  border-radius: var(--radius-lg);
  border-left: 4px solid var(--toast-color);
  box-shadow: var(--shadow-toast);
  pointer-events: auto;
  overflow-wrap: anywhere;
  font-size: 14px;
}
.toast-success { --toast-color: var(--success); }
.toast-info { --toast-color: var(--info); --toast-icon: var(--info-text); }
.toast-warning { --toast-color: var(--warning); --toast-icon: var(--warning-text); }
.toast-error { --toast-color: var(--danger); }
.toast > i { color: var(--toast-icon, var(--toast-color)); font-size: 20px; margin-top: 4px; }
.toast-content { flex: 1; min-width: 0; }
.toast-content strong { display: block; margin-bottom: 4px; }
.toast p { margin: 0; line-height: 1.5; }
.toast-close, .toast-action {
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-strong);
  font: inherit;
  cursor: pointer;
  min-height: 36px;
}
.toast-close { width: 36px; flex-shrink: 0; }
.toast-action { color: var(--accent-strong); text-decoration: underline; padding: 4px 0; }
.modal-open { overflow: hidden; }
.notification-entry { display: flex; align-items: center; gap: 8px; }
a.alert-row { flex: 1; min-width: 0; text-decoration: none; color: inherit; }
a.alert-row:hover { background: var(--notification-hover); }
a.kpi-card, a.strip-item { color: inherit; text-decoration: none; }
a.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); }
.modal-apilado { z-index: calc(var(--z-modal) + 10) !important; }
.confirm-modal.modal-apilado { z-index: calc(var(--z-confirm) + 10) !important; }
/* Confirmación compartida (DESIGN.md 4.8). Las páginas que ya la estilizan la refinan en su CSS. */
.confirm-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--overlay);
  z-index: var(--z-confirm);
}
.confirm-modal.hidden { display: none; }
.confirm-box {
  width: min(100%, 480px);
  background: var(--card-bg);
  border-radius: var(--radius-panel);
  padding: 24px;
  box-shadow: var(--shadow-modal);
}
.confirm-box h2 { color: var(--text-strong); font-size: 20px; margin: 0 0 10px; }
.confirm-box p { color: var(--text-strong); line-height: 1.5; margin: 0 0 20px; }
/* Campo de formulario estándar: el mismo aspecto que Mi cuenta (contraseñas de acciones críticas). */
.campo { margin: 0 0 14px; }
.campo label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--text-strong); }
.campo input {
  box-sizing: border-box; width: 100%; min-height: 44px; padding: 10px 14px;
  border: 1.5px solid var(--input-border); border-radius: var(--radius-md);
  background: var(--input-bg); color: var(--text-strong); font: inherit; font-size: 14px;
}
.campo input::placeholder { color: var(--text-muted); }
.campo input:hover { border-color: var(--accent); }
.campo input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(181, 71, 71, 0.16); }
.campo input[aria-invalid="true"] { border-color: var(--danger); }
.campo .field-help { margin: 5px 0 0; }
.campo .field-error { display: none; }
.campo .field-error.visible { display: block; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.confirm-actions > button { flex: 1 1 130px; min-height: 40px; }
dialog.confirm-dialog { padding: 0; border: 0; background: transparent; color: inherit; width: min(calc(100% - 32px), 480px); max-width: none; }
dialog.confirm-dialog::backdrop { background: var(--overlay); overflow: hidden; overscroll-behavior: contain; }
dialog.confirm-dialog:modal { overscroll-behavior: contain; }
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn-primary, .btn-save, .btn-search, .btn-new, .btn-add {
  background: var(--accent);
  color: var(--card-bg-alt);
  border: 0;
  border-radius: var(--radius-md);
  min-height: 48px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary:hover, .btn-save:hover, .btn-search:hover, .btn-new:hover, .btn-add:hover { background: var(--btn-hover); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn-secondary, .btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.btn-secondary { color: var(--text-dark); background: var(--input-bg); }
.btn-secondary:hover { color: var(--accent); border-color: var(--accent); }
body .btn-secondary:hover { color: var(--accent-strong); }
body .btn-back:hover { color: var(--card-bg-alt); }
.btn-danger { color: var(--card-bg-alt); background: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn-secondary.btn-sm, .btn-danger.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
button:disabled:hover { transform: none; }
::selection { background: var(--accent-soft); color: var(--accent-strong); }
input, textarea { caret-color: var(--accent); }
.kpi-value, .resumen-card, td.numeric, td.num { font-variant-numeric: tabular-nums; }
.field-error { color: var(--danger-text); font-size: 12px; margin: 4px 0 0; }
[aria-invalid="true"] { border-color: var(--danger); }
.phone-group { display: flex; gap: 8px; }
.phone-group select { flex: 0 0 132px; width: 132px; }
.phone-group input { min-width: 0; flex: 1; }
.field-help { font-size: 12px; color: var(--text-muted); }
@media (max-width: 600px) {
  .toast-stack { top: 8px; right: 8px; width: calc(100vw - 16px); }
  .detail-modal { padding: 0; }
  .detail-modal > .detail-panel { max-height: 100dvh; height: 100dvh; width: 100%; border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  min-height: 100%;
}

html:has(nav.main-top-nav) {
  scrollbar-gutter: stable;
}

/* Texto solo para lectores de pantalla (la columna sigue ocupando su lugar) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  background-color: var(--bg);
  color: var(--text-dark);
}

a, button, input, select, textarea {
  font-family: inherit;
}

/* Los controles de formulario no heredan el color del texto en todos los entornos
   de render: con el sistema en modo oscuro (navegador o WebView2) el texto de un
   input/select sin color propio se resuelve casi blanco y queda ilegible sobre los
   fondos claros del tema. Se declara explícito el color del texto y, además, el
   fondo de las opciones del desplegable, que en modo oscuro también se pintan solas. */
input,
select,
textarea {
  color: var(--text-strong);
}

option {
  color: #1e293b;
  background-color: #fff;
}

nav.main-top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 80px;
  min-height: 80px;
  background-color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
  gap: 24px;
  line-height: 20px;
}

@media (min-width: 1428px) {
  nav.main-top-nav {
    padding-left: calc((100% - 1380px) / 2 + 24px);
    padding-right: calc((100% - 1380px) / 2 + 24px);
  }
}

nav.main-top-nav .logo-wrap {
  display: flex;
  align-items: center;
  line-height: 1;
  flex-shrink: 0;
}

nav.main-top-nav .logo-wrap img {
  height: 60px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  display: block;
}

nav.main-top-nav .user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-dark);
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 6px 14px;
  border-radius: 20px;
  width: 200px;
  min-width: 0;
  min-height: 44px;
  flex: 0 0 200px;
  line-height: 20px;
  font-family: 'Inter', sans-serif;
  text-align: left;
}

nav.main-top-nav .user-pill-name {
  flex: 1;
  min-width: 0;
  max-width: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-pill svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

/* Barra de Navegación Horizontal Global (Sub-header) */
nav.dashboard-nav-tabs {
  display: block;
  min-height: auto;
  height: auto;
  padding: 0;
  background: #ffffff;
  border-top: 1px solid #f1e7e5;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 80px;
  z-index: 99;
  box-sizing: border-box;
  flex-shrink: 0;
  line-height: 20px;
}

.nav-tabs-container {
  max-width: 1380px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #e2e8f0 transparent;
  width: 100%;
  min-width: 0;
}

@media (min-width: 1200px) {
  .nav-tabs-container {
    justify-content: center;
    padding: 0 24px;
  }
}

.nav-tabs-container::-webkit-scrollbar {
  height: 4px;
}

.nav-tabs-container::-webkit-scrollbar-thumb {
  background: #e2e8f0;
  border-radius: 4px;
}

.nav-tab-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  color: #475569;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
  border-radius: 8px 8px 0 0;
  flex: 0 0 auto;
  min-height: 48px;
  line-height: 20px;
}

.nav-tab-item > i {
  width: 16px;
  flex: 0 0 16px;
  font-size: 16px;
  text-align: center;
}

.nav-tab-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #64748b;
  transition: color 0.2s ease;
}

.nav-tab-item:hover {
  color: var(--accent);
  background: #fdf6f6;
}

.nav-tab-item:hover svg {
  color: var(--accent);
}

.nav-tab-item.active {
  color: var(--accent);
  font-weight: 600;
  border-bottom-color: var(--accent);
  background: #fbf0ef;
}

.nav-tab-item.active svg {
  color: var(--accent);
}

.nav-tab-item.nav-tab-logout {
  margin-left: 8px;
  color: #b91c1c;
}

.nav-tab-item.nav-tab-logout svg {
  color: #b91c1c;
}

.nav-tab-item.nav-tab-logout:hover {
  background: #fee2e2;
}

.btn-back,
.btn,
.btn-save,
.btn-search,
.btn-new {
  transition: var(--transition-fast);
}

.btn-back:hover,
.btn:hover,
.btn-save:hover,
.btn-search:hover,
.btn-new:hover {
  transform: scale(1.02);
}

main > .card,
main > .form,
main > .page-card {
  background: #e8e3df;
  border-radius: 25px;
  padding: 40px;
  width: 100%;
  max-width: var(--page-card-width);
  margin-left: auto;
  margin-right: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

main.dashboard-main,
main.export-dashboard-main {
  max-width: none;
}

main > .page-card > :last-child {
  margin-bottom: 0;
}

@media (max-width: 900px) {
  main > .card,
  main > .form,
  main > .page-card {
    padding: 28px 20px;
  }
}

/* =========================================================
   COMPONENTE DE NOTIFICACIONES (global, compartido por todas las páginas)
   ========================================================= */

.nav-user-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    flex: 0 0 auto;
}

/* Apartado de Notificaciones */
.notifications-wrapper {
    position: relative;
}

.notifications-btn {
    position: relative;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    flex: 0 0 44px;
    border-radius: 50%;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

@media (max-width: 600px) {
  nav.main-top-nav {
    padding: 0 16px;
    gap: 12px;
  }
  nav.main-top-nav .logo-wrap img {
    height: 48px;
    max-width: 120px;
  }
  nav.main-top-nav .user-pill {
    width: 148px;
    flex-basis: 148px;
    padding: 6px 10px;
  }
}

.notifications-btn:hover {
    background: #f1f5f9;
    color: #1e293b;
    border-color: #cbd5e1;
}

.notifications-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    background: #dc2626;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #c9c9c9;
    box-shadow: 0 2px 5px rgba(220, 38, 38, 0.4);
}
.notifications-badge[hidden] { display: none; }
body .notifications-badge { animation: none; }


.notifications-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 530px;
    max-width: calc(100vw - 24px);
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 10px 35px -5px rgba(0, 0, 0, 0.16), 0 0 1px 1px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    overflow: hidden;
    animation: dropIn 0.2s ease-out;
}
.notifications-dropdown:not(.is-open) { display: none; }
.notifications-dropdown.is-open { display: block; }
@media (max-width: 600px) {
    body .notifications-dropdown { position: fixed; top: 88px; left: 8px; right: 8px; width: auto; max-width: none; }
}

@keyframes dropIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.notif-dropdown-header {
    padding: 16px 18px 12px 18px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.notif-header-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.notif-header-title h4 {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text-strong);
    margin: 0;
}

.notif-count-tag {
    font-size: 11.5px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    background: #fee2e2;
    color: #b91c1c;
}

.notif-header-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.btn-mark-all-read {
    background: transparent;
    border: none;
    color: #2563eb;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.btn-mark-all-read:hover {
    background: #eff6ff;
    color: #1d4ed8;
}

.notif-tabs {
    display: flex;
    gap: 6px;
    background: #e2e8f0;
    padding: 3px;
    border-radius: 8px;
}

.notif-tab {
    flex: 1;
    border: none;
    background: transparent;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.notif-tab.active {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.notif-list-body {
    max-height: 340px;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notif-list-body::-webkit-scrollbar {
    width: 6px;
}

.notif-list-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 10px;
    font-size: 12.5px;
    transition: background 0.15s;
}

.notif-item:hover {
    background: #f1f5f9;
}

.notif-item-left {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.notif-item-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: #fee2e2;
    color: #dc2626;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notif-item-title {
    font-weight: 600;
    color: #1e293b;
    line-height: 1.3;
}

.notif-item-sub {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}

.alert-empty-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    background: #f0fdf4;
    border-radius: 10px;
    color: #166534;
    font-size: 13px;
    font-weight: 500;
}

.alert-item-title {
    font-weight: 600;
    color: #1e293b;
}

.alert-item-subtitle {
    font-size: 11.5px;
    color: #64748b;
}

.fallback-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.fallback-row {
    display: flex;
    justify-content: space-between;
    font-size: 12.5px;
}

.fallback-badge-dot {
    display: flex;
    align-items: center;
    gap: 6px;
}

.fallback-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* Estructura Principal de AnalÃ­ticas (2 Columnas Equilibradas y Flexibles) */
.dashboard-analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 24px;
    width: 100%;
}

.chart-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px 24px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
    overflow: hidden;
}

.card-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

.card-title-wrap h3 {
    font-size: 15.5px;
    font-weight: 700;
    color: var(--text-strong);
    margin-bottom: 2px;
}

.card-title-wrap p {
    font-size: 12px;
    color: var(--text-muted);
}

.link-action {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    background: #fdf6f6;
    padding: 6px 12px;
    border-radius: 20px;
    transition: all 0.2s ease;
}

.link-action:hover {
    color: #ffffff;
    background: var(--accent);
}

.link-action svg {
    transition: transform 0.2s ease;
}

.link-action:hover svg {
    transform: translateX(2px);
}

.chart-wrapper {
    position: relative;
    height: 270px;
    width: 100%;
    min-width: 0;
}

.chart-wrapper canvas {
    max-width: 100% !important;
    max-height: 100% !important;
    display: block;
}

.chart-wrapper-bar {
    height: 270px;
}

/* Widget de Alertas */
.alerts-widget-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-left: 4px solid var(--accent);
    margin-bottom: 24px;
}

.alert-tabs-switch {
    display: flex;
    gap: 6px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 10px;
}

.alert-tabs-switch .tab-btn {
    border: none;
    background: transparent;
    padding: 6px 14px;
    font-size: 12.5px;
    font-weight: 600;
    color: #64748b;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.alert-tabs-switch .tab-btn.active {
    background: #ffffff;
    color: var(--accent);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.alerts-list-wrap {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.alert-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 12px 14px;
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 12px;
    font-size: 13px;
    transition: background 0.15s, opacity 0.2s, border-color 0.15s;
    gap: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.alert-row:hover {
    background: #f8fafc;
    border-color: #e2e8f0;
}

.alert-row.is-read {
    opacity: 0.55;
    background: #f8fafc;
    border-color: #e2e8f0;
}

.alert-row.is-read .alert-icon-svg {
    color: #94a3b8;
}

.alert-left {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: #334155;
    flex: 1;
    min-width: 0;
}

.alert-icon-svg {
    color: #dc2626;
    flex-shrink: 0;
    margin-top: 2px;
}

.alert-text-wrap {
    flex: 1;
    min-width: 0;
}

.alert-item-title {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.35;
    word-break: break-word;
}
.alert-item-subtitle > span { display: block; }
.alert-reference { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.alert-item-subtitle {
    font-size: 11.5px;
    color: #64748b;
    margin-top: 3px;
    line-height: 1.4;
    word-break: break-word;
}

/* Columna de acciones vertical que previene totalmente la sobreposiciÃ³n */
.alert-actions-col {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 6px;
    flex-shrink: 0;
    margin-left: 6px;
}
@media (max-width: 600px) {
    .notification-entry > .alert-row { flex-direction: column; align-items: stretch; gap: 8px; }
    .notification-entry .alert-actions-col { flex-direction: row; align-items: center; justify-content: space-between; margin-left: 28px; }
}

.alert-badge-tag {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
    text-align: right;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

.alert-badge-tag.vencido {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
}

.alert-badge-tag.por_vencer {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-badge-tag.leido {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.btn-mark-single-read {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #334155;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    min-height: 36px;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.btn-mark-single-read:hover {
    background: #f0fdf4;
    border-color: #86efac;
    color: #15803d;
}

.btn-mark-single-read svg {
    color: #16a34a;
}

.empty-hint {
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
    padding: 12px 0;
    text-align: center;
}

/* Contraste WCAG 1.4.3: boton Volver (blanco sobre #888 = 3.54:1) */
body .btn-back {
    background: #6b7280;
    color: #fff;
}

body .btn-back:hover {
    background: #565f6d;
}

/* =========================================================
   ESPACIADO UNIFORME DE PAGINA (mismo margen en todas)
   ========================================================= */
body main,
body main.dashboard-main,
body main.export-dashboard-main {
  padding: 48px 16px 48px 16px;
  margin-left: 0;
  margin-right: 0;
}

body main > .card,
body main > .form,
body main > .page-card {
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 900px) {
  body main,
  body main.dashboard-main,
  body main.export-dashboard-main {
    padding: 28px 14px 32px 14px;
  }
}

/* ===== Sesión expirada: modal de re-autenticación (auth.js) ===== */

body.sesion-abierta {
  overflow: hidden;
}

.sesion-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 3000;
}

.sesion-overlay[hidden] {
  display: none;
}

.sesion-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 24px;
  width: min(100%, 420px);
  box-shadow: 0 20px 35px rgba(0, 0, 0, 0.3);
}

.sesion-card h2 {
  color: var(--text-strong);
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 8px;
}

.sesion-texto {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.sesion-campo {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-strong);
  margin: 10px 0 6px;
}

.sesion-card input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--input-border);
  background-color: var(--input-bg);
  color: #1e293b;
  font-size: 13px;
  outline: none;
  color-scheme: light;
}

.sesion-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 5px rgba(181, 71, 71, 0.35);
}

.sesion-error {
  margin-top: 12px;
  background: #f8d7da;
  color: #721c24;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12.5px;
}

.sesion-acciones {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.sesion-ingresar,
.sesion-cancelar {
  border: none;
  border-radius: 10px;
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.sesion-ingresar {
  background: var(--btn-bg);
  color: #fff;
}

.sesion-ingresar:hover:not(:disabled) {
  background: var(--btn-hover);
}

.sesion-ingresar:disabled {
  opacity: 0.7;
  cursor: progress;
}

.sesion-cancelar {
  background: #f0eeee;
  color: var(--text-strong);
}

.sesion-cancelar:hover {
  background: #e5dede;
}

.sesion-aviso {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: #155724;
  color: #fff;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  z-index: 3100;
}
