/* ===========================================================================
   Pearl Rosary School ERP — design system
   Palette taken from the school crest: Celtic-cross blue, rule red, book olive
   =========================================================================== */

:root {
  /* crest blue */
  --blue-950: #07073f;
  --blue-900: #0b0b6b;
  --blue-800: #12128f;
  --blue-700: #1a1ac4;
  --blue-600: #1d1de3;
  --blue-100: #e8e8fd;
  --blue-050: #f3f3fe;

  /* crest red */
  --red-600: #cf1620;
  --red-500: #ee1c25;
  --red-100: #fde8e9;

  /* crest book */
  --olive-500: #b8b400;
  --olive-100: #f6f5d8;
  --green-700: #1f5c2e;

  --ink: #14182a;
  --ink-soft: #47506a;
  --ink-faint: #838da6;

  --paper: #f4f5fa;
  --surface: #ffffff;
  --line: #e4e7f2;

  --ok: #10745a;
  --ok-bg: #e4f4ee;
  --warn: #97600a;
  --warn-bg: #fdf2dc;
  --danger: var(--red-600);
  --danger-bg: var(--red-100);

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(11, 11, 63, 0.06), 0 1px 3px rgba(11, 11, 63, 0.05);
  --shadow-md: 0 6px 20px rgba(11, 11, 63, 0.10);
  --shadow-lg: 0 20px 52px rgba(7, 7, 63, 0.28);

  --sidebar-w: 252px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }

a { color: var(--blue-700); }

code, .mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.92em;
}

.muted { color: var(--ink-faint); }
.small { font-size: 0.82rem; }
.strong { font-weight: 600; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.inline { display: inline; margin: 0; }
.is-hidden { display: none !important; }
.req { color: var(--danger); font-weight: 700; }

/* ===========================  AUTH SCREENS  ============================== */

body.auth {
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background:
    radial-gradient(1000px 560px at 12% -12%, #2a2ae8 0%, transparent 58%),
    radial-gradient(880px 520px at 112% 112%, #12128f 0%, transparent 55%),
    var(--blue-950);
}

.auth-wrap { width: 100%; max-width: 400px; }

.auth-brand { text-align: center; color: #fff; margin-bottom: 1.6rem; }

.auth-logo-badge {
  width: 100%;
  max-width: 258px;
  margin: 0 auto;
  border-radius: 20px;
  background: #fff;
  padding: 16px 18px;
  display: block;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.32);
}

.auth-logo { width: 100%; height: auto; display: block; }

.auth-brand h1 {
  font-family: var(--serif);
  font-size: 1.55rem;
  margin-top: 0.95rem;
  letter-spacing: 0.02em;
}

.auth-brand p {
  margin: 0.3rem 0 0;
  font-size: 0.74rem;
  color: #c3c6f9;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.auth-motto {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.9rem !important;
  text-transform: none !important;
  letter-spacing: 0.01em !important;
  color: #fff !important;
  opacity: 0.72;
  margin-top: 0.5rem !important;
}

.auth-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.9rem;
  box-shadow: var(--shadow-lg);
}

.auth-card h2 { font-size: 1.15rem; margin-bottom: 0.3rem; }

.auth-hint { color: var(--ink-faint); font-size: 0.86rem; margin: 0 0 1.3rem; }
.auth-hint.center { margin: 1.1rem 0 0; text-align: center; }

.auth-foot {
  text-align: center;
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.76rem;
  margin-top: 1.4rem;
}

/* =============================  APP SHELL  =============================== */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: linear-gradient(168deg, var(--blue-800) 0%, var(--blue-950) 100%);
  border-right: 3px solid var(--red-500);
  color: #dbe4f0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.15rem 1.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

/* The crest is artwork on a white ground, so it sits in a white chip rather
   than floating on the blue. Works for the SVG and for a dropped-in PNG. */
.logo-badge {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: #fff;
  display: grid;
  place-items: center;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(7, 7, 63, 0.35);
}

.logo { width: 100%; height: 100%; object-fit: contain; display: block; }

.sidebar-brand-text { display: flex; flex-direction: column; min-width: 0; }

.brand-name { color: #fff; font-weight: 650; font-size: 0.98rem; }

.brand-sub {
  font-size: 0.66rem;
  color: #b9bdf7;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.nav { padding: 0.85rem 0.6rem; flex: 1; overflow-y: auto; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.58rem 0.7rem;
  margin-bottom: 0.15rem;
  border-radius: var(--radius-sm);
  color: #c3d1e4;
  text-decoration: none;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
}

.nav-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }

.nav-item.is-active {
  background: rgba(201, 162, 39, 0.16);
  border-left-color: var(--red-500);
  color: #fff;
  font-weight: 600;
}

.nav-item.is-soon { opacity: 0.42; cursor: not-allowed; }
.nav-item.is-soon:hover { background: none; color: #c3d1e4; }

.nav-icon { width: 1.1rem; text-align: center; opacity: 0.9; }

.nav-badge {
  margin-left: auto;
  font-size: 0.62rem;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 0.05rem 0.42rem;
}

.sidebar-foot { padding: 0.9rem 1.15rem; border-top: 1px solid rgba(255, 255, 255, 0.09); }

.role-chip {
  display: inline-block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #dbe4f0;
}

.role-admin { background: rgba(238, 28, 37, 0.30); color: #ffdfe1; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--surface);
  border-bottom: 2px solid var(--red-500);
  padding: 0.85rem 1.6rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 20;
}

.page-title { font-size: 1.1rem; flex: 1; font-family: var(--serif); letter-spacing: 0.01em; }

.topbar-right { display: flex; align-items: center; gap: 0.65rem; }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blue-800);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 650;
}

.who { font-size: 0.86rem; color: var(--ink-soft); }

.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.6rem;
  font-size: 1rem;
  cursor: pointer;
}

