:root {
    --bg: #f1f5f9;
    --card: #ffffff;
    --ink: #0f172a;
    --mut: #64748b;
    --line: #e2e8f0;
    --teal: #0d9488;
    --teal-d: #0f766e;
    --amber: #d97706;
    --amber-bg: #fffbeb;
    --radius: 16px;
    --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 8px 24px -12px rgba(15, 23, 42, .15);
    --rh: 56px;
}

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

html {
    scroll-behavior: smooth
}

body {
    font-family: 'Manrope', system-ui, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.5
}

header {
    background: linear-gradient(120deg, #134e4a 0%, #0f766e 45%, #0e7490 100%);
    color: #fff;
    padding: 38px 24px 88px;
    position: relative;
    overflow: hidden
}

header::after {
    content: "";
    position: absolute;
    right: -120px;
    top: -120px;
    width: 380px;
    height: 380px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .06)
}

header::before {
    content: "";
    position: absolute;
    left: -80px;
    bottom: -160px;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .05)
}

.head-in {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap
}

.logo {
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 18px;
    display: grid;
    place-items: center;
    flex: none
}

.logo svg {
    width: 36px;
    height: 36px
}

.kicker {
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: #99f6e4;
    margin-bottom: 4px
}

h1 {
    font-size: clamp(1.5rem, 3.4vw, 2.3rem);
    font-weight: 800;
    letter-spacing: -.02em
}

.head-sub {
    color: #ccfbf1;
    font-size: .95rem;
    margin-top: 6px;
    max-width: 640px
}

.head-stats {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap
}

.hstat {
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 12px;
    padding: 8px 16px;
    font-size: .85rem;
    backdrop-filter: blur(4px)
}

.hstat b {
    font-size: 1.05rem;
    font-weight: 800
}

.filters-wrap {
    max-width: 1200px;
    margin: -56px auto 0;
    padding: 0 24px;
    position: relative;
    z-index: 3
}

.filters {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--line);
    padding: 18px
}

.grado-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px
}

.chip {
    border: 1.5px solid var(--line);
    background: #fff;
    color: var(--ink);
    font-family: inherit;
    font-size: .86rem;
    font-weight: 700;
    padding: 8px 18px;
    border-radius: 999px;
    cursor: pointer;
    transition: all .18s
}

.chip:hover {
    border-color: var(--teal);
    color: var(--teal-d);
    transform: translateY(-1px)
}

.chip.on {
    background: var(--teal);
    border-color: var(--teal);
    color: #fff;
    box-shadow: 0 6px 14px -6px rgba(13, 148, 136, .6)
}

.fgrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    align-items: end
}

.field label {
    display: block;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--mut);
    margin-bottom: 6px
}

.field select,
.field input {
    width: 100%;
    font-family: inherit;
    font-size: .9rem;
    padding: 10px 12px;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    outline: none;
    transition: border .15s, box-shadow .15s
}

.field select:focus,
.field input:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, .15)
}

.chk {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--ink);
    padding: 10px 0;
    cursor: pointer;
    user-select: none
}

.chk input {
    width: 17px;
    height: 17px;
    accent-color: var(--teal);
    cursor: pointer
}

.btn {
    font-family: inherit;
    font-size: .85rem;
    font-weight: 700;
    border: none;
    border-radius: 10px;
    padding: 11px 18px;
    cursor: pointer;
    transition: all .15s
}

.btn-clear {
    background: #fee2e2;
    color: #b91c1c
}

.btn-clear:hover {
    background: #fecaca
}

.btn-print {
    background: #e0f2fe;
    color: #0369a1
}

.btn-print:hover {
    background: #bae6fd
}

.btn-file {
    background: #ccfbf1;
    color: #115e59
}

.btn-file:hover {
    background: #99f6e4
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 26px 24px 60px
}

.res-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px
}

.res-count {
    font-size: .95rem;
    color: var(--mut)
}

.res-count b {
    color: var(--ink)
}

.legend {
    display: flex;
    gap: 8px;
    flex-wrap: wrap
}

.lg {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .72rem;
    font-weight: 700;
    color: var(--mut)
}

.lg i {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    display: inline-block
}

