/* Tantárgyfelosztás – alapstílusok */
[hidden] { display: none !important; }
:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --text: #1f2933;
    --muted: #525d69;          /* AA-kontraszt a színezett hátterek előtt is */
    --border: #d9dee4;
    --primary: #1d4f91;        /* az iskola honlapjának kékje */
    --primary-dark: #163d70;
    --primary-soft: #e3ebf6;   /* fejlécek, kiemelt sorok háttere */
    --primary-faint: #f2f6fb;  /* oszlopfejek, összegek háttere */
    --primary-line: #8ea4c2;   /* évfolyam- és blokkhatárok */
    --primary-border: #c3cfdf;
    --danger: #b42318;
    --warning-bg: #fff4d6;
    --error-bg: #fdecea;
    --success-bg: #e5f4e4;
    --info-bg: #e7f1fb;
    --radius: 6px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.45; }
a { color: var(--primary); }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }

.topbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem;
    background: var(--primary); color: #fff; padding: .6rem 1.25rem;
}
.brand { display: flex; flex-direction: column; line-height: 1.2; color: inherit; text-decoration: none; border-radius: var(--radius); padding: .15rem .35rem; margin-left: -.35rem; }
.brand:hover { background: rgba(255, 255, 255, .12); }
.brand-school { font-weight: 700; font-size: 1.05rem; }
.brand-app { font-size: .8rem; opacity: .85; }
.mainnav { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; }
.mainnav a { color: #fff; text-decoration: none; padding: .35rem .5rem; font-size: .95rem; border-radius: var(--radius); }
.mainnav a:hover, .mainnav a.active { background: rgba(255, 255, 255, .18); }
.usermenu { display: flex; align-items: center; gap: .8rem; font-size: .9rem; }
.usermenu a, .usermenu .linklike { color: #fff; }
/* Felhasználói menü: a név a gomb, a lenyíló rész jobbra igazodik. */
.usermenu-dd .navmore-menu { left: auto; right: 0; }
.usermenu-dd summary { white-space: nowrap; }
.usermenu .navmore-menu a { color: var(--text); }
.menu-button { display: block; width: 100%; background: none; border: 0; font: inherit; color: var(--text); text-align: left; padding: .4rem .6rem; border-radius: 4px; cursor: pointer; }
.menu-button:hover { background: #f0f2f4; }
.navmore-menu form { margin: 0; }

.container { max-width: 1280px; margin: 0 auto; padding: 1.25rem; }
/* Rácsos nézetek (tantárgyi, munkaközösségi, osztálynézet, kiosztatlan órák): teljes szélesség. */
body.wide .container { max-width: none; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-bottom: 1.25rem; }
.card.narrow { max-width: 460px; margin: 2rem auto; }
.card.narrow-wide { max-width: 780px; margin: 1.5rem auto; }
/* Kétlépcsős belépés */
.code-input { font-size: 1.25rem; letter-spacing: .12em; font-variant-numeric: tabular-nums; max-width: 14ch; }
.setup-steps > li { margin-bottom: 1rem; }
.qr { margin: .6rem 0; }
.qr svg { display: block; width: 200px; height: 200px; border: 1px solid var(--border); border-radius: 4px; }
code.secret { font-size: 1rem; word-break: break-all; background: var(--bg); padding: .1rem .3rem; border-radius: 3px; }
.inline-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .4rem; }
.card h2.mt { margin-top: 1.5rem; }
.recovery-box { border: 2px solid #e0b25c; background: var(--warning-bg); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: 1rem; }
.recovery-box h2 { margin-top: 0; }
.recovery-codes { columns: 2; font-size: 1.1rem; padding-left: 1.6rem; }
.recovery-codes code { font-family: ui-monospace, Menlo, Consolas, monospace; }
.card.subtle { background: var(--bg); box-shadow: none; margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 1.25rem; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .card { margin-top: 1.25rem; }
.pagehead { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.pagehead h1 { margin: 0; }
.pagehead-links { display: flex; gap: 1rem; flex-wrap: wrap; }
.summary-link { margin-left: .4rem; font-size: .8rem; color: var(--muted); }
.summary-link:hover, .summary-link:focus-visible { color: var(--primary-dark); }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.pre { white-space: pre-wrap; }
ul.plain { padding-left: 1.1rem; margin: 0; }
ul.plain li { margin: .25rem 0; }

.flash { padding: .6rem .9rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid transparent; }
.flash-success { background: var(--success-bg); border-color: #b9dfb6; }
.flash-error { background: var(--error-bg); border-color: #f3c1bc; }
.flash-warning { background: var(--warning-bg); border-color: #f0d792; }
.flash-info { background: var(--info-bg); border-color: #bcd6f1; }

.field { margin-bottom: .9rem; }
.field label { display: block; font-weight: 600; margin-bottom: .25rem; }
.field.check label { font-weight: normal; }
.rights-table + h2 { margin-top: 1.6rem; }
.rights-table td.rights-level { white-space: nowrap; font-weight: 600; }
.rights-table td.rights-0 { color: var(--muted); font-weight: normal; }
.exception-field > summary { font-weight: 600; cursor: pointer; }
.exception-table select, .exception-table input[type=date] { width: auto; max-width: 100%; }
.exception-table select { min-width: 13.5rem; }
.exception-table td:first-child { width: 40%; }
@media (max-width: 640px) {
    .exception-table thead { display: none; }
    .exception-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem; padding: .4rem 0; border-bottom: 1px solid var(--border); }
    .exception-table td { border: 0; padding: 0; }
    .exception-table td:first-child { grid-column: 1 / -1; width: auto; }
    .exception-table select, .exception-table input[type=date] { min-width: 0; width: 100%; }
}
.exception-table tr.exception-set td:first-child { font-weight: 600; }
.scope-field legend { font-weight: 600; margin-bottom: .25rem; }
.scope-field label.radio, .scope-field label.check { display: inline-flex; gap: .35rem; align-items: baseline; font-weight: normal; margin: 0 1rem .3rem 0; }
.scope-field .scope-choices { margin: .35rem 0 .4rem; padding: .5rem .6rem; border: 1px solid var(--border); border-radius: var(--radius); }
.scope-field .scope-choices label.check { min-width: 4.5rem; }
.field input:not([type=checkbox]):not([type=radio]), .field select, .filters input, .filters select {
    width: 100%; padding: .45rem .55rem; border: 1px solid var(--border); border-radius: var(--radius);
    font: inherit; background: #fff;
}
.field input:focus, .field select:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
.field.has-error input, .field.has-error select { border-color: var(--danger); }
.field .error { color: var(--danger); font-size: .85rem; margin-top: .2rem; }
.field .hint { color: var(--muted); font-size: .85rem; margin-top: .2rem; }
.req { color: var(--danger); }

.btn {
    display: inline-block; padding: .45rem .9rem; border: 1px solid var(--border); border-radius: var(--radius);
    background: #fff; color: var(--text); font: inherit; cursor: pointer; text-decoration: none;
}
.btn:hover { background: #f0f2f4; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { color: var(--danger); border-color: #f3c1bc; }
.btn.danger:hover { background: var(--error-bg); }
.btn.small { padding: .2rem .55rem; font-size: .85rem; }
.linklike { background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; cursor: pointer; }
form.inline { display: inline; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: .45rem .55rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table th { background: #f0f2f4; font-weight: 600; }
.table tr.inactive td { color: var(--muted); }
/* Rendezhető listák: az oszlopfejléc gomb, a rendezés jele és a „Rendezve: …” sor */
.table th .sort-btn { all: unset; box-sizing: border-box; cursor: pointer; display: inline-flex; align-items: baseline; gap: .25rem; font: inherit; color: inherit; text-align: inherit; }
.table th .sort-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 2px; }
.table th .sort-mark { font-size: .7rem; color: var(--muted); opacity: .45; }
.table th .sort-btn:hover .sort-mark { opacity: 1; }
.table th.sorted { background: #e3eee7; }
.table th.sorted .sort-mark { color: var(--primary); opacity: 1; }
.sort-note { font-size: .85rem; color: var(--muted); margin: 0 0 .4rem; }
.badge-teaches { background: var(--primary-soft); color: var(--primary-dark); }
.missing-hours { color: var(--danger); }
.sheet-links { margin: .25rem 0 .5rem; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); text-decoration: underline; cursor: pointer; }
.table.log .values { font-size: .8rem; max-width: 280px; }
.kv { display: inline-block; margin: 0 .4rem .15rem 0; }
.kv .k { color: var(--muted); }
tr.act-sikertelen_bejelentkezes td, tr.act-belepesi_korlat td, tr.act-gyanus_belepes td, tr.act-hozzaferes_megtagadva td, tr.act-kenyszeritett_feloldas td { background: #fff7f6; }

.badge { display: inline-block; font-size: .75rem; padding: .05rem .45rem; border-radius: 999px; background: #e3e7eb; color: var(--text); font-weight: 600; }
.badge-foadmin { background: #efedff; }
.badge-igazgato { background: #e5f4e4; }
.badge-igazgatohelyettes { background: #e7f1fb; }
.badge-munkakozossegvezeto { background: #fdf0e3; }
.badge-koordinator { background: #f1e9f9; }
.badge-warn { background: #f9eeda; color: #6b4e00; }
.copy-report { margin-bottom: 1rem; }

.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); gap: .75rem; align-items: end; }
.filters label { font-size: .85rem; font-weight: 600; display: flex; flex-direction: column; gap: .2rem; }
.filter-actions { display: flex; gap: .75rem; align-items: center; }
.pager { display: flex; gap: 1rem; justify-content: center; margin-top: 1rem; }

@media (max-width: 640px) {
    .container { padding: .75rem; }
    .usermenu { width: 100%; justify-content: space-between; }
}

/* --- 2. egység: törzsadat-felületek --- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.warn-text { color: #b54708; font-size: .85rem; }

.navmore { position: relative; }
.navmore summary { color: #fff; cursor: pointer; padding: .35rem .5rem; font-size: .95rem; border-radius: var(--radius); list-style: none; }
.navmore summary::-webkit-details-marker { display: none; }
.navmore summary::after { content: " ▾"; }
.navmore[open] summary, .navmore summary:hover, .navmore.has-active summary { background: rgba(255, 255, 255, .18); }
.navmore-menu {
    position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; min-width: 210px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .12); padding: .3rem; display: flex; flex-direction: column;
}
.navmore-menu a { color: var(--text); text-decoration: none; padding: .4rem .6rem; border-radius: 4px; }
.navmore-menu a:hover, .navmore-menu a.active { background: #f0f2f4; }
.yearswitch select { padding: .3rem .5rem; border-radius: var(--radius); border: 1px solid rgba(255, 255, 255, .5); font: inherit; font-size: .9rem; }
.yearswitch { display: flex; align-items: center; gap: .4rem; font-size: .85rem; }
.themeswitch select { padding: .25rem .35rem; border-radius: var(--radius); border: 1px solid rgba(255, 255, 255, .5); font: inherit; font-size: .85rem; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 1.25rem; }
.perm-table td.center, .perm-table th.center { text-align: center; }
.perm-table tbody th { font-weight: 500; }
.perm-table input[type="checkbox"] { width: 1.1rem; height: 1.1rem; }
.perm-changed { background: #fff4d6; }
.perm-swatch { padding: 0 .3rem; border-radius: 3px; }
.form-actions { display: flex; gap: 1rem; align-items: center; margin-top: 1rem; flex-wrap: wrap; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset:disabled input, fieldset:disabled select { background: #f4f5f7; color: var(--muted); }
.narrow-form { max-width: 560px; }
.building-list { display: grid; gap: .5rem; margin-bottom: 1rem; }
.building-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem 1rem; padding: .6rem .8rem; border: 1px solid var(--border); border-radius: var(--radius); }
.building-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem 1rem; }
.building-form .field { margin: 0; min-width: min(220px, 100%); }
.building-usage { margin: 0 0 .35rem; }
#epuletek { max-width: 900px; }
.building-filter { display: flex; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.pagehead .building-filter { margin-bottom: 0; }
.building-note { margin: 0 0 .5rem; }
.building-filter select { padding: .3rem .4rem; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; max-width: 100%; }
.building-checks { border: 0; padding: 0; margin: 1rem 0 0; }
.building-checks legend { font-weight: 600; padding: 0; margin-bottom: .4rem; }
.building-checks .checks { margin-bottom: .2rem; }
.checks { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; margin-bottom: 1rem; }
.checks.columns { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.checks label { display: flex; gap: .4rem; align-items: center; font-weight: 400; margin: 0; }
.field .checks input.hours-input { width: 6rem; }
legend { font-weight: 600; margin-bottom: .35rem; padding: 0; }
.filter-input { padding: .35rem .55rem; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; min-width: 240px; }
.danger-zone { margin: -.25rem 0 1.25rem; display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }

.table.compact td, .table.compact th { padding: .25rem .4rem; }
.table.compact input { width: 100%; padding: .3rem .45rem; border: 1px solid var(--border); border-radius: 4px; font: inherit; }
.narrow-table { max-width: 420px; }
.hours-input { max-width: 6rem; text-align: right; padding: .3rem .45rem; border: 1px solid var(--border); border-radius: 4px; font: inherit; }

.lock-chip { display: inline-block; margin-left: .4rem; font-size: .75rem; background: var(--warning-bg); border: 1px solid #f0d792; border-radius: 999px; padding: 0 .45rem; }
.lock-note { margin: -.5rem 0 .75rem; }

.toggle {
    display: inline-flex; align-items: center; gap: .4rem; border: 0; background: none; cursor: pointer;
    font: inherit; font-size: .85rem; color: var(--muted); padding: 0;
}
.toggle span { width: 30px; height: 17px; border-radius: 999px; background: #c5ccd3; position: relative; transition: background .15s; }
.toggle span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #fff; transition: left .15s; }
.toggle.on { color: var(--primary); font-weight: 600; }
.toggle.on span { background: var(--primary); }
.toggle.on span::after { left: 15px; }
.toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

/* Excel-szerű lapfülek és rács */
.sheet-tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 2px solid var(--primary); margin-bottom: 0; }
.sheet-tabs a {
    padding: .35rem .7rem; text-decoration: none; color: var(--text); background: #e9ecef;
    border: 1px solid var(--border); border-bottom: 0; border-radius: 4px 4px 0 0; font-size: .88rem;
}
.sheet-tabs a:hover { background: #dde2e6; }
.sheet-tabs a.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }
.card.sheet { border-top-left-radius: 0; border-top-right-radius: 0; }
.grid { border-collapse: collapse; font-size: .88rem; }
.grid th, .grid td { border: 1px solid #c9d0d6; padding: 0; text-align: center; min-width: 2.35rem; height: 1.9rem; }
.grid thead th { background: var(--primary-soft); font-weight: 600; padding: .2rem .35rem; }
.grid .grade-row th.grade { border-bottom-color: #c9d0d6; }
.grid th.sticky-col { position: sticky; left: 0; z-index: 1; background: var(--primary-faint); text-align: left; padding: .2rem .5rem; min-width: 9rem; font-weight: 600; }
.grid td.grade-start, .grid th.grade-start { border-left: 2px solid var(--primary-line); }
.grid .cell { width: 100%; min-width: 2.35rem; height: 1.9rem; border: 0; text-align: center; font: inherit; background: transparent; }
.grid .cell:focus { outline: 2px solid var(--primary); outline-offset: -2px; background: #fff; }
/* Tantárgyi nézet: keskenyebb osztályoszlopok, hogy több osztály férjen el. */
#sheet thead th.letter { padding: .2rem .1rem; }
#sheet td, #sheet th.letter, #sheet .cell { min-width: 1.85rem; }
#sheet input.cell { width: 1.85rem; min-width: 100%; }
#sheet td.total { min-width: 2.6rem; }
#sheet td.load { min-width: 5.5rem; }
#sheet.cards td[data-plan-c] { padding: .15rem .1rem; }
#sheet .hcard { min-width: 1.45rem; padding: 0 .2rem; }
#sheet.cards input.cell:not(:placeholder-shown) { width: calc(100% - .24rem); min-width: 1.45rem; margin: .17rem .12rem; }
html[data-density="kompakt"] #sheet td, html[data-density="kompakt"] #sheet th.letter, html[data-density="kompakt"] #sheet .cell { min-width: 1.6rem; }
html[data-density="tagas"] #sheet td, html[data-density="tagas"] #sheet th.letter, html[data-density="tagas"] #sheet .cell { min-width: 2.4rem; }
/* A szerkesztett cella sora és oszlopa (app.js): áttetsző kék réteg a cella saját színe fölött. */
.grid td.cross-row, .grid td.cross-col { box-shadow: inset 0 0 0 999px var(--cross, rgba(29, 79, 145, .09)); }
.grid th.cross-head { box-shadow: inset 0 0 0 999px var(--cross-head, rgba(29, 79, 145, .18)); color: var(--primary-dark); }
@media (forced-colors: active) { .grid td.cross-row, .grid td.cross-col, .grid th.cross-head { outline: 1px dotted CanvasText; outline-offset: -2px; } }
@media print { .grid .cross-row, .grid .cross-col, .grid .cross-head { box-shadow: none; } }
.grid td.total, .grid tfoot td { background: var(--primary-faint); font-weight: 600; padding: 0 .4rem; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.5rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.choice-list { border: 0; padding: 0; margin: 0; display: grid; gap: .6rem; }
.choice-list .confirm-line { margin-top: .4rem; padding: .5rem .75rem; border: 1px solid #f0d792; background: var(--warning-bg); border-radius: var(--radius); }

/* Keskenyebb asztali képernyőn a menü saját sort kap, hogy ne törjön szét. */
@media (max-width: 1480px) and (min-width: 641px) {
    .mainnav { order: 3; flex-basis: 100%; }
    .yearswitch { margin-left: auto; }
}

/* --- 3. egység: tantárgyi lapok --- */
.sheet-actions { display: flex; align-items: center; gap: .5rem .75rem; flex-wrap: wrap; }
.sheet-status { font-size: .9rem; color: var(--muted); min-height: 1.2em; }
.sheet-status.error { color: #b42318; font-weight: 600; }
.sheet-status.warning { color: #9a5b00; }
.tab-note { font-size: .7rem; color: var(--muted); }
.tab-missing { display: inline-block; margin-left: .3rem; min-width: 1.2rem; padding: 0 .35rem; border-radius: 999px; font-size: .72rem; font-weight: 700; line-height: 1.35; text-align: center; background: #fbe3e3; color: #8a1c1c; }
.tab-missing[hidden] { display: none; }
.sheet-tabs a.active .tab-missing { background: #fff; color: #8a1c1c; }
.sheet-tabs a.active .tab-note { color: inherit; opacity: .85; }
/* A nézetek táblázatai (2.12.1) nem görgetnek függőlegesen: az oldal görget, a fejléc és az összegsor az ablak
   széléhez tapad (app.js pinHeads: --pin-top / --pin-bottom eltolás), vízszintesen a táblázat maga görget. */
.sheet-wrap { overflow-x: auto; width: fit-content; max-width: 100%; border: 1px solid #c9d0d6; }
.pin-heads thead th { transform: translateY(var(--pin-top, 0)); }
.pin-heads tfoot th, .pin-heads tfoot td { transform: translateY(var(--pin-bottom, 0)); }
.sheet-grid { border: 0; }
.sheet-grid thead th { position: sticky; z-index: 2; height: 2rem; box-sizing: border-box; }
.sheet-grid thead tr.grade-row th { top: 0; }
.sheet-grid thead tr.letter-row th { top: 2rem; }
.sheet-grid thead th.corner { z-index: 4; }
.sheet-grid tbody th.sticky-col, .sheet-grid tfoot th.sticky-col { z-index: 1; }
.sheet-grid th.sticky-col { min-width: 13rem; max-width: 16rem; }
.sheet-grid .tname { display: inline; }
.sheet-grid tr.plan-row th, .sheet-grid tr.plan-row td { background: #f5f7fb; color: #33415a; font-style: italic; padding: 0 .3rem; }
.sheet-grid tbody tr.plan-row:last-of-type td, .sheet-grid tbody tr.plan-row:last-of-type th { border-bottom: 2px solid var(--primary-line); }
.sheet-grid tr.plan-info th, .sheet-grid tr.plan-info td { color: var(--muted); }
/* Folytonosság (2.16): a „Tavaly tanította” sor monogramjai, és nagyon halvány, nem mozdítható kártya abban a cellában,
   ahol tavaly a sor pedagógusa tanított (rajta a tavalyi óraszám); a valódi kártya vagy beírt óra mellett nem látszik. */
.sheet-grid tr.prev-row th, .sheet-grid tr.prev-row td { background: #f5f7fb; color: #4a5a70; padding: .1rem .15rem; border-bottom: 2px solid var(--primary-line); }
.sheet-grid tr.prev-row th { padding: .1rem .3rem; font-weight: 600; font-size: .85rem; }
.sheet-grid tr.prev-row th a { font-weight: 400; font-size: .75rem; margin-left: .3rem; }
.sheet-grid tr.prev-row td { text-align: center; font-size: .68rem; line-height: 1.2; white-space: normal; }
.prev-mono { display: block; white-space: nowrap; }
.sheet-grid tr.prev-row td.prev-same { color: #17633a; }
.sheet-grid tr.prev-row td.prev-part, .sheet-grid tr.prev-row td.prev-change, .prev-change-swatch { background: #fdf0cf; color: #6b4300; }
.sheet-grid tr.prev-row td.prev-change .prev-mono, .prev-change-swatch { text-decoration: line-through; }
.prev-change-swatch { padding: 0 .3rem; border-radius: 3px; }
.prev-ghost, .prev-ghost-swatch { box-sizing: border-box; border: 1px dashed #8fa3bd; border-radius: 6px; color: #53657c; font-weight: 600; font-style: normal; }
.prev-ghost { position: absolute; left: .2rem; right: .2rem; top: .17rem; height: 1.55rem; display: flex; align-items: center; justify-content: center;
    font-size: .9rem; line-height: 1; opacity: .38; pointer-events: none; user-select: none; z-index: 1; }
.sheet-grid td.prev-filled .prev-ghost, .sheet-grid:not(.cards) td:focus-within .prev-ghost { display: none; }
.prev-ghost-swatch { padding: 0 .35rem; opacity: .6; }
html[data-density="kompakt"] .prev-ghost { height: 1.3rem; top: .1rem; }
html[data-density="tagas"] .prev-ghost { height: 1.9rem; }
.prev-toggle { display: inline-flex; margin: 0; }
@media print { .sheet-grid tr.prev-row td.prev-part, .sheet-grid tr.prev-row td.prev-change { background: none; } .prev-ghost { display: none; } }
.sheet-grid tr.inactive th .tname { color: var(--muted); text-decoration: line-through; }
/* Osztályszínek a tantárgyi nézetben (2.6): színcsík az osztály fejlécén, halványan színezett oszlop. A mentés,
   zárolás és összevonás színei (később definiálva, azonos erősséggel) felülírják a halvány színt. */
/* A színcsík a cellán belül, nem keretként: az összevont keret a ragadós fejléccel együtt nem görgetődik,
   és az évfolyam sorának aljához tapadna (2.8.1). */
.sheet-grid th.letter.cc::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--cc); pointer-events: none; }
.sheet-grid td.cc { background: color-mix(in srgb, var(--cc) var(--cc-tint, 9%), transparent); }
@media print { .sheet-grid td.cc { background: none; } }
/* Osztályfőnök jelölése (2.17): a pedagógus neve mellett az osztálya, a sorában az osztály színével keretezve a saját osztálya cellája. */
.sheet-grid td.ofo-own { --cc-tint: 24%; outline: 2px solid color-mix(in srgb, var(--cc) 80%, transparent); outline-offset: -2px; }
.ofo-mark { margin-left: .3rem; font-size: .72rem; line-height: 1.35; white-space: nowrap; vertical-align: 1px; }
.ofo-mark .ofo-word { font-weight: 500; opacity: .85; }
.ofo-swatch { margin-left: 0; background: #2f6f8f; color: #fff; }
.ofo-own-swatch { padding: 0 .3rem; outline: 2px solid #2f6f8f; outline-offset: -2px; background: color-mix(in srgb, #2f6f8f 20%, transparent); }
@media (forced-colors: active) { .sheet-grid td.ofo-own { outline-color: CanvasText; } }
.sheet-grid td.total { min-width: 3rem; }
.sheet-grid td.load { min-width: 5.5rem; white-space: nowrap; padding: 0 .4rem; font-variant-numeric: tabular-nums; }
.item-noted { text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }
.sheet-grid th.item-note-col { min-width: 18rem; text-align: left; padding: 0 .5rem; }
.sheet-grid .item-note { width: 100%; min-width: 18rem; height: 1.9rem; border: 0; padding: 0 .5rem; font: inherit; background: transparent; box-sizing: border-box; }
.sheet-grid .item-note:focus { outline: 2px solid var(--primary); outline-offset: -2px; background: #fff; }
.sheet-grid td.locked .item-note { color: #7b858e; cursor: not-allowed; }
.sheet-grid .item-note::placeholder { color: transparent; }
.sheet-grid .item-note:focus::placeholder { color: var(--muted); }
.sheet-grid tfoot td, .sheet-grid tfoot th { position: sticky; bottom: 0; z-index: 1; }
.sheet-grid tfoot tr.sum-row td, .sheet-grid tfoot tr.sum-row th { bottom: 2rem; height: 2rem; box-sizing: border-box; border-top: 2px solid var(--primary-line); }
.sheet-grid tfoot tr.diff-row td, .sheet-grid tfoot tr.diff-row th { height: 2rem; box-sizing: border-box; }
.sheet-grid tfoot tr:only-child td, .sheet-grid tfoot tr:only-child th { bottom: 0; }
.sheet-grid td.saving { background: #fff8db; }
.sheet-grid td.saved { background: #dcf3e2; transition: background .2s; }
.sheet-grid td.error { outline: 2px solid #d92d20; outline-offset: -2px; background: #fdecea; }
.sheet-grid td.locked, .sheet-grid td.locked .cell { background: #e7eaed; color: #7b858e; cursor: not-allowed; }
.sheet-grid th.locked { background: #d5dade !important; }
.sheet-grid tr.locked th.sticky-col { background: #e2e6e9; }
/* Munkaközösség-vezetőnél a nem szerkeszthető sorok. */
.sheet-grid tr.readonly-row th .tname { color: var(--muted); }
.sheet-grid tr.readonly-row td, .sheet-grid tr.readonly-row .cell, .sheet-grid tr.readonly-row .item-note { background: #f4f5f7; color: #5f6b75; cursor: default; }
.scope-note { background: var(--warning-bg); border: 1px solid #f0d792; border-radius: var(--radius); padding: .4rem .7rem; margin: .4rem 0; }
.lockmark { display: block; font-size: .72rem; font-weight: 400; color: #5b6670; }
.over-max { background: #f8d7da !important; color: #8a1c24; }
.empty-row { text-align: left !important; padding: .6rem !important; }
.diff-ok { color: #1d7a3a; }
.diff-missing { background: #dbeafe !important; color: #1e3a8a; }
.diff-extra { background: #ffe4c4 !important; color: #8a4b00; }
/* Kötelező alatt (2.23): élénkpiros háttér, félkövér fehér szám. */
/* Szerepkör kipróbálása (3.0) */
.test-role-banner { background: #5b2a86; color: #fff; padding: .5rem 1rem; text-align: center; font-size: .92rem; }
.test-role-banner form.inline { display: inline-block; margin-left: .5rem; }
.test-role-banner .btn { background: #fff; color: #5b2a86; border-color: #fff; font-weight: 700; }
.role-trial-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(17rem, 100%), 1fr)); gap: .75rem; }
.role-trial-list .card { margin: 0; }
/* Költözés (2.24): a régi példányon minden oldalon */
.moved-banner { background: #c8102e; color: #fff; padding: .6rem 1rem; text-align: center; font-size: .95rem; }
.moved-banner a { color: #fff; font-weight: 700; text-decoration: underline; }
.relocation-steps { margin: .5rem 0 0; }
.load-under, .load-swatch.load-under, .load-pill.load-under { background: #e11d2a; color: #fff; font-weight: 700; }
.load-ok { background: transparent; }
.load-1 { background: #d6f0d8; }
.load-2 { background: #fff1a8; }
.load-3 { background: #ffd2a1; }
.load-4 { background: #f7b0b0; }
.ghost-qual { display: inline-block; margin-left: .35rem; padding: 0 .4rem; border-radius: 999px; font-size: .78rem; font-weight: 700; background: #f9eeda; color: #7a4b00; border: 1px solid #e0b252; }
.ghost-load { display: inline-block; margin-left: .5rem; padding: 0 .4rem; border-radius: 999px; font-size: .78rem; font-weight: 700; color: var(--text); border: 1px solid rgba(0,0,0,.2); }
.sheet-grid .issue-target { box-shadow: inset 0 0 0 2px #e07b1f; background-color: rgba(224, 123, 31, .14); }
.load-preview { outline: 2px dashed var(--primary); outline-offset: -2px; font-style: italic; }
.load-swatch { display: inline-block; color: var(--text); padding: 0 .4rem; border-radius: 4px; border: 1px solid #d0d5da; font-size: .82rem; }
/* Összesítés nézetei (2.7): terhelésmérő, túlóracímke, osztályfőnöki osztály, csoportok, kártyák */
.view-switch { margin: 0 0 .9rem; }
.meter { position: relative; display: inline-block; width: 7rem; height: .7rem; background: #e6eaef; border-radius: 3px; vertical-align: middle; }
.meter i { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: #8a96a3; }
.meter i[data-load="load-under"] { background: #e11d2a; }
.meter i[data-load="load-1"] { background: #3f9a4f; }
.meter i[data-load="load-2"] { background: #c9a400; }
.meter i[data-load="load-3"] { background: #e07b1f; }
.meter i[data-load="load-4"] { background: #c93a3a; }
.meter i[data-load="load-none"] { opacity: .5; }
.meter b { position: absolute; top: -.25rem; bottom: -.25rem; width: 2px; margin-left: -1px; background: var(--text); border-radius: 1px; }
.total-meter { white-space: nowrap; }
.total-meter .meter { margin-right: .4rem; }
.load-pill { display: inline-block; padding: 0 .5rem; border-radius: 999px; font-weight: 700; font-size: .85rem; white-space: nowrap; color: var(--text); }
.load-pill.load-ok { border: 1px solid var(--border); color: var(--muted); font-weight: 600; }
.ofo-chip { display: inline-block; padding: 0 .35rem; border-radius: 4px; font-size: .8rem; font-weight: 700; line-height: 1.4; }
.load-dist { flex-basis: 100%; display: flex; gap: 2px; height: 1.6rem; border-radius: 4px; overflow: hidden; }
.load-dist span { display: flex; align-items: center; justify-content: center; min-width: 1.4rem; font-weight: 700; font-size: .82rem; color: var(--text); }
.load-dist .load-ok, .load-dist .load-none { background: #e6eaef; }
.load-dist-legend { flex-basis: 100%; margin: 0; display: flex; flex-wrap: wrap; gap: .25rem .9rem; }
.load-dist-legend .load-ok, .load-dist-legend .load-none { background: #e6eaef; }
.load-dist-legend .load-swatch { width: .9rem; height: .9rem; padding: 0; vertical-align: -2px; }
.summary-groups .group-row th { background: var(--primary-soft); text-align: left; font-size: .95rem; padding-top: .45rem; border-bottom: 1px solid var(--primary-line); }
.summary-groups .group-sum { font-weight: 400; color: var(--muted); margin-left: .75rem; font-size: .88rem; }
.summary-groups .group-sum b { color: var(--text); }
.load-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .75rem; }
.load-card { border: 1px solid var(--border); border-radius: 8px; padding: .75rem; display: grid; gap: .5rem; background: var(--surface); min-width: 0; break-inside: avoid; }
.load-card[data-load="load-under"] { background: color-mix(in srgb, #e11d2a 10%, var(--surface)); border-color: #e11d2a; }
.load-card[data-load="load-3"], .load-card[data-load="load-4"] { border-color: #c93a3a; }
.load-card.inactive { opacity: .7; }
.load-card header { display: flex; justify-content: space-between; align-items: start; gap: .5rem; }
.load-card h3 { margin: 0; font-size: 1rem; }
.load-card-tags { display: flex; flex-wrap: wrap; gap: .25rem; justify-content: flex-end; }
.load-card-big { display: flex; align-items: baseline; gap: .35rem; font-variant-numeric: tabular-nums; }
.load-card-big strong { font-size: 1.7rem; line-height: 1; }
.load-card-big .load-pill { margin-left: auto; }
.load-card .meter { width: 100%; }
.load-card dl { margin: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: .25rem; text-align: center; font-size: .76rem; }
.load-card dt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.load-card dt { color: var(--muted); }
.load-card dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
/* Összesítés statisztikái (2.8) */
.stat-boxes { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: .9rem; margin-bottom: 1.25rem; }
.stat-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem; display: grid; gap: .45rem; align-content: start; min-width: 0; }
@media (min-width: 40rem) { .stat-box-wide { grid-column: span 2; } }
.stat-box h2 { margin: 0; font-size: .78rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.stat-box p { margin: 0; }
.stat-big { font-variant-numeric: tabular-nums; }
.stat-big strong { font-size: 1.6rem; line-height: 1.1; }
.stat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .2rem; font-size: .9rem; }
.stat-list li { display: flex; justify-content: space-between; gap: .75rem; border-bottom: 1px dotted var(--border); padding-bottom: .15rem; }
.stat-list b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.appr-bar { display: flex; gap: 2px; height: .6rem; border-radius: 3px; overflow: hidden; }
.appr-bar span { display: block; min-width: 4px; }
.appr-bar .appr-none, .appr-bar .appr-ok, .appr-bar .appr-stale { padding: 0; border-radius: 0; }
.appr-bar .appr-ok { background: #3f9a4f; }
.appr-bar .appr-stale { background: #e07b1f; }
.appr-bar .appr-none { background: #e6eaef; }
.stat-compare { width: 100%; border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; }
.stat-compare th, .stat-compare td { padding: .2rem .3rem; border-bottom: 1px dotted var(--border); text-align: left; font-weight: 400; }
.stat-compare thead th { color: var(--muted); font-size: .8rem; }
.stat-compare .num { text-align: right; }
.stat-compare tbody td:last-child { font-weight: 700; }
.sheet-below { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-top: .9rem; }
.add-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.add-row label { font-weight: 600; }
.add-row select { padding: .3rem .4rem; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; max-width: 18rem; }
.sheet-grid tr.add-teacher-row > * { background: #f7f9fb; border-top: 1px dashed var(--border); }
.sheet-grid tr.add-teacher-row th.sticky-col { padding: .2rem .3rem; }
.sheet-grid tr.add-teacher-row select { width: 100%; padding: .25rem .3rem; border: 1px dashed var(--primary-line); border-radius: var(--radius); font: inherit; background: #fff; color: var(--text); }
.sheet-grid tr.add-teacher-row select:disabled { border-style: solid; color: var(--muted); }
.sheet-grid td.add-teacher-hint { text-align: left; padding: .2rem .5rem; }
/* A tipp szövege nem szélesítheti a táblázatot (kevés osztálynál széles oszlopokat okozott): a cella szélességéig törik. */
.sheet-grid td.add-teacher-hint .muted { display: block; contain: inline-size; padding-top: .2rem; }
.sheet-grid td.add-teacher-hint .btn { float: left; margin-right: .5rem; }
.cv-teachers { line-height: 2; }
span.cv-teacher { display: inline-block; margin-right: .6rem; white-space: nowrap; }
.cv-info { margin: 0 .15rem; text-decoration: none; color: var(--primary); font-size: .95em; }
.cv-info:hover, .cv-info:focus { text-decoration: underline; }
.cv-swap { padding: .15rem .3rem; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; max-width: 14rem; background: #fff; color: var(--text); }
.subject-order { display: inline-flex; align-items: center; gap: .15rem; margin-right: .4rem; vertical-align: middle; }
.subject-order .drag-handle { cursor: grab; color: var(--muted); padding: 0 .15rem; touch-action: none; }
.class-table tr.moved td { background: var(--primary-soft); transition: background .6s; }
.class-table td.cv-prev { color: var(--muted); }
.cont-same { color: #17633a; font-weight: 700; }
.cont-left { text-decoration: line-through; }
.changes-table th[scope="row"] { white-space: nowrap; font-weight: 600; text-align: left; }
.changes-table tr.group-start th, .changes-table tr.group-start td { border-top: 2px solid var(--border); }
.changes-table tbody tr:first-child th, .changes-table tbody tr:first-child td { border-top: 0; }
[data-theme="dark"] .cont-same { color: #7fd3a4; }
.cv-split { margin-left: .2rem; padding: .05rem .3rem; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; color: var(--muted); font: inherit; font-size: .85rem; line-height: 1.2; cursor: pointer; vertical-align: middle; }
.cv-split:hover { color: var(--primary-dark); border-color: var(--primary-line); }
.head-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: -.25rem 0 .75rem; }
.head-form select { font: inherit; padding: .25rem .4rem; border: 1px solid var(--border); border-radius: var(--radius); }
.shortcuts-dialog.cv-split-dialog { width: min(28rem, calc(100% - 2rem)); }
.cv-split-dialog h3 { margin: 0 0 .75rem; font-size: 1.05rem; }
.cv-split-dialog .form-row { display: flex; flex-direction: column; align-items: flex-start; gap: .25rem; margin-bottom: .6rem; text-align: left; }
.cv-split-dialog #cv-split-hours { width: 6rem; }
.cv-split-dialog #cv-split-to { max-width: 100%; }
.cv-split-dialog input, .cv-split-dialog select { font: inherit; padding: .35rem .45rem; border: 1px solid var(--border); border-radius: var(--radius); }
.cv-missing .cv-swap { max-width: 16rem;  border-style: dashed; border-color: var(--primary-line); color: var(--muted); }
#cv-status .btn { margin-left: .4rem; }
.legend { margin: .9rem 0 0; padding-left: 1.1rem; font-size: .86rem; color: var(--muted); }
.legend li { margin-bottom: .3rem; }
/* „Hogyan működik?” súgódoboz a nézetek alatt; a becsukott állapotot a program felhasználónként megjegyzi. */
.help-box { margin: .9rem 0 0; }
.help-box summary { cursor: pointer; width: max-content; max-width: 100%; font-size: .9rem; font-weight: 600; color: var(--primary); }
.help-box .legend { margin-top: .4rem; }
.sheet-grid tfoot td { z-index: 2; }
.sheet-grid tfoot th.sticky-col { z-index: 3; }
.sheet-picker { display: none; }
@media (max-width: 640px) {
    .sheet-tabs { display: none; }
    .sheet-picker { display: flex; align-items: center; gap: .5rem; margin-bottom: .75rem; }
    .sheet-picker select { flex: 1; min-width: 0; padding: .4rem; font: inherit; border: 1px solid var(--border); border-radius: var(--radius); }
    .sheet-grid th.sticky-col { min-width: 8rem; max-width: 9rem; font-size: .8rem; }
}

/* Összesítés, osztálynézet, hibalista */
.hint { color: var(--muted); font-size: .86rem; margin: .8rem 0 0; line-height: 1.7; }
.strong { font-weight: 700; }
.stats { display: flex; flex-wrap: wrap; gap: .75rem 2.25rem; align-items: baseline; }
.stats > div { color: var(--muted); font-size: .9rem; }
.stat { display: inline-block; font-size: 1.6rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; margin-right: .2rem; border-radius: 4px; }
.stat.load { padding: 0 .35rem; }
.stat-under { color: #c8102e; }
.summary-table { font-size: .9rem; }
.summary-table th, .summary-table td { padding: .35rem .45rem; }
.summary-table thead th { vertical-align: bottom; line-height: 1.2; }
.summary-table td.load { font-weight: 600; }
.summary-table tfoot th, .summary-table tfoot td, .class-table tfoot th, .class-table tfoot td { border-top: 2px solid var(--border); font-weight: 600; }
/* Összesítés (2.7.1): görgetéskor a fejléc fent, az összesen sor lent marad. Széles képernyőn az oldal görgetéséhez
   tapad; keskenyen, ahol vízszintesen is görgetni kell, a táblázat saját görgetősávot kap. */
.summary-scroll { overflow: visible; }
@media (max-width: 1099px) { .summary-scroll { overflow-x: auto; } }
.summary-scroll thead th { position: sticky; top: 0; z-index: 2; box-shadow: inset 0 -1px 0 var(--border); }
.summary-scroll tfoot th, .summary-scroll tfoot td { position: sticky; bottom: 0; z-index: 1; background: var(--surface); box-shadow: inset 0 2px 0 var(--border); }
.summary-scroll tfoot th { background: #f0f2f4; }
.pager-links { display: flex; flex-wrap: wrap; gap: 1rem; font-size: .9rem; }
.muted-row td { color: var(--muted); }
.ok-text { color: #1d7a3a; font-weight: 600; }
.issue-filters { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; align-items: center; margin-bottom: .6rem; }
.issue-filters .building-filter { margin-bottom: 0; }
.level-filter { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.level-filter a { padding: .3rem .75rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); text-decoration: none; font-size: .9rem; }
.level-filter a.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.lvl { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.lvl-hiba { background: #fdecea; color: #b42318; }
.lvl-figyelmeztetes { background: #fff1d6; color: #8a4b00; }
.lvl-megjegyzes { background: #e7f1fb; color: #1e4a7a; }
.print-only { display: none; }
.issue-summary { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

@media print {
    body { background: #fff; }
    .topbar, .no-print, .flash, .sheet-tabs, .sheet-picker { display: none !important; }
    .table th .sort-mark { display: none; }
    .container { max-width: none; padding: 0; }
    .card { border: 0; padding: 0; margin-bottom: .75rem; }
    .table-wrap { overflow: visible; }
    .summary-scroll { max-height: none; }
    .pin-heads thead th, .pin-heads tfoot th, .pin-heads tfoot td { transform: none; }
    .summary-scroll thead th, .summary-scroll tfoot th, .summary-scroll tfoot td { position: static; box-shadow: none; }
    .summary-table, .class-table { font-size: 8.5pt; }
    .load-1, .load-2, .load-3, .load-4, .load-under, .diff-missing, .diff-extra { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .meter, .meter i, .meter b, .ofo-chip, .load-dist span, .load-card { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .load-cards { grid-template-columns: repeat(3, 1fr); }
    .stat-boxes { grid-template-columns: repeat(3, 1fr); }
    .stat-box { break-inside: avoid; }
    .appr-bar span, .sheet-grid th.letter.cc::before { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    a { color: inherit; text-decoration: none; }
    .print-only { display: block; margin: 0 0 .25rem; font-weight: 600; }
    span.cv-teacher .print-only { display: inline; margin: 0; font-weight: 400; }
    tfoot { display: table-row-group; }
}
.table th.num, .table td.num { text-align: right; }

/* Igazgatói ellenőrzés */
.appr { display: inline-block; font-weight: 700; border-radius: 999px; padding: 0 .45rem; font-size: .85rem; white-space: nowrap; }
.appr-ok { background: #d6f0d8; color: #146c2e; }
.appr-stale { background: #ffe4c4; color: #8a4b00; }
.appr-none { background: #eef0f2; color: var(--muted); font-weight: 600; }
.appr-who { color: var(--muted); font-size: .82rem; }
.approval-hero { display: grid; gap: 1rem; }
.approval-hero h2 { margin: 0 0 .4rem; }
.approval-state .appr { font-size: 1.05rem; padding: .2rem .7rem; }
.approval-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.approval-actions form { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.approval-actions .hint { flex-basis: 100%; margin: 0; }
.approval-actions .finalize-form { align-items: flex-end; }
.finalize-form .field { margin: 0; }
.finalize-form #f-indok { min-width: min(28rem, 80vw); }
.version-banner { background: var(--warning-bg); border: 1px solid #f0d792; border-radius: var(--radius); padding: .5rem .8rem; margin: 0 0 1rem; }
.doc-version { font-weight: 600; }
.diff-old { color: #b42318; text-decoration: line-through; }
.diff-new { color: #067647; font-weight: 600; }
.version-state-hatalyos { color: #067647; font-weight: 600; }
.version-state-felulirva { color: var(--muted); }
.checkline { display: flex; align-items: center; gap: .4rem; font-size: .92rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.final-note { margin: .4rem 0 0; font-weight: 600; }
.final-banner { background: #e5f4e4; border-bottom: 1px solid #b9dfb6; color: #14532d; padding: .45rem 1.25rem; font-size: .92rem; text-align: center; }
.approval-table td { vertical-align: middle; }
.approve-btn { background: #e5f4e4; border-color: #9fd3a5; color: #146c2e; font-weight: 600; }
.revoke-btn { background: transparent; color: var(--muted); font-weight: 400; }
.revoke-btn:hover { color: #a12b2b; border-color: #d9a3a3; }
/* Osztályszínek és osztálykártyák (2.5) */
.class-swatch { display: inline-block; width: .8em; height: .8em; border-radius: 3px; margin-right: .35rem; vertical-align: -.05em; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.class-stats { margin: .4rem 0 .6rem; color: var(--muted); font-size: .92rem; }
.color-pick { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; }
.color-pick input[type=color] { width: 3rem; height: 2rem; padding: 0 .15rem; }
.class-cards { display: flex; flex-wrap: wrap; gap: .35rem; }
.class-card { display: inline-grid; min-width: 3.4rem; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; text-align: center; background: var(--surface); line-height: 1.3; }
.class-card b { font-size: .8rem; padding: .05rem .5rem; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.class-card .cc-none { background: #eef1f4; color: var(--muted); font-weight: 600; }
.class-card .cc-db { padding: .1rem .5rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.class-card small { display: block; font-size: .72rem; padding: 0 .4rem .15rem; max-width: 9rem; }
.class-card .cc-group { color: #5b3f8f; background: #f1ecfa; }
.class-card .cc-note { color: #7a4f00; background: #fff6e0; }
.approve-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin: 0 0 1rem; padding: .6rem .9rem; border: 1px solid var(--border); border-radius: var(--radius); background: #fafbfc; }
.approve-bar form { display: inline-flex; gap: .5rem; align-items: center; }
.sheet-tabs a .appr { font-size: .7rem; padding: 0 .3rem; margin-left: .2rem; }
.summary-table td.appr-cell { text-align: center; }
@media print { .approve-bar, .final-banner { display: none !important; } }

/* Hivatalos tantárgyfelosztás */
.doc-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem 1rem; margin-bottom: 1rem; }
.doc-toolbar .hint { flex-basis: 100%; margin: 0; }
.doc-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.official-doc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.doc-head { text-align: center; margin-bottom: 1.25rem; }
.doc-head h1 { margin: .2rem 0; font-size: 1.5rem; }
.doc-school { margin: 0; font-weight: 600; }
.doc-status { margin: .3rem 0 0; font-size: .88rem; color: var(--muted); }
.doc-section { margin-top: 1.5rem; }
.doc-section h2 { font-size: 1.1rem; border-bottom: 2px solid var(--primary); padding-bottom: .25rem; }
.doc-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.doc-table th, .doc-table td { border: 1px solid #c9ced4; padding: .3rem .4rem; vertical-align: top; text-align: left; }
.doc-table thead th { background: var(--primary-soft); }
.doc-table tfoot th, .doc-table tfoot td { background: #f4f5f7; font-weight: 600; }
.doc-table .num { text-align: right; white-space: nowrap; }
.doc-table th.num, .doc-table td.num > div { white-space: normal; }
.doc-teachers td div + div { margin-top: .1rem; }
.doc-classes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 1rem; }
.doc-classes > * { min-width: 0; }
.doc-class caption { text-align: left; font-weight: 700; padding: .2rem 0; }
.doc-totals { max-width: 720px; }
.doc-totals th { width: 60%; background: #f8f9fa; font-weight: 600; }
.doc-sign { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 1rem; margin-top: 2.5rem; }
.sign-line { display: flex; align-items: flex-end; gap: 3rem; }
.sign-line span { text-align: center; }
@media (max-width: 640px) {
    .official-doc { padding: .75rem; }
    .doc-class td, .doc-class th { overflow-wrap: anywhere; }
}
@media print {
    @page { size: A4 landscape; margin: 10mm; }
    .official-doc { border: 0; padding: 0 1px 0 0; } /* a jobb szélső keret se essen le a lapról */
    .doc-table { font-size: 7.5pt; }
    .doc-table thead th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .doc-teachers tr, .doc-break-avoid { break-inside: avoid; }
    .doc-break { break-before: page; }
    /* 2.20.2: a Safari a fekvő tájolást (@page size) nem veszi át, ezért a táblázatoknak álló A4-en is el kell férniük.
       Pedagógustáblázat: rögzített oszlopszélesség, így a jobb szélső oszlopok (órakedvezmény, összesen, kötelező, túlóra) nem esnek le a lapról. */
    .doc-teachers { table-layout: fixed; width: 100%; }
    .doc-teachers col.t-ssz { width: 3%; }
    .doc-teachers col.t-name { width: 11%; }
    .doc-teachers col.t-edu, .doc-teachers col.t-qual { width: 7%; }
    .doc-teachers col.t-lessons { width: 22%; }
    .doc-teachers col.t-other { width: 20%; }
    .doc-teachers col.t-bound { width: 6%; }
    .doc-teachers col.t-disc { width: 10%; }
    .doc-teachers col.t-sum, .doc-teachers col.t-req { width: 4.5%; }
    .doc-teachers col.t-over { width: 5%; }
    .doc-teachers th, .doc-teachers td { overflow-wrap: anywhere; word-break: break-word; padding: .2rem .25rem; }
    .doc-teachers thead th { font-size: 6.5pt; overflow-wrap: break-word; word-break: normal; }
    .doc-teachers td.num { white-space: nowrap; }
    .doc-teachers .pill { min-width: 0; padding: 0 .2rem; font-size: inherit; }
    /* Osztálykártyák: rács helyett egymás alatt, teljes szélességben. A rácsba tett, oldalhatáron átnyúló táblázatok
       Safariban egymásra csúsztak; így a hosszú kártya is tisztán törik, és a fejléce a következő oldalon megismétlődik. */
    .doc-classes { display: block; }
    .doc-class { table-layout: fixed; width: 100%; margin: 0 0 5mm; break-inside: auto; }
    .doc-class caption { break-after: avoid; }
    .doc-class tr { break-inside: avoid; }
    .doc-class col.c1 { width: 20%; }
    .doc-class col.c2 { width: 16%; }
    .doc-table .small { font-size: inherit; }
    .doc-class td, .doc-class th { overflow-wrap: anywhere; word-break: break-word; }
}
/* Egyéni pedagóguslap */
.doc-toolbar .filters { flex-basis: 100%; max-width: 760px; }
.doc-toolbar .filters button { justify-self: start; }
.teacher-sheet { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; max-width: 820px; margin: 0 auto 1.5rem; }
.teacher-sheet h2 { font-size: 1rem; margin: 1.1rem 0 .4rem; border-bottom: 2px solid var(--primary); padding-bottom: .2rem; }
.ts-year { margin: .2rem 0 0; font-weight: 600; }
.ts-facts th { width: 18%; background: #f8f9fa; font-weight: 600; }
.ts-items { table-layout: fixed; }
.ts-items .ts-c1 { width: 40%; }
.ts-items .ts-c3 { width: 5.5rem; }
.ts-totals th { width: 20%; }
.ts-totals td.num { text-align: center; }
.ts-status { margin: .5rem 0 0; color: var(--muted); }
.ts-ack { margin: 1.6rem 0 0; }
.ts-sign { margin: 1rem 0 0; }
.ts-signatures { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: flex-end; margin-top: 2.8rem; text-align: center; }
.ts-signatures span { min-width: 0; overflow-wrap: anywhere; }
/* Módosítási lap (2.23, 76.) és megismerési ív (77.) */
.change-table { table-layout: fixed; }
.change-table .ch-c1 { width: 28%; }
.change-table .ch-c3 { width: 9rem; }
.change-table td { vertical-align: top; overflow-wrap: anywhere; }
.ack-table { table-layout: fixed; }
.ack-table .ack-c1 { width: 2.4rem; }
.ack-table .ack-n { width: 4.6rem; }
.ack-table .ack-sign { width: 36%; }
.ack-table td { height: 2.1rem; vertical-align: middle; }
.ack-table td.ack-line { border-bottom: 1px solid var(--text); }
@media print {
    @page teacher { size: A4 portrait; margin: 12mm 14mm; }
    .teacher-sheet { page: teacher; break-after: page; border: 0; border-radius: 0; padding: 0; margin: 0; max-width: none; font-size: 10pt; }
    .teacher-sheet:last-of-type { break-after: auto; }
    .teacher-sheet .doc-head { margin-bottom: 4mm; }
    .teacher-sheet h2 { font-size: 10.5pt; margin: 4mm 0 1.5mm; }
    .teacher-sheet .doc-table { font-size: 9pt; }
    .teacher-sheet .doc-table th, .teacher-sheet .doc-table td { padding: .12rem .35rem; }
    .ts-signblock { break-inside: avoid; }
    .change-sheet, .ack-sheet { break-after: auto; }
    .change-table tr, .ack-table tr { break-inside: avoid; }
    .ack-table td { height: 9mm; }
    .ts-ack { margin-top: 6mm; }
    .ts-signatures { margin-top: 10mm; }
    .teacher-sheet .doc-table th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.table.log .values div + div { margin-top: .1rem; }
.table.log .values .k { color: var(--muted); }
.table.log .values .old { text-decoration: line-through; color: #8a4b00; }
.table.log .values .new { font-weight: 600; color: #146c2e; }
.copy-options { border: 1px solid var(--border); border-radius: var(--radius); padding: .5rem .8rem .7rem; margin: 0 0 1rem; display: grid; gap: .45rem; }
.copy-options legend { font-weight: 600; padding: 0 .3rem; }
.copy-options .checkline { align-items: flex-start; }
.copy-options .checkline input { margin-top: .2rem; }
.copy-options .field-label { margin: .3rem 0 0; font-weight: 600; font-size: .92rem; }
.copy-classes select { font: inherit; padding: .2rem .3rem; }
.new-classes { display: grid; grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); gap: .5rem; }
.new-classes label { display: grid; gap: .2rem; font-size: .88rem; color: var(--muted); }
.new-classes input { width: 100%; min-width: 0; box-sizing: border-box; font: inherit; padding: .35rem .45rem; border: 1px solid var(--border); border-radius: 4px; color: var(--text); }
.copy-options[hidden] { display: none; }
.copy-classes input[type="checkbox"] { width: auto; flex: none; }
.copy-classes .checkline { margin-top: .25rem; font-size: .85rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem 1rem; }
.card-head h2 { margin: 0; }
.sys-status { display: inline-block; font-size: .78rem; font-weight: 600; padding: .05rem .5rem; border-radius: 999px; vertical-align: middle; }
.sys-ok { background: #e5f4e4; color: #146c2e; }
.sys-figyelmeztetes { background: #fff3d6; color: #8a4b00; }
.sys-hiba { background: var(--error-bg); color: var(--danger); }
.danger-zone { border-color: #f3c1bc; }
.restore-form { display: grid; gap: .25rem; max-width: 34rem; }
.restore-form select { max-width: 100%; }
.help-layout { display: grid; grid-template-columns: 16rem 1fr; gap: 1.25rem; align-items: start; }
.help-toc { position: sticky; top: 1rem; }
.help-toc ol { margin: .5rem 0 0; padding-left: 1.2rem; display: grid; gap: .3rem; }
.help-section { border-left: 4px solid transparent; }
.help-section.help-mine { border-left-color: var(--primary); }
.help-section h2 { margin-top: 0; }
.help-section li + li { margin-top: .3rem; }
kbd { font: inherit; font-size: .85em; padding: 0 .3rem; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; background: #fff; }
@media (max-width: 860px) {
    .help-layout { grid-template-columns: 1fr; }
    .help-toc { position: static; }
}
@media print {
    .help-layout { display: block; }
    .help-section { border-left: 0; break-inside: avoid; }
}
.restore-form .btn { justify-self: start; }

/* Adatok importálása sablonból */
.import-data-form { margin-top: 1rem; display: grid; gap: .25rem; max-width: 34rem; }
.import-types td:first-child { width: 2.5rem; }
.section-title { margin: 1.5rem 0 .75rem; }
.import-counts { display: flex; flex-wrap: wrap; gap: .4rem; }
.imp { display: inline-block; padding: .05rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 700; background: #e3e7eb; }
.imp-uj { background: #e5f4e4; color: #1d5c1a; }
.imp-modosul { background: #e7f1fb; color: #1e4a7a; }
.imp-torles { background: #fff1d6; color: #8a4b00; }
.imp-hiba { background: #fdecea; color: #b42318; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.import-data-form .btn { justify-self: start; }

/* --- Cellamegjegyzések és cellatörténet (tantárgyi lap oldalpanelje) --- */
.sheet-grid tbody td { position: relative; }
.sheet-grid td.has-note::after { content: ""; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 .55rem .55rem 0;
    border-color: transparent #d92d20 transparent transparent; pointer-events: none; }
.sheet-grid td.panel-open { outline: 2px dashed var(--primary); outline-offset: -3px; }
.note-swatch { position: relative; padding-right: .7rem; }
.note-swatch::after { content: ""; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 .5rem .5rem 0;
    border-color: transparent #d92d20 transparent transparent; }
.cell-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(24rem, 100%); z-index: 50; background: var(--surface);
    border-left: 1px solid var(--border); box-shadow: -6px 0 18px rgba(31, 41, 51, .14); overflow-y: auto; padding: 1rem 1.1rem 2rem; box-sizing: border-box; }
.cell-panel[hidden] { display: none; }
.cell-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; }
.cell-panel-head h2 { font-size: 1.05rem; margin: 0; line-height: 1.35; }
.cell-panel-close { border: 0; background: transparent; font-size: 1.1rem; line-height: 1; padding: .3rem .45rem; cursor: pointer; color: var(--muted); border-radius: var(--radius); }
.cell-panel-close:hover { background: var(--bg); color: var(--text); }
.cell-panel-value { margin: .35rem 0 .2rem; color: var(--muted); }
.cell-panel-section { margin-top: 1rem; }
.cell-panel-section h3 { font-size: .9rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 .5rem; }
.note-list, .history-list { list-style: none; margin: 0; padding: 0; }
.note-list li { border: 1px solid #f1c9c4; background: #fff7f6; border-radius: var(--radius); padding: .5rem .65rem; margin-bottom: .5rem; }
.note-list li.resolved { border-color: var(--border); background: var(--bg); color: var(--muted); }
.note-list li.resolved .note-body { text-decoration: line-through; text-decoration-color: rgba(97, 110, 124, .6); }
.note-list .note-body { margin: 0 0 .3rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-list .note-meta { margin: 0; font-size: .8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .25rem .7rem; align-items: center; }
.note-list .note-meta button { font-size: .8rem; }
.note-list li.empty, .history-list li.empty { border: 0; background: none; padding: 0; color: var(--muted); }
.note-form textarea { width: 100%; box-sizing: border-box; font: inherit; padding: .45rem .55rem; border: 1px solid var(--border); border-radius: var(--radius); resize: vertical; }
.note-form .btn { margin-top: .4rem; }
.history-list li { padding: .45rem 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.history-list li:last-child { border-bottom: 0; }
.history-list .h-when { display: block; font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.history-list .h-val { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.history-list .h-note { color: var(--muted); font-size: .82rem; }
@media (max-width: 640px) {
    .cell-panel { top: auto; height: 72vh; width: 100%; border-left: 0; border-top: 1px solid var(--border); border-radius: 12px 12px 0 0; box-shadow: 0 -6px 18px rgba(31, 41, 51, .18); }
}
/* Széles képernyőn a panel mellé húzódik a lap, így a fejléc gombjai sem kerülnek alá. */
@media (min-width: 900px) { body.cell-panel-open .container { margin-right: 24rem; } }
@media print { .cell-panel, #sheet-cellinfo { display: none !important; } }

/* --- Csoportösszevonás (pl. 5.a+5.b) a tantárgyi lapon --- */
.sheet-grid td.merged { background: #f3effb; box-shadow: inset 0 -3px 0 #7c5cc4; }
.sheet-grid td.merged.merged-1 { background: #e9f6f8; box-shadow: inset 0 -3px 0 #0e7490; }
.sheet-grid td.merged.merged-2 { background: #fdf3e6; box-shadow: inset 0 -3px 0 #b45309; }
/* Kártyás beosztás (osztályhoz kötött lapok) */
.hcard { display: inline-flex; align-items: baseline; justify-content: center; gap: .1rem; min-width: 1.9rem; height: 1.55rem; padding: 0 .35rem;
    border: 1px solid var(--primary-border, #9db5d6); border-radius: 6px; background: #fff; color: var(--primary-dark); font: inherit; font-weight: 700;
    font-style: normal; box-shadow: 0 1px 2px rgba(16, 40, 80, .18); box-sizing: border-box; cursor: grab; line-height: 1; }
.hcard small { font-weight: 400; font-size: .72em; color: var(--muted); }
.sheet-grid.cards td[data-plan-c] { padding: .15rem .2rem; text-align: center; }
.sheet-grid.cards td[data-plan-c] .plan-val { display: none; }
.sheet-grid.cards .plan-card { touch-action: none; }
.sheet-grid.cards .plan-card.done { cursor: default; background: transparent; border-color: transparent; box-shadow: none; color: #2f7d4a; font-weight: 600; }
.sheet-grid.cards .plan-card.over { cursor: default; background: #fdecea; border-color: #f3b3ac; color: #b42318; box-shadow: none; }
.sheet-grid.cards .plan-card:focus-visible { outline: 3px solid var(--primary); outline-offset: 1px; }
.sheet-grid.cards input.cell { caret-color: transparent; cursor: default; user-select: none; }
.sheet-grid.cards input.cell::selection { background: transparent; }
.sheet-grid.cards input.cell:not(:placeholder-shown) { width: calc(100% - .4rem); min-width: 1.9rem; height: 1.55rem; margin: .17rem .2rem; border: 1px solid var(--primary-border, #9db5d6);
    border-radius: 6px; background: #fff; color: var(--primary-dark); font-weight: 700; box-shadow: 0 1px 2px rgba(16, 40, 80, .18); cursor: grab; touch-action: none; }
.sheet-grid.cards td.locked input.cell:not(:placeholder-shown), .sheet-grid.cards tr.readonly-row input.cell:not(:placeholder-shown),
.sheet-grid.cards input.cell[readonly]:not(:placeholder-shown) { cursor: default; color: #5f6b75; background: #f4f5f7; box-shadow: none; }
.sheet-grid.cards input.cell:focus { outline: 3px solid var(--primary); outline-offset: -2px; }
.sheet-grid.cards td.merged input.cell:not(:placeholder-shown) { background: transparent; }
.sheet-grid td.drop-ok { background-image: repeating-linear-gradient(45deg, rgba(29, 79, 145, .07) 0 6px, transparent 6px 12px); }
.sheet-grid td.drop-over { outline: 2px dashed var(--primary); outline-offset: -3px; background-color: #e6efff; }
.sheet-grid td.drag-source .hcard, .sheet-grid td.drag-source input.cell { opacity: .45; }
.sheet-grid td.drag-source .plan-card:not(.done) { outline: 3px solid #e0a100; outline-offset: 1px; opacity: 1; }
.drag-ghost { position: fixed; z-index: 1000; pointer-events: none; cursor: grabbing; transform: rotate(-3deg); box-shadow: 0 6px 16px rgba(16, 40, 80, .3); }
body.card-dragging, body.card-dragging * { cursor: grabbing !important; user-select: none; }
.sheet-grid .merge-link { position: absolute; right: -.55rem; top: 50%; transform: translateY(-50%); z-index: 2; font-size: .8rem; line-height: 1; cursor: pointer; }
.sheet-grid .merge-badge { position: absolute; left: 1px; bottom: 0; z-index: 2; font-size: .62rem; line-height: 1; cursor: pointer; }
.sheet-grid.cards td[data-plan-c] { white-space: nowrap; }
.sheet-grid.cards .plan-card.piece { min-width: 1.5rem; margin: 0 .05rem; border-style: dashed; }
.plan-split, .cell-split { border: 0; background: transparent; color: var(--muted); font-size: .8rem; line-height: 1; padding: .1rem; cursor: pointer; }
.plan-split:hover, .cell-split:hover { color: var(--primary-dark); }
.cell-split { position: absolute; right: 0; bottom: 0; z-index: 2; background: #fff; border-radius: 4px 0 0 0; }
/* A pedagógus kártyájáról leválasztott, áthúzható rész (sheet.js: pick). */
/* Munkaközösségi nézet: a cella tantervi óraszáma buborékban (community.js). */
.plan-tip { position: absolute; z-index: 60; max-width: 22rem; padding: .3rem .55rem; border-radius: var(--radius); background: #1f2933; color: #fff;
    font-size: .82rem; line-height: 1.35; box-shadow: 0 2px 8px rgba(16, 24, 40, .25); pointer-events: none; }
.plan-tip[hidden] { display: none; }
@media print { .plan-tip { display: none !important; } }
.sheet-grid td[data-piece]::after { content: attr(data-piece); position: absolute; left: 50%; top: -.55rem; transform: translateX(-50%); z-index: 3; pointer-events: none;
    padding: 0 .3rem; border-radius: 999px; background: var(--primary); color: #fff; font-size: .7rem; font-weight: 700; line-height: 1.1rem; white-space: nowrap; }
.sheet-grid td.drop-merge { background-image: repeating-linear-gradient(-45deg, rgba(124, 92, 196, .16) 0 6px, transparent 6px 12px); }
.drag-ghost.merging { background: #f3effb; border-color: #7c5cc4; color: #4c2f99; }
.drag-ghost.refused { background: #fdecea; border-color: #f3b3ac; color: #b42318; }
.split-pop { position: fixed; z-index: 1001; max-width: 20rem; padding: .6rem .7rem; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(16, 40, 80, .25); }
.split-pop label { display: block; font-weight: 600; }
.split-pop input { display: block; width: 100%; margin-top: .3rem; }
.split-pop .hint { margin: .35rem 0; font-size: .85rem; }
.split-actions { display: flex; gap: .4rem; }
.legend-card { cursor: default; height: 1.3rem; font-weight: 600; }
@media (forced-colors: active) { .sheet-grid td.drop-over { outline-color: Highlight; } .hcard, .sheet-grid.cards input.cell:not(:placeholder-shown) { border-color: CanvasText; } }
@media print {
    .sheet-grid.cards td[data-plan-c] .plan-val { display: inline; }
    .sheet-grid.cards .plan-card, .plan-split, .cell-split, .merge-badge { display: none; }
    .sheet-grid.cards input.cell:not(:placeholder-shown) { border: 0; box-shadow: none; }
}
.sheet-grid td.merged.merged-3 { background: #fcedf4; box-shadow: inset 0 -3px 0 #be185d; }
.merge-swatch { background: #f3effb; box-shadow: inset 0 -3px 0 #7c5cc4; padding: 0 .3rem; }
.merged-tag { color: #5b3fa6; white-space: nowrap; }
.merge-info { margin: 0 0 .5rem; }
.merge-options { list-style: none; margin: .3rem 0 .5rem; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem .9rem; }
.merge-options label { display: inline-flex; align-items: center; gap: .3rem; cursor: pointer; }
.merge-options .muted { font-size: .8rem; }
.merge-more { margin: 0 0 .5rem; font-size: .9rem; }
.merge-more summary { cursor: pointer; color: var(--muted); }

/* --- Csoportbontás (pl. Angol emelt 1. cs.): a csoport sorszáma a cella bal felső sarkában --- */
.gmark { display: inline-block; min-width: 1.05em; padding: 0 .2em; border-radius: 3px; background: #e7eef6; color: #1e4a7a;
    font-size: .7rem; font-weight: 700; line-height: 1.35; text-align: center; vertical-align: .05em; }
.sheet-grid td[data-group]::before { content: attr(data-group); position: absolute; top: 1px; left: 2px; padding: 0 .2em; border-radius: 3px;
    background: #d6e4f5; color: #1e4a7a; font-size: .66rem; font-weight: 700; line-height: 1.3; pointer-events: none; z-index: 1; }
.sheet-grid.cards.no-gmarks td[data-group]::before { content: none; }
.group-form { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.group-form select { max-width: 100%; font: inherit; padding: .3rem .4rem; border: 1px solid var(--border); border-radius: var(--radius); }
.merge-options.with-groups { flex-direction: column; }
.merge-options.with-groups li { display: flex; flex-wrap: wrap; gap: .2rem .5rem; align-items: center; }
.merge-options select { font-size: .82rem; padding: .05rem .2rem; max-width: 13rem; }

/* --- Piszkozatok és összevetés --- */
.draft-banner { background: #fff4d6; border-bottom: 1px solid #f0d58c; color: #6b4a00; padding: .45rem 1.25rem; font-size: .92rem; text-align: center; }
.draft-banner a { color: inherit; font-weight: 600; }
.form-row { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: flex-end; }
.form-row .field { margin-bottom: 0; }
.form-row select, .form-row input { max-width: 100%; }
.compare-form select { min-width: 18rem; }
.row-current td { background: #fffbeb; }
.actions-cell { display: flex; flex-wrap: wrap; gap: .4rem; align-items: flex-start; }
.inline-details { position: relative; }
.inline-details > summary { list-style: none; cursor: pointer; }
.inline-details > summary::-webkit-details-marker { display: none; }
.inline-details-body { display: flex; flex-direction: column; gap: .4rem; margin-top: .4rem; }
.compare-title { font-size: 1.05rem; }
.cmp-a { color: #b42318; }
.cmp-b { color: #067647; }
.compare-items { margin: 0; padding-left: 1.1rem; }
.compare-items li { margin: .1rem 0; }
.compare-table tr.cmp-uj td:first-child { border-left: 3px solid #12b76a; }
.compare-table tr.cmp-kikerult td:first-child { border-left: 3px solid #f04438; }
.delta-up { color: #067647; font-weight: 600; }
.delta-down { color: #b42318; font-weight: 600; }
.adopt-card { border-color: #f0d58c; }
@media print { .draft-banner { background: none; border: 1px solid #000; color: #000; } }
.doc-draft { font-weight: 700; color: #b54708; letter-spacing: .04em; margin: .2rem 0; }

/* Tantárgyi lap: egyedi tanársorrend */
.order-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin: .5rem 0; padding: .5rem .75rem;
    background: #fff8e6; border: 1px solid #f0d48a; border-radius: 6px; }
.order-bar p { margin: 0; flex: 1 1 22rem; }
.order-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.sheet-grid.reordering tbody tr[data-t] { cursor: grab; }
.sheet-grid.reordering tbody tr[data-t] th { touch-action: none; user-select: none; }
.sheet-grid.reordering tbody tr[data-t] input { pointer-events: none; }
.sheet-grid.reordering tbody tr.dragging { opacity: .45; }
.sheet-grid.reordering tbody tr.dragging > * { background: #fff1c2; }
.order-ctl { display: inline-flex; align-items: center; gap: .15rem; margin-right: .35rem; vertical-align: middle; }
.order-handle { color: var(--muted); font-size: 1rem; cursor: grab; padding: 0 .15rem; }
.order-btn { border: 1px solid var(--primary-border); background: #fff; border-radius: 4px; font-size: .7rem; line-height: 1; padding: .2rem .3rem; cursor: pointer; }
.order-btn:hover, .order-btn:focus-visible { background: var(--primary-soft); }
@media print { .order-ctl { display: none; } }

/* Húzással rendezhető listák (app.js sortable): fogantyú, húzott elem */
.drag-handle { color: var(--muted); font-size: 1rem; cursor: grab; padding: 0 .2rem; touch-action: none; user-select: none; vertical-align: middle; }
.order-handle { touch-action: none; user-select: none; }
body.sorting, body.sorting * { cursor: grabbing !important; user-select: none; }
tr.dragging > *, .tab-item.dragging { background: #fff1c2 !important; }
tr.dragging, .tab-item.dragging { opacity: .75; outline: 2px dashed var(--primary); outline-offset: -2px; }

/* Saját fülsorrend (tantárgyi nézet, tantervi óraszámok) */
.tab-order { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: .3rem .8rem; margin: 0 0 .35rem; }
.tab-order-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin: 0 0 .5rem; padding: .5rem .75rem;
    background: #fff8e6; border: 1px solid #f0d48a; border-radius: 6px; }
.tab-order-bar[hidden] { display: none; }
.tab-order-bar [role=status] { flex: 1 1 22rem; }
.tab-order-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.sheet-tabs.reordering { gap: 4px; padding-top: 2px; }
.sheet-tabs.reordering .tab-item { display: inline-flex; align-items: stretch; border-radius: 4px 4px 0 0; }
.sheet-tabs.reordering .tab-item a { cursor: grab; touch-action: none; user-select: none; }
.tab-move { border: 1px solid var(--border); border-bottom: 0; background: #fff; color: var(--primary-dark); font-size: .65rem; padding: 0 .3rem; cursor: pointer; }
.tab-move.tab-left { border-radius: 4px 0 0 0; border-right: 0; }
.tab-move.tab-right { border-radius: 0 4px 0 0; border-left: 0; }
.tab-move:hover, .tab-move:focus-visible { background: var(--primary-soft); }
.tab-move.tab-eye { border-left: 0; border-right: 0; font-size: .75rem; }
.sheet-tabs[data-tab-hide-only] .tab-move.tab-eye { border-right: 1px solid var(--border); border-radius: 0 4px 0 0; }
.sheet-tabs[data-tab-hide-only].reordering .tab-item a { cursor: default; }
.tab-item.is-hidden .tab-eye { text-decoration: line-through; color: var(--muted); }
.sheet-tabs a.tab-hidden { opacity: .55; font-style: italic; }
.sheet-tabs a.tab-hidden.active { opacity: .8; }
@media (min-width: 641px) { .sheet-tabs a.tab-off { display: none; } }
@media (max-width: 640px) {
    .tab-order-bar, .tab-order > :not(#sheet-order):not(.prev-toggle) { display: none !important; }
    .tab-order:not(:has(#sheet-order)):not(:has(.prev-toggle)) { display: none; }
}
@media print { .drag-handle { display: none; } }

/* Munkaközösségi nézet */
.cv-grid tr.cv-head th, .cv-grid tr.cv-head td { background: var(--primary-soft); border-top: 3px solid var(--primary); height: 2.3rem; }
.cv-grid tr.cv-head th.sticky-col { border-left: 5px solid var(--primary); }
.cv-grid tr.cv-head th .tname { font-weight: 700; font-size: .98rem; color: var(--primary-dark); text-decoration: none; }
.cv-grid tr.cv-row th.sticky-col { border-left: 5px solid var(--primary-line); }
.cv-grid tbody.cv-teacher tr.cv-row:last-child > * { border-bottom: 2px solid var(--primary-line); }
.cv-grid tr.cv-gap td { height: .9rem; padding: 0; background: var(--surface); border-left: 0; border-right: 0; }
.cv-grid tr.cv-head th .tname:hover { text-decoration: underline; }
.cv-grid th.cv-subject { font-weight: 400; padding-left: 1.4rem; }
.cv-grid th.cv-subject a { color: inherit; text-decoration: none; }
.cv-grid th.cv-subject a:hover { text-decoration: underline; }
.cv-grid th.cv-subject { padding-left: .5rem; white-space: nowrap; }
.cv-grid tr.cv-head th.sticky-col { white-space: nowrap; }
.cv-grid th.sticky-col { max-width: none; }
.cv-grid tr.cv-head .subject-order { margin-right: .3rem; }
.cv-hide { margin-left: .3rem; padding: 0 .3rem; border: 1px solid transparent; border-radius: 4px; background: none; color: var(--muted); font: inherit; font-size: .8rem; line-height: 1.3; cursor: pointer; }
.cv-hide:hover, .cv-hide:focus-visible { border-color: var(--primary-border); color: var(--primary-dark); }
.cv-grid tr.cv-row-hidden th.cv-subject a { font-style: italic; }
.cv-grid tr.cv-row-hidden > th, .cv-grid tr.cv-row-hidden > td { border-top-style: dashed; }
.cv-show-hidden { margin-left: .75rem; }
.cv-grid tr.moved > th, .cv-grid tr.moved > td, .cv-grid tbody.moved > tr > th, .cv-grid tbody.moved > tr > td { box-shadow: inset 0 0 0 999px rgba(29, 79, 145, .12); }
.cv-grid th.cv-unbound { min-width: 4.5rem; white-space: normal; font-size: .8rem; }
.cv-grid tbody.inactive th .tname { color: var(--muted); text-decoration: line-through; }
.cv-grid tbody.readonly-row td, .cv-grid tbody.readonly-row .cell { background: #f4f5f7; color: #5f6b75; cursor: default; }
.cv-grid tbody.locked tr.cv-head th { background: #e7eaed; }
.cv-grid tbody.locked tr.cv-head th.sticky-col { border-left-color: var(--muted); }
.add-row select + select { margin-left: .25rem; }
.cv-grid tbody td.cv-na, .cv-grid tbody.readonly-row td.cv-na { background: repeating-linear-gradient(135deg, #f3f4f6, #f3f4f6 4px, #eceef1 4px, #eceef1 8px); }
.cv-grid td.cv-fill { text-align: left; }
.cv-load { display: inline-block; border: 1px solid var(--primary-border); padding: .05rem .5rem; border-radius: 999px; font-size: .85rem; font-weight: 600; margin-right: .5rem; }

/* --- Akadálymentesség (WCAG 2.1 AA), mobil menü, lábléc --- */
:focus-visible { outline: 3px solid var(--primary-dark); outline-offset: 2px; }
.topbar :focus-visible { outline-color: #fff; }
.topbar .navmore-menu :focus-visible { outline-color: var(--primary-dark); }
main.container:focus { outline: none; }
.skip-link {
    position: absolute; left: .5rem; top: -4rem; z-index: 100; background: #fff; color: var(--primary-dark);
    padding: .55rem .9rem; border-radius: var(--radius); font-weight: 600; box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
.skip-link:focus { top: .5rem; }
.table-wrap:focus-visible { outline-offset: 0; }
.filters > * { min-width: 0; }
.doc-toolbar .filters { min-width: 0; }
.doc-class td, .doc-class th, .teacher-sheet td, .teacher-sheet th { overflow-wrap: anywhere; }

.menu-toggle { display: none; }
.topbar-menu { display: contents; }
@media (max-width: 640px) {
    .topbar { padding: .5rem .75rem; }
    .js .menu-toggle {
        display: inline-block; margin-left: auto; background: transparent; color: #fff; font: inherit; font-weight: 600;
        border: 1px solid rgba(255, 255, 255, .7); border-radius: var(--radius); padding: .4rem .75rem; cursor: pointer;
    }
    .topbar-menu { display: flex; flex-direction: column; align-items: stretch; gap: .6rem; flex-basis: 100%; }
    .js .topbar:not(.menu-open) .topbar-menu { display: none; }
    .mainnav { flex-direction: column; flex-wrap: nowrap; }
    .mainnav a, .navmore summary { padding: .5rem .6rem; }
    .navmore-menu { position: static; box-shadow: none; margin: .2rem 0 .4rem .8rem; }
    .usermenu { flex-wrap: wrap; justify-content: flex-start; }
    .teacher-sheet { padding: .75rem; }
}

.sitefooter { border-top: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: .85rem; padding: .8rem 1.25rem; margin-top: 1.5rem; }
.sitefooter p { max-width: 1280px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: .3rem 1.25rem; justify-content: center; }
@media print { .sitefooter, .skip-link, .menu-toggle { display: none !important; } }

/* Menüszerkesztő */
.menu-table td { vertical-align: middle; }
.menu-table .menu-label { width: 100%; min-width: 12rem; padding: .35rem .5rem; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; }
.menu-table .menu-label + .small { display: block; margin-top: .15rem; }
.menu-table select { padding: .3rem .4rem; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; }
.menu-table tr.menu-hidden .menu-label { color: var(--muted); text-decoration: line-through; }
.menu-table tr.menu-group-row td { background: var(--primary-faint); }
.menu-table tr.menu-group-row .menu-label { font-weight: 600; }
.menu-new { max-width: 40rem; margin-top: 1rem; }
table[data-reorder] tr.moved td { background: var(--primary-soft); transition: background .4s; }

/* NAT-ok */
.page-toc { margin: -.5rem 0 1rem; font-size: .92rem; }
.nat-grid th.sticky-col { text-align: left; white-space: nowrap; }
.nat-grid td.nat-out, .nat-grid td.nat-out .cell { background: #f4f5f7; }
.nat-grid tr.nat-own th { font-style: italic; }
.nat-grid tr.nat-new th input { width: 12rem; font: inherit; padding: .15rem .3rem; }
.nat-rollout-form { margin-top: 1rem; }
.nat-diff { border-top: 1px solid var(--border); padding: .5rem 0 .2rem; }
.nat-diff ul { margin: .25rem 0 .2rem 1.6rem; }
.grid td.nat-mismatch { box-shadow: inset 0 0 0 2px #e0a100; }
.nat-note { margin: 0 0 .6rem; }
.nat-mismatch-sample { box-shadow: inset 0 0 0 2px #e0a100; padding: 0 .25rem; }
.nat-rollout-form input[type="number"] { max-width: 9rem; }

/* Grafikus áttekintés (34.): hőtérkép, eltérő irányú oszlopok, százalékos sávok. A színek tokenek (sötét mód). */
:root { --chart-under: #e11d2a; --chart-over: #d0671f; --chart-fill: var(--primary); --chart-full: #2e7d4f; --chart-track: #e6e9ed; --heat-zero: #eef0f2; }
.chart-card h3.heat-group { margin: 1rem 0 .4rem; font-size: 1rem; }
.heatmap { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 4px; }
.heat-tile { display: flex; justify-content: space-between; align-items: baseline; gap: .4rem; padding: .35rem .5rem; border-radius: 4px;
    color: var(--text); text-decoration: none; border: 1px solid rgba(0, 0, 0, .08); min-height: 2.2rem; }
.heat-tile:hover, .heat-tile:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.heat-tile.heat-zero, .load-swatch.heat-zero { background: var(--heat-zero); }
.heat-name { font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.heat-value { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart-table { margin-top: .9rem; }
.chart-table summary { cursor: pointer; color: var(--primary); font-weight: 600; }
.chart-key { display: inline-block; width: .8rem; height: .8rem; border-radius: 2px; vertical-align: -1px; }
.key-under, .bar-under { background: var(--chart-under); }
.key-over, .bar-over { background: var(--chart-over); }
.div-chart { display: grid; gap: 6px; margin-top: .6rem; }
.div-row { display: grid; grid-template-columns: minmax(7rem, 13rem) 1fr 1fr; align-items: center; gap: 0; }
.div-label { padding-right: .6rem; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.div-side { display: flex; align-items: center; gap: .35rem; height: 1.4rem; }
.div-left { justify-content: flex-end; border-right: 1px solid var(--muted); padding-right: 1px; }
.div-right { padding-left: 1px; }
.div-bar { display: block; height: 100%; min-width: 0; }
.div-left .div-bar { border-radius: 4px 0 0 4px; }
.div-right .div-bar { border-radius: 0 4px 4px 0; }
.div-value { font-size: .82rem; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text); }
.pct-chart { list-style: none; margin: .6rem 0 0; padding: 0; display: grid; gap: 4px; }
.pct-row { display: grid; grid-template-columns: 3.5rem 1fr minmax(9rem, 14rem); align-items: center; gap: .6rem; color: var(--text); text-decoration: none; padding: 1px 0; }
.pct-row:hover .pct-label, .pct-row:focus-visible .pct-label { text-decoration: underline; }
.pct-label { font-weight: 600; }
.pct-track { display: block; height: .9rem; background: var(--chart-track); border-radius: 4px; overflow: hidden; }
.pct-fill { display: block; height: 100%; background: var(--chart-fill); border-radius: 4px; }
.pct-fill.pct-full { background: var(--chart-full); }
.pct-value { font-size: .85rem; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
    .div-row { grid-template-columns: 1fr 1fr; }
    .div-label { grid-column: 1 / -1; }
    .pct-row { grid-template-columns: 2.6rem 1fr 7.5rem; gap: .4rem; }
    .pct-value { font-size: .78rem; }
}
@media print {
    .heat-tile, .div-bar, .pct-fill, .chart-key { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .chart-table { display: none; }
}

/* ------------------------------------------------------------------
   Sötét mód (31.): a <html data-theme="dark"> alatt (a felhasználó választása, vagy „Automatikus”
   módban a gép beállítása, lásd layout.php). Előbb a tokenek, utána a beégetett színű elemek.
   A jelzőszínek (terhelés, eltérés, zár, összevonás) sötét háttéren is megkülönböztethetők, a szöveg világos.
   ------------------------------------------------------------------ */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #121619;
    --surface: #1b2127;
    --text: #e3e7eb;
    --muted: #a7b1bb;
    --border: #38424c;
    --primary: #8db8f2;          /* szövegként, kiemelésként; háttérként lásd --primary-bg */
    --primary-bg: #2c5a99;
    --primary-dark: #b8d2f6;
    --primary-soft: #22344c;
    --primary-faint: #1f2934;
    --primary-line: #4f6886;
    --primary-border: #3f5675;
    --danger: #ff8a80;
    --warning-bg: #3d3214;
    --error-bg: #45201d;
    --success-bg: #1d3a24;
    --info-bg: #1c3047;
    --chart-under: #f04545; --chart-over: #e0823f; --chart-fill: #5b97e0; --chart-full: #4caf72; --chart-track: #2c343c; --heat-zero: #2a3138;
    --cross: rgba(141, 184, 242, .12); --cross-head: rgba(141, 184, 242, .22);
}
[data-theme="dark"] .topbar, [data-theme="dark"] .btn.primary, [data-theme="dark"] .sheet-tabs a.active,
[data-theme="dark"] .level-filter a.active, [data-theme="dark"] .toggle.on span { background: var(--primary-bg); border-color: var(--primary-bg); color: #fff; }
[data-theme="dark"] .btn.primary:hover { background: #366bb3; }
[data-theme="dark"] .sheet-grid td[data-piece]::after { background: var(--primary-bg); }
[data-theme="dark"] .plan-tip { background: #e3e7eb; color: #121619; }
[data-theme="dark"] .topbar { background: #1a3355; }
[data-theme="dark"] .field input:not([type=checkbox]):not([type=radio]), [data-theme="dark"] .field select, [data-theme="dark"] .filters input,
[data-theme="dark"] .filters select, [data-theme="dark"] .btn, [data-theme="dark"] .grid .cell:focus, [data-theme="dark"] .sheet-grid .item-note:focus,
[data-theme="dark"] .sheet-grid tr.add-teacher-row select, [data-theme="dark"] .cv-swap, [data-theme="dark"] .cv-split, [data-theme="dark"] kbd, [data-theme="dark"] .cell-split,
[data-theme="dark"] .split-pop, [data-theme="dark"] .order-btn, [data-theme="dark"] .tab-move, [data-theme="dark"] .skip-link,
[data-theme="dark"] textarea, [data-theme="dark"] input, [data-theme="dark"] select { background-color: #151a1f; color: var(--text); }
[data-theme="dark"] .btn:hover, [data-theme="dark"] .navmore-menu a:hover, [data-theme="dark"] .navmore-menu a.active, [data-theme="dark"] .menu-button:hover { background: #26303a; }
[data-theme="dark"] .btn.danger { color: var(--danger); border-color: #6b2c27; }
[data-theme="dark"] .yearswitch select, [data-theme="dark"] .themeswitch select { background-color: #10243d; color: #fff; }
[data-theme="dark"] .table th, [data-theme="dark"] .doc-totals th, [data-theme="dark"] .ts-facts th, [data-theme="dark"] .doc-table tfoot th,
[data-theme="dark"] .doc-table tfoot td { background: #232a32; }
[data-theme="dark"] .table th.sorted { background: #23362b; }
[data-theme="dark"] .grid th, [data-theme="dark"] .grid td, [data-theme="dark"] .sheet-wrap, [data-theme="dark"] .doc-table th,
[data-theme="dark"] .doc-table td, [data-theme="dark"] .load-swatch { border-color: #3d4752; }
[data-theme="dark"] .grid .grade-row th.grade { border-bottom-color: #3d4752; }
[data-theme="dark"] .sheet-tabs a { background: #252d35; }
[data-theme="dark"] .sheet-tabs a:hover { background: #2e3842; }
[data-theme="dark"] .badge, [data-theme="dark"] .imp { background: #2c343c; }
[data-theme="dark"] .badge-foadmin { background: #34305a; }
[data-theme="dark"] .badge-igazgato, [data-theme="dark"] .imp-uj, [data-theme="dark"] .sys-ok, [data-theme="dark"] .appr-ok { background: #1f4029; color: #a8e2b4; }
[data-theme="dark"] .badge-igazgatohelyettes, [data-theme="dark"] .imp-modosul, [data-theme="dark"] .lvl-megjegyzes { background: #1c3550; color: #b7d3f3; }
[data-theme="dark"] .badge-munkakozossegvezeto { background: #46321c; }
[data-theme="dark"] .badge-koordinator { background: #3a2c4c; }
[data-theme="dark"] .badge-warn, [data-theme="dark"] .imp-torles, [data-theme="dark"] .lvl-figyelmeztetes, [data-theme="dark"] .sys-figyelmeztetes,
[data-theme="dark"] .appr-stale { background: #46351a; color: #f5d38f; }
[data-theme="dark"] .imp-hiba, [data-theme="dark"] .lvl-hiba { background: #4a211e; color: #ffb4ab; }
[data-theme="dark"] .appr-none { background: #2a3138; }
[data-theme="dark"] .badge-teaches { color: var(--text); }
[data-theme="dark"] .flash-success { border-color: #2f6b3d; }
[data-theme="dark"] .flash-error, [data-theme="dark"] .danger-zone, [data-theme="dark"] .note-list li { border-color: #74302a; }
[data-theme="dark"] .flash-warning, [data-theme="dark"] .lock-chip, [data-theme="dark"] .scope-note, [data-theme="dark"] .version-banner,
[data-theme="dark"] .choice-list .confirm-line, [data-theme="dark"] .recovery-box, [data-theme="dark"] .adopt-card { border-color: #6f5a22; }
[data-theme="dark"] .flash-info { border-color: #2e4f73; }
[data-theme="dark"] .warn-text, [data-theme="dark"] .doc-draft { color: #f0b46a; }
[data-theme="dark"] .perm-changed, [data-theme="dark"] .row-current td { background: #3a3218; }
[data-theme="dark"] fieldset:disabled input, [data-theme="dark"] fieldset:disabled select { background: #20262c; }
[data-theme="dark"] .toggle span { background: #4a545e; }
[data-theme="dark"] tr.act-sikertelen_bejelentkezes td, [data-theme="dark"] tr.act-belepesi_korlat td, [data-theme="dark"] tr.act-gyanus_belepes td, [data-theme="dark"] tr.act-hozzaferes_megtagadva td,
[data-theme="dark"] tr.act-kenyszeritett_feloldas td, [data-theme="dark"] .note-list li { background: #2e1d1b; }
[data-theme="dark"] .sheet-status.error, [data-theme="dark"] .diff-old, [data-theme="dark"] .cmp-a, [data-theme="dark"] .delta-down { color: #ff9d94; }
[data-theme="dark"] .sheet-status.warning { color: #f0c36a; }
[data-theme="dark"] .diff-ok, [data-theme="dark"] .ok-text, [data-theme="dark"] .diff-new, [data-theme="dark"] .version-state-hatalyos,
[data-theme="dark"] .cmp-b, [data-theme="dark"] .delta-up, [data-theme="dark"] .table.log .values .new { color: #7fd69a; }
[data-theme="dark"] .table.log .values .old { color: #f0b46a; }
[data-theme="dark"] .stat-under { color: #ff8a8a; }
/* Tantárgyi lap */
[data-theme="dark"] .sheet-grid tr.plan-row th, [data-theme="dark"] .sheet-grid tr.plan-row td { background: #1e2733; color: #c3d2e6; }
[data-theme="dark"] .sheet-grid tr.prev-row th, [data-theme="dark"] .sheet-grid tr.prev-row td { background: #1e2733; color: #aebccf; }
[data-theme="dark"] .sheet-grid tr.prev-row td.prev-same { color: #7fd3a4; }
[data-theme="dark"] .sheet-grid tr.prev-row td.prev-part, [data-theme="dark"] .sheet-grid tr.prev-row td.prev-change, [data-theme="dark"] .prev-change-swatch { background: #3d3214; color: #f0d58a; }
[data-theme="dark"] .prev-ghost, [data-theme="dark"] .prev-ghost-swatch { border-color: #7f93ad; color: #b9c7d8; }
[data-theme="dark"] .sheet-grid td.locked .item-note, [data-theme="dark"] .lockmark { color: #98a2ac; }
[data-theme="dark"] .sheet-grid td.saving { background: #3d3514; }
[data-theme="dark"] .sheet-grid td.saved { background: #1d3d27; }
[data-theme="dark"] .sheet-grid td.error { background: #4a211e; }
[data-theme="dark"] .sheet-grid td.locked, [data-theme="dark"] .sheet-grid td.locked .cell { background: #262c32; color: #8e98a2; }
[data-theme="dark"] .sheet-grid th.locked { background: #2b3238 !important; }
[data-theme="dark"] .sheet-grid tr.locked th.sticky-col { background: #283037; }
[data-theme="dark"] .sheet-grid tr.readonly-row td, [data-theme="dark"] .sheet-grid tr.readonly-row .cell, [data-theme="dark"] .sheet-grid tr.readonly-row .item-note,
[data-theme="dark"] .cv-grid tbody.readonly-row td, [data-theme="dark"] .cv-grid tbody.readonly-row .cell, [data-theme="dark"] .nat-grid td.nat-out,
[data-theme="dark"] .nat-grid td.nat-out .cell { background: #20262c; color: #9aa4ae; }
[data-theme="dark"] .cv-grid tbody.locked tr.cv-head th { background: #262c32; }
[data-theme="dark"] .cv-grid tbody td.cv-na { background: repeating-linear-gradient(135deg, #1f252b, #1f252b 4px, #252c33 4px, #252c33 8px); }
[data-theme="dark"] .sheet-grid tr.add-teacher-row > * { background: #1d242b; }
[data-theme="dark"] .class-card .cc-none { background: #2a333c; }
[data-theme="dark"] .class-card .cc-group { color: #c9b4f0; background: #2b2340; }
[data-theme="dark"] .class-card .cc-note { color: #f0c56a; background: #3a2f18; }
[data-theme="dark"] .sheet-grid td.cc { --cc-tint: 16%; }
[data-theme="dark"] .sheet-grid td.ofo-own { --cc-tint: 34%; }
[data-theme="dark"] .approve-bar { background: #1f262d; }
[data-theme="dark"] .revoke-btn:hover { color: #f0a3a3; border-color: #7a3a3a; }
[data-theme="dark"] .approve-btn { background: #1f4029; border-color: #2f6b3d; color: #a8e2b4; }
[data-theme="dark"] .final-banner { background: #1d3a24; border-color: #2f6b3d; color: #bfe9c9; }
[data-theme="dark"] .draft-banner { background: #3d3214; border-color: #6f5a22; color: #f5d38f; }
/* Jelzőszínek: terhelés, eltérés, korlát */
[data-theme="dark"] .diff-missing { background: #1f3b63 !important; color: #cfe0ff; }
[data-theme="dark"] .load-under { background: #d42020 !important; color: #fff; }
[data-theme="dark"] .load-1 { background: #1f4d2c; color: #d5f2dc; }
[data-theme="dark"] .load-2 { background: #574a12; color: #fbeeb6; }
[data-theme="dark"] .load-3 { background: #6a3c14; color: #ffdcb8; }
[data-theme="dark"] .load-4 { background: #702222; color: #ffd3d3; }
[data-theme="dark"] .meter, [data-theme="dark"] .load-dist .load-ok, [data-theme="dark"] .load-dist .load-none,
[data-theme="dark"] .load-dist-legend .load-ok, [data-theme="dark"] .load-dist-legend .load-none { background: #2a343f; }
[data-theme="dark"] .meter i[data-load="load-under"] { background: #f04545; }
[data-theme="dark"] .appr-bar .appr-none { background: #2a343f; }
[data-theme="dark"] .appr-bar .appr-ok { background: #5fbf70; }
[data-theme="dark"] .appr-bar .appr-stale { background: #f0954a; }
[data-theme="dark"] .meter i[data-load="load-1"] { background: #5fbf70; }
[data-theme="dark"] .meter i[data-load="load-2"] { background: #d9b82a; }
[data-theme="dark"] .meter i[data-load="load-3"] { background: #f0954a; }
[data-theme="dark"] .meter i[data-load="load-4"] { background: #ee6b6b; }
[data-theme="dark"] .load-card[data-load="load-under"] { background: color-mix(in srgb, #d42020 22%, var(--surface)); border-color: #f04545; }
[data-theme="dark"] .load-card[data-load="load-3"], [data-theme="dark"] .load-card[data-load="load-4"] { border-color: #ee6b6b; }
[data-theme="dark"] .diff-extra { background: #5c3a10 !important; color: #ffdcb0; }
[data-theme="dark"] .over-max { background: #5a1f25 !important; color: #ffc7cc; }
/* Kártyák, összevonások, húzás */
[data-theme="dark"] .hcard, [data-theme="dark"] .sheet-grid.cards input.cell:not(:placeholder-shown) {
    background: #22344c; border-color: #4a6a94; color: #dbe8fa; box-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
[data-theme="dark"] .sheet-grid.cards .plan-card.done { background: transparent; border-color: transparent; color: #7fd69a; box-shadow: none; }
[data-theme="dark"] .sheet-grid.cards .plan-card.over, [data-theme="dark"] .drag-ghost.refused { background: #4a211e; border-color: #8a3a33; color: #ffb4ab; }
[data-theme="dark"] .sheet-grid.cards input.cell[readonly]:not(:placeholder-shown) { background: #20262c; color: #9aa4ae; box-shadow: none; }
[data-theme="dark"] .sheet-grid td.drop-over { background-color: #1f3350; }
[data-theme="dark"] .sheet-grid td.merged, [data-theme="dark"] .merge-swatch, [data-theme="dark"] .drag-ghost.merging { background: #2e2747; }
[data-theme="dark"] .sheet-grid td.merged.merged-1 { background: #183a40; }
[data-theme="dark"] .sheet-grid td.merged.merged-2 { background: #3d2e17; }
[data-theme="dark"] .sheet-grid td.merged.merged-3 { background: #42202f; }
[data-theme="dark"] .merged-tag, [data-theme="dark"] .drag-ghost.merging { color: #c6b3f5; }
[data-theme="dark"] .gmark { background: #22344c; color: #b7d3f3; }
[data-theme="dark"] .sheet-grid.reordering tbody tr.dragging > *, [data-theme="dark"] tr.dragging > *, [data-theme="dark"] .tab-item.dragging { background: #4a3d12 !important; }
[data-theme="dark"] .heat-tile { border-color: rgba(255, 255, 255, .08); }
[data-theme="dark"] .topbar .badge { background: rgba(255, 255, 255, .16); color: #fff; }

/* --- Sűrűség és betűméret felhasználónként (32.) --- */
/* A betűméret a gyökérelemé, így minden rem-ben megadott méret (cellák, kártyák, panelek) együtt nő. */
html[data-font="nagy"] { font-size: 17px; }
html[data-font="nagyobb"] { font-size: 19px; }
/* A sűrűség csak a táblázatok törzsét érinti; a rögzített fejlécek és összegsorok helye nem változik. */
html[data-density="kompakt"] .table th, html[data-density="kompakt"] .table td { padding: .2rem .45rem; }
html[data-density="kompakt"] .grid tbody th, html[data-density="kompakt"] .grid tbody td { height: 1.5rem; }
html[data-density="kompakt"] .grid tbody .cell, html[data-density="kompakt"] .sheet-grid tbody .item-note { height: 1.5rem; }
html[data-density="kompakt"] .grid tbody th, html[data-density="kompakt"] .grid tbody td, html[data-density="kompakt"] .grid .cell { min-width: 2rem; }
html[data-density="kompakt"] .hcard, html[data-density="kompakt"] .sheet-grid.cards input.cell:not(:placeholder-shown) { height: 1.3rem; margin-top: .1rem; margin-bottom: .1rem; }
html[data-density="tagas"] .table th, html[data-density="tagas"] .table td { padding: .7rem .7rem; }
html[data-density="tagas"] .grid tbody th, html[data-density="tagas"] .grid tbody td { height: 2.5rem; }
html[data-density="tagas"] .grid tbody .cell, html[data-density="tagas"] .sheet-grid tbody .item-note { height: 2.5rem; }
html[data-density="tagas"] .grid tbody td, html[data-density="tagas"] .grid .cell { min-width: 2.8rem; }
html[data-density="tagas"] .hcard, html[data-density="tagas"] .sheet-grid.cards input.cell:not(:placeholder-shown) { height: 1.9rem; }
.appearance-form .choice-list { margin-bottom: 1rem; }
.appearance-form legend { font-weight: 600; margin-bottom: .3rem; }
@media print { html[data-font] { font-size: 15px; } }

/* --- Pedagógus oldalpanel (33.) --- */
.sheet-grid a.tname { color: inherit; text-decoration: none; }
.sheet-grid a.tname:hover, .sheet-grid a.tname:focus-visible { text-decoration: underline; color: var(--primary); }
.teacher-panel { z-index: 52; }
.tp-load { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .6rem; margin: .5rem 0 0; }
.tp-load .load { font-weight: 700; font-size: 1.1rem; padding: .1rem .45rem; border-radius: var(--radius); }
.tp-table td { vertical-align: top; }
.tp-classes { display: block; font-size: .8rem; color: var(--muted); }
.tp-table tr.tp-other td { color: var(--muted); }
.tp-list { margin: 0; padding-left: 1.1rem; }
.tp-links { margin-top: 1rem; }

/* --- Billentyűparancsok (35.) --- */
kbd { display: inline-block; font: inherit; font-size: .82em; line-height: 1.3; padding: .05rem .4rem; border: 1px solid var(--border); border-bottom-width: 2px;
    border-radius: 4px; background: var(--surface); color: var(--text); white-space: nowrap; }
.sitefooter .linklike kbd { font-size: .78em; padding: 0 .3rem; }
.shortcuts-dialog { width: min(46rem, calc(100% - 2rem)); max-height: calc(100vh - 2rem); overflow-y: auto; border: 1px solid var(--border); border-radius: 10px;
    padding: 1rem 1.25rem 1.25rem; background: var(--surface); color: var(--text); box-shadow: 0 12px 36px rgba(31, 41, 51, .25); }
.shortcuts-dialog::backdrop { background: rgba(15, 23, 32, .45); }
.shortcut-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(19rem, 100%), 1fr)); gap: .5rem 1.5rem; }
.shortcut-group h3 { font-size: .9rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: .9rem 0 .4rem; }
.shortcut-list { display: grid; grid-template-columns: max-content 1fr; gap: .3rem .75rem; margin: 0; font-size: .92rem; }
.shortcut-list dt { text-align: right; }
.shortcut-list dd { margin: 0; }
@media (max-width: 480px) { .shortcut-list { grid-template-columns: 1fr; } .shortcut-list dt { text-align: left; } .shortcut-list dd { margin-bottom: .3rem; } }
@media print { .shortcuts-dialog { display: none; } }

/* --- Kiosztási javaslat (37.) --- */
.suggest { margin-top: .35rem; font-size: .88rem; display: flex; flex-wrap: wrap; gap: .15rem .7rem; align-items: baseline; }
.suggest-label { font-weight: 600; color: var(--muted); }
.suggest-item .linklike { color: var(--primary); font-weight: 600; }

/* --- Szükségletszámítás (38.) --- */
.demand-short { color: var(--danger); }
.demand-ok { color: #1d7a3a; }
[data-theme="dark"] .demand-short { color: #ff8a80; }
[data-theme="dark"] .demand-ok { color: #7bd88f; }
.demand-who { margin-top: .2rem; }
.demand-who summary { cursor: pointer; color: var(--muted); }
.demand-who ul { margin: .25rem 0 0; padding-left: 1.1rem; }
.compact-grid { gap: 0 1.25rem; }
.badge-absent { background: #fde7c7; color: #6b3d00; text-decoration: none; }
[data-theme="dark"] .badge-absent { background: #5a3d12; color: #ffe2b8; }

/* Frissítés: a változásnapló új része */
.changelog { max-height: 24rem; overflow: auto; border: 1px solid var(--border); border-radius: 6px; padding: .25rem 1rem; margin-bottom: 1rem; }
.changelog h3 { font-size: 1rem; margin: .75rem 0 .25rem; }
.changelog ul { margin: .25rem 0 .5rem; padding-left: 1.25rem; }
.changelog p { margin: .25rem 0; }

/* --- Nyomtatóbarát nézetek (2.17) --- */
/* A tantárgyi és a munkaközösségi nézet nyomtatási elrendezése: az app.js nyomtatás előtt teszi a html-re a
   .printing osztályt, megméri a táblázatot, és a lap (fekvő A4 vagy A3) szélességéhez kicsinyíti. A fejléc
   minden oldalon megismétlődik, az összegsor csak a végén áll. */
.print-ctl { display: inline-flex; align-items: stretch; }
.print-ctl > .btn { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.print-ctl .print-more > summary.btn { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 0; height: 100%; }
.print-head .print-date { font-weight: 400; }
/* Osztálynézet: minden osztály egymás után (két hasábban, egy osztály nem törik ketté). */
.class-print { columns: 2 30rem; column-gap: 1.5rem; }
.class-print-block { break-inside: avoid; margin: 0 0 1.25rem; padding: .75rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.class-print-block h2 { margin: 0 0 .4rem; font-size: 1.05rem; }
.class-print-block .class-table { width: 100%; }
.class-print-block .class-table th, .class-print-block .class-table td { padding: .2rem .4rem; }
@media print {
    .class-print { columns: 125mm; column-gap: 8mm; } /* fekvő A4-en két, A3-on három hasáb */
    .class-print-block { border: 0; border-radius: 0; padding: 0; margin: 0 0 5mm; }
    .class-print-block h2 { font-size: 10.5pt; margin-bottom: 1mm; }
    .class-print-block .class-table { font-size: 7.5pt; }
    .class-print-block .class-table th, .class-print-block .class-table td { padding: .5mm 1mm; }
    .class-print-block .class-table td.small, .class-print-block .badge { font-size: inherit; }
    .class-swatch, .badge-warn { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
html.printing, html.printing[data-font] { font-size: 15px; }
html.printing .sheet-wrap { overflow: visible; width: min-content; max-width: none; border: 0; }
html.printing .sheet-grid { font-size: .8rem; border: 1px solid #c9d0d6; }
html.printing .sheet-grid thead th { position: relative; top: auto; transform: none; }
html.printing .grid th.sticky-col { position: static; }
html.printing .sheet-grid thead th.sticky-col { position: relative; left: auto; }
html.printing .sheet-grid tfoot th, html.printing .sheet-grid tfoot td { position: static; transform: none; }
/* Ami nyomtatásban nem látszik, a méréskor se foglaljon helyet (a táblázat szélessége így ugyanaz, mint a lapon). */
html.printing .sheet-grid .no-print, html.printing .sheet-grid .lockmark, html.printing .sheet-grid .plan-card, html.printing .sheet-grid .plan-split,
html.printing .sheet-grid .cell-split, html.printing .sheet-grid .merge-badge, html.printing .sheet-grid .prev-ghost, html.printing .sheet-grid .drag-handle,
html.printing .sheet-grid .cv-show-hidden, html.printing .sheet-grid .cv-hide, html.printing .sheet-grid tr.prev-row th a { display: none !important; }
html.printing .sheet-grid.cards td[data-plan-c] .plan-val { display: inline; }
html.printing .sheet-grid th.sticky-col { min-width: 0; max-width: none; white-space: nowrap; padding: .1rem .4rem; }
html.printing .grid th, html.printing .grid td, html.printing .grid tbody th, html.printing .grid tbody td { height: 1.45rem; }
html.printing .grid tbody .cell { height: 1.45rem; }
html.printing #sheet td, html.printing #sheet th.letter, html.printing #sheet .cell,
html.printing #cv td, html.printing #cv th.letter, html.printing #cv .cell { min-width: 1.5rem; }
html.printing #sheet input.cell { width: 1.5rem; }
html.printing #sheet td.total, html.printing #cv td.total { min-width: 2.2rem; }
html.printing .sheet-grid.cards input.cell:not(:placeholder-shown) { height: 1.2rem; margin: .08rem .1rem; border: 0; box-shadow: none; background: none; }
html.printing .sheet-grid thead th { height: 1.6rem; padding: .1rem .2rem; }
html.printing #sheet td.load { min-width: 4.4rem; }
html.printing .sheet-grid tr.readonly-row td, html.printing .sheet-grid tr.readonly-row .cell,
html.printing .cv-grid tbody.readonly-row td, html.printing .cv-grid tbody.readonly-row .cell { background: none; color: inherit; }
html.printing .sheet-grid tr.locked th, html.printing .sheet-grid tr.locked td, html.printing .sheet-grid td.locked-col { background: none; }
html.printing .cv-grid tr.cv-head th, html.printing .cv-grid tr.cv-head td { height: 1.6rem; border-top-width: 2px; }
html.printing .cv-grid tr.cv-head th .tname { font-size: .85rem; }
html.printing .cv-grid tr.cv-gap td { height: .3rem; }
html.printing .cv-grid tbody.cv-teacher { break-inside: avoid; }
html.printing .cv-grid .cv-load { padding: 0 .4rem; }
html.printing .sheet-grid tr { break-inside: avoid; }
html.printing .sheet-grid td.cross-row, html.printing .sheet-grid td.cross-col, html.printing .sheet-grid th.cross-head { box-shadow: none; }
@media print {
    .sheet-actions, .view-toolbar, .tab-tools, .help-box, .sheet-below, .scope-note, #order-badge, .lockmark, .cv-show-hidden, .cv-hide, .prev-row th a { display: none !important; }
    .pagehead { margin-bottom: .3rem; }
    .card.sheet > h2 { margin: 0 0 .3rem; }
    .sheet-grid td.ofo-own, .ofo-mark, .cv-grid tr.cv-head th, .cv-grid tr.cv-head td, .cv-grid tbody td.cv-na { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .sheet-grid td.ofo-own { background: none; }
}

/* --- Hivatalos dokumentum: modern képernyős nézet (2.18) ---
   Csak a képernyőre: a nyomtatott dokumentum (jogszabályi forma) változatlan. A színek a többi nézet jelöléseit követik
   (osztályszín-jelvény, terhelés-színek, kék fejléc). */
.doc-title h1 { margin: 0; font-size: 1.6rem; }
.doc-title .sub { margin: .15rem 0 0; color: var(--muted); font-size: .9rem; }
.doc-chips, .doc-kpis { display: flex; flex-wrap: wrap; gap: .5rem; flex-basis: 100%; margin: 0; }
.chip { display: inline-flex; padding: .2rem .7rem; border-radius: 999px; font-size: .85rem; font-weight: 600; background: #eef1f4; color: #33415a; }
.chip-warn { background: var(--warning-bg); color: #8a4b00; }
.chip-ok { background: var(--success-bg); color: #146c2e; }
.doc-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .75rem; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--primary); border-radius: 10px; padding: .7rem 1rem; }
.kpi b { display: block; font-size: 1.55rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi span { font-size: .8rem; color: var(--muted); }
.kpi-over { border-top-color: #d9822b; }
.kpi-pos { border-top-color: #2f8f5b; }
.doc-tags { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .4rem; margin: .15rem 0; }
.doc-tags .sn { font-weight: 600; margin-right: .1rem; }
.tag { display: inline-flex; gap: .25rem; align-items: baseline; padding: .05rem .45rem; border-radius: 5px; background: var(--primary-faint); border: 1px solid var(--primary-border); font-size: .8rem; font-variant-numeric: tabular-nums; white-space: normal; }
.tag i { font-style: normal; font-weight: 700; color: var(--primary-dark); }
.tag em { font-style: normal; color: var(--muted); }
.tag-other { background: #f5f5f2; border-color: #e2e0d6; }
.who { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.av { flex: none; width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .8rem; color: #fff; }
.ofo { display: inline-block; padding: 0 .4rem; border-radius: 4px; font-size: .75rem; font-weight: 700; margin-left: .1rem; }
.pill { display: inline-block; min-width: 2.3rem; text-align: center; padding: 0 .5rem; border-radius: 999px; font-weight: 700; font-size: .82rem; }
.pill.load-ok { border: 1px solid var(--border); color: var(--muted); font-weight: 600; }
.pill.load-none { color: var(--muted); }
.miss { color: #b05a00; font-weight: 600; }
.official-doc .dash { display: none; }
@media screen {
    .doc-toolbar { align-items: flex-end; }
    .official-doc { background: transparent; border: 0; padding: 0; }
    .official-doc .doc-head { display: none; }
    .doc-plain { display: none; }
    .doc-section { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1rem 1.25rem; margin: 0 0 1rem; }
    .doc-section h2 { border-bottom: 0; font-size: 1.05rem; margin-top: 0; }
    .doc-teachers { border-collapse: separate; border-spacing: 0; font-size: .9rem; }
    .doc-teachers th, .doc-teachers td { border: 0; border-bottom: 1px solid #e6eaef; padding: .55rem .6rem; vertical-align: middle; }
    .doc-teachers thead th { position: sticky; top: 0; z-index: 1; background: var(--primary-soft); color: var(--primary-dark); font-size: .74rem; letter-spacing: .04em; text-transform: uppercase; border-bottom: 2px solid var(--primary-line); }
    .doc-teachers thead th:first-child { border-top-left-radius: 8px; }
    .doc-teachers thead th:last-child { border-top-right-radius: 8px; }
    .doc-teachers tbody tr:hover td { background: var(--primary-faint); }
    .doc-teachers td.num { font-variant-numeric: tabular-nums; }
    .doc-teachers tfoot th, .doc-teachers tfoot td { background: var(--primary-faint); border-top: 2px solid var(--primary-line); border-bottom: 0; }
}
/* A pedagógusok táblázata vízszintes görgetés nélkül (2.23.1): keskenyebb képernyőn tömörebb, tablet álló helyzetben
   és telefonon pedagógusonként kártya, a cellák a saját címkéjükkel. */
@media screen and (max-width: 1100px) {
    .doc-teachers { font-size: .85rem; }
    .doc-teachers th, .doc-teachers td { padding: .45rem .35rem; }
    .doc-teachers thead th { letter-spacing: 0; font-size: .7rem; }
    .doc-teachers .av { display: none; }
}
@media screen and (max-width: 900px) {
    .doc-teachers, .doc-teachers tbody, .doc-teachers tfoot { display: block; }
    .doc-teachers thead, .doc-teachers colgroup, .doc-teachers .t-empty, .doc-teachers tfoot th:first-child { display: none; }
    .doc-teachers tr { display: grid; grid-template-columns: 2rem repeat(4, minmax(0, 1fr)); gap: .4rem .75rem; border: 1px solid var(--border); border-radius: 8px; padding: .6rem .75rem; margin-bottom: .6rem; background: var(--surface); }
    .doc-teachers th, .doc-teachers td { display: block; border: 0 !important; padding: 0; background: none !important; text-align: left; }
    .doc-teachers td[data-label]::before { content: attr(data-label); display: block; font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
    .doc-teachers td.t-ssz::before { content: none; }
    .doc-teachers td.num, .doc-teachers th.t-name { text-align: left; white-space: normal; }
    .doc-teachers td.t-ssz { color: var(--muted); }
    /* az 1. oszlopban csak a sorszám áll, a többi adat a 2–5. oszlopban */
    .doc-teachers .t-name { grid-column: 2 / -1; }
    .doc-teachers td.small { grid-column: span 2; }
    .doc-teachers td.small:nth-child(3), .doc-teachers td.t-bound, .doc-teachers td.t-sum { grid-column-start: 2; }
    .doc-teachers td.t-wide { grid-column: 2 / -1; }
    .doc-teachers td.t-disc { grid-column: span 3; }
    .doc-teachers tfoot tr { grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); background: var(--primary-faint); }
    .doc-teachers tfoot .t-name { grid-column: 1 / -1; }
    .doc-teachers tfoot td.t-disc { grid-column: auto; }
}
@media screen and (max-width: 600px) {
    .doc-teachers td.small, .doc-teachers td.t-disc { grid-column: 2 / -1; }
    .doc-teachers td[data-label]::before { overflow-wrap: anywhere; }
}
@media screen {
    .doc-classes { gap: 1rem; }
    /* keskeny kártyán se törjön betűnként: szóhatáron törjön, az oszlopok kapjanak ésszerű szélességet (2.18.1) */
    .doc-classes { grid-template-columns: repeat(auto-fill, minmax(min(460px, 100%), 1fr)); }
    .doc-class td, .doc-class th { overflow-wrap: break-word; }
    .doc-class th:first-child, .doc-class td:first-child { min-width: 7rem; }
    .doc-class th.num, .doc-class td.num { min-width: 5.5rem; }
    .doc-class thead th { white-space: normal; hyphens: manual; }
    .doc-class { border-collapse: separate; border-spacing: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; font-size: .84rem; }
    .doc-class caption { padding: .5rem .7rem; background: var(--primary-soft); border: 1px solid var(--border); border-bottom: 0; border-radius: 8px 8px 0 0; color: var(--primary-dark); }
    .doc-class th, .doc-class td { border: 0; border-bottom: 1px solid #eef1f4; }
    .doc-class thead th { background: var(--primary-faint); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
    .doc-class tfoot th, .doc-class tfoot td { background: var(--primary-faint); border-top: 2px solid var(--primary-line); border-bottom: 0; }
    .doc-totals th, .doc-totals td { border-color: #e6eaef; }
    .doc-totals th { background: transparent; font-weight: 500; color: #33415a; }
    .doc-totals td { font-weight: 700; font-variant-numeric: tabular-nums; }
    .doc-table:not(.doc-teachers):not(.doc-class):not(.doc-totals) th, .doc-table:not(.doc-teachers):not(.doc-class):not(.doc-totals) td { border-color: #e6eaef; }
}
@media print {
    .doc-tags, .doc-chips, .doc-kpis, .av, .miss { display: none !important; }
    .doc-plain { display: block; }
    .official-doc .dash { display: inline; }
    .ofo { background: none !important; color: inherit !important; padding: 0; font-weight: 400; font-size: inherit; }
    .pill { background: none !important; border: 0; padding: 0; min-width: 0; font-weight: 400; font-size: inherit; text-align: right; }
    .who { display: block; min-width: 0; }
}
[data-theme="dark"] .chip { background: #2a333c; color: #cbd5df; }
[data-theme="dark"] .chip-warn { background: #3d3214; color: #f5d38f; }
[data-theme="dark"] .chip-ok { background: #1f3a26; color: #9fd9aa; }
[data-theme="dark"] .tag { background: #1f2c3d; border-color: #34496a; }
[data-theme="dark"] .tag i { color: #b7cdee; }
[data-theme="dark"] .tag-other { background: #2b2a25; border-color: #46433a; }
[data-theme="dark"] .doc-teachers th, [data-theme="dark"] .doc-teachers td, [data-theme="dark"] .doc-class th, [data-theme="dark"] .doc-class td,
[data-theme="dark"] .doc-totals th, [data-theme="dark"] .doc-totals td { border-color: #333d46; }
[data-theme="dark"] .doc-totals th { color: #cbd5df; }
[data-theme="dark"] .doc-teachers thead th, [data-theme="dark"] .doc-class thead th, [data-theme="dark"] .doc-class caption { color: #b7cdee; }
[data-theme="dark"] .miss { color: #f0b46a; }
/* Tisztségek és kedvezmények (2.21) */
.offices-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 0 1rem; align-items: start; }
@media print {
    .offices-page .offices-grid { display: block; }
    .offices-page .card { break-inside: auto; }
    .offices-page tr { break-inside: avoid; }
    .offices-page h2 { break-after: avoid; }
    .offices-page .badge { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.dt-list td:first-child input { width: min(28rem, 100%); }
.dt-list td:first-child .inline-form { margin: 0; }
#dt-new { width: min(28rem, 100%); }

/* --- Közös eszközsáv a nézetekben (3.1) ---
   Tantárgyi, munkaközösségi és osztálynézet (és az Összesítés): a cím mellett egy sáv, mindenhol ugyanabban a sorrendben
   (állapot · épület · jelzések · szerkesztés · Excel és nyomtatás); a csoportokat vékony vonal választja el.
   A fülsor végén (.tabs-row) a fülek és a pedagógusok sorrendjének ikongombjai. */
.pagehead.view-head { align-items: center; }
.view-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .4rem .5rem; margin-left: auto; }
.view-toolbar .sheet-status:empty { display: none; }
.view-toolbar .sheet-status { max-width: 32rem; }
.vt-group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.vt-group + .vt-group { border-left: 1px solid var(--border); padding-left: .5rem; }
.view-toolbar .building-filter { margin: 0; gap: .35rem; font-size: .9rem; }
.view-toolbar .building-filter select { width: auto; max-width: 12rem; }
.view-toolbar .btn { padding: .38rem .75rem; line-height: 1.3; }
.view-toolbar .btn.small { padding: .38rem .6rem; font-size: .88rem; }
.btn.icon { min-width: 2.3rem; padding-left: .5rem !important; padding-right: .5rem !important; text-align: center; }
.btn[disabled]:hover { background: var(--surface); }
/* Nézeti jelzés: a lenyomott (kék) gomb azt jelenti, hogy a jelzés látszik. */
.btn.mark[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary-border); color: var(--primary-dark); font-weight: 600; }
.btn.mark[aria-pressed="false"] { color: var(--muted); }
.btn.mark:focus-visible, .btn.icon:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
/* Gombként megjelenő lenyíló menü (Nyomtatás ▾, Kapcsolódó oldalak ▾): a főmenü lenyíló mintája, világos gombbal. */
.navmore.dd { display: inline-flex; }
.navmore.dd > summary.btn { color: var(--text); font-size: inherit; padding: .38rem .6rem; border-radius: var(--radius); line-height: 1.3; }
.navmore.dd > summary.btn::after { content: " ▾"; font-size: .75em; color: var(--muted); }
.navmore.dd > summary.btn:hover, .navmore.dd[open] > summary.btn { background: #f0f2f4; }
.navmore.dd .navmore-menu { left: auto; right: 0; min-width: 13rem; }
.navmore-menu .menu-head { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .35rem .6rem .15rem; }
.navmore-menu .menu-radio { display: flex; align-items: center; gap: .45rem; padding: .35rem .6rem; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.navmore-menu .menu-radio:hover { background: #f0f2f4; }
.navmore-menu .menu-sep { border-top: 1px solid var(--border); margin: .3rem .2rem; }
[data-theme="dark"] .navmore.dd > summary.btn:hover, [data-theme="dark"] .navmore.dd[open] > summary.btn, [data-theme="dark"] .navmore-menu .menu-radio:hover { background: #26303a; }
[data-theme="dark"] .btn[disabled]:hover { background: var(--surface); }
/* A fülsor végén, az utolsó fül után jobbra igazítva: a fülek és a pedagógusok sorrendjének ikongombjai. */
.sheet-tabs > .tab-tools { margin: 0 0 0 auto; align-self: center; padding: 0 0 0 .5rem; gap: .3rem .5rem; flex-wrap: nowrap; }
.tab-tools .btn.icon { padding-top: .12rem; padding-bottom: .12rem; min-width: 2rem; }
.tab-tools .small.muted { white-space: nowrap; }
/* Keskeny ablakban a jelzőgombokon csak az ikon látszik (a teljes név a buborékban és a felolvasónak). */
@media (max-width: 1100px) {
    .btn.mark .mark-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (max-width: 900px) {
    .view-toolbar { justify-content: flex-start; margin-left: 0; }
}
@media (max-width: 640px) {
    /* Telefonon a fülsor helyett lista van; a pedagógussorrend gombja megmarad. */
    .sheet-tabs:has(#sheet-order) { display: flex; border-bottom: 0; margin-bottom: .5rem; }
    .sheet-tabs:has(#sheet-order) > a { display: none; }
    .tab-tools > :not(#sheet-order) { display: none !important; }
    .vt-group + .vt-group { border-left: 0; padding-left: 0; }
}

/* --- 3.2: munkaközösségi nézet – tavalyi tanárok, cellapanel --- */
/* Más tanítja, mint tavaly: sárga jel a cella bal alsó sarkában (a jobb felső a megjegyzésé). */
.cv-grid td.prev-other::before, .prev-other-swatch::before { content: ""; position: absolute; bottom: 0; left: 0; border-style: solid;
    border-width: .55rem 0 0 .55rem; border-color: transparent transparent transparent #d99a00; pointer-events: none; }
.prev-other-swatch { position: relative; padding-left: .8rem; }
@media print { .cv-grid td.prev-other::before { display: none; } }
@media (forced-colors: active) { .cv-grid td.prev-other::before { border-left-color: CanvasText; } }

/* 4.0: Kréta-import – a két mód választása kártyaként, alatta a mód leírása és eredménye. */
.kreta-modes { display: grid; gap: .6rem; }
.checks label.kreta-mode { display: grid; grid-template-columns: auto 1fr; column-gap: .6rem; row-gap: .25rem; align-items: start;
    padding: .7rem .85rem; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; }
.kreta-mode > input { grid-row: 1 / span 3; margin-top: .25rem; }
.kreta-mode > strong, .kreta-mode > .hint, .kreta-mode > .small { grid-column: 2; }
.checks label.kreta-mode:has(input:checked) { border-color: var(--primary); background: var(--primary-faint); }
.kreta-summary li { margin-bottom: .2rem; }

/* 4.1: osztályfőnök a listában; 4.1.1: épületek jelölőnégyzettel a táblázatban */
.bldg-col, .bldg-cell { text-align: center; width: 1%; }
.bldg-head { display: inline-flex; flex-direction: column; align-items: center; gap: .2rem; font-weight: inherit; margin: 0; cursor: pointer; }
.bldg-head span { max-width: 7rem; white-space: normal; line-height: 1.15; }
.bldg-cell input, .bldg-head input { width: 1.05rem; height: 1.05rem; margin: 0; cursor: pointer; }
.bldg-cell input:disabled { cursor: not-allowed; }
.head-pick { margin: 0; }
.head-pick select { font: inherit; font-size: .92rem; padding: .2rem .3rem; border: 1px solid var(--border); border-radius: var(--radius); max-width: 15rem; width: 100%; background: transparent; }
@media print { .head-pick select { border: 0; appearance: none; padding: 0; } }

/* 5.0: AMI (alapfokú művészetoktatás) */
.ami-grades { border: 0; padding: 0; margin: 0 0 .8rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: .2rem .8rem; }
.ami-grades legend { font-weight: 600; margin-bottom: .3rem; }
.ami-grades label.check { display: inline-flex; gap: .35rem; align-items: baseline; font-weight: normal; }
.ami-classes td.num { white-space: nowrap; }
