@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

@font-face {
    font-display: swap;
    font-family: 'Poltawski Nowy';
    font-style: normal;
    font-weight: 400;
    src: url('../fonts/PoltawskiNowy-Regular.woff2') format('woff2');
}

@font-face {
    font-display: swap;
    font-family: 'Poltawski Nowy';
    font-style: normal;
    font-weight: 700;
    src: url('../fonts/PoltawskiNowy-Bold.woff2') format('woff2');
}

:root {
    color-scheme: light;
    --font-brand: 'Poltawski Nowy', Georgia, serif;
    --font-ui: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    --bg: #f7f5f0;
    --panel: #ffffff;
    --line: rgba(70, 90, 131, .14);
    --line-strong: rgba(214, 165, 74, .35);
    --text: #26315f;
    --heading: #26315f;
    --muted: #6f7550;
    --brand: #26315f;
    --brand-dark: #141b34;
    --brand-blue: #031a8b;
    --accent: #d6a54a;
    --accent-2: #d67c32;
    --danger: #dc2626;
    --success: #15803d;
    --soft: #faf7f2;
    --shadow: 0 4px 16px rgba(38, 49, 95, .06);
    --shadow-elevated: 0 10px 25px rgba(38, 49, 95, .10);
}

:root.dark-mode,
html.dark-mode {
    color-scheme: dark;
    --bg: #090e1a;
    --panel: #121a2d;
    --line: rgba(214, 165, 74, .16);
    --line-strong: rgba(214, 165, 74, .28);
    --text: #f7f3eb;
    --heading: #f7f3eb;
    --muted: #cbd5e1;
    --soft: #17233c;
    --brand: #f7f3eb;
    --brand-dark: #f7f3eb;
    --brand-blue: #f7f3eb;
    --shadow: 0 4px 16px rgba(0, 0, 0, .35);
    --shadow-elevated: 0 10px 25px rgba(0, 0, 0, .50);
}

* {
    box-sizing: border-box;
}

html {
    background-color: var(--bg);
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

h1,
h2,
h3 {
    color: var(--heading);
    font-family: var(--font-brand);
    line-height: 1.12;
    margin-top: 0;
}

h1 {
    font-size: 34px;
    margin-bottom: 8px;
}

h2 {
    font-size: 22px;
    margin-bottom: 6px;
}

p {
    color: var(--muted);
    line-height: 1.55;
    margin-top: 0;
}

.sidebar {
    background: var(--brand-dark);
    border-right: 1px solid rgba(214, 165, 74, .18);
    bottom: 0;
    box-shadow: 4px 0 20px rgba(7, 12, 24, .30);
    color: #fff;
    display: flex;
    flex-direction: column;
    left: 0;
    position: fixed;
    top: 0;
    width: 275px;
    z-index: 20;
}

.brand {
    align-items: center;
    background: rgba(7, 12, 24, .25);
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    display: flex;
    gap: 13px;
    min-height: 88px;
    padding: 18px 20px;
}

.brand-logo {
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, .25));
    height: 48px;
    object-fit: contain;
    width: 48px;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    color: #fff;
    font-family: var(--font-brand);
    font-size: 18px;
    font-weight: 700;
}

.brand small {
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-top: 2px;
    text-transform: uppercase;
}

.nav {
    display: grid;
    flex: 1;
    gap: 6px;
    padding: 20px 14px;
}

.nav a {
    align-items: center;
    border-left: 3px solid transparent;
    border-radius: 12px;
    color: #cbd5e1;
    display: flex;
    font-size: 15px;
    font-weight: 600;
    gap: 12px;
    padding: 12px 14px;
    text-decoration: none;
    transition: background .2s ease, color .2s ease, border-color .2s ease, transform .2s ease;
}

.nav-group {
    display: grid;
    gap: 6px;
}

.nav-group-toggle {
    align-items: center;
    background: transparent;
    border: 0;
    border-left: 3px solid transparent;
    border-radius: 12px;
    box-shadow: none;
    color: #cbd5e1;
    display: flex;
    font-size: 15px;
    font-weight: 600;
    justify-content: space-between;
    padding: 12px 14px;
    text-align: left;
    width: 100%;
}

.nav-group-toggle span {
    align-items: center;
    display: inline-flex;
    gap: 12px;
}

.nav-group-toggle:hover,
.nav-group-toggle.active {
    background: rgba(214, 165, 74, .12);
    border-left-color: rgba(214, 165, 74, .60);
    box-shadow: none;
    color: #fff;
    transform: none;
}

.nav-group-toggle.active {
    border-left-color: var(--accent);
}

.nav-group-caret {
    font-size: 12px;
    min-width: auto;
    transition: transform .2s ease;
    width: auto;
}

.nav-group.is-open .nav-group-caret {
    transform: rotate(180deg);
}

.nav-submenu {
    display: none;
    gap: 4px;
    padding: 0 0 2px 16px;
}

.nav-group.is-open .nav-submenu {
    display: grid;
}

.nav-submenu a {
    border-radius: 10px;
    font-size: 13px;
    padding: 9px 12px;
}

.nav-submenu i {
    font-size: 15px;
    height: 20px;
    min-width: 20px;
    width: 20px;
}

.nav a:hover {
    background: rgba(214, 165, 74, .12);
    border-left-color: rgba(214, 165, 74, .60);
    color: #fff;
}

.nav a.active {
    background: linear-gradient(135deg, rgba(38, 49, 95, .95), rgba(3, 26, 139, .95));
    border-left-color: var(--accent);
    box-shadow: 0 4px 14px rgba(3, 26, 139, .35);
    color: #fff;
}

.nav i {
    align-items: center;
    color: #83927e;
    display: inline-flex;
    font-size: 18px;
    height: 24px;
    justify-content: center;
    min-width: 24px;
    width: 24px;
}

.nav a:hover i,
.nav a.active i,
.nav-group-toggle:hover i,
.nav-group-toggle.active i {
    color: #fff;
}

.button i,
button i {
    margin-right: 7px;
}

.sidebar-footer {
    background: rgba(7, 12, 24, .20);
    border-top: 1px solid rgba(255, 255, 255, .08);
    padding: 18px 20px;
}

.public-link {
    color: var(--accent);
    display: inline-flex;
    font-weight: 700;
    text-decoration: none;
}

.app-shell {
    margin-left: 275px;
    min-height: 100vh;
}

.app-shell-full {
    display: grid;
    margin-left: 0;
    place-items: center;
}

