/* =========================================================
   IGS Portal — v6 "Warm Premium"
   Framed dashboard on an amber backdrop, maroon-light sidebar
   with a gold active pill, icon stat tiles, a donut breakdown
   card, an activity feed. Illustrated blob-split login.
   ========================================================= */

:root {
  --ink:        #241019;
  --ink-soft:   #6b5560;
  /* Was #9c8a92 — Ishaq flagged labels/hints/meta text as too dim to
     read comfortably (2026-07-27). Darkened to meet WCAG AA contrast
     (4.5:1+) on both white and cream backgrounds while staying visibly
     lighter/more muted than --ink-soft. */
  --ink-faint:  #7f6c74;

  --maroon:     #8c2140;
  --maroon-2:   #a52a4d;
  --maroon-deep:#5c1329;

  --gold:       #d9a441;
  --gold-deep:  #b6842a;

  --amber-1:    #e7bd76;
  --amber-2:    #dba955;

  --cream:      #fbf7ee;
  --card:       #ffffff;
  --line:       #efe7d8;

  --c-blue:     #3b6fa0;
  --c-teal:     #2f8f74;
  --c-rose:     #c1567c;

  --good: #2f8f56;
  --warn: #b3701e;
  --bad:  #b3413a;

  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--cream); color: var(--ink); }

/* The `hidden` attribute is only display:none via the browser's default
   (very low-priority) stylesheet — any class below that also sets its own
   `display` (e.g. .nav a { display: flex }) silently wins over it, so a
   role-gated nav link marked hidden="" can still render. This rule forces
   `hidden` to always mean hidden, everywhere on the site, regardless of
   what other display rules a hidden element's classes carry. */
[hidden] { display: none !important; }

.ic { width: 18px; height: 18px; flex-shrink: 0; }
.ic svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ================= LOGIN — illustrated blob split ================= */

.login-page {
  min-height: 100vh;
  display: flex;
  background: linear-gradient(160deg, var(--maroon-deep), var(--maroon) 60%, var(--maroon-2) 100%);
}

.blob-side {
  flex: 1.05;
  position: relative;
  display: none;
}
@media (min-width: 860px) { .blob-side { display: block; } }

.blob-side svg { position: absolute; inset: 0; width: 100%; height: 100%; }

.blob-content {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 40px 60px 40px 48px;
}

.blob-brand { display: flex; align-items: center; gap: 12px; }
.blob-brand .ring { width: 34px; height: 34px; border-radius: 50%; background: var(--maroon); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; }
.blob-brand .name { font-weight: 700; color: var(--ink); font-size: 14px; }
.blob-brand .tag { font-size: 10.5px; color: var(--ink-faint); }

.blob-illustration { display: flex; align-items: center; justify-content: center; flex: 1; }

.blob-foot { font-size: 10.5px; color: var(--ink-faint); }

.form-side { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 24px; }

