/* ============================================================
   Panel de Loterías: sistema de diseño
   Registro: producto. Tema claro, neutros cálidos, acento teal.
   Reemplaza styles.css y styles-optimized.css.
   ============================================================ */

:root {
    /* Neutros entintados hacia el tono de marca (cálidos) */
    --ink: #1c1b18;
    --text: #3f3d38;
    --text-muted: #726e64;
    --surface: #faf9f6;
    --surface-raised: #ffffff;
    --surface-sunken: #f3f1ec;
    --border: #e7e4dd;
    --border-strong: #d6d2c8;

    /* Acento */
    --accent: #0e7466;
    --accent-strong: #0b5d52;
    --accent-soft: #e4f1ee;
    --accent-contrast: #ffffff;

    /* Semánticos */
    --success: #1a7f37;
    --success-soft: #e5f3e8;
    --warning: #91630a;
    --warning-soft: #faf0d7;
    --danger: #bb2d20;
    --danger-soft: #fbeae8;
    --info: #0c6790;
    --info-soft: #e4f0f7;

    /* Layout */
    --sidebar-width: 248px;
    --topbar-height: 60px;
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgba(28, 27, 24, 0.05);
    --shadow: 0 2px 8px rgba(28, 27, 24, 0.07);
    --shadow-lg: 0 12px 32px rgba(28, 27, 24, 0.14);

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ===== Base ===== */

html {
    font-size: 15px;
}

body {
    font-family: var(--font-sans);
    background: var(--surface);
    color: var(--text);
    line-height: 1.55;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--ink);
    font-weight: 600;
    letter-spacing: -0.01em;
}

a {
    color: var(--accent);
}

a:hover {
    color: var(--accent-strong);
}

code {
    background: var(--surface-sunken);
    border-radius: 4px;
    padding: 0.15em 0.4em;
    color: var(--ink);
    font-size: 0.85em;
}

::selection {
    background: var(--accent-soft);
    color: var(--accent-strong);
}

/* ===== Estructura ===== */

.wrapper {
    display: flex;
    min-height: 100vh;
}

.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.2s var(--ease-out);
}

main {
    flex: 1;
}

.page-header h1 {
    font-size: 1.35rem;
    margin: 0;
}

/* ===== Sidebar ===== */

.sidebar {
    width: var(--sidebar-width);
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    background: var(--surface-sunken);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    transition: transform 0.22s var(--ease-out);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1rem 1.1rem;
    min-height: var(--topbar-height);
    border-bottom: 1px solid var(--border);
}

.sidebar-header .logo-img {
    height: 34px;
    width: auto;
}

.sidebar-menu {
    padding: 0.9rem 0.7rem;
    flex: 1;
}

.sidebar-menu .nav-header {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 1.1rem 0.65rem 0.35rem;
}

.sidebar-menu .nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--text);
    font-weight: 500;
    font-size: 0.92rem;
    padding: 0.55rem 0.65rem;
    border-radius: var(--radius-sm);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-menu .nav-link i {
    width: 1.15rem;
    text-align: center;
    color: var(--text-muted);
    transition: color 0.15s ease;
}

.sidebar-menu .nav-link:hover {
    background: rgba(28, 27, 24, 0.05);
    color: var(--ink);
}