.view-toggle {
    display: inline-flex;
    background: #e2e8f0;
    border-radius: 12px;
    padding: 4px;
    gap: 4px
}

.vt {
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: .85rem;
    font-weight: 700;
    color: #475569;
    padding: 9px 18px;
    border-radius: 9px;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap
}

.vt.on {
    background: #fff;
    color: var(--teal-d);
    box-shadow: 0 2px 6px rgba(15, 23, 42, .12)
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform .18s, box-shadow .18s;
    animation: fade .3s ease
}

@keyframes fade {
    from {
        opacity: 0;
        transform: translateY(8px)
    }

    to {
        opacity: 1;
        transform: none
    }
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px -12px rgba(15, 23, 42, .25)
}

.card-top {
    padding: 16px 16px 12px;
    border-top: 4px solid var(--acc, #94a3b8)
}

.tagrow {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 10px
}

.tag {
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .04em;
    padding: 4px 10px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid var(--line)
}

.tag.gr {
    background: #ccfbf1;
    color: #115e59;
    border-color: #99f6e4
}

.tag.cl {
    background: #cffafe;
    color: #155e75;
    border-color: #a5f3fc
}

.tag.hs {
    background: #ede9fe;
    color: #5b21b6;
    border-color: #ddd6fe
}

.tag.cc {
    color: #fff;
    border: none
}

.cc-Definitiva {
    background: #059669
}

.cc-Interina {
    background: #d97706
}

.cc-PT {
    background: #0284c7
}

.cc-IT {
    background: #7c3aed
}

.cc-Jubilado {
    background: #64748b
}

.cc-Licencia {
    background: #e11d48
}

.cc-OT {
    background: #94a3b8
}

.ua {
    font-size: 1.02rem;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: -.01em
}

.clave {
    font-size: .74rem;
    color: var(--mut);
    font-weight: 600;
    margin-top: 3px
}

.prof-row {
    margin-top: 10px;
    display: flex;
    align-items: flex-start;
    gap: 8px
}

.prof-ico {
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #f0fdfa;
    color: var(--teal-d);
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: .8rem;
    border: 1px solid #99f6e4
}

.prof-name {
    font-size: .9rem;
    font-weight: 700;
    color: #134e4a
}

.prof-link {
    cursor: pointer;
    border-bottom: 1px dashed #5eead4
}

.prof-link:hover {
    color: var(--teal)
}

.vacante {
    margin-top: 10px;
    background: var(--amber-bg);
    border: 1px dashed #fcd34d;
    border-radius: 10px;
    padding: 9px 12px;
    font-size: .82rem;
    color: #92400e;
    display: flex;
    gap: 8px;
    align-items: flex-start
}

.vacante b {
    font-weight: 800
}

.sessions {
    padding: 0 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px
}

.sess {
    display: grid;
    grid-template-columns: 1.35fr 1fr 1fr;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: .78rem;
    align-items: center
}

.sess .sd {
    font-weight: 700;
    color: #334155
}

.sess .sh {
    color: #0f766e;
    font-weight: 700;
    white-space: nowrap
}

.sess .sa {
    color: #475569;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0
}

.sess .sa span {
    overflow: hidden;
    text-overflow: ellipsis
}

.sess-head {
    display: grid;
    grid-template-columns: 1.35fr 1fr 1fr;
    gap: 8px;
    padding: 0 10px;
    font-size: .64rem;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: #94a3b8
}

.espacio {
    margin: 0 16px 12px;
    font-size: .78rem;
    font-weight: 600;
    color: #155e75;
    background: #ecfeff;
    border: 1px solid #a5f3fc;
    border-radius: 10px;
    padding: 8px 12px;
    display: flex;
    gap: 8px;
    align-items: center
}

.motivo-note {
    margin: 0 16px 12px;
    font-size: .78rem;
    color: #92400e;
    background: var(--amber-bg);
    border-radius: 10px;
    padding: 8px 12px
}

.extra {
    margin-top: auto;
    border-top: 1px dashed var(--line);
    padding: 10px 16px;
    font-size: .75rem;
    color: var(--mut);
    display: flex;
    flex-direction: column;
    gap: 3px
}

.extra b {
    color: #475569
}

.empty {
    text-align: center;
    padding: 70px 20px;
    color: var(--mut)
}

.empty .big {
    font-size: 3rem;
    margin-bottom: 10px
}

.empty h3 {
    color: var(--ink);
    font-size: 1.15rem;
    margin-bottom: 6px
}

.cal-note {
    font-size: .9rem;
    color: var(--mut);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap
}

.cal-note b {
    color: var(--ink)
}

.cal-scroll {
    overflow-x: auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow)
}

