:root {
  --bg: #f6f7fb; --surface: #ffffff; --surface-2: #fbfbfe; --border: #e7e8f0;
  --ink: #1e2138; --muted: #6b7280; --faint: #9aa0b4;
  --accent: #4f46e5; --accent-2: #7c3aed;
  --tile-blue-bg: #eaf1ff; --tile-blue: #2563eb;
  --tile-green-bg: #e6f7ef; --tile-green: #0d9f6e;
  --tile-violet-bg: #f1ebfe; --tile-violet: #7c3aed;
  --good: #0d9f6e; --warn: #d97706; --track: #eceef5;
  --shadow: 0 1px 2px rgba(24,27,45,.04), 0 8px 24px rgba(24,27,45,.06);
  --radius: 16px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sel-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  --gap: 12px; --req-border: #f0a3a3;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161f; --surface: #1c1f2b; --surface-2: #20222f; --border: #2c2f3e;
    --ink: #e8e9f0; --muted: #9aa0b4; --faint: #6b7086;
    --accent: #7c6cf0; --accent-2: #9a6cf0;
    --tile-blue-bg: #1e2740; --tile-blue: #7aa2ff;
    --tile-green-bg: #16302479; --tile-green: #56d7a2;
    --tile-violet-bg: #2a2350; --tile-violet: #b79bff;
    --track: #2c2f3e;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
    --sel-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239aa0b4' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    --gap: 12px; --req-border: #6e3a44;
  }
}
:root[data-theme="light"] {
  --bg: #f6f7fb; --surface: #ffffff; --surface-2: #fbfbfe; --border: #e7e8f0;
  --ink: #1e2138; --muted: #6b7280; --faint: #9aa0b4; --accent: #4f46e5; --accent-2: #7c3aed;
  --tile-blue-bg: #eaf1ff; --tile-blue: #2563eb; --tile-green-bg: #e6f7ef; --tile-green: #0d9f6e;
  --tile-violet-bg: #f1ebfe; --tile-violet: #7c3aed; --track: #eceef5;
  --shadow: 0 1px 2px rgba(24,27,45,.04), 0 8px 24px rgba(24,27,45,.06);
  --sel-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  --gap: 12px; --req-border: #f0a3a3;
}
:root[data-theme="dark"] {
  --bg: #14161f; --surface: #1c1f2b; --surface-2: #20222f; --border: #2c2f3e;
  --ink: #e8e9f0; --muted: #9aa0b4; --faint: #6b7086; --accent: #7c6cf0; --accent-2: #9a6cf0;
  --tile-blue-bg: #1e2740; --tile-blue: #7aa2ff; --tile-green-bg: #163024; --tile-green: #56d7a2;
  --tile-violet-bg: #2a2350; --tile-violet: #b79bff; --track: #2c2f3e;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  --sel-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239aa0b4' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  --gap: 12px; --req-border: #6e3a44;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans);
       -webkit-font-smoothing: antialiased; line-height: 1.45; }

/* =====================================================================
   Page primitives (global base; per-page scoped .razor.css overrides)
   -----------------------------------------------------------------
   30 pages under Pages/*.razor ship without a scoped .razor.css, so
   Blazor's [b-xxx] scoping never attaches to their markup and these
   design-system classes were previously undefined at runtime. This
   section supplies a GLOBAL fallback for the common vocabulary shared
   across scoped pages, sourced from the most complete/most-recent
   scoped siblings (ReassignSubjectMaster / AssignReval1 /
   EnableRecheckCount / AssignExam / SubjectWise / Evaluation hub).
   Any page WITH a scoped .razor.css keeps rendering from its own
   [b-xxx]-qualified rules, which win on specificity — this section
   cannot regress an already-styled page.
   ===================================================================== */

/* -- page header (cand-head) -- */
.cand-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.cand-head h1 { margin: 0 0 4px; font-size: 22px; font-weight: 700; color: var(--ink); }
.cand-head .sub { margin: 0; color: var(--muted); font-size: 13.5px; }
.cand-head .back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12.5px; font-weight: 600; text-decoration: none; }
.cand-head .back:hover { color: var(--ink); }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12.5px; font-weight: 600; text-decoration: none; }
.back:hover { color: var(--ink); }

/* -- card container -- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
        box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: var(--gap); }
.card h3, .assign-panel h3 { font-size: 15px; font-weight: 700; margin-bottom: 10px; }

/* -- toolbar (filters row) -- */
.toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.toolbar label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.toolbar select, .toolbar input[type="date"], .toolbar input[type="number"], .toolbar input[type="text"] {
    border: 1px solid var(--border); background: var(--surface-2); color: var(--ink);
    border-radius: 9px; padding: 7px 10px; font-size: 13px; font-family: inherit; }