.sidebar-menu .nav-link.active {
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.sidebar-menu .nav-link.active i {
    color: var(--accent);
}

.sidebar-footer {
    padding: 0.9rem 1.1rem;
    border-top: 1px solid var(--border);
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Backdrop para el sidebar en móvil */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1035;
    background: rgba(28, 27, 24, 0.4);
}

/* ===== Topbar ===== */

.topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: var(--topbar-height);
    padding: 0 1.4rem;
    background: var(--surface-raised);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.topbar .btn-toggle-sidebar {
    display: none;
    border: 1px solid var(--border);
    background: var(--surface-raised);
    color: var(--text);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    align-items: center;
    justify-content: center;
}

.topbar .breadcrumb {
    margin: 0;
    font-size: 0.85rem;
}

.topbar .breadcrumb-item a {
    color: var(--text-muted);
    text-decoration: none;
}

.topbar .breadcrumb-item a:hover {
    color: var(--accent);
}

.topbar .breadcrumb-item.active {
    color: var(--ink);
    font-weight: 500;
}

/* ===== Tarjetas / paneles ===== */

.card {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.card .card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: 0.85rem 1.15rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.card .card-header .card-title,
.card .card-header h2 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
}

.card .card-body {
    padding: 1.15rem;
}

/* ===== Estadísticas del dashboard ===== */

.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.stat-cell {
    padding: 1.05rem 1.3rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    border-left: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: background-color 0.15s ease;
}

.stat-cell:first-child {
    border-left: none;
}

a.stat-cell:hover {
    background: var(--surface);
    color: inherit;
}

.stat-cell .stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.stat-cell .stat-value {
    font-size: 1.55rem;
    font-weight: 650;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.stat-cell .stat-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ===== Tablas ===== */

.table {
    color: var(--text);
    margin-bottom: 0;
    --bs-table-hover-bg: rgba(14, 116, 102, 0.04);
}

.table thead th {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.6rem 1rem;
    white-space: nowrap;
}

.table td {
    padding: 0.7rem 1rem;
    vertical-align: middle;
    border-color: var(--border);
    font-size: 0.9rem;
}

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

.table a {
    text-decoration: none;
}

/* Miniatura de logo en tablas */
.entity-cell {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--ink);
    font-weight: 500;
    min-width: 0;
}

.entity-cell .entity-sub {
    display: block;
    font-size: 0.76rem;
    font-weight: 400;
    color: var(--text-muted);
}

.entity-logo,
.entity-logo-placeholder {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    flex-shrink: 0;
    object-fit: contain;
    background: var(--surface-sunken);
    border: 1px solid var(--border);
}

.entity-logo-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.entity-logo-placeholder.lg,
.entity-logo.lg {
    width: 72px;
    height: 72px;
    border-radius: var(--radius);
    font-size: 1.5rem;
}

/* Punto de color de marca de una lotería/sorteo */
.brand-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--border-strong);
    flex-shrink: 0;
}

/* ===== Badges de estado ===== */

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.74rem;
    font-weight: 550;
    padding: 0.22rem 0.6rem;
    border-radius: 999px;
    white-space: nowrap;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-badge.published { background: var(--success-soft); color: var(--success); }
.status-badge.draft { background: var(--warning-soft); color: var(--warning); }
.status-badge.scraping { background: var(--accent-soft); color: var(--accent-strong); }
.status-badge.inactive { background: var(--surface-sunken); color: var(--text-muted); }
.status-badge.count { background: var(--info-soft); color: var(--info); }
.status-badge.count::before, .status-badge.plain::before { display: none; }
.status-badge.plain { background: var(--surface-sunken); color: var(--text-muted); }
.status-badge.level-error { background: var(--danger-soft); color: var(--danger); }

/* ===== Página de registros ===== */

.log-table td {
    font-size: 0.85rem;
}

.log-message {
    max-width: 60ch;
    overflow-wrap: anywhere;
}

.log-meta summary {
    cursor: pointer;
    color: var(--accent);
    font-size: 0.78rem;
}

.log-meta pre {
    background: var(--surface-sunken);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.8rem;
    font-size: 0.75rem;
    margin: 0.4rem 0 0;
    max-height: 240px;
    overflow: auto;
}

/* ===== Botones ===== */

.btn {
    font-weight: 500;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    box-shadow: none;
}

