/* Печать «Мастера»: окно настроек и документ для печати (он живёт в iframe и всегда светлый). */

/* --- содержимое листа: таблицы «Мастера» без интерфейсных ограничений */
.pt-doc { width: max-content; transform-origin: 0 0; background: #fff; color: #111; }
#ptMeasure { position: fixed; left: -99999px; top: 0; visibility: hidden; }
.pt-doc .mwrap { max-height: none; overflow: visible; border: 0; margin-bottom: 10px; background: #fff; }
.pt-doc .mtable { border-collapse: collapse; }
.pt-doc .mtable thead th, .pt-doc .mtable .sd, .pt-doc .mtable .st, .pt-doc .mtable .sn, .pt-doc .mteachers .sg { position: static; }
.pt-doc .mc { cursor: default; }
/* «растянуть на лист»: ширину задаёт таблица (targetW), высоту строк — множитель --ky; шрифт не меняется */
.pt-doc .mclasses td { height: calc(34px * var(--ky, 1)); }
.pt-doc .mc { min-height: calc(34px * var(--ky, 1)); }
.pt-doc .mteachers.mfixed td.pc { height: calc(30px * var(--ky, 1)); }
.pt-doc .pt-title { font: 600 13px/1.3 var(--font, sans-serif); margin: 0 0 6px; }
.pt-doc .mcap { font-size: 13px; }

/* --- документ в iframe */
html, body.pt-body { margin: 0; background: #fff; }
.pt-sheet { position: relative; box-sizing: border-box; overflow: hidden; background: #fff; page-break-after: always; break-after: page; }
.pt-sheet:last-child { page-break-after: auto; break-after: auto; }
.pt-clip { overflow: hidden; position: relative; }
.pt-num { position: absolute; right: 4mm; bottom: 2mm; font: 9px sans-serif; color: #888; }
body.pv { display: grid; gap: 8px; background: #d5d9e0; padding: 0; width: max-content; }
body.pv .pt-sheet { box-shadow: 0 1px 4px rgba(0, 0, 0, .3); }
@media print { body.pv { display: block; background: #fff; } .pt-sheet { box-shadow: none; } }

/* --- окно настроек */
.modal.print-modal { width: min(1120px, 96vw); height: min(92vh, 900px); max-height: 92vh; padding: 0; display: grid; grid-template-columns: 340px minmax(0, 1fr); overflow: hidden; }
.pm-side { padding: 18px 18px 14px; overflow-y: auto; border-right: 1px solid var(--line); max-height: 92vh; }
.pm-side h3 { font-size: 17px; margin-bottom: 12px; }
.pm-sec { margin-bottom: 16px; }
.pm-h { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.pm-h .muted { text-transform: none; letter-spacing: 0; font-weight: 400; }
.pm-links { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 400; }
.pm-rows { max-height: 210px; overflow-y: auto; border: 1px solid var(--line-2); border-radius: var(--r); padding: 8px; }
.pm-grp { margin-bottom: 8px; }
.pt-grp { margin-bottom: 8px; }
.pt-grp .link { font-size: 12px; margin-bottom: 4px; }
.pm-rows .rchips { max-height: none; margin-bottom: 4px; gap: 4px; }
.pm-rows .rchip { padding: 2px 8px; font-size: 12px; }
.pm-checks { display: flex; flex-direction: column; gap: 6px; }
.pm-line { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13px; }
.pm-step { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.pm-step b { min-width: 18px; text-align: center; color: var(--ink); font-size: 15px; }
.pm-step button { width: 26px; height: 26px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm); cursor: pointer; font-size: 15px; line-height: 1; color: var(--ink); }
.pm-step button:hover { border-color: var(--accent); color: var(--accent); }
.pm-main { padding: 18px; display: flex; flex-direction: column; min-width: 0; max-height: 92vh; }
.pm-info { font-size: 13px; margin-bottom: 10px; min-height: 20px; }
.pm-view { flex: 1; overflow: auto; background: var(--hover); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px; min-height: 240px; }
.pm-frame { position: relative; overflow: hidden; margin: 0 auto; }
.pm-frame iframe { position: absolute; left: 0; top: 0; border: 0; transform-origin: 0 0; background: transparent; }
.pm-main .modal-btns { margin-top: 12px; }
.pm-main .btn svg { margin-right: 4px; }
@media (max-width: 900px) { .modal.print-modal { grid-template-columns: 1fr; overflow-y: auto; } .pm-side { max-height: none; border-right: 0; } }
@media print { .pt-modal-wrap { display: none !important; } }

/* --- оформление листа: темы задают переменные на .pt-doc (print.js → THEMES), здесь они применяются */
.pt-doc .mtable th, .pt-doc .mtable td { border-color: var(--pt-line, #d6dae2); }
.pt-doc .mtable thead th { background: var(--pt-head, #eceff4); color: var(--pt-head-ink, #111); }
.pt-doc .mtable .sd, .pt-doc .mtable .st, .pt-doc .mtable .sn, .pt-doc .mteachers .sg { background: var(--pt-side, #f4f6f9); color: var(--pt-ink, #111); }
.pt-doc .mclasses tr.sum td { background: var(--pt-side, #f7f8fb); }
.pt-doc .mclasses td.mc-empty { background: var(--pt-empty, #fbfbfc); }
.pt-doc .mteachers th.kt, .pt-doc .mteachers td.ktc { background: var(--pt-side, #eef1f6); }
.pt-doc .mteachers td[data-key] { background: var(--pt-lesson, #e0e7ff); color: var(--pt-lesson-ink, #1e3a8a); }
.pt-doc .mteachers td.extra { background: var(--pt-extra, #e4e4e4); color: var(--pt-ink, #555); }
.pt-doc .mteachers tr.grow td, .pt-doc .mteachers tr.grow td.st { background: var(--pt-group, #dde3ee); color: var(--pt-ink, #2d3548); }
.pt-doc .mc { color: var(--pt-ink, #111); }
.pt-doc[data-bold] .mc .ms, .pt-doc[data-bold] .mteachers td.pc b { font-weight: 800; }
.pt-doc[data-grid="strong"] .mtable th, .pt-doc[data-grid="strong"] .mtable td { border-width: 0 1.5px 1.5px 0; }

/* --- на весь экран */
.pt-modal-wrap.pm-full { padding: 0; }
.pt-modal-wrap.pm-full .modal.print-modal { width: 100vw; height: 100vh; max-height: none; border-radius: 0; }
.pt-modal-wrap.pm-full .pm-side, .pt-modal-wrap.pm-full .pm-main { max-height: 100vh; }
.pt-modal-wrap.pm-full.pm-nopanel .modal.print-modal { grid-template-columns: minmax(0, 1fr); }
.pt-modal-wrap.pm-full.pm-nopanel .pm-side { display: none; }
.pm-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.pm-top .pm-info { flex: 1; margin: 0; min-width: 240px; }
.pm-themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
.pm-theme { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 6px; cursor: pointer; text-align: left; font-size: 11.5px; color: var(--ink-2); }
.pm-theme:hover { border-color: var(--accent); }
.pm-theme.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--accent-soft); }
.pm-sw { display: flex; height: 12px; border-radius: 3px; overflow: hidden; margin-bottom: 4px; border: 1px solid rgba(0,0,0,.15); }
.pm-sw i { flex: 1; }
.pm-days { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.pm-days .rchip { min-width: 40px; text-align: center; }
.pm-days .rchip.off { opacity: .45; border-style: dashed; cursor: help; }
.pm-rh { font-size: 12px; color: var(--muted); margin: 6px 0 4px; }
.pm-rr { display: flex; align-items: center; gap: 6px; font-size: 12.5px; margin-bottom: 4px; color: var(--muted); }
.pm-rr span { width: 26px; font-weight: 600; color: var(--ink); }
.pm-rr select { height: 26px; padding: 0 4px; width: 56px; }

/* --- раскраска и пометки */
.pm-pal { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin-bottom: 4px; }
.pm-col { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(0,0,0,.25); cursor: pointer; padding: 0; }
.pm-col.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.pm-pal input[type=color] { width: 26px; height: 24px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: none; }
.pm-days .rchip.extra { border-style: dashed; }
.pt-doc .pt-note { font: 600 9.5px/1.15 var(--font, sans-serif); color: #111; margin-top: 1px; white-space: normal; }
.pt-doc .mteachers td .pt-note { font-size: 8.5px; font-weight: 600; }
.pm-view { position: relative; }

/* --- лупа */
.pm-zoom { display: inline-flex; align-items: center; gap: 4px; }
.pm-zoom button { height: 28px; min-width: 28px; padding: 0 8px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm); cursor: pointer; color: var(--ink); font-size: 13px; }
.pm-zoom button:hover { border-color: var(--accent); color: var(--accent); }
.pm-zoom span { min-width: 44px; text-align: center; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pm-view.zoomed { cursor: grab; }
.pm-view.panning { cursor: grabbing; user-select: none; }
.pm-view.panning iframe { pointer-events: none; }

/* --- подсветка кабинетов: легенда под таблицей, выбор кабинетов в окне */
.pt-doc .pt-legend { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 4px 0 8px; font: 600 10px/1 var(--font, sans-serif); }
.pt-doc .pt-legend i { font-style: normal; padding: 2px 6px; border-radius: 3px; border: 1px solid rgba(0,0,0,.15); color: #111; }
.pm-hlk { font-size: 12px; margin-bottom: 6px; }
.pm-hlr { max-height: 130px; overflow-y: auto; gap: 4px; }
.pm-hlr .rchip { padding: 2px 8px; font-size: 12px; }
.pt-doc .mteachers th.kr, .pt-doc .mteachers td.kr { background: var(--pt-side, #eef1f6); font-size: 10.5px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: static; }

/* --- панель раскраски над предпросмотром */
.pm-paint { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px 12px; margin: -2px 0 8px; }
.pm-paint .pm-pl { font-weight: 700; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); }
.pm-paint .pm-ph { order: -1; flex: 1 1 200px; min-width: 160px; font-size: 12px; color: var(--ink-2); text-align: left; }
.pm-paint .pm-pal { margin: 0; flex-wrap: nowrap; }
.pm-paint .seg button { padding: 4px 10px; font-size: 13px; }