.toolbar select:focus, .toolbar input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.toolbar .count { margin-left: auto; color: var(--faint); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.count { color: var(--faint); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* -- search input (standalone or inside a .search-box) -- */
.search-box { position: relative; display: flex; align-items: center; }
.search-box .search-ico { position: absolute; left: 11px; color: var(--faint); display: inline-flex;
                          align-items: center; pointer-events: none; }
.search-ico { color: var(--faint); display: inline-flex; align-items: center; }
.search { border: 1px solid var(--border); background: var(--surface-2); color: var(--ink);
          border-radius: 10px; padding: 9px 12px 9px 34px; font-size: 13.5px; }
.search:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.search-btn { border: 1px solid var(--border); background: var(--surface-2); color: var(--ink); cursor: pointer;
              border-radius: 10px; padding: 7px 12px; font-size: 12.5px; font-weight: 600; }
.search-btn:hover { background: var(--track); }

/* -- buttons -- */
.btn { border: 1px solid var(--border); background: var(--surface-2); color: var(--ink); cursor: pointer;
       border-radius: 10px; padding: 7px 12px; font-size: 12.5px; font-weight: 600; transition: background .12s, border-color .12s;
       display: inline-flex; align-items: center; gap: 5px; }
.btn:hover { background: var(--track); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); background: var(--accent); }
.btn.ghost { background: transparent; }
.btn.danger { color: #c02b3c; border-color: transparent; background: transparent; }
.btn.danger:hover { background: rgba(192,43,60,.08); }
.btn:disabled { opacity: .55; cursor: default; }

/* -- dropdowns: one baseline so every <select> matches the design system --
   The non-!important props are defaults for un-styled selects; per-page scoped
   rules still override border/background-color/radius. The chevron + appearance
   reset are forced because much legacy per-page CSS sets a `background:` shorthand
   that would otherwise wipe the arrow, leaving a bare native dropdown. Background
   comes from the global control-surface rule below. */
select {
  border: 1px solid var(--border); background-color: var(--surface); color: var(--ink);
  border-radius: 9px; font-size: 13.5px; padding: 8px 12px;
  /* never let a long option (e.g. a full course name) push the control past its column */
  box-sizing: border-box; max-width: 100%;
  -webkit-appearance: none !important; appearance: none !important;
  background-image: var(--sel-chevron) !important; background-repeat: no-repeat !important;
  background-position: right 11px center !important; background-size: 15px !important;
  padding-right: 34px !important; cursor: pointer;
}
select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
select:disabled { opacity: .6; cursor: default; }

/* -- data grid -- */
table.grid, .grid { width: 100%; border-collapse: collapse; }
.grid thead th, .grid th { text-align: left; color: var(--faint); font-size: 11px; font-weight: 700; letter-spacing: .05em;
                 text-transform: uppercase; padding: 6px 12px 10px; border-bottom: 1px solid var(--border); }
.grid tbody td, .grid td { padding: 11px 12px; font-size: 13px; color: var(--ink); border-bottom: 1px solid var(--border); vertical-align: middle; }
.grid tbody tr:last-child td { border-bottom: none; }
.grid tbody tr:hover td { background: var(--surface-2); }
.grid .nm, .nm { font-weight: 600; }
.ta-c { text-align: center; }
.table-scroll { overflow-x: auto; }

/* -- grid definition: header band + zebra rows --
   39 pages re-declare `.grid` in their own scoped css, so these must land there too.
   Those scoped rules set padding/colour/borders but never a `background`, so a plain
   global background rule wins by cascade. The one exception is :hover, which scoped
   css DOES set — hence the single targeted !important, so the hover still reads on
   top of a zebra row. Both themes come free via the tokens. */
.grid thead th, .grid th { background: var(--track); }
.grid tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--track) 45%, var(--surface)); }
.grid tbody tr:hover td { background: var(--track) !important; }

/* A wide grid must scroll inside its own card — the page body must never scroll
   sideways. Scoped to cards that actually hold a grid, so cards with popups are
   left alone. Saves wrapping ~40 grids in .table-scroll by hand. */
.card:has(table.grid) { overflow-x: auto; }

/* -- icon row-actions (replaces repeated "Edit"/"Deactivate" text links) --
   Icon-only, but each keeps a visually-hidden label so screen readers (and the
   DOM/tests) still see the action name. */
.row-actions { display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
            padding: 0; border: 1px solid transparent; border-radius: 8px; background: transparent;
            color: var(--muted); cursor: pointer; text-decoration: none;
            transition: background .12s, color .12s, border-color .12s; }
