/* ── Timetable Grid ───────────────────────────── */
.tt-grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.tt-grid th,
.tt-grid td {
    border: 1px solid var(--cui-border-color, #d8dbe0);
    text-align: center;
    vertical-align: top;
    padding: 0;
}
.tt-grid thead th {
    background: var(--cui-tertiary-bg, #ebedef);
    padding: 0.5rem 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 2;
}
.tt-grid thead th.tt-day-header {
    min-width: 50px;
}
.tt-grid thead th.tt-period-header {
    min-width: 100px;
}
.tt-grid tbody th {
    background: var(--cui-tertiary-bg, #ebedef);
    padding: 0.5rem 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    width: 60px;
}
.tt-grid tbody th .tt-time {
    display: block;
    font-size: 0.65rem;
    font-weight: 400;
    color: var(--cui-secondary-color, #6c757d);
}

/* ── Slot cell ────────────────────────────────── */
.tt-cell {
    min-height: 70px;
    padding: 0.35rem 0.4rem;
    cursor: default;
    transition: background 0.15s;
    position: relative;
}
.tt-cell:hover {
    filter: brightness(0.95);
}
.tt-cell-empty {
    background: transparent;
}

/* ── Course type colours ──────────────────────── */
.tt-cell-theory   { background: var(--cui-info-bg-subtle, #d1ecf1);    }
.tt-cell-lab      { background: var(--cui-success-bg-subtle, #d1e7dd); }
.tt-cell-project  { background: var(--cui-warning-bg-subtle, #fff3cd); }
.tt-cell-seminar  { background: var(--cui-primary-bg-subtle, #cfe2ff); }
.tt-cell-elective { background: var(--cui-secondary-bg-subtle, #e2e3e5); }
.tt-cell-audit    { background: var(--cui-light, #f8f9fa); }

/* ── Cell content ─────────────────────────────── */
.tt-cell .tt-code {
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--cui-emphasis-color, #000);
}
.tt-cell .tt-name {
    font-size: 0.7rem;
    color: var(--cui-secondary-color, #6c757d);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
    margin: 0 auto;
}
.tt-cell .tt-faculty {
    font-size: 0.68rem;
    color: var(--cui-tertiary-color, #9da5b1);
    margin-top: 2px;
}
.tt-cell .tt-room {
    font-size: 0.65rem;
    color: var(--cui-tertiary-color, #9da5b1);
}

/* ── Lunch break row ──────────────────────────── */
.tt-lunch {
    background: repeating-linear-gradient(
        45deg,
        var(--cui-tertiary-bg, #ebedef),
        var(--cui-tertiary-bg, #ebedef) 5px,
        transparent 5px,
        transparent 10px
    );
    text-align: center;
    padding: 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--cui-secondary-color, #6c757d);
}

/* ── Admin slot management — clickable cells ──── */
.tt-cell-clickable {
    cursor: pointer;
}
.tt-cell-clickable:hover {
    box-shadow: inset 0 0 0 2px var(--cui-primary, #321fdb);
}
.tt-cell-clickable.tt-cell-empty:hover {
    background: var(--cui-primary-bg-subtle, #cfe2ff);
}

/* ── Faculty schedule — multi-batch indicator ─── */
.tt-cell .tt-section-badge {
    display: inline-block;
    font-size: 0.6rem;
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--cui-primary, #321fdb);
    color: #fff;
    font-weight: 600;
}

/* ── Legend ────────────────────────────────────── */
.tt-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.8rem;
    padding: 0.5rem 0;
}
.tt-legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.tt-legend-swatch {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid var(--cui-border-color, #d8dbe0);
}

/* ── Print-friendly ───────────────────────────── */
@media print {
    .tt-grid { font-size: 9pt; }
    .tt-cell { min-height: 50px; }
    .page-header button, .card-header button { display: none; }
}
