/* Dark Flat Design System - Gold Accent */

:root {
    color-scheme: dark;
    --bg-base: #121214;
    --card-bg: #1a1a1d;
    --card-border: #2a2a2e;
    --text-primary: #f5f5f5;
    --text-secondary: #8a8a8a;
    --primary: #e0a030;
    --primary-hover: #c6871c;
    --accent: #e0a030;
    --success: #28a745;
    --error: #dc3545;
    --warning: #f0b020;
    --sidebar-bg: #0f0f11;
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --transition-smooth: all 0.2s ease;
}

/* Light Theme Tokens (applied via data-theme on <html>) */
[data-theme="light"] {
    color-scheme: light;
    --bg-base: #eef0e8;
    --card-bg: #ffffff;
    --card-border: #d9dbd2;
    --text-primary: #1d1d1b;
    --text-secondary: #66705f;
    --primary: #bd8410;
    --primary-hover: #a06e0a;
    --accent: #bd8410;
    --sidebar-bg: #fafaf4;
    --success: #1f9d41;
    --error: #d22f3b;
    --warning: #d99a0a;
}

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

html {
    color-scheme: dark;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Card / panel base (flat) */
.glass-panel {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
}

/* Auth pages */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 32px;
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-title {
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Forms */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.form-group:has(.form-control[required]) .form-label::after {
    content: " *";
    color: var(--error);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition-smooth);
}

.form-control::placeholder {
    color: var(--text-secondary);
}

select.form-control option {
    background: var(--card-bg);
    color: var(--text-primary);
}

.form-control:focus {
    border-color: var(--primary);
    background: #202024;
}

.form-check-input {
    accent-color: var(--primary);
}

select.form-control {
    color-scheme: dark;
}

input[type="date"] {
    color-scheme: dark;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 11px 22px;
    background: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 6px;
    color: #0d0d0f;
    font-weight: 700;
    font-size: 0.86rem;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-decoration: none;
}

.btn:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #0d0d0f;
}

.btn:active {
    background: var(--primary-hover);
}

.auth-links {
    margin-top: 18px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.auth-links a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-links a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Alerts */
.alert {
    padding: 11px 16px;
    border-radius: 6px;
    margin-bottom: 18px;
    font-size: 0.9rem;
}

.alert-success {
    background: rgba(40, 167, 69, 0.14);
    border: 1px solid rgba(40, 167, 69, 0.35);
    color: #0a2916;
}

[data-theme="dark"] .alert-success {
    color: #5fc97c;
}

.alert-danger {
    background: rgba(220, 53, 69, 0.14);
    border: 1px solid rgba(220, 53, 69, 0.35);
    color: #000000;
}

[data-theme="dark"] .alert-danger {
    color: #ef8090;
}

.alert-warning {
    background: rgba(240, 176, 32, 0.14);
    border: 1px solid rgba(240, 176, 32, 0.4);
    color: #5c3d05;
}

[data-theme="dark"] .alert-warning {
    color: #e8b34d;
}

[data-theme="light"] .alert-warning {
    color: #854d0e;
}

.alert ul {
    margin: 0;
    padding-left: 18px;
}

/* Layout App */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    padding: 24px 18px;
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    transition: width 0.25s ease, margin-left 0.3s ease, left 0.3s ease, padding 0.25s ease;
    margin: 15px;
    height: calc(100vh - 30px);
    background: var(--sidebar-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 26px;
}

.sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 6px;
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    transition: var(--transition-smooth);
}

.sidebar-toggle svg {
    width: 20px;
    height: 20px;
}

.sidebar-toggle .icon-close {
    display: none;
}

.sidebar-toggle:hover {
    color: var(--primary);
    border-color: var(--primary);
}

/* Theme toggle button */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 6px;
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    margin-left: auto;
    transition: var(--transition-smooth);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

.theme-toggle:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.theme-toggle .icon-sun {
    display: none;
}

.theme-toggle .icon-moon {
    display: block;
}

[data-theme="light"] .theme-toggle .icon-sun {
    display: block;
}

[data-theme="light"] .theme-toggle .icon-moon {
    display: none;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-text {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--primary);
}

/* Logotipo compacto que aparece cuando el menú está contraído */
.logo-mark {
    display: none;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(224, 160, 48, 0.14);
    color: var(--primary);
    flex-shrink: 0;
}

.logo-mark svg {
    width: 20px;
    height: 20px;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 5px;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.92rem;
    transition: var(--transition-smooth);
}

.nav-item a svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
}

.nav-category-header .cat-ico {
    display: inline-flex;
    align-items: center;
    gap: 9px;
}

.nav-category-header .cat-ico svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.nav-item a:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.nav-item a:hover svg {
    color: var(--primary);
}

