/* Shared IVEACER visual language, derived from the main portal. */
@import url('https://fonts.googleapis.com/css2?family=Prompt:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=Sarabun:wght@300;400;500;600;700&display=swap');

@font-face {
  font-family: 'IVEACER Thai Fallback';
  src: url('../data-portal/fonts/thai-regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'IVEACER Thai Fallback';
  src: url('../data-portal/fonts/thai-bold.ttf') format('truetype');
  font-weight: 600 900;
  font-display: swap;
}

:root {
  --iveacer-font-body: 'Prompt', 'Sarabun', 'IVEACER Thai Fallback', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --iveacer-font-heading: 'Prompt', 'Sarabun', 'IVEACER Thai Fallback', sans-serif;
  --iveacer-brand-green: #1e4d2b;
  --iveacer-brand-deep: #14381e;
  --iveacer-brand-medium: #2e7d32;
  --iveacer-brand-gold: #d4af37;
  --iveacer-gold-hover: #b8941f;
  --iveacer-gold-text: #7c5e08;
  --iveacer-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --iveacer-ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --iveacer-ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --iveacer-on-brand: #ffffff;
  --iveacer-on-brand-muted: #d4e5d8;
  --iveacer-on-gold: #1e293b;
  --iveacer-canvas-color: #F8FAFC;
  --iveacer-canvas: #F8FAFC;
  --iveacer-surface: #ffffff;
  --iveacer-surface-soft: #f1f8f4;
  --iveacer-surface-subtle: #e8f5e9;
  --iveacer-text-main: #1e293b;
  --iveacer-text-muted: #53665b;
  --iveacer-text-heading: 24px;
  --iveacer-text-body: 16px;
  --iveacer-text-small: 14px;
  --iveacer-heading: #14381e;
  --iveacer-link: #226438;
  --iveacer-link-rgb: 34,100,56;
  --iveacer-border: #dce6df;
  --iveacer-border-soft: rgba(46,125,50,.12);
  --iveacer-header: rgba(255,255,255,.96);
  --iveacer-hero: linear-gradient(135deg,#0d2814 0%,#1a4926 50%,#205c2f 100%);
  --iveacer-success-text: #166534;
  --iveacer-success-surface: #e8f5e9;
  --iveacer-warning-text: #825c0a;
  --iveacer-warning-surface: #fff6da;
  --iveacer-info-text: #0c4a6e;
  --iveacer-info-surface: #edf4fb;
  --iveacer-violet-text: #581c87;
  --iveacer-violet-surface: #f3eef7;
  --iveacer-neutral-text: #334155;
  --iveacer-neutral-surface: #f1f5f9;
  --iveacer-danger-text: #a13928;
  --iveacer-danger-surface: #fff1ec;
  --iveacer-focus: #b8941f;

  /* Campus Theme Tokens — Light Mode */
  /* Phetchaburi (นอกเวลาราชการ — Emerald #16a34a family) */
  --iveacer-campus-pb-accent: #16a34a;
  --iveacer-campus-pb-surface: #ecfdf5;
  --iveacer-campus-pb-text: #14532d;
  --iveacer-campus-pb-border: #86efac;
  /* Lopburi (นอกเวลาราชการ — Warm Gold/Amber #d97706 family) */
  --iveacer-campus-lb-accent: #d97706;
  --iveacer-campus-lb-surface: #fffbeb;
  --iveacer-campus-lb-text: #78350f;
  --iveacer-campus-lb-border: #fcd34d;
  /* Ratchaburi (ในเวลาราชการ สัตวรักษ์ — Clinical Royal Blue #0284c7 family) */
  --iveacer-campus-rb-accent: #0284c7;
  --iveacer-campus-rb-surface: #f0f9ff;
  --iveacer-campus-rb-text: #0c4a6e;
  --iveacer-campus-rb-border: #7dd3fc;

  --iveacer-shadow-sm: 0 2px 10px rgba(0,0,0,.04);
  --iveacer-shadow-md: 0 10px 30px rgba(20,56,30,.08);
  --iveacer-shadow-lg: 0 20px 50px rgba(20,56,30,.12);
  --iveacer-radius-sm: 4px;
  --iveacer-radius-card: 8px;
  --iveacer-radius-lg: 12px;
  --iveacer-radius-control: 6px;
  --iveacer-radius-pill: 9999px;
  color-scheme: light;
}

html[data-theme='dark'], html[data-bs-theme='dark'], html.dark {
  --iveacer-canvas-color: #0B110E;
  --iveacer-canvas: #0B110E;
  --iveacer-surface: #112217;
  --iveacer-surface-soft: #142a1d;
  --iveacer-surface-subtle: #193823;
  --iveacer-text-main: #f8fafc;
  --iveacer-text-muted: #adc1b2;
  --iveacer-heading: #d4e9da;
  --iveacer-link: #9ce5ad;
  --iveacer-link-rgb: 156,229,173;
  --iveacer-gold-text: #f2d77e;
  --iveacer-border: #2e4936;
  --iveacer-border-soft: rgba(255,255,255,.13);
  --iveacer-header: rgba(10,26,15,.96);
  --iveacer-hero: linear-gradient(135deg,#061509 0%,#102917 50%,#0b2011 100%);
  --iveacer-success-text: #a3e5b2;
  --iveacer-success-surface: #173b25;
  --iveacer-warning-text: #f1d374;
  --iveacer-warning-surface: #3a2c0b;
  --iveacer-info-text: #b9d5ef;
  --iveacer-info-surface: #193343;
  --iveacer-violet-text: #d3bee4;
  --iveacer-violet-surface: #302538;
  --iveacer-neutral-text: #cbd5e1;
  --iveacer-neutral-surface: #1e293b;
  --iveacer-danger-text: #ffb6a8;
  --iveacer-danger-surface: #40251e;
  --iveacer-focus: #f2d77e;

  /* Campus Theme Tokens — Dark Mode */
  --iveacer-campus-pb-accent: #4ade80;
  --iveacer-campus-pb-surface: #133220;
  --iveacer-campus-pb-text: #bbf7d0;
  --iveacer-campus-pb-border: #22c55e;

  --iveacer-campus-lb-accent: #fbbf24;
  --iveacer-campus-lb-surface: #36280a;
  --iveacer-campus-lb-text: #fde68a;
  --iveacer-campus-lb-border: #f59e0b;

  --iveacer-campus-rb-accent: #38bdf8;
  --iveacer-campus-rb-surface: #112a3d;
  --iveacer-campus-rb-text: #bae6fd;
  --iveacer-campus-rb-border: #0ea5e9;

  --iveacer-shadow-sm: 0 2px 10px rgba(0,0,0,.35);
  --iveacer-shadow-md: 0 10px 30px rgba(0,0,0,.5);
  --iveacer-shadow-lg: 0 20px 50px rgba(0,0,0,.65);
  color-scheme: dark;
}

/* Existing modules consume these aliases without acquiring another palette. */
:root, html[data-theme], html[data-bs-theme], html.dark {
  --ivea-green-dark: var(--iveacer-brand-deep);
  --ivea-green-primary: var(--iveacer-brand-green);
  --ivea-green-medium: var(--iveacer-brand-medium);
  --ivea-green-surface: var(--iveacer-surface-soft);
  --ivea-green-subtle: var(--iveacer-surface-subtle);
  --ivea-gold-primary: var(--iveacer-brand-gold);
  --ivea-gold-hover: var(--iveacer-gold-hover);
  --ivea-gold-light: var(--iveacer-warning-surface);
  --bg-main: var(--iveacer-canvas);
  --bg-card: var(--iveacer-surface);
  --bg-box: var(--iveacer-surface-soft);
  --text-main: var(--iveacer-text-main);
  --text-muted: var(--iveacer-text-muted);
  --heading: var(--iveacer-heading);
  --border-light: var(--iveacer-border-soft);
  --border-card: var(--iveacer-border);
  --shadow-sm: var(--iveacer-shadow-sm);
  --shadow-md: var(--iveacer-shadow-md);
  --shadow-lg: var(--iveacer-shadow-lg);
  --radius-sm: var(--iveacer-radius-sm);
  --radius-md: var(--iveacer-radius-card);
  --radius-lg: var(--iveacer-radius-lg);
  --radius-full: var(--iveacer-radius-pill);
  --adm-green-dark: var(--iveacer-brand-deep);
  --adm-green-primary: var(--iveacer-brand-green);
  --adm-green-medium: var(--iveacer-brand-medium);
  --adm-green-subtle: var(--iveacer-surface-subtle);
  --adm-green-border: var(--iveacer-border);
  --adm-gold-primary: var(--iveacer-brand-gold);
  --adm-gold-dark: var(--iveacer-gold-text);
  --adm-gold-light: var(--iveacer-warning-surface);
  --adm-bg: var(--iveacer-canvas-color);
  --adm-card-bg: var(--iveacer-surface);
  --adm-text: var(--iveacer-text-main);
  --adm-text-muted: var(--iveacer-text-muted);
  --adm-border: var(--iveacer-border);
  --adm-shadow: var(--iveacer-shadow-md);
  --adm-shadow-hover: var(--iveacer-shadow-lg);
  --iveacer-green: var(--iveacer-brand-green);
  --iveacer-green-light: var(--iveacer-brand-medium);
  --iveacer-green-dark: var(--iveacer-brand-deep);
  --iveacer-gold: var(--iveacer-brand-gold);
  --iveacer-gold-light: #f7e7a9;
  --iveacer-bg: var(--iveacer-canvas-color);
  --iveacer-card-bg: var(--iveacer-surface);
  --font-sarabun: var(--iveacer-font-body);
  --font-prompt: var(--iveacer-font-heading);
  --bg-color: var(--iveacer-canvas-color);
  --card-bg: var(--iveacer-surface);
  --card-border: var(--iveacer-border);
  --text-sub: var(--iveacer-text-muted);
  --header-bg: var(--iveacer-header);
  --header-border: var(--iveacer-border);
  --accent-gold: var(--iveacer-brand-gold);
  --accent-gold-glow: rgba(212,175,55,.3);
  --bs-primary: var(--iveacer-brand-green);
  --bs-primary-rgb: 30,77,43;
  --bs-success: var(--iveacer-brand-medium);
  --bs-success-rgb: 46,125,50;
  --bs-warning: var(--iveacer-brand-gold);
  --bs-warning-rgb: 212,175,55;
  --bs-body-bg: var(--iveacer-canvas-color);
  --bs-body-color: var(--iveacer-text-main);
  --bs-heading-color: var(--iveacer-heading);
  --bs-secondary-color: var(--iveacer-text-muted);
  --bs-tertiary-bg: var(--iveacer-surface-soft);
  --bs-secondary-bg: var(--iveacer-surface-soft);
  --bs-border-color: var(--iveacer-border);
  --bs-link-color: var(--iveacer-link);
  --bs-link-color-rgb: var(--iveacer-link-rgb);
  --bs-link-hover-color: var(--iveacer-heading);
}

/* ============================================================================
   Shared Design System Components
   Reusable across index.html, admission.html, aun-qa.html, academic-works.html
   ============================================================================ */
.iveacer-card {
  background: var(--iveacer-surface);
  color: var(--iveacer-text-main);
  border: 1px solid var(--iveacer-border);
  border-radius: var(--iveacer-radius-lg, 12px);
  box-shadow: var(--iveacer-shadow-sm);
  transition: transform 200ms var(--iveacer-ease-out), box-shadow 200ms var(--iveacer-ease-out), border-color 180ms ease-out;
}
@media (hover: hover) and (pointer: fine) {
  .iveacer-card:hover {
    transform: translate3d(0, -3px, 0);
    box-shadow: var(--iveacer-shadow-md);
  }
}
.iveacer-card--pb { border-color: var(--iveacer-campus-pb-border, var(--iveacer-campus-pb-accent)); }
.iveacer-card--lb { border-color: var(--iveacer-campus-lb-border, var(--iveacer-campus-lb-accent)); }
.iveacer-card--rb { border-color: var(--iveacer-campus-rb-border, var(--iveacer-campus-rb-accent)); }

.iveacer-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--iveacer-radius-pill);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.4;
  border: 1px solid var(--iveacer-border);
  background: var(--iveacer-surface-soft);
  color: var(--iveacer-text-main);
  white-space: nowrap;
}
.iveacer-badge--emerald {
  background: var(--iveacer-campus-pb-surface, var(--iveacer-success-surface));
  color: var(--iveacer-campus-pb-text, var(--iveacer-success-text));
  border-color: var(--iveacer-campus-pb-border, var(--iveacer-border));
}
.iveacer-badge--amber {
  background: var(--iveacer-campus-lb-surface, var(--iveacer-warning-surface));
  color: var(--iveacer-campus-lb-text, var(--iveacer-warning-text));
  border-color: var(--iveacer-campus-lb-border, var(--iveacer-border));
}
.iveacer-badge--blue {
  background: var(--iveacer-campus-rb-surface, var(--iveacer-info-surface));
  color: var(--iveacer-campus-rb-text, var(--iveacer-info-text));
  border-color: var(--iveacer-campus-rb-border, var(--iveacer-border));
}
.iveacer-badge--violet {
  background: var(--iveacer-violet-surface);
  color: var(--iveacer-violet-text);
  border-color: var(--iveacer-border);
}
.iveacer-badge--neutral {
  background: var(--iveacer-neutral-surface, var(--iveacer-surface-soft));
  color: var(--iveacer-neutral-text, var(--iveacer-text-muted));
  border-color: var(--iveacer-border);
}

.iveacer-filter-bar {
  background: var(--iveacer-surface);
  color: var(--iveacer-text-main);
  border: 1px solid var(--iveacer-border);
  border-radius: var(--iveacer-radius-lg, 12px);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--iveacer-shadow-sm);
}

