/* Noto Sans Thai is a variable font split into three subsets; one file per
   subset covers every weight, so the browser only fetches what the page uses. */
@font-face {
  font-family: 'Noto Sans Thai';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/noto-sans-thai-thai.woff2') format('woff2');
  unicode-range: U+2D7, U+303, U+331, U+E01-E5B, U+200C-200D, U+25CC;
}

@font-face {
  font-family: 'Noto Sans Thai';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/noto-sans-thai-latin-ext.woff2') format('woff2');
  unicode-range: U+100-2BA, U+2BD-2C5, U+2C7-2CC, U+2CE-2D7, U+2DD-2FF, U+304, U+308,
    U+329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0,
    U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Noto Sans Thai';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/noto-sans-thai-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+131, U+152-153, U+2BB-2BC, U+2C6, U+2DA, U+2DC, U+304,
    U+308, U+329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF,
    U+FFFD;
}

/* ============================================================
   learner: design tokens
   แสด (KMUTT orange) split by job so the accent passes WCAG AA:
   --shade      surfaces / buttons / rails  (never small text on white)
   --shade-deep text + links on white       (5.2:1, passes AA)
   ============================================================ */
:root {
  --shade: #fa4616;
  --shade-deep: #c13a12;
  --shade-dim: #ffe4d8;
  --shade-ghost: #fff3ed;

  --canvas: #f1ece9;
  --ground: #fffcfa;
  --surface: #ffffff;
  --ink: #2a211d;
  --ink-soft: #7a6a63;
  --ink-faint: #a89890;
  --rule: #eddfd8;
  --rule-strong: #d9c6bc;

  --ok: #1f7a4d;
  --warn: #9a6212;

  --font-ui: 'Noto Sans Thai', 'Leelawadee UI', 'Sarabun',
    'Segoe UI', system-ui, -apple-system, sans-serif;
  /* Same face as the UI stack: Noto's digits are already tabular-capable,
     so columns stay aligned without switching typeface mid-table. */
  --font-num: 'Noto Sans Thai', 'Segoe UI', system-ui,
    sans-serif;

  --r: 10px;
  --shell: 1024px;
  --topbar-h: 60px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --shade: #ff7448;
    --shade-deep: #ff9166;
    --shade-dim: #4a2418;
    --shade-ghost: #241a16;
    --canvas: #100c0b;
    --ground: #17110f;
    --surface: #1f1815;
    --ink: #f5ede8;
    --ink-soft: #b3a29a;
    --ink-faint: #7d6d66;
    --rule: #362a25;
    --rule-strong: #4b3b34;
    --ok: #5fcb93;
    --warn: #e0a44a;
  }
}

:root[data-theme='dark'] {
  --shade: #ff7448;
  --shade-deep: #ff9166;
  --shade-dim: #4a2418;
  --shade-ghost: #241a16;
  --canvas: #100c0b;
  --ground: #17110f;
  --surface: #1f1815;
  --ink: #f5ede8;
  --ink-soft: #b3a29a;
  --ink-faint: #7d6d66;
  --rule: #362a25;
  --rule-strong: #4b3b34;
  --ok: #5fcb93;
  --warn: #e0a44a;
}

:root[data-theme='light'] {
  --shade: #fa4616;
  --shade-deep: #c13a12;
  --shade-dim: #ffe4d8;
  --shade-ghost: #fff3ed;
  --canvas: #f1ece9;
  --ground: #fffcfa;
  --surface: #ffffff;
  --ink: #2a211d;
  --ink-soft: #7a6a63;
  --ink-faint: #a89890;
  --rule: #eddfd8;
  --rule-strong: #d9c6bc;
  --ok: #1f7a4d;
  --warn: #9a6212;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: var(--shade-deep);
  text-underline-offset: 2px;
}

:focus-visible {
  outline: 2px solid var(--shade);
  outline-offset: 2px;
}

.num {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}

/* ---------- app shell ---------- */
.app {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  clip-path: inset(0);
  isolation: isolate;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  background: var(--shade);
  color: #fff;
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: var(--topbar-h);
}

:root[data-theme='dark'] .topbar {
  color: #1a0f0a;
}

@media (prefers-color-scheme: dark) {
  .topbar {
    color: #1a0f0a;
  }
}

:root[data-theme='light'] .topbar {
  color: #fff;
}

.mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  display: grid;
  place-items: center;
  flex: none;
}

