/* ============================================================
   Stitch Design System — Academic Matrix Pro
   Tokens & Utility Classes
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
  --stitch-primary: #2e5bff;
  --stitch-primary-on: #ffffff;
  --stitch-primary-container: #2e5bff;
  --stitch-primary-on-container: #efefff;
  --stitch-primary-fixed: #dde1ff;
  --stitch-primary-fixed-dim: #b8c3ff;
  --stitch-primary-text: #0040e0;
  --stitch-on-primary-fixed: #001356;
  --stitch-on-primary-fixed-variant: #0035be;
  --stitch-inverse-primary: #b8c3ff;

  --stitch-surface: #f7f9fb;
  --stitch-surface-bright: #f7f9fb;
  --stitch-surface-dim: #d8dadc;
  --stitch-surface-container-lowest: #ffffff;
  --stitch-surface-container-low: #f2f4f6;
  --stitch-surface-container: #eceef0;
  --stitch-surface-container-high: #e6e8ea;
  --stitch-surface-container-highest: #e0e3e5;
  --stitch-on-surface: #191c1e;
  --stitch-on-surface-variant: #434656;
  --stitch-inverse-surface: #2d3133;
  --stitch-inverse-on-surface: #eff1f3;

  --stitch-secondary: #505f76;
  --stitch-secondary-on: #ffffff;
  --stitch-secondary-container: #d0e1fb;
  --stitch-secondary-on-container: #54647a;
  --stitch-secondary-fixed: #d3e4fe;
  --stitch-secondary-fixed-dim: #b7c8e1;
  --stitch-on-secondary-fixed: #0b1c30;
  --stitch-on-secondary-fixed-variant: #38485d;

  --stitch-tertiary: #993100;
  --stitch-tertiary-on: #ffffff;
  --stitch-tertiary-container: #c24100;
  --stitch-tertiary-on-container: #ffece6;
  --stitch-tertiary-fixed: #ffdbcf;
  --stitch-tertiary-fixed-dim: #ffb59b;
  --stitch-on-tertiary-fixed: #380d00;
  --stitch-on-tertiary-fixed-variant: #812800;

  --stitch-error: #ba1a1a;
  --stitch-error-on: #ffffff;
  --stitch-error-container: #ffdad6;
  --stitch-error-on-container: #93000a;

  --stitch-outline: #747688;
  --stitch-outline-variant: #c4c5d9;
  --stitch-surface-variant: #e0e3e5;
  --stitch-background: #f7f9fb;
  --stitch-on-background: #191c1e;
  --stitch-surface-tint: #124af0;

  --stitch-success: #059669;
  --stitch-success-on: #ffffff;
  --stitch-success-container: #d1fae5;
  --stitch-warning: #d97706;
  --stitch-warning-on: #ffffff;
  --stitch-warning-container: #fef3c7;
  --stitch-pending: #e2e8f0;

  --stitch-font-inter: 'Inter', system-ui, -apple-system, sans-serif;

  --stitch-radius-default: 0.125rem;
  --stitch-radius-lg: 0.25rem;
  --stitch-radius-xl: 0.5rem;
  --stitch-radius-full: 0.75rem;

  --stitch-sidebar-width: 260px;
  --stitch-topbar-height: 64px;
  --stitch-gutter: 24px;
  --stitch-margin-desktop: 32px;
  --stitch-margin-mobile: 16px;
  --stitch-table-cell-padding: 12px 16px;
  --stitch-stack-gap-sm: 8px;
  --stitch-stack-gap-md: 16px;
  --stitch-stack-gap-lg: 24px;
}

/* --- Backgrounds --- */
.bg-surface { background-color: var(--stitch-surface); }
.bg-surface-dim { background-color: var(--stitch-surface-dim); }
.bg-surface-bright { background-color: var(--stitch-surface-bright); }
.bg-surface-container { background-color: var(--stitch-surface-container); }
.bg-surface-container-low { background-color: var(--stitch-surface-container-low); }
.bg-surface-container-lowest { background-color: var(--stitch-surface-container-lowest); }
.bg-surface-container-high { background-color: var(--stitch-surface-container-high); }
.bg-surface-container-highest { background-color: var(--stitch-surface-container-highest); }
.bg-primary { background-color: var(--stitch-primary); }
.bg-primary-container { background-color: var(--stitch-primary-container); }
.bg-primary-fixed { background-color: var(--stitch-primary-fixed); }
.bg-primary-fixed-dim { background-color: var(--stitch-primary-fixed-dim); }
.bg-secondary { background-color: var(--stitch-secondary); }
.bg-secondary-container { background-color: var(--stitch-secondary-container); }
.bg-secondary-fixed-dim { background-color: var(--stitch-secondary-fixed-dim); }
.bg-error { background-color: var(--stitch-error); }
.bg-error-container { background-color: var(--stitch-error-container); }
.bg-success { background-color: var(--stitch-success); }
.bg-success-container { background-color: var(--stitch-success-container); }
.bg-warning { background-color: var(--stitch-warning); }
.bg-warning-container { background-color: var(--stitch-warning-container); }
.bg-pending { background-color: var(--stitch-pending); }
.bg-outline { background-color: var(--stitch-outline); }
.bg-surface-variant { background-color: var(--stitch-surface-variant); }
.bg-background { background-color: var(--stitch-background); }

/* --- Text Colors --- */
.text-on-surface { color: var(--stitch-on-surface); }
.text-on-surface-variant { color: var(--stitch-on-surface-variant); }
.text-primary { color: var(--stitch-primary-text); }
.text-on-primary { color: var(--stitch-primary-on); }
.text-on-primary-container { color: var(--stitch-primary-on-container); }
.text-on-secondary { color: var(--stitch-secondary-on); }
.text-on-secondary-container { color: var(--stitch-secondary-on-container); }
.text-on-secondary-fixed { color: var(--stitch-on-secondary-fixed); }
.text-on-secondary-fixed-variant { color: var(--stitch-on-secondary-fixed-variant); }
.text-on-error { color: var(--stitch-error-on); }
.text-on-error-container { color: var(--stitch-error-on-container); }
.text-on-success { color: var(--stitch-success-on); }
.text-error { color: var(--stitch-error); }
.text-success { color: var(--stitch-success); }
.text-outline { color: var(--stitch-outline); }
.text-on-background { color: var(--stitch-on-background); }
.text-inverse-on-surface { color: var(--stitch-inverse-on-surface); }

/* --- Border Colors --- */
.border-outline { border-color: var(--stitch-outline); }
.border-outline-variant { border-color: var(--stitch-outline-variant); }
.border-primary { border-color: var(--stitch-primary); }
.border-error { border-color: var(--stitch-error); }
.border-error\/20 { border-color: rgba(186, 26, 26, 0.2); }
.border-success { border-color: var(--stitch-success); }