.iveacer-pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 40px;
  padding: 0.45rem 0.95rem;
  border-radius: var(--iveacer-radius-pill);
  border: 1px solid var(--iveacer-border);
  background: var(--iveacer-surface);
  color: var(--iveacer-text-main);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 160ms ease-out, color 160ms ease-out, border-color 160ms ease-out, transform 150ms var(--iveacer-ease-out);
}
@media (pointer: coarse) {
  .iveacer-pill-btn {
    min-height: 44px;
  }
}
.iveacer-pill-btn:hover {
  background: var(--iveacer-surface-soft);
  border-color: var(--iveacer-link);
  color: var(--iveacer-link);
}
.iveacer-pill-btn:active:not(:disabled) {
  transform: scale(0.96);
}
.iveacer-pill-btn:is(.active, [aria-pressed='true']) {
  background: var(--iveacer-brand-green);
  color: var(--iveacer-on-brand);
  border-color: var(--iveacer-brand-green);
}

.iveacer-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.6rem 1.35rem;
  border-radius: var(--iveacer-radius-control, 6px);
  border: 1.5px solid var(--iveacer-brand-green);
  background: var(--iveacer-brand-green);
  color: var(--iveacer-on-brand);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--iveacer-shadow-sm);
  transition: background-color 180ms ease-out, border-color 180ms ease-out, transform 180ms var(--iveacer-ease-out), box-shadow 180ms var(--iveacer-ease-out);
}
.iveacer-btn-primary:hover {
  background: var(--iveacer-brand-deep);
  border-color: var(--iveacer-brand-deep);
  color: var(--iveacer-on-brand);
}
@media (hover: hover) and (pointer: fine) {
  .iveacer-btn-primary:hover {
    transform: translate3d(0, -2px, 0);
    box-shadow: var(--iveacer-shadow-md);
  }
}
.iveacer-btn-primary:active:not(:disabled) {
  transform: scale(0.96);
}