:root[data-theme='dark'] .mark {
  background: rgba(26, 15, 10, 0.85);
}

.brand {
  min-width: 0;
}

.brand-t1 {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-t2 {
  font-size: 12.5px;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tb-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.tb-btn {
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.16);
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 7px;
  padding: 6px 12px;
  white-space: nowrap;
  flex: none;
  text-decoration: none;
}

.tb-btn:hover {
  background: rgba(255, 255, 255, 0.26);
}

.lang-pair {
  display: flex;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 7px;
  overflow: hidden;
  flex: none;
}

.lang-pair a {
  font: inherit;
  font-size: 13px;
  color: inherit;
  padding: 6px 11px;
  white-space: nowrap;
  text-decoration: none;
}

.lang-pair a[aria-current='true'] {
  background: rgba(255, 255, 255, 0.92);
  color: var(--shade-deep);
  font-weight: 700;
}

:root[data-theme='dark'] .lang-pair a[aria-current='true'] {
  background: rgba(26, 15, 10, 0.85);
  color: #ffb694;
}

/* ---------- drawer ---------- */
.burger {
  display: none;
  flex: none;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.16);
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 7px;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
}

.burger:hover {
  background: rgba(255, 255, 255, 0.26);
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(42, 33, 29, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.scrim[data-open='true'] {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 31;
  width: 268px;
  max-width: 82%;
  background: var(--surface);
  border-left: 1px solid var(--rule-strong);
  box-shadow: -14px 0 34px -12px rgba(42, 33, 29, 0.34);
  transform: translateX(100%);
  transition: transform 0.26s cubic-bezier(0.32, 0.72, 0.35, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.drawer[data-open='true'] {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--rule);
  background: var(--shade-ghost);
}

.drawer-title {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 700;
}

.drawer-close {
  font: inherit;
  cursor: pointer;
  background: none;
  color: var(--ink-soft);
  border: 1px solid var(--rule-strong);
  border-radius: 7px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  flex: none;
}

.drawer-body {
  padding: 6px 16px 16px;
}

.drawer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
}

.drawer-row + .drawer-row {
  border-top: 1px solid var(--rule);
}

.drawer-k {
  font-size: 13.5px;
  color: var(--ink-soft);
}

.drawer-btn {
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  text-align: left;
  background: none;
  border: 0;
  color: var(--ink);
  padding: 0;
  font-weight: 600;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.drawer-btn:hover {
  color: var(--shade-deep);
}

.drawer-btn.danger {
  color: var(--shade-deep);
}

.drawer-lang {
  display: flex;
  border: 1px solid var(--rule-strong);
  border-radius: 7px;
  overflow: hidden;
}

.drawer-lang a {
  font: inherit;
  font-size: 13px;
  background: var(--surface);
  color: var(--ink);
  padding: 6px 14px;
  text-decoration: none;
}

.drawer-lang a[aria-current='true'] {
  background: var(--shade);
  color: #fff;
  font-weight: 700;
}

:root[data-theme='dark'] .drawer-lang a[aria-current='true'] {
  color: #1a0f0a;
}

/* ---------- home / login ----------
   Layout mirrors parents.kmutt.ac.th so the two registrar systems feel
   like siblings: a grey canvas, one white card centred in the viewport,
   illustration on the right, action on the left, rule-topped footer.
   Its palette is not borrowed, since Bootstrap's #ffa500 fails AA on white.
   ------------------------------------ */
.home {
  flex: 1;
  background: var(--canvas);
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
}

.home-shell {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.home-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  box-shadow: 0 1px 3px rgba(42, 33, 29, 0.06);
  padding: 56px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 48px;
}

/* The mark sits second in the DOM so a screen reader hears the heading
   and the sign-in button before the decoration. */
.home-art {
  grid-column: 2;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Sized after parents' hero (max 380px, 120px once stacked). The art is
   decorative, so it carries an empty alt and is hidden from print. */
.home-art-img {
  width: 100%;
  max-width: 300px;
  height: auto;
}

.home-body {
  grid-column: 1;
  grid-row: 1;
  max-width: 420px;
}

/* Same placement and size as parents.kmutt.ac.th, so the university mark
   sits above the heading on both registrar systems */
.home-logo {
  display: block;
  height: 72px;
  width: auto;
  margin-bottom: 40px;
}

.home-body h1 {
  font-size: 25px;
  line-height: 1.3;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.home-lede {
  font-size: 15px;
  color: var(--ink-soft);
  margin: 0 0 24px;
}

.home-alert {
  border: 1px solid var(--shade);
  border-left-width: 4px;
  border-radius: 8px;
  background: var(--shade-ghost);
  color: var(--shade-deep);
  font-size: 13.5px;
  font-weight: 600;
  padding: 11px 14px;
  margin: 0 0 18px;
}

.btn-primary {
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  background: var(--shade);
  color: #fff;
  border: 0;
  border-radius: 9px;
  padding: 14px 28px;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
}

:root[data-theme='dark'] .btn-primary {
  color: #1a0f0a;
}

@media (prefers-color-scheme: dark) {
  .btn-primary {
    color: #1a0f0a;
  }
}

:root[data-theme='light'] .btn-primary {
  color: #fff;
}

.btn-primary:hover {
  background: var(--shade-deep);
}

:root[data-theme='dark'] .btn-primary:hover {
  background: #ff9166;
}

/* ThaID's own navy, so learners recognise the government app at a glance */
.btn-thaid,
:root[data-theme='dark'] .btn-thaid,
:root[data-theme='light'] .btn-thaid {
  background: #1b3a8c;
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  .btn-thaid {
    background: #2f55b8;
    color: #fff;
  }
}

:root[data-theme='dark'] .btn-thaid {
  background: #2f55b8;
}

.btn-thaid:hover,
:root[data-theme='light'] .btn-thaid:hover {
  background: #132a66;
}

:root[data-theme='dark'] .btn-thaid:hover {
  background: #3d66d1;
}

@media (prefers-color-scheme: dark) {
  .btn-thaid:hover {
    background: #3d66d1;
  }
}

.home-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.home-or::before,
.home-or::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--rule);
}

.home-help {
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.6;
}

.home-foot {
  max-width: var(--shell);
  width: 100%;
  margin: 0 auto;
  padding: 18px 20px 4px;
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
}

@media (max-width: 900px) {
  .home-card {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 28px;
    padding: 36px 28px;
  }

  /* Stack with the mark on top, the way parents does below 768px */
  .home-art,
  .home-body {
    grid-column: 1;
    grid-row: auto;
  }

  .home-art {
    order: -1;
  }

  .home-art-img {
    max-width: 150px;
  }

  .home-body {
    max-width: 460px;
  }

  .home-logo {
    margin: 0 auto 32px;
  }
}

@media (max-width: 560px) {
  .home {
    padding: 16px 12px;
  }

  .home-card {
    padding: 26px 20px;
  }

  .home-body h1 {
    font-size: 22px;
  }

  .home-logo {
    height: 56px;
    margin-bottom: 24px;
  }

  .home-art-img {
    max-width: 120px;
  }
}

/* ---------- picker ---------- */
.page {
  padding: 26px 28px 40px;
  flex: 1;
}

.page-head {
  margin-bottom: 20px;
}

.page-head h1 {
  font-size: 22px;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}

.page-head p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14.5px;
}

.prog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
  gap: 16px;
}

.prog {
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-top: 4px solid var(--shade);
  border-radius: var(--r);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
}

.prog:hover {
  border-color: var(--shade);
  background: var(--shade-ghost);
}

.prog-level {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--shade-deep);
}