.form-card { width: 100%; max-width: 360px; color: #fff; }

.form-card .kicker { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 700; color: var(--gold); margin-bottom: 12px; }
.form-card h1 { margin: 0 0 8px; font-size: 32px; font-weight: 700; }
.form-card .sub { color: rgba(255,255,255,0.68); font-size: 13.5px; margin-bottom: 30px; }

.role-select { display: flex; gap: 8px; margin-bottom: 26px; background: rgba(255,255,255,0.08); padding: 4px; border-radius: 12px; }
.role-select button { flex: 1; background: none; border: none; padding: 9px 6px; font-size: 11.5px; font-weight: 700; color: rgba(255,255,255,0.55); cursor: pointer; border-radius: 9px; }
.role-select button.active { background: var(--gold); color: var(--maroon-deep); }

.form-card .field-line { margin-bottom: 16px; }
.form-card .field-line label { display: block; font-size: 11px; font-weight: 700; color: rgba(255,255,255,0.6); margin-bottom: 7px; letter-spacing: 0.03em; }
.form-card .field-line input {
  width: 100%; border: 1px solid rgba(255,255,255,0.14); background: rgba(255,255,255,0.07);
  border-radius: 12px; padding: 12px 14px; font-size: 14.5px; color: #fff; font-family: inherit;
}
.form-card .field-line input::placeholder { color: rgba(255,255,255,0.4); }
.form-card .field-line input:focus { outline: none; border-color: var(--gold); background: rgba(255,255,255,0.11); }

.btn-primary {
  width: 100%; padding: 14px; border: none; border-radius: 12px; cursor: pointer;
  background: linear-gradient(120deg, var(--gold), var(--gold-deep));
  color: var(--maroon-deep); font-size: 14px; font-weight: 700; margin-top: 6px;
  box-shadow: 0 16px 30px -12px rgba(217,164,65,0.55);
}

.form-error { background: rgba(203,64,64,0.16); border: 1px solid rgba(203,64,64,0.35); color: #ffd7d7; font-size: 12.5px; padding: 10px 13px; border-radius: 10px; margin-bottom: 16px; }

.login-note { margin-top: 18px; font-size: 12px; color: rgba(255,255,255,0.55); text-align: center; }
.login-links { margin-top: 20px; text-align: center; font-size: 12.5px; color: rgba(255,255,255,0.6); }
.login-links a { color: var(--gold); text-decoration: none; font-weight: 600; }

/* ================= APP SHELL — framed, warm backdrop ================= */

.frame-page {
  min-height: 100vh;
  background: var(--cream);
}

.frame {
  width: 100%; min-height: 100vh;
  background: var(--cream);
  overflow: hidden;
  display: grid;
  grid-template-columns: 260px 1fr 320px;
}
/* Pages without an activity column (e.g. the staff portal) use this
   instead of an inline style, so the responsive rules below — which
   target plain element/class selectors — aren't out-specificity'd by an
   inline style and silently fail to collapse the grid on mobile. */
.frame-2col { grid-template-columns: 260px 1fr; }

/* Base rules for the sidebar and its mobile-only companions (top bar,
   backdrop, close button) MUST come before the responsive media queries
   below — they share equal CSS specificity (one class each), so with
   plain source-order cascade, whichever rule appears LATER in the file
   wins regardless of the media query. Keeping base rules first and
   media-query overrides after is what lets the overrides actually take
   effect on mobile. (This ordering caused a real bug the first time this
   shipped: the base .sidebar rule was accidentally placed after the
   mobile media query, so `position: fixed` from the media query was
   always overridden back to `position: relative` — the sidebar still
   reserved a full 100vh-tall row in the page's grid layout while being
   invisible off-screen, pushing all real content a full screen-height
   below the fold and leaving the visible area blank. Fixed 2026-07-27.) */
.sidebar {
  position: relative; overflow: hidden;
  background: linear-gradient(190deg, var(--maroon), var(--maroon-deep));
  color: #fff; padding: 26px 16px; display: flex; flex-direction: column;
}

/* Fixed top bar shown only on mobile (<=780px, see media query below),
   holding the hamburger button that opens the sidebar drawer. */
.mobile-topbar {
  display: none; align-items: center; gap: 12px;
  position: fixed; top: 0; left: 0; right: 0; height: 56px; box-sizing: border-box;
  background: linear-gradient(190deg, var(--maroon), var(--maroon-deep));
  color: #fff; padding: 0 16px; z-index: 998;
  box-shadow: 0 4px 14px -6px rgba(0,0,0,0.3);
}
.mobile-topbar .hamburger-btn {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: rgba(255,255,255,0.14); border: none; color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.mobile-topbar .hamburger-btn svg { width: 19px; height: 19px; }
.mobile-topbar .mt-brand { font-size: 14.5px; font-weight: 700; }

/* Dark overlay behind the open sidebar drawer — tapping it closes the
   drawer, same as the explicit close button. */
.sidebar-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(20,8,14,0.55); z-index: 1000;
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
}

.sidebar-close-btn {
  display: none; position: absolute; top: 16px; right: 14px; width: 30px; height: 30px; border-radius: 9px;
  background: rgba(255,255,255,0.14); border: none; color: #fff; align-items: center; justify-content: center; cursor: pointer;
}
.sidebar-close-btn svg { width: 16px; height: 16px; }

@media (max-width: 1100px) {
  .frame { grid-template-columns: 220px 1fr; }
  .frame-2col { grid-template-columns: 220px 1fr; }
  .activity-col { display: none; }
}
/* Mobile nav (added 2026-07-27): below 780px the sidebar becomes a
   slide-in drawer (triggered by the hamburger button in .mobile-topbar)
   instead of just disappearing with no way to reopen it — the old rule
   here was `.sidebar { display: none; }` with no toggle at all, which
   left mobile users with zero navigation. */
@media (max-width: 780px) {
  .frame, .frame-2col { grid-template-columns: 1fr; }
  .mobile-topbar { display: flex; }
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; width: 82vw; max-width: 280px;
    z-index: 1001; transform: translateX(-100%); transition: transform .28s ease;
    box-shadow: 12px 0 34px -10px rgba(0,0,0,0.45);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close-btn { display: flex; }
  .sidebar-backdrop { display: block; }
  .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
  .main { padding-top: 78px; }
}

.sidebar .brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 28px; }
.sidebar .brand .mark { width: 32px; height: 32px; border-radius: 9px; background: var(--gold); color: var(--maroon-deep); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; }
.sidebar .brand-name { font-size: 14.5px; font-weight: 700; }
.sidebar .brand-tag { font-size: 10px; color: rgba(255,255,255,0.55); }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 13px;
  color: rgba(255,255,255,0.7); text-decoration: none; font-size: 13.5px; font-weight: 600;
}
.nav a.active { background: var(--gold); color: var(--maroon-deep); box-shadow: 0 10px 20px -8px rgba(0,0,0,0.35); }
.nav a:hover:not(.active) { background: rgba(255,255,255,0.08); color: #fff; }

/* Expandable nav group (e.g. "Examination Centre" -> Create Exam / Assign Papers) */
.nav-group-toggle {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 13px; border-radius: 13px;
  background: none; border: none; color: rgba(255,255,255,0.7); font-size: 13.5px; font-weight: 600;
  font-family: inherit; cursor: pointer; transition: background-color .15s ease, color .15s ease;
}
.nav-group-toggle:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-group.open .nav-group-toggle { color: #fff; }
.nav-caret { transition: transform .18s ease; font-size: 11px; }
.nav-group.open .nav-caret { transform: rotate(-180deg); }

.nav-subnav {
  display: block; max-height: 0; overflow: hidden; transition: max-height .2s ease;
  margin: 2px 0 2px 29px; padding-left: 14px; border-left: 1.5px solid rgba(255,255,255,0.16);
}
.nav-group.open .nav-subnav { max-height: 280px; }

.nav-sub {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 9px;
  color: rgba(255,255,255,0.55); text-decoration: none; font-size: 11.5px; font-weight: 500;
  letter-spacing: 0.01em; margin: 2px 0;
}
.nav-sub.active { background: var(--gold); color: var(--maroon-deep); font-weight: 700; box-shadow: 0 10px 20px -8px rgba(0,0,0,0.35); }
.nav-sub:hover:not(.active) { background: rgba(255,255,255,0.08); color: #fff; }

/* Awaiting-review count badge on the Paper Review nav link (added
   2026-07-27) — a Controller/Super Admin should be able to tell at a
   glance that papers are waiting on their decision, without opening
   each exam one at a time. */
.nav-badge {
  margin-inline-start: auto; background: var(--maroon-2); color: #fff; font-size: 10.5px; font-weight: 800;
  min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 5px;
}
.nav-sub.active .nav-badge { background: var(--maroon-deep); color: #fff; }

.sidebar .user-mini { border-top: 1px solid rgba(255,255,255,0.14); padding-top: 16px; margin-top: 14px; display: flex; align-items: center; gap: 10px; }
.sidebar .user-mini .av { width: 32px; height: 32px; border-radius: 50%; background: var(--gold); color: var(--maroon-deep); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; }
.sidebar .user-mini .n { font-size: 12px; font-weight: 700; }
.sidebar .user-mini .r { font-size: 10.5px; color: rgba(255,255,255,0.55); }

.credit-line { font-size: 9.5px; line-height: 1.5; color: rgba(255,255,255,0.35); text-align: center; margin-top: 16px; }

.main { padding: 34px 40px 50px; overflow-y: auto; }
.mock-banner { background: #fdeccf; border: 1px solid #f0d9a0; color: #8a6300; font-size: 12px; padding: 9px 15px; border-radius: 12px; margin-bottom: 18px; }

.top-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.top-row h1 { margin: 0; font-size: 24px; font-weight: 800; }

/* Hero banner */
.hero {
  position: relative; overflow: hidden; border-radius: 22px; padding: 26px 30px; margin-bottom: 20px;
  background: linear-gradient(120deg, var(--gold-deep), var(--gold));
  color: var(--maroon-deep);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.hero::after { content: ""; position: absolute; top: -60px; right: -20px; width: 200px; height: 200px; border-radius: 50%; background: rgba(255,255,255,0.18); }
.hero h2 { margin: 0 0 6px; font-size: 21px; font-weight: 800; }
.hero .sub { font-size: 12.5px; color: rgba(92,19,41,0.75); max-width: 380px; }
.hero-avatar { width: 54px; height: 54px; border-radius: 50%; background: var(--maroon-deep); color: var(--gold); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 17px; flex-shrink: 0; position: relative; z-index: 2; border: 3px solid rgba(255,255,255,0.5); }
.hero-actions { display: flex; gap: 10px; margin-top: 14px; position: relative; z-index: 2; }
.pill-btn { background: #fff; color: var(--maroon-deep); border: none; padding: 9px 15px; border-radius: 999px; font-size: 12px; font-weight: 700; }

/* Icon stat tiles */
.tile-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
@media (max-width: 900px) { .tile-grid { grid-template-columns: repeat(2, 1fr); } }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; display: flex; align-items: center; gap: 12px; }
.tile .ic-c { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tile .ic-c.t1 { background: #f7e6ee; color: var(--maroon); }
.tile .ic-c.t2 { background: #e6f2ee; color: var(--c-teal); }
.tile .ic-c.t3 { background: #fbeed7; color: var(--gold-deep); }
.tile .ic-c.t4 { background: #e8eef6; color: var(--c-blue); }
.tile .tv { font-size: 19px; font-weight: 800; line-height: 1.1; }
.tile .tl { font-size: 11px; color: var(--ink-faint); font-weight: 600; margin-top: 2px; }

/* Breakdown card w/ donut */
.panel-row { display: grid; grid-template-columns: 1fr; gap: 18px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 22px; }
.panel-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.panel-top h3 { margin: 0; font-size: 15.5px; font-weight: 800; }
.panel-top .cnt { font-size: 12.5px; color: var(--ink-faint); font-weight: 600; }

.donut-row { display: flex; align-items: center; gap: 26px; }
.donut-wrap { position: relative; width: 128px; height: 128px; flex-shrink: 0; }
.donut-wrap .center { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; }
.donut-wrap .center .n { font-size: 24px; font-weight: 800; }
.donut-wrap .center .l { font-size: 9.5px; color: var(--ink-faint); font-weight: 700; text-transform: uppercase; }

.legend { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.legend-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.legend-row .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.legend-row .lbl { flex-shrink: 0; width: 76px; font-weight: 600; }
.legend-row .bar-track { flex: 1; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.legend-row .bar-fill { height: 100%; border-radius: 999px; }
.legend-row .val { width: 30px; text-align: right; font-weight: 700; }

table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 4px; }
th { text-align: left; color: var(--ink-faint); font-weight: 700; padding: 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; }
td { padding: 12px 8px; border-top: 1px solid var(--line); }
.badge { display: inline-flex; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge.ok { background: #e3f3e9; color: var(--good); }
.badge.warn { background: #fbecd8; color: var(--warn); }
.badge.info { background: #e8eef6; color: var(--c-blue); }
.badge.neutral { background: #eee8ea; color: var(--ink-faint); }
.badge.bad { background: #f7e2e0; color: var(--bad); }

/* Activity column */
.activity-col { background: var(--card); border-left: 1px solid var(--line); padding: 28px 22px; overflow-y: auto; }
.activity-col h3 { margin: 0 0 16px; font-size: 16px; font-weight: 800; }
.act-sub { display: flex; align-items: center; justify-content: space-between; margin: 20px 0 10px; }
.act-sub .h { font-size: 11px; font-weight: 700; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.04em; }
.act-sub a { font-size: 11px; color: var(--maroon); font-weight: 700; text-decoration: none; }

.date-item { display: flex; gap: 12px; align-items: center; padding: 10px 0; }
.date-badge { width: 38px; height: 38px; border-radius: 10px; background: #f7e6ee; color: var(--maroon); display: flex; flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0; }
.date-badge .d { font-size: 12px; font-weight: 800; line-height: 1; }
.date-badge .m { font-size: 8px; font-weight: 700; text-transform: uppercase; }
.date-item .t { font-size: 12.5px; font-weight: 700; }
.date-item .m2 { font-size: 11px; color: var(--ink-faint); }

.feed-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; }
.feed-av { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0; position: relative; }
.feed-item .n { font-size: 12.5px; font-weight: 700; }
.feed-item .d { font-size: 11px; color: var(--ink-faint); }
.online-dot { position: absolute; bottom: -1px; right: -1px; width: 8px; height: 8px; border-radius: 50%; background: var(--good); border: 2px solid #fff; }

/* ================= APP MODALS, FORM CONTROLS & BUTTONS =================
   Shared across every admin/controller screen (User Management, Exams,
   and anything built after) so the whole app looks and behaves the same
   way — one deliberate button/field system instead of ad hoc inline
   styles per screen. */

.field-line { margin-bottom: 14px; }
.field-line label { display: block; font-size: 11px; font-weight: 700; color: var(--ink-faint); margin-bottom: 5px; letter-spacing: 0.02em; }
.field-line input,
.field-line select,
.field-line textarea {
  width: 100%; padding: 10px 13px; border-radius: 10px; border: 1px solid var(--line);
  font-size: 13px; font-family: inherit; color: var(--ink); background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field-line input::placeholder { color: var(--ink-faint); }
.field-line input:focus,
.field-line select:focus,
.field-line textarea:focus {
  outline: none; border-color: var(--gold-deep); box-shadow: 0 0 0 3px rgba(217,164,65,0.18);
}
.field-line-hint { font-size: 11px; color: var(--ink-faint); margin-top: 5px; line-height: 1.4; }

.modal-overlay { position: fixed; inset: 0; background: rgba(36,16,25,0.55); align-items: center; justify-content: center; z-index: 50; }
.modal-card { background: #fff; border-radius: 18px; padding: 26px 28px; width: 100%; max-height: 88vh; overflow-y: auto; }
.modal-title { margin: 0 0 6px; font-size: 18px; font-weight: 800; }
.modal-subtitle { margin: 0 0 16px; color: var(--ink-faint); font-size: 12px; line-height: 1.5; }
.modal-error { display: none; background: #fbeaea; border: 1px solid #f0caca; color: #8a2a2a; font-size: 12.5px; padding: 9px 12px; border-radius: 9px; margin-bottom: 12px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }

/* Buttons: every clickable action across the app shares these three
   variants plus a lift-and-press animation, instead of plain flat white
   buttons with no feedback. */
.btn-solid, .btn-outline, .row-btn, .pill-btn {
  cursor: pointer; font-family: inherit; font-weight: 700;
  transition: transform .12s ease, box-shadow .18s ease, background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn-solid:active, .btn-outline:active, .row-btn:active, .pill-btn:active { transform: scale(0.96); }

.btn-solid {
  flex: 1; padding: 11px; border-radius: 999px; border: none;
  background: linear-gradient(120deg, var(--maroon-2), var(--maroon-deep));
  color: #fff; font-size: 13px; box-shadow: 0 10px 22px -12px rgba(140,33,64,0.65);
}
.btn-solid:hover { box-shadow: 0 14px 26px -10px rgba(140,33,64,0.7); transform: translateY(-1px); }
.btn-solid:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; transform: none; }

.btn-outline {
  flex: 1; padding: 11px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-size: 13px;
}
.btn-outline:hover { background: var(--cream); border-color: var(--maroon-2); color: var(--maroon-deep); }

.pill-btn {
  background: linear-gradient(120deg, var(--maroon-2), var(--maroon-deep)); color: #fff; border: none;
  padding: 10px 17px; border-radius: 999px; font-size: 12.5px;
  box-shadow: 0 10px 22px -12px rgba(140,33,64,0.65);
}
.pill-btn:hover { box-shadow: 0 14px 26px -10px rgba(140,33,64,0.7); transform: translateY(-1px); }

.row-btn {
  background: #fff; border: 1px solid var(--line); padding: 6px 11px; border-radius: 9px;
  font-size: 11px; margin-right: 5px;
}
.row-btn:hover { background: var(--cream); border-color: var(--maroon-2); color: var(--maroon-deep); }
.row-btn.danger:hover { background: #fbeaea; border-color: #e3a8a8; color: #8a2a2a; }

/* Dynamic paper-format row builder (Exams) */
.format-row { margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
.format-row:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.format-row-main { display: grid; grid-template-columns: 1fr 62px 78px 74px 32px; gap: 8px; align-items: center; }
.format-row select, .format-row input { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); font-size: 12.5px; font-family: inherit; }
.format-row-instructions { margin-top: 6px; }
.format-row-instructions input { width: 100%; color: var(--ink-faint); }
.format-remove-btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--bad); font-weight: 800; cursor: pointer; transition: all .12s ease; }
.format-remove-btn:hover { background: #fbeaea; border-color: #e3a8a8; }
.format-remove-btn:active { transform: scale(0.9); }
.format-total-row { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; font-weight: 700; margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.format-total-row.match { color: var(--good); }
.format-total-row.mismatch { color: var(--warn); }

/* Per-grade custom format overrides (Exams — added 2026-07-26) */
.grade-override-picker {
  width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line);
  font-size: 12.5px; font-family: inherit; background: #fff; color: var(--ink); margin-top: 4px;
}
.grade-override-block {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 10px; background: var(--cream);
}
.grade-override-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.grade-override-header strong { font-size: 12.5px; color: var(--maroon-deep); }
.grade-override-block .field-line { margin-bottom: 10px; }
.grade-override-block .field-line label { font-size: 10.5px; }

/* Assign Papers (Step 3) — teacher-picker selects inside the table */
#assignRows select {
  width: 100%; padding: 7px 9px; border-radius: 8px; border: 1px solid var(--line);
  font-size: 12px; font-family: inherit; background: #fff; color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
#assignRows select:focus { outline: none; border-color: var(--gold-deep); box-shadow: 0 0 0 3px rgba(217,164,65,0.18); }
#assignRows input[type="date"] {
  width: 100%; padding: 7px 9px; border-radius: 8px; border: 1px solid var(--line);
  font-size: 12px; font-family: inherit; background: #fff; color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
#assignRows input[type="date"]:focus { outline: none; border-color: var(--gold-deep); box-shadow: 0 0 0 3px rgba(217,164,65,0.18); }

.bulk-assign-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--cream); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 14px; margin-bottom: 14px;
}
.bulk-assign-bar select {
  padding: 8px 11px; border-radius: 8px; border: 1px solid var(--line); font-size: 12.5px;
  font-family: inherit; background: #fff; color: var(--ink);
}
.bulk-assign-bar input[type="date"] {
  padding: 7px 11px; border-radius: 8px; border: 1px solid var(--line); font-size: 12.5px;
  font-family: inherit; background: #fff; color: var(--ink);
}

/* Paper Builder / Paper Review (Step 4/5 — added 2026-07-27) */
.paper-section-card {
  border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 14px; background: #fff;
}
.paper-section-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px;
  padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
.paper-section-header strong { font-size: 13.5px; color: var(--maroon-deep); }
.paper-section-header span { font-size: 11.5px; color: var(--ink-faint); font-weight: 600; }
.paper-question-block { margin-bottom: 12px; }
.paper-question-block label { display: block; font-size: 11px; font-weight: 700; color: var(--ink-faint); margin-bottom: 5px; }
.paper-question-block textarea {
  width: 100%; min-height: 64px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  font-size: 13px; font-family: inherit; resize: vertical; color: var(--ink); background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.paper-question-block textarea:focus { outline: none; border-color: var(--gold-deep); box-shadow: 0 0 0 3px rgba(217,164,65,0.18); }
.paper-question-block textarea:disabled { background: var(--cream); color: var(--ink-faint); }

/* Section instructions (editable by the teacher — added 2026-07-27) */
.paper-instructions-wrap { margin-bottom: 14px; }
.paper-instructions-wrap label { display: block; font-size: 11px; font-weight: 700; color: var(--ink-faint); margin-bottom: 5px; }
.paper-instructions-wrap input {
  width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line);
  font-size: 12.5px; font-family: inherit; font-style: italic; color: var(--ink); background: #fff;
}
.paper-instructions-wrap input:focus { outline: none; border-color: var(--gold-deep); box-shadow: 0 0 0 3px rgba(217,164,65,0.18); }
.paper-instructions-wrap input:disabled { background: var(--cream); color: var(--ink-faint); }

/* MCQ option boxes (added 2026-07-27) */
.mcq-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.mcq-option-row { display: flex; align-items: center; gap: 8px; }
.mcq-opt-label {
  width: 22px; height: 22px; border-radius: 50%; background: var(--cream); color: var(--maroon-deep);
  font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.mcq-option-row input {
  flex: 1; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); font-size: 12.5px; font-family: inherit;
  color: var(--ink); background: #fff;
}
.mcq-option-row input:focus { outline: none; border-color: var(--gold-deep); box-shadow: 0 0 0 3px rgba(217,164,65,0.18); }
.mcq-option-row input:disabled { background: var(--cream); color: var(--ink-faint); }

/* Question image attach (added 2026-07-27) */
.paper-image-wrap { margin-top: 10px; }
.paper-image-preview { display: flex; align-items: flex-start; gap: 10px; }
.paper-image-preview img { max-width: 220px; max-height: 160px; border-radius: 10px; border: 1px solid var(--line); object-fit: contain; background: var(--cream); }

/* "Format Mathematics" button — shown on math-subject papers only (added 2026-07-27) */
.paper-format-math-btn { margin-top: 8px; }

/* Answer-lines count — how much blank writing space prints under a
   written question (Short/Long/Fill-in-the-Blank only, added 2026-07-27) */
.paper-lines-wrap { margin-top: 10px; }
.paper-lines-wrap label { display: block; font-size: 11px; font-weight: 700; color: var(--ink-faint); margin-bottom: 5px; }
.paper-lines-hint { font-weight: 400; text-transform: none; letter-spacing: 0; }
.paper-lines-input {
  width: 70px; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line);
  font-size: 12.5px; font-family: inherit; color: var(--ink); background: #fff;
}
.paper-lines-input:focus { outline: none; border-color: var(--gold-deep); box-shadow: 0 0 0 3px rgba(217,164,65,0.18); }
.paper-lines-input:disabled { background: var(--cream); color: var(--ink-faint); }