.iveacer-btn-gold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.6rem 1.35rem;
  border-radius: var(--iveacer-radius-control, 6px);
  border: 1.5px solid var(--iveacer-brand-gold);
  background: linear-gradient(135deg, #f7d969 0%, var(--iveacer-brand-gold) 55%, #b8860b 100%);
  color: #0f172a;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(212, 175, 55, 0.28);
  transition: transform 180ms var(--iveacer-ease-out), box-shadow 180ms var(--iveacer-ease-out), filter 180ms ease-out;
}
.iveacer-btn-gold:hover {
  filter: brightness(1.05);
  color: #0f172a;
}
@media (hover: hover) and (pointer: fine) {
  .iveacer-btn-gold:hover {
    transform: translate3d(0, -2px, 0);
    box-shadow: 0 10px 24px rgba(212, 175, 55, 0.38);
  }
}
.iveacer-btn-gold:active:not(:disabled) {
  transform: scale(0.96);
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Avoid font-size rules here: the shared accessibility controller scales text. */
html[data-iveacer-a11y] body {
  font-family: var(--iveacer-font-body);
  color: var(--iveacer-text-main);
  background: var(--iveacer-canvas);
}
body :is(h1,h2,h3,h4,h5,h6,.brand-title,.font-prompt,.font-space,.adm-brand-title,.edoc-brand-text,.card-title-text,.section-heading) {
  font-family: var(--iveacer-font-heading);
}
body :is(h1,h2,h3,h4,.brand-title,.adm-brand-title,.edoc-brand-text,.card-title-text,.section-heading) {
  text-wrap: balance;
}
body :is(.hero-description,.card-desc-text,.card-desc,.body-copy,.spec-degree-subtitle,.adm-hero-lead) {
  text-wrap: pretty;
}
body :is(input,select,textarea,button,.font-sarabun) { font-family: var(--iveacer-font-body); }
body :is(a,button,input,select,textarea):focus-visible { outline: 3px solid var(--iveacer-focus); outline-offset: 3px; }
body :is(.form-control,.form-select):focus { border-color: var(--iveacer-link); box-shadow: 0 0 0 .2rem var(--iveacer-border-soft); }
body :is(.form-control,.form-select,.list-group-item,.modal-content,.offcanvas,.card,.accordion-item) {
  --bs-card-bg: var(--iveacer-surface);
  --bs-card-color: var(--iveacer-text-main);
  --bs-card-border-color: var(--iveacer-border);
  --bs-list-group-bg: var(--iveacer-surface);
  --bs-list-group-color: var(--iveacer-text-main);
  --bs-list-group-border-color: var(--iveacer-border);
  --bs-modal-bg: var(--iveacer-surface);
  --bs-modal-color: var(--iveacer-text-main);
  --bs-modal-border-color: var(--iveacer-border);
  --bs-offcanvas-bg: var(--iveacer-surface);
  --bs-accordion-bg: var(--iveacer-surface);
  --bs-accordion-color: var(--iveacer-text-main);
  --bs-accordion-border-color: var(--iveacer-border);
}
body .btn-primary, body .btn-success {
  --bs-btn-bg: var(--iveacer-brand-green);
  --bs-btn-border-color: var(--iveacer-brand-green);
  --bs-btn-hover-bg: var(--iveacer-brand-deep);
  --bs-btn-hover-border-color: var(--iveacer-brand-deep);
  --bs-btn-active-bg: var(--iveacer-brand-deep);
  --bs-btn-active-border-color: var(--iveacer-brand-deep);
  --bs-btn-color: var(--iveacer-on-brand);
  --bs-btn-hover-color: var(--iveacer-on-brand);
  --bs-btn-active-color: var(--iveacer-on-brand);
}
body .btn-outline-success {
  --bs-btn-color: var(--iveacer-link);
  --bs-btn-border-color: var(--iveacer-link);
  --bs-btn-hover-bg: var(--iveacer-brand-green);
  --bs-btn-hover-border-color: var(--iveacer-brand-green);
  --bs-btn-hover-color: var(--iveacer-on-brand);
  --bs-btn-active-bg: var(--iveacer-brand-green);
}
body .btn-warning {
  --bs-btn-bg: var(--iveacer-brand-gold);
  --bs-btn-border-color: var(--iveacer-brand-gold);
  --bs-btn-color: var(--iveacer-on-gold);
  --bs-btn-hover-bg: var(--iveacer-gold-hover);
  --bs-btn-hover-color: var(--iveacer-on-gold);
}
body :is(.adm-navbar,.aunqa-subnav-bar,.top-bar) { background: var(--iveacer-header); border-color: var(--iveacer-border); }
body :is(.adm-brand-title,.brand-title) { color: var(--iveacer-heading); }
body :is(.hero-portal-section,.aunqa-hero,.programme-spec-hero,.edoc-navbar) { background: var(--iveacer-hero); border-color: var(--iveacer-brand-gold); }
body :is(.aunqa-hero-title,.programme-spec-hero h1,.hero-title-main,.edoc-brand-text) { color: var(--iveacer-on-brand); }
body :is(.aunqa-hero-subtitle,.aunqa-stat-label,.edoc-brand-sub) { color: var(--iveacer-on-brand-muted); }
body :is(.aunqa-stat-num,.aunqa-badge-pill,.hero-title-en) { color: #f7e7a9; }
body .adm-hero:not(.admissions-masthead) { background: var(--iveacer-canvas); }
body :is(.btn-curriculum-view,.plo-nav-tabs .nav-link.active,.study-plan-tab-btn.active,.qa-campus-pill-btn.active) { background: var(--iveacer-brand-green); border-color: var(--iveacer-brand-green); }
body :is(.curriculum-card,.faculty-card,.adm-college-card,.adm-stat-card,.edoc-stat-card,.edoc-container-card,.verify-card) { background: var(--iveacer-surface); border-color: var(--iveacer-border); border-radius: var(--iveacer-radius-card); box-shadow: var(--iveacer-shadow-sm); }
body :is(.table,.table-custom) { --bs-table-bg: var(--iveacer-surface); --bs-table-color: var(--iveacer-text-main); --bs-table-border-color: var(--iveacer-border); --bs-table-hover-bg: var(--iveacer-surface-soft); --bs-table-hover-color: var(--iveacer-text-main); }
body :is(.table-custom thead th,.ksecr-tag,.kpi-target-badge,.kasian-preset-btn) { background: var(--iveacer-surface-soft); color: var(--iveacer-text-main); border-color: var(--iveacer-border); }
body :is(.table-custom tbody tr:hover,.kasian-preset-btn:hover) { background: var(--iveacer-surface-subtle); color: var(--iveacer-text-main); }
body .kasian-preset-btn.active { background: var(--iveacer-brand-green); color: var(--iveacer-on-brand); border-color: var(--iveacer-brand-green); }
body :is(.btn-curriculum-download,.official-kasian-sheet,.official-kasian-box) { background: var(--iveacer-surface); border-color: var(--iveacer-border); }
body :is(.official-kasian-body,.official-kasian-name,.official-kasian-pos,.official-kasian-date) { color: var(--iveacer-text-main); }
body :is(.curriculum-badge-tag.badge-verified,.ylo-year-badge.ylo-badge-1,.badge-status-signed,.official-kasian-seal-badge) { background: var(--iveacer-success-surface); color: var(--iveacer-success-text); border-color: var(--iveacer-border); }
body :is(.curriculum-badge-tag.badge-campus,.ylo-year-badge.ylo-badge-2,.badge-status-routing,.badge-urgency-urgent) { background: var(--iveacer-warning-surface); color: var(--iveacer-warning-text); border-color: var(--iveacer-border); }
body :is(.curriculum-badge-tag.badge-degree,.badge-status-registered) { background: var(--iveacer-info-surface); color: var(--iveacer-info-text); border-color: var(--iveacer-border); }
body :is(.badge-urgency-normal,.badge-conf-normal) { background: var(--iveacer-surface-soft); color: var(--iveacer-text-muted); }
body :is(.badge-urgency-most,.badge-conf-secret) { background: var(--iveacer-danger-surface); color: var(--iveacer-danger-text); }

/* The PHP gateway uses an independent navy stylesheet; retain its layout. */
body .login-gateway-card { background: var(--iveacer-surface) !important; border-color: var(--iveacer-border) !important; box-shadow: var(--iveacer-shadow-lg) !important; }
body :is(.library-tab-switcher,.library-input-field,.service-shortcut-card,.quick-account-pill) { background: var(--iveacer-surface-soft); color: var(--iveacer-text-main); border-color: var(--iveacer-border); }
body .service-shortcut-card { background: var(--iveacer-surface-soft) !important; color: var(--iveacer-text-main) !important; border-color: var(--iveacer-border) !important; }
body :is(.service-shortcut-title,.library-input-group label) { color: var(--iveacer-text-main); }
body :is(.service-shortcut-desc,.login-divider span,.library-input-group .input-icon) { color: var(--iveacer-text-muted); }
body :is(.library-tab-switcher .nav-link,.quick-account-pill) { color: var(--iveacer-text-muted); }
body :is(.library-tab-switcher .nav-link:hover,.quick-account-pill:hover) { color: var(--iveacer-link); background: var(--iveacer-surface-subtle); border-color: var(--iveacer-border); }
body .library-tab-switcher .nav-link.active { background: var(--iveacer-brand-green) !important; color: var(--iveacer-on-brand) !important; box-shadow: var(--iveacer-shadow-sm) !important; }
body .btn-library-gradient { background: var(--iveacer-hero); color: var(--iveacer-on-brand); box-shadow: var(--iveacer-shadow-md); }
body .btn-library-gradient:hover { background: var(--iveacer-brand-green); }
body .btn-google-workspace { background: var(--iveacer-surface); color: var(--iveacer-text-main) !important; border-color: var(--iveacer-border); }
body .btn-google-workspace:hover { background: var(--iveacer-surface-soft); }
body .login-glow-orb-top { background: rgba(212,175,55,.16); }
body .login-glow-orb-bottom { background: rgba(46,125,50,.15); }
body .login-gateway-card :is(.text-white,.text-light) { color: var(--iveacer-text-main) !important; }
body .login-gateway-card .text-white-50 { color: var(--iveacer-text-muted) !important; }

/* Override Bootstrap's fixed white & subtle utilities for surface regions (single source of truth). */
html[data-iveacer-a11y] body :is(.bg-white,.bg-light,.bg-body-tertiary,.alert-light) { background-color: var(--iveacer-surface) !important; color: var(--iveacer-text-main) !important; border-color: var(--iveacer-border) !important; }
body :is(.bg-white,.bg-light,.bg-body-tertiary,.alert-light,.card,.list-group-item,.modal-content,.modal-body,.agri-metric-tile,.agri-feature-card,.ita-action-card,.smart-agri-hub-card,.colleges-network-card,.ita-section-card) .text-dark:not(.bg-warning):not(.btn-warning):not(.badge.bg-warning):not(.bg-warning-subtle):not(.btn-outline-warning),
html[data-iveacer-a11y] body :is(.bg-white,.bg-light,.bg-body-tertiary).text-dark,
body #agriWind.text-dark { color: var(--iveacer-text-main) !important; }
html:is([data-theme='dark'],[data-bs-theme='dark'],.dark,[data-contrast='high'],.high-contrast) body .text-dark:not(.bg-warning):not(.btn-warning):not(.badge.bg-warning):not(.bg-warning-subtle):not(.btn-outline-warning) { color: var(--iveacer-text-main) !important; }
body :is(.bg-warning.text-dark,.badge.bg-warning.text-dark,.badge.bg-warning .text-dark,.btn-warning.text-dark) { background-color: var(--iveacer-brand-gold) !important; color: var(--iveacer-on-gold) !important; }
body :is(.bg-warning-subtle,.badge.bg-warning-subtle,.badge.bg-warning-subtle.text-dark) { background-color: var(--iveacer-warning-surface) !important; color: var(--iveacer-warning-text) !important; border-color: var(--iveacer-border) !important; }
body .bg-warning-subtle .text-dark { color: var(--iveacer-warning-text) !important; }
body :is(.btn-outline-warning.text-dark,.ita-action-card .btn-outline-warning.text-dark) { color: var(--iveacer-warning-text) !important; }
body :is(.btn-outline-warning.text-dark,.ita-action-card .btn-outline-warning.text-dark):is(:hover,:focus-visible) { color: var(--iveacer-heading) !important; background-color: transparent !important; text-decoration: underline; }
body :is(.bg-success-subtle,.badge.bg-success-subtle) { background-color: var(--iveacer-success-surface) !important; color: var(--iveacer-success-text) !important; border-color: var(--iveacer-border) !important; }
body .bg-success-subtle :is(.text-dark,.text-success) { color: var(--iveacer-success-text) !important; }
body :is(.bg-primary-subtle,.badge.bg-primary-subtle) { background-color: var(--iveacer-info-surface) !important; color: var(--iveacer-info-text) !important; border-color: var(--iveacer-border) !important; }
body .bg-primary-subtle :is(.text-dark,.text-primary) { color: var(--iveacer-info-text) !important; }
body :is(.bg-secondary-subtle,.badge.bg-secondary-subtle,.bg-dark-subtle,#agriLiveStatusBadge) { background-color: var(--iveacer-surface-soft) !important; color: var(--iveacer-text-main) !important; border-color: var(--iveacer-border) !important; }
html[data-iveacer-a11y] body :is(.text-success,.text-primary) { color: var(--iveacer-link) !important; }
html[data-iveacer-a11y] body .text-muted { color: var(--iveacer-text-muted) !important; }

/* Gateway Bottom section: theme-aware contrast across Light, Dark & High Contrast modes (single source of truth). */
.gateway-bottom,
body .gateway-bottom,
body.home-design .gateway-bottom {
  background: var(--iveacer-surface) !important;
  color: var(--iveacer-text-main) !important;
  border: 1.5px solid var(--iveacer-border) !important;
}
.gateway-bottom :is(.side-description,.side-badge) {
  display: inline-flex;
  width: fit-content;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--iveacer-surface-soft) !important;
  color: var(--iveacer-link) !important;
  border: 1px solid var(--iveacer-border) !important;
  font-weight: 700;
  margin-bottom: 12px;
}
.gateway-bottom .side-content h2,
.gateway-bottom .side-content h2 span {
  color: var(--iveacer-heading) !important;
}
.gateway-bottom .side-content p {
  color: var(--iveacer-text-muted) !important;
  opacity: 1 !important;
}
.gateway-bottom .stat-item {
  background: var(--iveacer-surface-soft) !important;
  border: 1px solid var(--iveacer-border) !important;
  color: var(--iveacer-text-main) !important;
  box-shadow: var(--iveacer-shadow-sm);
}
.gateway-bottom .stat-item:hover {
  background: var(--iveacer-surface-subtle) !important;
  border-color: var(--iveacer-link) !important;
}
.gateway-bottom .stat-item strong,
.gateway-bottom .stat-item .stat-num {
  color: var(--iveacer-brand-green) !important;
}
.gateway-bottom .stat-item span {
  color: var(--iveacer-text-main) !important;
  opacity: 1 !important;
  font-weight: 600;
}
.gateway-bottom .contact-box {
  background: var(--iveacer-surface-soft) !important;
  border: 1px solid var(--iveacer-border) !important;
  color: var(--iveacer-text-main) !important;
}
.gateway-bottom .contact-box h4 {
  color: var(--iveacer-heading) !important;
  border-bottom: 1px solid var(--iveacer-border) !important;
}
.gateway-bottom .contact-box p,
.gateway-bottom .contact-box p span {
  color: var(--iveacer-text-main) !important;
  opacity: 1 !important;
}
.gateway-bottom .contact-box strong {
  color: var(--iveacer-heading) !important;
}
.gateway-bottom .contact-box a {
  color: var(--iveacer-link) !important;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.gateway-bottom .contact-box a:hover {
  color: var(--iveacer-heading) !important;
}
html:is([data-theme='dark'],[data-bs-theme='dark'],.dark) .gateway-bottom :is(.stat-item strong,.stat-item .stat-num,.contact-box a) {
  color: #f2d77e !important;
}
html:is([data-theme='dark'],[data-bs-theme='dark'],.dark) .gateway-bottom .contact-box a:hover {
  color: #ffffff !important;
}

/* News category badges: >= 4.5:1 contrast across Light, Dark & High Contrast modes (single source of truth). */
html:is([data-theme='dark'],[data-bs-theme='dark'],.dark) :is(body,.home-design) .news-cat-badge,
html:is([data-theme='dark'],[data-bs-theme='dark'],.dark) :is(body,.home-design) .news-cat-badge.cat-admission {
  background: var(--iveacer-success-surface) !important;
  color: var(--iveacer-success-text) !important;
  border-color: rgba(163, 229, 178, 0.38) !important;
}
html:is([data-theme='dark'],[data-bs-theme='dark'],.dark) :is(body,.home-design) .news-cat-badge:is(.cat-royal,.cat-ceremony,.cat-procurement) {
  background: var(--iveacer-warning-surface) !important;
  color: var(--iveacer-warning-text) !important;
  border-color: rgba(241, 211, 116, 0.42) !important;
}
html:is([data-theme='dark'],[data-bs-theme='dark'],.dark) :is(body,.home-design) .news-cat-badge.cat-council {
  background: var(--iveacer-info-surface) !important;
  color: var(--iveacer-info-text) !important;
  border-color: rgba(185, 213, 239, 0.38) !important;
}
html:is([data-theme='dark'],[data-bs-theme='dark'],.dark) :is(body,.home-design) .news-cat-badge.cat-conference {
  background: var(--iveacer-violet-surface) !important;
  color: var(--iveacer-violet-text) !important;
  border-color: rgba(211, 190, 228, 0.38) !important;
}

/* User-selected high contrast keeps artwork intact and strengthens UI tokens. */
html[data-contrast='high'], html.high-contrast {
  --iveacer-brand-green: #000000;
  --iveacer-brand-deep: #000000;
  --iveacer-brand-medium: #000000;
  --iveacer-brand-gold: #ffff00;
  --iveacer-gold-hover: #ffff00;
  --iveacer-gold-text: #ffff00;
  --iveacer-on-brand: #ffffff;
  --iveacer-on-brand-muted: #ffffff;
  --iveacer-on-gold: #000000;
  --iveacer-canvas-color: #000000;
  --iveacer-canvas: #000000;
  --iveacer-surface: #000000;
  --iveacer-surface-soft: #000000;
  --iveacer-surface-subtle: #000000;
  --iveacer-text-main: #ffffff;
  --iveacer-text-muted: #ffffff;
  --iveacer-heading: #ffff00;
  --iveacer-link: #ffff00;
  --iveacer-link-rgb: 255,255,0;
  --iveacer-border: #ffffff;
  --iveacer-border-soft: #ffffff;
  --iveacer-header: #000000;
  --iveacer-hero: #000000;
  --iveacer-success-text: #ffffff;
  --iveacer-success-surface: #000000;
  --iveacer-warning-text: #ffff00;
  --iveacer-warning-surface: #000000;
  --iveacer-info-text: #ffffff;
  --iveacer-info-surface: #000000;
  --iveacer-violet-text: #ffffff;
  --iveacer-violet-surface: #000000;
  --iveacer-neutral-text: #ffffff;
  --iveacer-neutral-surface: #000000;
  --iveacer-danger-text: #ffffff;
  --iveacer-danger-surface: #000000;
  --iveacer-focus: #ffff00;

  /* Campus Theme Tokens — High Contrast Mode */
  --iveacer-campus-pb-accent: #ffff00;
  --iveacer-campus-pb-surface: #000000;
  --iveacer-campus-pb-text: #ffff00;
  --iveacer-campus-pb-border: #ffffff;

  --iveacer-campus-lb-accent: #ffff00;
  --iveacer-campus-lb-surface: #000000;
  --iveacer-campus-lb-text: #ffff00;
  --iveacer-campus-lb-border: #ffffff;

  --iveacer-campus-rb-accent: #ffff00;
  --iveacer-campus-rb-surface: #000000;
  --iveacer-campus-rb-text: #ffffff;
  --iveacer-campus-rb-border: #ffffff;

  color-scheme: dark;
}
html:is([data-contrast='high'],.high-contrast) .gateway-bottom :is(.stat-item strong,.stat-item .stat-num,.contact-box a) {
  color: #ffff00 !important;
}
html:is([data-contrast='high'],.high-contrast) .gateway-bottom .contact-box a:hover {
  color: #ffffff !important;
}
html:is([data-contrast='high'],.high-contrast) :is(body,.home-design) .news-cat-badge,
html:is([data-contrast='high'],.high-contrast) :is(body,.home-design) .news-cat-badge:is(.cat-admission,.cat-council,.cat-conference,.cat-royal,.cat-ceremony,.cat-procurement) {
  background: #000000 !important;
  color: #ffff00 !important;
  border: 1.5px solid #ffffff !important;
}
/* Grayscale is scoped off <html> in accessibility.css & landing-a11y.css so fixed/sticky layers stay viewport-anchored. */
html[data-reduced-motion='true'], html.reduce-motion { scroll-behavior: auto; }
html:is([data-reduced-motion='true'], .reduce-motion) :is(.iveacer-card,.iveacer-pill-btn,.iveacer-btn-primary,.iveacer-btn-gold):is(:hover,:active) {
  transform: none !important;
}
@media (prefers-reduced-motion: reduce) {
  html:not([data-reduced-motion='false']) { scroll-behavior: auto; }
  html:not([data-reduced-motion='false']) :is(.iveacer-card,.iveacer-pill-btn,.iveacer-btn-primary,.iveacer-btn-gold):is(:hover,:active) {
    transform: none !important;
  }
}

@media (forced-colors: active) {
  body :is(button,a,input,select,textarea):focus-visible { outline-color: Highlight; }
}
@media print {
  html[data-iveacer-a11y] body { background: #fff !important; color: #000 !important; }
  body :is(.official-kasian-sheet,.official-kasian-box) { background: #fff !important; color: #000 !important; }
  body :is(.official-kasian-body,.official-kasian-name,.official-kasian-pos,.official-kasian-date) { color: #000 !important; }
}