.content { flex: 1; padding: 1.6rem; max-width: 1180px; width: 100%; }

.footer {
  padding: 1.2rem 1.6rem 2rem;
  color: var(--ink-faint);
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.footer-motto {
  font-family: var(--serif);
  font-style: italic;
  color: var(--blue-700);
}

.page-intro { color: var(--ink-soft); font-size: 0.9rem; margin-bottom: 1.2rem; max-width: 70ch; }
.page-intro p { margin: 0; }

/* ================================  HERO  ================================= */

.hero {
  background: linear-gradient(118deg, var(--blue-900) 0%, var(--blue-700) 62%, var(--blue-600) 100%);
  border-bottom: 4px solid var(--red-500);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.7rem 1.8rem;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.hero-text { flex: 1; min-width: 0; }

.eyebrow {
  margin: 0;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--olive-500);
}

.hero h2 { font-size: 1.6rem; margin: 0.25rem 0 0.4rem; }

.hero-sub { margin: 0; color: rgba(255, 255, 255, 0.78); font-size: 0.92rem; max-width: 56ch; }

.hero-logo-badge {
  flex: 0 0 auto;
  width: 96px;
  height: 96px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  padding: 9px;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 22px rgba(7, 7, 63, 0.3);
}

.hero-logo { width: 100%; height: 100%; object-fit: contain; display: block; }

.hero h2 { font-family: var(--serif); }

/* ================================  STATS  ================================ */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.2rem;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-sm);
  border-top: 3px solid var(--blue-600);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.stat:nth-child(even) { border-top-color: var(--red-500); }
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-value { display: block; font-size: 1.85rem; font-weight: 700; color: var(--blue-900); }

.stat-label { display: block; font-size: 0.78rem; color: var(--ink-faint); margin-top: 0.15rem; }

/* ===============================  PANELS  ================================ */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.2rem;
  overflow: hidden;
}

.panel-center { padding-bottom: 1.6rem; }

.panel-head {
  padding: 1rem 1.3rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  background: linear-gradient(var(--surface), #fbfcfe);
}

.panel-head h3 { font-size: 0.98rem; flex: 1; }

.panel-note { font-size: 0.78rem; color: var(--ink-faint); }

.panel > .grid,
.panel > .senior-only,
.panel > .help.block,
.panel > .doc-list,
.panel > .detail-grid { padding: 1.3rem; }

.panel > .senior-only { padding-top: 0; }

/* ================================  TILES  ================================ */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 0.9rem;
  padding: 1.3rem;
}

