/* ==========================================================================
   Assessment Portal — Modern UI theme
   --------------------------------------------------------------------------
   Loaded after the legacy stylesheets (see includes/theme-head.php).
   College branding comes from config.php via:
     --t-primary    ($color1)      --t-secondary  ($color2)
     --t-gradient   ($gradient1)   --t-gradient-2 ($gradient2)
   Every other colour is derived from those, so AET / KAL / Chelsea each get
   their own look without any per-college CSS.
   ========================================================================== */

:root {
  /* Brand scale (derived) */
  --t-primary-50:  color-mix(in srgb, var(--t-primary) 6%, #fff);
  --t-primary-100: color-mix(in srgb, var(--t-primary) 12%, #fff);
  --t-primary-200: color-mix(in srgb, var(--t-primary) 24%, #fff);
  --t-primary-600: color-mix(in srgb, var(--t-primary) 88%, #000);
  --t-primary-700: color-mix(in srgb, var(--t-primary) 72%, #000);
  --t-ring:        color-mix(in srgb, var(--t-primary) 22%, transparent);

  /* Neutrals */
  --t-bg:       #f4f6fa;
  --t-surface:  #ffffff;
  --t-ink:      #0f172a;
  --t-text:     #334155;
  --t-muted:    #64748b;
  --t-subtle:   #94a3b8;
  --t-border:   #e5e9f0;
  --t-border-2: #d5dbe5;
  --t-row:      #f8fafc;

  /* Status */
  --t-success: #16a34a;  --t-success-bg: #ecfdf3;
  --t-danger:  #dc2626;  --t-danger-bg:  #fef2f2;
  --t-warning: #d97706;  --t-warning-bg: #fffbeb;
  --t-info:    #2563eb;  --t-info-bg:    #eff6ff;

  /* Shape */
  --t-radius-sm: 8px;
  --t-radius:    12px;
  --t-radius-lg: 18px;
  --t-shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --t-shadow:    0 4px 6px -2px rgba(15, 23, 42, .05), 0 12px 24px -6px rgba(15, 23, 42, .08);
  --t-shadow-lg: 0 24px 48px -12px rgba(15, 23, 42, .18);

  --t-font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Keep legacy variables in sync so old inline styles pick up the brand */
  --brand-color: var(--t-primary);
  --brand-color2: var(--t-secondary);
  --font-family: var(--t-font);
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
html { -webkit-text-size-adjust: 100%; }
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }

body,
body * {
  font-family: var(--t-font);
}

/* Icon fonts must keep their own family */
body .fa, body .fas, body .far, body .fab, body [class^="fa-"], body [class*=" fa-"],
body .material-icons, body .material-symbols-outlined {
  font-family: revert;
}

body {
  background: var(--t-bg) !important;
  color: var(--t-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--t-ink);
  letter-spacing: -0.015em;
  line-height: 1.25;
}

::selection { background: var(--t-primary-200); color: var(--t-ink); }

* { scrollbar-width: thin; scrollbar-color: var(--t-border-2) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--t-border-2); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: var(--t-subtle); }

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

/* --------------------------------------------------------------------------
   Form controls (global)
   -------------------------------------------------------------------------- */
input[type="text"], input[type="email"], input[type="password"], input[type="url"],
input[type="number"], input[type="date"], input[type="datetime-local"], input[type="search"],
input[type="tel"], input:not([type]), select, textarea {
  font-size: 14px;
  color: var(--t-ink);
  background-color: #fff;
  border: 1px solid var(--t-border-2);
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 42px;
  line-height: 1.4;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
}
textarea { min-height: 96px; }

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: 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='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  cursor: pointer;
}
select[multiple] { background-image: none; padding: 6px; }
select[multiple] option { padding: 8px 10px; margin: 2px 0; border-radius: 8px; color: var(--t-text); }
select[multiple] option:checked, form select[multiple] option:checked {
  background: linear-gradient(var(--t-primary-100), var(--t-primary-100)) !important;
  color: var(--t-primary-700) !important;
  font-weight: 600;
}
.resource-link { width: fit-content; }

input::placeholder, textarea::placeholder { color: var(--t-subtle); }

input:hover:not(:focus):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="submit"]):not([type="button"]),
select:hover:not(:focus), textarea:hover:not(:focus) {
  border-color: var(--t-subtle);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--t-primary);
  box-shadow: 0 0 0 4px var(--t-ring);
}

input[readonly], select[readonly], input:disabled, select:disabled, textarea:disabled {
  background-color: var(--t-row);
  color: var(--t-muted);
}

input[type="file"] {
  font-size: 13px;
  padding: 6px;
  border: 1px dashed var(--t-border-2);
  border-radius: 10px;
  background: var(--t-row);
  min-height: 42px;
  width: 100%;
}
input[type="file"]::file-selector-button {
  border: 0;
  border-radius: 8px;
  padding: 8px 14px;
  margin-right: 12px;
  background: var(--t-primary-100);
  color: var(--t-primary-700);
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease;
}
input[type="file"]::file-selector-button:hover { background: var(--t-primary-200); }

input[type="checkbox"], input[type="radio"] {
  accent-color: var(--t-primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

label {
  color: var(--t-text);
  font-weight: 600;
  font-size: 13px;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.form-btn, .btn, .btn-purple, .ou-button-primary, button[type="submit"]:not(.swal2-styled):not(.nav-sign):not(.remove-btn),
.download-resource a, .download-all a, .download-all button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--t-primary);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .08), inset 0 1px 0 rgba(255, 255, 255, .12);
  transition: background-color .15s ease, box-shadow .15s ease, transform .05s ease, border-color .15s ease;
  width: auto;
  height: auto;
}
.form-btn:hover, .btn:hover, .btn-purple:hover, .ou-button-primary:hover,
button[type="submit"]:not(.swal2-styled):not(.nav-sign):not(.remove-btn):hover,
.download-resource a:hover, .download-all a:hover, .download-all button:hover {
  background: var(--t-primary-600);
  color: #fff;
  box-shadow: 0 4px 12px -2px color-mix(in srgb, var(--t-primary) 40%, transparent);
}
.form-btn:active, .btn:active, button[type="submit"]:active { transform: translateY(1px); }
.form-btn:disabled, .btn:disabled, button[type="submit"]:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }

/* Secondary / neutral buttons */
.btn-white, .ou-button-secondary, .form-table-btn, #add-enrollment-row {
  background: #fff !important;
  color: var(--t-ink) !important;
  border: 1px solid var(--t-border-2) !important;
  box-shadow: var(--t-shadow-sm) !important;
}
.btn-white:hover, .ou-button-secondary:hover, .form-table-btn:hover, #add-enrollment-row:hover {
  background: var(--t-row) !important;
  border-color: var(--t-subtle) !important;
}

/* "Add X" header links reuse .side-nav__item in legacy markup */
a.form-btn.side-nav__item, .form-btn.side-nav__item {
  display: inline-flex !important;
  margin: 0 !important;
  padding: 10px 18px !important;
  background: var(--t-primary) !important;
  color: #fff !important;
  border-radius: 10px !important;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
a.form-btn.side-nav__item[href^="add-"]::before { content: "+"; font-size: 18px; line-height: 1; font-weight: 500; margin-right: 2px; }
a.form-btn.side-nav__item:hover { background: var(--t-primary-600) !important; color: #fff !important; }
a.form-btn.side-nav__item.side-nav__item-active::before { position: static; width: auto; background: none; border-radius: 0; }

/* Small table action buttons */
.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 2px 4px 2px 0;
  padding: 6px 12px;
  min-height: 32px;
  border: 1px solid var(--t-border-2);
  border-radius: 8px;
  background: #fff;
  color: var(--t-ink);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: all .15s ease;
}
.action-btn:hover {
  border-color: var(--t-primary);
  color: var(--t-primary-700);
  background: var(--t-primary-50);
  box-shadow: none;
}
.action-btn.btn-delete {
  background: var(--t-primary);
  border-color: var(--t-primary);
  color: #fff;
}
.action-btn.btn-delete:hover { background: var(--t-primary-600); color: #fff; }

/* Round remove (×) buttons */
.remove-btn {
  width: 32px !important;
  height: 32px !important;
  font-size: 20px !important;
  line-height: 1 !important;
  border-radius: 999px !important;
  background: var(--t-danger-bg) !important;
  color: var(--t-danger) !important;
  border: 1px solid color-mix(in srgb, var(--t-danger) 25%, #fff) !important;
  box-shadow: none !important;
}
.remove-btn:hover { background: var(--t-danger) !important; color: #fff !important; }
/* Draw the × with two bars so it is optically centred (the text glyph sits on
   the font baseline and looks low). The original character stays for screen readers. */
.remove-btn {
  position: relative;
  padding: 0 !important;
  font-size: 0 !important;
  line-height: 0 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}
.remove-btn::before, .remove-btn::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}
.remove-btn::before { transform: translate(-50%, -50%) rotate(45deg); }
.remove-btn::after  { transform: translate(-50%, -50%) rotate(-45deg); }

/* Back links */
.back-btn > a, .back-button, a.back-button {
  display: inline-flex !important;
  width: fit-content !important;
  align-items: center;
  gap: 8px;
  padding: 8px 14px !important;
  border: 1px solid var(--t-border-2);
  border-radius: 10px !important;
  background: #fff !important;
  color: var(--t-ink) !important;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: all .15s ease;
  box-shadow: var(--t-shadow-sm);
}
.back-btn > a:hover, .back-button:hover {
  border-color: var(--t-primary);
  color: var(--t-primary-700) !important;
  background: var(--t-primary-50) !important;
}
.back-button p { margin: 0; color: inherit !important; font-size: inherit; font-weight: inherit; }
.back-button img { width: 16px; height: 16px; }

/* Icon-only back buttons next to a page title (trainer / student pages):
   a compact square, centred on the title's first line, with a clear gap. */
.back-button:not(:has(p:not(:empty))) {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px;
  padding: 0 !important;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 12px !important;
}
.back-button:not(:has(p:not(:empty))) p:empty { display: none; }
.back-button img { width: 18px !important; height: 18px !important; }
div:has(> .back-button):has(> .headline) {
  display: flex !important;
  align-items: flex-start !important;
  gap: 14px !important;
}
/* title line ≈ 31px tall at 26px: lift the 40px button so both centres match */
div:has(> .back-button):has(> .headline) > .back-button:not(:has(p:not(:empty))) { margin-top: -4px; }
/* Same pattern where the title sits one level down (course-batches, all-units) */
div:has(> .back-button):has(> .course-navigation > .headline) {
  align-items: flex-start !important;
  gap: 14px !important;
  margin-bottom: 20px !important;
}
div:has(> .back-button):has(> .course-navigation > .headline) > .course-navigation { margin: 0 !important; padding: 0 !important; border: 0 !important; }
div:has(> .back-button):has(> .course-navigation > .headline) > .back-button:not(:has(p:not(:empty))) { margin-top: -4px; }
.course-overview .headline p { margin: 0 !important; }
div:has(> .back-button) > .headline,
div:has(> .back-button) > .course-navigation { flex: 1 1 auto; min-width: 0; margin-right: 0 !important; }
.course-overview .headline p { overflow-wrap: anywhere; }

/* --------------------------------------------------------------------------
   Tables (global)
   -------------------------------------------------------------------------- */
table { border-collapse: separate; border-spacing: 0; }

.box table, .course-overview table, .form-box table, .ou-table, .form-table,
.transaction-history, #enrollment-table, .attendance-table {
  width: 100%;
  padding: 0 !important;
  border: 1px solid var(--t-border);
  border-radius: var(--t-radius);
  overflow: hidden;
  background: #fff;
}

.box table thead tr, .course-overview table thead tr, .form-box table thead tr,
.ou-table thead tr, .form-table thead tr, .transaction-history thead tr, #enrollment-table thead tr {
  background: var(--t-row) !important;
}

.box table th, .course-overview table th, .form-box table th, .ou-table th, .form-table th,
.transaction-history th, #enrollment-table th, .attendance-table th {
  padding: 12px 14px !important;
  background: var(--t-row);
  color: var(--t-muted) !important;
  font-size: 11.5px !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: .05em;
  text-align: left;
  border-bottom: 1px solid var(--t-border);
  border-radius: 0 !important;
  white-space: nowrap;
}