.cal-grid {
    display: grid;
    min-width: 920px
}

.cal-corner {
    position: sticky;
    left: 0;
    z-index: 6;
    background: #f8fafc;
    border-bottom: 2px solid var(--line);
    border-right: 1px solid var(--line);
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 6px 8px;
    font-size: .6rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #94a3b8
}

.cal-dayh {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: .85rem;
    color: #134e4a;
    background: #f0fdfa;
    border-bottom: 2px solid var(--line);
    border-right: 1px solid var(--line)
}

.cal-hours {
    position: sticky;
    left: 0;
    z-index: 5;
    background: #f8fafc;
    border-right: 1px solid var(--line)
}

.cal-hlabel {
    position: absolute;
    right: 8px;
    transform: translateY(-55%);
    font-size: .68rem;
    font-weight: 700;
    color: var(--mut);
    white-space: nowrap
}

.cal-col {
    position: relative;
    border-right: 1px solid var(--line);
    background-image: repeating-linear-gradient(to bottom, var(--line) 0, var(--line) 1px, transparent 1px, transparent var(--rh))
}

.cal-block {
    position: absolute;
    border-radius: 8px;
    padding: 4px 6px;
    font-size: .64rem;
    line-height: 1.3;
    color: #fff;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(15, 23, 42, .25);
    border-left: 3px solid rgba(0, 0, 0, .28);
    transition: transform .12s, box-shadow .12s;
    z-index: 2
}

.cal-block:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 16px rgba(15, 23, 42, .35);
    z-index: 4
}

.cal-block b {
    display: block;
    font-size: .66rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.cal-block .cmeta {
    opacity: .9;
    font-weight: 600;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.cal-block .ctime {
    display: block;
    font-weight: 800;
    font-size: .62rem;
    opacity: .95
}

.cal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px
}

.clg {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 5px 12px;
    font-size: .74rem;
    font-weight: 700;
    color: #334155;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .05)
}

.clg i {
    width: 11px;
    height: 11px;
    border-radius: 4px;
    flex: none
}

.clg small {
    color: var(--mut);
    font-weight: 600
}

.cal-msg {
    padding: 60px 30px;
    text-align: center;
    color: var(--mut);
    font-size: .95rem
}

.cal-msg b {
    color: var(--ink)
}

.load-error {
    max-width: 720px;
    margin: 10px auto 30px;
    background: #fff;
    border: 1.5px solid #fcd34d;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px
}

.load-error h3 {
    color: #92400e;
    margin-bottom: 8px;
    font-size: 1.05rem
}

.load-error p {
    font-size: .86rem;
    color: var(--mut);
    margin-bottom: 10px
}

.load-error code {
    background: #f1f5f9;
    border-radius: 6px;
    padding: 2px 7px;
    font-size: .8rem;
    color: #0f766e;
    font-weight: 700
}

.load-error .actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
    align-items: center
}

footer {
    background: #0f172a;
    color: #94a3b8;
    text-align: center;
    padding: 26px 20px;
    font-size: .8rem
}

footer b {
    color: #e2e8f0
}

@media (max-width:640px) {
    header {
        padding: 28px 18px 80px
    }

    .filters-wrap {
        padding: 0 14px
    }

    main {
        padding: 20px 14px 50px
    }

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

    .res-bar {
        flex-direction: column;
        align-items: flex-start
    }
}

@media print {
    header {
        padding: 10px;
        background: #fff;
        color: #000
    }

    .filters-wrap,
    .res-bar,
    .btn,
    footer,
    .cal-legend,
    .view-toggle,
    .load-error {
        display: none !important
    }

    body {
        background: #fff
    }

    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc
    }

    .cal-scroll {
        overflow: visible;
        box-shadow: none
    }

    .cal-block {
        box-shadow: none;
        border: 1px solid rgba(0, 0, 0, .3);
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact
    }
}