.tile {
  display: block;
  padding: 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.tile:hover {
  transform: translateY(-2px);
  border-color: var(--blue-700);
  box-shadow: var(--shadow-md);
}

.tile-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--blue-100);
  color: var(--blue-900);
  font-size: 1.05rem;
  margin-bottom: 0.6rem;
}

.tile-label { display: block; font-weight: 620; }

.tile-desc { display: block; font-size: 0.8rem; color: var(--ink-faint); margin-top: 0.15rem; }

/* ================================  FORMS  ================================ */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem 1.2rem;
}

.field { display: flex; flex-direction: column; margin: 0; }

label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid #cfd7e2;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.92rem;
  background: var(--surface);
  color: var(--ink);
}

input[type="file"] {
  padding: 0.35rem;
  font-size: 0.84rem;
  background: #fbfcfe;
  cursor: pointer;
}

input[type="file"]::file-selector-button {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  margin-right: 0.7rem;
  padding: 0.34rem 0.8rem;
  border: 1px solid var(--blue-100);
  border-radius: 6px;
  background: var(--blue-050);
  color: var(--blue-700);
  cursor: pointer;
}

input[type="file"]::file-selector-button:hover {
  background: var(--blue-100);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue-700);
  box-shadow: 0 0 0 3px rgba(30, 70, 117, 0.14);
}

/* :user-invalid (not :invalid) so an untouched empty required field is not
   painted as an error the moment the page loads */
input:user-invalid, select:user-invalid { border-color: #e39aa0; }
input:user-invalid:focus { box-shadow: 0 0 0 3px rgba(238, 28, 37, 0.14); }

.help { font-size: 0.77rem; color: var(--ink-faint); margin-top: 0.3rem; }
.help.block { margin: 0 0 0.4rem; }

.divider {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 1.4rem 0 1rem;
  color: var(--blue-800);
  font-size: 0.78rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--red-500), transparent);
}

.file-chosen {
  font-size: 0.75rem;
  color: var(--ok);
  margin-top: 0.3rem;
  word-break: break-all;
}

.file-chosen.too-big { color: var(--danger); font-weight: 600; }

.form-actions {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  margin: 1.4rem 0 0.5rem;
  flex-wrap: wrap;
}

.form-actions.center { justify-content: center; }

