/* Base and shared components — follows docs/design-system.md. Bootstrap (RTL build) is loaded underneath for grid/forms;
   the public site lives in css/public.css and the panel chrome in css/panel.css. */

*, *::before, *::after { box-sizing: border-box; }
html { direction: rtl; }
body {
  font-family: var(--font-sans);
  line-height: var(--lh-body);
  color: var(--text);
  background: var(--bg-alt);
  margin: 0;
}
h1, h2, h3, .h1, .h2, .h3 { line-height: var(--lh-heading); color: var(--heading); font-weight: 700; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; color: var(--ink); }
h3 { font-size: 1.125rem; }
.display { font-size: 2.25rem; font-weight: 900; color: var(--heading); }
.subtitle { color: var(--red); font-weight: 700; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--font-mono); }
.ltr { direction: ltr; text-align: left; unicode-bidi: isolate; }
.small { font-size: .875rem; color: var(--text-muted); }
.text-muted { color: var(--text-muted) !important; }
/* v0.2: the yellow marker stays for print/PDF; on screen a critical line is a navy pill with amber text */
mark.notice { background: var(--brand-navy); color: var(--brand-amber); font-weight: 700; padding: .25em .9em; border-radius: var(--r-pill); display: inline-block; line-height: 1.7; }
.em-date, .em-mode { color: var(--red); font-weight: 700; }
.em-positive { color: var(--green-text); font-weight: 700; }
svg.ico { width: 18px; height: 18px; flex: none; }
/* text that only belongs on paper (css/print.css shows it) */
.print-only { display: none; }
/* a page's print version (Shared/PrintSheet): paper only */
.pv { display: none; }
/* Blazor moves focus to the page h1 after navigation (FocusOnNavigate); no visible ring for that programmatic focus */
h1:focus, [tabindex="-1"]:focus { outline: none; }

/* ---- Buttons ---- */
.btn { height: 40px; padding: 0 18px; border-radius: var(--r-btn); font-weight: 700; border: 1px solid transparent; display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); line-height: 1; white-space: nowrap; cursor: pointer; font-family: inherit; font-size: .95rem; transition: background .15s; }
.btn:hover { text-decoration: none; }
.btn svg { width: 18px; height: 18px; }
.btn-sm { height: 34px; padding: 0 var(--s-3); font-size: .85rem; }
/* an icon-only square button, the shape of the sidebar's (print); its name is in the tooltip */
.btn-sq { width: 34px; padding: 0; border-radius: 8px; }
.btn-sq.tip[data-tip] { cursor: pointer; }
.btn-sq.tip[data-tip]:focus-visible { border-radius: 8px; }
.btn-primary { background: var(--primary); color: var(--primary-contrast); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); color: #fff; border-color: var(--primary-hover); }
.btn-brand { background: var(--accent); color: var(--accent-contrast); }
.btn-brand:hover { background: var(--brand-orange-dark); color: var(--accent-contrast); }
.btn-amber { background: var(--brand-amber); color: var(--accent-contrast); }
.btn-amber:hover { background: #e0900f; color: var(--ink); }
.btn-secondary { background: var(--surface); color: var(--heading); border-color: var(--gray-300); }
.btn-secondary:hover { background: var(--gray-100); color: var(--heading); border-color: var(--brand-navy); }
.btn-glass { background: rgb(255 255 255 / .14); color: #fff; border-color: rgb(255 255 255 / .4); backdrop-filter: blur(8px); }
.btn-glass:hover { background: rgb(255 255 255 / .24); color: #fff; }
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:hover { background: #c4161c; color: #fff; }
.btn-ghost { background: transparent; color: var(--link); }
.btn-ghost:hover { background: var(--tint-blue); color: var(--link); }
.btn-ghost.text-danger { color: var(--red) !important; }
.btn-ghost.text-danger:hover { background: var(--error-bg); }
.btn:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; box-shadow: none; }
@media (pointer: coarse) { .btn { height: 44px; } }

/* ---- Chips (tracks, exam mode, content kind) ---- */
.chip { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding-inline: 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.chip.math { background: var(--track-math-tint); color: var(--track-math); }
.chip.exp { background: var(--track-exp-tint); color: var(--track-exp); }
.chip.hum { background: var(--track-hum-tint); color: var(--track-hum); }
.chip.all { background: var(--gray-100); color: var(--gray-600); }
.chip.onsite { background: var(--error-bg); color: var(--red); }
.chip.online { background: var(--tint-blue); color: var(--link); }
.chip.hybrid { background: var(--warning-bg); color: var(--warning-text); }
.chip.type { background: var(--warning-bg); color: var(--warning-text); }
.chip.news { background: var(--tint-blue); color: var(--link); }
.chip.notice { background: var(--warning-bg); color: var(--warning-text); }
.chip.article { background: var(--success-bg); color: var(--green-text); }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }

/* ---- Forms ---- */
.form-label { font-weight: 700; margin-bottom: var(--s-1); font-size: .9rem; }
.form-control, .form-select { height: 40px; border: 1px solid var(--border); border-radius: var(--r-sm); font-family: inherit; }
textarea.form-control { height: auto; min-height: 64px; }
.form-control:focus, .form-select:focus { border-color: var(--brand-orange); box-shadow: 0 0 0 3px var(--focus-ring); }
.form-text { font-size: .8rem; color: var(--text-muted); }
.form-section { border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s-4) var(--s-6) var(--s-6); margin-bottom: var(--s-4); background: var(--surface); box-shadow: var(--shadow-1); }
.form-section > legend { float: none; width: auto; font-size: 1rem; font-weight: 800; color: var(--heading); padding: 0 var(--s-2); margin-bottom: var(--s-3); }
.form-actions { display: flex; gap: var(--s-3); flex-wrap: wrap; margin-top: var(--s-4); }
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--green-text); }
.invalid { outline: 1px solid var(--red); }
.validation-message { color: var(--red); font-size: .875rem; }