.prog h2 {
  font-size: 16px;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.4;
}

.prog-org {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
}

.prog-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.prog-code {
  font-size: 13.5px;
  font-weight: 700;
}

.prog-years {
  font-size: 12.5px;
  color: var(--ink-soft);
}

.pill {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
}

.pill-grad {
  background: var(--shade-dim);
  color: var(--shade-deep);
}

.pill-cur {
  background: color-mix(in srgb, var(--ok) 14%, transparent);
  color: var(--ok);
}

.pill-plain {
  background: var(--rule);
  color: var(--ink-soft);
}

/* ---------- result ---------- */
.res-grid {
  display: grid;
  grid-template-columns: 264px 1fr;
  align-items: start;
  flex: 1;
}

/* Pinned under the top bar with its own scroll, so the learner and the
   semester links stay in view while the grades scroll past */
.side {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  border-right: 1px solid var(--rule);
  padding: 24px 20px;
  background: var(--surface);
}

.side-sec + .side-sec {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--rule);
}

.side-k {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 10px;
}

.who-name {
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.who-org {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 9px;
  line-height: 1.5;
}

.kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13.5px;
  padding: 5px 0;
}

.kv .k {
  color: var(--ink-soft);
}

.kv .v {
  font-weight: 700;
}

.side-kvs {
  margin-top: 12px;
}