.filters { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.filters select, .filters input { width: auto; margin: 0; font-size: 0.85rem; padding: 0.4rem 0.6rem; }

/* ===============================  BUTTONS  =============================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.05rem;
  border: 1px solid #cfd7e2;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 550;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.btn:hover { background: #f1f4f9; }

.btn-primary {
  background: var(--blue-700);
  border-color: var(--blue-700);
  color: #fff;
}

.btn-primary:hover { background: var(--blue-800); border-color: var(--blue-800); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--blue-700); }
.btn-ghost:hover { background: #eef2f8; }

.btn-danger { background: var(--surface); border-color: #e6b6b8; color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); }

.btn-sm { padding: 0.32rem 0.7rem; font-size: 0.8rem; }
.btn-lg { padding: 0.7rem 1.5rem; font-size: 0.95rem; }
.btn-block { width: 100%; }

/* ===============================  ALERTS  ================================ */

.alert {
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.87rem;
  margin: 0 0 1.1rem;
  border: 1px solid transparent;
}

.alert ul { margin: 0.45rem 0 0; padding-left: 1.15rem; }
.alert li { margin-bottom: 0.15rem; }

.alert-error { background: var(--danger-bg); color: #8a1f26; border-color: #f0c4c6; }
.alert-warn { background: var(--warn-bg); color: #7d4f06; border-color: #f0d9ad; }

.notice-strip {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: var(--blue-100);
  border: 1px solid #e8d9ab;
  border-left: 3px solid var(--red-500);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.84rem;
  color: #6b5410;
  margin-bottom: 1.2rem;
}

.notice-icon { flex: 0 0 auto; }

/* ===============================  TABLES  ================================ */

.table-wrap { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: 0.89rem; }

.table th.right { text-align: right; }

.table th {
  text-align: left;
  padding: 0.7rem 1rem;
  background: #f7f9fc;
  border-bottom: 1px solid var(--line);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  white-space: nowrap;
}

.table td { padding: 0.72rem 1rem; border-bottom: 1px solid #eef1f6; vertical-align: middle; }

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafbfd; }

/* ================================  PILLS  ================================ */

.pill {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.14rem 0.55rem;
  border-radius: 999px;
  background: #eef2f8;
  color: var(--blue-800);
}

.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-accent { background: var(--blue-100); color: #7a610f; }

/* ===============================  PROFILE  =============================== */

.profile {
  display: flex;
  gap: 1.4rem;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem;
  margin-bottom: 1.2rem;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.profile-photo { flex: 0 0 auto; }

.profile-photo img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 3px solid var(--blue-100);
}

.photo-placeholder {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-sm);
  background: var(--blue-800);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 2.1rem;
  font-weight: 650;
}

.profile-head { flex: 1; min-width: 220px; }
.profile-head h2 { font-size: 1.35rem; margin-bottom: 0.55rem; }

.chips { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.profile-actions { display: flex; gap: 0.5rem; margin-top: 0.9rem; align-items: center; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem 1.4rem;
  margin: 0;
}

.detail-grid dt { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-faint); }
.detail-grid dd { margin: 0.15rem 0 0; font-weight: 550; }

/* ==============================  DOC LIST  =============================== */

.doc-list { list-style: none; margin: 0; }

.doc-list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid #eef1f6;
}

.doc-list li:last-child { border-bottom: none; }

.doc-icon { font-size: 1.05rem; }
.doc-name { flex: 1; font-weight: 550; }

/* =============================  CREDENTIALS  ============================= */

.credentials {
  max-width: 430px;
  margin: 0 auto;
  background: #fbfcfe;
  border: 1px dashed #c6d2e2;
  border-radius: var(--radius-sm);
  padding: 1.2rem;
}

.credentials-title {
  margin: 0 0 0.8rem;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  text-align: center;
}

.credential-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.45rem 0;
}

.credential-row span { font-size: 0.84rem; color: var(--ink-soft); }

.credential-row code {
  background: var(--blue-900);
  color: #ffffff;
  padding: 0.28rem 0.7rem;
  border-radius: 6px;
  font-size: 0.92rem;
  letter-spacing: 0.03em;
}

/* ================================  EMPTY  ================================ */

.empty { text-align: center; padding: 2.6rem 1.5rem; }

.empty-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 0.9rem;
  border-radius: 50%;
  background: #eef2f8;
  color: var(--blue-700);
  font-size: 1.3rem;
}

.empty-icon.success { background: var(--ok-bg); color: var(--ok); }

.empty h3 { font-size: 1.02rem; margin-bottom: 0.3rem; }
.empty p { color: var(--ink-faint); font-size: 0.88rem; margin: 0 0 1rem; }

/* ==============================  RESPONSIVE  ============================= */

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
  }
  .shell.nav-open .sidebar { transform: translateX(0); }
  .menu-toggle { display: block; }
  .content { padding: 1.1rem; }
  .topbar { padding: 0.75rem 1.1rem; }
  .who { display: none; }
  .hero { padding: 1.3rem; }
  .hero-logo-badge { display: none; }
}

@media (max-width: 520px) {
  .grid { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr; }
  .credential-row { flex-direction: column; align-items: flex-start; gap: 0.3rem; }
}