/* --- Font Families --- */
.font-body { font-family: var(--stitch-font-inter); }
.font-label { font-family: var(--stitch-font-inter); }
.font-headline { font-family: var(--stitch-font-inter); }

/* --- Typography Scales --- */
.text-headline-lg {
  font-size: 32px;
  font-weight: 700;
  line-height: 40px;
  letter-spacing: -0.02em;
  font-family: var(--stitch-font-inter);
}
.text-headline-md {
  font-size: 24px;
  font-weight: 600;
  line-height: 32px;
  letter-spacing: -0.01em;
  font-family: var(--stitch-font-inter);
}
.text-headline-sm {
  font-size: 20px;
  font-weight: 600;
  line-height: 28px;
  font-family: var(--stitch-font-inter);
}
.text-body-lg {
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
  font-family: var(--stitch-font-inter);
}
.text-body-md {
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  font-family: var(--stitch-font-inter);
}
.text-body-sm {
  font-size: 13px;
  font-weight: 400;
  line-height: 18px;
  font-family: var(--stitch-font-inter);
}
.text-label-md {
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  letter-spacing: 0.05em;
  font-family: var(--stitch-font-inter);
  text-transform: uppercase;
}
.text-label-sm {
  font-size: 11px;
  font-weight: 500;
  line-height: 14px;
  font-family: var(--stitch-font-inter);
}

/* --- Border Radius --- */
.rounded-stitch { border-radius: var(--stitch-radius-default); }
.rounded-stitch-lg { border-radius: var(--stitch-radius-lg); }
.rounded-stitch-xl { border-radius: var(--stitch-radius-xl); }
.rounded-stitch-full { border-radius: var(--stitch-radius-full); }

/* --- Sidebar --- */
.sidebar-stitch {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 50;
  width: var(--stitch-sidebar-width);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--stitch-secondary-fixed-dim);
  padding: var(--stitch-stack-gap-lg) 16px;
  overflow-y: auto;
  transition: transform 0.3s ease;
}

/* Sidebar backdrop overlay */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 49;
  background-color: rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.sidebar-open .sidebar-backdrop {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 768px) {
  .sidebar-stitch { transform: translateX(-100%); }
  .sidebar-open .sidebar-stitch { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }
  .sidebar-stitch { padding: var(--stitch-stack-gap-md) 12px; }
  .sidebar-stitch .nav-link { gap: 8px; padding: 8px 10px; font-size: 11px; }
}
@media (min-width: 769px) {
  .sidebar-toggle-mobile { display: none !important; }
}
.sidebar-toggle-desktop { display: none; }
@media (min-width: 769px) {
  .sidebar-toggle-desktop { display: inline-flex; }
  .sidebar-collapsed .sidebar-stitch { transform: translateX(-100%); }
  .sidebar-collapsed .main-content { margin-left: 0; }
}
@media (max-width: 768px) {
  .sidebar-toggle-desktop { display: none !important; }
}

/* --- Topbar --- */
.topbar-stitch {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--stitch-topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 var(--stitch-margin-desktop);
  background-color: var(--stitch-surface);
  border-bottom: 1px solid var(--stitch-outline-variant);
}

/* --- Data Table --- */
.table-stitch {
  width: 100%;
  text-align: left;
  border-collapse: collapse;
}
.table-stitch thead {
  background-color: var(--stitch-surface-container-low);
  border-bottom: 1px solid var(--stitch-outline-variant);
}
.table-stitch thead th {
  padding: var(--stitch-table-cell-padding);
  font-family: var(--stitch-font-inter);
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--stitch-on-surface);
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: var(--stitch-surface-container-low);
}
.table-stitch tbody {
  font-family: var(--stitch-font-inter);
}
.table-stitch tbody td {
  padding: var(--stitch-table-cell-padding);
  font-size: 13px;
  color: var(--stitch-on-surface);
}
.table-stitch tbody tr {
  border-bottom: 1px solid var(--stitch-outline-variant);
  transition: background-color 0.15s;
}
.table-stitch tbody tr:hover {
  background-color: var(--stitch-surface-container-low);
}
.table-stitch tbody tr:nth-child(even) {
  background-color: #f1f5f9;
}
.table-stitch tbody tr:nth-child(even):hover {
  background-color: var(--stitch-surface-container-low);
}

/* --- Status Chip --- */
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 9999px;
  font-family: var(--stitch-font-inter);
  font-size: 11px;
  font-weight: 500;
  line-height: 14px;
}
.status-chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-chip-primary {
  background-color: var(--stitch-secondary-container);
  color: var(--stitch-on-secondary-container);
}
.status-chip-primary .dot { background-color: var(--stitch-primary); }
.status-chip-error {
  background-color: var(--stitch-error-container);
  color: var(--stitch-error-on-container);
}
.status-chip-error .dot { background-color: var(--stitch-error); }
.status-chip-default {
  background-color: var(--stitch-surface-variant);
  color: var(--stitch-on-surface-variant);
}
.status-chip-default .dot { background-color: var(--stitch-outline); }
.status-chip-success {
  background-color: var(--stitch-success-container);
  color: var(--stitch-success);
}
.status-chip-success .dot { background-color: var(--stitch-success); }

/* --- Cards --- */
.card-stitch {
  background-color: var(--stitch-surface-container-lowest);
  border: 1px solid var(--stitch-outline-variant);
  border-radius: var(--stitch-radius-xl);
  overflow: hidden;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.card-stitch-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--stitch-outline-variant);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--stitch-surface);
}
.card-stitch-body {
  padding: 16px 24px;
}

