/* ============================================================================
 * b2-daily.css — page CSS shared by the "daily work" pages: the timetable (schedule, classes, teachers,
 * bells, duties, admin), the duty board, rooms, calendar, attendance marking, tasks, chat, inbox,
 * learning, leaves, staff, teachers, profile, welcome, what's new, links, reports, bug report and the
 * standalone pages (login, privacy, accessibility). Loaded from each page's {% block head %}, after
 * app.css. Tokens only — no institution colour, no hex. RTL: logical properties.
 * ========================================================================== */

/* ---- page columns: a page that reads better narrower than the 1280px shell ---- */
.b2-col { max-width: 920px; }            /* starts at the page edge, under the title */
.b2-col--narrow { max-width: 720px; }
.b2-col--wide { max-width: 1100px; }

/* ---- a quiet lead paragraph under the page title ---- */
.b2-lead { color: var(--text-2); font-size: 14.5px; line-height: 1.6; margin: 0 0 16px; }
.b2-hint { color: var(--text-3); font-size: 13px; line-height: 1.5; }
.b2-list { margin: 0; padding-inline-start: 20px; line-height: 1.9; color: var(--text-2); }
.b2-list li::marker { color: var(--accent-line); }

/* ---- tiles: a grid of links to pick from (classes, teachers, sections of a module) ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tiles--wide { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.tile {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 64px; padding: 12px 14px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-in); box-shadow: var(--shadow-sm);
  color: var(--text); font-weight: 700; font-size: 16px; text-align: center; text-decoration: none;
  transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.tile:hover { border-color: var(--accent); color: var(--accent-text); }
.tile:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.tile--row { justify-content: space-between; text-align: start; font-size: 14.5px; font-weight: 600; min-height: 52px; }
.tile--row > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.tile.is-dim { color: var(--text-3); background: var(--surface-soft); box-shadow: none; }
.tile--nav { flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 3px; text-align: start; min-height: 76px; }
.tile--nav b { font-size: 15px; }
.tile--nav small { font-size: 12.5px; font-weight: 400; color: var(--text-3); line-height: 1.4; }

/* ---- the weekly timetable grid (my timetable, a class, duties) ---- */
.tt { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; background: var(--card); }
.tt th, .tt td { border-bottom: 1px solid var(--hair); border-inline-end: 1px solid var(--hair); padding: 6px; text-align: center; vertical-align: top; overflow-wrap: anywhere; }
.tt tr > :last-child { border-inline-end: 0; }
.tt tbody tr:last-child > * { border-bottom: 0; }
.tt th { background: var(--surface-soft); color: var(--text-2); font-weight: 700; font-size: 13px; white-space: normal; }
.tt tr:hover td { background: transparent; }
.tt .tt-period { width: 54px; background: var(--surface-soft); color: var(--accent-text); font-weight: 700; vertical-align: middle; font-variant-numeric: tabular-nums; }
.tt tr:hover td.tt-period { background: var(--surface-soft); }
.tt-stack { display: flex; flex-direction: column; gap: 4px; min-height: 56px; }
.tt-cell {
  display: flex; flex-direction: column; gap: 1px; padding: 5px 6px; border-radius: 10px;
  background: var(--accent-softer); font-size: 12.5px; line-height: 1.3; text-align: center;
}
.tt-cell.empty { background: transparent; min-height: 30px; }
.tt-cell.sub { background: var(--warn-bg); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--warn) 55%, var(--warn-bg)); }
.tt-main { font-weight: 700; font-size: 13.5px; color: var(--text); }
.tt-sub { font-size: 12.5px; color: var(--text-2); }
.tt-note { font-size: 11.5px; color: var(--text-3); }
.tt-tag { align-self: center; font-size: 11px; font-weight: 700; color: var(--warn); background: var(--card); padding: 0 7px; border-radius: 999px; }
@media (max-width: 720px) {
  .tt th, .tt td { padding: 4px; }
  .tt .tt-period { width: 40px; }
}
@media print {
  .tt th, .tt td { font-size: 10pt; border-color: #ccc; }
}

/* ---- a notice with an action at its end ---- */
.alert--row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; }

/* ---- small text helpers ---- */
.b2-ok { color: var(--good); font-weight: 600; }
.b2-err { color: var(--bad); font-weight: 600; }
.b2-mt { margin-top: 12px; }