.jump {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.jump a {
  font-size: 13.5px;
  padding: 6px 9px;
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.jump a:hover {
  background: var(--shade-ghost);
  color: var(--shade-deep);
}

.main {
  padding: 22px 28px 40px;
  min-width: 0;
}

/* Narrow-screen stand-in for the sidebar: one compact card instead of a
   stacked column that pushed the grades below the fold */
.idcard {
  display: none;
  align-items: flex-start;
  gap: 20px;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r);
  padding: 16px 18px;
  margin-bottom: 16px;
}

.idcard-who {
  min-width: 0;
}

.idcard-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.35;
}

.idcard-org {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 4px;
  line-height: 1.5;
}

.idcard-fact {
  margin-left: auto;
  flex: none;
  text-align: right;
}

.idcard-fact .k {
  display: block;
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.idcard-fact .v {
  font-size: 17px;
  font-weight: 700;
}

/* Out of the way until a course is ticked, then floats over the bottom of
   the page so the count and the print button stay in reach while scrolling */
.seltools {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 20;
  width: calc(100% - 32px);
  max-width: 760px;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r);
  box-shadow: 0 10px 30px -8px rgba(42, 33, 29, 0.35);
  padding: 11px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  transform: translate(-50%, calc(100% + 30px));
  visibility: hidden;
  transition: transform 0.22s ease, visibility 0s linear 0.22s;
}

.seltools[data-open='true'] {
  transform: translate(-50%, 0);
  visibility: visible;
  transition: transform 0.22s ease;
}

/* Room under the last semester so the floating box never covers it */
.main[data-picking='true'] {
  padding-bottom: 120px;
}

.selcount {
  font-size: 14px;
}