.btn-primary {
    --bs-btn-bg: var(--accent);
    --bs-btn-border-color: var(--accent);
    --bs-btn-hover-bg: var(--accent-strong);
    --bs-btn-hover-border-color: var(--accent-strong);
    --bs-btn-active-bg: var(--accent-strong);
    --bs-btn-active-border-color: var(--accent-strong);
    --bs-btn-color: var(--accent-contrast);
    --bs-btn-hover-color: var(--accent-contrast);
    --bs-btn-active-color: var(--accent-contrast);
    --bs-btn-disabled-bg: var(--accent);
    --bs-btn-disabled-border-color: var(--accent);
}

.btn-outline-secondary {
    --bs-btn-color: var(--text);
    --bs-btn-border-color: var(--border-strong);
    --bs-btn-hover-bg: var(--surface-sunken);
    --bs-btn-hover-color: var(--ink);
    --bs-btn-hover-border-color: var(--border-strong);
    --bs-btn-active-bg: var(--surface-sunken);
    --bs-btn-active-color: var(--ink);
    --bs-btn-active-border-color: var(--border-strong);
}

.btn-danger {
    --bs-btn-bg: var(--danger);
    --bs-btn-border-color: var(--danger);
    --bs-btn-hover-bg: #a02417;
    --bs-btn-hover-border-color: #a02417;
}

/* Botones de icono en tablas */
.btn-icon {
    width: 30px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-raised);
    color: var(--text-muted);
    font-size: 0.8rem;
}

.btn-icon:hover {
    color: var(--ink);
    background: var(--surface-sunken);
    border-color: var(--border-strong);
}

.btn-icon.btn-icon-danger:hover {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: var(--danger-soft);
}

.actions-cell {
    display: flex;
    gap: 0.35rem;
    justify-content: flex-end;
}

/* ===== Formularios ===== */

.form-label {
    font-size: 0.84rem;
    font-weight: 550;
    color: var(--ink);
    margin-bottom: 0.3rem;
}

.form-control,
.form-select {
    border-color: var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--ink);
    font-size: 0.9rem;
    background-color: var(--surface-raised);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-text {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

.form-check-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Barra de filtros */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
}

.filter-bar .form-control,
.filter-bar .form-select {
    font-size: 0.86rem;
}

.filter-bar .search-group {
    position: relative;
    flex: 1 1 220px;
    max-width: 340px;
}

.filter-bar .search-group i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8rem;
    pointer-events: none;
}

.filter-bar .search-group .form-control {
    padding-left: 2.1rem;
}

/* ===== Bolas de resultados =====
   El campo `format` del sorteo define el color por posición:
   0 gris, 1 azul, 2 rojo, 3 naranja, 4 verde (multiplicador). */

.lottery-result {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: center;
}

.lottery-ball,
.lottery-rect {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 650;
    color: #fff;
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
    box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.18), inset 0 2px 3px rgba(255, 255, 255, 0.28), var(--shadow-sm);
}

.lottery-ball {
    width: 34px;
    height: 34px;
    border-radius: 50%;
}

.lottery-rect {
    min-width: 34px;
    height: 34px;
    padding: 0 0.55rem;
    border-radius: 999px;
}

.lottery-ball-sm.lottery-ball,
.lottery-ball-sm.lottery-rect { width: 28px; height: 28px; font-size: 0.72rem; }
.lottery-ball-sm.lottery-rect { width: auto; min-width: 28px; }

.lottery-ball-lg.lottery-ball,
.lottery-ball-lg.lottery-rect { width: 48px; height: 48px; font-size: 1.05rem; }
.lottery-ball-lg.lottery-rect { width: auto; min-width: 48px; }