.nav-item.active a {
    color: var(--text-primary);
    background: rgba(224, 160, 48, 0.1);
    border-left: 3px solid var(--primary);
}

.nav-item.active a svg {
    color: var(--primary);
}

.sidebar-user-wrap {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--card-border);
    width: 100%;
    position: relative;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 40px;
    background: none;
    border: none;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    color: inherit;
    transition: var(--transition-smooth);
}

.sidebar-user:hover {
    background: rgba(255, 255, 255, 0.04);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #3a3d42;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.sidebar-user-name {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.user-caret {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

.sidebar-user-wrap.open .user-caret {
    transform: rotate(180deg);
}

/* Dropdown de cuenta (flotante, por encima del contenido) */
.user-menu {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    min-width: 200px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px) scale(0.98);
    transform-origin: bottom left;
    z-index: 120;
    transition: opacity 0.18s ease, visibility 0.18s ease, transform 0.18s ease;
}

.sidebar-user-wrap.open .user-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: var(--transition-smooth);
}

.user-menu-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.user-menu-item:hover {
    background: rgba(220, 53, 69, 0.1);
    color: var(--error);
}

.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.header {
    height: 64px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
}

.header-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary);
}

.content-body {
    padding: 28px 32px;
    flex-grow: 1;
}

/* Section titles (page headers inside panels) */
.glass-panel h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary) !important;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Dashboard cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.dashboard-card {
    padding: 20px;
    transition: var(--transition-smooth);
}

.dashboard-card:hover {
    background: #202024;
}

.card-icon {
    font-size: 1.7rem;
    margin-bottom: 12px;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.card-value {
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--text-primary);
}

/* Tables */
.table-container {
    margin-top: 20px;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    background: var(--card-bg);
}

.data-table th {
    padding: 12px 14px;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 1px solid var(--card-border);
    font-size: 0.88rem;
    white-space: nowrap;
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #232327;
    font-size: 0.92rem;
}

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

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Badges (solid pills) */
.badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}

.badge-active {
    background: var(--success);
    color: #ffffff;
}

.badge-inactive {
    background: #4a4f57;
    color: #ffffff;
}

.badge-warning {
    background: var(--warning);
    color: #1a1a1d;
}

.badge-info {
    background: #1a6fc4;
    color: #ffffff;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 24px;
    list-style: none;
    padding: 0;
}

.pagination-item {
    min-width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    cursor: pointer;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition-smooth);
    padding: 0 8px;
}

.pagination-item a {
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.pagination-item:hover:not(.active):not(.disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination-item:hover:not(.active):not(.disabled) a {
    color: var(--primary);
}

.pagination-item.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #0d0d0f;
}

.pagination-item.active span {
    color: #0d0d0f;
}

.pagination-item.disabled {
    opacity: 0.4;
    cursor: default;
}

/* Row action icon buttons (border-only, square) */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    padding: 5px;
    text-decoration: none;
    border: 1.5px solid #38bdf8;
    color: #38bdf8;
    outline: none;
    margin: 0;
    line-height: 1;
    box-sizing: border-box;
    transition: var(--transition-smooth);
    vertical-align: middle;
}

.btn-icon:hover {
    background: #1e2e37;
    color: #38bdf8;
}

[data-theme="light"] .btn-icon:hover {
    background: rgba(56, 189, 248, 0.12);
    color: #063352;
}

.btn-icon.btn-edit {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-icon.btn-edit:hover {
    background: rgba(224, 160, 48, 0.12);
    color: var(--primary);
}

.btn-icon.btn-delete {
    border-color: var(--error);
    color: var(--error);
}

.btn-icon.btn-delete:hover {
    background: rgba(220, 53, 69, 0.12);
    color: var(--error);
}

.btn-icon.btn-renew {
    border-color: var(--success);
    color: var(--success);
}

.btn-icon.btn-renew:hover {
    background: rgba(40, 167, 69, 0.12);
    color: var(--success);
}

.action-buttons {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* Hamburger Button */
.hamburger-btn {
    display: none;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    font-size: 1.2rem;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition-smooth);
    margin-right: 14px;
}

.hamburger-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Collapsible submenus */
.nav-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 9px 12px;
    margin-top: 14px;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 0.78rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 700;
    letter-spacing: 0.8px;
    cursor: pointer;
    border-radius: 6px;
    transition: var(--transition-smooth);
    user-select: none;
}

.nav-category-header:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.nav-category-header .caret {
    font-size: 0.65rem;
    transition: transform 0.3s ease;
    display: inline-block;
}

.nav-category-header.expanded .caret {
    transform: rotate(90deg);
}

.submenu {
    list-style: none;
    padding-left: 14px;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
}

.submenu.expanded {
    max-height: 640px;
}