/* --- Buttons --- */
.btn-primary {
  background-color: var(--stitch-primary);
  color: var(--stitch-primary-on);
  padding: 8px 16px;
  border-radius: var(--stitch-radius-lg);
  font-family: var(--stitch-font-inter);
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.btn-primary:hover { background-color: #1d4ed8; }

.btn-secondary {
  background-color: var(--stitch-surface);
  color: var(--stitch-on-surface);
  padding: 8px 16px;
  border-radius: var(--stitch-radius-lg);
  font-family: var(--stitch-font-inter);
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--stitch-outline-variant);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s;
}
.btn-secondary:hover { background-color: var(--stitch-surface-container-high); }

.btn-ghost {
  color: var(--stitch-on-surface-variant);
  padding: 6px 12px;
  border-radius: var(--stitch-radius-lg);
  font-family: var(--stitch-font-inter);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  cursor: pointer;
  transition: color 0.15s;
  background: none;
}
.btn-ghost:hover { color: var(--stitch-primary-text); }

/* --- Form Inputs --- */
.input-stitch,
.select-stitch {
  width: 100%;
  padding: 8px 12px;
  background-color: var(--stitch-surface);
  border: 1px solid var(--stitch-outline-variant);
  border-radius: var(--stitch-radius-lg);
  font-family: var(--stitch-font-inter);
  font-size: 14px;
  color: var(--stitch-on-surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input-stitch:focus,
.select-stitch:focus {
  border-color: var(--stitch-primary);
  box-shadow: 0 0 0 2px rgba(46, 91, 255, 0.2);
}
.input-stitch::placeholder {
  color: var(--stitch-outline);
}

.select-stitch {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  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='%23747688' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 36px;
}
.select-stitch.select2 {
  background-image: none;
  padding-right: 12px;
}
.select-stitch optgroup,
.select-stitch option {
  font-family: var(--stitch-font-inter);
  font-size: 14px;
}

/* --- Tabs --- */
.tabs-stitch {
  border-bottom: 1px solid var(--stitch-outline-variant);
  display: flex;
  gap: 32px;
}
.tab-stitch {
  padding-bottom: 12px;
  border-bottom: 2px solid transparent;
  color: var(--stitch-on-surface-variant);
  font-family: var(--stitch-font-inter);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.tab-stitch:hover { color: var(--stitch-on-surface); }
.tab-stitch.active {
  color: var(--stitch-primary-text);
  border-bottom-color: var(--stitch-primary);
}

/* --- Drawer (Slide-in panel) --- */
.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background-color: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(4px);
}
.drawer-panel {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 33%;
  min-width: 360px;
  max-width: 600px;
  background-color: var(--stitch-surface);
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.12);
  overflow-y: auto;
}

/* --- Marking Toggle --- */
.marking-toggle {
  width: 24px;
  height: 24px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}
.marking-toggle.done {
  background-color: var(--stitch-success);
  color: var(--stitch-success-on);
}
.marking-toggle.pending {
  background-color: var(--stitch-pending);
}
.marking-toggle.overdue {
  background-color: var(--stitch-pending);
}
.marking-toggle.overdue .dot {
  background-color: var(--stitch-error);
}

/* --- Stat Card --- */
.stat-card {
  background-color: var(--stitch-surface-container-lowest);
  border: 1px solid var(--stitch-outline-variant);
  border-radius: var(--stitch-radius-xl);
  padding: 20px;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

/* --- Alert/Warning Card --- */
.alert-card {
  background-color: rgba(255, 218, 214, 0.4);
  border: 1px solid rgba(186, 26, 26, 0.2);
  border-radius: var(--stitch-radius-xl);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.alert-card-error {
  background-color: rgba(186, 26, 26, 0.06);
  border: 1px solid rgba(186, 26, 26, 0.2);
  border-radius: var(--stitch-radius-xl);
  padding: 12px 16px;
  margin-bottom: 16px;
  color: var(--stitch-error-on-container);
  font-size: 13px;
}
.alert-card-error ul {
  margin: 0;
  padding-left: 16px;
}

/* --- Progress Bar --- */
.progress-bar {
  width: 100%;
  background-color: var(--stitch-surface-container-high);
  border-radius: 8px;
  height: 8px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 8px;
  border-radius: 8px;
  background-color: var(--stitch-primary);
  transition: width 0.3s;
}

/* --- Pagination --- */
.pagination-stitch {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  border-top: 1px solid var(--stitch-outline-variant);
  background-color: var(--stitch-surface);
  color: var(--stitch-on-surface-variant);
  font-size: 13px;
}

/* --- Custom Scrollbar --- */
.custom-scrollbar::-webkit-scrollbar { width: 6px; height: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: var(--stitch-outline-variant); border-radius: 4px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: var(--stitch-outline); }

/* --- Material Symbols defaults --- */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: 400;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
}
.material-symbols-outlined.fill {
  font-variation-settings: 'FILL' 1;
}

/* --- Breadcrumb --- */
.breadcrumb-stitch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  margin-left: auto;
}
.breadcrumb-stitch a {
  color: var(--stitch-on-surface-variant);
  text-decoration: none;
}
.breadcrumb-stitch a:hover {
  color: var(--stitch-primary-text);
}
.breadcrumb-stitch .sep {
  color: var(--stitch-outline);
  margin: 0 2px;
}

/* --- Grid helpers --- */
.grid-form {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.grid-form > * {
  flex: 1 1 200px;
  min-width: 200px;
}

/* --- Page Header --- */
.page-header {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: var(--stitch-stack-gap-lg);
}
@media (min-width: 768px) {
  .page-header {
    flex-direction: row;
    justify-content: space-between !important;
    align-items: center;
  }
}

/* --- Main Content Padding --- */
.main-content {
  flex: 1;
  overflow-y: auto;
  background-color: var(--stitch-background);
  padding: var(--stitch-margin-desktop);
  margin-left: var(--stitch-sidebar-width);
  transition: margin-left 0.3s ease;
}

/* --- Sidebar navigation link --- */
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--stitch-radius-lg);
  color: var(--stitch-secondary);
  font-family: var(--stitch-font-inter);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  transition: all 0.15s;
}
.nav-link:hover {
  color: var(--stitch-on-secondary-fixed-variant);
  background-color: var(--stitch-surface-container-high);
}
.nav-link.active {
  color: var(--stitch-primary-text);
  font-weight: 700;
  background-color: var(--stitch-surface-container-highest);
  border-right: 4px solid var(--stitch-primary);
}

/* --- Filter bar --- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

/* --- Zebra stripe for tables --- */
.zebra tbody tr:nth-child(even) {
  background-color: #f1f5f9;
}

/* --- Marking board row group header --- */
.row-group-header {
  background-color: var(--stitch-surface-container-high);
  border-bottom: 1px solid var(--stitch-outline-variant);
}
.row-group-header td {
  padding: var(--stitch-table-cell-padding);
  font-family: var(--stitch-font-inter);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--stitch-on-surface);
}

/* --- Responsive table wrapper --- */
.table-wrap {
  overflow-x: auto;
}
@media (max-width: 768px) {
  .table-wrap {
    margin: 0 calc(-1 * var(--stitch-margin-mobile));
  }
}

/* --- Session Overview Dashboard Layout --- */
.session-dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--stitch-gutter);
  align-items: start;
}
@media (min-width: 1280px) {
  .session-dashboard-grid {
    grid-template-columns: 1fr 320px;
  }
}

