:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #667085;
  --line: #e3e6eb;
  --brand: #2b4c7e;
  --brand-dark: #1f3a63;
  --brand-soft: #e8eef7;
  --danger: #c0392b;
  --warn: #b7791f;
  --warn-soft: #fff6e5;
  --ok: #2f855a;
  --ok-soft: #e8f5ee;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
a { color: var(--brand); }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
.nowrap { white-space: nowrap; }
.error { color: var(--danger); margin: .5rem 0; }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }
.danger-text { color: var(--danger) !important; }

/* buttons & inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .5rem .9rem; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 500;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: #c5cbd4; background: #fafbfc; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger, .btn.primary.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-outline { color: var(--danger); border-color: #f0c7c2; }
.btn.lg { padding: .7rem 1.2rem; font-size: 1rem; }
.btn.sm { padding: .3rem .65rem; font-size: .85rem; }
.btn.block { width: 100%; }
.link { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; text-decoration: none; }
.link:hover { text-decoration: underline; }
.icon-btn { background: none; border: 0; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--muted); }
label { display: block; font-weight: 500; font-size: .9rem; margin-bottom: .8rem; }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; }
label.check.pad-top { padding-top: 1.7rem; }
input, select {
  display: block; width: 100%; margin-top: .3rem; padding: .55rem .65rem;
  border: 1px solid #cfd5dd; border-radius: 8px; font: inherit; background: #fff; color: var(--text);
}
input[type=checkbox] { width: auto; margin: 0; }
/* No up/down spinner arrows on number boxes — just type the number. */
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=file] { border-style: dashed; }
input:focus, select:focus { outline: 2px solid #9db6dc; outline-offset: 0; border-color: var(--brand); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .8rem; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 .8rem; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, #e8eef7, #f4f5f7 60%); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); padding: 2rem; border-radius: 14px; box-shadow: 0 10px 30px rgba(31, 58, 99, .12); }
.login-card p { margin: .4rem 0 1.4rem; }

/* shell */
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.05rem; }
.brand-lg { font-size: 1.35rem; }
.logo { width: 26px; height: 26px; border-radius: 7px; background: var(--brand); position: relative; flex: none;
  background-image: radial-gradient(circle, #fff 0 2.6px, transparent 3px); background-size: 9px 9px; background-position: 4px 4px; }
.shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 1.2rem .9rem; display: flex; flex-direction: column; gap: 1.4rem; position: sticky; top: 0; height: 100vh; }
#nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
#nav a { display: flex; align-items: center; gap: .65rem; padding: .55rem .7rem; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 500; }
#nav a:hover { background: var(--bg); }
#nav a.active { background: var(--brand-soft); color: var(--brand); }
.ico { width: 1.1rem; text-align: center; opacity: .8; }
.me { border-top: 1px solid var(--line); padding-top: .9rem; font-size: .9rem; }
.me .badge { margin-left: .4rem; }
.me-actions { display: flex; gap: 1rem; margin-top: .4rem; font-size: .85rem; }
#main { min-width: 0; }
.page { padding: 1.6rem 2rem 3rem; max-width: 1200px; }
.loading { padding: 2rem; color: var(--muted); }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.page-head p { margin: .3rem 0 0; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.back { display: inline-block; margin-bottom: .6rem; text-decoration: none; font-size: .9rem; }

/* cards & tables */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.2rem; margin-bottom: 1rem; }
.card.flush { padding: 0; overflow: hidden; }
.card.empty, td.empty { color: var(--muted); text-align: center; padding: 2rem 1rem; }
.table-wrap { overflow-x: auto; overflow-y: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #fafbfc; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfc; }
.table.compact th, .table.compact td { padding: .45rem .7rem; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions > * + * { margin-left: .8rem; }
.toolbar { display: flex; align-items: center; gap: 1rem; margin-bottom: .7rem; }
.toolbar input { max-width: 420px; margin: 0; }
.pager { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 1rem; }
.badge { display: inline-block; white-space: nowrap; font-size: .75rem; font-weight: 600; padding: .15rem .5rem; border-radius: 99px; background: var(--brand-soft); color: var(--brand); vertical-align: middle; }
.badge.grey { background: #eef0f3; color: #556070; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.alert { padding: .8rem 1rem; border-radius: var(--radius); background: var(--brand-soft); color: var(--brand-dark); margin-bottom: 1rem; }
.alert.warn { background: var(--warn-soft); color: #7a4f12; border: 1px solid #f3dcae; }
.alert details { margin-top: .5rem; }
.cols-list { columns: 2; margin: .5rem 0 0; padding-left: 1.2rem; font-size: .9rem; }

/* dashboard */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; color: var(--muted); font-size: .9rem; box-shadow: var(--shadow); }
.stat span { display: block; font-size: 1.8rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.steps { list-style: none; padding: 0; margin: 1rem 0; counter-reset: s; }
.steps li { counter-increment: s; display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem 1rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.steps li::before { content: counter(s); width: 1.6rem; height: 1.6rem; border-radius: 50%; display: inline-grid; place-items: center; background: #eef0f3; font-weight: 700; font-size: .85rem; flex: none; }
.steps li.done::before { content: "✓"; background: var(--ok-soft); color: var(--ok); }
.steps a { font-weight: 600; text-decoration: none; min-width: 200px; }
.cta { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 1.2rem; }

/* dashboard workflow */
.workflow .phase { margin-top: 1.1rem; }
.workflow .phase h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .2rem; }
.workflow .steps { margin: 0; counter-reset: none; }
.workflow .steps li { counter-increment: none; flex-wrap: nowrap; align-items: flex-start; gap: .8rem; }
.workflow .steps li::before { content: var(--n); }
.workflow .steps li.done::before { content: "✓"; background: var(--ok-soft); color: var(--ok); }
.workflow .steps li.todo::before { background: var(--warn-soft); color: var(--warn); }
.workflow .steps li.info::before { background: #eef0f3; color: #556070; }
.workflow .steps a { min-width: 0; }
.workflow .gen-btn { margin-top: .5rem; }
.legend-line { margin: 1rem 0 0; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.dot { width: .8rem; height: .8rem; border-radius: 50%; display: inline-block; margin-left: .6rem; }
.dot.done { background: var(--ok-soft); border: 1px solid var(--ok); }
.dot.todo { background: var(--warn-soft); border: 1px solid var(--warn); }
.dot.info { background: #eef0f3; border: 1px solid #9aa1ab; }

/* import */
.import-box summary { cursor: pointer; }
.import-form { display: flex; align-items: center; gap: .8rem; margin-top: .9rem; flex-wrap: wrap; }
.import-form input { max-width: 340px; margin: 0; }
.skips { max-height: 180px; overflow: auto; font-size: .85rem; color: var(--warn); }

/* range add */
.range-row { display: grid; grid-template-columns: 1fr 1fr 1.4fr 2rem; gap: 0 .8rem; align-items: start; }
.range-row .rm { margin-top: 1.7rem; }
#more-range { margin-bottom: 1rem; }
.range-preview { background: var(--bg); border-radius: 8px; padding: .3rem .9rem; margin-bottom: .8rem; font-size: .9rem; word-break: break-word; }
@media (max-width: 600px) { .range-row { grid-template-columns: 1fr 1fr; } .range-row label:nth-child(3) { grid-column: 1 / 2; } }

/* halls */
.hall-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 1rem; }
.hall-item { display: flex; gap: 1rem; align-items: flex-start; margin: 0; }
.hall-item.inactive { opacity: .6; }
.hall-info p { margin: .3rem 0; font-size: .9rem; }
.hall-info .row-actions { text-align: left; margin-top: .5rem; }
.hall-mini { display: grid; grid-template-columns: repeat(var(--c), 1fr); gap: 2px; width: 110px; flex: none; }
.hall-mini i { display: block; aspect-ratio: 1; border-radius: 2px; background: #9db6dc; }
.hall-mini i.off { background: #e6e9ee; }
.hall-mini.big { width: 100%; max-width: 280px; margin: 0 auto; gap: 3px; }
.preview-wrap { background: var(--bg); border-radius: 8px; padding: .8rem; }
.board { text-align: center; font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); border: 1px dashed #c5cbd4; border-radius: 6px; padding: .25rem; margin: 0 auto .7rem; max-width: 360px; }

/* timetable */
.slot-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .7rem; flex-wrap: wrap; }
.slot .table-wrap { margin: 0 -1.2rem -1.1rem; }

/* seating plan */
.tabs { display: flex; flex-wrap: wrap; gap: 0 .3rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.tab { white-space: nowrap; }
.tab { background: none; border: 0; padding: .55rem .7rem; font: inherit; font-size: .93rem; font-weight: 600; text-decoration: none; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--brand); border-color: var(--brand); }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; margin-bottom: 1rem; font-size: .85rem; }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.seat-scroll { overflow-x: auto; overflow-y: hidden; }
.seat-grid { display: grid; grid-template-columns: 2.2rem repeat(var(--c), minmax(84px, 1fr)); gap: 6px 6px; min-width: min-content; }
.seat-grid.two { grid-template-columns: 2.2rem repeat(var(--c), minmax(164px, 1fr)); gap: 6px 12px; }
.desk { display: flex; flex-direction: column; min-width: 0; }
.desk .dno { font-size: .68rem; font-weight: 700; color: #475569; line-height: 1; margin: 0 0 2px 2px; }
.desk-seats { display: grid; grid-template-columns: 1fr; gap: 2px; flex: 1; }
.desk.two .desk-seats { grid-template-columns: 1fr 1fr; }
.desk.two .desk-seats { border: 1px solid #cbd2dc; border-radius: 7px; padding: 2px; }
.seat em { float: right; font-style: normal; font-size: .62rem; font-weight: 700; color: #64748b; margin-left: 2px; }
.seat.empty.unused { background: #fff; border-style: dotted; color: #cbd2dc; }
.seat-grid .rl, .seat-grid .cl { font-size: .72rem; color: var(--muted); display: grid; place-items: center; font-weight: 600; }
.seat { border-radius: 6px; padding: .35rem .4rem; background: color-mix(in srgb, var(--g) 12%, white); border: 1px solid color-mix(in srgb, var(--g) 35%, white); border-left: 4px solid var(--g); min-height: 48px; overflow: hidden; }
.seat b { display: block; font-size: .8rem; font-family: ui-monospace, Menlo, Consolas, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat small { display: block; font-size: .68rem; color: #4a5565; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat.empty { background: repeating-linear-gradient(45deg, #f6f7f9, #f6f7f9 6px, #eef0f3 6px, #eef0f3 12px); border: 1px dashed #d5d9e0; color: #b5bcc7; display: grid; place-items: center; }
.print-only { display: none; }

/* notice board */
.notice { padding: 1.4rem 1.6rem; }
.notice-head { text-align: center; margin-bottom: 1rem; }
.notice-kicker { text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; color: var(--muted); font-weight: 600; }
.notice-head h2 { font-size: 1.4rem; margin: .3rem 0; overflow-wrap: anywhere; }
.notice-head h2.notice-hall { font-size: 2.2rem; }
.notice-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 1rem; }
.notice-table th, .notice-table td { border: 1px solid #cfd5dd; padding: .5rem .65rem; text-align: left; vertical-align: middle; overflow-wrap: anywhere; }
.notice-table th { background: #f1f3f6; font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; }
.notice-table th.num, .notice-table td.num { text-align: right; }
.notice-table .grp span { color: #4a5565; }
.notice-table tr.cont td { border-top-color: #e6e9ee; }
.notice-table tr.cont td.grp { border-top-color: transparent; }
.notice-table .regs { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 600; font-size: 1.02rem; }
.notice-table .r { white-space: nowrap; }
.notice-table .to { font-family: system-ui, sans-serif; font-weight: 400; color: var(--muted); font-size: .85em; padding: 0 .15rem; }
.notice-table .rg + .rg { margin-top: .25rem; }
.notice-table .subj-cell { font-size: .85em; color: #4a5565; }
.notice-table .cnt { font-family: system-ui, sans-serif; font-weight: 400; color: var(--muted); font-size: .8em; }
.notice-table .subj { font-size: .78rem; color: var(--muted); margin-top: .2rem; }
.notice-table .hall-cell { font-weight: 700; }
.notice-table tr.total td { font-weight: 700; background: #f1f3f6; }

/* institution header (all printouts) */
.inst { font-weight: 800; font-size: 1.15rem; text-transform: uppercase; letter-spacing: .02em; }
.inst-sub { font-size: .85rem; color: var(--muted); }
.inst-exam { font-weight: 600; font-size: .95rem; margin: .15rem 0 .3rem; }
.settings-form { max-width: 560px; }

/* attendance / question paper / absentee documents */
.doc { padding: 1.4rem 1.6rem; }
.doc-head { text-align: center; margin-bottom: .9rem; }
.doc-head h2 { font-size: 1.25rem; text-transform: uppercase; letter-spacing: .06em; margin: .35rem 0 .2rem; }
.doc-meta { color: #4a5565; }
.doc-sub { margin: 1.2rem 0 .5rem; font-size: 1rem; }
.doc-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .92rem; }
.doc-table th, .doc-table td { border: 1px solid #b9c0ca; padding: .4rem .55rem; text-align: left; vertical-align: middle; overflow-wrap: anywhere; }
.doc-table th { background: #f1f3f6; font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; }
.doc-table th.num, .doc-table td.num { text-align: right; }
.doc-table .b { font-weight: 700; }
.doc-table .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.doc-table .regs { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 600; }
.doc-table .regs .r { white-space: nowrap; }
.doc-table .regs .to { font-family: system-ui, sans-serif; font-weight: 400; color: var(--muted); font-size: .85em; }
.doc-table tr.sub td { background: #f6f7f9; font-size: .85rem; }
.doc-table tr.total td { font-weight: 700; background: #f1f3f6; }
.doc-table tr.cont td { border-top-color: #e3e6eb; }
.doc-table.att td { height: 30px; }
.doc-table.absent tr.tall td { height: 64px; }
.doc-table.summary { margin-top: .3rem; }
.keep-title { margin-top: 1rem; font-weight: 700; font-size: .85rem; }
.fill-line { border-bottom: 1px solid #8a8f98; min-height: 1.9rem; margin-top: .5rem; font-size: .9rem; padding-top: .3rem; }
.signs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; margin-top: 3rem; font-size: .85rem; text-align: center; }
.signs div { border-top: 1px solid #555; padding-top: .3rem; }

/* desk stickers: 3 x 8 per A4 page */
.sticker-page { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 33mm; background: #fff; border: 1px solid var(--line); margin-bottom: 1rem; max-width: 186mm; }
.sticker { border: 1px dashed #9aa1ab; margin: -.5px; padding: 2mm 3mm; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.st-top { display: flex; justify-content: space-between; font-size: 9px; font-weight: 600; color: #4a5565; gap: 4px; }
.st-top span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-reg { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 800; font-size: 17px; text-align: center; letter-spacing: .02em; }
.st-name { font-size: 10px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 12px; }
.st-course { font-size: 9px; text-align: center; color: #4a5565; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-date { font-size: 8px; text-align: center; color: #6b7280; }

/* hall chooser */
.hall-picks { display: grid; grid-template-columns: 1fr 1fr; gap: .2rem 1rem; max-height: 50vh; overflow: auto; }
.hall-pick { margin: 0; padding: .35rem .2rem; border-bottom: 1px solid var(--line); }
.hall-sum { margin: .8rem 0 .4rem; padding: .5rem .7rem; background: var(--bg); border-radius: 8px; }
@media (max-width: 600px) { .hall-picks { grid-template-columns: 1fr; } }

/* invigilators */
.spacer { flex: 1; }
.inactive-row td { opacity: .6; }
.cta-card { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.2rem; }
.cta-card p { flex-basis: 100%; margin: 0; }
.duty-slot summary { cursor: pointer; list-style: none; margin: 0; }
.duty-slot summary::-webkit-details-marker { display: none; }
.duty-slot summary h3::before { content: '▸ '; color: var(--muted); }
.duty-slot[open] summary h3::before { content: '▾ '; }
.duty-body { margin-top: .8rem; }
.slot-actions { display: flex; gap: .5rem; margin-top: .8rem; flex-wrap: wrap; }
.pick-search { margin: 0 0 .6rem; }
.staff-picks { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; max-height: 52vh; overflow: auto; }
.staff-pick { margin: 0; padding: .35rem .2rem; border-bottom: 1px solid var(--line); }
@media (max-width: 600px) { .staff-picks { grid-template-columns: 1fr; } }
.doc-table .ctr { text-align: center; }
.doc-table.chart td, .doc-table.chart th { padding: .3rem .35rem; }
.doc-table.duty td { height: 34px; }
.letter-page { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.4rem; margin-bottom: 1rem; max-width: 820px; }
.letter p { margin: .4rem 0; font-size: .92rem; }
.letter .doc-head { margin-bottom: .5rem; }
.cut { text-align: center; color: #9aa1ab; font-size: 11px; letter-spacing: 1px; margin: 1rem 0; white-space: nowrap; overflow: hidden; }
.signs.two { grid-template-columns: 1fr 1fr; }

.clear-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.5rem; }
.clear-opts p { margin: .3rem 0 .6rem; }
@media (max-width: 700px) { .clear-opts { grid-template-columns: 1fr; } }

/* multiple selection */
.selc { width: 2.2rem; padding-right: 0 !important; }
.selc input, .hall-sel { width: 1.05rem; height: 1.05rem; margin: 0; cursor: pointer; }
.bulkbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .7rem; background: var(--brand-soft); border: 1px solid #c9d7ec; border-radius: var(--radius); padding: .55rem .8rem; margin-bottom: .8rem; position: sticky; top: .5rem; z-index: 5; }
.bulkbar .bb-count { color: var(--brand-dark); margin-right: .3rem; }
.bulkbar .bb-clear { margin-left: auto; }
.sel-toolbar { margin-bottom: .5rem; }
.sel-toolbar label { margin: 0; }
.hall-item { position: relative; }
.hall-sel { position: absolute; top: .7rem; right: .7rem; }

/* desk-number layout (hall form preview) */
.desk-layout { display: grid; grid-template-columns: 2rem repeat(var(--c), minmax(2.4rem, 1fr)); gap: 4px; max-width: 100%; overflow-x: auto; }
.desk-layout .rl, .desk-layout .cl { font-size: .72rem; color: var(--muted); font-weight: 600; display: grid; place-items: center; }
.dl-desk { background: #e3ebf6; border: 1px solid #9db6dc; border-radius: 5px; text-align: center; padding: 3px 2px; font-size: .8rem; }
.dl-desk.off { background: #f1f3f6; border-style: dashed; color: #a3abb7; }
.dl-desk b { display: block; }
.dl-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; margin-top: 2px; }
.dl-sides i { font-style: normal; font-size: .58rem; background: #fff; border-radius: 3px; color: #475569; }
.dl-sides i.off { color: #c4cad3; text-decoration: line-through; }
.hall-mini .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: none; aspect-ratio: auto; }
.hall-mini .pair u { display: block; aspect-ratio: 1; border-radius: 2px; background: #9db6dc; }
.hall-mini .pair u.off { background: #e6e9ee; }
.hall-mini.two { width: 150px; }
.sticker-pick { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; align-items: center; }
.sticker-pick label { margin: 0; }
/* fixed desk stickers */
.sticker.dsk { justify-content: space-between; }
.dsk-no { font-size: 46px; font-weight: 800; text-align: center; line-height: 1; font-variant-numeric: tabular-nums; }
.dsk-sides { display: grid; grid-template-columns: 1fr 1fr; border-top: 1.5px solid #333; font-size: 10px; font-weight: 700; letter-spacing: .12em; text-align: center; }
.dsk-sides span { padding-top: 2px; }
.dsk-sides span + span { border-left: 1.5px solid #333; }
.dsk-sides span.off { color: #bbb; }
.dsk-sides.one { grid-template-columns: 1fr; border-top: 0; color: #6b7280; font-weight: 600; }

/* student filters */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem .8rem; margin: -.2rem 0 .8rem; }
.filters label { margin: 0; font-size: .8rem; color: var(--muted); font-weight: 600; flex: 1 1 150px; max-width: 230px; }
.filters select { margin-top: .2rem; padding: .4rem .5rem; font-size: .9rem; color: var(--text); }
.filters .link { padding-bottom: .5rem; }

.seat-opts { padding: .8rem 1rem; }
.seat-opts label { margin: 0; align-items: flex-start; }
.seat-opts input { margin-top: .2rem; }
.seat-opts .small { display: block; font-weight: 400; margin-top: .2rem; }

/* elective student picker */
.pick-head { display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap; margin-bottom: .4rem; }
.pick-head b { color: var(--brand); font-size: 1.05rem; }
.pk-tabs { margin-bottom: .7rem; }
.pk-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem; }
.pk-table { max-height: 34vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.pk-table thead th { position: sticky; top: 0; z-index: 1; }
textarea { display: block; width: 100%; margin-top: .3rem; padding: .55rem .65rem; border: 1px solid #cfd5dd; border-radius: 8px; font: inherit; font-family: ui-monospace, Menlo, Consolas, monospace; resize: vertical; }
dialog.wide { width: min(980px, calc(100vw - 32px)); }

.checks { display: flex; flex-wrap: wrap; gap: .2rem 1.5rem; }
.checks label { margin: 0; }

/* modal */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: 0 20px 50px rgba(16, 24, 40, .25); }
dialog.wide { width: min(760px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(20, 28, 40, .45); }
dialog header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); }
.modal-body { padding: 1.1rem 1.2rem .4rem; max-height: 70vh; overflow: auto; }
dialog footer { display: flex; justify-content: flex-end; gap: .5rem; padding: .9rem 1.2rem; border-top: 1px solid var(--line); background: #fafbfc; }

/* toast */
#toast { position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 140%); background: #1c2430; color: #fff; padding: .7rem 1.1rem; border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); transition: transform .25s; z-index: 50; max-width: calc(100vw - 32px); }
#toast.show { transform: translate(-50%, 0); }
#toast.err { background: var(--danger); }
#toast.warn { background: #8a5a12; }

/* phone / tablet */
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: .7rem 16px; gap: .6rem 1rem; }
  #nav { flex-direction: row; flex-wrap: wrap; order: 3; flex-basis: 100%; }
  #nav a { white-space: nowrap; padding: .45rem .6rem; }
  .ico { display: none; }
  .me { border: 0; padding: 0; margin-left: auto; display: flex; gap: .8rem; align-items: center; }
  .me-actions { margin: 0; }
  #me-name { display: none; }
  .page { padding: 1.1rem 16px 3rem; }
  .stats { grid-template-columns: 1fr 1fr; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .cols-list { columns: 1; }
}

/* printing: one hall per page */
@media print {
  /* Every printout is A4 portrait. */
  @page { size: A4 portrait; margin: 12mm; }
  html, body { width: auto !important; min-width: 0 !important; overflow: visible !important; }
  :root, body { background: #fff; font-size: 12px; }
  .sidebar, .no-print, .plan .page-head, .inv .page-head, .tabs, #toast, .alert, .bulkbar, .selc { display: none !important; }
  .shell { display: block; }
  .page { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .hall-plan, .notice, .doc, .sticker-page { break-after: page; }
  .hall-plan:last-child, .notice:last-child, .doc:last-child, .sticker-page:last-child { break-after: auto; }
  .doc { padding: 0 1px; margin: 0; }
  .doc-head { margin-bottom: 8px; }
  .doc-head h2 { font-size: 15px; }
  .inst { font-size: 15px; }
  .inst-sub, .inst-exam { font-size: 11px; }
  .doc-table { font-size: 10.5px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc-table th { font-size: 8.5px; }
  .doc-table th, .doc-table td { border: 0.75pt solid #6b7280; padding: 3px 5px; }
  .doc-table tr.cont td { border-top-color: #d0d4da; }
  .doc-table thead { display: table-header-group; }
  .doc-table tr { break-inside: avoid; }
  .doc-table.att td { height: 19px; padding-top: 0; padding-bottom: 0; }
  .doc-table.att tr.sub td { height: 16px; font-size: 9.5px; }
  .doc .doc-head { margin-bottom: 5px; }
  .keep .signs { margin-top: 26px; }
  .doc-table .grp-body { break-inside: avoid; }
  .keep-title { font-size: 10.5px; margin-top: 8px; }
  .doc-table.absent tr.tall td { height: 56px; }
  .keep { break-inside: avoid; }
  .fill-line { font-size: 11px; min-height: 22px; }
  .signs { margin-top: 34px; font-size: 10.5px; }
  .sticker-page { border: 0; margin: 0; width: 186mm; max-width: none; grid-template-rows: repeat(8, 33.5mm); grid-auto-rows: 33.5mm; }
  .sticker { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc-table.duty td { height: 30px; }
  .doc-table.chart { font-size: 9.5px; }
  .doc-table.chart td, .doc-table.chart th { padding: 2px 3px; }
  .letter-page { border: 0; padding: 0; margin: 0; max-width: none; height: 271mm; display: flex; flex-direction: column; justify-content: space-between; break-after: page; }
  .letter-page:last-child { break-after: auto; }
  .letter { height: 128mm; overflow: hidden; padding: 0 1px; }
  .letter p { font-size: 11px; margin: 4px 0; }
  .letter .signs { margin-top: 26px; }
  .cut { margin: 0; font-size: 9px; }
  .notice { padding: 0 1px; margin: 0; width: 100%; box-sizing: border-box; }
  .notice-head { margin-bottom: 10px; }
  .notice-head h2 { font-size: 16px; }
  .notice-head h2.notice-hall { font-size: 26px; }
  .notice-table { width: 100%; font-size: 11px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .notice-table th { font-size: 8.5px; }
  .notice-table th, .notice-table td { border: 0.75pt solid #6b7280; padding: 4px 6px; }
  .notice-table tr.cont td { border-top-color: #d0d4da; }
  .notice-table tr.cont td.grp { border-top-color: transparent; }
  .notice-table .regs { font-size: 11.5px; }
  .notice-table thead { display: table-header-group; }
  .notice-table tr, .notice-table .grp-body { break-inside: avoid; page-break-inside: avoid; }
  /* Tighter text when a notice has many rows, so a hall notice stays on one A4 page. */
  .notice.dense .notice-table td { padding: 3px 6px; }
  .notice.dense .notice-table { font-size: 10.5px; }
  .notice.dense .notice-table .regs { font-size: 11px; }
  .notice.denser .notice-table td { padding: 2px 5px; }
  .notice.denser .notice-table { font-size: 9.5px; }
  .notice.denser .notice-table .regs { font-size: 10px; }
  .print-only { display: block; }
  .print-title { font-weight: 600; margin-bottom: .3rem; }
  .seat-scroll { overflow: visible; }
  .hall-plan .slot-head { margin-bottom: .3rem; }
  .hall-plan .board { margin-bottom: .4rem; }
  .seat-grid, .seat-grid.two { grid-template-columns: 22px repeat(var(--c), minmax(0, 1fr)); gap: 3px; width: 100%; }
  .seat-grid.two { column-gap: 5px; }
  .desk .dno { font-size: 9px; margin-bottom: 1px; color: #111; }
  .desk.two .desk-seats { padding: 1px; border-color: #8a8f98; }
  .seat em { font-size: 7px; }
  .seat-grid .rl, .seat-grid .cl { font-size: 9px; }
  .seat { min-height: var(--prh, 40px); padding: 2px 3px; border-left-width: 3px; -webkit-print-color-adjust: exact; print-color-adjust: exact; break-inside: avoid; }
  .seat b { font-size: var(--pfs, 11px); }
  .seat small { font-size: var(--pfs2, 8px); }
  .seat.empty { font-size: 9px; }
  .print-list-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
  #plan-table { font-size: 10.5px; }
  #plan-table th, #plan-table td { padding: 3px 5px; border-bottom: 1px solid #bbb; }
  #plan-table tr { break-inside: avoid; }
  #tab-list .card { overflow: visible; }
  .table-wrap { overflow: visible; }
  #tab-halls > .legend { display: none; }
  .hall-legend { display: flex !important; flex-wrap: wrap; gap: 2px 12px; font-size: 9.5px; margin-bottom: 5px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .hall-legend span { display: inline-flex; align-items: center; gap: 4px; }
  .hall-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
  .plan .page-head h1 { font-size: 1.2rem; }
  #tab-list[hidden] { display: none !important; }
}