/* Sidebar drawer overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.55);
    border: none;
    padding: 0;
    z-index: 998;
}

/* Password toggle */
.btn-toggle-password {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: var(--transition-smooth);
}

.btn-toggle-password:hover {
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 768px) {
    .hamburger-btn {
        display: inline-flex;
    }

    /* En móvil el botón del sidebar funciona como "cerrar menú" */
    .sidebar-header {
        justify-content: space-between;
    }

    .sidebar-toggle {
        display: inline-flex;
        order: 2;
    }

    .sidebar-toggle .icon-panel {
        display: none;
    }

    .sidebar-toggle .icon-close {
        display: block;
    }

    body.nav-drawer-open {
        overflow: hidden;
    }

    .app-container {
        flex-direction: column;
        position: relative;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -300px;
        width: 280px;
        height: 100vh !important;
        margin: 0 !important;
        border-radius: 0 !important;
        z-index: 999;
        transition: left 0.3s ease;
        border-right: 1px solid var(--card-border);
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .header {
        margin: 12px 12px 0 12px !important;
        padding: 0 16px;
    }

    .content-body {
        padding: 18px;
    }
}

/* Desktop Sidebar Collapse -> Icon Rail (top-level icons only) */
@media (min-width: 769px) {
.app-container.sidebar-collapsed .sidebar {
    width: 70px;
    padding: 16px 10px;
    background: #0d0d0f;
    align-items: center;
}

.app-container.sidebar-collapsed .sidebar-header {
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
}

.app-container.sidebar-collapsed .logo-container {
    display: flex;
    justify-content: center;
}

.app-container.sidebar-collapsed .logo-text {
    display: none;
}

.app-container.sidebar-collapsed .logo-mark {
    display: inline-flex;
}

.app-container.sidebar-collapsed .nav-menu {
    overflow: visible;
    padding-right: 0;
    gap: 8px;
    width: 100%;
    align-items: center;
}

.app-container.sidebar-collapsed .nav-category {
    width: 100%;
}

.app-container.sidebar-collapsed .nav-category-header {
    justify-content: center;
    padding: 8px 0;
    margin-top: 0;
    width: 100%;
    position: relative;
}

.app-container.sidebar-collapsed .nav-category-header .cat-ico {
    gap: 0;
}

.app-container.sidebar-collapsed .cat-label {
    display: none;
}

.app-container.sidebar-collapsed .nav-category-header .caret {
    display: none;
}

.app-container.sidebar-collapsed .cat-ico svg {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

.app-container.sidebar-collapsed .nav-category-header:hover .cat-ico svg {
    color: var(--primary);
}

.app-container.sidebar-collapsed .nav-category-header.expanded .cat-ico svg {
    color: var(--primary);
}

.app-container.sidebar-collapsed .submenu {
    display: none;
}

.app-container.sidebar-collapsed .nav-item {
    width: 100%;
    display: flex;
    justify-content: center;
}

.app-container.sidebar-collapsed .nav-item a {
    justify-content: center;
    gap: 0;
    width: 38px;
    height: 36px;
    padding: 0;
    border-radius: 6px;
    position: relative;
    border-left: 3px solid transparent;
}

.app-container.sidebar-collapsed .nav-item a span {
    display: none;
}

.app-container.sidebar-collapsed .nav-item a svg {
    width: 20px;
    height: 20px;
}

.app-container.sidebar-collapsed .nav-item.active a {
    border-left: 3px solid var(--primary);
    background: rgba(224, 160, 48, 0.12);
}

.app-container.sidebar-collapsed .nav-item.active a svg {
    color: var(--primary);
}

/* Tooltip (Principal in collapsed rail) */
.app-container.sidebar-collapsed .nav-item a::after,
.app-container.sidebar-collapsed .nav-category-header::after {
    content: attr(data-title);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: #2a2a2d;
    color: #f5f5f5;
    font-weight: 700;
    font-size: 0.72rem;
    white-space: nowrap;
    padding: 6px 10px;
    border-radius: 6px;
    line-height: 1;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 90;
    transition: opacity 0.15s ease 0.18s, visibility 0.15s ease 0.18s;
}

.app-container.sidebar-collapsed .nav-item a:hover::after,
.app-container.sidebar-collapsed .nav-category-header:hover::after {
    opacity: 1;
    visibility: visible;
}

.app-container.sidebar-collapsed .sidebar-user {
    justify-content: center;
    padding: 6px 0;
}

.app-container.sidebar-collapsed .sidebar-user-name,
.app-container.sidebar-collapsed .user-caret {
    display: none;
}

/* En estado contraído el menú de cuenta se abre a la derecha del avatar,
   sin afectar el ancho del sidebar ni el contenido principal. */
.app-container.sidebar-collapsed .user-menu {
    left: calc(100% + 12px);
    right: auto;
    bottom: 0;
    min-width: 200px;
    transform-origin: bottom left;
    /* Cerrado: ligeramente desplazado a la izquierda (hacia el avatar). */
    transform: translateX(-10px) scale(0.98);
}

/* Al abrirse en contraído, entra deslizándose horizontalmente desde la izquierda. */
.app-container.sidebar-collapsed .sidebar-user-wrap.open .user-menu {
    transform: translateX(0) scale(1);
}
}

@media (min-width: 769px) {
    .sidebar {
        position: sticky;
        top: 15px;
        align-self: flex-start;
    }

    .nav-menu {
        flex: 1 1 auto;
        overflow-y: auto;
        min-height: 0;
    }
}

/* ===== Light Mode overrides (hardcoded colors) ===== */
[data-theme="light"] select.form-control,
[data-theme="light"] input[type="date"] {
    color-scheme: light;
}

[data-theme="light"] .form-control:focus {
    background: #ffffff;
}

[data-theme="light"] .dashboard-card:hover {
    background: #f5f6ef;
}

[data-theme="light"] .data-table td {
    border-bottom-color: #e5e7de;
}

[data-theme="light"] .data-table tbody tr:hover,
[data-theme="light"] .nav-item a:hover,
[data-theme="light"] .nav-category-header:hover,
[data-theme="light"] .sidebar-user:hover,
[data-theme="light"] .hamburger-btn:hover {
    background: rgba(10, 12, 16, 0.05);
}

[data-theme="light"] .nav-item.active a {
    background: rgba(189, 132, 16, 0.14);
}

[data-theme="light"] .alert-success {
    color: #166534;
}

[data-theme="light"] .alert-danger {
    color: #c82333;
}

[data-theme="light"] .user-avatar {
    background: #e3e4dc;
    color: #23232a;
}

[data-theme="light"] .badge-inactive {
    background: #99a096;
}

[data-theme="light"] .sidebar-overlay {
    background: rgba(10, 12, 16, 0.35);
}

[data-theme="light"] .app-container.sidebar-collapsed .sidebar {
    background: #ffffff;
}

[data-theme="light"] .app-container.sidebar-collapsed .nav-item a::after {
    background: #2b2b2c;
    color: #f5f5f5;
}

/* ============================================================
   MÓDULO DE REPORTES
   Se distinguen dos áreas:
   - INTERFAZ (panel de control y acciones): clases .report-panel /
     .report-actions / .report-preview-exit → nunca se imprimen.
   - DOCUMENTO (.report-document): única zona imprimible.
   ============================================================ */

/* ---------- Panel de control (interfaz) ---------- */
.report-panel {
    padding: 20px 24px;
    margin-bottom: 18px;
}

.report-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.report-panel__title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary) !important;
}