.box table td, .course-overview table td, .form-box table td, .ou-table td, .form-table td,
.transaction-history td, #enrollment-table td, .attendance-table td {
  padding: 12px 14px !important;
  color: var(--t-text);
  font-size: 13.5px !important;
  font-weight: 500 !important;
  vertical-align: middle;
  border-bottom: 1px solid var(--t-border);
  background: #fff;
}

.box table tbody tr:last-child td, .course-overview table tbody tr:last-child td,
.form-box table tbody tr:last-child td, .transaction-history tbody tr:last-child td,
#enrollment-table tbody tr:last-child td, .ou-table tbody tr:last-child td {
  border-bottom: 0;
}

.box table tbody tr:hover td, .course-overview table tbody tr:hover td,
.transaction-history tbody tr:hover td, .ou-table tbody tr:hover td {
  background: var(--t-primary-50);
}

.box table td select, .box table td input, #enrollment-table td select, #enrollment-table td input {
  margin-top: 0 !important;
  min-height: 38px;
}

/* --------------------------------------------------------------------------
   Pagination
   -------------------------------------------------------------------------- */
.pagination { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 24px; }
.pagination a, .pagination span {
  margin: 0 !important;
  min-width: 36px;
  height: 36px;
  padding: 0 12px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--t-border-2) !important;
  border-radius: 10px !important;
  background: #fff;
  color: var(--t-text);
  font-size: 13px;
  font-weight: 600;
  transition: all .15s ease;
}
.pagination a:hover { background: var(--t-primary-50) !important; border-color: var(--t-primary) !important; color: var(--t-primary-700); }
.pagination a.active { background: var(--t-primary) !important; border-color: var(--t-primary) !important; color: #fff !important; }

/* ==========================================================================
   ADMIN SHELL  (pages that include admin/includes/sidebar.php)
   ========================================================================== */
.container:has(> .sidebar) {
  display: flex;
  height: 100vh;
  background: var(--t-bg);
}

/* Sidebar */
.sidebar {
  width: 264px !important;
  padding: 20px 16px !important;
  background: #fff !important;
  border-right: 1px solid var(--t-border) !important;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  height: 100vh;
  overflow-y: auto;
}

.sidebar__logo {
  display: flex !important;
  justify-content: center !important;
  align-items: center;
  padding: 4px 0 18px;
  margin: 0 0 14px !important;
  border-bottom: 1px solid var(--t-border);
}
.sidebar__logo img { width: 100%; max-width: 100% !important; max-height: 120px; height: auto; object-fit: contain; object-position: center; }

.side-nav { display: flex; flex-direction: column; gap: 2px; padding: 0; margin: 0; }

.side-nav__header {
  display: block;
  padding: 6px 12px 10px !important;
  color: var(--t-subtle) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: .08em !important;
  text-transform: uppercase;
}

.side-nav > a { display: block; text-decoration: none; }

.side-nav__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px !important;
  margin: 0 !important;
  padding: 10px 12px !important;
  border-radius: 10px !important;
  color: var(--t-muted) !important;
  font-size: 14px;
  font-weight: 600;
  transition: background-color .15s ease, color .15s ease !important;
}
.side-nav__item > span { font-weight: 600 !important; letter-spacing: 0 !important; }
.side-nav__item svg { width: 20px; height: 20px; flex-shrink: 0; }
.side-nav__item:hover { background: var(--t-row) !important; color: var(--t-ink) !important; }
.side-nav__item.side-nav__item-active {
  background: var(--t-primary-100) !important;
  color: var(--t-primary-700) !important;
}
.side-nav__item.side-nav__item-active::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--t-primary);
}
.side-nav__item.last-item { margin-bottom: 0 !important; }
.side-nav__item.last-item:hover { background: var(--t-danger-bg) !important; color: var(--t-danger) !important; }

.sidebar__footer {
  padding: 12px;
  color: var(--t-subtle);
  font-size: 12px;
  font-weight: 500;
}

/* Main */
.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: var(--t-bg);
}

/* Topbar */
.top-container {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 68px;
  padding: 12px 32px !important;
  background: rgba(255, 255, 255, .85) !important;
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--t-border) !important;
}
.topbar__title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.topbar__eyebrow {
  color: var(--t-subtle);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.topbar__heading {
  color: var(--t-ink);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-container .user-nav { display: flex; align-items: center; gap: 12px; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 5px;
  border: 1px solid var(--t-border);
  border-radius: 999px;
  background: #fff;
}
.user-chip__avatar, .portal-user__avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--t-gradient);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
}
.user-chip__text { display: flex; flex-direction: column; line-height: 1.15; }
.user-chip__name { color: var(--t-ink); font-size: 13.5px; font-weight: 700; margin: 0 !important; }
.user-chip__role { color: var(--t-muted); font-size: 11.5px; font-weight: 600; text-transform: capitalize; }

/* Content area */
.bottom-container {
  display: flex;
  gap: 24px;
  padding: 28px 32px 40px !important;
  background: transparent !important;
}
.bottom-container__left { width: 100%; max-width: 1240px !important; margin: 0 auto; }
.all-courses { padding-top: 28px !important; }

.box {
  background: var(--t-surface) !important;
  border: 1px solid var(--t-border);
  border-radius: var(--t-radius-lg) !important;
  box-shadow: var(--t-shadow-sm);
  padding: 24px !important;
  margin-bottom: 24px;
}
.box.transaction-box { margin-bottom: 24px; }

.form-box { padding: 8px !important; }
.form-box > h2, .box > h2, .bottom-container h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--t-ink);
  margin-bottom: 6px;
}
.form-box h3, .box h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--t-ink);
  margin: 8px 0 14px;
}

.header-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px !important;
  padding-bottom: 18px !important;
  border-bottom: 1px solid var(--t-border) !important;
  color: var(--t-ink) !important;
}
.section-header { font-size: 18px !important; font-weight: 700; color: var(--t-ink); }

.box p, .total-box p { color: var(--t-muted); font-weight: 500; font-size: 13px; line-height: 1.5; }

