/* aust.live — Tabler-style skin (25 Oct 2026).
   Loaded last in the <head> of every page frame (admin/_lib.php for the admin
   panel, teacher portal and student portal; result/ and registration/ pages;
   the home page; the teacher's offline page). It does not change any page's
   markup: it remaps the site's colour variables to a neutral, Tabler-like
   palette — light grey ground, white cards, hairline borders, muted uppercase
   table heads — while each theme keeps its own primary colour (AUST green by
   default), and restyles the shared pieces: top bars, cards, tables, buttons,
   fields, badges, alerts and the stat tiles.

   Page stylesheets added in the <body> (admin-home, student-access, teacher
   portal …) come after this file, so the rules aimed at them start with
   `html` to outrank them. */

/* ---- tokens ------------------------------------------------------------ */
:root:root {
  --tb-primary: var(--green, #1f6b52);
  --tb-primary-d: var(--green-d, #17543f);
  --tb-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ground: #f6f8fb;
  --paper: #ffffff;
  --paper-2: #fbfcfd;
  --field: #ffffff;
  --row: #f8fafc;
  --ink: #1d273b;
  --ink-2: #3a4859;
  --muted: #667382;
  --line: #e3e7ec;
  --line-2: #eef1f4;
  --tb-line-strong: #d3d9e0;
  --tb-head: #f8fafc;
  --sage: color-mix(in srgb, var(--tb-primary) 11%, #fff);
  --sage-2: color-mix(in srgb, var(--tb-primary) 5%, #fff);
  --glow: transparent;
  --nav-bg: #ffffff;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05);
  --tb-shadow-lg: 0 8px 24px rgba(15, 23, 42, .08), 0 2px 6px rgba(15, 23, 42, .05);
  --tb-ring: 0 0 0 3px color-mix(in srgb, var(--tb-primary) 22%, transparent);
  --tb-primary-lt: color-mix(in srgb, var(--tb-primary) 10%, #fff);
  --ok-soft: #e9f7ef; --ok-line: #bfe3cc;
  --bad: #c0392b; --bad-soft: #fdeeec; --bad-line: #f3c4be;
  --warn: #a15c07; --warn-soft: #fff6e5;
  --gold-soft: #fff7e6;
  --note-bg: #fff8e8; --note-line: #f1dfae; --note-ink: #6a4f10;
}
html[data-theme="midnight"]:root {
  --ground: #11161d;
  --paper: #182029;
  --paper-2: #1b242e;
  --field: #141b23;
  --row: #1c2630;
  --ink: #e5ebf1;
  --ink-2: #c3ced9;
  --muted: #8d9aa8;
  --line: #2a3541;
  --line-2: #222c37;
  --tb-line-strong: #36424f;
  --tb-head: #1c2530;
  --sage: color-mix(in srgb, var(--tb-primary) 20%, #182029);
  --sage-2: color-mix(in srgb, var(--tb-primary) 10%, #182029);
  --nav-bg: #182029;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --tb-shadow-lg: 0 10px 30px rgba(0, 0, 0, .45);
  --tb-primary-lt: color-mix(in srgb, var(--tb-primary) 16%, #182029);
  --ok-soft: #15301f; --ok-line: #24533a;
  --bad: #ff8a78; --bad-soft: #3a1d18; --bad-line: #5e2b23;
  --warn: #f2b84b; --warn-soft: #33270f;
  --gold-soft: #2c2412;
  --note-bg: #2b2414; --note-line: #4d3f1d; --note-ink: #f0d58c;
}

/* ---- base -------------------------------------------------------------- */
html body {
  font-family: var(--tb-font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--ground) !important;
  -webkit-font-smoothing: antialiased;
}
html a { color: var(--tb-primary); text-underline-offset: 2px; }
html a:hover { color: var(--tb-primary-d); }
html :is(h1, h2, h3) { color: var(--ink); letter-spacing: -.01em; }
html h1 { font-size: 20px; font-weight: 650; line-height: 1.35; }
html h2 { font-size: 16px; font-weight: 600; }
html h3 { font-size: 14.5px; font-weight: 600; }
html .lead { color: var(--muted); }
html .hint, html .muted { color: var(--muted); }
html :is(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--tb-primary);
  outline-offset: 2px;
}

/* ---- the site bar (every page) ---------------------------------------- */
html .aust-site-nav {
  background: var(--nav-bg);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border-bottom: 0;
  box-shadow: inset 0 -1px 0 var(--line);
  font-family: var(--tb-font);
}
html .aust-site-nav .aust-nav-inner { max-width: 1240px; padding: 0 24px; min-height: 56px; }
html .aust-site-nav .aust-nav-home b { color: var(--ink); letter-spacing: .06em; }
html .aust-site-nav .aust-nav-home small { color: var(--muted); font-weight: 500; }
html .aust-site-nav .aust-nav-links { gap: 2px; align-self: stretch; }
html .aust-site-nav .aust-nav-links a {
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 0;
  color: var(--ink-2);
  font-weight: 500;
  box-shadow: inset 0 -2px 0 transparent;
}
html .aust-site-nav .aust-nav-links a:hover { background: transparent; color: var(--ink); box-shadow: inset 0 -2px 0 var(--line); }
html .aust-site-nav .aust-nav-links a[aria-current="page"] {
  background: transparent;
  color: var(--tb-primary);
  box-shadow: inset 0 -2px 0 var(--tb-primary);
}
html .aust-site-nav .aust-nav-history button {
  border-radius: 6px;
  border-color: var(--line);
  color: var(--ink-2);
  font-weight: 500;
  box-shadow: var(--shadow);
}
html .aust-site-nav .aust-nav-history button:hover:not(:disabled) { background: var(--row); }
@media (max-width: 760px) {
  html .aust-site-nav .aust-nav-inner { padding: 8px 14px 0; min-height: 0; }
  html .aust-site-nav .aust-nav-links a { padding: 10px 11px; }
}

/* ---- admin panel / teacher portal / student portal frame ---------------- */
html .top { background: var(--paper); border-bottom: 0; box-shadow: inset 0 -1px 0 var(--line); }
html .top::after { display: none; }
html .top-in { max-width: 1240px; padding: 6px 24px; }
html .brand img { height: 34px; }
html .nav { gap: 2px; font-size: 14px; }
html .nav .who { color: var(--muted); margin-right: 10px; }
html .nav .who b { color: var(--ink); font-weight: 600; }
html .nav a {
  padding: 8px 11px;
  border-radius: 6px;
  color: var(--ink-2);
  font-weight: 500;
}
html .nav a:hover { background: var(--row); color: var(--ink); }
html .nav a.on { background: var(--tb-primary-lt); color: var(--tb-primary); }
html .wrap { max-width: 1240px !important; padding: 24px 24px 48px; }
html main.wrap > h1:first-child, html main.wrap > p:first-child + h1 { margin-top: 0; }
html .foot { max-width: 1240px; color: var(--muted); font-size: 12.5px; }

/* Cards: white, 8px corners, a hairline and the faintest shadow. */
html .card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px !important;
  box-shadow: var(--shadow) !important;
  padding: 20px;
  margin-top: 16px;
}
html .card > h2:first-child, html .card > :is(h2, h3):first-child { margin-top: 0; }
html .card h2 { color: var(--ink); }
html details.card > summary { color: var(--ink); font-weight: 600; font-size: 15px; }

/* Tables: a quiet head band with small uppercase labels, hairline rows. */
html table { border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
html th {
  background: var(--tb-head);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
html tr:first-child > th:first-child { border-top-left-radius: 6px; }
html tr:first-child > th:last-child { border-top-right-radius: 6px; }
html td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); color: var(--ink); }
html tr:nth-child(even) > td { background: transparent; }
html tr:not(:first-child):hover > td, html tbody tr:hover > td { background: var(--row); }
html th:has(+ td) {
  background: var(--tb-head);
  color: var(--ink-2);
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  border-bottom: 1px solid var(--line-2);
}
html tr.short > td { background: var(--bad-soft); }
/* Every table sits on its own white panel, inside a card or on the page. */
html .scroll:has(> table) {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-top: 12px;
}
html .scroll > table { margin-top: 0; border: 0 !important; }
html :is(main, .wrap, .card) > table { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
html :is(.scroll, main, .wrap, .card) > table tr:last-child > td { border-bottom: 0; }

/* Buttons: 6px corners; primary in the theme colour, the rest white. */
html :is(button, .btn):not(.aust-password-toggle, .aust-theme-btn, .aust-theme-opt, .aust-nav-history button) {
  border-radius: 6px;
  font-weight: 600;
  font-size: 13.5px;
  padding: 8px 15px;
  line-height: 1.25;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 1px 2px rgba(15, 23, 42, .08);
}
html :is(button, .btn).sm, html .btn.sm { padding: 5px 11px; font-size: 12.5px; }
html :is(button, .btn).ghost {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--tb-line-strong);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
}
html :is(button, .btn).ghost:hover { background: var(--row); color: var(--ink); border-color: var(--tb-line-strong); }
html :is(button, .btn):disabled { box-shadow: none; }

/* Fields. */
html label { color: var(--ink-2); font-weight: 600; font-size: 13px; }
html :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=file]), select, textarea) {
  font-family: var(--tb-font);
  font-size: 14px;
  border: 1px solid var(--tb-line-strong);
  border-radius: 6px;
  background-color: var(--field);
  color: var(--ink);
  padding: 8px 11px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
html :is(input, select, textarea):focus {
  outline: 0;
  border-color: var(--tb-primary);
  box-shadow: var(--tb-ring);
}
html input::placeholder, html textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
html input[type=checkbox], html input[type=radio] { accent-color: var(--tb-primary); }

/* Alerts. */
html .msg { border-radius: 6px; padding: 11px 14px; font-size: 13.5px; }
html .msg.ok { background: var(--ok-soft); border-color: var(--ok-line); color: color-mix(in srgb, var(--tb-primary) 85%, var(--ink)); }
html .msg.err { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }

/* Badges. */
html :is(.tag, .pill) { border-radius: 4px; font-weight: 600; font-size: 11.5px; padding: 2px 8px; letter-spacing: .01em; }
html .tag { background: var(--tb-primary-lt); color: var(--tb-primary); }
html .tag.off { background: var(--bad-soft); color: var(--bad); }
html .code { border-radius: 4px; background: var(--row); color: var(--ink-2); border: 1px solid var(--line); }

/* Stat tiles: a card each — small uppercase label, large figure. */
html .stats { gap: 12px; margin-top: 16px; }
html .stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  background: var(--paper);
}
html .stat b { font-size: 24px; font-weight: 650; color: var(--ink); line-height: 1.2; }
html .stat span { font-size: 12px; color: var(--muted); font-weight: 500; }
html .stat.warn b { color: var(--bad); }
html a.stat:hover { border-color: color-mix(in srgb, var(--tb-primary) 45%, var(--line)); box-shadow: var(--tb-shadow-lg); }

/* Class choice cards, steps, the sticky action bar. */
html .pick { border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
html .pick:hover { background: var(--row); border-color: var(--tb-line-strong); }
html .pick:has(input:checked), html .pick.on { border-color: var(--tb-primary); background: var(--tb-primary-lt); box-shadow: var(--tb-ring); }
html .step .num { background: var(--tb-primary); }
html .bar { background: color-mix(in srgb, var(--paper) 96%, transparent); border-top-color: var(--line); border-radius: 0 0 8px 8px; }
html .offer { border-radius: 8px; border-color: var(--line); }
html .secret { border-radius: 6px; }

/* ---- admin home --------------------------------------------------------- */
html .admin-welcome {
  background: linear-gradient(120deg, var(--tb-primary-lt), var(--paper) 70%);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px 20px;
}
html .admin-welcome h1 { color: var(--ink); font-size: 20px; }
html .admin-welcome p { color: var(--muted); }
html .admin-eyebrow { color: var(--muted); font-weight: 600; letter-spacing: .08em; }
html .admin-workspace { border-color: var(--line); background: var(--paper); color: var(--ink-2); border-radius: 6px; }
html .admin-modules { gap: 14px; }
html .admin-module {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
  padding: 16px;
}
html .admin-module:hover { border-color: color-mix(in srgb, var(--tb-primary) 40%, var(--line)); box-shadow: var(--tb-shadow-lg); }
html .admin-module-icon { background: var(--tb-primary-lt); border: 0; border-radius: 6px; color: var(--tb-primary); }
html .admin-category { color: var(--muted); font-weight: 600; }
html .admin-module h2 { color: var(--ink); font-size: 15px; font-weight: 600; }
html .admin-module > p { color: var(--muted); }
html .admin-primary { border-radius: 6px; background: var(--tb-primary); font-weight: 600; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 1px 2px rgba(15, 23, 42, .08); }
html .admin-secondary { border-radius: 6px; border-color: var(--tb-line-strong); color: var(--ink); background: var(--paper); font-weight: 500; }
html .admin-secondary:hover { background: var(--row); color: var(--ink); }
html .admin-module[data-approval-poll] { background: linear-gradient(90deg, var(--gold-soft), var(--paper) 65%); border-color: color-mix(in srgb, var(--gold) 55%, var(--line)); }
html [data-approval-count] { color: var(--ink); }

/* ---- student accounts / student portal (student-access.css) ------------- */
html body:has([data-access-theme]) { background: var(--ground) !important; color: var(--ink); }
html body:has([data-access-theme]) :is(h1, h2) { color: var(--ink); letter-spacing: -.01em; }
html body:has([data-access-theme]) :is(.card, .admin-module) { border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); background: var(--paper); }
html body:has([data-access-theme]) .admin-welcome { background: linear-gradient(120deg, var(--tb-primary-lt), var(--paper) 70%); box-shadow: var(--shadow); }
html body:has([data-access-theme]) :is(.admin-welcome h1) { color: var(--ink); }
html body:has([data-access-theme]) :is(.admin-welcome p, .admin-eyebrow) { color: var(--muted); }
html body:has([data-access-theme]) .admin-module-icon { background: var(--tb-primary-lt); color: var(--tb-primary); border: 0; }
html body:has([data-access-theme]) .admin-module h2 { color: var(--ink); }
html body:has([data-access-theme]) :is(.admin-category, label) { color: var(--ink-2); }
html body:has([data-access-theme]) .admin-module > p { color: var(--muted); }
html body:has([data-access-theme]) :is(button, .btn, .admin-primary) { background: var(--tb-primary); border-color: var(--tb-primary); color: var(--on-primary, #fff); border-radius: 6px; }
html body:has([data-access-theme]) :is(button, .btn, .admin-primary):hover { background: var(--tb-primary-d); color: var(--on-primary, #fff); }
html body:has([data-access-theme]) :is(button, .btn).ghost { background: var(--paper); color: var(--ink); border-color: var(--tb-line-strong); }
html body:has([data-access-theme]) .admin-secondary { border-color: var(--tb-line-strong); color: var(--ink); background: var(--paper); }
html body:has([data-access-theme]) a:not(.btn):not(.admin-primary):not(.admin-secondary) { color: var(--tb-primary); }
html body:has([data-access-theme]) :is(input:not([type=checkbox]):not([type=hidden]), select) { border: 1px solid var(--tb-line-strong); border-radius: 6px; background: var(--field); color: var(--ink); }
html body:has([data-access-theme]) input[type=checkbox] { accent-color: var(--tb-primary); }
html body:has([data-access-theme]) fieldset { border: 1px solid var(--line); border-radius: 8px; background: var(--paper-2); }
html body:has([data-access-theme]) th { background: var(--tb-head); color: var(--muted); }
html body:has([data-access-theme]) td { border-color: var(--line-2); }
html body:has([data-access-theme]) [data-approval-poll] { border: 1px solid color-mix(in srgb, var(--gold) 55%, var(--line)); border-radius: 8px; background: linear-gradient(90deg, var(--gold-soft), var(--paper) 65%); }
html body:has([data-access-theme]) [data-approval-count] { color: var(--ink); }
html body:has([data-access-theme]) .error { color: var(--bad); background: var(--bad-soft); border-radius: 6px; }
html body:has([data-access-theme]) .ok { color: color-mix(in srgb, var(--tb-primary) 85%, var(--ink)); background: var(--ok-soft); border-radius: 6px; }

/* ---- teacher portal (teacher/portal.css) -------------------------------- */
html .wrap:has(.portal-hero), html body:has(.portal-hero) .wrap { max-width: 1240px !important; }
html .portal-hero {
  background: linear-gradient(120deg, var(--tb-primary-lt), var(--paper) 70%);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
html .portal-hero h1 { color: var(--ink); }
html .portal-hero p { color: var(--muted); }
html .portal-hero .eyebrow { color: var(--muted); }
html .portal-hero .btn { background: var(--tb-primary); color: var(--on-primary, #fff); }
html :is(.portal-course, .portal-stat) { border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); background: var(--paper); }
html .portal-course:hover { box-shadow: var(--tb-shadow-lg); }
html .portal-stat b, html .course-figs b { color: var(--ink); }
html .course-figs span { background: var(--row); border: 1px solid var(--line-2); border-radius: 6px; }
html .course-figs .bad { background: var(--bad-soft); border-color: var(--bad-line); }
html .lecture { border-color: var(--line); border-radius: 8px; box-shadow: var(--shadow); }
html .lecture.done { background: var(--paper); }
html table th { background: var(--tb-head); color: var(--muted); }
html table td { padding: 10px 12px !important; }
html .pill { background: var(--row); color: var(--ink-2); border: 1px solid var(--line); }
html .portal-search { border-radius: 6px !important; }
html .attendance-save, html .att-bar { border-radius: 8px; box-shadow: var(--tb-shadow-lg); border-color: var(--line); }

/* ---- public pages: results, registration & attendance ------------------- */
html .masthead {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px 22px;
}
html .masthead::after { display: none; }
html .masthead .inst { color: var(--muted); font-weight: 600; letter-spacing: .06em; font-size: 11.5px; }
html .masthead h1 { font-size: clamp(20px, 2.6vw, 24px); font-weight: 650; }
html .masthead p { color: var(--muted); }
html .field label { color: var(--ink-2); font-weight: 600; }
html .field input { border-radius: 6px; padding: 9px 12px; }
html .btn-primary {
  border-radius: 6px;
  background: var(--tb-primary);
  font-weight: 600;
  padding: 10px 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 1px 2px rgba(15, 23, 42, .1);
}
html .btn-primary:hover { background: var(--tb-primary-d); filter: none; }
html :is(.alert, .notice) { border-radius: 6px; }
html .facts span { border-radius: 6px; background: var(--row); border-color: var(--line-2); }
html .cgpa { background: var(--tb-primary-lt); border-color: color-mix(in srgb, var(--tb-primary) 25%, var(--line)); border-radius: 8px; }
html .cgpa b { color: var(--tb-primary); }
html .sem { border-radius: 8px; border-color: var(--line); box-shadow: var(--shadow); }
html .sem > .bar { background: var(--tb-head); border-bottom-color: var(--line); }
html .sem .gpa b { color: var(--tb-primary); }
html .sem .remark { border-radius: 4px; }
html thead th { background: var(--tb-head); color: var(--muted); font-weight: 600; }
html :is(table.courses, .retake-box table) th {
  background: var(--tb-head);
  color: var(--muted);
  font-weight: 600;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
}
html .retake-box th { background: var(--bad-soft); color: var(--bad); }
html table.courses tbody tr:nth-child(even) td { background: transparent; }
html .session-head { border-bottom: 1px solid var(--line); }
html :is(.overall, .retake-box) { border-radius: 8px; }
html tbody td { border-top-color: var(--line-2); }
html tbody tr:hover td { background: var(--row); }

/* ---- teacher's offline attendance page (teacher/offline.html) ----------- */
html body > header:first-child:not(.aust-site-nav) {
  background: var(--paper);
  color: var(--ink);
  box-shadow: inset 0 -1px 0 var(--line);
  padding: 16px 24px;
  font-weight: 600;
}
html body > header:first-child:not(.aust-site-nav) a { color: var(--tb-primary); font-weight: 500; }
html body:not(:has(.aust-site-nav)) :is(button, .button):not(.ghost) { background: var(--tb-primary); color: #fff; }
html body:not(:has(.aust-site-nav)) #notice { background: var(--tb-primary-lt); border-radius: 6px; }
html body:not(:has(.aust-site-nav)) main { max-width: 1240px; }

/* ---- the promotion-rules pop-up (instructions.js) ----------------------- */
/* Its table must wrap inside the dialog: none of the page-table rules apply. */
html #aust-rules-box table { border-collapse: collapse; border: 0; background: transparent; font-size: inherit; width: 100%; min-width: 0; }
html #aust-rules-box th { white-space: normal; text-transform: none; letter-spacing: 0; }
html #aust-rules-box tr:not(:first-child):hover > td { background: inherit; }

/* ---- the rest of the site's pieces ------------------------------------- */
html .mode { border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
html .mode:hover { background: var(--row); border-color: var(--tb-line-strong); }

@media (max-width: 640px) {
  html .wrap { padding: 16px 14px 36px; }
  html .card { padding: 15px 14px; }
  html .top-in { padding: 6px 14px; }
}
@media print {
  html body { background: #fff !important; }
  html th { background: none; color: #000; }
  html .card { box-shadow: none !important; }
}