/* ---- a grid form whose labels wrap their control (<label>text <input></label>) ---- */
.lform { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 12px; align-items: end; }
.lform label { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; font-weight: 600; color: var(--text-2); min-width: 0; }
.lform :is(input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=file]), select, textarea) { min-height: 40px; width: 100%; font-weight: 400; }
.lform .lform-wide { grid-column: 1 / -1; }
.lform .lform-end { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.lform--divided { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--hair); }

/* ============================================================================
 * The duty-roster / rooms family (duty plans, board, daily, settings, teachers; timetable rooms).
 * These pages build much of their markup in their own scripts with page-local class names
 * (dp- / db- / dd- / dr- / tr-). Here those names take the design-system look once, so the
 * markup the scripts write looks like the rest of the site without touching the scripts' logic.
 * ========================================================================== */
:is(.dp-head, .db-head, .dd-head, .dr-head, .tr-head) { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 14px; }
:is(.dp-head, .db-head, .dd-head, .dr-head, .tr-head) h1 { margin: 0; font-size: 17px; font-weight: 700; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
:is(.dp-links, .dr-links, .tr-links, .dd-tools, .db-tools) { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

/* buttons: X-btn + .p primary / .g quiet / .d delete / .w warning / .i info; links in a head row are quiet buttons */
:is(.dp-btn, .db-btn, .dr-btn, .tr-btn), :is(.dp-links, .dr-links, .tr-links, .dd-tools) a {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 5px 13px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--card); color: var(--text-2);
  font-family: var(--font); font-size: 13.5px; font-weight: 600; line-height: 1.25; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
:is(.dp-btn, .db-btn, .dr-btn, .tr-btn):hover, :is(.dp-links, .dr-links, .tr-links, .dd-tools) a:hover { border-color: var(--accent-line); color: var(--accent-text); }
:is(.dp-btn, .db-btn, .dr-btn, .tr-btn):focus-visible, :is(.dp-links, .dr-links, .tr-links, .dd-tools) a:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
:is(.dp-btn, .db-btn, .dr-btn, .tr-btn).p { background: var(--accent); border-color: transparent; color: #fff; font-weight: 700; }
:is(.dp-btn, .db-btn, .dr-btn, .tr-btn).p:hover { background: var(--accent-deep); color: #fff; }
:is(.dr-links, .tr-links) a.p, :is(.dp-btn, .db-btn, .dr-btn, .tr-btn).i { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-text); }
:is(.dp-btn, .db-btn, .dr-btn, .tr-btn).d { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 25%, var(--bad-bg)); color: var(--bad); }
:is(.dp-btn, .db-btn, .dr-btn, .tr-btn).w { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 30%, var(--warn-bg)); color: var(--warn); }
:is(.dp-btn, .db-btn, .dr-btn, .tr-btn):disabled { opacity: .55; cursor: not-allowed; }
.dd-tools select { min-height: 34px; }

/* surfaces */
:is(.dp-card, .dr-card, .tr-card) {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow);
  padding: 18px 20px; margin-bottom: var(--gap); min-width: 0;
}
:is(.dp-card, .dr-card, .tr-card) > h2 { margin: 0 0 10px; font-size: 17px; line-height: 1.3; }
:is(.dr-card, .tr-card) .hint, .dr-hint { color: var(--text-2); font-size: 13.5px; line-height: 1.55; margin: 4px 0 10px; }
:is(.dp-muted, .dr-muted, .tr-muted, .dd-muted) { color: var(--text-3); font-size: 12.5px; }

/* tables: the design-system table; the scroll wrapper is in the markup (.table-wrap / .b2-scroll) */
:is(.dp-table, .dr-table, .tr-table, .dd-table) { font-size: 14px; }
:is(.dp-table, .dr-table, .tr-table, .dd-table) :is(th, td) { padding: 8px 10px; vertical-align: middle; }
.b2-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }

/* status pills */
:is(.dp-pill, .db-pill, .dr-pill) { display: inline-flex; align-items: center; min-height: 22px; padding: 1px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-muted); color: var(--text-2); white-space: nowrap; }
:is(.dp-pill, .db-pill, .dr-pill):is(.draft, .pending) { background: var(--warn-bg); color: var(--warn); }
:is(.dp-pill, .db-pill, .dr-pill).published { background: var(--good-bg); color: var(--good); }
:is(.dp-pill, .db-pill, .dr-pill):is(.archived, .rejected) { background: var(--surface-muted); color: var(--text-2); }
.dr-pill.mandatory { background: var(--bad-bg); color: var(--bad); }
.dr-pill.preference { background: var(--accent-soft); color: var(--accent-text); }