.report-panel__subtitle {
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.report-filters {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.report-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 170px;
}

.report-field .form-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 0;
}

.report-field--action {
    justify-content: flex-end;
}

/* ---------- Barra de acciones (interfaz) ---------- */
.report-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.report-actions__group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.report-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid var(--card-border);
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    transition: var(--transition-smooth);
}

.report-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.report-btn--primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #0d0d0f;
}

.report-btn--primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #0d0d0f;
}

/* ---------- Documento del reporte (hoja imprimible) ---------- */
.report-document {
    background: #ffffff;
    color: #1a1a1a;
    width: 100%;
    max-width: 900px;
    margin: 0 auto 32px;
    padding: 34px 38px 28px;
    border: 1px solid #d8d8d2;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
    font-size: 13px;
    line-height: 1.45;
}

.report-document * {
    box-sizing: border-box;
}

/* Encabezado institucional */
.report-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    padding-bottom: 14px;
    border-bottom: 3px double #333333;
    margin-bottom: 18px;
}

.report-header__institution {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #6b6b6b;
    margin-bottom: 4px;
}

.report-header__title {
    font-size: 21px;
    font-weight: 800;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: #111111;
    line-height: 1.2;
}

.report-header__subtitle {
    margin-top: 4px;
    font-size: 12.5px;
    color: #555555;
    font-style: italic;
}

.report-header__meta {
    text-align: right;
    font-size: 11.5px;
    color: #444444;
    min-width: 200px;
}

.report-header__meta-item {
    margin-top: 5px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.report-header__meta-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #8a8a8a;
}

.report-header__meta-value {
    font-weight: 600;
    color: #222222;
}

/* Resumen estadístico */
.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.report-summary__item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    padding: 10px 14px;
    border: 1px solid #e0e0da;
    border-left: 4px solid #9aa0a6;
    border-radius: 4px;
    background: #f8f8f5;
}

.report-summary__value {
    font-size: 22px;
    font-weight: 800;
    line-height: 1.1;
    color: #1a1a1a;
}

