:root {
    --app-bg: #f6f7f9;
    --app-border: #d9dee7;
    --app-sidebar: #17202a;
    --app-text: #1f2937;
}

body {
    background: var(--app-bg);
    color: var(--app-text);
}

.app-shell {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    min-height: 100vh;
}

.app-sidebar {
    background: var(--app-sidebar);
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 22px 18px;
}

.app-brand {
    color: #fff;
    font-size: 24px;
    font-weight: 700;
    text-decoration: none;
}

.app-sidebar .nav-link {
    border-radius: 6px;
    color: #d6dde8;
    padding: 9px 10px;
}

.app-sidebar .nav-link:hover,
.app-sidebar .nav-link:focus {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.app-sidebar .nav-link.active {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.app-main {
    min-width: 0;
    padding: 28px;
}

.auth-main {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.public-body {
    background:
        radial-gradient(1200px 420px at 10% -10%, rgba(23, 32, 42, 0.08), transparent 55%),
        radial-gradient(900px 360px at 100% 0%, rgba(37, 99, 235, 0.08), transparent 50%),
        var(--app-bg);
}

.public-main {
    min-height: 100vh;
    padding: 18px 16px 32px;
}

.public-shell {
    margin: 0 auto;
    max-width: 1100px;
}

.public-header {
    align-items: center;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(8px);
    border: 1px solid var(--app-border);
    border-radius: 14px;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 18px;
    padding: 12px 16px;
}

.public-brand {
    align-items: center;
    color: var(--app-text);
    display: inline-flex;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    text-decoration: none;
}

.public-brand:hover {
    color: var(--app-text);
}

.public-brand-mark {
    align-items: center;
    background: var(--app-sidebar);
    border-radius: 10px;
    color: #fff;
    display: inline-flex;
    font-size: 14px;
    height: 34px;
    justify-content: center;
    width: 34px;
}

.public-header-label {
    color: #6b7280;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.public-footer {
    color: #9ca3af;
    font-size: 12px;
    margin-top: 28px;
    text-align: center;
}

/* ---- Toma de posesión (público) ---- */
.tp-hero {
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: 16px;
    margin-bottom: 16px;
    padding: 22px 22px 20px;
}

.tp-hero h1 {
    font-size: clamp(1.6rem, 2.4vw, 2rem);
    font-weight: 750;
    letter-spacing: -0.02em;
    margin: 0 0 8px;
}

.tp-lead {
    color: #4b5563;
    font-size: 15px;
    line-height: 1.5;
    margin: 0;
    max-width: 52ch;
}

.tp-pill {
    align-items: center;
    border-radius: 999px;
    display: inline-flex;
    font-size: 11px;
    font-weight: 700;
    justify-content: center;
    line-height: 1;
    padding: 0.35em 0.7em;
    width: fit-content;
}

.tp-pill-code {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: 0.02em;
}

.tp-pill-hours {
    background: #dbeafe;
    border: 1px solid #93c5fd;
    color: #1d4ed8;
}

.tp-toolbar {
    margin-bottom: 16px;
}

.tp-filter {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
    font-size: 15px;
    padding: 0.7rem 0.95rem;
}

.tp-toolbar-hint {
    margin-top: 8px;
    padding-left: 4px;
}

.tp-list {
    display: grid;
    gap: 18px;
}

.tp-comision {
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: 16px;
    overflow: hidden;
}

.tp-comision-header {
    align-items: flex-start;
    background: #f8fafc;
    border-bottom: 1px solid var(--app-border);
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 14px 18px;
}

.tp-comision-header-main {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.tp-comision-title {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.2rem;
    font-weight: 750;
    letter-spacing: 0.01em;
    margin: 0;
}

.tp-comision-sede {
    color: #1f2937;
    font-size: 14px;
    font-weight: 650;
    line-height: 1.35;
}

.tp-comision-domicilio {
    color: #6b7280;
    font-size: 13px;
    line-height: 1.4;
}

.tp-comision-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.tp-comision-count {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    color: #4b5563;
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 700;
    padding: 0.35em 0.75em;
    white-space: nowrap;
}

.tp-cards {
    display: grid;
    gap: 12px;
    padding: 14px;
}

@media (min-width: 768px) {
    .tp-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: 16px;
    }
}

.tp-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 100%;
    padding: 16px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tp-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.tp-card-main {
    display: grid;
    flex: 1;
    gap: 12px;
}

.tp-card-title-row {
    align-items: flex-start;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.tp-card-title {
    font-size: 1.05rem;
    font-weight: 750;
    letter-spacing: -0.01em;
    line-height: 1.3;
    margin: 0;
    min-width: 0;
}

.tp-card-code-row {
    align-items: center;
    display: flex;
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.tp-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tp-tag {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #1f2937;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    padding: 0.35em 0.55em;
}

.tp-tag-label {
    color: #6b7280;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.tp-card-horario {
    align-items: flex-start;
    background: #f8fafc;
    border-radius: 10px;
    display: flex;
    gap: 10px;
    padding: 10px 12px;
}

.tp-horario-icon {
    font-size: 14px;
    line-height: 1.4;
    opacity: 0.7;
}

.tp-card-action {
    margin-top: auto;
}

.tp-btn-tomar {
    border-radius: 10px;
    font-weight: 700;
    padding: 0.65rem 1rem;
    width: 100%;
}

.tp-empty {
    background: #fff;
    border: 1px dashed #d1d5db;
    border-radius: 16px;
    color: #6b7280;
    display: grid;
    gap: 4px;
    justify-items: start;
    padding: 28px 22px;
    text-align: left;
}

.tp-empty strong {
    color: var(--app-text);
    font-size: 1.05rem;
}

.tp-empty-filter {
    margin-top: 8px;
}

@media (max-width: 575.98px) {
    .public-main {
        padding: 12px 10px 24px;
    }

    .tp-hero {
        padding: 18px 16px;
    }

    .tp-comision-header {
        flex-direction: column;
        gap: 8px;
    }

    .public-brand-text {
        font-size: 15px;
    }
}

.login-panel {
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    max-width: 400px;
    padding: 28px;
    width: 100%;
}

.validation-main {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.validation-panel {
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    max-width: 760px;
    padding: 28px;
    width: 100%;
}

.validation-header {
    align-items: flex-start;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 18px;
}

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

.page-header h1 {
    font-size: 28px;
    margin: 0;
}

.panel {
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    margin-bottom: 18px;
    padding: 18px;
}

.panel h2 {
    font-size: 20px;
    margin-bottom: 16px;
}

.filters-bar {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.filters-bar .form-control,
.filters-bar .form-select {
    max-width: 420px;
}

.app-table {
    background: #fff;
    border: 1px solid var(--app-border);
    font-size: 14px;
}

.app-table th {
    color: #4b5563;
    font-size: 12px;
    text-transform: uppercase;
}

.app-table tr.calificacion-aprobada > * {
    background: #dcfce7;
    color: #14532d;
}

.app-table tr.calificacion-desaprobada > * {
    background: #fee2e2;
    color: #7f1d1d;
}

.contralor-copy-table {
    width: max-content;
    background: #fff;
    font-size: 13px;
}

.contralor-copy-table td {
    white-space: nowrap;
}

.rindex-table {
    background: #fff;
    border: 1px solid var(--app-border);
    font-size: 13px;
    white-space: nowrap;
}

.rindex-table th,
.rindex-table td {
    border: 1px solid #d9dee7;
    padding: 6px 8px;
    vertical-align: middle;
}

.rindex-table th {
    background: #f8fafc;
    font-size: 12px;
    font-weight: 600;
    max-width: 140px;
    white-space: normal;
}

.rindex-sem1 {
    background: #e3f2fd !important;
}

.rindex-sem2 {
    background: #fff3cd !important;
}

.rindex-ok {
    background: #c8e6c9;
    font-weight: 700;
}

.rindex-missing {
    background: #ffcdd2;
}

.rindex-sticky-col,
.rindex-sticky-col-2 {
    background: #fff;
    left: 0;
    position: sticky;
    z-index: 1;
}

.rindex-sticky-col-2 {
    left: 8rem;
}

.rindex-table thead .rindex-sticky-col,
.rindex-table thead .rindex-sticky-col-2 {
    background: #f8fafc;
    z-index: 2;
}

.rindex-table tr.table-secondary .rindex-sticky-col,
.rindex-table tr.table-secondary .rindex-sticky-col-2 {
    background: #e9ecef;
}

.badge-planilla {
    border-radius: 999px;
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    padding: 0.35em 0.65em;
    white-space: nowrap;
}

.badge-planilla-entregada {
    background: #dcfce7;
    color: #14532d;
}

.badge-planilla-no-entregada {
    background: #fee2e2;
    color: #7f1d1d;
}

.badge-planilla-sin-docente {
    background: #e5e7eb;
    color: #4b5563;
}

.calificacion-number {
    max-width: 82px;
}

.empty-state,
.action-card {
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    display: block;
    padding: 18px;
}

.action-card {
    color: inherit;
    min-height: 120px;
    text-decoration: none;
}

.action-card strong,
.action-card span {
    display: block;
}

.action-card span {
    color: #6b7280;
    margin-top: 8px;
}

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

.form-grid-persona {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-wide {
    grid-column: 1 / -1;
}

.form-span-2 {
    grid-column: span 2;
}

.form-composite {
    display: grid;
    gap: 8px;
}

.form-cuil-grid {
    grid-template-columns: 62px minmax(120px, 1fr) 54px;
}

.form-date-grid {
    grid-template-columns: 74px 74px 94px;
}

.form-phone-grid {
    grid-template-columns: minmax(96px, 0.8fr) minmax(130px, 1.2fr);
}

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

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

.role-option {
    align-items: flex-start;
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    gap: 10px;
    margin: 0;
    min-height: 100%;
    padding: 14px;
}

.role-option input {
    margin-top: 4px;
}

.role-option span span {
    color: #6b7280;
    display: block;
    margin-top: 4px;
}

.role-option:has(input:checked) {
    border-color: #2563eb;
    box-shadow: 0 0 0 1px #2563eb;
}

.comision-picker,
.curso-picker {
    align-items: start;
    display: grid;
    gap: 8px 12px;
    position: relative;
}

.pf-summary {
    border: 1px solid var(--app-border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    min-height: 92px;
    padding: 16px;
}

.pf-summary strong {
    font-size: 28px;
    line-height: 1;
}

.pf-summary-success {
    background: #ecfdf3;
    color: #166534;
}

.pf-summary-warning {
    background: #fffbeb;
    color: #92400e;
}

.pf-summary-danger {
    background: #fef2f2;
    color: #991b1b;
}

.comision-picker {
    grid-template-columns: minmax(96px, 1fr) minmax(0, 4fr);
}

.curso-picker {
    grid-template-columns: max-content minmax(0, 1fr);
}

.comision-summary,
.curso-summary {
    line-height: 1.45;
    padding-top: 7px;
}

.comision-results {
    background: #fff;
    border: 1px solid #98a2b3;
    border-radius: 6px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.14);
    left: 0;
    max-height: 220px;
    overflow-y: auto;
    position: absolute;
    top: calc(100% + 4px);
    width: min(560px, 86vw);
    z-index: 10;
}

.comision-option,
.comision-empty {
    background: #fff;
    border: 0;
    display: block;
    padding: 8px 10px;
    text-align: left;
    width: 100%;
}

.comision-option:hover,
.comision-option:focus {
    background: #eef5ff;
}

@media (max-width: 1100px) {
    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .form-span-2 {
        grid-column: 1 / -1;
    }

    .role-options {
        grid-template-columns: 1fr;
    }
}

tr.import-log-conflict td {
    background-color: #ffb020 !important;
    color: #1a1200 !important;
    font-weight: 700;
}

.import-log-conflict-text {
    color: #1a1200;
    font-weight: 700;
}

@media (max-width: 760px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        position: static;
    }

    .app-main {
        padding: 18px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-cuil-grid,
    .form-date-grid,
    .form-phone-grid,
    .form-ingreso-grid {
        grid-template-columns: 1fr;
    }

    .comision-picker,
    .curso-picker {
        grid-template-columns: 1fr;
    }

    .comision-summary,
    .curso-summary {
        padding-top: 0;
    }
}