/* forms: labels wrap their control */
:is(.dp-form, .dr-form, .tr-form) { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 12px; align-items: end; margin-top: 10px; }
.dp-form { display: flex; flex-wrap: wrap; align-items: flex-end; }
:is(.dp-form, .dr-form, .tr-form) label { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; font-weight: 600; color: var(--text-2); min-width: 0; }
:is(.dp-form, .dr-form, .tr-form) :is(input:not([type=checkbox]):not([type=radio]):not([type=color]), select, textarea) { min-height: 38px; font-weight: 400; min-width: 0; }
.dp-form :is(input, select) { min-width: 200px; }
:is(.dr-form, .tr-form) .full { grid-column: 1 / -1; }

/* a row of numbers in words */
:is(.dr-stats, .tr-stats, .dd-stats, .db-stats) { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; color: var(--text-2); margin: 8px 0 12px; }
:is(.dr-stats, .tr-stats, .dd-stats, .db-stats) b { color: var(--text); font-size: 15px; font-variant-numeric: tabular-nums; }
.db-stats { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-in); padding: 10px 14px; box-shadow: var(--shadow-sm); }
.db-stats .bad b { color: var(--bad); }
.db-stats .warn b { color: var(--warn); }

/* notices */
:is(.dp-empty, .db-empty, .dd-alert) { background: var(--warn-bg); border: 1px solid color-mix(in srgb, var(--warn) 30%, var(--warn-bg)); color: var(--text); padding: 12px 14px; border-radius: var(--r-in); margin-bottom: var(--gap); font-size: 14px; line-height: 1.5; }
.db-alert { background: var(--bad-bg); border: 1px solid color-mix(in srgb, var(--bad) 28%, var(--bad-bg)); color: var(--text); padding: 10px 12px; border-radius: var(--r-in); margin: 10px 0; font-size: 13.5px; }
.db-note { background: var(--accent-softer); border: 1px solid var(--accent-line); color: var(--text); padding: 10px 12px; border-radius: var(--r-in); margin: 10px 0; font-size: 13.5px; }

/* toast (the scripts add .show / .on, and .err) */
:is(.dp-toast, .db-toast, .dr-toast, .tr-toast) {
  position: fixed; z-index: 9999; bottom: 20px; inset-inline-start: 20px; max-width: min(80vw, 520px);
  background: var(--text); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-pop);
  opacity: 0; transition: opacity .2s; pointer-events: none;
}
:is(.dp-toast, .db-toast, .dr-toast, .tr-toast):is(.show, .on) { opacity: 1; }
:is(.dr-toast, .tr-toast).err { background: var(--bad); }
@media (max-width: 820px) { :is(.dp-toast, .db-toast, .dr-toast, .tr-toast) { bottom: 84px; } }

/* modal (the scripts add .open / .on) */
:is(.db-modal, .dr-modal) { position: fixed; inset: 0; z-index: 9998; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(22, 42, 77, .42); }
:is(.db-modal.open, .dr-modal.on) { display: flex; }
:is(.db-modal, .dr-modal) .box { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-pop); max-width: 760px; width: 100%; max-height: 90vh; overflow: auto; padding: 18px 20px; }
:is(.db-modal, .dr-modal) h2 { margin: 0 0 10px; font-size: 17px; }
@media (max-width: 600px) {
  :is(.db-modal, .dr-modal) { padding: 0; align-items: flex-end; }
  :is(.db-modal, .dr-modal) .box { border-radius: 20px 20px 0 0; max-height: 92vh; }
}
/* the scripts hide things with the `hidden` attribute; a display set above must not undo it */
:is([class^="dp-"], [class^="db-"], [class^="dd-"], [class^="dr-"], [class^="tr-"], .dr-ai .actions)[hidden] { display: none !important; }

/* ============================================================================
 * Tasks (/school/tasks): the page keeps school/static/tasks.css; these rules come after it and
 * bring its few hard-coded colours and gradients to the tokens.
 * ========================================================================== */