.ball-primary, .rect-primary { background: radial-gradient(circle at 32% 28%, #3b6fe0, #1d4ed8 62%, #16389d); }
.ball-danger, .rect-danger { background: radial-gradient(circle at 32% 28%, #e5544a, #d02c20 62%, #9c1f16); }
.ball-warning, .rect-warning { background: radial-gradient(circle at 32% 28%, #f0793a, #e05e14 62%, #a84610); }
.ball-success, .rect-success { background: radial-gradient(circle at 32% 28%, #34b45e, #1a9445 62%, #126b32); }
.ball-secondary, .rect-secondary { background: radial-gradient(circle at 32% 28%, #8b8f98, #6b7078 62%, #4d5158); }

.lottery-ball-group {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}

.lottery-ball-label {
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    line-height: 1;
}

@keyframes ballIn {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

.lottery-ball.animated,
.lottery-rect.animated {
    animation: ballIn 0.35s var(--ease-out) backwards;
}

/* ===== Paginación ===== */

.pagination {
    --bs-pagination-color: var(--text);
    --bs-pagination-border-color: var(--border);
    --bs-pagination-hover-color: var(--ink);
    --bs-pagination-hover-bg: var(--surface-sunken);
    --bs-pagination-hover-border-color: var(--border);
    --bs-pagination-focus-color: var(--accent-strong);
    --bs-pagination-focus-bg: var(--accent-soft);
    --bs-pagination-focus-box-shadow: none;
    --bs-pagination-active-bg: var(--accent);
    --bs-pagination-active-border-color: var(--accent);
    --bs-pagination-disabled-color: var(--border-strong);
    --bs-pagination-disabled-border-color: var(--border);
    margin: 0;
}

.pagination .page-link {
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

.pagination-info {
    font-size: 0.83rem;
    color: var(--text-muted);
}

/* ===== Alertas / flash ===== */

.alert {
    border-radius: var(--radius);
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.alert-success { background: var(--success-soft); color: var(--success); border-color: rgba(26, 127, 55, 0.2); }
.alert-danger { background: var(--danger-soft); color: var(--danger); border-color: rgba(187, 45, 32, 0.2); }
.alert-info { background: var(--info-soft); color: var(--info); border-color: rgba(12, 103, 144, 0.2); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: rgba(145, 99, 10, 0.25); }

/* ===== Estados vacíos ===== */

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--surface-sunken);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 0.9rem;
}

.empty-state h3 {
    font-size: 1rem;
    margin-bottom: 0.3rem;
}

.empty-state p {
    font-size: 0.88rem;
    max-width: 38ch;
    margin: 0 auto 1rem;
}

/* ===== Modales ===== */

.modal-content {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.25rem;
}

.modal-title {
    font-size: 1rem;
}

.modal-footer {
    border-top: 1px solid var(--border);
    padding: 0.85rem 1.25rem;
}

/* ===== Listas de definición (páginas de detalle) ===== */

.meta-list {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.45rem 1.2rem;
    font-size: 0.89rem;
    margin: 0;
}

.meta-list dt {
    color: var(--text-muted);
    font-weight: 500;
}

.meta-list dd {
    margin: 0;
    color: var(--ink);
    overflow-wrap: anywhere;
}

/* ===== Gráficos ===== */

.chart-area {
    position: relative;
    height: 300px;
}

.chart-pie {
    position: relative;
    height: 300px;
}

/* ===== Footer ===== */

.footer {
    border-top: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ===== Responsive ===== */

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
    }

    .content-wrapper {
        margin-left: 0;
    }

    .topbar .btn-toggle-sidebar {
        display: inline-flex;
    }
}

@media (max-width: 575.98px) {
    .topbar {
        padding: 0 1rem;
    }

    main.container-fluid {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .stat-cell {
        border-left: none;
        border-top: 1px solid var(--border);
    }

    .stat-cell:first-child {
        border-top: none;
    }
}

/* ===== Accesibilidad / preferencias ===== */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media print {
    .sidebar, .topbar, .btn, .footer, .actions-cell, .modal {
        display: none !important;
    }

    .content-wrapper {
        margin-left: 0 !important;
    }
}

/* ===== Contenido SEO generado (vista de detalle) ===== */
.seo-content {
    max-width: 72ch;
    color: var(--text);
    line-height: 1.6;
}
.seo-content h2 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 1.4rem 0 0.5rem;
    color: var(--text-strong, var(--text));
}
.seo-content h2:first-child { margin-top: 0; }
.seo-content ul, .seo-content ol { padding-left: 1.3rem; }
.seo-content li { margin-bottom: 0.3rem; }
.seo-content details {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0.9rem;
    margin-bottom: 0.5rem;
}
.seo-content summary { cursor: pointer; font-weight: 600; }
.seo-content details p { margin: 0.6rem 0 0.2rem; }
.seo-content .note { font-size: 0.82rem; color: var(--text-muted); }

/* ===== Estadísticas: scraping por día y consultas al API ===== */
.card .card-header .card-subtitle {
    margin: 0.15rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
}
.card .card-header .card-subtitle code { font-size: 0.78rem; }
.card .card-header form { margin: 0; }

.stat-row.compact { box-shadow: none; }
.stat-row.compact .stat-cell { padding: 0.8rem 1rem; }
.stat-row.compact .stat-value { font-size: 1.3rem; }

.chart-area-lg { height: 340px; }

.section-title {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin: 0 0 0.6rem;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85em;
    color: var(--ink);
    text-decoration: none;
}
a.mono:hover { color: var(--accent-strong); text-decoration: underline; }

.status-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.45rem;
}
.status-list li {
    display: grid;
    grid-template-columns: 56px 1fr 44px;
    align-items: center;
    gap: 0.6rem;
}
.status-list .status-badge { justify-content: center; text-decoration: none; }
.status-list .status-bar {
    height: 8px;
    background: var(--surface-sunken);
    border-radius: 999px;
    overflow: hidden;
}
.status-list .status-bar > span {
    display: block;
    height: 100%;
    background: var(--accent);
    border-radius: 999px;
}
.status-list .status-n {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-size: 0.85rem;
    color: var(--text);
}

@media (min-width: 992px) {
    .border-end-lg { border-right: 1px solid var(--border); }
}

.filter-bar .form-control-sm-w { max-width: 200px; }

/* ===== Acceso al panel (login) ===== */
.auth-body {
    background:
        radial-gradient(80% 60% at 50% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%),
        var(--surface);
    padding: 1.15rem;
    min-height: 100vh;
}

.auth-shell {
    min-height: calc(100vh - 2.3rem);
    display: grid;
    place-items: center;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.2rem 1.9rem;
    text-align: center;
}

.auth-card .auth-logo {
    height: 42px;
    width: auto;
    margin-bottom: 1.4rem;
}

.auth-card h1 {
    font-size: 1.35rem;
    font-weight: 650;
    color: var(--ink);
    margin: 0 0 0.35rem;
}

.auth-card .auth-intro {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 1.6rem;
}

.auth-card .form-label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
}

.auth-card .alert {
    text-align: left;
    font-size: 0.86rem;
}

.auth-hint {
    margin: 1.4rem 0 0;
    font-size: 0.76rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.auth-setup {
    text-align: left;
    font-size: 0.86rem;
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
}

.auth-setup pre {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.9rem;
    margin: 0 0 0.7rem;
    font-size: 0.8rem;
    overflow-x: auto;
}

.topbar-user {
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.topbar-user i { margin-right: 0.15rem; }

/* La pantalla de acceso es la única que debe verse bien aunque el CDN de
   Bootstrap no cargue: estilos mínimos propios para sus campos. */
.auth-card .form-label { display: block; margin-bottom: 0.3rem; }

.auth-card .form-control {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font: inherit;
    color: var(--ink);
    background: var(--surface-raised);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
}

.auth-card .form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.auth-card .btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.55rem 1rem;
    font: inherit;
    font-weight: 600;
    color: var(--accent-contrast);
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.auth-card .btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.auth-card .alert-danger { background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent); border-radius: var(--radius-sm); padding: 0.7rem 0.9rem; margin-bottom: 1.1rem; }