/* ---- Badges & alerts ---- */
.badge { display: inline-block; padding: .2em .75em; border-radius: var(--r-pill); font-size: .78rem; font-weight: 700; vertical-align: middle; line-height: 1.6; }
.badge-success { background: var(--success-bg); color: var(--green-text); }
.badge-warning { background: var(--warning-bg); color: var(--warning-text); }
.badge-error { background: var(--error-bg); color: var(--red); }
.badge-info { background: var(--tint-blue); color: var(--link); }
.alert { border-radius: var(--r-md); border: 1px solid transparent; }
.alert-success { background: var(--success-bg); color: var(--green-text); border-color: var(--success-line); }
.alert-danger { background: var(--error-bg); color: var(--red); border-color: var(--error-line); }
.alert-info { background: var(--tint-blue); color: var(--link); border-color: var(--brand-blue-light); }
.alert ul { list-style: disc inside; }

/* ---- Data table (v0.2 / E1): light header, hairline rows, start-aligned. The navy+zebra flyer table is kept for PDF/Excel. ---- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); }
.table-brand { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.table-brand th { background: var(--gray-100); color: var(--gray-600); font-weight: 700; font-size: .8125rem; text-align: start; height: 44px; padding: 0 var(--s-3); white-space: nowrap; border-bottom: 1px solid var(--border); }
.table-brand td { text-align: start; height: 46px; padding: var(--s-1) var(--s-3); border-top: 1px solid var(--line-soft); vertical-align: middle; }
.table-brand tbody tr:first-child td { border-top: 0; }
.table-brand tbody tr:hover td { background: var(--surface-soft); }
.table-brand td.text-start { text-align: start; }
.table-brand td.text-center, .table-brand th.text-center { text-align: center; }
.table-brand.math th { background: var(--track-math-tint); color: var(--track-math); }
.table-brand.exp  th { background: var(--track-exp-tint); color: var(--track-exp); }
.table-brand.hum  th { background: var(--track-hum-tint); color: var(--track-hum); }

/* ---- Cards ---- */
.card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-1); }
/* No box in a box (decided 2026-10-18, design-system §6.5). A card that only frames a table (with its heading, a note, a
   toolbar) is marked .bare and drops its frame: the table's own frame is the box. A card that holds more than that (a chart,
   an import summary) keeps its frame, and the table inside it loses its own. */
.card.bare, .rp-card.bare { background: none; border: 0; border-radius: 0; box-shadow: none; padding: 0; }
.bare > :is(.table-wrap, .rp-tw) { box-shadow: var(--shadow-1); }
:is(.card, .rp-card):not(.bare) :is(.table-wrap, .rp-tw) { border: 0; border-radius: 0; box-shadow: none; }
.card--pad { padding: var(--s-6); }
.brand { font-weight: 800; color: var(--heading); white-space: nowrap; }
.brand:hover { text-decoration: none; }

/* ---- Blazor error UI ---- */
#blazor-error-ui { color-scheme: light only; background: var(--warning-bg); color: var(--warning-text); bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); display: none; inset-inline-start: 0; padding: 0.6rem 1.25rem 0.7rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; inset-inline-end: 0.75rem; top: 0.5rem; }

/* ---- Data-entry rules (docs/data-entry-rules.md) ---- */
/* §1 required fields: a red star after the label; the form starts with a one-line legend. */
.form-label.req::after, legend.req::after { content: "*"; color: var(--red); font-weight: 800; margin-inline-start: .3em; }
.req-star { color: var(--red); font-weight: 800; }
.req-note { display: flex; align-items: center; gap: .35em; margin: 0 0 var(--s-3); font-size: .85rem; color: var(--text-muted); }

/* §3 toastr: brand colours over the library defaults, RTL text and icon placement. */
.toast-seed { display: none; }
#toast-container > div { direction: rtl; text-align: right; font-family: var(--font-sans); border-radius: var(--r-md); box-shadow: 0 6px 18px rgb(0 0 0 / .18); opacity: 1; padding: 14px 52px 14px 28px; background-position: right 16px center; }
#toast-container > div:hover { box-shadow: 0 6px 18px rgb(0 0 0 / .18); }
#toast-container > div.rtl { padding: 14px 52px 14px 28px; background-position: right 16px center; }
#toast-container > .toast-success { background-color: var(--green-text); }
#toast-container > .toast-error { background-color: var(--red); }
#toast-container > .toast-info { background-color: var(--brand-blue); }
#toast-container > .toast-warning { background-color: var(--warning-text); }
#toast-container .toast-message { font-size: .9375rem; line-height: 1.7; }
#toast-container .toast-title { margin-bottom: 4px; }
#toast-container .toast-close-button { right: auto; left: -.2em; top: -.35em; font-weight: 400; text-shadow: none; }
#toast-container .toast-progress { left: auto; right: 0; }
.toast-top-center > div { width: min(520px, calc(100vw - 32px)); margin: 0 auto 8px; }