/* --- DataTable Global Shared Styles --- */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
  margin-bottom: 1rem;
}
.dataTables_wrapper .dataTables_length select {
  padding: 0.5rem 2rem 0.5rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--stitch-outline-variant);
  background-color: var(--stitch-surface-container-lowest);
  color: var(--stitch-on-surface);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23434656' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 0.875rem;
  font-family: var(--stitch-font-inter);
  font-size: 13px;
}
.dataTables_wrapper .dataTables_filter input {
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--stitch-outline-variant);
  background-color: var(--stitch-surface-container-lowest);
  color: var(--stitch-on-surface);
  font-family: var(--stitch-font-inter);
  font-size: 13px;
}
.dataTables_wrapper .dataTables_filter input::placeholder {
  color: var(--stitch-outline);
}
.dataTables_wrapper .dataTables_filter input:focus {
  border-color: var(--stitch-primary);
  box-shadow: 0 0 0 2px rgba(46, 91, 255, 0.2);
  outline: none;
}

/* DataTables Bootstrap 5 pagination compatibility
   (Bootstrap 5 CSS not loaded, but DataTables BS5 integration is used) */
.pagination {
  display: flex;
  flex-wrap: wrap;
  padding-left: 0;
  list-style: none;
  margin: 0;
  align-items: center;
  gap: 0.25rem;
}
.page-item {
  display: flex;
}
.page-link {
  display: block;
  text-decoration: none;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
}
.page-item.active .paginate_button {
  background-color: var(--stitch-primary);
  color: var(--stitch-primary-on);
  border-color: var(--stitch-primary);
  font-weight: 600;
}
.page-item.disabled .paginate_button {
  opacity: 0.4;
  cursor: default;
}

.dataTables_wrapper .dataTables_paginate {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
  padding: 0.5rem 0.75rem;
  margin: 0 0.25rem;
  border-radius: 0.5rem;
  border: 1px solid var(--stitch-outline-variant);
  background-color: var(--stitch-surface-container-lowest);
  color: var(--stitch-on-surface);
  font-family: var(--stitch-font-inter);
  font-size: 13px;
  transition: all 0.15s;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background-color: var(--stitch-surface-container-low);
  border-color: var(--stitch-outline);
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background-color: var(--stitch-primary);
  color: var(--stitch-primary-on);
  border-color: var(--stitch-primary);
  font-weight: 600;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
  opacity: 0.4;
  cursor: default;
}
.dataTables_wrapper .dataTables_info {
  color: var(--stitch-on-surface-variant);
  font-family: var(--stitch-font-inter);
  font-size: 13px;
}
.dataTables_wrapper .dataTables_processing {
  background: rgba(247, 249, 251, 0.85);
  color: var(--stitch-primary-text);
  font-family: var(--stitch-font-inter);
  font-size: 13px;
  border: 1px solid var(--stitch-outline-variant);
  border-radius: 0.5rem;
  padding: 1rem;
}
.dataTables_wrapper table.dataTable thead th {
  font-family: var(--stitch-font-inter);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--stitch-on-surface-variant);
  padding: 12px 16px;
  border-bottom: 1px solid var(--stitch-outline-variant);
  background-color: var(--stitch-surface-container-low);
  white-space: nowrap;
}
.dataTables_wrapper table.dataTable tbody td {
  font-family: var(--stitch-font-inter);
  font-size: 13px;
  color: var(--stitch-on-surface);
  padding: 12px 16px;
  border-bottom: 1px solid var(--stitch-outline-variant);
  vertical-align: middle;
}
.dataTables_wrapper table.dataTable tbody tr:hover {
  background-color: var(--stitch-surface-container-low);
}
.dataTables_wrapper table.dataTable tbody tr:nth-child(even) {
  background-color: var(--stitch-surface-container-low);
}
.dataTables_wrapper table.dataTable tbody tr:nth-child(even):hover {
  background-color: var(--stitch-surface-container);
}
.dataTables_wrapper table.dataTable.no-footer {
  border-bottom: none;
}

/* Dark mode DarkBar styles */
.dark .dataTables_wrapper .dataTables_length select,
.dark .dataTables_wrapper .dataTables_filter input,
.dark .dataTables_wrapper .dataTables_paginate .paginate_button {
  background-color: #1f2937;
  border-color: #374151;
  color: #d1d5db;
}
.dark .dataTables_wrapper .dataTables_length select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23d1d5db' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}
.dark .dataTables_wrapper .dataTables_info {
  color: #9ca3af;
}
.dark .dataTables_wrapper table.dataTable thead th {
  background-color: #1e293b;
  color: #94a3b8;
  border-bottom-color: #334155;
}
.dark .dataTables_wrapper table.dataTable tbody td {
  color: #cbd5e1;
  border-bottom-color: #334155;
}
.dark .dataTables_wrapper table.dataTable tbody tr:hover {
  background-color: #334155;
}
.dark .dataTables_wrapper table.dataTable tbody tr:nth-child(even) {
  background-color: #1e293b;
}
.dark .dataTables_wrapper table.dataTable tbody tr:nth-child(even):hover {
  background-color: #334155;
}

/* DataTable responsive */
@media (max-width: 1024px) {
  .dataTables_wrapper table.dataTable thead th { font-size: 11px; padding: 8px 10px; }
  .dataTables_wrapper table.dataTable tbody td { font-size: 12px; padding: 8px 10px; }
}
@media (max-width: 640px) {
  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter { margin-bottom: 0.5rem; }
  .dataTables_wrapper .dataTables_length select,
  .dataTables_wrapper .dataTables_filter input { font-size: 12px; padding: 0.375rem 1rem; }
  .dataTables_wrapper .dataTables_paginate { margin-top: 0.75rem; }
  .dataTables_wrapper .dataTables_paginate .paginate_button { padding: 0.375rem 0.5rem; font-size: 12px; margin: 0.125rem; }
  .dataTables_wrapper .dataTables_info { font-size: 12px; }
}

/* --- List Page Card Wrapper --- */
.list-card {
  background-color: var(--stitch-surface-container-lowest);
  border: 1px solid var(--stitch-outline-variant);
  border-radius: var(--stitch-radius-xl);
  overflow: hidden;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.06);
}

/* --- List Page Toolbar --- */
.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--stitch-outline-variant);
  background-color: var(--stitch-surface);
}
.list-toolbar-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.list-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.list-toolbar-left form.flex .select-stitch {
  height: 36px;
  width: auto;
  flex: 1 1 auto;
  min-width: 160px;
  max-width: 250px;
  font-size: 13px;
  background-color: var(--stitch-surface-container-lowest);
}

/* --- Document form row (faculty form) --- */
@media (max-width: 768px) {
  .document-form-row { grid-template-columns: 1fr !important; }
}