.topbar {
    align-items: center;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 2px 8px rgba(38, 49, 95, .04);
    display: flex;
    gap: 16px;
    height: 72px;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar h2 {
    font-size: 22px;
    margin: 0;
}

.topbar-actions {
    align-items: center;
    display: flex;
    gap: 12px;
}

.user-chip {
    align-items: center;
    color: #5f6677;
    display: inline-flex;
    font-size: 14px;
    font-weight: 700;
}

/* Chip indicador de Base de Datos y Entorno (Morado en Light Mode / Naranja en Dark Mode) */
.db-status-chip {
    align-items: center;
    border-radius: 9999px;
    cursor: default;
    display: inline-flex;
    flex-shrink: 0;
    gap: 7px;
    height: 30px;
    line-height: 1;
    padding: 0 12px 0 9px;
    user-select: none;
    transition: background-color .25s ease, border-color .25s ease, color .25s ease, box-shadow .25s ease;
    /* LIGHT MODE: MORADO */
    background: #f5edfc;
    border: 1px solid #d8b4fe;
    box-shadow: 0 1px 3px rgba(107, 33, 168, .08);
    color: #581c87;
}

.db-status-chip .db-chip-dot {
    background-color: #9333ea;
    border-radius: 50%;
    display: inline-block;
    height: 7px;
    width: 7px;
    box-shadow: 0 0 0 2.5px rgba(168, 85, 247, .25);
    animation: dbChipPulsePurple 2.2s infinite ease-in-out;
}

.db-status-chip .db-chip-icon {
    color: #7e22ce;
    font-size: 11px;
}

.db-status-chip .db-chip-env {
    background: #7e22ce;
    border-radius: 9999px;
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .6px;
    padding: 2.5px 7px;
    text-transform: uppercase;
}

.db-status-chip .db-chip-sep {
    color: #c084fc;
    font-weight: 400;
    margin: 0 1px;
}

.db-status-chip .db-chip-name {
    color: #6b21a8;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: -.2px;
}

@keyframes dbChipPulsePurple {
    0%, 100% {
        box-shadow: 0 0 0 2px rgba(168, 85, 247, .25);
    }
    50% {
        box-shadow: 0 0 0 5px rgba(168, 85, 247, .45);
    }
}

/* DARK MODE: NARANJA */
body.dark-mode .db-status-chip,
html.dark-mode .db-status-chip {
    background: rgba(249, 115, 22, .14);
    border: 1px solid rgba(249, 115, 22, .48);
    box-shadow: 0 1px 4px rgba(249, 115, 22, .15);
    color: #fdba74;
}

body.dark-mode .db-status-chip .db-chip-dot,
html.dark-mode .db-status-chip .db-chip-dot {
    background-color: #f97316;
    box-shadow: 0 0 0 2.5px rgba(249, 115, 22, .3);
    animation: dbChipPulseOrange 2.2s infinite ease-in-out;
}

body.dark-mode .db-status-chip .db-chip-icon,
html.dark-mode .db-status-chip .db-chip-icon {
    color: #fb923c;
}

body.dark-mode .db-status-chip .db-chip-env,
html.dark-mode .db-status-chip .db-chip-env {
    background: #ea580c;
    color: #ffffff;
}

body.dark-mode .db-status-chip .db-chip-sep,
html.dark-mode .db-status-chip .db-chip-sep {
    color: #ea580c;
    opacity: .7;
}

body.dark-mode .db-status-chip .db-chip-name,
html.dark-mode .db-status-chip .db-chip-name {
    color: #fed7aa;
}

@keyframes dbChipPulseOrange {
    0%, 100% {
        box-shadow: 0 0 0 2px rgba(249, 115, 22, .25);
    }
    50% {
        box-shadow: 0 0 0 5px rgba(249, 115, 22, .45);
    }
}

.content-shell {
    padding: 28px;
}

.page-heading {
    margin-bottom: 24px;
}

.row-heading {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
}

.eyebrow {
    color: var(--accent-2);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1.8px;
    margin: 0 0 8px;
    text-transform: uppercase;
}

.stats-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    margin-bottom: 24px;
}

