:root {
    color-scheme: light;
    --bg: #f5f7fb;
    --surface: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #2563eb;
    --border: #e5e7eb;
    --green: #16a34a;
    --yellow: #ca8a04;
    --red: #dc2626;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}
.container { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { color: var(--text); font-weight: 750; text-decoration: none; }
.nav { display: flex; gap: 16px; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover { color: var(--primary); }
main { padding: 32px 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.stat { font-size: 1.8rem; font-weight: 750; margin-top: 6px; }
.muted { color: var(--muted); }
.btn { display: inline-block; border: 0; border-radius: 10px; padding: 10px 16px; background: var(--primary); color: white; text-decoration: none; cursor: pointer; }
.empty { padding: 42px 20px; text-align: center; color: var(--muted); }
.form-grid { display: grid; gap: 16px; }
label { display: grid; gap: 7px; font-weight: 650; }
input, select, textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 9px; background: white; }

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(1.8rem, 3vw, 2.35rem); line-height: 1.15; color: #10213b; }
h2 { margin-bottom: 8px; color: #17243a; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(37, 99, 235, .14); border-color: var(--primary); }

.page-stack { display: grid; gap: 20px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.page-heading-actions { align-items: center; }
.back-link { display: inline-block; margin-bottom: 12px; color: var(--primary); text-decoration: none; font-weight: 650; }
.back-link:hover { text-decoration: underline; }
.required { color: var(--red); }

.btn { font-weight: 700; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 7px 18px rgba(37, 99, 235, .18); }
.btn-secondary { background: #eaf0ff; color: #1d4ed8; }
.btn-secondary:hover { box-shadow: 0 7px 18px rgba(37, 99, 235, .10); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); box-shadow: none; }
.full-width { width: 100%; text-align: center; }

.alert { border-radius: 12px; padding: 14px 16px; border: 1px solid transparent; }
.alert ul { margin: 8px 0 0; padding-left: 20px; }
.alert-danger { background: #fff1f2; border-color: #fecdd3; color: #9f1239; }
.alert-success { background: #ecfdf5; border-color: #a7f3d0; color: #166534; }

.course-builder-form { display: grid; gap: 20px; }
.builder-section { padding: 24px; }
.section-heading { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 22px; }
.section-heading-actions { justify-content: space-between; }
.section-heading-main { display: flex; align-items: flex-start; gap: 14px; }
.section-heading h2 { margin: 0 0 5px; font-size: 1.25rem; }
.section-heading p { margin: 0; }
.step-number { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--primary); font-weight: 800; }
.form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-span-2 { grid-column: span 2; }
.color-field { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.color-field input[type="color"] { width: 58px; height: 42px; padding: 3px; cursor: pointer; }
.color-value { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; color: var(--muted); }

.repeat-list { display: grid; gap: 14px; }
.repeat-card { border: 1px solid var(--border); border-radius: 12px; padding: 16px; background: #fbfcff; }
.repeat-card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.icon-button { border: 0; background: transparent; padding: 5px 8px; border-radius: 7px; cursor: pointer; font-weight: 700; }
.icon-button.danger { color: #b91c1c; }
.icon-button.danger:hover { background: #fee2e2; }
.activity-grid { grid-template-columns: minmax(220px, 1.35fr) minmax(180px, 1fr) minmax(200px, .95fr) minmax(145px, .7fr); align-items: end; }
.checkbox-field { align-self: stretch; }
.checkbox-control { display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; background: white; font-weight: 500; }
.checkbox-control input { width: 18px; height: 18px; margin: 0; }
.deadline-display { min-height: 44px; padding: 7px 11px; border: 1px solid var(--border); border-radius: 9px; background: #f8fafc; display: grid; gap: 1px; }
.deadline-display strong { color: #0f3e86; }
.deadline-display small { color: var(--muted); }
.builder-summary { display: flex; align-items: center; justify-content: space-between; gap: 24px; border-color: #c7d2fe; background: linear-gradient(135deg, #ffffff 0%, #eef2ff 100%); }
.builder-summary h2 { margin: 5px 0; }
.eyebrow { font-size: .77rem; letter-spacing: .08em; text-transform: uppercase; color: #4f46e5; font-weight: 800; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.course-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 18px; }
.course-card { padding: 0; overflow: hidden; position: relative; }
.course-card-accent { height: 7px; background: var(--course-color, var(--primary)); }
.course-card-body { padding: 20px; display: grid; gap: 16px; }
.course-card-top { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.badge { display: inline-flex; align-items: center; min-height: 28px; padding: 5px 9px; border-radius: 999px; background: #eef2ff; color: #3730a3; font-size: .78rem; font-weight: 750; }
.badge-neutral { background: #f1f5f9; color: #475569; }
.course-code { color: var(--muted); font-size: .84rem; font-weight: 650; }
.course-card h2 { margin: 0; font-size: 1.25rem; }
.course-description { margin: -8px 0 0; min-height: 42px; }
.course-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.course-metrics div { display: grid; gap: 3px; padding: 10px; background: #f8fafc; border-radius: 9px; text-align: center; }
.course-metrics strong { font-size: 1.15rem; color: #10213b; }
.course-metrics span { font-size: .75rem; color: var(--muted); }
.empty-state { min-height: 310px; display: grid; place-items: center; align-content: center; text-align: center; gap: 10px; }
.empty-state-icon { font-size: 3rem; }
.empty-state h2, .empty-state p { margin-bottom: 0; }

.course-title-line { display: flex; align-items: center; gap: 12px; }
.course-color-dot { width: 16px; height: 16px; border-radius: 50%; box-shadow: 0 0 0 5px rgba(15, 23, 42, .05); }
.course-title-line h1 { margin: 0; }
.summary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.summary-card { display: grid; gap: 8px; }
.summary-card span { color: var(--muted); }
.summary-card strong { font-size: 1.55rem; color: #10213b; }
.summary-card strong.text-neutral { font-size: 1rem; color: #475569; }
.section-list { display: grid; gap: 18px; }
.section-detail-card { padding: 0; overflow: hidden; }
.section-detail-head { padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--border); }
.section-detail-head h2, .section-detail-head p { margin-bottom: 0; }
.activity-table-wrap { overflow-x: auto; }
.activity-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.activity-table th, .activity-table td { padding: 13px 16px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.activity-table th { background: #f8fafc; color: #475569; font-size: .78rem; text-transform: uppercase; letter-spacing: .035em; }
.activity-table tbody tr:last-child td { border-bottom: 0; }
.deadline-chip { display: inline-flex; padding: 5px 9px; border-radius: 999px; background: #ecfdf5; color: #166534; font-size: .8rem; font-weight: 800; }
.deadline-chip.deadline-final { background: #fff7ed; color: #9a3412; }
.status { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: .78rem; font-weight: 750; }
.status-neutral { background: #f1f5f9; color: #475569; }

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

@media (max-width: 680px) {
    .container { width: min(100% - 22px, 1180px); }
    .topbar-inner, .page-heading, .builder-summary, .section-heading-actions, .section-detail-head { align-items: stretch; flex-direction: column; }
    .nav { gap: 10px; }
    main { padding: 22px 0; }
    .builder-section { padding: 17px; }
    .form-grid-2, .form-grid-3, .activity-grid, .summary-grid { grid-template-columns: 1fr; }
    .field-span-2 { grid-column: auto; }
    .form-actions { justify-content: stretch; }
    .form-actions .btn { flex: 1; text-align: center; }
}

/* Programación de actividades */
.programming-course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 18px;
}
.programming-course-card {
    padding: 0;
    overflow: hidden;
}
.programming-course-body {
    padding: 20px;
    display: grid;
    gap: 16px;
}
.programming-course-body h2 {
    margin: 0;
    font-size: 1.25rem;
}
.programming-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
.programming-metrics div {
    display: grid;
    gap: 3px;
    padding: 10px 8px;
    border-radius: 9px;
    background: #f8fafc;
    text-align: center;
}
.programming-metrics strong {
    color: #10213b;
    font-size: 1.15rem;
}
.programming-metrics span {
    color: var(--muted);
    font-size: .72rem;
}
.programming-course-header {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding-left: 28px;
}
.programming-course-accent {
    position: absolute;
    inset: 0 auto 0 0;
    width: 7px;
    background: var(--course-color, var(--primary));
}
.programming-course-header h2,
.programming-course-header p {
    margin-bottom: 0;
}
.programming-header-counts {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.programming-header-counts span {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    padding: 8px 11px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    font-size: .82rem;
}
.programming-header-counts strong {
    color: #10213b;
}
.programming-form {
    gap: 18px;
}
.programming-table {
    min-width: 900px;
}
.programming-date-cell {
    width: 245px;
}
.programming-date-cell input[type="datetime-local"] {
    min-width: 215px;
    padding: 9px 10px;
}
.programming-current-date {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-weight: 500;
}
.status-programmed {
    background: #dbeafe;
    color: #1d4ed8;
}
.programming-save-bar {
    position: sticky;
    bottom: 14px;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-color: #bfdbfe;
    box-shadow: 0 14px 35px rgba(15, 23, 42, .13);
}
.programming-save-bar p {
    margin: 4px 0 0;
}

@media (max-width: 760px) {
    .programming-course-header,
    .programming-save-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .programming-save-bar .btn {
        width: 100%;
        text-align: center;
    }

    .programming-metrics {
        grid-template-columns: 1fr;
    }
}

/* Panel dinámico y semáforo */
.panel-updated {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 7px 11px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    font-size: .82rem;
    white-space: nowrap;
}
.panel-summary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.summary-alert-card {
    position: relative;
    overflow: hidden;
    display: grid;
    gap: 5px;
    min-height: 128px;
}
.summary-alert-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: #94a3b8;
}
.summary-alert-card span { color: var(--muted); }
.summary-alert-card small { color: var(--muted); }
.summary-alert-red::before { background: var(--red); }
.summary-alert-yellow::before { background: var(--yellow); }
.summary-alert-blue::before { background: var(--primary); }
.summary-alert-neutral::before { background: #64748b; }
.panel-empty-state { min-height: 240px; }
.panel-group { display: grid; gap: 13px; }
.panel-group-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.panel-group-heading > div { display: flex; align-items: center; gap: 10px; }
.panel-group-heading h2 { margin: 0; font-size: 1.18rem; }
.panel-group-dot { width: 11px; height: 11px; border-radius: 50%; }
.dot-red { background: var(--red); }
.dot-yellow { background: var(--yellow); }
.dot-blue { background: var(--primary); }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1d4ed8; }
.alert-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
    gap: 16px;
}
.activity-alert-card {
    position: relative;
    overflow: hidden;
    display: grid;
    gap: 15px;
    padding-left: 25px;
}
.activity-alert-accent {
    position: absolute;
    inset: 0 auto 0 0;
    width: 7px;
    background: var(--course-color, var(--primary));
}
.activity-alert-head,
.activity-alert-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.alert-state-pill {
    display: inline-flex;
    align-items: center;
    min-height: 29px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 800;
}
.state-verde { background: #dcfce7; color: #166534; }
.state-amarillo { background: #fef3c7; color: #92400e; }
.state-rojo { background: #fee2e2; color: #991b1b; }
.state-vencido { background: #1f2937; color: white; }
.state-neutral { background: #f1f5f9; color: #475569; }
.activity-alert-card h3 { margin: 0 0 5px; font-size: 1.15rem; color: #10213b; }
.activity-context { margin: 0; color: var(--muted); }
.alert-message {
    margin: 0;
    padding: 11px 12px;
    border-radius: 9px;
    background: #f8fafc;
    color: #334155;
}
.activity-alert-footer > div { display: grid; gap: 3px; }
.activity-alert-footer small { color: var(--muted); }
.activity-alert-footer strong { color: #10213b; }
.alert-color-rojo { border-color: #fecaca; }
.alert-color-amarillo { border-color: #fde68a; }
.alert-color-verde { border-color: #bbf7d0; }
.alert-color-vencido { border-color: #94a3b8; }
.unscheduled-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
}
.unscheduled-summary p { margin: 5px 0 0; }

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

@media (max-width: 680px) {
    .panel-summary-grid { grid-template-columns: 1fr; }
    .activity-alert-head,
    .activity-alert-footer,
    .unscheduled-summary { align-items: stretch; flex-direction: column; }
    .activity-alert-footer .btn,
    .unscheduled-summary .btn { width: 100%; text-align: center; }
}

/* Flujo de ejecución, notas y logros */
.alert-error { background: #fff1f2; border-color: #fecdd3; color: #9f1239; }
.activity-card-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.activity-card-actions .btn { white-space: nowrap; }
.activity-timeline-mini {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}
.activity-timeline-mini > div {
    display: grid;
    gap: 3px;
    padding: 10px 11px;
    border-radius: 10px;
    background: #f8fafc;
}
.activity-timeline-mini small { color: var(--muted); }
.activity-timeline-mini strong { color: #10213b; font-size: .88rem; }

.action-dialog {
    width: min(560px, calc(100% - 28px));
    padding: 0;
    border: 0;
    border-radius: 18px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 28px 80px rgba(15, 23, 42, .28);
}
.action-dialog::backdrop { background: rgba(15, 23, 42, .58); backdrop-filter: blur(2px); }
.action-dialog form { display: grid; }
.dialog-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 24px 17px;
    border-bottom: 1px solid var(--border);
}
.dialog-head h2 { margin: 4px 0 5px; }
.dialog-head p { margin: 0; }
.dialog-eyebrow { color: var(--primary); font-size: .76rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.dialog-close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: #f1f5f9;
    color: #475569;
    font-size: 1.45rem;
    line-height: 1;
    cursor: pointer;
}
.dialog-close:hover { background: #e2e8f0; color: #0f172a; }
.dialog-body { display: grid; gap: 14px; padding: 22px 24px; }
.dialog-note { margin: 0; padding: 12px 13px; border-radius: 10px; background: #eff6ff; color: #334155; line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px 22px; border-top: 1px solid var(--border); }

.achievement-summary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.achievement-summary-card { position: relative; overflow: hidden; display: grid; gap: 6px; min-height: 126px; }
.achievement-summary-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: #64748b; }
.achievement-summary-card span, .achievement-summary-card small { color: var(--muted); }
.achievement-summary-card strong { color: #10213b; font-size: 1.7rem; }
.achievement-summary-success::before { background: var(--green); }
.achievement-summary-danger::before { background: var(--red); }
.achievement-summary-rate::before { background: var(--primary); }
.achievements-empty { min-height: 280px; }
.achievements-table-card { padding: 0; overflow: hidden; }
.achievements-table-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 22px; border-bottom: 1px solid var(--border); }
.achievements-table-heading h2, .achievements-table-heading p { margin-bottom: 0; }
.achievements-table { min-width: 1050px; }
.achievement-course-cell { display: flex; align-items: center; gap: 12px; }
.achievement-course-cell > div { display: grid; gap: 3px; }
.achievement-course-cell small, .table-subtext { display: block; margin-top: 3px; color: var(--muted); font-size: .78rem; }
.achievement-result { display: inline-flex; align-items: center; min-height: 30px; padding: 5px 10px; border-radius: 999px; font-size: .78rem; font-weight: 800; white-space: nowrap; }
.achievement-on-time { background: #dcfce7; color: #166534; }
.achievement-late { background: #fee2e2; color: #991b1b; }
.achievement-neutral { background: #e0e7ff; color: #3730a3; }
.status-executed { background: #fef3c7; color: #92400e; }
.status-completed { background: #dcfce7; color: #166534; }
.status-cancelled { background: #fee2e2; color: #991b1b; }

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

@media (max-width: 680px) {
    .activity-alert-footer,
    .activity-card-actions,
    .dialog-actions,
    .achievements-table-heading { align-items: stretch; flex-direction: column; }
    .activity-card-actions .btn,
    .dialog-actions .btn { width: 100%; text-align: center; }
    .activity-timeline-mini,
    .achievement-summary-grid { grid-template-columns: 1fr; }
    .dialog-head, .dialog-body, .dialog-actions { padding-left: 18px; padding-right: 18px; }
}

/* Cronograma general y exportable */
.print-only { display: none; }
.schedule-heading-actions,
.schedule-filter-actions,
.schedule-view-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.schedule-filters { display: grid; gap: 18px; }
.schedule-filter-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}
.schedule-filter-grid label,
.cycle-dates-card label { display: grid; gap: 7px; }
.schedule-filter-grid label > span,
.cycle-dates-card label > span { font-weight: 700; color: #22324b; }
.schedule-filter-grid select,
.schedule-filter-grid input,
.cycle-dates-card input {
    width: 100%;
    min-height: 43px;
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 9px 11px;
    background: #fff;
    color: var(--text);
    font: inherit;
}
.schedule-view-switch {
    padding: 5px;
    width: fit-content;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #fff;
}
.schedule-view-switch a {
    padding: 9px 14px;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 750;
    text-decoration: none;
}
.schedule-view-switch a.active { background: var(--primary); color: #fff; }
.schedule-summary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.schedule-summary-card { display: grid; gap: 7px; min-height: 120px; }
.schedule-summary-card span,
.schedule-summary-card small { color: var(--muted); }
.schedule-summary-card strong { font-size: 1.8rem; color: #10213b; }
.cycle-dates-card {
    display: grid;
    grid-template-columns: minmax(280px, 1.5fr) repeat(2, minmax(180px, .7fr)) auto;
    align-items: end;
    gap: 16px;
    border-left: 5px solid var(--primary);
}
.cycle-dates-card h2 { margin: 0 0 6px; }
.schedule-table-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 22px 0;
}
.schedule-table-heading h2 { margin: 0; }
.schedule-list-card,
.schedule-matrix-card { overflow: hidden; padding: 0; }
.schedule-course-cell,
.schedule-course-name {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.schedule-course-cell > div,
.schedule-course-name > div { display: grid; gap: 3px; }
.schedule-course-cell small,
.schedule-course-name small { color: var(--muted); }
.schedule-status {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 800;
    white-space: nowrap;
}
.schedule-status-programmed { background: #dbeafe; color: #1d4ed8; }
.schedule-status-grades { background: #fef3c7; color: #92400e; }
.schedule-status-done { background: #dcfce7; color: #166534; }
.schedule-status-neutral { background: #f1f5f9; color: #475569; }
.schedule-matrix-wrap { overflow: auto; max-height: 68vh; margin-top: 18px; }
.schedule-matrix-table {
    border-collapse: separate;
    border-spacing: 0;
    min-width: 2200px;
    width: 100%;
    font-size: .79rem;
}
.schedule-matrix-table th,
.schedule-matrix-table td {
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 7px;
    vertical-align: top;
    background: #fff;
}
.schedule-matrix-table thead th {
    position: sticky;
    top: 0;
    z-index: 4;
    background: #eef3f9;
    color: #27364d;
    text-align: center;
    font-weight: 800;
}
.schedule-matrix-table thead tr:nth-child(2) th { top: 35px; }
.schedule-matrix-table .sticky-course,
.schedule-matrix-table .sticky-section {
    position: sticky;
    z-index: 3;
    background: #fff;
}
.schedule-matrix-table thead .sticky-course,
.schedule-matrix-table thead .sticky-section { z-index: 7; background: #e6edf6; }
.schedule-matrix-table .sticky-course { left: 0; min-width: 235px; max-width: 235px; }
.schedule-matrix-table .sticky-section { left: 235px; min-width: 100px; max-width: 100px; }
.schedule-week-heading { min-width: 98px; }
.schedule-week-heading strong,
.schedule-week-heading small { display: block; }
.schedule-week-heading small { margin-top: 3px; color: var(--muted); font-weight: 600; }
.schedule-week-cell { min-width: 98px; height: 86px; }
.schedule-matrix-item {
    display: grid;
    gap: 2px;
    margin-bottom: 6px;
    padding: 6px 7px;
    border-left: 4px solid #94a3b8;
    border-radius: 7px;
    background: #f8fafc;
    line-height: 1.15;
}
.schedule-matrix-item:last-child { margin-bottom: 0; }
.schedule-matrix-item strong { font-size: .82rem; }
.schedule-matrix-item span,
.schedule-matrix-item small { color: #475569; }
.schedule-matrix-item.schedule-status-programmed { border-left-color: #2563eb; background: #eff6ff; }
.schedule-matrix-item.schedule-status-grades { border-left-color: #d97706; background: #fffbeb; }
.schedule-matrix-item.schedule-status-done { border-left-color: #16a34a; background: #f0fdf4; }
.schedule-print-title { margin-bottom: 18px; }
.schedule-print-title h1 { margin: 0 0 5px; }
.schedule-print-title p { margin: 0; color: #475569; }


/* Matriz semanal compacta, inspirada en el cronograma docente */
.week-config-card { padding: 0; overflow: hidden; }
.week-config-card summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 15px 18px;
    cursor: pointer;
    list-style: none;
}
.week-config-card summary::-webkit-details-marker { display: none; }
.week-config-card summary::before {
    content: "▸";
    color: var(--primary);
    font-weight: 900;
    transition: transform .18s ease;
}
.week-config-card[open] summary::before { transform: rotate(90deg); }
.week-config-card summary > span:first-of-type { flex: 1; }
.week-config-action { color: var(--primary); font-weight: 800; }
.week-config-card form {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr)) auto;
    gap: 14px;
    align-items: end;
    padding: 0 18px 18px;
    border-top: 1px solid var(--border);
}
.week-config-card label { display: grid; gap: 7px; padding-top: 16px; }
.week-config-card label span { font-weight: 700; color: #22324b; }
.week-config-card input {
    width: 100%; min-height: 43px; border: 1px solid var(--border);
    border-radius: 9px; padding: 9px 11px; background: #fff; color: var(--text); font: inherit;
}
.schedule-matrix-legend {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    padding: 12px 22px 0;
    color: var(--muted);
    font-size: .82rem;
}
.schedule-matrix-legend span { display: inline-flex; align-items: center; gap: 7px; }
.schedule-matrix-legend i { font-style: normal; color: #172033; }
.matrix-legend-code,
.matrix-activity-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    padding: 2px 5px;
    background: #facc15;
    color: #1f2937;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
}
.matrix-legend-date,
.matrix-activity-date {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 5px;
    background: #bef264;
    color: #172033;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}
.schedule-matrix-compact .schedule-matrix-wrap { margin-top: 12px; }
.schedule-matrix-compact .schedule-matrix-table {
    min-width: 2160px;
    font-size: .74rem;
    table-layout: fixed;
}
.schedule-matrix-compact .schedule-matrix-table th,
.schedule-matrix-compact .schedule-matrix-table td {
    padding: 4px;
    height: 36px;
    vertical-align: middle;
}
.schedule-matrix-compact .schedule-matrix-table tbody tr:nth-child(even) td { background: #fbfdff; }
.schedule-matrix-compact .schedule-matrix-table .sticky-course,
.schedule-matrix-compact .schedule-matrix-table .sticky-section { background: #fff; }
.schedule-matrix-compact .schedule-matrix-table tbody tr:nth-child(even) .sticky-course,
.schedule-matrix-compact .schedule-matrix-table tbody tr:nth-child(even) .sticky-section { background: #fbfdff; }
.schedule-matrix-compact .schedule-matrix-table .sticky-course { min-width: 260px; max-width: 260px; }
.schedule-matrix-compact .schedule-matrix-table .sticky-section { left: 260px; min-width: 86px; max-width: 86px; text-align: center; }
.schedule-matrix-compact .schedule-week-heading,
.schedule-matrix-compact .schedule-week-cell { min-width: 98px; width: 98px; }
.schedule-matrix-compact .schedule-week-heading strong { font-size: .82rem; }
.schedule-matrix-compact .schedule-week-heading small { font-size: .64rem; }
.schedule-matrix-compact .schedule-week-cell { height: 38px; }
.schedule-matrix-compact .schedule-matrix-item {
    display: flex;
    align-items: stretch;
    gap: 0;
    width: max-content;
    max-width: 100%;
    margin: 1px auto 2px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none;
    line-height: 1;
}
.schedule-matrix-compact .schedule-matrix-item:last-child { margin-bottom: 1px; }
.schedule-matrix-compact .schedule-matrix-item.schedule-status-done .matrix-activity-code::after {
    content: "✓";
    margin-left: 3px;
    font-size: .68rem;
}
.schedule-matrix-compact .schedule-matrix-item.schedule-status-grades .matrix-activity-date {
    box-shadow: inset 0 -3px 0 #f59e0b;
}
.schedule-matrix-compact .week-group-end { border-right: 2px dashed #2563eb !important; }

@media (max-width: 980px) {
    .schedule-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .schedule-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cycle-dates-card { grid-template-columns: 1fr 1fr; }
    .cycle-dates-card > div { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
    .schedule-filter-grid,
    .schedule-summary-grid,
    .cycle-dates-card { grid-template-columns: 1fr; }
    .schedule-heading-actions,
    .schedule-filter-actions { align-items: stretch; flex-direction: column; }
    .schedule-heading-actions .btn,
    .schedule-filter-actions .btn { width: 100%; text-align: center; }
}

@media print {
    @page { size: landscape; margin: 8mm; }
    body { background: #fff; font-size: 9pt; }
    .topbar,
    .no-print { display: none !important; }
    .print-only { display: block !important; }
    main .container { max-width: none; padding: 0; }
    .schedule-page { gap: 10px; }
    .card { border: 0; box-shadow: none; border-radius: 0; }
    .schedule-list-card,
    .schedule-matrix-card { overflow: visible; }
    .schedule-matrix-wrap { overflow: visible; max-height: none; margin-top: 0; }
    .schedule-matrix-table { min-width: 0; width: 100%; font-size: 5.8pt; }
    .schedule-matrix-table th,
    .schedule-matrix-table td { position: static !important; padding: 2px; }
    .schedule-matrix-table .sticky-course { min-width: 72px; max-width: 72px; }
    .schedule-matrix-table .sticky-section { min-width: 34px; max-width: 34px; }
    .schedule-week-heading,
    .schedule-week-cell { min-width: 31px; }
    .schedule-matrix-item { padding: 2px; margin-bottom: 2px; border-left-width: 2px; }
    .schedule-matrix-item small { display: none; }
    .schedule-matrix-compact .schedule-matrix-table .sticky-course { min-width: 75px; max-width: 75px; }
    .schedule-matrix-compact .schedule-matrix-table .sticky-section { min-width: 30px; max-width: 30px; }
    .schedule-matrix-compact .schedule-week-heading,
    .schedule-matrix-compact .schedule-week-cell { min-width: 30px; width: auto; }
    .schedule-matrix-compact .schedule-matrix-item { display: flex; padding: 0; margin: 0 0 1px; border: 0; }
    .schedule-matrix-compact .matrix-activity-code,
    .schedule-matrix-compact .matrix-activity-date { min-height: 0; padding: 1px 2px; font-size: 5.2pt; }
    .activity-table th,
    .activity-table td { padding: 5px; font-size: 8pt; }
}