@media print {
  .sidebar, .topbar, .form-actions, .footer { display: none; }
  .panel { box-shadow: none; border-color: #ccc; }
}

/* ===========================  PHASE 3: ATTENDANCE  ======================= */

.pad { padding: 1.3rem; }
.pad-x { padding-left: 1.3rem; padding-right: 1.3rem; }
.form-actions.pad-x { padding-bottom: 1.3rem; }

.alert-ok { background: var(--ok-bg); color: #14684a; border-color: #bfe5d4; }

.alert-flag {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* direct child only — a bare `span` selector also caught the spans inside the
   flagged-student list and broke each entry across three lines */
.alert-flag > div > span { display: block; font-weight: 400; }

.flag-list { margin: 0.6rem 0 0; padding-left: 1.15rem; }
.flag-list li { margin-bottom: 0.2rem; }
.flag-list a { color: inherit; font-weight: 600; }

.pill-danger { background: var(--danger-bg); color: var(--danger); }

.pill-link { text-decoration: none; margin-right: 0.25rem; }
.pill-link:hover { background: var(--blue-800); color: #fff; }

.filters-pad { padding: 1.3rem; align-items: flex-end; }

.inline-field { flex-direction: column; }
.inline-field label { margin-bottom: 0.3rem; }

.bulk-bar {
  display: flex;
  gap: 0.5rem;
  padding: 0.9rem 1.3rem;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
  flex-wrap: wrap;
}

.roster td { padding-top: 0.5rem; padding-bottom: 0.5rem; }

.radio {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.28rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.82rem;
  margin: 0;
  font-weight: 500;
  color: var(--ink-soft);
}

.radio input { accent-color: var(--ok); margin: 0; }
.radio:has(input:checked) { background: var(--ok-bg); border-color: #a9dcc6; color: var(--ok); font-weight: 650; }

.radio-absent input { accent-color: var(--danger); }
.radio-absent:has(input:checked) { background: var(--danger-bg); border-color: #eebcbe; color: var(--danger); }

.self-done {
  display: flex;
  gap: 1.3rem;
  align-items: center;
  padding: 1.3rem;
  flex-wrap: wrap;
}

.self-photo img {
  width: 132px;
  height: 132px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 3px solid var(--blue-100);
}

.self-done h3 { margin: 0.4rem 0 0.2rem; font-size: 1.05rem; }
.self-done .pill { display: inline-block; }

.selfie-preview { margin: 1rem 0; }

.selfie-preview canvas {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  display: block;
}

/* =====================  PHASE 4 & 5: MARKS, NOTICES, HOMEWORK  =========== */

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.bell {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 1rem;
  line-height: 1;
}

.bell:hover { background: var(--blue-050); }

.bell-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--red-500);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 2px solid var(--surface);
}

.bell.has-unread { animation: bell-nudge 1.4s ease 0.3s 2; }

@keyframes bell-nudge {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(12deg); }
  75% { transform: rotate(-12deg); }
}

@media (prefers-reduced-motion: reduce) {
  .bell.has-unread { animation: none; }
}

/* wide fields inside the auto-fit grid */
.field.span-2 { grid-column: span 2; }
.field.span-3 { grid-column: 1 / -1; }

textarea { resize: vertical; min-height: 90px; }

input.narrow { width: 110px; }

.inline-label {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
}

.bulk-bar .help { margin: 0; }

/* notice / homework cards */
.notice-list { list-style: none; margin: 0; padding: 0; }

.notice-item {
  padding: 1.1rem 1.3rem;
  border-bottom: 1px solid #eef1f6;
}

.notice-item:last-child { border-bottom: none; }
.notice-item:hover { background: #fcfdff; }

.notice-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}

.notice-head h4 { font-size: 1rem; margin: 0; flex: 0 1 auto; }

.notice-body {
  margin: 0 0 0.6rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.notice-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.notice-meta .spacer { flex: 1; }

@media (max-width: 720px) {
  .field.span-2, .field.span-3 { grid-column: 1 / -1; }
}

/* =========================  PHASE 6: COMPLAINTS  ========================= */

.notice-item.is-resolved { opacity: 0.68; }
.notice-item.is-resolved .notice-body { text-decoration: none; }

/* =============================  FEES & RECEIPTS  ========================= */

.checkout-amount {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--blue-800);
  margin: 0.5rem 0 1.2rem;
}

.receipt { padding: 1.5rem; }

.receipt-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1.1rem;
  border-bottom: 2px solid var(--red-500);
  margin-bottom: 1.3rem;
  flex-wrap: wrap;
}

.receipt-logo { box-shadow: none; border: 1px solid var(--line); }
.receipt-head h2 { font-family: var(--serif); font-size: 1.2rem; }
.receipt-no { margin-left: auto; text-align: right; }
.receipt-no strong { display: block; font-family: ui-monospace, Menlo, monospace; }

.receipt-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.4rem;
  padding: 1rem 1.2rem;
  background: var(--blue-050);
  border-radius: var(--radius-sm);
  border: 1px solid var(--blue-100);
}

.receipt-total strong { font-size: 1.4rem; color: var(--blue-800); }

@media print {
  .no-print { display: none; }
  .receipt { border: none; }
}