/* Enrolment tables (add-student / edit-student) */
#enrollment-table { margin-bottom: 0; }
#enrollment-table + #add-enrollment-row,
.table-scroll:has(> #enrollment-table) + #add-enrollment-row,
#add-enrollment-row { margin: 14px 0 8px !important; }
#enrollment-table th.enrol-actions, #enrollment-table td.enrol-actions { width: 1%; white-space: nowrap; text-align: center !important; }
.enrol-actions__inner { display: flex; align-items: center; justify-content: center; gap: 8px; }
.enrol-actions__inner .remove-btn { margin: 0 !important; flex-shrink: 0; }
.enrol-actions .sync-units-btn { min-height: 32px !important; padding: 6px 12px !important; font-size: 12.5px !important; border-radius: 8px !important; }
#enrollment-table td select, #enrollment-table td input { width: 100%; min-width: 140px; }

/* Admin form layout */
.input-control { margin-top: 0 !important; margin-bottom: 18px !important; gap: 6px; }
.input-control label { margin: 0; }
.input-control select, .input-control textarea, .input-control input { margin-top: 0 !important; }
.input-control.half { width: 100% !important; flex: 1 1 0; min-width: 0; margin-bottom: 18px !important; }
/* A full-width control sharing a row with a half one (e.g. Unit + Due Date on
   Open Unit): share the row evenly instead of squeezing its neighbour to nothing,
   so the columns line up with the rows above and below. */
.d-flex > .input-control:not(.half) { flex: 1 1 0; min-width: 0; }
/* Open Unit pages wrap their labels in <h3>: size them like every other field label */
.ou-input-control label h3, .ou-input-control > h3 {
  margin: 0 !important;
  color: var(--t-text);
  font-size: 13px !important;
  font-weight: 600 !important;
  letter-spacing: 0;
}
.d-flex { gap: 16px; }
.form-box .d-flex.justify-content-center, .input-control.d-flex.justify-content-center {
  flex-direction: row;
  justify-content: flex-end;
  padding-top: 18px;
  margin-top: 8px !important;
  border-top: 1px solid var(--t-border);
}

.form-box .status label { font-weight: 600; }

/* Search inputs inside admin lists */
.box input[type="search"], .box input.search, .box .search-input, #searchInput, #search {
  padding-left: 38px;
  background-image: 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='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}

/* Status pills (added by assets/js/theme.js) */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.status-pill--success { color: var(--t-success); background: var(--t-success-bg); }
.status-pill--danger  { color: var(--t-danger);  background: var(--t-danger-bg); }
.status-pill--warning { color: var(--t-warning); background: var(--t-warning-bg); }
.status-pill--info    { color: var(--t-info);    background: var(--t-info-bg); }

/* Status-ish words inside admin tables */
.status-active, .badge-success { color: var(--t-success); background: var(--t-success-bg); }
.status-inactive, .badge-danger { color: var(--t-danger); background: var(--t-danger-bg); }

/* Dashboard */
.dashboard-layout {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 380px;
  align-items: start;
  gap: 24px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}
.dashboard-layout > .stat-grid { grid-column: 1 / -1; margin-bottom: 0; }
.dashboard-layout .bottom-container__left { min-width: 0; max-width: none !important; width: auto; margin: 0; }
.dashboard-layout .bottom-container__right { width: auto; position: sticky; top: 92px; }
.dashboard-layout .box { margin-bottom: 0; }
#active-batches-table th:nth-child(2) { min-width: 220px; }
#active-batches-table td:nth-child(5) { max-width: 260px; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.section-subtitle { display: block; margin-top: 2px; color: var(--t-muted); font-size: 13px; font-weight: 500; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--t-border);
  border-radius: var(--t-radius-lg);
  box-shadow: var(--t-shadow-sm);
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--t-shadow); border-color: var(--t-primary-200); }
.stat-card__icon {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: var(--t-primary-100);
  color: var(--t-primary-700);
}
.stat-card__icon svg { width: 22px; height: 22px; }
.stat-card--accent .stat-card__icon { background: var(--t-gradient); color: #fff; }
.stat-card__body { display: flex; flex-direction: column; min-width: 0; }
.stat-card__label { color: var(--t-muted); font-size: 13px; font-weight: 600; }
.stat-card__value { color: var(--t-ink); font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }

.cell-strong { color: var(--t-ink); font-weight: 700; }
.cell-code {
  display: inline-block;
  margin-right: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--t-primary-50);
  color: var(--t-primary-700);
  font-size: 12px;
  font-weight: 700;
}
.cell-muted { color: var(--t-muted) !important; font-size: 13px !important; }
.cell-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--t-row);
  border: 1px solid var(--t-border);
  color: var(--t-ink);
  font-size: 12.5px;
  font-weight: 700;
}
.count-pill--accent { background: var(--t-primary); border-color: var(--t-primary); color: #fff; }

.approvals-card .header-container { margin-bottom: 12px !important; }
.approval-list { list-style: none; margin: 0; padding: 0 4px 0 0; max-height: 70vh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.approval-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--t-border);
  border-radius: 12px;
  background: #fff;
  transition: border-color .15s ease, background .15s ease;
}
.approval-item:hover { border-color: var(--t-primary-200); background: var(--t-primary-50); }
.approval-item__body { flex: 1; min-width: 0; }
.approval-item__top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.approval-item__name { color: var(--t-ink); font-size: 14px; font-weight: 700; }
.approval-item__time { color: var(--t-subtle); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.approval-item__meta { color: var(--t-text); font-size: 12.5px; margin-top: 2px; }
.approval-item__trainer { color: var(--t-muted); font-size: 12px; margin-top: 2px; }
.approval-empty { padding: 24px 12px; text-align: center; color: var(--t-muted); font-size: 13.5px; }

@media (max-width: 1300px) {
  .dashboard-layout { grid-template-columns: minmax(0, 1fr); }
  .dashboard-layout .bottom-container__right { position: static; }
}
@media (max-width: 1000px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Units accordion buttons on open-unit pages */
.units-accordion-btns { gap: 0; margin-top: 16px; margin-bottom: 20px; border: 1px solid var(--t-border-2); border-radius: 12px; overflow: hidden; }
.units-accordion-btns button { border-radius: 0 !important; box-shadow: none !important; padding: 14px !important; background: #fff !important; color: var(--t-muted) !important; border: 0 !important; }
.units-accordion-btns button.active { background: var(--t-primary) !important; color: #fff !important; }

/* Units list (course page) */
.units_list li .left { background: var(--t-primary-50) !important; color: var(--t-ink) !important; border: 1px solid var(--t-primary-100); border-radius: 10px; padding: 10px 14px !important; }
.units_list li .left .unit-name a { color: var(--t-primary-700) !important; font-weight: 600; }
.add-unit { background: var(--t-primary) !important; border-radius: 10px !important; padding: 8px 14px !important; font-weight: 600; }

/* ==========================================================================
   TRAINER / STUDENT PORTAL  (pages that include includes/header.php)
   ========================================================================== */
.container:has(.dashboard) { width: 100%; min-height: 0 !important; padding-bottom: 48px !important; background: transparent !important; }
.wrapper:has(> .dashboard) { width: 100% !important; max-width: 1280px; margin: 0 auto; padding: 0 28px; }

/* Portal top bar */
body:has(.portal-topbar) { overflow-x: clip; }
.portal-topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  margin: 0 calc(50% - 50vw) 28px;
  padding: 0 calc(50vw - 50%);
  background: rgba(255, 255, 255, .88);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--t-border);
}
.portal-topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 80px;
}
.portal-brand { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.portal-brand img { height: 64px; width: auto; max-width: 140px; object-fit: contain; }
.portal-brand__label {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--t-primary-100);
  color: var(--t-primary-700);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
}
.portal-actions { display: flex; align-items: center; gap: 10px; }

.portal-icon-btn, .profile .nav-sign {
  position: relative;
  width: 40px !important;
  height: 40px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  border-radius: 12px !important;
  border: 1px solid var(--t-border) !important;
  background: #fff !important;
  color: var(--t-muted);
  cursor: pointer;
  transition: all .15s ease;
}
.portal-icon-btn:hover, .profile .nav-sign:hover {
  background: var(--t-primary-50) !important;
  border-color: var(--t-primary-200) !important;
  color: var(--t-primary-700);
}
.portal-icon-btn, .profile .nav-sign { padding: 0 !important; margin: 0 !important; box-shadow: none !important; }
.portal-icon-btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.portal-icon-btn.is-logout:hover { background: var(--t-danger-bg) !important; border-color: #fecaca !important; color: var(--t-danger); }

.profile .notification-group { position: relative; }
.profile .notification-group .number {
  position: absolute;
  top: -6px !important;
  right: -6px !important;
  z-index: 2;
  min-width: 20px;
  height: 20px !important;
  width: auto !important;
  padding: 0 5px;
  border-radius: 999px !important;
  border: 2px solid #fff;
  background: var(--t-primary) !important;
  color: #fff !important;
  font-size: 10.5px !important;
  font-weight: 700 !important;
  pointer-events: none;
}

.portal-user { display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border: 1px solid var(--t-border); border-radius: 999px; background: #fff; }
.portal-user__name { color: var(--t-ink); font-size: 13.5px; font-weight: 700; white-space: nowrap; margin: 0; }

/* Notification panel */
.notification-panel {
  width: 360px !important;
  max-height: none !important;
  top: calc(100% + 10px) !important;
  right: -8px !important;
  border-radius: 16px !important;
  border: 1px solid var(--t-border);
  box-shadow: var(--t-shadow-lg) !important;
  overflow: hidden !important;
}
.alert-header { width: 100% !important; height: auto !important; padding: 14px 16px !important; background: #fff; }
.alert-header p { font-size: 14px !important; font-weight: 700 !important; color: var(--t-ink) !important; }
.alert-border { border-bottom: 1px solid var(--t-border) !important; }
.notification-scroll-area { max-height: 380px !important; padding: 0 !important; }
.notification-scroll-area a { display: block; text-decoration: none; }
.alert-message { padding: 12px 16px !important; transition: background .15s ease; }
.notification-scroll-area a:hover .alert-message { background: var(--t-primary-50); }
.user-details .user-abbreviation { width: 36px !important; height: 36px !important; background: var(--t-primary-100) !important; }
.user-icon { height: 36px !important; }
.user-icon .user-abbreviation p { color: var(--t-primary-700) !important; font-size: 13px !important; font-weight: 700 !important; }
.user-icon .user-availability { display: none; }
.user-info div.user-name { font-size: 13px !important; font-weight: 600 !important; color: var(--t-ink) !important; gap: 8px; margin: 0 !important; line-height: 1.35; }
.user-info p.user-message, .user-last-seen p, p.user-last-seen { font-size: 12px !important; color: var(--t-muted) !important; }
.user-last-seen { white-space: nowrap; }

body:has(.portal-topbar)::after {
  content: "© Infodelix";
  display: block;
  padding: 8px 0 28px;
  text-align: center;
  color: var(--t-subtle);
  font-size: 12px;
}

/* Page card */
.course-overview {
  width: 100% !important;
  max-width: 100% !important;
  height: auto;
  margin-bottom: 24px !important;
  padding: 28px !important;
  border-radius: var(--t-radius-lg) !important;
  background: var(--t-surface) !important;
  border: 1px solid var(--t-border);
  box-shadow: var(--t-shadow-sm);
}

.course-navigation {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 20px;
}
.course-overview .headline p, .headline p {
  font-size: 26px !important;
  font-weight: 700 !important;
  color: var(--t-ink) !important;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0;
}
.course-info { display: flex; flex-direction: column; gap: 10px; }
.course-details { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.course-details p { font-size: 13.5px !important; color: var(--t-ink) !important; font-weight: 600 !important; margin: 0 !important; }
.course-details span { color: var(--t-muted) !important; font-weight: 500 !important; }

/* Lists of rows (courses, batches, units, students) */
.course-unit {
  border: 1px solid var(--t-border);
  border-radius: var(--t-radius);
  overflow: hidden;
  background: #fff;
}
.unit-border {
  border-top: 0 !important;
  border-bottom: 1px solid var(--t-border);
  padding: 14px 18px !important;
  column-gap: 16px;
  align-items: center;
}
.course-unit > .unit-border:last-child, .scrollable-container > .unit-border:last-child { border-bottom: 0; }
.course-unit[style*="max-height"] { overflow-y: auto; }

.unit-heading {
  background: var(--t-row);
  padding-top: 11px !important;
  padding-bottom: 11px !important;
}
.unit-heading p {
  color: var(--t-muted) !important;
  font-size: 11.5px !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin: 0;
}

.unit-content { transition: background-color .15s ease; }
.unit-content:hover { background: var(--t-primary-50); }
.unit-content p { color: var(--t-text) !important; font-size: 14px !important; font-weight: 500 !important; margin: 0; }
.unit-content .unit-name { display: flex; align-items: center !important; gap: 12px !important; text-decoration: none; }
.unit-content a.unit-name p, .unit-content .unit-name p { color: var(--t-ink) !important; font-weight: 600 !important; }
.unit-content a.unit-name:hover p { color: var(--t-primary-700) !important; }
.unit-content .unit-name img {
  width: 36px;
  height: 36px;
  padding: 8px;
  border-radius: 10px;
  background: var(--t-primary-100);
  flex-shrink: 0;
}

.scrollable-container { max-height: 62vh !important; margin-top: 0 !important; }

/* Result pills */
.unit-result {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  width: fit-content;
  height: auto !important;
  padding: 5px 12px !important;
  border-radius: 999px !important;
  font-size: 12.5px;
  font-weight: 600;
}
.unit-content .true { background: var(--t-success-bg) !important; }
.true p { color: var(--t-success) !important; font-weight: 600 !important; font-size: 12.5px !important; }
.unit-content .false { background: var(--t-danger-bg) !important; }
.false p { color: var(--t-danger) !important; font-weight: 600 !important; font-size: 12.5px !important; }

/* Resource buttons */
.download-resource a { width: auto !important; height: auto !important; border-radius: 10px !important; font-size: 13.5px !important; }
.download-resource a img { filter: brightness(0) invert(1); width: 16px; }

/* Search boxes on trainer pages */
.searchbar .form-home-search, .form-home-search {
  min-width: 280px;
  padding-left: 40px !important;
  border-radius: 10px !important;
  background-image: 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='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: 14px center !important;
}

/* search-students.php legacy table */
.table100.ver5 .table100-head th { background: var(--t-row) !important; color: var(--t-muted) !important; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; }
.table100.ver5 td { background: #fff !important; color: var(--t-text) !important; border-bottom: 1px solid var(--t-border) !important; }
.table100.ver5 tr:hover td { background: var(--t-primary-50) !important; }
.table100.ver5 tr:hover td a { color: var(--t-primary-700) !important; }
.container-table100 { padding: 16px 0 !important; }

/* --------------------------------------------------------------------------
   Assessment / marking pages (student-submissions, all-assessments,
   admin edit-student-enrolled-unit)
   -------------------------------------------------------------------------- */
.course-overview.trainer-portal, .course-overview:has(> .course-dashboard) { display: flex; gap: 28px; align-items: flex-start; }
.course-dashboard {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  border-radius: 0 !important;
}
.course-dashboard > .back-button { margin-bottom: 16px; }
.course-dashboard .course-navigation { align-items: flex-start; padding-bottom: 18px; margin-bottom: 18px !important; border-bottom: 1px solid var(--t-border); }

.due-date { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 0 !important; }
.due-date p:first-child { color: var(--t-muted) !important; font-size: 12px !important; font-weight: 700 !important; text-transform: uppercase; letter-spacing: .05em; }
.due-date p:last-child { color: var(--t-ink) !important; font-size: 14px !important; font-weight: 600 !important; }
#dueDateField { max-width: 170px !important; min-height: 40px; border-radius: 10px !important; border-color: var(--t-border-2) !important; }
.due-date button, #updateDueDateBtn {
  min-height: 34px !important;
  padding: 6px 14px !important;
  margin-top: 0 !important;
  border-radius: 8px !important;
  font-size: 12.5px !important;
  font-weight: 600;
  background: var(--t-primary) !important;
}

/* Action buttons inside rows (download / upload / send back) */
.download-file > a, .download-file > label, .download-file > button {
  height: auto !important;
  min-height: 38px;
  width: auto;
  padding: 8px 14px !important;
  border-radius: 10px !important;
  background: var(--t-primary) !important;
  color: #fff !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  white-space: nowrap;
  gap: 8px !important;
  text-decoration: none;
  transition: background-color .15s ease, box-shadow .15s ease;
}
.download-file > a:hover, .download-file > label:hover, .download-file > button:hover {
  background: var(--t-primary-600) !important;
  box-shadow: 0 4px 12px -2px color-mix(in srgb, var(--t-primary) 40%, transparent);
}
.download-file > a img, .download-file > label img { width: 16px; height: 16px; }
.download-actions { gap: 8px !important; flex-wrap: wrap; justify-content: flex-end; }
.download-actions a[title="Remove from view"] img { width: 34px; height: 34px; padding: 7px; border-radius: 10px; background: var(--t-danger-bg); }
.course-navigation > .download-file > a { min-height: 42px; }

/* Submitted item rows */
.course-overview .course-unit { max-height: none; padding-right: 0 !important; }
.course-overview .course-unit > .scrollable-container { max-height: 60vh !important; }
.course-dashboard .course-unit .unit-content {
  display: flex;
  flex-direction: column;
  gap: 12px !important;
  padding: 16px 18px !important;
  border-top: 0 !important;
  border-bottom: 1px solid var(--t-border);
}
.course-dashboard .course-unit .unit-content:hover { background: #fff; }
.unit-row-top { gap: 16px; }
.unit-content .unit-name { width: auto !important; flex: 1; min-width: 0; }
.unit-name p { color: var(--t-ink) !important; font-weight: 600 !important; font-size: 13.5px !important; word-break: break-word; }
.trainer-feedback textarea, .feedback textarea {
  min-height: 44px !important;
  border-radius: 10px !important;
  border: 1px solid var(--t-border-2) !important;
  padding: 10px 12px !important;
  font-size: 13.5px;
}
.unit-content .status { width: auto !important; height: auto !important; background: transparent !important; border-radius: 0 !important; }
.unit-content .status select, .status select {
  width: 190px !important;
  min-height: 44px;
  border-radius: 10px !important;
  border: 1px solid var(--t-border-2) !important;
  padding-left: 14px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
}
.status select.satisfactory { border-color: var(--t-success) !important; background-color: var(--t-success) !important; }
.status select.not-satisfactory { border-color: var(--t-danger) !important; background-color: var(--t-danger) !important; }

/* Final result row */
.final-submission { align-items: center; gap: 12px; padding: 16px; margin-top: 18px !important; border: 1px solid var(--t-border); border-radius: var(--t-radius); background: var(--t-row); }
.final-result { width: 260px !important; margin: 0 !important; height: auto !important; background: transparent !important; border-radius: 10px !important; }
.final-submission .final-result select, .final-result select {
  width: 100% !important;
  min-height: 46px;
  border-radius: 10px !important;
  border: 1px solid var(--t-border-2) !important;
  background-color: #fff !important;
  text-align: left !important;
  padding-left: 14px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  color: var(--t-ink) !important;
}
.final-submission .submit-btn { flex: 1; }
.final-submission .submit-btn button, form .submit-btn button { width: 100% !important; max-width: none !important; min-height: 46px; font-size: 15px !important; }
.course-dashboard .final-submission .download-file.submit-btn > button[type="submit"] { width: 100% !important; min-height: 46px !important; font-size: 15px !important; }
.date-field { display: flex; align-items: center; gap: 10px; }
#mark_without_submission + strong, label:has(> #mark_without_submission) { font-weight: 500; color: var(--t-text); font-size: 13.5px; line-height: 1.6; }
label:has(> #mark_without_submission) {
  display: block;
  position: relative;
  padding-left: 44px !important;
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px dashed var(--t-border-2);
  border-radius: var(--t-radius);
  background: #fff;
}
label:has(> #mark_without_submission) input { position: absolute; left: 16px; top: 17px; margin: 0; }
label:has(> #mark_without_submission) strong { color: var(--t-ink); font-weight: 700; }
#ars-section { margin-top: 14px; padding: 12px 16px !important; border: 1px solid var(--t-border) !important; border-radius: var(--t-radius); background: var(--t-row); }
#ars-section .unit-row-top { align-items: center; }

/* Result / feedback side panel */
.feedback-page {
  flex: 0 0 340px;
  width: 340px !important;
  padding: 0 0 0 28px !important;
  border-left: 1px solid var(--t-border);
  align-self: stretch;
}
.feedback-page > p, .feedback-section > p {
  color: var(--t-ink) !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  margin: 0 0 14px !important;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--t-border);
}
.feedbacks { padding-right: 4px !important; }
.feedback-one {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--t-border);
  border-radius: var(--t-radius);
  background: #fff;
}
.feedback-one .feedback-item:last-child { border-bottom: 0 !important; }
.feedback-header { margin-top: 0 !important; margin-bottom: 10px !important; gap: 8px; flex-wrap: wrap; }
.feedback-profile p { color: var(--t-ink) !important; font-size: 13.5px !important; font-weight: 700 !important; }
.feedback-profile-name {
  width: 32px !important;
  height: 32px !important;
  line-height: 32px !important;
  border-radius: 999px !important;
  background: var(--t-primary-100) !important;
  color: var(--t-primary-700) !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}
.duration-competent { align-items: center; gap: 6px; }
.duration-competent .border-right { display: none; }
.duration-competent p, .duration-competent .competent p, .duration-competent .remaining p {
  height: auto !important;
  padding: 3px 10px !important;
  border-radius: 999px !important;
  font-size: 11.5px !important;
  font-weight: 700 !important;
  line-height: 1.5;
}
.duration-competent .competent p { background: var(--t-row); color: var(--t-ink); border: 1px solid var(--t-border); }
.duration-competent .remaining p { background: var(--t-ink) !important; color: #fff !important; }
.item-header { font-size: 13px !important; gap: 8px; padding: 6px 0; }
.item-title { font-weight: 600 !important; color: var(--t-text); word-break: break-word; }
.description { color: var(--t-muted) !important; font-size: 12.5px !important; }
.feedback-tags .item-bg { border: 1px solid var(--t-border) !important; border-radius: 10px !important; background: var(--t-row) !important; }

.course-navigation .back-button, .headline .back-button, .course-info .back-button { align-self: flex-start; flex-shrink: 0; height: auto !important; }
.headline { display: flex; align-items: flex-start; gap: 12px; }
.duration-competent p { white-space: nowrap; }
.course-unit > p[style*="text-align: center"], .course-dashboard .course-unit > p {
  margin: 0;
  padding: 18px;
  background: var(--t-success-bg);
  color: var(--t-success) !important;
  font-size: 14px !important;
  font-weight: 700 !important;
}
.assessment-status { gap: 6px !important; font-size: 13px; font-weight: 600; color: var(--t-muted); white-space: nowrap; }
.assessment-status p { color: inherit !important; font-weight: 600 !important; }
.assessment-status.true { color: var(--t-success) !important; }
.assessment-status img { width: 18px; height: 18px; }

/* Student unit page (all-assessments) */
.course-dashboard .headline { gap: 16px; align-items: flex-start; }
.course-dashboard .headline .back-button { margin-top: 2px; }
.assessment-status { padding: 6px 12px; border-radius: 999px; background: var(--t-row); border: 1px solid var(--t-border); }
.assessment-status.true { background: var(--t-success-bg) !important; border-color: #bbf7d0; }
.course-dashboard div[style^="margin-top:10px"] > div[style^="display: flex"] { align-items: center; gap: 12px; margin-top: 16px; }
.course-dashboard .download-file > label[for="file-upload"],
.course-dashboard .download-file > button[type="submit"] {
  min-height: 44px !important;
  width: auto !important;
  min-width: 150px;
  padding: 10px 18px !important;
  margin: 0 !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
}

/* Result panel: cards use the full width; result pill never spills out */
.feedbacks .scrollable-container { padding-right: 0 !important; }
.feedback-one { width: 100%; }
.feedback-header { align-items: flex-start; }
.duration, .duration-competent { max-width: 100%; }
.duration-competent { flex-wrap: wrap; justify-content: flex-start; }
.duration-competent p { width: auto !important; max-width: 100%; justify-content: flex-start !important; white-space: normal; text-align: left; }
.duration-competent .remaining p:empty, .duration-competent .remaining:has(p:empty) { display: none; }

/* Student units list: name | date of result | result (no empty 6th column) */
.course-unit:has(.unit-result) .unit-border { grid-template-columns: minmax(0, 1fr) 150px 260px; }
.course-unit:has(.unit-result) .unit-border > :first-child { grid-column: auto; }
.course-unit:has(.unit-result) .unit-border > * { text-align: left !important; justify-self: start; }
.unit-result { white-space: nowrap; }

/* Marking page (student-submissions): even padding in the file list */
.course-dashboard .course-unit > .scrollable-container { padding-right: 0 !important; }
.course-dashboard .course-unit > .scrollable-container > .unit-content:last-child { border-bottom: 0; }
.unit-row-bottom { gap: 12px !important; }
.final-submission { margin-top: 16px !important; }

/* Result panel with no results yet: the page prints an empty card */
.feedback-one:has(> span:only-child:empty) { border-style: dashed; background: var(--t-row); }
.feedback-one:has(> span:only-child:empty)::before {
  content: "No results yet";
  display: block;
  padding: 10px 0;
  text-align: center;
  color: var(--t-muted);
  font-size: 13px;
  font-weight: 600;
}
.feedbacks > .tag-border-bottom:first-child { display: none; }

/* Modal (course-batches legend etc.) */
.modal-content { border-radius: var(--t-radius-lg) !important; border: 1px solid var(--t-border); box-shadow: var(--t-shadow-lg) !important; }

/* ==========================================================================
   ADMIN: assigned-course chips (all-trainers / all-admins)
   ========================================================================== */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.course-chips { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px; min-width: 230px; max-width: 360px; }
.course-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--t-primary-100);
  background: var(--t-primary-50);
  color: var(--t-primary-700);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
  cursor: default;
}
.course-chip__tag {
  padding: 0 5px;
  border-radius: 999px;
  background: var(--t-primary);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.6;
}
.course-chip--more, .course-chip--all { cursor: pointer; border-color: var(--t-border-2); background: #fff; color: var(--t-text); }
.course-chip--more:hover, .course-chip--all:hover { border-color: var(--t-primary-200); color: var(--t-primary-700); }
.course-chip--all b { margin-left: 2px; padding: 0 6px; border-radius: 999px; background: var(--t-primary); color: #fff; font-size: 10.5px; }
.course-chips__more { display: contents; }
.course-chips__more > summary { list-style: none; display: inline-flex; }
.course-chips__more > summary::-webkit-details-marker { display: none; }
.course-chips__more[open] > summary .course-chip--more { font-size: 0; }
.course-chips__more[open] > summary .course-chip--more::after { content: "Show less"; font-size: 12px; }
.course-chips__extra { display: contents; }
.course-chips__extra > * { order: 1; }
.course-chips__more[open] > summary:has(.course-chip--more) { order: 2; }
.course-chips__more:not([open]) > .course-chips__extra { display: none; }
.course-chips__none { color: var(--t-subtle); font-size: 12.5px; font-style: italic; }

/* ==========================================================================
   ADMIN: edit-student-enrolled-unit summary header
   ========================================================================== */
.eu-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  padding-bottom: 22px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--t-border);
}
.eu-student { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.eu-student__avatar {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: var(--t-gradient);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
}
.eu-student__text { display: flex; flex-direction: column; min-width: 0; }
.eu-student__name { margin: 0; color: var(--t-ink); font-size: 22px !important; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.eu-student__id { color: var(--t-muted); font-size: 13px; font-weight: 600; }
.eu-badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}
.eu-badge::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: currentColor; }
.eu-badge--success { background: #dcfce7; color: #15803d; }
.eu-badge--info    { background: #cffafe; color: #0e7490; }
.eu-badge--danger  { background: #fee2e2; color: #b91c1c; }
.eu-badge--warning { background: #ffedd5; color: #c2410c; }
.eu-badge--violet  { background: #ede9fe; color: #6d28d9; }
.eu-badge--teal    { background: #ccfbf1; color: #0f766e; }
.eu-badge--neutral { background: var(--t-row); color: var(--t-muted); border: 1px solid var(--t-border); }

.eu-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  border: 1px solid var(--t-border);
  border-radius: var(--t-radius);
  background: var(--t-border);
  overflow: hidden;
}
.eu-fact { padding: 12px 16px; background: #fff; }
.eu-fact--wide { grid-column: 1 / -1; }
.eu-fact dt { margin-bottom: 4px; color: var(--t-muted); font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.eu-fact dd { margin: 0; color: var(--t-ink); font-size: 14px; font-weight: 600; line-height: 1.45; }
.eu-units { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.eu-units li { display: flex; align-items: baseline; gap: 10px; }
.eu-units-flat { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 8px; }
.eu-code {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--t-primary-50);
  border: 1px solid var(--t-primary-100);
  color: var(--t-primary-700);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
}

.eu-summary__side { display: flex; flex-direction: column; gap: 12px; }
.eu-panel { padding: 14px 16px; border: 1px solid var(--t-border); border-radius: var(--t-radius); background: var(--t-row); }
.eu-due-row { display: flex; gap: 8px; align-items: center; width: 100%; }
.eu-due-row #dueDateField { flex: 1; max-width: none !important; background: #fff; }
.eu-actions { display: flex !important; flex-direction: column; gap: 8px !important; }
.eu-actions > a { width: 100% !important; justify-content: center; margin: 0 !important; }
.eu-actions > a.eu-actions__secondary { background: #fff !important; color: var(--t-ink) !important; border: 1px solid var(--t-border-2) !important; }
.eu-actions > a.eu-actions__secondary img { filter: brightness(0) saturate(0) opacity(.7); }
.eu-actions__empty { padding: 12px; border: 1px dashed var(--t-border-2); border-radius: 10px; color: var(--t-muted); font-size: 13px; font-weight: 600; text-align: center; }
.eu-approve { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.eu-approve button { width: 100% !important; margin: 0 !important; }
.eu-approve .eu-approve__yes { background: var(--t-success) !important; }
.eu-approve .eu-approve__yes:hover { background: #15803d !important; }
.eu-approve .eu-approve__no { background: var(--t-danger) !important; }
.eu-approve .eu-approve__no:hover { background: #b91c1c !important; }

@media (max-width: 1024px) {
  .eu-summary { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .eu-facts { grid-template-columns: 1fr; }
  .eu-badge { margin-left: 0; }
  .eu-student__name { font-size: 19px !important; }
  .eu-units li { flex-direction: column; gap: 4px; }
}

/* ==========================================================================
   MODALS (admin dashboard: submission status + figures)
   ========================================================================== */
body.modal-open { overflow: hidden; }
.portal-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, .55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: portal-modal-fade .15s ease-out;
}
.portal-modal__dialog {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: calc(100vh - 48px);
  background: #fff;
  border-radius: 20px;
  box-shadow: var(--t-shadow-lg);
  overflow: hidden;
  animation: portal-modal-pop .18s ease-out;
}
.portal-modal__dialog--sm { max-width: 640px; }
.portal-modal__dialog--xl { max-width: 1400px; height: calc(100vh - 48px); }
.portal-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--t-border);
  background:
    linear-gradient(90deg, var(--t-primary-50), transparent 60%),
    #fff;
}
.portal-modal__heading { min-width: 0; }
.portal-modal__eyebrow {
  display: inline-block;
  margin-bottom: 4px;
  color: var(--t-primary-700);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.portal-modal__title { margin: 0; color: var(--t-ink); font-size: 20px !important; font-weight: 800; letter-spacing: -0.02em; text-align: left !important; }
.portal-modal__subtitle { margin: 2px 0 0; color: var(--t-muted) !important; font-size: 13.5px !important; font-weight: 500 !important; }
.portal-modal__close {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--t-border) !important;
  border-radius: 12px !important;
  background: #fff !important;
  color: var(--t-muted) !important;
  float: none !important;
  font-size: 0 !important;
  cursor: pointer;
  transition: all .15s ease;
}
.portal-modal__close:hover { background: var(--t-row) !important; color: var(--t-ink) !important; border-color: var(--t-border-2) !important; }
.portal-modal__body { flex: 1; min-height: 0; overflow: auto; padding: 24px; }
.portal-modal__body--flush { padding: 0; display: flex; flex-direction: column; }
.portal-modal__state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 160px;
  padding: 24px;
  color: var(--t-muted);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}
.portal-modal__state--error { color: var(--t-danger); }
.portal-spinner {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid var(--t-primary-200);
  border-top-color: var(--t-primary);
  animation: portal-spin .7s linear infinite;
}
@keyframes portal-spin { to { transform: rotate(360deg); } }
@keyframes portal-modal-fade { from { opacity: 0; } }
@keyframes portal-modal-pop { from { opacity: 0; transform: translateY(8px) scale(.99); } }

/* ---- Submission status matrix ---- */
.status-matrix { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.sm-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--t-border);
  background: #fff;
}
.sm-summary { color: var(--t-muted); font-size: 13px; font-weight: 500; white-space: nowrap; }
.sm-summary strong { color: var(--t-ink); font-weight: 800; }
.sm-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; padding: 0; list-style: none; }
.sm-legend li { display: inline-flex; align-items: center; gap: 6px; color: var(--t-text); font-size: 12px; font-weight: 600; white-space: nowrap; }
.sm-legend b { color: var(--t-muted); font-weight: 700; }
.sm-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; padding: 0 !important; }
.sm-legend .sm-dot { background: currentColor !important; }
.sm-dot--moved { color: var(--t-danger); }

.sm-scroll { flex: 1; min-height: 0; overflow: auto; }
.status-matrix .status-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}
.status-matrix .status-table th, .status-matrix .status-table td {
  height: auto;
  min-width: 0;
  padding: 6px;
  border-bottom: 1px solid var(--t-border);
  border-right: 1px solid var(--t-border);
  background: #fff;
  vertical-align: middle;
  text-align: left;
}
/* sticky header row */
.status-matrix thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--t-row);
  vertical-align: bottom;
  padding: 10px 10px 12px;
}
.sm-unit { width: 150px; min-width: 150px; max-width: 150px; }
.sm-unit__code { display: block; color: var(--t-ink); font-size: 12px; font-weight: 800; letter-spacing: .01em; word-break: break-all; }
.sm-unit__name {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 3px;
  color: var(--t-muted);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.35;
  text-transform: none;
  letter-spacing: 0;
}
.sm-unit__badge {
  display: inline-block;
  margin-top: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--t-success-bg);
  color: var(--t-success);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}
.sm-unit.is-opened { box-shadow: inset 0 3px 0 var(--t-success); }

/* sticky student column */
.status-matrix .sm-corner, .status-matrix .sm-student {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 210px;
  min-width: 210px;
  max-width: 210px;
  padding: 10px 14px !important;
  background: #fff;
  box-shadow: 1px 0 0 var(--t-border), 6px 0 12px -10px rgba(15, 23, 42, .25);
}
.status-matrix .sm-corner {
  z-index: 3;
  background: var(--t-row);
  color: var(--t-muted);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.sm-student__name { display: block; color: var(--t-ink); font-size: 13px; font-weight: 700; line-height: 1.3; }
.sm-student__id { display: block; margin-top: 2px; color: var(--t-subtle); font-size: 11.5px; font-weight: 600; }
.sm-student.is-moved { box-shadow: inset 3px 0 0 var(--t-danger), 1px 0 0 var(--t-border), 6px 0 12px -10px rgba(15, 23, 42, .25); }
.sm-student.is-moved .sm-student__name { color: var(--t-danger); }
.status-matrix tbody tr:hover th, .status-matrix tbody tr:hover td { background: var(--t-row); }

/* chips */
.sm-link { display: block; text-decoration: none; border-radius: 9px; }
.sm-link:focus-visible { outline-offset: 1px; }
.sm-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 6px 8px;
  border-radius: 9px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.sm-link:hover .sm-chip { transform: translateY(-1px); box-shadow: 0 4px 10px -4px rgba(15, 23, 42, .3); filter: saturate(1.15); }
.sm-chip--competent              { background: #dcfce7; color: #15803d; }
.sm-chip--admin-approval-pending { background: #cffafe; color: #0e7490; }
.sm-chip--not-yet-competent      { background: #fee2e2; color: #b91c1c; }
.sm-chip--continuing             { background: #ffedd5; color: #c2410c; }
.sm-chip--re-submission          { background: #ede9fe; color: #6d28d9; }
.sm-chip--no-submissions         { background: #fef9c3; color: #a16207; }
.sm-chip--credit-transfer        { background: #ccfbf1; color: #0f766e; }
.sm-chip--enrolled-other         { background: #dbeafe; color: #1d4ed8; }
.sm-chip--other                  { background: var(--t-row); color: var(--t-text); }
.sm-empty { text-align: center !important; }
.sm-empty span { color: var(--t-border-2); font-weight: 700; }

/* ---- Submission figures ---- */
.figures { display: flex; flex-direction: column; gap: 18px; }
.fig-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.fig-tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px;
  border: 1px solid var(--t-border);
  border-radius: 14px;
  background: #fff;
}
.fig-tile__label { color: var(--t-muted); font-size: 12.5px; font-weight: 600; }
.fig-tile__value { color: var(--t-ink); font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.fig-tile__hint { color: var(--t-subtle); font-size: 12px; font-weight: 500; }
.fig-tile--accent { background: var(--t-primary-50); border-color: var(--t-primary-100); }
.fig-tile--accent .fig-tile__value { color: var(--t-primary-700); }
.fig-tile--success { background: var(--t-success-bg); border-color: #bbf7d0; }
.fig-tile--success .fig-tile__value { color: var(--t-success); }
.fig-progress { padding: 14px 16px; border: 1px solid var(--t-border); border-radius: 14px; }
.fig-progress__top { display: flex; justify-content: space-between; align-items: baseline; color: var(--t-ink); font-size: 13.5px; font-weight: 700; }
.fig-progress__top b { font-size: 16px; font-weight: 800; color: var(--t-primary-700); }
.fig-progress__track { height: 8px; margin: 10px 0 8px; border-radius: 999px; background: var(--t-row); overflow: hidden; box-shadow: inset 0 0 0 1px var(--t-border); }
.fig-progress__track span { display: block; height: 100%; border-radius: inherit; background: var(--t-gradient); }
.fig-progress__detail { color: var(--t-muted); font-size: 12.5px; }

@media (max-width: 768px) {
  .portal-modal { padding: 0; align-items: stretch; }
  .portal-modal__dialog, .portal-modal__dialog--xl { max-width: none; max-height: none; height: 100%; border-radius: 0; }
  .portal-modal__dialog--sm { height: auto; max-height: 100%; margin-top: auto; border-radius: 20px 20px 0 0; }
  .portal-modal__header { padding: 16px; }
  .portal-modal__body { padding: 16px; }
  .portal-modal__body--flush { padding: 0; }
  .sm-toolbar { padding: 12px 16px; }
  .status-matrix .sm-corner, .status-matrix .sm-student { width: 130px; min-width: 130px; max-width: 130px; padding: 8px 10px !important; }
  .sm-unit { width: 120px; min-width: 120px; max-width: 120px; }
  .fig-tile__value { font-size: 24px; }
}
@media (max-width: 420px) {
  .fig-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   SWEETALERT 2
   ========================================================================== */
div:where(.swal2-container) div:where(.swal2-popup) {
  border-radius: 20px !important;
  padding: 28px 24px 24px !important;
  box-shadow: var(--t-shadow-lg);
}
div:where(.swal2-container) h2:where(.swal2-title) { color: var(--t-ink) !important; font-size: 20px !important; font-weight: 700 !important; }
div:where(.swal2-container) div:where(.swal2-html-container) { color: var(--t-muted) !important; font-size: 14.5px !important; }
div:where(.swal2-container) button:where(.swal2-styled) {
  border-radius: 10px !important;
  padding: 10px 20px !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  box-shadow: none !important;
}
div:where(.swal2-container) button:where(.swal2-styled).swal2-confirm { background: var(--t-primary) !important; color: #fff !important; }
div:where(.swal2-container) button:where(.swal2-styled).swal2-confirm:hover { background: var(--t-primary-600) !important; }
div:where(.swal2-container) button:where(.swal2-styled).swal2-cancel { background: #fff !important; color: var(--t-ink) !important; border: 1px solid var(--t-border-2) !important; }
div:where(.swal2-container) .swal2-toast { border-radius: 14px !important; padding: 12px 16px !important; }

/* ==========================================================================
   AUTH & WELCOME PAGES
   ========================================================================== */
.auth-page {
  min-height: 100vh;
  height: auto !important;
  align-items: stretch !important;
  padding: 0 !important;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  background: #fff !important;
}
.auth-visual {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  padding: 48px 56px;
  background: var(--t-gradient);
  color: #fff;
}
.auth-visual::before, .auth-visual::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: rgba(255, 255, 255, .10);
  pointer-events: none;
}
.auth-visual::before { width: 520px; height: 520px; right: -180px; top: -160px; }
.auth-visual::after  { width: 360px; height: 360px; left: -140px; bottom: -140px; background: rgba(255, 255, 255, .07); }
.auth-visual > * { position: relative; z-index: 1; }
.auth-visual__tag {
  align-self: flex-start;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .25);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #fff;
}
.auth-visual__title { color: #fff; font-size: clamp(28px, 3vw, 40px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; max-width: 520px; margin: 14px 0 10px; }
.auth-visual__text { color: rgba(255, 255, 255, .85); font-size: 15.5px; max-width: 460px; }
.auth-visual__art {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  flex: 1;
}
.auth-visual__art img {
  max-width: 100%;
  max-height: 46vh;
  object-fit: contain;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .35);
}
.auth-visual__foot { color: rgba(255, 255, 255, .7); font-size: 12.5px; }

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  background:
    radial-gradient(circle at 100% 0%, var(--t-primary-50), transparent 45%),
    #fff;
}
.auth-card { width: 100%; max-width: 400px; }
.auth-card__logo { height: 190px; width: auto; max-width: 100%; object-fit: contain; margin: 0 auto 24px; display: block; }
.auth-card > a:has(> .auth-card__logo) { display: block; }
.auth-card__title { text-align: center; margin-bottom: 24px !important; }
.auth-card__title { font-size: 28px; font-weight: 800; color: var(--t-ink); letter-spacing: -0.025em; margin: 0 0 6px; }
.auth-card__subtitle { color: var(--t-muted); font-size: 14.5px; margin: 0 0 28px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field__label { font-size: 13px; font-weight: 600; color: var(--t-text); }
.auth-field__control { position: relative; }
.auth-field__control svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--t-subtle);
  pointer-events: none;
}
.auth-field__control input {
  width: 100%;
  min-height: 48px;
  padding-left: 44px !important;
  font-size: 15px;
  border-radius: 12px;
}
.auth-row { display: flex; justify-content: flex-end; margin-top: -4px; }
.auth-link { color: var(--t-primary-700); font-size: 13.5px; font-weight: 600; text-decoration: none; }
.auth-link:hover { text-decoration: underline; }
.auth-form button[type="submit"] { width: 100%; min-height: 50px; font-size: 15px; border-radius: 12px; margin-top: 4px; }
.auth-switch { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--t-border); color: var(--t-muted); font-size: 13.5px; text-align: center; }
.auth-switch a { color: var(--t-primary-700); font-weight: 600; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

/* Admin login: single centred card */
.auth-page--single { grid-template-columns: 1fr; }
.auth-page--single .auth-panel {
  background:
    radial-gradient(circle at 0% 0%, var(--t-primary-100), transparent 40%),
    radial-gradient(circle at 100% 100%, color-mix(in srgb, var(--t-secondary) 10%, #fff), transparent 45%),
    var(--t-bg);
}
.auth-page--single .auth-card {
  max-width: 440px;
  padding: 40px 36px;
  background: #fff;
  border: 1px solid var(--t-border);
  border-radius: 24px;
  box-shadow: var(--t-shadow-lg);
}
.auth-badge {
  display: flex;
  width: fit-content;
  margin-left: auto !important;
  margin-right: auto !important;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  margin-bottom: 14px;
  border-radius: 999px;
  background: var(--t-primary-100);
  color: var(--t-primary-700);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
}

/* Welcome / role chooser */
.welcome-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  background:
    radial-gradient(circle at 10% 10%, var(--t-primary-100), transparent 35%),
    radial-gradient(circle at 90% 90%, color-mix(in srgb, var(--t-secondary) 12%, #fff), transparent 40%),
    var(--t-bg);
}
.welcome-card { width: 100%; max-width: 920px; text-align: center; }
.welcome-card__logo { height: 240px; width: auto; max-width: 100%; object-fit: contain; margin: 0 auto 20px; display: block; }
.welcome-card__eyebrow { display: inline-block; padding: 6px 12px; border-radius: 999px; background: var(--t-primary-100); color: var(--t-primary-700); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.welcome-card__title { margin: 14px auto 8px; max-width: 720px; font-size: clamp(28px, 4vw, 42px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; color: var(--t-ink); }
.welcome-card__subtitle { color: var(--t-muted); font-size: 16px; margin-bottom: 36px; }
.welcome-card__title { margin-bottom: 32px; }
.role-card { align-items: center; }
.role-card__title { margin: 0; font-size: 22px; }
.role-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.role-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px;
  text-align: left;
  text-decoration: none;
  background: #fff;
  border: 1px solid var(--t-border);
  border-radius: 20px;
  box-shadow: var(--t-shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.role-card:hover { transform: translateY(-3px); box-shadow: var(--t-shadow); border-color: var(--t-primary-200); }
.role-card__icon {
  width: 88px;
  height: 88px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  overflow: hidden;
}
.role-card__icon img { width: 78px; height: 78px; object-fit: contain; }
.role-card--student .role-card__icon { background: var(--t-gradient); }
.role-card--trainer .role-card__icon { background: var(--t-gradient-2); }
.role-card__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.role-card__title, .role-card__text { display: block; }
.role-card__title { font-size: 20px; font-weight: 700; color: var(--t-ink); margin: 0 0 4px; }
.role-card__text { color: var(--t-muted); font-size: 14px; margin: 0; }
.role-card__arrow {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--t-primary-50);
  color: var(--t-primary-700);
  transition: background .2s ease, color .2s ease;
}
.role-card:hover .role-card__arrow { background: var(--t-primary); color: #fff; }
.welcome-foot { margin-top: 36px; color: var(--t-subtle); font-size: 12.5px; }
.welcome-foot a { color: var(--t-muted); text-decoration: none; font-weight: 600; }
.welcome-foot a:hover { color: var(--t-primary-700); }

/* Unsupported-device screen (student/trainer login) */
#supported_devices { background: var(--t-bg) !important; }
#main_heading { color: var(--t-ink) !important; font-weight: 800; letter-spacing: -0.02em; }
.circle { box-shadow: var(--t-shadow) !important; }
.title { color: var(--t-ink) !important; font-weight: 700; letter-spacing: .06em; }
.caution { color: var(--t-muted) !important; }

/* ==========================================================================
   Responsive
   Breakpoints: 1024px (tablet: sidebar becomes a drawer), 768px (phone
   landscape / small tablet), 480px (phone).
   ========================================================================== */

/* Table scroll wrapper (added by theme.js). Invisible on desktop so sticky
   headers inside existing scroll containers keep working. */
.table-scroll { display: contents; }

/* Hamburger (admin top bar) + drawer backdrop: hidden on desktop */
.topbar__menu {
  display: none;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--t-border);
  border-radius: 12px;
  background: #fff;
  color: var(--t-ink);
  cursor: pointer;
}
.topbar__menu:hover { background: var(--t-primary-50); border-color: var(--t-primary-200); color: var(--t-primary-700); }
.sidebar-backdrop { display: none; }

/* Undo the legacy dashboard.css "mobile" rules that turned every table into
   stacked blocks labelled "Transactions / Date / Amount / Status", hid the
   sidebar entirely and stacked the top bar. */
@media (max-width: 780px) {
  table { display: table !important; }
  thead { display: table-header-group !important; }
  tbody { display: table-row-group !important; }
  tr { display: table-row !important; }
  th, td { display: table-cell !important; position: static !important; top: auto !important; left: auto !important; }
  td { padding-left: 14px !important; }
  tr > td:not(.text-center) { text-align: left !important; }
  td::before { content: none !important; }
  tr > td:first-child { justify-content: flex-start !important; }
  .top-container { flex-direction: row !important; }
}

@media (max-width: 1100px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
}

/* ---------- Tablet & below ---------- */
@media (max-width: 1024px) {
  /* Admin shell: sidebar becomes an off-canvas drawer */
  .container:has(> .sidebar) { display: block; height: auto; min-height: 100vh; }
  .sidebar {
    display: flex !important;
    position: fixed !important;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1100 !important;
    width: 280px !important;
    max-width: 86vw;
    transform: translateX(-100%);
    transition: transform .25s ease, box-shadow .25s ease;
    box-shadow: none;
  }
  body.sidebar-open .sidebar { transform: none; box-shadow: var(--t-shadow-lg); }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1090;
    background: rgba(15, 23, 42, .45);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
  }
  body.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  body.sidebar-open { overflow: hidden; }
  .side-nav__item.side-nav__item-active::before { left: -16px; }
  .topbar__menu { display: inline-flex; }
  .top-container { justify-content: flex-start; }
  .top-container .user-nav { margin-left: auto; }
  .main-content { overflow: visible; min-height: 100vh; }

  /* Wide tables scroll sideways inside their card */
  .table-scroll {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--t-border);
    border-radius: var(--t-radius);
  }
  .table-scroll > table { min-width: 640px; border: 0 !important; border-radius: 0 !important; }
  .table-scroll td:has(> .action-btn), .table-scroll td:has(> a > .action-btn), .table-scroll td:last-child { white-space: nowrap; }

  /* Bottom area / cards */
  .bottom-container { flex-direction: column; padding: 20px 20px 32px !important; }
  .bottom-container__left, .bottom-container__right { width: 100% !important; max-width: none !important; }
  .bottom-container__left[style*="max-width"] { max-width: none !important; }

  /* Assessment / marking pages: results panel drops below the files */
  .course-overview.trainer-portal, .course-overview:has(> .course-dashboard) { flex-direction: column; }
  .course-dashboard { width: 100% !important; }
  .feedback-page {
    width: 100% !important;
    flex: 1 1 auto;
    padding: 24px 0 0 !important;
    border-left: 0;
    border-top: 1px solid var(--t-border);
  }

  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-layout { grid-template-columns: minmax(0, 1fr); }
  .dashboard-layout .bottom-container__right { position: static; }

  /* Fixed-size popups from the legacy stylesheets */
  .submit-file-popup { width: min(415px, 92vw) !important; height: auto !important; min-height: 320px; padding: 28px 20px !important; }
  .submit-file-popup span { width: 100% !important; }
  .modal-content { width: 94% !important; height: auto !important; max-height: 92vh; padding: 16px !important; }
  .swal-wide { width: 94vw !important; }
}

/* ---------- Small tablet / large phone ---------- */
@media (max-width: 768px) {
  .bottom-container { padding: 16px 12px 28px !important; gap: 16px; }
  .box { padding: 18px !important; border-radius: 14px !important; }
  .form-box { padding: 0 !important; }
  .form-box > h2, .box > h2, .bottom-container h2 { font-size: 19px; }
  .top-container { padding: 10px 12px !important; min-height: 60px; gap: 10px; }
  .topbar__heading { font-size: 16px; }
  .topbar__eyebrow { font-size: 10.5px; }

  /* Form rows stack */
  .d-flex:not(.justify-content-center) { flex-direction: column; gap: 0; }
  .input-control.half { width: 100% !important; }
  .form-box .name { width: 100% !important; }
  .form-box .status { width: auto !important; margin-left: 0 !important; padding-top: 4px !important; }
  .form-box .d-flex.justify-content-center, .input-control.d-flex.justify-content-center { justify-content: stretch; }
  .form-box .d-flex.justify-content-center .form-btn, .input-control.d-flex.justify-content-center .form-btn { width: 100%; }

  /* List headers: title / search / add button wrap */
  .header-container { flex-direction: column; align-items: stretch; }
  .header-container > * { width: 100% !important; max-width: none !important; }
  .header-container .d-flex { flex-direction: row !important; flex-wrap: wrap; gap: 8px; }
  .header-container a.form-btn.side-nav__item { width: 100%; justify-content: center; }
  .header-container form, .header-container input, .header-container select { max-width: 100% !important; }
  .student-searchbar { max-width: none !important; }

  .stat-card { padding: 14px; gap: 10px; }
  .stat-card__icon { width: 38px; height: 38px; border-radius: 12px; }
  .stat-card__value { font-size: 22px; }
  .stat-card__label { font-size: 12px; }

  .ou-form-box > div[style*="space-between"] { flex-wrap: wrap; gap: 12px; }
  .back-button p { white-space: nowrap; }

  /* Admin "edit enrolled unit": results + extensions stack */
  .main-container { display: flex !important; flex-direction: column !important; gap: 16px; }
  .main-container > .feedback-section, .main-container > .extension-section { width: 100% !important; max-width: none !important; flex: 1 1 auto !important; }
  .download-all, .download-all > div { flex-wrap: wrap; }
  .download-all a[style*="width"] { width: auto !important; }
  .feedback-tags .tag-one { flex-direction: column; }

  /* Units list on course page */
  .units_list li { flex-direction: column; align-items: stretch; gap: 8px; }
  .units_list li .left, .units_list li .right { width: 100% !important; }
  .add-unit { position: static !important; width: fit-content; margin-bottom: 12px; }

  /* ---- Trainer / student portal ---- */
  .wrapper:has(> .dashboard) { padding: 0 12px; }
  .portal-topbar { margin-bottom: 16px; }
  .portal-topbar__inner { min-height: 60px; gap: 8px; }
  .portal-brand img { height: 50px; }
  .portal-brand__label, .portal-user__name, .user-chip__text { display: none; }
  .portal-user { padding: 3px; }
  .portal-actions { gap: 6px; }

  .notification-panel {
    position: fixed !important;
    top: 66px !important;
    left: 12px !important;
    right: 12px !important;
    width: auto !important;
  }

  .course-overview { padding: 18px !important; border-radius: 14px !important; }
  .course-navigation { flex-direction: column; align-items: stretch; gap: 12px; }
  .course-overview .headline p, .headline p { font-size: 20px !important; }
  div:has(> .back-button):has(> .headline) > .back-button:not(:has(p:not(:empty))) { margin-top: -8px; width: 38px !important; height: 38px !important; min-width: 38px; }
  div:has(> .back-button):has(> .course-navigation > .headline) > .back-button:not(:has(p:not(:empty))) { margin-top: -8px; width: 38px !important; height: 38px !important; min-width: 38px; }
  div:has(> .back-button):has(> .course-navigation > .headline) { flex-direction: row !important; }
  .course-navigation .download-resource a, .course-navigation > div > a.back-button[href*="open-unit"] { width: 100% !important; justify-content: center; }

  /* Grid rows (courses / units / batches / students) become stacked cards */
  .unit-heading { display: none !important; }
  .unit-border {
    grid-template-columns: 1fr !important;
    row-gap: 8px;
    padding: 14px !important;
  }
  .unit-border > *, .unit-border :first-child { grid-column: auto !important; text-align: left !important; justify-self: start !important; }
  .unit-content .date p, .unit-content > p { color: var(--t-muted) !important; font-size: 13px !important; }
  .scrollable-container { max-height: none !important; }

  /* Marking / submission rows */
  .unit-row-top, .unit-row-bottom { flex-direction: column; align-items: stretch !important; }
  .trainer-feedback, .trainer-feedback textarea { width: 100% !important; }
  /* Student unit page: file rows and the upload / submit bar */
  .course-unit[style*="max-height"] { max-height: none !important; }
  .course-dashboard .unit-content[style*="flex-direction: row"] { flex-direction: column !important; align-items: flex-start !important; }
  .course-dashboard .unit-content[style*="flex-direction: row"] .unit-name { width: 100% !important; }
  .course-dashboard div[style^="display: flex"]:not(:has(> .headline)) { flex-wrap: wrap; gap: 10px; }
  .course-dashboard .file-list { flex: 1 1 100% !important; }
  .course-dashboard .download-file { flex: 1 1 auto; }
  .course-dashboard .download-file > label[style*="width"], .course-dashboard .download-file > button[style*="width"],
  .course-dashboard .download-file > a[style*="width"] { width: 100% !important; margin-left: 0 !important; }
  .download-actions { justify-content: flex-start !important; }
  .unit-content .status select, .status select, .status { width: 100% !important; }
  .final-submission { flex-direction: column; align-items: stretch; }
  .final-result { width: 100% !important; }
  .feedback textarea { width: 100% !important; }
  .feedback-form { flex-direction: column; gap: 12px; }
  .course-overview .course-unit > .scrollable-container { max-height: none !important; }
  .due-date { width: 100%; }
  #dueDateField { max-width: none !important; }
  .navigation .switch-tab-btn { width: 100% !important; }
  .searchbar .form-home-search, .form-home-search { min-width: 0 !important; width: 100%; }
  .searchbar, .has-search, .fixed-location-mbl { width: 100% !important; max-width: none !important; position: static !important; }

  /* Auth & welcome */
  .auth-panel { padding: 32px 18px; align-items: flex-start; }
  .auth-card__logo { height: 140px; margin-bottom: 16px; }
  .auth-card__title { font-size: 24px; }
  .auth-page--single .auth-card { padding: 28px 20px; border-radius: 20px; }
  .welcome-page { padding: 32px 16px; align-items: flex-start; }
  .welcome-card__logo { height: 160px; }
  .welcome-card__title { font-size: 26px; margin-bottom: 24px; }
  .role-grid { grid-template-columns: 1fr; gap: 12px; }
  .role-card { padding: 16px; gap: 14px; }
  .role-card__icon { width: 64px; height: 64px; border-radius: 16px; }
  .role-card__icon img { width: 58px; height: 58px; }
}

/* ---------- Phone ---------- */
@media (max-width: 480px) {
  .stat-grid { gap: 10px; }
  .stat-card { flex-direction: column; align-items: flex-start; }
  .action-btn { padding: 6px 10px; font-size: 12px; }
  .pagination a, .pagination span { min-width: 32px; height: 32px; padding: 0 9px !important; }
  .approval-item { flex-direction: column; align-items: stretch; }
  .approval-item .action-btn { width: 100%; }
  .welcome-card__logo { height: 130px; }
  .auth-card__logo { height: 120px; }
  div:where(.swal2-container) div:where(.swal2-popup) { padding: 22px 16px 18px !important; }
}