.stat-card,
.panel,
.card,
.welcome {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.stat-card {
    min-height: 94px;
    padding: 20px;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.stat-card:hover {
    border-color: rgba(214, 165, 74, .40);
    box-shadow: var(--shadow-elevated);
    transform: translateY(-2px);
}

.stat-card small {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .4px;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.stat-card strong {
    color: var(--heading);
    display: block;
    font-family: var(--font-brand);
    font-size: 34px;
    line-height: 1;
}

.panel,
.welcome {
    padding: 24px;
}

.panel-header {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    margin: -24px -24px 22px;
    padding: 20px 24px;
}

.quick-actions,
.form-actions,
.actions {
    align-items: center;
    display: flex;
    gap: 10px;
}

.quick-actions {
    flex-wrap: wrap;
}

.button,
button {
    background: linear-gradient(135deg, var(--brand), var(--brand-blue));
    border: 1px solid rgba(214, 165, 74, .35);
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(3, 26, 139, .20);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    justify-content: center;
    padding: 10px 15px;
    text-decoration: none;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease;
}

.button:hover,
button:hover {
    border-color: var(--accent);
    box-shadow: 0 5px 15px rgba(3, 26, 139, .30);
    transform: translateY(-1px);
}

.button-light {
    background: #faf6ee;
    border-color: var(--line);
    box-shadow: none;
    color: var(--brand);
}

.menu-toggle {
    display: none;
}

.actions {
    justify-content: flex-end;
}

.actions a,
.actions button {
    background: var(--panel);
    border: 1px solid rgba(38, 49, 95, .18);
    border-radius: 8px;
    box-shadow: none;
    color: var(--brand-blue);
    font-size: 13px;
    padding: 7px 10px;
    text-decoration: none;
}

.actions form {
    margin: 0;
}

.actions button {
    border-color: rgba(220, 38, 38, .25);
    color: var(--danger);
}

.table-wrap {
    overflow-x: auto;
    padding: 0;
}

table {
    border-collapse: collapse;
    min-width: 820px;
    width: 100%;
}

th,
td {
    border-bottom: 1px solid #f1f5f9;
    padding: 15px 18px;
    text-align: left;
    vertical-align: middle;
}

th {
    background: var(--soft);
    border-bottom: 2px solid var(--line-strong);
    color: var(--brand);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .6px;
    text-transform: uppercase;
    white-space: nowrap;
}

td {
    color: #07112c;
    font-size: 14px;
}

tbody tr:hover {
    background: #fdfbf7;
}

.right {
    text-align: right;
}

.badge {
    background: #eef2f7;
    border-radius: 999px;
    color: #42506a;
    display: inline-flex;
    font-size: 12px;
    font-weight: 700;
    padding: 5px 10px;
}

.swatch {
    border: 1px solid rgba(0, 0, 0, .12);
    border-radius: 5px;
    display: inline-block;
    height: 18px;
    margin-right: 8px;
    vertical-align: middle;
    width: 28px;
}

.thumb {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    height: 46px;
    margin-right: 8px;
    object-fit: contain;
    padding: 4px;
    vertical-align: middle;
    width: 46px;
}

.image-preview,
.assignment-panel,
.assignment-card {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.image-preview {
    align-items: center;
    display: flex;
    gap: 12px;
    padding: 12px;
}

.image-preview img {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    height: 86px;
    object-fit: contain;
    padding: 6px;
    width: 86px;
}

.image-preview span,
td small {
    color: var(--muted);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.form-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
    color: #44517b;
    display: grid;
    font-size: 12px;
    font-weight: 800;
    gap: 8px;
    letter-spacing: .4px;
    text-transform: uppercase;
}

input,
select,
textarea {
    background: #faf6ee;
    border: 1.5px solid rgba(70, 90, 131, .18);
    border-radius: 12px;
    color: var(--text);
    font: inherit;
    font-weight: 500;
    outline: none;
    padding: 11px 12px;
    text-transform: none;
    width: 100%;
}

input:focus,
select:focus,
textarea:focus {
    background: #fff;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(214, 165, 74, .22);
}

textarea {
    resize: vertical;
}

.span-2 {
    grid-column: span 2;
}

.check-row {
    align-items: center;
    display: flex;
}

.check-row input {
    width: auto;
}

.alert {
    border-radius: 12px;
    font-weight: 700;
    margin-bottom: 18px;
    padding: 12px 14px;
}

.alert-success {
    background: #e7f7ee;
    color: #176a3a;
}

.alert-danger {
    background: #fde8ec;
    color: var(--danger);
}

.detail-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(280px, .8fr) minmax(360px, 1fr);
    margin-bottom: 22px;
}

.meta-list {
    display: grid;
    gap: 12px;
    margin: 14px 0 0;
}

.meta-list dt {
    color: var(--accent-2);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.meta-list dd {
    color: var(--text);
    line-height: 1.45;
    margin: 0;
}

.compact-form,
.table-edit-form {
    display: grid;
    gap: 10px;
}

.inline-fields {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.table-edit-form {
    min-width: 320px;
}

.delete-row-form {
    margin-top: 10px;
}

.delete-row-form button {
    background: #fff;
    border-color: #f0c7cf;
    color: var(--danger);
    width: 100%;
}

.assignment-panel {
    padding: 16px;
}

.assignment-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.assignment-card {
    background: #fff;
    display: grid;
    gap: 12px;
    padding: 14px;
}

.toggle-row {
    align-items: center;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--brand);
    display: flex;
    gap: 10px;
    font-weight: 800;
    padding: 11px 12px;
}

.toggle-row input {
    accent-color: var(--brand-blue);
    height: 18px;
    width: 18px;
}

.filters-panel {
    margin-bottom: 18px;
}

.filters-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(220px, 1.2fr) repeat(4, minmax(150px, 1fr)) auto;
}

.filter-actions {
    align-items: end;
    display: flex;
    gap: 10px;
}

.prereg-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.badge-presencial {
    background: #eef2ff;
    color: var(--brand-blue);
}

.badge-virtual {
    background: #f4f6ee;
    color: var(--muted);
}

.badge-status-confirmado {
    background: #dcfce7;
    color: #166534;
}

.badge-status-pendiente {
    background: #ffedd5;
    color: #9a3412;
}

.badge-status-cancelado {
    background: #fee2e2;
    color: #991b1b;
}

.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.committee-chip {
    --chip-color: var(--brand);
    align-items: center;
    background: color-mix(in srgb, var(--chip-color) 10%, #fff);
    border: 1px solid color-mix(in srgb, var(--chip-color) 28%, #fff);
    border-radius: 999px;
    color: var(--brand-blue);
    display: inline-flex;
    gap: 8px;
    max-width: 100%;
    padding: 8px 12px 8px 8px;
}

.committee-chip strong {
    align-items: center;
    background: var(--chip-color);
    border-radius: 999px;
    color: #fff;
    display: inline-flex;
    font-size: 12px;
    height: 24px;
    justify-content: center;
    min-width: 28px;
    padding: 0 7px;
}

.committee-chip span {
    font-size: 14px;
    line-height: 1.25;
}

.pagination-bar {
    align-items: center;
    background: #fff;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
}

.pagination-bar p {
    color: var(--muted);
    margin: 0;
}

.pagination {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pagination a {
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--brand-blue);
    display: inline-flex;
    font-weight: 800;
    height: 34px;
    justify-content: center;
    min-width: 34px;
    padding: 0 10px;
    text-decoration: none;
}

.pagination a.is-active {
    background: var(--brand-blue);
    border-color: var(--brand-blue);
    color: #fff;
}

.sidebar-backdrop {
    display: none;
}

html.dark-mode,
body.dark-mode {
    --bg: #090e1a;
    --panel: #121a2d;
    --line: rgba(214, 165, 74, .16);
    --line-strong: rgba(214, 165, 74, .28);
    --text: #f7f3eb;
    --heading: #f7f3eb;
    --muted: #cbd5e1;
    --soft: #17233c;
    background: var(--bg);
    color: var(--text);
}

.dark-mode .topbar,
.dark-mode .panel,
.dark-mode .card,
.dark-mode .stat-card,
.dark-mode .welcome,
.dark-mode .toggle-row,
.dark-mode .assignment-card {
    background: var(--panel);
}

.dark-mode label {
    color: #f7f3eb;
}

.dark-mode h1,
.dark-mode h2,
.dark-mode h3,
.dark-mode h4 {
    color: #f7f3eb;
}

.dark-mode strong {
    color: #f7f3eb;
}

.dark-mode td,
.dark-mode .meta-list dd {
    color: #f1f5f9;
}

.dark-mode th {
    color: #f7f3eb;
}

.dark-mode tbody tr:hover {
    background: rgba(214, 165, 74, .06);
}

.dark-mode input,
.dark-mode select,
.dark-mode textarea {
    background: #0b1120;
    border-color: rgba(255, 255, 255, .15);
    color: #f7f3eb;
}

.dark-mode .button-light,
.dark-mode .actions a,
.dark-mode .actions button {
    background: #17233c;
    border-color: rgba(255, 255, 255, .12);
    color: #f7f3eb;
}

.dark-mode .badge {
    background: #17233c;
    color: #e2d9cc;
}

.dark-mode .committee-chip {
    background: color-mix(in srgb, var(--chip-color) 18%, #121a2d);
    border-color: color-mix(in srgb, var(--chip-color) 38%, #121a2d);
    color: #f7f3eb;
}

.dark-mode .pagination-bar {
    background: var(--panel);
}

.dark-mode .pagination a {
    background: #17233c;
    border-color: var(--line);
    color: #f7f3eb;
}

@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .25s ease;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar-backdrop.show {
        background: rgba(7, 12, 24, .65);
        display: block;
        inset: 0;
        position: fixed;
        z-index: 15;
    }

    .app-shell {
        margin-left: 0;
    }

    .topbar {
        align-items: flex-start;
        height: auto;
        padding: 16px 20px;
    }

    .menu-toggle {
        display: inline-flex;
    }

    .topbar-actions,
    .row-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .content-shell {
        padding: 20px;
    }

    .stats-grid,
    .detail-grid,
    .assignment-grid,
    .form-grid,
    .filters-grid,
    .prereg-stats {
        grid-template-columns: 1fr;
    }

    .filter-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .pagination-bar {
        align-items: flex-start;
        flex-direction: column;
    }

    .span-2 {
        grid-column: span 1;
    }
}

/* Portal de asistencia */
.attendance-body {
    background: linear-gradient(145deg, #0b1228 0, #18264d 38%, #f7f5f0 38%);
    min-height: 100vh;
}

.attendance-header {
    margin: 0 auto;
    max-width: 1120px;
    padding: 22px 24px;
}

.attendance-brand {
    align-items: center;
    color: #fff;
    display: inline-flex;
    gap: 12px;
    text-decoration: none;
}

.attendance-brand img { height: 52px; object-fit: contain; width: 52px; }
.attendance-brand strong, .attendance-brand small { display: block; }
.attendance-brand strong { font-family: var(--font-brand); font-size: 19px; }
.attendance-brand small { color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; }

.attendance-shell {
    margin: 0 auto;
    max-width: 1120px;
    min-height: calc(100vh - 150px);
    padding: 28px 24px 60px;
}

.attendance-card, .attendance-section, .attendance-welcome, .attendance-open {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: 0 18px 50px rgba(7, 17, 44, .14);
    padding: 28px;
}

.attendance-login { margin: 5vh auto 0; max-width: 520px; }
.attendance-login h1 { font-size: clamp(32px, 6vw, 48px); }
.attendance-form { display: grid; gap: 16px; margin-top: 22px; }
.attendance-form button { min-height: 52px; width: 100%; }
.folio-input { font-size: 28px; font-weight: 800; letter-spacing: 10px; text-align: center; }
.attendance-secondary { margin-top: 12px; width: 100%; }

.attendance-summary { display: grid; gap: 10px; margin: 22px 0; }
.attendance-summary div { background: var(--soft); border-radius: 12px; padding: 12px 14px; }
.attendance-summary dt { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.attendance-summary dd { font-size: 18px; font-weight: 700; margin: 4px 0 0; }

.attendance-welcome { align-items: center; display: flex; justify-content: space-between; margin-bottom: 18px; }
.attendance-welcome h1 { font-size: clamp(32px, 5vw, 52px); }
.attendance-open { background: linear-gradient(135deg, #26315f, #031a8b); color: #fff; display: grid; gap: 4px; margin-bottom: 18px; }
.attendance-open span { color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; }
.attendance-open strong { font-family: var(--font-brand); font-size: 25px; }
.attendance-open small, .attendance-open p { color: #dbe4ff; }
.attendance-open p { margin: 8px 0 0; }

.attendance-section { margin-top: 18px; }
.attendance-section-heading { align-items: end; display: flex; gap: 20px; justify-content: space-between; margin-bottom: 20px; }
.attendance-section-heading h2 { font-size: 29px; margin: 0; }
.attendance-section-heading p { margin-bottom: 0; }
.room-grid { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.room-card { background: var(--soft); border: 1px solid var(--line); border-radius: 16px; display: grid; gap: 5px; min-height: 145px; padding: 20px; text-decoration: none; transition: .2s ease; }
.room-card:hover { border-color: var(--accent); box-shadow: var(--shadow-elevated); transform: translateY(-3px); }
.room-card span { color: var(--accent-2); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.room-card strong { color: var(--brand); font-family: var(--font-brand); font-size: 27px; }
.room-card small { color: var(--muted); }

.program-list, .history-list { display: grid; gap: 12px; }
.program-card, .history-list article { align-items: center; background: var(--soft); border: 1px solid var(--line); border-radius: 14px; display: flex; gap: 16px; justify-content: space-between; padding: 16px; }
.program-card > div, .history-list article > div:first-child { display: grid; gap: 4px; }
.program-card strong, .history-list strong { color: var(--brand); }
.program-card small, .history-list small { color: var(--muted); }
.history-times { align-items: flex-end; display: grid; gap: 2px; text-align: right; }
.history-times span { color: var(--muted); font-size: 13px; }
.history-times b { color: var(--brand-blue); font-size: 12px; text-transform: uppercase; }
.attendance-empty { background: var(--soft); border-radius: 14px; color: var(--muted); padding: 24px; text-align: center; }
.attendance-footer { color: var(--muted); font-size: 12px; padding: 0 24px 28px; text-align: center; }
.back-link { color: var(--brand-blue); display: inline-block; font-weight: 700; margin-bottom: 28px; text-decoration: none; }
.attendance-alternatives { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 18px; }
.attendance-alternatives summary { color: var(--brand-blue); cursor: pointer; font-weight: 700; }
.attendance-alternatives div { display: flex; gap: 12px; justify-content: space-between; padding: 12px 0; }

.attendance-admin-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.attendance-filters { grid-template-columns: 2fr 1fr 1fr auto; margin-bottom: 18px; }
.qr-panel { align-items: center; display: grid; gap: 38px; grid-template-columns: minmax(300px, 390px) 1fr; }
#program-qr { background: #fff; border: 12px solid #fff; display: inline-grid; place-items: center; width: fit-content; }
#program-qr img, #program-qr canvas { height: auto !important; max-width: 100%; }
.qr-panel code { background: var(--soft); border-radius: 8px; display: block; margin: 16px 0; overflow-wrap: anywhere; padding: 12px; }
.nfc-total { color: var(--brand-blue); font-family: var(--font-brand); font-size: 64px; font-weight: 700; line-height: 1; }
.setup-list { color: var(--text); display: grid; gap: 10px; padding-left: 22px; }
.checker-context { display: grid; gap: 14px; grid-template-columns: .45fr 1fr .65fr; margin-bottom: 18px; }
.checker-context > div { background: linear-gradient(135deg, #26315f, #031a8b); border-radius: 16px; color: #fff; display: grid; gap: 4px; padding: 20px; }
.checker-context span { color: var(--accent); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.checker-context strong { font-family: var(--font-brand); font-size: 24px; }
.checker-context small { color: #dbe4ff; }
.checker-nfc { border: 2px dashed var(--accent); min-height: 240px; }
.checker-program-picker { align-items: end; display: grid; gap: 16px; grid-template-columns: minmax(240px, 1fr) minmax(280px, .9fr) auto; margin-bottom: 18px; }
.checker-program-picker p { margin-bottom: 0; }
.location-note { color: var(--muted); display: block; font-size: 14px; line-height: 1.45; margin-bottom: 10px; }
.attendance-form .location-note { margin: 0; text-align: center; }
.location-cell { min-width: 170px; }
.location-cell a { color: var(--brand-blue); font-weight: 700; text-decoration: none; }
.location-cell small { color: var(--muted); display: block; margin-top: 4px; }
.preregistro-nfc-card { align-items: center; display: grid; gap: 24px; grid-column: 1 / -1; grid-template-columns: minmax(240px, .7fr) minmax(320px, 1.3fr); }
.nfc-link-box { background: var(--soft); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.nfc-link-box code { display: block; overflow-wrap: anywhere; }
.nfc-link-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

@media (max-width: 900px) {
    .attendance-body { background: linear-gradient(165deg, #0b1228 0, #18264d 24%, #f7f5f0 24%); }
    .attendance-shell { padding: 16px 14px 42px; }
    .attendance-card, .attendance-section, .attendance-welcome, .attendance-open { border-radius: 18px; padding: 20px; }
    .attendance-welcome, .attendance-section-heading, .program-card, .history-list article { align-items: stretch; flex-direction: column; }
    .room-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .room-card { min-height: 125px; }
    .history-times { align-items: start; text-align: left; }
    .attendance-admin-stats, .attendance-filters, .qr-panel, .checker-context, .checker-program-picker, .preregistro-nfc-card { grid-template-columns: 1fr; }
    .qr-panel { justify-items: center; text-align: center; }
}

/* Experiencia publica de asistentes */
.attendance-body {
    background: #071022;
    color: #17244d;
    font-family: "Poppins", "Segoe UI", sans-serif;
    margin: 0;
    min-height: 100vh;
}

.attendance-shell {
    align-items: center;
    display: flex;
    justify-content: center;
    max-width: none;
    min-height: 100vh;
    padding: 32px 20px;
}

.attendance-device {
    background: #fbf6ec;
    border: 1px solid rgba(214, 165, 74, .3);
    border-radius: 28px;
    box-shadow: 0 28px 90px rgba(0, 0, 0, .38);
    max-width: 470px;
    overflow: hidden;
    padding: 28px 20px 0;
    width: 100%;
}

.attendance-device-wide {
    max-width: 1160px;
    padding-left: 28px;
    padding-right: 28px;
}

.attendance-masthead {
    align-items: center;
    display: flex;
    justify-content: space-between;
    min-height: 58px;
}

.attendance-masthead a { display: inline-flex; }
.attendance-event-logo { height: 54px; object-fit: contain; width: 64px; }
.attendance-institution-logo { height: 45px; object-fit: contain; width: 138px; }

.attendance-welcome-card,
.attendance-card {
    background: #fff;
    border: 1px solid #dfe4eb;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(24, 39, 78, .05);
    padding: 22px;
    text-align: center;
}

.attendance-welcome-card h1,
.attendance-view-heading h1,
.attendance-program-topbar h1,
.attendance-card h1 {
    color: #26315f;
    font-family: var(--font-brand);
    font-size: clamp(1.65rem, 5vw, 2.2rem);
    line-height: 1.12;
    margin: 4px 0 10px;
}

.attendance-kicker {
    color: #26315f;
    font-family: var(--font-brand);
    font-size: .86rem;
    font-weight: 800;
    letter-spacing: .13em;
    margin: 0;
    text-transform: uppercase;
}

.attendance-folio {
    background: #fff8ea;
    border: 1px solid #edc98e;
    border-radius: 999px;
    display: inline-flex;
    font-size: .82rem;
    font-weight: 800;
    padding: 5px 11px;
}

.attendance-text-button {
    background: none;
    border: 0;
    box-shadow: none;
    color: #6b7692;
    font-size: .82rem;
    margin-top: 7px;
    padding: 4px;
    text-decoration: underline;
}

.attendance-text-button:hover { background: none; box-shadow: none; color: #031a8b; transform: none; }

.attendance-active-card {
    background: #203968;
    border-radius: 14px;
    color: #fff;
    display: grid;
    gap: 3px;
    margin-top: 12px;
    padding: 14px 16px;
}

.attendance-active-card span { color: #f0c46a; font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.attendance-active-card strong { font-size: .95rem; }
.attendance-active-card small { color: #dbe5f5; }

.attendance-menu { display: grid; gap: 9px; margin-top: 12px; }
.attendance-menu > a,
.attendance-room-list > a {
    align-items: center;
    background: #fff;
    border: 1px solid #dfe4eb;
    border-radius: 13px;
    color: #26315f;
    display: grid;
    gap: 10px;
    grid-template-columns: 34px 1fr auto;
    min-height: 54px;
    padding: 9px 13px;
    text-decoration: none;
    transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.attendance-menu > a:hover,
.attendance-room-list > a:hover { border-color: #d6a54a; box-shadow: 0 8px 20px rgba(32, 57, 104, .09); transform: translateY(-1px); }
.attendance-menu > a > .fa-chevron-right,
.attendance-room-list > a > .fa-chevron-right { color: #9ba8bc; font-size: .75rem; }

.attendance-menu-icon,
.attendance-room-list > a > span {
    align-items: center;
    background: #f3f5f8;
    border-radius: 9px;
    color: #193b85;
    display: inline-flex;
    height: 32px;
    justify-content: center;
    width: 32px;
}

.attendance-menu-icon-gold { color: #e49b22; }
.attendance-menu strong { font-size: .91rem; }

.attendance-back {
    color: #344469;
    display: inline-flex;
    font-size: .83rem;
    font-weight: 800;
    gap: 7px;
    margin: 2px 0 18px;
    text-decoration: none;
}

.attendance-view-heading { margin-bottom: 18px; text-align: center; }
.attendance-view-heading p:last-child { color: #6b7692; font-size: .9rem; margin: 6px auto 0; }
.attendance-inline-notice { background: #fff4dc; border: 1px solid #efd097; border-radius: 12px; font-size: .84rem; line-height: 1.45; margin-bottom: 12px; padding: 12px 14px; }
.attendance-room-list { display: grid; gap: 9px; }
.attendance-room-list div { display: grid; gap: 2px; }
.attendance-room-list strong { font-size: .95rem; }
.attendance-room-list small { color: #6b7692; font-size: .78rem; }

.attendance-history-list { display: grid; gap: 10px; }
.attendance-history-list article { background: #fff; border: 1px solid #dfe4eb; border-radius: 14px; display: grid; gap: 12px; padding: 15px; }
.attendance-history-head { display: grid; gap: 3px; }
.attendance-history-head small { color: #6b7692; font-size: .76rem; }
.attendance-history-head strong { color: #17244d; line-height: 1.3; }
.attendance-history-times { display: flex; gap: 18px; }
.attendance-history-times span { color: #6b7692; display: grid; font-size: .74rem; gap: 2px; text-transform: uppercase; }
.attendance-history-times b { color: #17244d; font-size: .9rem; }
.attendance-status { background: #eef3ff; border-radius: 999px; color: #193b85; font-size: .7rem; font-weight: 800; justify-self: start; padding: 5px 9px; text-transform: uppercase; }

.attendance-program-topbar { align-items: end; display: flex; gap: 22px; margin-bottom: 18px; }
.attendance-program-topbar .attendance-back { margin-bottom: 4px; }
.attendance-program-topbar h1, .attendance-program-topbar h2 { margin-bottom: 0; }
.attendance-login-program-heading { align-items: center; justify-content: space-between; margin-top: 32px; }
.attendance-login-program-heading > p { color: #66728a; font-size: .84rem; margin: 0; max-width: 470px; text-align: right; }
.attendance-day-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 22px; }
.attendance-day-tabs button { background: #fff; border: 1px solid #d9e0ea; border-radius: 0; box-shadow: none; color: #10192e; gap: 7px; min-height: 52px; padding: 10px 14px; }
.attendance-day-tabs button:first-child { border-radius: 13px 0 0 13px; }
.attendance-day-tabs button:last-child { border-radius: 0 13px 13px 0; }
.attendance-day-tabs button.is-active { background: #203968; color: #fff; }
.attendance-day-short { display: none; }

.attendance-schedule { background: #fff; border: 1px solid #dce2ea; border-radius: 16px; overflow: hidden; }
.attendance-schedule[hidden] { display: none !important; }
.attendance-schedule-head,
.attendance-schedule-row { display: grid; grid-template-columns: 120px minmax(250px, 1.5fr) minmax(155px, .85fr) 125px minmax(260px, 1.25fr); }
.attendance-schedule-head { background: #203968; color: #fff; font-size: .78rem; font-weight: 800; }
.attendance-schedule-head span { padding: 15px; text-align: center; }
.attendance-schedule-row { border-bottom: 1px solid #e2e7ee; box-shadow: inset 5px 0 0 var(--row-color); min-height: 76px; }
.attendance-schedule-row:last-child { border-bottom: 0; }
.attendance-schedule-row > * { align-items: center; border-right: 1px solid #e2e7ee; display: flex; justify-content: center; padding: 12px 15px; }
.attendance-schedule-row > *:last-child { border-right: 0; }
.attendance-schedule-row time { color: #10203f; font-size: .85rem; white-space: nowrap; }
.attendance-schedule-title { gap: 12px; justify-content: flex-start; }
.attendance-schedule-title > span { align-items: center; background: var(--row-color); border-radius: 9px; color: #fff; display: inline-flex; flex: 0 0 38px; height: 38px; justify-content: center; }
.attendance-schedule-title > span img { border-radius: inherit; height: 100%; object-fit: contain; width: 100%; }
.attendance-schedule-title > div { display: grid; gap: 2px; }
.attendance-schedule-title strong { color: #10192e; font-size: .86rem; line-height: 1.25; }
.attendance-schedule-title small { color: #56627a; font-size: .72rem; }
.attendance-schedule-room { color: #10192e; font-size: .8rem; font-weight: 700; text-align: center; }
.attendance-schedule-room .fa-location-dot { display: none; }
.attendance-schedule-access a { background: #203968; border-radius: 9px; color: #fff; font-size: .76rem; font-weight: 800; padding: 9px 11px; text-decoration: none; white-space: nowrap; }
.attendance-gated-access { align-items: center; color: #56627a; display: inline-flex; font-size: .72rem; font-weight: 700; gap: 6px; line-height: 1.3; text-align: center; }
.attendance-gated-access .fa-lock { color: #d18d1c; }
.attendance-schedule-action { align-content: center; flex-wrap: wrap; gap: 6px; }
.attendance-schedule-action a,
.attendance-schedule-action button { background: #fff; border: 1px solid #203968; border-radius: 999px; box-shadow: none; color: #203968; font-size: .68rem; font-weight: 800; min-height: 0; padding: 6px 9px; text-align: center; text-decoration: none; }
.attendance-schedule-action button:hover { background: #203968; color: #fff; transform: none; }
.attendance-schedule-action form { margin: 0; }
.attendance-schedule-action span { color: #66728a; font-size: .7rem; font-weight: 700; text-align: center; }
.attendance-schedule-action button:disabled { background: #f0f2f5; border-color: #d5dbe5; color: #818b9d; cursor: not-allowed; opacity: 1; }
.attendance-schedule-action button:disabled:hover { background: #f0f2f5; color: #818b9d; }
.attendance-program-status { align-items: center; border: 1px solid transparent; border-radius: 999px; display: inline-flex; font-size: .7rem; font-weight: 800; gap: 5px; padding: 6px 9px; white-space: nowrap; }
.attendance-program-status-proximo { background: #fff5df; border-color: #efd49d; color: #855b12; }
.attendance-program-status-en_curso { background: #e9f7ef; border-color: #a9dbc0; color: #157044; }
.attendance-program-status-finalizado { background: #eef1f5; border-color: #d8dee7; color: #5c6678; }
.attendance-ended-message { width: 100%; }

.attendance-program-modal[hidden] { display: none; }
.attendance-program-modal { align-items: center; display: flex; inset: 0; justify-content: center; padding: 20px; position: fixed; z-index: 2000; }
.attendance-program-modal-backdrop { background: rgba(4, 11, 28, .78); border: 0; border-radius: 0; box-shadow: none; inset: 0; padding: 0; position: absolute; }
.attendance-program-modal-panel { background: #fbf8f1; border: 1px solid rgba(214, 165, 74, .45); border-radius: 22px; box-shadow: 0 30px 90px rgba(0, 0, 0, .45); max-height: min(90vh, 850px); max-width: 850px; overflow: hidden; position: relative; width: 100%; z-index: 1; }
.attendance-program-modal-close { align-items: center; background: #fff; border: 1px solid #dce2ea; border-radius: 50%; color: #26315f; display: flex; height: 38px; justify-content: center; padding: 0; position: absolute; right: 16px; top: 16px; width: 38px; z-index: 2; }
.attendance-program-modal-scroll { max-height: min(90vh, 850px); overflow-y: auto; padding: 30px; }
.attendance-program-modal-scroll > h2 { color: #17244d; font-family: var(--font-brand); font-size: clamp(1.65rem, 4vw, 2.5rem); margin: 4px 48px 12px 0; }
.attendance-program-modal-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.attendance-program-modal-meta span { align-items: center; background: #fff; border: 1px solid #e0e5ec; border-radius: 999px; display: inline-flex; font-size: .76rem; font-weight: 700; gap: 6px; padding: 7px 10px; }
.attendance-program-modal-description { background: rgba(255, 255, 255, .72); border-left: 4px solid #d6a54a; border-radius: 0 12px 12px 0; color: #59667d; font-size: .84rem; line-height: 1.55; padding: 12px 14px; }
.attendance-program-modal-description strong { color: #26315f; }
.attendance-program-modal-description p { margin: 6px 0 0; }
.attendance-modal-section { margin-top: 22px; }
.attendance-modal-section h3 { color: #50602e; font-size: 1.15rem; margin-bottom: 10px; }
.attendance-modal-empty { color: #6b7692; font-size: .86rem; }
.attendance-responsible-list { background: #fff; border: 1px solid #e0e5ec; border-radius: 15px; overflow: hidden; }
.attendance-responsible-list > div { align-items: center; border-bottom: 1px solid #edf0f4; display: grid; gap: 10px; grid-template-columns: 120px minmax(0, 1fr) auto; padding: 11px 14px; }
.attendance-responsible-list > div:last-child { border-bottom: 0; }
.attendance-responsible-list span { font-size: .76rem; font-weight: 800; text-transform: capitalize; }
.attendance-responsible-list strong { color: #4f5c73; font-size: .84rem; }
.attendance-responsible-list small, .attendance-presentation-list article > div span { background: #eef2f8; border-radius: 999px; color: #536078; font-size: .68rem; font-weight: 800; padding: 5px 8px; }
.attendance-presentation-list { display: grid; gap: 10px; }
.attendance-presentation-list article { background: #fff; border: 1px solid #e0e5ec; border-radius: 15px; padding: 14px; }
.attendance-presentation-list article > div { align-items: center; display: flex; gap: 8px; justify-content: space-between; }
.attendance-presentation-list time { background: #eef2f8; border-radius: 999px; color: #26315f; font-size: .75rem; font-weight: 800; padding: 6px 9px; }
.attendance-presentation-list h4 { color: #17244d; font-size: .95rem; margin: 10px 0 0; }
.attendance-presentation-list p, .attendance-presentation-list small { color: #66728a; display: block; font-size: .78rem; line-height: 1.5; margin: 7px 0 0; }
.attendance-modal-open { overflow: hidden; }

.attendance-login { margin: 0 auto; max-width: 520px; scroll-margin-top: 16px; }
.attendance-form label { text-align: left; }
.attendance-empty { background: #fff; border: 1px solid #dfe4eb; }
.attendance-footer { color: #777954; font-size: .82rem; font-weight: 700; padding: 20px 10px 12px; text-align: center; }
.attendance-talavera { background: url('../img/talavera-bottom-border.png') center bottom / auto 70px repeat-x; height: 58px; margin: 0 -20px; }
.attendance-device-wide .attendance-talavera { margin-left: -28px; margin-right: -28px; }

@media (max-width: 820px) {
    .attendance-shell { align-items: flex-start; padding: 12px; }
    .attendance-device, .attendance-device-wide { border-radius: 20px; padding: 20px 14px 0; }
    .attendance-masthead { min-height: 48px; }
    .attendance-event-logo { height: 46px; width: 54px; }
    .attendance-institution-logo { height: 38px; width: 118px; }
    .attendance-device-wide { max-width: 560px; }
    .attendance-day-tabs { background: #fff; border: 1px solid #d9e0ea; border-radius: 13px; display: flex; margin-bottom: 18px; overflow-x: auto; }
    .attendance-day-tabs button { border: 0; border-right: 1px solid #d9e0ea; border-radius: 0; flex: 1 0 96px; font-size: .76rem; gap: 4px; min-height: 48px; padding: 9px 4px; }
    .attendance-day-tabs button:last-child { border-right: 0; }
    .attendance-day-tabs button:first-child,
    .attendance-day-tabs button:last-child { border-radius: 0; }
    .attendance-day-full { display: none; }
    .attendance-day-short { display: inline; }
    .attendance-schedule { background: transparent; border: 0; display: grid; gap: 10px; overflow: visible; }
    .attendance-schedule-head { display: none; }
    .attendance-schedule-row { background: #fff; border: 1px solid #dce2ea; border-radius: 15px; box-shadow: inset 4px 0 0 var(--row-color), 0 5px 15px rgba(20, 34, 68, .07); display: grid; gap: 0; grid-template-areas: "title time" "room room" "access access" "action action"; grid-template-columns: minmax(0, 1fr) auto; min-height: 0; overflow: hidden; padding: 14px 14px 13px 18px; }
    .attendance-schedule-row > * { border: 0; justify-content: flex-start; padding: 0; }
    .attendance-schedule-row time { align-self: start; background: #fbf7ee; border: 1px solid #e5e0d7; border-radius: 999px; color: #10203f; font-size: .75rem; font-weight: 800; grid-area: time; margin-left: 8px; padding: 6px 9px; }
    .attendance-schedule-row time .fa-clock { display: none; }
    .attendance-schedule-title { align-items: flex-start; grid-area: title; min-width: 0; }
    .attendance-schedule-title > span { border-radius: 10px; flex-basis: 42px; height: 42px; }
    .attendance-schedule-title strong { font-size: 1rem; line-height: 1.18; }
    .attendance-schedule-title small { font-size: .76rem; line-height: 1.3; }
    .attendance-schedule-room { border-top: 1px solid #edf0f4; color: #344469; gap: 7px; grid-area: room; margin-top: 12px; padding-top: 10px; text-align: left; }
    .attendance-schedule-room .fa-location-dot { color: var(--row-color); display: inline-block; }
    .attendance-schedule-access { grid-area: access; margin-top: 11px; }
    .attendance-gated-access { background: #fff8e9; border: 1px solid #f0d59e; border-radius: 9px; justify-content: center; min-height: 38px; padding: 7px 10px; width: 100%; }
    .attendance-schedule-access .attendance-not-available { display: none; }
    .attendance-schedule-access a { display: flex; gap: 7px; justify-content: center; min-height: 42px; width: 100%; }
    .attendance-schedule-action { align-items: stretch; display: grid; grid-area: action; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 9px; width: 100%; }
    .attendance-schedule-action a,
    .attendance-schedule-action button { align-items: center; border-radius: 10px; display: flex; font-size: .76rem; justify-content: center; min-height: 42px; padding: 9px; width: 100%; }
    .attendance-schedule-action form { width: 100%; }
    .attendance-schedule-action > :only-child { grid-column: 1 / -1; }
    .attendance-schedule-action > span { grid-column: 1 / -1; }
    .attendance-program-topbar { align-items: flex-start; flex-direction: column; gap: 4px; }
    .attendance-program-topbar .attendance-back { margin-bottom: 12px; }
    .attendance-login-program-heading { margin-top: 26px; }
    .attendance-login-program-heading > p { text-align: left; }
    .attendance-program-modal { align-items: stretch; padding: 0; }
    .attendance-program-modal-panel { border: 0; border-radius: 0; max-height: 100vh; }
    .attendance-program-modal-scroll { max-height: 100vh; padding: 24px 16px 32px; }
    .attendance-program-modal-close { right: 12px; top: 12px; }
    .attendance-program-modal-scroll > h2 { font-size: 1.65rem; margin-right: 42px; }
    .attendance-program-modal-meta { align-items: stretch; display: grid; grid-template-columns: 1fr 1fr; }
    .attendance-program-modal-meta span { border-radius: 10px; line-height: 1.3; }
    .attendance-responsible-list > div { grid-template-columns: 90px minmax(0, 1fr); }
    .attendance-responsible-list small { grid-column: 2; justify-self: start; }
    .attendance-talavera, .attendance-device-wide .attendance-talavera { margin-left: -14px; margin-right: -14px; }
}

/* Acceso y usuarios internos */
.panel-auth-body {
    align-items: center;
    background: radial-gradient(circle at top, #203968 0, #0a142b 48%, #060c19 100%);
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.panel-auth-shell { max-width: 460px; padding: 24px; width: 100%; }
.panel-auth-card { background: #fff; border: 1px solid rgba(214, 165, 74, .35); border-radius: 22px; box-shadow: 0 28px 70px rgba(0, 0, 0, .32); padding: 28px; }
.panel-auth-brand { align-items: center; border-bottom: 1px solid var(--line); display: flex; gap: 14px; margin-bottom: 25px; padding-bottom: 20px; }
.panel-auth-brand img { height: 62px; object-fit: contain; width: 62px; }
.panel-auth-brand strong, .panel-auth-brand small { display: block; }
.panel-auth-brand strong { color: var(--brand); font-family: var(--font-brand); font-size: 1.35rem; }
.panel-auth-brand small { color: var(--accent-2); font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.panel-auth-heading { text-align: center; }
.panel-auth-heading h1 { font-size: 2.1rem; }
.panel-auth-heading p:last-child { color: #66728a; font-size: .9rem; }
.panel-auth-form { display: grid; gap: 16px; margin-top: 24px; }
.panel-auth-form label { font-size: .75rem; }
.panel-auth-form label small { color: #66728a; font-size: .72rem; font-weight: 500; letter-spacing: 0; text-transform: none; }
.panel-auth-form button { min-height: 50px; }
.panel-auth-public-link { color: #52617e; display: block; font-size: .8rem; font-weight: 700; margin-top: 20px; text-align: center; }
.logout-form { margin: 0; }
.role-summary-grid { display: grid; gap: 14px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 20px; }
.role-summary-grid article { align-items: flex-start; display: flex; gap: 14px; }
.role-summary-grid article > i { align-items: center; background: var(--soft); border-radius: 12px; color: var(--brand-blue); display: inline-flex; font-size: 1.2rem; height: 44px; justify-content: center; width: 44px; }
.role-summary-grid strong { color: var(--brand); }
.role-summary-grid p { font-size: .82rem; margin: 5px 0 0; }
.user-password-form { align-items: center; display: flex; gap: 7px; min-width: 285px; }
.user-password-form input { min-width: 165px; padding: 8px 10px; }
.user-password-form button { padding: 8px 10px; }

/* Dark mode overrides for role summary & users */
body.dark-mode .role-summary-grid article,
.dark-mode .role-summary-grid article {
    background: #121a2d;
    border: 1px solid rgba(214, 165, 74, 0.22);
}
body.dark-mode .role-summary-grid article > i,
.dark-mode .role-summary-grid article > i {
    background: rgba(214, 165, 74, 0.15) !important;
    border: 1px solid rgba(214, 165, 74, 0.35) !important;
    color: #f7f3eb !important;
}
body.dark-mode .role-summary-grid strong,
.dark-mode .role-summary-grid strong {
    color: #f7f3eb !important;
}
body.dark-mode .role-summary-grid p,
.dark-mode .role-summary-grid p {
    color: #cbd5e1 !important;
}
body.dark-mode .user-password-form input,
.dark-mode .user-password-form input {
    background: #17233c;
    border: 1px solid rgba(214, 165, 74, 0.3);
    color: #f7f3eb;
}
body.dark-mode .user-password-form button,
.dark-mode .user-password-form button {
    background: #1e293b;
    border: 1px solid rgba(214, 165, 74, 0.35);
    color: #f7f3eb;
}
body.dark-mode .user-password-form button:hover,
.dark-mode .user-password-form button:hover {
    background: #263554;
    color: #d6a54a;
}
body.dark-mode .table-wrap,
.dark-mode .table-wrap {
    background: #121a2d;
    border: 1px solid rgba(214, 165, 74, 0.2);
}
body.dark-mode th,
.dark-mode th {
    background: #17233c !important;
    color: #f7f3eb !important;
    border-bottom: 2px solid rgba(214, 165, 74, 0.3) !important;
}
body.dark-mode td,
.dark-mode td {
    color: #f7f3eb !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}
body.dark-mode td strong,
.dark-mode td strong {
    color: #f7f3eb !important;
}
body.dark-mode td small,
.dark-mode td small {
    color: #cbd5e1 !important;
}
body.dark-mode tbody tr:hover,
.dark-mode tbody tr:hover {
    background: rgba(214, 165, 74, 0.04) !important;
}
body.dark-mode .badge,
.dark-mode .badge {
    background: #1a2640 !important;
    color: #f7f3eb !important;
    border: 1px solid rgba(214, 165, 74, 0.25) !important;
}

@media (max-width: 900px) {
    .role-summary-grid { grid-template-columns: 1fr; }
    .topbar-actions { flex-wrap: wrap; }
}

/* Barra superior compacta para la operacion movil */
.topbar-primary {
    align-items: center;
    display: flex;
    gap: 14px;
    min-width: 0;
}

.user-chip { gap: 8px; }
.user-chip > i { color: var(--accent-2); font-size: 1.35rem; }
.user-chip > span { display: grid; line-height: 1.2; }
.user-chip strong { color: var(--brand); font-size: .82rem; }
.user-chip small { color: var(--muted); font-size: .7rem; }
body.dark-mode .user-chip strong { color: #f7f3eb; }

@media (max-width: 900px) {
    .topbar {
        align-items: stretch;
        display: grid;
        gap: 10px;
        height: auto;
        padding: 11px 14px;
    }

    .topbar-primary { width: 100%; }
    .topbar-primary h2 {
        font-size: 18px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .menu-toggle {
        align-items: center;
        display: inline-flex;
        flex: 0 0 auto;
        gap: 7px;
        min-height: 40px;
        padding: 8px 12px;
    }

    .topbar-actions {
        align-items: center;
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 7px;
        width: 100%;
    }

    .topbar-actions .user-chip {
        margin-right: auto;
        max-width: calc(100% - 142px);
        min-width: 0;
        order: -1;
    }

    .user-chip > span { min-width: 0; }
    .user-chip strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .topbar-control { height: 40px; min-width: 40px; padding: 0 11px; }
    .topbar-control .topbar-action-label { display: none; }
    .logout-form { flex: 0 0 auto; }
    .db-status-chip {
        height: 27px;
        padding: 0 8px 0 7px;
        gap: 5px;
        margin-left: auto;
    }
    .db-status-chip .db-chip-name,
    .db-status-chip .db-chip-sep {
        display: none;
    }
}

@media (max-width: 420px) {
    .topbar { padding-left: 10px; padding-right: 10px; }
    .topbar-primary { gap: 8px; }
    .topbar-primary h2 { font-size: 16px; }
    .menu-toggle span { display: none; }
    .menu-toggle { min-width: 40px; padding: 8px 11px; }
    .content-shell { padding: 16px 12px 28px; }
}