.linkbtn {
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  background: none;
  border: 0;
  color: var(--shade-deep);
  padding: 4px 2px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-print {
  margin-left: auto;
  font: inherit;
  font-weight: 700;
  font-size: 14.5px;
  cursor: pointer;
  background: var(--shade);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 9px 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

:root[data-theme='dark'] .btn-print {
  color: #1a0f0a;
}

@media (prefers-color-scheme: dark) {
  .btn-print {
    color: #1a0f0a;
  }
}

:root[data-theme='light'] .btn-print {
  color: #fff;
}

.btn-print:hover {
  background: var(--shade-deep);
}

.btn-print[disabled] {
  background: var(--rule);
  color: var(--ink-faint);
  cursor: not-allowed;
}

.sem {
  margin-bottom: 28px;
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}

.sem-bar {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  padding: 0 0 9px;
  border-bottom: 2px solid var(--shade);
}

.sem-bar h2 {
  font-size: 16.5px;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.tablewrap {
  overflow-x: auto;
}

table.grades {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}

table.grades th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 700;
  padding: 10px;
  white-space: nowrap;
  border-bottom: 1px solid var(--rule);
}

table.grades td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

table.grades tbody tr:hover {
  background: var(--shade-ghost);
}

table.grades tr[data-picked='true'] {
  background: var(--shade-ghost);
}

.sem-sum {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px 20px;
  padding: 9px 10px 0;
  font-size: 13.5px;
  color: var(--ink-soft);
}

.sem-sum .v {
  margin-left: 2px;
  font-weight: 700;
  color: var(--ink);
}

.c-check {
  width: 40px;
}

.c-code {
  white-space: nowrap;
  font-weight: 700;
  font-size: 14px;
  width: 96px;
}

.c-code-inline {
  display: none;
}

.c-cr,
.c-gr {
  text-align: right;
  white-space: nowrap;
}

.c-cr {
  width: 82px;
}

.c-gr {
  font-weight: 700;
  width: 64px;
}

.g-special {
  color: var(--warn);
}

input[type='checkbox'] {
  width: 17px;
  height: 17px;
  accent-color: var(--shade);
  cursor: pointer;
  margin: 2px 0 0;
}

/* ---------- empty / error ---------- */
.empty {
  text-align: center;
  padding: 64px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  justify-content: center;
}

.empty-mark {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  margin-bottom: 16px;
  background: var(--shade-dim);
  color: var(--shade-deep);
  display: grid;
  place-items: center;
}

.empty h1 {
  font-size: 18.5px;
  margin: 0 0 7px;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.empty p {
  margin: 0 0 5px;
  color: var(--ink-soft);
  font-size: 14.5px;
  max-width: 44ch;
}

.acts {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-ghost {
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  padding: 9px 18px;
  text-decoration: none;
}

.btn-ghost:hover {
  border-color: var(--shade);
  color: var(--shade-deep);
}

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .res-grid {
    grid-template-columns: 1fr;
  }

  .side {
    display: none;
  }

  .idcard {
    display: flex;
  }
}

@media (max-width: 720px) {
  .topbar {
    padding: 0 14px;
    gap: 11px;
  }

  :root {
    --topbar-h: 54px;
  }

  .tb-actions {
    display: none;
  }

  .burger {
    display: grid;
    margin-left: auto;
  }

  .page,
  .main {
    padding: 18px 16px 32px;
  }

  .idcard {
    flex-direction: column;
    gap: 12px;
  }

  .idcard-fact {
    margin-left: 0;
    text-align: left;
  }

  table.grades th,
  table.grades td {
    padding-left: 6px;
    padding-right: 6px;
  }

  .c-check {
    width: 30px;
  }

  /* The system name wraps instead of being cut off with an ellipsis */
  .brand-t1 {
    white-space: normal;
    font-size: 14px;
    line-height: 1.35;
  }

  .brand-t2 {
    font-size: 12px;
  }

  .btn-print {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 560px) {
  /* Course code moves above the name so the name gets the full width
     instead of wrapping one word per line */
  table.grades th.c-code-h,
  table.grades td.c-code {
    display: none;
  }

  .c-code-inline {
    display: block;
    font-weight: 700;
    font-size: 13px;
  }

  /* Number columns sized to their content so the course name keeps the width */
  .c-cr {
    width: 52px;
  }

  .c-gr {
    width: 40px;
  }

  table.grades th {
    letter-spacing: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  .drawer,
  .scrim {
    transition: none !important;
    animation: none !important;
  }
}

/* ============================================================
   PRINT: the real deliverable. Black and white only, because this is
   handed to employers, photocopied and faxed.
   ============================================================ */
@media print {
  @page {
    size: A4;
    margin: 14mm 12mm;
  }

  body {
    background: #fff;
    color: #1a1a1a;
    font-size: 11pt;
  }

  .topbar,
  .side,
  .seltools,
  .burger,
  .scrim,
  .drawer,
  .c-check,
  .home-art,
  .no-print {
    display: none !important;
  }

  .res-grid {
    grid-template-columns: 1fr;
  }

  .main {
    padding: 0;
  }

  /* Never split a semester's heading from its table */
  .sem {
    break-inside: avoid;
    margin-bottom: 14px;
  }

  .sem-bar {
    border-bottom-color: #1a1a1a;
  }

  table.grades th,
  table.grades td {
    border-bottom-color: #ddd;
  }

  table.grades tr[data-picked='true'],
  table.grades tbody tr:hover {
    background: none;
  }

  /* Rows the learner did not tick are dropped from the printout */
  table.grades tr[data-picked='false'] {
    display: none;
  }

  /* A semester with nothing ticked would otherwise print a bare heading
     and an empty table, so drop the whole block. */
  .sem[data-has-picked='false'] {
    display: none;
  }

  .sem-sum,
  .sem-sum .v {
    color: #1a1a1a;
  }

  .sem[data-all-picked='false'] .sem-sum {
    display: none;
  }

  a {
    color: #1a1a1a;
    text-decoration: none;
  }
}

.print-only {
  display: none;
}

@media print {
  .print-only {
    display: block;
  }

  .print-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    border-bottom: 2px solid #1a1a1a;
    padding-bottom: 10px;
    margin-bottom: 14px;
  }

  .print-head h1 {
    margin: 0 0 2px;
    font-size: 13pt;
  }

  .print-head .org2 {
    font-size: 9.5pt;
    color: #555;
  }

  .print-head .issued {
    font-size: 9pt;
    color: #555;
    text-align: right;
    white-space: nowrap;
  }

  .print-id {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    font-size: 10pt;
  }

  .print-id .k {
    color: #555;
    font-size: 8.5pt;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    display: block;
  }

  .print-id .v {
    font-weight: 700;
  }

  .print-foot {
    margin-top: 16px;
    padding-top: 8px;
    border-top: 1px solid #c9c9c9;
    font-size: 8.5pt;
    color: #555;
    display: flex;
    justify-content: space-between;
    gap: 16px;
  }
}