/* --- Filter Select --- */
.filter-select {
  height: 36px;
  min-width: 140px;
  max-width: 180px;
  padding: 6px 32px 6px 12px;
  border-radius: var(--stitch-radius-lg);
  border: 1px solid var(--stitch-outline-variant);
  background-color: var(--stitch-surface-container-lowest);
  color: var(--stitch-on-surface);
  font-family: var(--stitch-font-inter);
  font-size: 13px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23434656' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.filter-select:focus {
  border-color: var(--stitch-primary);
  box-shadow: 0 0 0 2px rgba(46, 91, 255, 0.2);
  outline: none;
}
.dark .filter-select {
  background-color: #1f2937;
  border-color: #374151;
  color: #d1d5db;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23d1d5db' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

/* --- Filter Clear Link --- */
.filter-clear {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--stitch-font-inter);
  font-size: 13px;
  color: var(--stitch-on-surface-variant);
  text-decoration: none;
  transition: color 0.15s;
}
.filter-clear:hover {
  color: var(--stitch-primary-text);
}

/* --- Action Buttons --- */
.btn-action-view,
.btn-action-edit,
.btn-action-delete,
.btn-action-success,
.btn-action-warning,
.btn-action-neutral {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--stitch-radius-lg);
  font-family: var(--stitch-font-inter);
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: all 0.15s;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-action-view {
  background-color: var(--stitch-surface);
  color: var(--stitch-on-surface);
  border-color: var(--stitch-outline-variant);
}
.btn-action-view:hover {
  background-color: var(--stitch-surface-container-low);
  border-color: var(--stitch-outline);
}
.btn-action-edit {
  background-color: var(--stitch-primary);
  color: var(--stitch-primary-on);
  border-color: var(--stitch-primary);
}
.btn-action-edit:hover {
  background-color: #1d4ed8;
}
.btn-action-delete {
  background-color: var(--stitch-error);
  color: var(--stitch-error-on);
  border-color: var(--stitch-error);
}
.btn-action-delete:hover {
  background-color: #991b1b;
}
.dark .btn-action-view {
  background-color: #1f2937;
  color: #d1d5db;
  border-color: #374151;
}
.dark .btn-action-view:hover {
  background-color: #334155;
  border-color: #475569;
}

/* --- Action Button Variants --- */
.btn-action-success {
  background-color: #059669;
  color: #fff;
  border-color: #059669;
}
.btn-action-success:hover {
  background-color: #047857;
}
.btn-action-warning {
  background-color: #d97706;
  color: #fff;
  border-color: #d97706;
}
.btn-action-warning:hover {
  background-color: #b45309;
}
.btn-action-neutral {
  background-color: var(--stitch-surface);
  color: var(--stitch-on-surface);
  border-color: var(--stitch-outline-variant);
}
.btn-action-neutral:hover {
  background-color: var(--stitch-surface-container-low);
  border-color: var(--stitch-outline);
}
.dark .btn-action-success {
  background-color: #059669;
  color: #fff;
  border-color: #059669;
}
.dark .btn-action-success:hover {
  background-color: #047857;
}
.dark .btn-action-warning {
  background-color: #d97706;
  color: #fff;
  border-color: #d97706;
}
.dark .btn-action-warning:hover {
  background-color: #b45309;
}
.dark .btn-action-neutral {
  background-color: #1f2937;
  color: #d1d5db;
  border-color: #374151;
}
.dark .btn-action-neutral:hover {
  background-color: #334155;
  border-color: #475569;
}
/* --- Status Chips (additional aliases) --- */
.status-chip-success {
  background-color: #ecfdf5;
  color: #065f46;
}
.status-chip-success .material-symbols-outlined { font-size: 10px; }
.dark .status-chip-success {
  background-color: rgba(5, 150, 105, 0.15);
  color: #34d399;
}
.status-chip-neutral {
  background-color: #f3f4f6;
  color: #4b5563;
}
.status-chip-neutral .material-symbols-outlined { font-size: 10px; }
.dark .status-chip-neutral {
  background-color: rgba(107, 114, 128, 0.15);
  color: #9ca3af;
}
.status-chip-danger {
  background-color: #fef2f2;
  color: #991b1b;
}
.status-chip-danger .material-symbols-outlined { font-size: 10px; }
.dark .status-chip-danger {
  background-color: rgba(220, 38, 38, 0.15);
  color: #fca5a5;
}
.status-chip-warning {
  background-color: #fffbeb;
  color: #92400e;
}
.status-chip-warning .material-symbols-outlined { font-size: 10px; }
.dark .status-chip-warning {
  background-color: rgba(217, 119, 6, 0.15);
  color: #fbbf24;
}

/* --- Add Button --- */
.btn-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--stitch-radius-lg);
  background-color: var(--stitch-primary);
  color: var(--stitch-primary-on);
  font-family: var(--stitch-font-inter);
  font-size: 13px;
  font-weight: 600;
  line-height: 20px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  white-space: nowrap;
}
.btn-add:hover {
  background-color: #1d4ed8;
}
.btn-add svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
@media (max-width: 640px) {
  .btn-add { padding: 6px 10px; font-size: 12px; }
  .btn-add .btn-add-label-full { display: none; }
  .btn-add .btn-add-label-short { display: inline; }
}
@media (min-width: 641px) {
  .btn-add .btn-add-label-short { display: none; }
  .btn-add .btn-add-label-full { display: inline; }
}

/* --- DataTable DOM Layout Override --- */
.list-table-wrapper {
  padding: 12px 16px;
  overflow-x: auto;
}
@media (min-width: 640px) {
  .list-table-wrapper { padding: 16px 20px; }
}

/* --- Form Page Layout --- */
.form-card {
  max-width: 720px;
  margin: 0 auto;
}
.form-card-narrow {
  max-width: 480px;
  margin: 0 auto;
}
.form-card-wide {
  max-width: 900px;
  margin: 0 auto;
}
.section-heading {
  font-size: 15px;
  font-weight: 600;
  color: var(--stitch-on-surface);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--stitch-outline-variant);
}

.form-field {
  flex: 1 1 0%;
  min-width: 200px;
}
@media (max-width: 767px) {
  .form-field {
    min-width: 150px;
  }
}
@media (max-width: 480px) {
  .form-field {
    min-width: 100%;
  }
}
.form-row-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 1200px) {
  .form-row-4 {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 992px) {
  .form-row-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 640px) {
  .form-row-4 {
    grid-template-columns: 1fr;
  }
}
.form-row-4 .form-field-full,
.form-field-full {
  grid-column: 1 / -1;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.form-group {
  margin-bottom: 0;
}
.form-group-full {
  grid-column: 1 / -1;
}
.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 24px;
}

.form-label {
  display: block;
  margin-bottom: 4px;
}

/* --- Delete Confirmation --- */
.delete-warning {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  margin-bottom: 16px;
  color: #991b1b;
}
.dark .delete-warning {
  background: rgba(220,38,38,0.1);
  border-color: rgba(220,38,38,0.3);
  color: #fca5a5;
}
.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border: none;
  border-radius: 8px;
  font-family: var(--stitch-font-inter);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  background: #dc2626;
  color: white;
  transition: background 0.2s;
  text-decoration: none;
}
.btn-danger:hover {
  background: #b91c1c;
}