.report-summary__label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: #6b7280;
}

.report-summary__item--success { border-left-color: #1f9d41; }
.report-summary__item--success .report-summary__value { color: #157a31; }
.report-summary__item--danger { border-left-color: #c62828; }
.report-summary__item--danger .report-summary__value { color: #b32424; }
.report-summary__item--warning { border-left-color: #d99a0a; }
.report-summary__item--warning .report-summary__value { color: #a87708; }
.report-summary__item--info { border-left-color: #1f6fd6; }
.report-summary__item--info .report-summary__value { color: #1a5fb0; }
.report-summary__item--muted { border-left-color: #8a8f98; }

/* Bloques y tablas */
.report-block {
    margin-bottom: 20px;
}

.report-block__title {
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #333333;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #dddddd;
}

/* Caja con scroll propio: si la tabla no cabe, solo ella se desplaza. */
.report-table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    color: #1f1f1f;
}

.report-table th {
    background: #ececea;
    border: 1px solid #cfcfca;
    padding: 8px 10px;
    text-align: left;
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #2a2a2a;
}

.report-table td {
    border: 1px solid #dcdcd7;
    padding: 7px 10px;
    vertical-align: top;
    /* Nombres, descripciones o correos largos se ajustan en lugar de desbordar. */
    overflow-wrap: anywhere;
}

.report-table tbody tr:nth-child(even) {
    background: #fafaf8;
}

.report-table .is-center { text-align: center; }
.report-table .is-right { text-align: right; }

.report-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    white-space: nowrap;
    border: 1px solid transparent;
}

.report-badge--success { background: #e4f5e8; color: #157a31; border-color: #b7e0c1; }
.report-badge--muted { background: #eceef0; color: #55606b; border-color: #d3d8dd; }
.report-badge--danger { background: #fdeaea; color: #b32424; border-color: #f3c4c4; }
.report-badge--warning { background: #fdf3dd; color: #854d0e; border-color: #f0dcae; }
.report-badge--info { background: #e7f0fb; color: #1a5fb0; border-color: #c3daf5; }

.report-empty {
    padding: 18px;
    border: 1px dashed #cccccc;
    border-radius: 6px;
    color: #666666;
    text-align: center;
    font-size: 12.5px;
}

/* Pie de página del documento */
.report-footer {
    margin-top: 22px;
    padding-top: 10px;
    border-top: 1px solid #dddddd;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    font-size: 10.5px;
    color: #666666;
}

.report-footer__text {
    max-width: 70%;
}

/* ---------- Vista previa (solo pantalla) ---------- */
body.report-preview-mode {
    background: #454545 !important;
}

body.report-preview-mode .sidebar,
body.report-preview-mode .sidebar-overlay,
body.report-preview-mode .header,
body.report-preview-mode .report-panel,
body.report-preview-mode .report-actions {
    display: none !important;
}

body.report-preview-mode .app-container {
    display: block !important;
}

body.report-preview-mode .content-body {
    padding: 26px 16px;
}

body.report-preview-mode .report-document {
    max-width: 794px;
}

.report-preview-exit {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1200;
    padding: 10px 18px;
    border-radius: 6px;
    border: 1px solid var(--primary);
    background: var(--primary);
    color: #0d0d0f;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.report-toast {
    position: fixed;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1f1f22;
    color: #ffffff;
    border: 1px solid var(--primary);
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.85rem;
    z-index: 1300;
    opacity: 0;
    visibility: hidden;
    max-width: 90vw;
    text-align: center;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.report-toast.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* ---------- Vista previa responsive (solo pantalla) ----------
   Corrige el desbordamiento horizontal en móviles y tabletas:
   reduce paddings, apila encabezado y pie, y contiene el scroll
   de las tablas en su propia caja. La impresión no se ve afectada
   porque estas reglas viven dentro de @media screen. */
@media screen and (max-width: 768px) {
    .report-panel {
        padding: 16px;
    }

    /* La hoja se estrecha sin perder márgenes internos. */
    .report-document {
        padding: 22px 18px 18px;
        border-radius: 6px;
    }

    /* El encabezado institucional se apila para no forzar ancho. */
    .report-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .report-header__meta {
        min-width: 0;
        text-align: left;
    }

    .report-header__meta-item {
        align-items: flex-start;
    }

    .report-summary {
        grid-template-columns: repeat(auto-fit, minmax(min(120px, 100%), 1fr));
    }

    /* El pie se ajusta en varias líneas. */
    .report-footer {
        flex-wrap: wrap;
        gap: 6px;
    }

    .report-footer__text {
        max-width: 100%;
    }

    .report-table th,
    .report-table td {
        padding: 6px 8px;
    }
}

@media screen and (max-width: 480px) {
    .report-document {
        padding: 18px 14px 16px;
        font-size: 12.5px;
    }

    .report-header__title {
        font-size: 18px;
    }

    .report-summary {
        grid-template-columns: repeat(auto-fit, minmax(min(96px, 100%), 1fr));
    }

    .report-summary__value {
        font-size: 19px;
    }

    /* Filtros y acciones a ancho completo: apilados y cómodos de pulsar. */
    .report-field {
        min-width: 0;
        width: 100%;
    }

    .report-filters {
        gap: 10px;
    }

    .report-field--action,
    .report-field--action .report-btn {
        width: 100%;
    }

    .report-actions__group {
        width: 100%;
    }

    .report-actions__group .report-btn {
        flex: 1 1 auto;
    }
}

/* ============================================================
   IMPRESIÓN PROFESIONAL (papel A4)
   ============================================================ */
@page {
    size: A4 portrait;
    margin: 14mm 14mm 16mm 14mm;
}

@media print {
    html,
    body {
        background: #ffffff !important;
        color: #000000 !important;
        margin: 0 !important;
        padding: 0 !important;
        width: auto !important;
        height: auto !important;
        overflow: visible !important;
    }

    /* Elementos exclusivos de la interfaz web */
    .sidebar,
    .sidebar-overlay,
    .header,
    .hamburger-btn,
    .report-panel,
    .report-actions,
    .report-preview-exit,
    .report-toast,
    .no-print {
        display: none !important;
    }

    /* Neutralizar el chasis de la aplicación */
    .app-container,
    .main-content,
    .content-body {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        min-height: 0 !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }

    /* La hoja ocupa exactamente el área imprimible */
    .report-document {
        background: #ffffff !important;
        color: #000000 !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        font-size: 10.5pt !important;
        line-height: 1.4 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* En impresión la tabla fluye en la hoja: sin scroll ni recorte. */
    .report-table-scroll {
        overflow: visible !important;
    }

    .report-header {
        border-bottom-color: #000000 !important;
    }

    .report-header__title,
    .report-header__meta-value {
        color: #000000 !important;
    }

    .report-summary {
        gap: 6px !important;
    }

    .report-summary__item {
        background: #ffffff !important;
        border-color: #9aa0a6 !important;
    }

    .report-summary__value {
        color: #000000 !important;
    }

    /* Tablas: repetir encabezado y evitar cortar filas */
    .report-table {
        font-size: 9.5pt !important;
    }

    .report-table thead {
        display: table-header-group;
    }

    .report-table tfoot {
        display: table-footer-group;
    }

    .report-table tr,
    .report-block,
    .report-summary__item,
    .report-header {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .report-table th {
        background: #e8e8e8 !important;
    }

    .report-badge {
        border-color: #999999 !important;
    }

    .report-footer {
        margin-top: 14px;
    }

    a {
        color: #000000 !important;
        text-decoration: none !important;
    }
}

/* ============================================================
   MÓDULO: DASHBOARD
   Panel de control con encabezado en tarjeta, indicadores,
   flujo financiero, resumen general, alertas, agenda y
   accesos rápidos. Usa una paleta teal/carmesí sobre las
   superficies del tema (claro y oscuro).
   ============================================================ */

.dash {
    --dash-teal: #0d7a68;
    --dash-teal-dark: #0a6555;
    --dash-teal-soft: rgba(13, 122, 104, 0.10);
    --dash-teal-line: rgba(13, 122, 104, 0.22);
    --dash-pink: #d81b4b;
    --dash-amber: #f2a516;
    --dash-blue: #2563eb;
    --dash-line: var(--card-border);
    --dash-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}

/* ---------- Encabezado ---------- */
.dash-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px 24px;
    padding: 22px 28px;
    margin-bottom: 16px;
    background: var(--card-bg);
    border: 1px solid var(--dash-line);
    border-radius: 16px;
    box-shadow: var(--dash-shadow);
}

.dash-header__title {
    font-size: 1.9rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--text-primary);
}

.dash-header__subtitle {
    margin-top: 4px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.dash-header__tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.dash-chip {
    display: inline-flex;
    align-items: center;
    padding: 9px 20px;
    border: 1px solid var(--dash-line);
    border-radius: 999px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}

.dash-refresh {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 34px;
    border: 1px solid var(--dash-teal);
    border-radius: 999px;
    background: var(--dash-teal);
    color: #ffffff;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.dash-refresh:hover {
    background: var(--dash-teal-dark);
    border-color: var(--dash-teal-dark);
}

/* ---------- Tarjetas de estadísticas principales ---------- */
.dash-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.dash-kpi {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px 20px;
    background: var(--card-bg);
    border: 1px solid var(--dash-line);
    border-radius: 14px;
    box-shadow: var(--dash-shadow);
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.dash-kpi:hover {
    border-color: var(--dash-teal-line);
    transform: translateY(-1px);
}

.dash-kpi__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin-top: 2px;
    border-radius: 50%;
    background: var(--dash-teal-soft);
    border: 1px solid var(--dash-teal-line);
    flex-shrink: 0;
}

.dash-kpi__icon::after {
    content: "";
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--dash-teal);
}

.dash-kpi__body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.dash-kpi__label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.dash-kpi__value {
    margin-top: 4px;
    font-size: 1.65rem;
    font-weight: 700;
    line-height: 1.15;
    color: var(--text-primary);
}

.dash-kpi__value--money {
    font-size: 1.45rem;
}

.dash-kpi__sub {
    margin-top: 5px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ---------- Rejillas y paneles ---------- */
.dash-grid {
    display: grid;
    gap: 16px;
    margin-bottom: 16px;
}

.dash-grid--fin,
.dash-grid--split {
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
    align-items: stretch;
}

.dash-grid--bottom {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
}

.dash-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 22px 24px;
    background: var(--card-bg);
    border: 1px solid var(--dash-line);
    border-radius: 16px;
    box-shadow: var(--dash-shadow);
}

.dash-panel__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.dash-panel__title {
    font-size: 1.12rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
}

.dash-panel__desc {
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.dash-subtitle {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ---------- Gráfico de flujo financiero ---------- */
.dash-legend {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.dash-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.dash-legend__dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.dash-legend__dot--in { background: var(--dash-teal); }
.dash-legend__dot--out { background: var(--dash-pink); }

.dash-chart {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    flex: 1;
    align-content: end;
}

.dash-chart__col {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 0 8px;
}

.dash-chart__bars {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 7px;
    height: clamp(190px, 24vh, 250px);
    border-bottom: 1px solid var(--dash-line);
}

.dash-bar {
    position: relative;
    display: block;
    width: 18px;
    max-width: 20px;
    min-width: 10px;
    border-radius: 3px 3px 0 0;
    transition: height 0.35s ease, filter 0.18s ease;
}

.dash-bar--in { background: var(--dash-teal); }
.dash-bar--out { background: var(--dash-pink); }

.dash-bar:hover {
    filter: brightness(1.12);
}

.dash-bar::after {
    content: attr(data-tip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%) translateY(4px);
    background: #26262b;
    color: #f5f5f5;
    border: 1px solid var(--card-border);
    padding: 6px 9px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 40;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
}

.dash-bar:hover::after,
.dash-bar:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.dash-chart__label {
    padding-top: 10px;
    text-align: center;
    font-size: 0.74rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ---------- Resumen general ---------- */
.dash-mini {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.dash-mini__item {
    display: flex;
    align-items: baseline;
    gap: 18px;
    padding: 13px 16px;
    border: 1px solid var(--dash-line);
    border-radius: 10px;
}

.dash-mini__value {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-primary);
}

.dash-mini__label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ---------- Asistencia general ---------- */
.dash-attendance {
    margin-top: 22px;
}

.dash-att {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
}

.dash-att__row {
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 10px;
}

.dash-att__name {
    font-size: 0.76rem;
    color: var(--text-secondary);
}

.dash-att__track {
    height: 8px;
    border-radius: 999px;
    background: rgba(128, 128, 128, 0.16);
    overflow: hidden;
}

.dash-att__fill {
    height: 100%;
    border-radius: 999px;
}

.dash-att__fill--ok { background: var(--dash-teal); }
.dash-att__fill--no { background: var(--dash-pink); }
.dash-att__fill--late { background: var(--dash-amber); }

.dash-att__pct {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: right;
}

/* ---------- Indicadores clave ---------- */
.dash-ind-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.dash-ind {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    border: 1px solid var(--dash-line);
    border-radius: 10px;
}

.dash-ind__dot {
    width: 10px;
    height: 10px;
    margin-bottom: 2px;
    border-radius: 50%;
    background: var(--ind, var(--dash-teal));
}

.dash-ind__value {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.15;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

.dash-ind__label {
    font-size: 0.75rem;
    line-height: 1.35;
    color: var(--text-secondary);
}

.dash-ind--ok { --ind: var(--dash-teal); }
.dash-ind--no { --ind: var(--dash-pink); }
.dash-ind--late { --ind: var(--dash-amber); }
.dash-ind--info { --ind: var(--dash-blue); }

/* ---------- Alertas accionables ---------- */
.dash-alert-list {
    max-height: 340px;
    overflow-y: auto;
    padding-right: 6px;
    scrollbar-width: thin;
    scrollbar-color: var(--dash-teal-line) transparent;
}

.dash-alert-list::-webkit-scrollbar {
    width: 6px;
}

.dash-alert-list::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: var(--dash-teal-line);
}

.dash-alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid var(--dash-line);
}

.dash-alert:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.dash-alert__main {
    min-width: 0;
}

.dash-alert__title {
    display: block;
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-primary);
}

.dash-alert__meta {
    display: block;
    margin-top: 2px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}

.dash-pill {
    flex-shrink: 0;
    padding: 5px 14px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.dash-pill--warning {
    background: rgba(242, 165, 22, 0.14);
    border-color: rgba(242, 165, 22, 0.35);
    color: #a56b00;
}

.dash-pill--success {
    background: rgba(13, 122, 104, 0.12);
    border-color: var(--dash-teal-line);
    color: var(--dash-teal);
}

.dash-pill--danger {
    background: rgba(216, 27, 75, 0.10);
    border-color: rgba(216, 27, 75, 0.28);
    color: var(--dash-pink);
}

/* ---------- Filas de agenda ---------- */
.dash-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 16px;
    margin-bottom: 10px;
    border: 1px solid var(--dash-line);
    border-radius: 9px;
}

.dash-row:last-child {
    margin-bottom: 0;
}

.dash-row__title {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

.dash-row__date {
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ---------- Estados vacíos ---------- */
.dash-empty {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px 12px;
    text-align: center;
    color: var(--text-secondary);
}

.dash-empty svg {
    width: 32px;
    height: 32px;
    opacity: 0.55;
}

.dash-empty p {
    font-size: 0.82rem;
}

/* ---------- Accesos rápidos ---------- */
.dash-quick {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    align-content: start;
}

.dash-quick__item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 12px;
    border: 1px solid var(--dash-teal-line);
    border-radius: 8px;
    background: var(--dash-teal-soft);
    color: var(--dash-teal-dark);
    font-size: 0.78rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.dash-quick__item:hover {
    background: rgba(13, 122, 104, 0.18);
    border-color: var(--dash-teal);
}

/* ---------- Adaptabilidad ---------- */
@media (max-width: 1200px) {
    .dash-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dash-grid--fin,
    .dash-grid--split {
        grid-template-columns: minmax(0, 1fr);
    }

    .dash-grid--bottom {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .dash-grid--bottom {
        grid-template-columns: minmax(0, 1fr);
    }

    .dash-ind-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .dash-header {
        padding: 18px;
    }

    .dash-header__tools {
        width: 100%;
    }

    .dash-chip,
    .dash-refresh {
        flex: 1 1 auto;
        justify-content: center;
    }

    .dash-kpis,
    .dash-mini {
        grid-template-columns: minmax(0, 1fr);
    }

    .dash-panel {
        padding: 18px;
    }

    .dash-att__row {
        grid-template-columns: 70px minmax(0, 1fr) 38px;
    }

    .dash-quick {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dash-chart__bars {
        height: clamp(160px, 32vh, 220px);
        gap: 5px;
    }
}

/* ---------- Ajustes de tema oscuro ---------- */
[data-theme="dark"] .dash-quick__item {
    color: #86d8c8;
    border-color: rgba(80, 205, 180, 0.25);
    background: rgba(13, 160, 138, 0.10);
}

[data-theme="dark"] .dash-quick__item:hover {
    background: rgba(13, 160, 138, 0.18);
}

[data-theme="dark"] .dash-pill--warning {
    color: #f3c264;
}

[data-theme="dark"] .dash-pill--success {
    color: #86d8c8;
}

[data-theme="dark"] .dash-pill--danger {
    color: #ff90aa;
}

[data-theme="dark"] .dash-bar::after {
    background: #26262b;
    border-color: #3a3a3a;
}

[data-theme="light"] .dash-bar::after {
    background: #2b2b2c;
    border-color: #3a3a3a;
}

[data-theme="light"] .dash-att__track {
    background: rgba(20, 24, 30, 0.08);
}

/* ============================================================
   MÓDULO: ASIGNAR ROL
   Tarjetas de selección de roles. Reutiliza los componentes
   existentes (.glass-panel, .data-table, .btn, .badge, .btn-icon)
   y respeta las variables de color (tema claro y oscuro).
   ============================================================ */

.roles-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.role-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.role-option:hover {
    border-color: var(--primary);
    background: rgba(224, 160, 48, 0.06);
}

.role-option:has(input:checked) {
    border-color: var(--primary);
    background: rgba(224, 160, 48, 0.10);
}

.role-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
    flex-shrink: 0;
    cursor: pointer;
}

.role-option__name {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.role-option__desc {
    display: block;
    margin-top: 2px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.role-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
}

@media (max-width: 640px) {
    .roles-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

[data-theme="light"] .role-option:hover,
[data-theme="light"] .role-option:has(input:checked) {
    background: rgba(189, 132, 16, 0.10);
}