.tasks-bulk-hero.btn { background: var(--accent-softer) !important; border: 1px solid var(--accent-line) !important; color: var(--text) !important; border-radius: var(--r-in); min-height: 0; }
.tasks-bulk-hero.btn:hover { filter: none; background: var(--accent-soft) !important; }
.tasks-bulk-hero-icon { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--card); font-size: 20px; }
.tasks-bulk-hero-body strong { color: var(--accent-text); }
.tasks-bulk-hero-body small { color: var(--text-2); opacity: 1; }
.tasks-mon-banner { background: var(--accent-softer); border-color: var(--accent-line); border-radius: var(--r-in); }
.tasks-bucket-chip { background: var(--card); border-color: var(--border); }
.tasks-qa-btn { border-width: 1px; border-radius: 12px; min-height: 40px; }
.tasks-qa-btn.qa-today { border-color: color-mix(in srgb, var(--bad) 30%, var(--bad-bg)); color: var(--bad); }
.tasks-qa-btn.qa-week { border-color: color-mix(in srgb, var(--warn) 34%, var(--warn-bg)); color: var(--warn); }
.tasks-qa-btn.qa-future { border-color: var(--border-strong); background: var(--surface-muted); color: var(--text-2); }
.tasks-qa-btn:is(.qa-custom, .qa-ongoing) { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-text); }
.tasks-qa-btn.qa-today:hover { background: color-mix(in srgb, var(--bad) 16%, var(--card)); }
.tasks-qa-btn.qa-week:hover { background: color-mix(in srgb, var(--warn) 20%, var(--card)); }
.tasks-qa-btn.qa-future:hover { background: color-mix(in srgb, var(--text-3) 18%, var(--card)); }
.tasks-qa-btn:is(.qa-custom, .qa-ongoing):hover { background: color-mix(in srgb, var(--accent) 14%, var(--card)); }
.task-future { border-inline-start-color: var(--border-strong); background: var(--surface-muted); }

/* ============================================================================
 * Staff absence (/school/absence): keeps school/static/staff_absence.css; these rules come after
 * it and bring its surfaces, tabs, chips and buttons to the design-system look.
 * ========================================================================== */
.abs-wrap { max-width: 1080px; margin: 0; padding: 0; }
.abs-card { border-radius: var(--r-card); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: var(--gap); }
.abs-section-title { font-size: 17px; margin-bottom: 12px; }
.abs-tabs { gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.abs-tab { min-height: 42px; padding: 8px 14px; font-size: 14px; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; border-radius: 10px 10px 0 0; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.abs-tab:hover { color: var(--text); background: var(--surface-soft); }
.abs-tab.active { color: var(--accent-text); border-bottom-color: var(--accent); font-weight: 700; }
.abs-tab-admin { background: none; border-radius: 10px 10px 0 0; }
.abs-label { font-size: 13.5px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.abs-chip { min-height: 36px; padding: 5px 14px; border-width: 1px; border-color: var(--border); font-size: 14px; font-weight: 600; color: var(--text-2); }
.abs-chip:hover { border-color: var(--accent); background: var(--card); }
.abs-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.abs-btn { min-height: 40px; padding: 8px 16px; border-radius: 12px; border-color: var(--border); font-size: 14px; font-weight: 700; color: var(--text-2); justify-content: center; }
.abs-btn:hover { background: var(--card); border-color: var(--accent-line); color: var(--accent-text); }
.abs-btn-primary { background: var(--accent); border-color: transparent; color: #fff; }
.abs-btn-primary:hover { background: var(--accent-deep); border-color: transparent; color: #fff; }
.abs-btn-ghost { background: var(--card); font-weight: 600; }
/* in the column form a field keeps its own height (its 200px flex-basis is meant for the side-by-side row),
   and what the script hides with `hidden` stays hidden even where a display is set */
.abs-form > .abs-field { flex: 0 0 auto; }
.abs-wrap [hidden] { display: none !important; }

/* ---- long-form text (privacy policy, accessibility statement) ---- */
.b2-prose h2 { font-size: 17px; margin: 22px 0 8px; }
.b2-prose > h2:first-of-type { margin-top: 14px; }
.b2-prose p { margin: 0 0 10px; }
.b2-prose ul, .b2-prose ol { margin: 0 0 12px; padding-inline-start: 22px; }
.b2-prose li { margin-bottom: 5px; }
.b2-prose code { background: var(--surface-muted); border-radius: 6px; padding: 1px 6px; font-size: .92em; }
.b2-prose table { font-size: 14px; }