.btn-icon-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: var(--stitch-radius-lg);
  background: transparent;
  color: var(--stitch-error);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.btn-icon-danger:hover {
  background-color: var(--stitch-error-container);
  color: var(--stitch-error-on-container);
}
@media (max-width: 480px) {
  .btn-icon-danger {
    width: 44px;
    height: 44px;
  }
}

/* --- DataTable Child Row (expand/collapse) --- */
table.dataTable td.dt-control {
  cursor: pointer;
  text-align: center;
  width: 32px;
  min-width: 32px;
}
table.dataTable td.dt-control:before {
  content: '\25B6';
  font-size: 10px;
  color: var(--stitch-on-surface-variant);
  display: inline-block;
  transition: transform 0.15s;
}
table.dataTable tr.shown td.dt-control:before {
  content: '\25BC';
}
table.dataTable tr.shown + tr.child {
  background-color: var(--stitch-surface-container-low);
}
table.dataTable tr.shown + tr.child td {
  border-bottom: 1px solid var(--stitch-outline-variant);
  padding: 0 !important;
}
.child-row-detail {
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.6;
  background-color: var(--stitch-surface-container-low);
}
.child-row-detail .detail-row {
  margin-bottom: 6px;
}
.child-row-detail .detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 2px 16px;
}
.child-row-detail .detail-item {
  padding: 3px 0;
}
.child-row-detail .detail-label {
  font-weight: 600;
  color: var(--stitch-on-surface-variant);
}
.child-row-detail .detail-value {
  color: var(--stitch-on-surface);
}
.dark .child-row-detail {
  background-color: #1a1f2e;
}
.dark .child-row-detail .detail-label {
  color: #94a3b8;
}
.dark .child-row-detail .detail-value {
  color: #e2e8f0;
}

/* ============================================================
   Responsive Breakpoints
   ============================================================ */

/* --- Tablet (768px–1023px) --- */
@media (max-width: 1023px) {
  .topbar-stitch { padding: 0 var(--stitch-margin-mobile); }
  .card-stitch-header { padding: 12px 16px; }
  .card-stitch-body { padding: 12px 16px; }
  .form-card, .form-card-wide, .form-card-narrow { max-width: 100%; margin: 0; }
  .pagination-stitch { padding: 12px 16px; }
}

/* --- Detail grid (2-col → 1-col on mobile) --- */
.detail-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

/* --- Mobile (<768px) --- */
@media (max-width: 768px) {
  .main-content { padding: var(--stitch-margin-mobile); }
  .stat-card { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column; }
  .form-actions .btn-primary,
  .form-actions .btn-secondary { width: 100%; justify-content: center; }
  .detail-grid-2 { grid-template-columns: 1fr; }
  .tabs-stitch { gap: 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .list-toolbar { padding: 12px 16px; }
  .list-table-wrapper { padding: 8px 12px; }
  .filter-select { min-width: 0; max-width: none; width: 100%; }
  .list-toolbar-left { flex: 1; }
  .list-toolbar-left form.flex { width: 100%; }
  .list-toolbar-left form.flex .select-stitch,
  .list-toolbar-left form.flex .filter-select { flex: 1; min-width: 0; }
}

/* --- Small Mobile (<480px) --- */
@media (max-width: 480px) {
  .stat-card { flex: 1 1 100% !important; min-width: 100% !important; }
  .text-headline-lg { font-size: 24px; line-height: 32px; }
  .text-headline-md { font-size: 20px; line-height: 28px; }
  .text-headline-sm { font-size: 18px; line-height: 24px; }
  .topbar-stitch [style*="text-headline-sm"] { font-size: 16px; }
  .topbar-username { display: none; }
  .btn-action-view,
  .btn-action-edit,
  .btn-action-delete,
  .btn-action-success,
  .btn-action-warning,
  .btn-action-neutral { padding: 6px 10px; font-size: 11px; }
  .dataTables_wrapper .dataTables_filter input { width: 100%; }
  .dataTables_wrapper .dataTables_length { width: 100%; }
  .dataTables_wrapper .dataTables_length select { width: 100%; }
}

/* --- Responsive helper classes --- */
.sidebar-open { overflow: hidden; }
@media (min-width: 769px) {
  .sidebar-open { overflow: auto; }
}
.hide-mobile { display: none; }
@media (min-width: 481px) {
  .hide-mobile { display: revert; }
}
.show-mobile { display: revert; }
@media (min-width: 481px) {
  .show-mobile { display: none; }
}

.faculty-account-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 34%);
  gap: 20px;
  align-items: start;
}
.faculty-account-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.faculty-account-fields > div {
  min-width: 0;
}
.faculty-photo-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.faculty-photo-card {
  position: relative;
  overflow: hidden;
  padding: 0;
  aspect-ratio: 3 / 2;
  border-radius: 8px;
}
.faculty-photo-state {
  position: absolute;
  inset: 0;
  background: var(--stitch-surface-container-lowest);
}
.faculty-photo-state img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.faculty-photo-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  text-align: center;
}
.faculty-photo-upload .upload-icon {
  font-size: 42px;
  color: var(--stitch-primary);
}
.faculty-photo-upload p {
  margin: 8px 0 0;
  color: var(--stitch-on-surface-variant);
  font-size: 13px;
  font-weight: 600;
}
.faculty-photo-input input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.faculty-photo-upload-button {
  justify-content: center;
  cursor: pointer;
}
.faculty-document-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--stitch-outline-variant);
  border-radius: 8px;
  background: color-mix(in srgb, var(--stitch-surface-container-lowest) 72%, var(--stitch-surface) 28%);
}
.faculty-document-fields {
  display: grid;
  grid-template-columns: minmax(190px, 0.95fr) minmax(220px, 1.15fr) auto;
  gap: 12px;
  align-items: end;
  min-width: 0;
}
.faculty-document-file-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 260px);
  gap: 12px;
  align-items: stretch;
  min-width: 0;
}
.faculty-document-current {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--stitch-outline-variant);
  border-radius: 8px;
  background: var(--stitch-surface);
}
.faculty-document-current > .material-symbols-outlined {
  font-size: 22px;
  color: var(--stitch-primary);
}
.faculty-document-current-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.faculty-document-link {
  color: var(--stitch-primary);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
}
.faculty-document-link:hover {
  text-decoration: underline;
}
.faculty-document-empty {
  color: var(--stitch-outline);
  font-size: 13px;
  font-weight: 500;
}
.faculty-document-view {
  min-height: 32px;
  padding: 6px 10px;
  white-space: nowrap;
}
.faculty-document-upload {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  align-content: center;
  min-width: 0;
}
.faculty-document-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.faculty-document-upload-button {
  width: 100%;
  justify-content: center;
  cursor: pointer;
  white-space: nowrap;
}
.faculty-document-file-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}
.faculty-document-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.faculty-document-delete-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.faculty-document-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--stitch-error) 35%, var(--stitch-outline-variant));
  border-radius: 8px;
  color: var(--stitch-error);
  background: color-mix(in srgb, var(--stitch-error) 6%, transparent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.faculty-document-delete:hover,
.faculty-document-delete-input:checked + .faculty-document-delete {
  background: color-mix(in srgb, var(--stitch-error) 12%, transparent);
  border-color: var(--stitch-error);
}
.faculty-document-delete .material-symbols-outlined {
  font-size: 18px;
}
@media (max-width: 900px) {
  .faculty-account-layout {
    grid-template-columns: 1fr;
  }
  .faculty-document-card,
  .faculty-document-fields,
  .faculty-document-file-panel {
    grid-template-columns: 1fr;
  }
  .faculty-document-actions {
    justify-content: flex-start;
  }
}

/* --- Responsive action buttons group --- */
.action-group {
  display: inline-flex;
  gap: 4px;
}
.action-group .btn-action-view .action-label,
.action-group .btn-action-edit .action-label,
.action-group .btn-action-delete .action-label,
.action-group .btn-action-success .action-label,
.action-group .btn-action-warning .action-label,
.action-group .btn-action-neutral .action-label {
  display: inline;
}
@media (max-width: 640px) {
  .action-group .btn-action-view .action-label,
  .action-group .btn-action-edit .action-label,
  .action-group .btn-action-delete .action-label,
  .action-group .btn-action-success .action-label,
  .action-group .btn-action-warning .action-label,
  .action-group .btn-action-neutral .action-label {
    display: none;
  }
}
@media (min-width: 641px) {
  .action-group .btn-action-view .action-icon-only,
  .action-group .btn-action-edit .action-icon-only,
  .action-group .btn-action-delete .action-icon-only,
  .action-group .btn-action-success .action-icon-only,
  .action-group .btn-action-warning .action-icon-only,
  .action-group .btn-action-neutral .action-icon-only {
    display: none;
  }
}

.formset-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

/* --- Formset table responsive (card layout on ≤992px) --- */
.formset-table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  margin-bottom: 24px;
}
@media (max-width: 992px) {
  .formset-table-responsive {
    overflow-x: visible;
    width: 100%;
  }
  .formset-table-responsive table {
    min-width: 0;
    width: 100%;
  }
  .formset-table-responsive thead {
    display: none;
  }
  .formset-table-responsive tbody,
  .formset-table-responsive tr,
  .formset-table-responsive td {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }
  .formset-table-responsive tr.qualification-form,
  .formset-table-responsive tr.document-form {
    border: 1px solid var(--stitch-outline-variant);
    border-radius: var(--stitch-radius-lg);
    padding: 12px;
    margin-bottom: 12px;
    background: var(--stitch-surface);
    width: 100%;
    box-sizing: border-box;
  }
  .formset-table-responsive td {
    padding: 4px 0 !important;
    border: none !important;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    width: 100%;
    box-sizing: border-box;
  }
  .formset-table-responsive td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 12px;
    color: var(--stitch-on-surface-variant);
    width: 100%;
  }
  .formset-table-responsive td input,
  .formset-table-responsive td select,
  .formset-table-responsive td .input-stitch,
  .formset-table-responsive td .select-stitch {
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
  }
  .formset-table-responsive td.text-center {
    align-items: center;
  }
  .formset-table-responsive tbody tr:nth-child(even) {
    background: transparent;
  }
  .formset-table-responsive tbody tr:hover {
    background: transparent;
  }
}

