/* Startosoft — shared styles. No @import, no external font: the CSP allows
   only self-hosted assets and we ship no CDN dependency. */

:root {
  --sx-navy: #123a5e;
  --sx-navy-dark: #0d2b46;
  --sx-accent: #c8873b;
  --sx-bg: #f6f7f9;
}

body { background: var(--sx-bg); }

/* The hidden attribute must always win. Bootstrap utilities such as .d-flex are
   declared display:... !important and would otherwise keep a "hidden" element
   visible — which left an empty error box permanently on screen. */
[hidden] { display: none !important; }

/* Keyboard focus must always be visible — never outline:none. */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, .btn:focus-visible {
  outline: 3px solid var(--sx-accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 2000;
  background: #fff; padding: .75rem 1rem; border-radius: 0 0 .5rem 0;
}
.skip-link:focus { left: 0; }

.navbar-school { background: var(--sx-navy); }
.navbar-school .navbar-brand,
.navbar-school .nav-link { color: #fff; }
.navbar-school .nav-link:hover,
.navbar-school .nav-link:focus { color: var(--sx-accent); }
/* Bootstrap's active colour is dark (for light navbars) — unreadable on navy. */
.navbar-school .nav-link.active {
  color: #fff; font-weight: 600;
  box-shadow: inset 0 -3px 0 var(--sx-accent);
}

.hero {
  background: linear-gradient(135deg, var(--sx-navy) 0%, var(--sx-navy-dark) 100%);
  color: #fff;
}

.card-soft { border: 1px solid rgba(0,0,0,.075); box-shadow: 0 1px 2px rgba(0,0,0,.04); }

.required-mark { color: #b3261e; }

/* The honeypot must be reachable by a naive bot but never by a person or a
   screen reader: off-screen, not display:none, and excluded from the a11y tree. */
.hp-field {
  position: absolute !important;
  left: -10000px !important;
  width: 1px; height: 1px; overflow: hidden;
}

.reference-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.25rem; letter-spacing: .05em;
}

footer.site-footer { background: var(--sx-navy-dark); color: #cfd8e3; }
footer.site-footer a { color: #fff; }

/* Developer credit. Quiet by design: it sits under the school's own footer lines,
   and on the few public pages that have no footer it is the whole footer. */
.site-credit { margin-top: .5rem; opacity: .85; }
footer.site-footer .site-credit a { text-decoration: underline; }
.site-credit-bare a { color: var(--sx-navy); }

@media print {
  .no-print, .navbar, footer.site-footer { display: none !important; }
}

/* ── Admin shell ─────────────────────────────────────────────────────────── */
.admin-main { min-height: calc(100vh - 56px); }
.page-header { gap: .75rem; }

/* Status and priority badges: colour is never the only signal — the label is text. */
.badge-status { font-weight: 500; }
.badge-status.st-new                  { background: #0b5ed7; }
.badge-status.st-in_progress          { background: #6f42c1; }
.badge-status.st-awaiting_information { background: #b35c00; }
.badge-status.st-resolved             { background: #198754; }
.badge-status.st-closed               { background: #5c636a; }
.badge-status.st-spam                 { background: #842029; }
.badge-priority.pr-urgent { background: #b02a37; }
.badge-priority.pr-high   { background: #d97706; }
.badge-priority.pr-normal { background: #e9ecef; color: #212529; }
.badge-priority.pr-low    { background: #f8f9fa; color: #495057; border: 1px solid #dee2e6; }

.status-tabs .nav-link { color: #495057; }
.status-tabs .nav-link.active { color: var(--sx-navy); font-weight: 600; }
.status-tabs .count { font-size: .75em; }

.message-body { white-space: pre-wrap; word-break: break-word; }

.timeline { list-style: none; padding-left: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 1rem 1.25rem; border-left: 2px solid #dee2e6; }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -6px; top: .3rem;
  width: 10px; height: 10px; border-radius: 50%; background: var(--sx-navy);
}

/* Below 576px dense tables become stacked cards, so no column is hidden on a phone. */
@media (max-width: 575.98px) {
  /* The wrapper must not scroll: stacked cards have to FIT, not hide their
     right-hand side inside an inner scroll area. */
  .table-responsive:has(.table-stack) { overflow-x: visible; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack thead { position: absolute; left: -10000px; }
  .table-stack tr { border: 1px solid #dee2e6; border-radius: .5rem;
                    margin-bottom: .75rem; background: #fff; padding: .5rem .75rem; }
  .table-stack td { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem;
                    border: 0; padding: .3rem 0; text-align: right; min-width: 0; }
  .table-stack td > * { min-width: 0; overflow-wrap: anywhere; }
  .table-stack td .text-nowrap { white-space: normal; }
  .table-stack td::before { content: attr(data-label); flex: 0 0 6.5rem; font-weight: 600;
                            text-align: left; color: #6c757d; }
}

.skeleton { background: linear-gradient(90deg,#eee 25%,#f5f5f5 37%,#eee 63%); background-size: 400% 100%;
            animation: sk 1.4s ease infinite; border-radius: .25rem; height: 1rem; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* ── Notification bell ───────────────────────────────────────────────────── */
.bell-btn { position: relative; color: #fff; border-color: rgba(255,255,255,.5); }
.bell-btn:hover, .bell-btn:focus { color: #fff; background: rgba(255,255,255,.12); }
.bell-btn svg { width: 1.1rem; height: 1.1rem; vertical-align: -.15em; }
.bell-count { position: absolute; top: -.35rem; right: -.4rem; font-size: .65rem; }
.bell-menu { width: min(24rem, calc(100vw - 2rem)); max-height: 70vh; overflow-y: auto; }
.bell-item { white-space: normal; border-left: 3px solid transparent; }
.bell-item.unread { border-left-color: var(--sx-accent); background: #fffaf2; }
.bell-item.unread .bell-title { font-weight: 600; }

/* Placeholders are examples, not values: lighter and italic so they cannot be
   mistaken for data already filled in. */
.form-control::placeholder { color: #adb5bd; font-style: italic; opacity: 1; }

/* Cards stacked in a grid column: the row gutter already spaces them, so the
   last card must not add its own bottom margin as well (it doubled the gap). */
.row > [class*="col"] > .card:last-child { margin-bottom: 0 !important; }

/* ── Attendance ──────────────────────────────────────────────────────────── */
.register-status .btn { min-width: 2.4rem; font-weight: 600; }
.register-late { width: 5.5rem; }
.register-table td[data-label="Remark"] input { min-width: 10rem; }
/* The save bar stays reachable at the bottom of a long class list. */
.register-footer { position: sticky; bottom: 0; z-index: 2; box-shadow: 0 -2px 6px rgba(0,0,0,.05); }
@media (max-width: 575.98px) {
  .register-table td[data-label="Remark"] input { min-width: 0; }
  .register-table td { align-items: center; }
}
.att-figure { font-size: 2rem; font-weight: 700; line-height: 1; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.cal-head { font-size: .75rem; font-weight: 600; color: #6c757d; text-align: center; padding: .25rem 0; }
.cal-day { min-height: 5rem; background: #fff; border: 1px solid #e9ecef; border-radius: .25rem; padding: .25rem;
           text-align: left; font-size: .8rem; overflow: hidden; }
.cal-day:hover, .cal-day:focus { border-color: var(--sx-navy); outline: none; box-shadow: 0 0 0 .15rem rgba(13,43,94,.2); }
.cal-day.is-weekend { background: #f8f9fa; color: #6c757d; }
.cal-day.is-today .cal-num { background: var(--sx-navy); color: #fff; border-radius: 1rem; padding: 0 .4rem; }
.cal-day.is-selected { border-color: var(--sx-navy); border-width: 2px; }
.cal-day.is-blank { background: transparent; border: 0; }
.cal-entry { display: block; margin-top: .15rem; padding: 0 .25rem; border-radius: .2rem; white-space: nowrap;
             overflow: hidden; text-overflow: ellipsis; font-size: .7rem; }
.cal-holiday { background: #f8d7da; color: #58151c; }
.cal-working { background: #d1e7dd; color: #0a3622; }
.cal-exam    { background: #fff3cd; color: #664d03; }
.cal-event   { background: #cfe2ff; color: #052c65; }
@media (max-width: 575.98px) {
  .cal-day { min-height: 3rem; font-size: .7rem; }
  .cal-entry { font-size: 0; height: .35rem; padding: 0; }   /* a coloured bar; the list below names it */
}
.cal-key { display: inline-block; padding: 0 .4rem; border-radius: .2rem; font-size: .75rem; }

/* ── Homework ────────────────────────────────────────────────────────────── */
.hw-offcanvas { --bs-offcanvas-width: min(34rem, 100vw); }
.hw-attempt { border-left: 3px solid #dee2e6; padding-left: .75rem; }
.hw-attempt.is-latest { border-left-color: var(--sx-navy); }
.hw-card { border-left: 4px solid transparent; }
.hw-card.is-overdue { border-left-color: #b02a37; }
.hw-card.is-done { border-left-color: #198754; }
.hw-score { max-width: 12rem; }

/* Toasts dock bottom-left: clear of the navbar and header actions (top right) and of
   save bars, whose buttons sit bottom right. */
.toast-dock { z-index: 1090; max-width: calc(100vw - 1rem); }

/* ── Marks ───────────────────────────────────────────────────────────────── */
.ms-status { min-width: 7rem; }
.ms-mark { max-width: 9rem; }
@media (max-width: 575.98px) { .ms-mark { max-width: 12rem; } }

/* ── Report card ─────────────────────────────────────────────────────────── */
.report-card { max-width: 60rem; margin: 0 auto; }
.rc-table th, .rc-table td { white-space: nowrap; }
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; }
  .navbar, .skip-link, #toast-container { display: none !important; }
  .admin-main { padding: 0 !important; min-height: 0; }
  .report-card { border: 0 !important; box-shadow: none !important; max-width: none; }
  .rc-table th, .rc-table td { white-space: normal; }
}
.pay-alloc { max-width: 9rem; margin-left: auto; }

/* ── Timetable ───────────────────────────────────────────────────────────── */
.tt-table th, .tt-table td { min-width: 7.5rem; }
.tt-table .tt-period { min-width: 6.5rem; background: #f8f9fa; }
.tt-table .tt-today { background: #f3f7ff; }
.tt-table .tt-break td, .tt-table .tt-break th { background: #f8f9fa; }
.tt-editable { cursor: pointer; }
.tt-editable:hover, .tt-editable:focus { outline: 2px solid var(--sx-navy); outline-offset: -2px; }
.tt-list { display: none; }
@media (max-width: 767.98px) {
  .tt-table { display: none; }
  .table-responsive:has(.tt-table) { display: none; }
  .tt-list { display: block; }
  .tt-editable-page .table-responsive:has(.tt-table) { display: block; }
  .tt-editable-page .tt-table { display: table; }
  .tt-editable-page .tt-list { display: none; }
}

/* ── Announcements ───────────────────────────────────────────────────────── */
.ann-targets { max-height: 14rem; overflow-y: auto; }
.notice-card { border-left: 4px solid transparent; }
.notice-card.is-unread { border-left-color: var(--sx-accent); }
.notice-card.is-urgent { border-left-color: #b02a37; }
.notice-article { max-width: 48rem; }
.meeting-form { max-width: 48rem; }

/* ── Certificates ────────────────────────────────────────────────────────── */
.certificate { max-width: 46rem; margin: 0 auto; }
.cert-title { letter-spacing: .08em; }
.cert-text { font-size: 1.05rem; line-height: 1.8; }
.cert-sign { width: 12rem; border-bottom: 1px solid #212529; height: 3rem; }
@media print {
  .certificate { border: 0 !important; box-shadow: none !important; max-width: none; }
}