.icon-btn:hover { background: var(--surface); border-color: var(--border); color: var(--accent); }
.icon-btn.danger { color: #c02b3c; border-color: rgba(192,43,60,.25); }
.icon-btn.good { color: var(--good); border-color: color-mix(in srgb, var(--good) 30%, transparent); }
.icon-btn.danger:hover { color: #c02b3c; border-color: rgba(192,43,60,.25); background: rgba(192,43,60,.08); }
.icon-btn.good:hover { color: var(--good); border-color: color-mix(in srgb, var(--good) 30%, transparent);
                       background: var(--tile-green-bg); }
.icon-btn:disabled { opacity: .45; cursor: default; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
           clip-path: inset(50%); white-space: nowrap; border: 0; }
.row-check, .row-pick { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

/* -- pager -- */
.pager { display: flex; align-items: center; gap: 12px; padding: 14px 2px 2px; }
.pager .count, .pager .pageinfo { color: var(--muted); font-size: 13px; }

/* -- misc text/layout helpers -- */
.pad { padding: 22px 6px; }
.sub { color: var(--muted); font-size: 13px; }
.note { color: var(--muted); font-size: 13px; }

/* -- banner -- */
.banner { border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-bottom: 16px; font-weight: 500; }
.banner.ok { background: var(--tile-green-bg); color: var(--good); border: 1px solid transparent; }
.banner.err { background: rgba(192,43,60,.08); color: #c02b3c; border: 1px solid rgba(192,43,60,.2); }
.banner.info { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

/* -- assign panel (schedule/reassign forms) -- */
.assign-panel { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; }
.assign-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 4px 10px;
         font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.group-head { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
              color: var(--faint); margin-bottom: 10px; }

/* -- status card (KPI strip) -- */
.status-card { display: flex; gap: 32px; }
.status-card .stat, .stat { display: flex; flex-direction: column; }
.stat .lbl { color: var(--muted); font-size: 12px; }
.stat .val { font-size: 22px; font-weight: 700; }

/* -- hub tile links (menu hub pages) -- */
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; align-items: start; }
.link-card { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px;
             border: 1px solid transparent; text-decoration: none; color: var(--ink);
             transition: background .14s, border-color .14s; }
.link-card:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.link-card.soon { cursor: default; opacity: .55; }
.link-card.soon:hover { background: none; border-color: transparent; }
.link-card.soon .ic { filter: grayscale(35%); }
.ic { width: 44px; height: 44px; border-radius: 12px; flex: none; display: grid; place-items: center;
      color: #fff; box-shadow: 0 4px 10px rgba(0,0,0,.14); }
.ic.info  { background: linear-gradient(135deg, #22d3ee, #0891b2); }
.ic.green { background: linear-gradient(135deg, #34d399, #059669); }
.ic.blue  { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.ic.red   { background: linear-gradient(135deg, #f87171, #dc2626); }
.txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.txt b { font-size: 14px; font-weight: 620; }
.txt small { color: var(--faint); font-size: 12px; }
.arrow { color: var(--faint); display: inline-flex; }
.link-card:hover .arrow { color: var(--accent); }
.pill { flex: none; font-size: 11px; font-weight: 700; color: var(--muted); background: var(--surface-2);
        border: 1px solid var(--border); border-radius: 999px; padding: 3px 9px; }

/* =====================================================================
   QA polish 2026-08-07 (spec §4.6) — global, cannot regress scoped pages
   ===================================================================== */

/* -- required-field marker: used 194x, previously styled in only 35 scoped files -- */
.req { color: #dc2626; font-weight: 700; margin-left: 2px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .req { color: #f87171; } }
:root[data-theme="dark"] .req { color: #f87171; }

/* -- every value-entry control sits on a surface background (QA point 6) -- */
input, select, textarea { background: var(--surface); color: var(--ink); }

/* -- required inputs: ePravesh dashed treatment. Inert until markup carries `required`;
      applied deliberately to the Task-11 modal forms, NOT swept across all pages. -- */
input:required, select:required, textarea:required { border: 1px dashed var(--req-border); }
input:required:focus, select:required:focus, textarea:required:focus { border-style: solid; }

/* Answer-sheet magnifier lens (osm-booklet-viewer.js enableMagnifier). It is appended to <body> so it can
   follow the cursor over a scrolling page without being clipped by any container, which puts it outside every
   component's scoped stylesheet — hence a global rule. Port of legacy BookletVerification.aspx's #magnifier. */
.bk-magnifier {
    position: fixed;
    z-index: 60;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    overflow: hidden;
    pointer-events: none;
    background: #fff;
    border: 2px solid var(--border, #444);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
}
.bk-magnifier canvas { display: block; }