.formset-table-responsive .delete-checkbox,
.formset-table-responsive .delete-document-checkbox {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
}

/* --- Deadline edit table responsive (card layout on ≤640px) --- */
.deadline-table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.deadline-table-responsive table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 900px;
}
.deadline-table-responsive thead th {
  padding: 8px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--stitch-outline);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--stitch-outline-variant);
  white-space: nowrap;
}
.deadline-table-responsive tbody td {
  padding: 6px 8px;
  vertical-align: middle;
}
.deadline-table-responsive tbody tr:nth-child(even) {
  background: var(--stitch-surface-container);
}
.deadline-table-responsive input.input-stitch {
  width: 100%;
  min-width: 140px;
}
.deadline-table-responsive input.input-stitch[type="datetime-local"] {
  min-width: 180px;
}
.week-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--stitch-primary-container);
  color: var(--stitch-on-primary-container);
  font-size: 13px;
  font-weight: 600;
}
@media (max-width: 640px) {
  .deadline-table-responsive {
    overflow-x: visible;
  }
  .deadline-table-responsive table {
    min-width: 0;
  }
  .deadline-table-responsive thead {
    display: none;
  }
  .deadline-table-responsive tbody,
  .deadline-table-responsive tr,
  .deadline-table-responsive td {
    display: block;
  }
  .deadline-table-responsive tr {
    border: 1px solid var(--stitch-outline-variant);
    border-radius: var(--stitch-radius-lg);
    padding: 12px;
    margin-bottom: 12px;
    background: var(--stitch-surface) !important;
  }
  .deadline-table-responsive td {
    padding: 6px 0 !important;
    border: none !important;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
  }
  .deadline-table-responsive td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 12px;
    color: var(--stitch-on-surface-variant);
    width: 100%;
  }
  .deadline-table-responsive td input {
    width: 100%;
    min-width: 0 !important;
  }
  .deadline-table-responsive td:first-child::before {
    content: attr(data-label);
  }
  .deadline-table-responsive td:first-child .week-badge {
    display: none;
  }
}

/* --- Section history responsive (card layout on ≤640px) --- */
.section-history-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 640px) {
  .section-history-responsive {
    overflow-x: visible;
  }
  .section-history-responsive table {
    min-width: 0;
  }
  .section-history-responsive thead {
    display: none;
  }
  .section-history-responsive tbody,
  .section-history-responsive tr,
  .section-history-responsive td {
    display: block;
  }
  .section-history-responsive tr {
    border: 1px solid var(--stitch-outline-variant);
    border-radius: var(--stitch-radius-lg);
    padding: 12px;
    margin-bottom: 12px;
    background: var(--stitch-surface);
  }
  .section-history-responsive td {
    padding: 4px 0 !important;
    border: none !important;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .section-history-responsive td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 12px;
    color: var(--stitch-on-surface-variant);
    width: 100%;
  }
  .section-history-responsive tbody tr:nth-child(even) {
    background: transparent;
  }
  .section-history-responsive tbody tr:hover {
    background: transparent;
  }
}

