/* Timetable module: weekly grids, the builder, master timetable, print layouts. */
.tt-wrap { overflow-x: auto; }
.tt-grid { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); font-size: .92rem; }
.tt-grid th, .tt-grid td { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); padding: .35rem .4rem; vertical-align: top; }
.tt-grid tr > :last-child { border-right: 0; }
.tt-grid tbody tr:last-child > * { border-bottom: 0; }
.tt-grid thead th { background: var(--surface-2); font-weight: 600; text-align: left; position: sticky; top: 0; }
.tt-grid th.tt-time { width: 6.5rem; background: var(--surface-2); font-weight: 500; white-space: nowrap; }
.tt-grid td.tt-cell { min-width: 8.5rem; height: 3.4rem; }
.tt-grid .tt-today { background: var(--accent-soft); }
.tt-grid thead th.tt-today { background: var(--accent-soft); }
.tt-grid tr.tt-break td { background: var(--grey-soft); color: var(--muted); text-align: center; font-size: .82rem; padding: .2rem; }
.tt-grid tr.tt-break th { background: var(--grey-soft); color: var(--muted); font-size: .8rem; padding: .2rem .4rem; }
.tt-grid td.tt-breakcell { background: var(--grey-soft); color: var(--muted); font-size: .8rem; text-align: center; }
.tt-grid td.tt-none { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 6px, var(--surface) 6px, var(--surface) 12px); }
.tt-ptime { font-size: .72rem; color: var(--muted); margin-bottom: .15rem; }
.tt-lesson { border-left: 4px solid var(--accent); background: var(--surface-2); border-radius: 4px; padding: .2rem .35rem; margin-bottom: .2rem; position: relative; line-height: 1.25; }
.tt-lesson:last-child { margin-bottom: 0; }
.tt-lesson.tt-cover { background: var(--amber-soft); }
.tt-subj { font-weight: 600; font-size: .86rem; }
.tt-sub { font-size: .76rem; color: var(--muted); }
.tt-covered { color: var(--amber); font-weight: 600; }
.tt-tag { font-size: .66rem; text-transform: uppercase; letter-spacing: .03em; background: var(--purple-soft); color: var(--purple); border-radius: 3px; padding: 0 .25rem; font-weight: 600; vertical-align: middle; }
.tt-tools { position: absolute; top: 1px; right: 1px; display: none; gap: 0; }
.tt-tools form { display: inline; }
.tt-tools .btn { padding: .05rem .2rem; min-height: 0; line-height: 1; }
.tt-tools .tt-on { color: var(--accent); }
.tt-lesson:hover .tt-tools { display: flex; }
.tt-side { grid-template-columns: minmax(0, 1fr) 300px; }

/* builder */
.tt-editable td.tt-cell { cursor: default; }
.tt-editable td.tt-ok { background: var(--green-soft); cursor: pointer; box-shadow: inset 0 0 0 2px var(--green); }
.tt-editable td.tt-clash { background: var(--red-soft); }
.tt-editable td.tt-ok:hover { background: #cdeedb; }
.tt-pick { display: grid; grid-template-columns: 1fr auto; width: 100%; text-align: left; border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 6px; background: var(--surface); padding: .35rem .5rem; margin-bottom: .35rem; cursor: pointer; font: inherit; color: inherit; }
.tt-pick:hover { background: var(--surface-2); }
.tt-pick.active { box-shadow: 0 0 0 2px var(--accent); background: var(--accent-soft); }
.tt-pick-name { font-weight: 600; }
.tt-pick-sub { grid-column: 1; font-size: .78rem; color: var(--muted); }
.tt-pick-count { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.tt-hint { margin-bottom: .6rem; }

/* master timetable */
.tt-master { border-collapse: collapse; font-size: .74rem; background: var(--surface); }
.tt-master th, .tt-master td { border: 1px solid var(--border); padding: .12rem .18rem; vertical-align: top; min-width: 2.9rem; }
.tt-master thead th { background: var(--surface-2); text-align: center; font-weight: 600; }
.tt-master .tt-daystart { border-left: 2px solid var(--border-strong); }
.tt-master .tt-dayhead { border-left: 2px solid var(--border-strong); }
.tt-master th.tt-master-name { text-align: left; white-space: nowrap; background: var(--surface-2); position: sticky; left: 0; z-index: 1; min-width: 9rem; }
.tt-master td.tt-free { background: var(--surface); }
.tt-mini { border-left: 3px solid var(--accent); padding-left: .2rem; white-space: nowrap; line-height: 1.2; }
.tt-mini span { color: var(--muted); }
.tt-selected td { background: var(--accent-soft); }
.tt-issues { margin: 0; padding-left: 1.1rem; }
.tt-issues li { margin-bottom: .35rem; }
.tt-today-list li { display: block; }
.tt-avail select { width: 100%; font-size: .8rem; padding: .15rem; }
.tt-avail td.tt-mark-off { background: var(--red-soft); }
.tt-avail td.tt-mark-prefer_free { background: var(--amber-soft); }
.tt-block-level { margin: .3rem 0; }
.tt-block-level summary { cursor: pointer; font-weight: 600; }
.tt-cover-form select { max-width: 17rem; }

@media (max-width: 1000px) { .tt-side { grid-template-columns: 1fr; } }
@media print {
    .tt-grid { font-size: 9.5px; }
    .tt-grid td.tt-cell { height: auto; min-width: 0; }
    .tt-grid thead th { position: static; }
    .tt-lesson { background: #fff; }
    .tt-tools { display: none !important; }
    .tt-master { font-size: 7.5px; }
    .tt-master th.tt-master-name { position: static; min-width: 0; }
    .tt-paper { padding: 0; }
}