/* --- Day selector in schedule card header (mobile full-width) --- */
.card-stitch-header .day-select {
  margin-left: auto;
  min-width: 160px;
}
@media (max-width: 768px) {
  .card-stitch-header .day-select {
    margin-left: 0;
    min-width: 0;
    width: 100%;
  }
  .card-stitch-header .day-select .select-stitch {
    width: 100%;
  }
}

/* --- Schedule table responsive (card layout on ≤768px) --- */
.schedule-table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 768px) {
  .schedule-table-responsive {
    overflow-x: visible;
    margin: 0;
  }
  .schedule-table-responsive table {
    min-width: 0;
  }
  .schedule-table-responsive thead {
    display: none;
  }
  .schedule-table-responsive tbody,
  .schedule-table-responsive tr,
  .schedule-table-responsive td {
    display: block;
  }
  .schedule-table-responsive tr {
    border: 1px solid var(--stitch-outline-variant);
    border-radius: var(--stitch-radius-lg);
    padding: 12px;
    margin-bottom: 12px;
    background: var(--stitch-surface);
  }
  .schedule-table-responsive td {
    padding: 4px 0 !important;
    border: none !important;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .schedule-table-responsive td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 12px;
    color: var(--stitch-on-surface-variant);
    width: 100%;
  }
  .schedule-table-responsive td.text-right {
    text-align: left;
    align-items: flex-start;
  }
  .schedule-table-responsive tbody tr:nth-child(even) {
    background: transparent;
  }
  .schedule-table-responsive tbody tr:hover {
    background: transparent;
  }
}

/* ===== DataTables Global Styling ===== */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
  margin-bottom: 1rem;
}

.dataTables_wrapper .dataTables_length select {
  padding: 0.5rem 2rem 0.5rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--stitch-outline);
  background: var(--stitch-surface);
  color: var(--stitch-on-surface);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23374151' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 0.875rem;
}

.dataTables_wrapper .dataTables_filter input {
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--stitch-outline);
  background: var(--stitch-surface);
  color: var(--stitch-on-surface);
}

.dataTables_wrapper .dataTables_paginate {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  padding: 0.5rem 0.75rem;
  margin: 0 0.25rem;
  border-radius: 0.5rem;
  border: 1px solid var(--stitch-outline);
  background: var(--stitch-surface);
  color: var(--stitch-on-surface-variant);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--stitch-primary);
  color: #fff;
  border-color: var(--stitch-primary);
}

.dataTables_wrapper .dataTables_info {
  color: var(--stitch-on-surface-variant);
}

.dark .dataTables_wrapper .dataTables_length select,
.dark .dataTables_wrapper .dataTables_filter input,
.dark .dataTables_wrapper .dataTables_paginate .paginate_button {
  background: var(--stitch-surface-container-high);
  border-color: var(--stitch-outline-variant);
  color: var(--stitch-on-surface);
}

.dark .dataTables_wrapper .dataTables_length select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23d1d5db' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

.dark .dataTables_wrapper .dataTables_info {
  color: var(--stitch-on-surface-variant);
}

@media (max-width: 640px) {
  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter {
    margin-bottom: 0.5rem;
  }

  .dataTables_wrapper .dataTables_length select,
  .dataTables_wrapper .dataTables_filter input {
    font-size: 0.75rem;
    padding: 0.375rem 1rem;
  }

  .dataTables_wrapper .dataTables_length label,
  .dataTables_wrapper .dataTables_filter label {
    font-size: 0.75rem;
  }

  .dataTables_wrapper .dataTables_paginate {
    margin-top: 0.75rem;
  }

  .dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    margin: 0 0.125rem;
  }

  .dataTables_wrapper .dataTables_info {
    font-size: 0.75rem;
  }

  .dtr-details {
    padding: 0.5rem !important;
  }

  .dtr-details li {
    padding: 0.25rem 0 !important;
    font-size: 0.875rem;
  }

  .dataTables_wrapper .dataTables_scrollBody {
    overflow-x: auto !important;
  }

  .dataTables_wrapper .dataTables_scroll {
    overflow-x: auto !important;
  }
}

/* --- Modal Dialog --- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-container {
  background: var(--stitch-surface);
  border-radius: 12px;
  max-width: 560px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--stitch-outline-variant);
  position: sticky; top: 0;
  background: var(--stitch-surface);
  z-index: 1;
}
.modal-title { font-size: 14px; font-weight: 600; color: var(--stitch-on-surface); }
.modal-close {
  background: none; border: none; cursor: pointer;
  padding: 4px; border-radius: 4px;
  color: var(--stitch-on-surface-variant);
}
.modal-close:hover { background: var(--stitch-surface-container-high); }
.modal-body { padding: 24px; }
.modal-loading {
  display: flex; align-items: center; justify-content: center;
  padding: 48px;
}
.modal-form-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  padding-top: 16px; border-top: 1px solid var(--stitch-outline-variant);
  margin-top: 24px;
}
@keyframes modal-spin { to { transform: rotate(360deg); } }
.modal-loading .material-symbols-outlined { animation: modal-spin 1s linear infinite; }
@media (max-width: 640px) {
  .modal-overlay { padding: 0; }
  .modal-container { max-width: 100%; max-height: 100%; height: 100%; border-radius: 0; }
}

/* --- Status Dropdown --- */
.status-dropdown { position: relative; }
.status-dropdown-trigger { cursor: pointer; display: inline-flex; align-items: center; }
.status-dropdown-menu {
  position: absolute; top: 100%; left: 0; z-index: 100;
  min-width: 140px; padding: 4px;
  background: var(--stitch-surface);
  border: 1px solid var(--stitch-outline-variant);
  border-radius: var(--stitch-radius-lg);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.status-dropdown-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 6px 10px;
  background: none; border: none; cursor: pointer;
  border-radius: var(--stitch-radius-md);
  font-family: var(--stitch-font-inter);
  font-size: 13px; color: var(--stitch-on-surface);
  text-align: left; white-space: nowrap;
}
.status-dropdown-item:hover { background: var(--stitch-surface-container-high); }
.status-dropdown-item.active { background: var(--stitch-surface-container-highest); font-weight: 600; }
.dark .status-dropdown-menu { background: #1e293b; border-color: #334155; }
.dark .status-dropdown-item { color: #e2e8f0; }
.dark .status-dropdown-item:hover { background: #334155; }
.dark .status-dropdown-item.active { background: #334155; color: #60a5fa; }
