@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary: #1734c8;
  --primary-hover: #10237d;
  --accent: #f4d12a;
  --accent-light: rgba(244, 209, 42, 0.15);
  
  --bg-app: #eef3f8;
  --bg-card: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #d9deec;

  --status-pending: #d97706;
  --status-pending-bg: #fef3c7;
  --status-approved: #16a34a;
  --status-approved-bg: #dcfce7;
  --status-declined: #dc2626;
  --status-declined-bg: #fee2e2;

  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-family);
  color: var(--text-main);
  background:
    linear-gradient(115deg, rgba(9, 30, 61, 0.82) 0%, rgba(10, 74, 91, 0.58) 52%, rgba(4, 32, 41, 0.82) 100%),
    url("../img/slogo.jpg");
  background-position: center, center;
  background-size: cover, cover;
  background-repeat: no-repeat, no-repeat;
  background-attachment: scroll, scroll;
  background-color: #06182b;
}

body.login-body {
  background-image:
    linear-gradient(115deg, rgba(9, 30, 61, 0.82) 0%, rgba(10, 74, 91, 0.58) 52%, rgba(4, 32, 41, 0.82) 100%),
    url("../img/slbg.jfif");
  background-position: center, center;
  background-size: cover, cover;
  background-repeat: no-repeat, no-repeat;
  background-attachment: scroll, scroll;
}

body.dashboard-body {
  color: var(--text-main);
  background: var(--bg-app);
  overflow: hidden;
}

a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
  transition:
    color 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    filter 180ms ease,
    transform 180ms ease;
}

a:hover {
  text-decoration: underline;
}

.login-page {
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px clamp(18px, 5vw, 72px);
  overflow: auto;
}

.login-shell {
  width: min(100%, 860px);
  height: auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 440px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 28px 70px rgba(2, 8, 23, 0.42);
  backdrop-filter: blur(8px);
}

.login-identity {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 38px;
  color: #ffffff;
  background: linear-gradient(145deg, rgba(8, 28, 58, 0.86), rgba(16, 35, 125, 0.72));
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow-y: auto;
  padding: 28px 34px 26px;
  border-left: 5px solid #f4d12a;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 247, 255, 0.94));
}

.login-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at top right, rgba(244, 209, 42, 0.2), transparent 34%),
    linear-gradient(90deg, rgba(29, 52, 200, 0.08), transparent 45%);
}

.portal-badge {
  position: relative;
  width: fit-content;
  margin-bottom: 10px;
  padding: 6px 10px;
  border: 1px solid rgba(29, 52, 200, 0.24);
  border-radius: 999px;
  color: #1734c8;
  background: #eef2ff;
  font-size: 12px;
  font-weight: 800;
}

.brand-block {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 3px solid #f4d12a;
  border-radius: 50%;
  color: transparent;
  background:
    url("../img/slogo.jpg") center / cover no-repeat,
    #ffffff;
  font-size: 0;
  font-weight: 800;
  box-shadow: 0 14px 28px rgba(29, 52, 200, 0.2);
}

.brand-block-large {
  align-items: center;
  flex-direction: row;
  gap: 18px;
  margin-top: 18px;
  text-align: left;
}

.brand-block-large .brand-mark {
  width: 96px;
  height: 96px;
  border-width: 5px;
  box-shadow: 0 20px 44px rgba(2, 8, 23, 0.36);
}

.brand-kicker {
  margin: 0 0 4px;
  color: #516079;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-identity .brand-kicker {
  color: #f4d12a;
  font-size: 16px;
}

h1 {
  margin: 0;
  color: #10237d;
  font-size: 25px;
  line-height: 1.2;
}

.login-identity h1 {
  color: #ffffff;
  font-size: 34px;
}

.identity-tagline {
  max-width: 330px;
  margin: 22px 0 0;
  color: #dbeafe;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.5;
  text-align: center;
  text-transform: uppercase;
}

.login-copy {
  position: relative;
  margin: 0 0 14px;
  color: #516079;
  font-size: 14px;
  line-height: 1.6;
}

.login-form {
  position: relative;
  display: grid;
  gap: 10px;
}

.login-form.is-password-change {
  gap: 0;
}

.login-details {
  display: grid;
  gap: 10px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(-8px);
  transition:
    max-height 360ms ease,
    opacity 240ms ease,
    transform 260ms ease;
}

.login-details.is-visible {
  max-height: 760px;
  opacity: 1;
  transform: translateY(0);
}

.login-form.is-password-change .login-details {
  max-height: 520px;
  opacity: 1;
  transform: none;
}

.login-form.is-password-change .login-role-field,
.login-form.is-password-change .credential-field {
  display: none;
}

.field-group {
  display: grid;
  gap: 6px;
}

.field-group[hidden],
.form-options[hidden],
.student-type-field[hidden] {
  display: none;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.label-row label {
  color: #1f2f59;
  font-size: 14px;
  font-weight: 700;
}

.label-row span {
  color: #8994aa;
  font-size: 12px;
  font-weight: 700;
}

.field-group input,
.field-group select {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid #c4cce0;
  border-radius: 6px;
  color: #111827;
  font: inherit;
  background: rgba(255, 255, 255, 0.96);
}

.field-group input::placeholder {
  color: #94a3b8;
}

.field-group select {
  cursor: pointer;
}

.field-group input:focus,
.field-group select:focus {
  outline: 3px solid rgba(244, 209, 42, 0.3);
  border-color: #1734c8;
}

.password-field,
.password-visibility-field {
  position: relative;
  display: block;
  width: 100%;
}

.password-field input,
.password-visibility-field input {
  padding-right: 46px !important;
}

/* Hide the browser's native reveal control so only the system eye icon appears. */
.password-field input::-ms-reveal,
.password-field input::-ms-clear,
.password-visibility-field input::-ms-reveal,
.password-visibility-field input::-ms-clear {
  display: none;
}

.password-visibility-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  z-index: 6;
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: #64748b;
  background: transparent;
  font-size: 15px;
  cursor: pointer;
  transform: translateY(-50%);
}

.password-visibility-toggle[hidden] {
  display: none !important;
}

.password-visibility-toggle:hover,
.password-visibility-toggle:focus-visible {
  color: #1734c8;
  background: #eef2ff;
  outline: none;
}

.form-options {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  color: #475569;
  font-size: 14px;
}

.remember-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.remember-option input {
  width: 16px;
  height: 16px;
  accent-color: #1734c8;
}

.primary-button {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(244, 209, 42, 0.85);
  border-radius: 6px;
  color: #ffffff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  background: linear-gradient(135deg, #1734c8, #10237d);
  box-shadow: 0 14px 24px rgba(29, 52, 200, 0.28);
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    filter 180ms ease,
    transform 180ms ease;
}

.primary-button:hover {
  filter: brightness(0.95);
  transform: translateY(-1px);
}

.primary-button:disabled {
  opacity: 0.62;
  cursor: not-allowed;
  filter: none;
  transform: none;
}

.login-submit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.first-login-panel {
  display: grid;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid #d9deec;
}

.first-login-panel[hidden] {
  display: none;
}

.login-form.is-password-change .first-login-panel {
  gap: 14px;
  padding-top: 0;
  border-top: 0;
}

.login-panel.is-password-change .login-copy,
.login-panel.is-password-change .login-security-note {
  display: none;
}

.first-login-heading {
  display: grid;
  gap: 5px;
  padding-bottom: 14px;
  border-bottom: 1px solid #d9deec;
}

.first-login-heading h2,
.first-login-heading p {
  margin: 0;
}

.first-login-heading h2 {
  color: #172033;
  font-size: 25px;
}

.first-login-heading p:not(.dashboard-kicker) {
  color: #64748b;
  line-height: 1.5;
}

.login-role-choice {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(10, 15, 30, 0.45);
}

.login-role-choice[hidden] {
  display: none;
}

.login-role-choice-panel {
  width: min(420px, 100%);
  padding: 24px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
}

.login-role-choice-panel h2 {
  margin: 4px 0 18px;
  color: #172033;
}

.login-role-choice-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.signup-text {
  position: relative;
  margin: 12px 0 0;
  color: #475569;
  font-size: 14px;
  text-align: center;
}

.security-note {
  position: relative;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #d9deec;
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.login-error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 6px;
  color: #991b1b;
  background: #fee2e2;
  font-size: 13px;
  font-weight: 800;
}

.login-error[hidden] {
  display: none;
}

.registration-message {
  margin: 0;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
}

.registration-message[hidden] {
  display: none;
}

.registration-message-success {
  border: 1px solid #bbf7d0;
  color: #166534;
  background: #dcfce7;
}

.registration-message-error {
  border: 1px solid #fecaca;
  color: #991b1b;
  background: #fee2e2;
}

.dashboard-layout {
  height: 100vh;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  overflow: hidden;
  transition: filter 250ms ease;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 24px 18px;
  color: #ffffff;
  background: #10237d;
}

.sidebar-brand {
  color: #ffffff;
}

.sidebar-brand:hover {
  text-decoration: none;
}

.sidebar-brand strong {
  display: block;
  color: #ffffff;
  font-size: 18px;
  line-height: 1.2;
}

.sidebar .brand-kicker {
  display: block;
  color: #f4d12a;
}

.module-nav {
  display: grid;
  gap: 8px;
  margin-top: 32px;
}

.module-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 6px;
  color: #dbeafe;
  font-weight: 800;
  transition:
    color 180ms ease,
    background-color 180ms ease,
    transform 180ms ease;
}

.module-link:hover,
.module-link.is-active {
  color: #10237d;
  background: #f4d12a;
  text-decoration: none;
}

.module-link:hover {
  transform: translateX(2px);
}

.module-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-logout {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-top: auto;
  padding: 10px 14px;
  border: 1px solid rgba(244, 209, 42, 0.45);
  border-radius: 6px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 800;
  transition:
    color 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    transform 180ms ease;
}

.sidebar-logout:hover {
  color: #10237d;
  border-color: #f4d12a;
  background: #f4d12a;
  text-decoration: none;
  transform: translateX(2px);
}

.logout-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dashboard-main {
  height: 100vh;
  min-width: 0;
  overflow-y: auto;
  padding: 28px;
}

.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.school-banner-header {
  min-height: 148px;
  align-items: flex-end;
  padding: 22px 24px;
  overflow: hidden;
  border: 1px solid #d9deec;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.82) 0%, rgba(255, 255, 255, 0.62) 34%, rgba(255, 255, 255, 0.08) 66%, rgba(255, 255, 255, 0) 100%),
    url("../img/sl.jpg") center / cover no-repeat;
  box-shadow: 0 18px 38px rgba(23, 32, 51, 0.1);
}

.school-banner-header h1 {
  color: #0b2545;
}

.school-banner-header .dashboard-subtitle {
  max-width: 620px;
  color: #1f2f59;
  font-weight: 700;
}

.school-banner-header .header-actions {
  align-self: flex-start;
}

.school-banner-header .ghost-button {
  border-color: rgba(255, 255, 255, 0.72);
  color: #10237d;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
}

.dashboard-kicker,
.dashboard-subtitle {
  margin: 0;
}

.dashboard-kicker {
  color: #1734c8;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.dashboard-header h1 {
  margin-top: 4px;
  color: #172033;
  font-size: 30px;
}

.dashboard-subtitle {
  margin-top: 8px;
  color: #64748b;
  line-height: 1.5;
}

.header-actions {
  flex: 0 0 auto;
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid #c4cce0;
  border-radius: 6px;
  color: #1734c8;
  background: #ffffff;
  transition:
    color 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.ghost-button:hover {
  background: #eef2ff;
  text-decoration: none;
  transform: translateY(-1px);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.student-stats-grid {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 16px !important;
}

.stat-card,
.dashboard-section,
.dashboard-panel,
.monitoring-toolbar {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.stat-card {
  display: grid;
  gap: 6px;
  padding: 20px 18px;
  position: relative;
  overflow: hidden;
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.22s ease, border-color 0.22s ease;
  border-top: 4px solid var(--primary);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(23, 52, 200, 0.2);
}

/* Intelligent Top Accents based on index */
.stats-grid article.stat-card:nth-child(1) { border-top-color: var(--primary); }
.stats-grid article.stat-card:nth-child(2) { border-top-color: var(--status-pending); }
.stats-grid article.stat-card:nth-child(3) { border-top-color: var(--status-approved); }
.stats-grid article.stat-card:nth-child(4) { border-top-color: var(--status-declined); }

.stat-card span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card strong {
  color: var(--primary-hover);
  font-size: 32px;
  line-height: 1;
  font-weight: 800;
}

.stat-card small {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

.admin-stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.admin-stats-grid .stat-card {
  gap: 5px;
  min-width: 0;
  padding: 14px 12px;
}

.admin-stats-grid .stat-card span {
  font-size: 11px;
}

.admin-stats-grid .stat-card strong {
  font-size: 26px;
}

.admin-stats-grid .stat-card small {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.monitoring-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 16px;
}

.search-field {
  display: grid;
  gap: 6px;
  width: min(100%, 380px);
}

.search-field label {
  color: #1f2f59;
  font-size: 13px;
  font-weight: 800;
}

.search-field input {
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid #c4cce0;
  border-radius: 6px;
  font: inherit;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-button {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid #c4cce0;
  border-radius: 6px;
  color: #1f2f59;
  background: #ffffff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition:
    color 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    transform 180ms ease;
}

.filter-button.is-active,
.filter-button:hover {
  color: #ffffff;
  border-color: #1734c8;
  background: #1734c8;
  transform: translateY(-1px);
}

.dashboard-section {
  margin-top: 18px;
  overflow: hidden;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid #d9deec;
}

.section-heading h2,
.dashboard-panel h2 {
  margin: 0;
  color: #172033;
  font-size: 20px;
}

.section-heading p {
  margin: 6px 0 0;
  color: #64748b;
  line-height: 1.5;
}

.refresh-pill {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  color: #166534;
  background: #dcfce7;
  font-size: 12px;
  font-weight: 800;
}

.active-term-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid #e5bc11;
  border-radius: 999px;
  color: #10237d;
  background: #fff7cf;
  box-shadow: 0 6px 14px rgba(16, 35, 125, 0.08);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  gap: 6px;
}

.dashboard-header.has-active-term:not(.school-banner-header) > .active-term-badge {
  flex: 0 0 auto;
  margin-left: auto;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.request-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.request-table th,
.request-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  vertical-align: middle;
}

.request-table tbody tr {
  transition: background-color 150ms ease;
}

.request-table tbody tr:hover {
  background-color: rgba(23, 52, 200, 0.02);
}

.request-table th {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.request-table td {
  color: var(--text-main);
  font-size: 14px;
}

.request-table td strong,
.request-table td span {
  display: block;
}

.request-table td strong {
  color: var(--text-main);
}

.request-table td span:not(.status-badge) {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: 1px solid currentColor;
}

.status-badge::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
}

.status-pending {
  color: var(--status-pending);
  background: var(--status-pending-bg);
}

.status-approved {
  color: var(--status-approved);
  background: var(--status-approved-bg);
}

.status-declined {
  color: var(--status-declined);
  background: var(--status-declined-bg);
}

.status-neutral {
  color: var(--text-muted);
  background: #f1f5f9;
}

.system-status-message {
  margin: 0 18px 14px;
  padding: 12px 14px;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  color: #7c2d12;
  background: #fff7ed;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.4;
}

.system-status-message[hidden] {
  display: none;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
  margin-top: 18px;
}

.dashboard-panel {
  padding: 18px;
}

.registration-section {
  margin-bottom: 18px;
}

.bulk-upload-section {
  margin-top: 18px;
}

.bulk-upload-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.7fr);
  gap: 0;
}

.bulk-upload-panel,
.bulk-upload-guide {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 18px;
}

.bulk-upload-guide {
  border-left: 1px solid #e7ebf3;
  background: #f8faff;
}

.bulk-upload-guide h3,
.bulk-upload-guide p,
.bulk-upload-guide ul {
  margin: 0;
}

.bulk-upload-guide h3 {
  color: #172033;
  font-size: 17px;
}

.bulk-upload-guide ul {
  display: grid;
  gap: 8px;
  padding-left: 20px;
  color: #475569;
  font-weight: 700;
  line-height: 1.5;
}

.bulk-upload-guide p {
  color: #64748b;
  line-height: 1.5;
}

.bulk-upload-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid #e7ebf3;
  border-radius: 8px;
  background: #f8faff;
}

.bulk-file-field {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.bulk-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.bulk-file-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid #c4cce0;
  border-radius: 6px;
  color: #1734c8;
  background: #ffffff;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition:
    color 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    transform 180ms ease;
}

.bulk-file-button:hover,
.bulk-file-input:focus + .bulk-file-button {
  background: #eef2ff;
  transform: translateY(-1px);
}

.bulk-upload-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.bulk-template-menu {
  position: relative;
  width: fit-content;
}

.bulk-template-choices {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  width: fit-content;
  display: grid;
  grid-template-columns: repeat(2, max-content);
  gap: 8px;
  padding: 8px;
  border: 1px solid #e7ebf3;
  border-radius: 8px;
  background: #ffffff;
}

.bulk-template-choices[hidden] {
  display: none;
}

.bulk-upload-button,
.bulk-template-button,
.bulk-template-choice,
.bulk-file-cancel {
  width: fit-content;
}

.bulk-upload-button {
  min-width: 96px;
}

.bulk-template-button {
  min-width: 188px;
}

.bulk-file-cancel {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.bulk-file-cancel:disabled {
  color: #94a3b8;
  background: #f1f5f9;
  cursor: not-allowed;
  transform: none;
}

.bulk-file-note {
  min-width: 0;
  overflow: hidden;
  color: #8994aa;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.registration-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 18px;
}

.registration-grid-single {
  grid-template-columns: minmax(0, 980px);
}

.registration-stats-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.registration-dashboard-grid {
  grid-template-columns: minmax(0, 1fr);
}

.registration-dashboard-grid .registered-accounts-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.registration-form {
  display: grid;
  gap: 16px;
  max-width: 1040px;
  padding: 20px;
  border: 1px solid #e7ebf3;
  border-radius: 8px;
  background: #ffffff;
}

.registration-form-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e7ebf3;
}

.registration-form-header h3 {
  margin: 0;
  color: #10237d;
  font-size: 18px;
}

.registration-form-header p {
  margin: 5px 0 0;
  color: #64748b;
  line-height: 1.5;
}

.registration-card-section {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid #e7ebf3;
  border-radius: 8px;
  background: #f8faff;
}

.registration-form > .registration-card-section:first-child {
  max-width: 360px;
}

.registration-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #172033;
}

.registration-section-title span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: #1734c8;
  font-size: 12px;
  font-weight: 800;
}

.registration-section-title strong {
  font-size: 15px;
}

.registration-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.registration-row-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.registration-row-four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.registration-row-single {
  grid-template-columns: max-content;
}

.registration-row-single .field-group {
  width: min(100%, 420px);
}

.registration-row-single #registration-type {
  width: 240px;
  min-width: 0;
}

.student-course-field {
  width: min(100%, 420px);
}

.student-registration-fields .registration-row:not(.registration-row-three):not(.registration-row-four):not(.registration-row-single) {
  grid-template-columns: repeat(2, minmax(220px, 280px));
  justify-content: start;
}

.student-registration-fields .registration-row:not(.registration-row-three):not(.registration-row-four):not(.registration-row-single) .field-group {
  width: min(100%, 280px);
}

.registration-fields {
  display: grid;
  gap: 16px;
}

.registration-fields[hidden] {
  display: none;
}

.irregular-subject-panel {
  display: grid;
  gap: 10px;
}

.irregular-subject-panel[hidden] {
  display: none;
}

.irregular-subject-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 580px;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid #d9deec;
  border-radius: 8px;
  background: #f8fafc;
}

.irregular-subject-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 8px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  color: #172033;
  background: #ffffff;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.irregular-subject-option:hover {
  border-color: #cbd5e1;
  background: #f1f5f9;
}

.irregular-subject-option input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: #1734c8;
}

.irregular-subject-option span,
.irregular-subject-option small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.irregular-subject-option span {
  font-size: 13px;
  font-weight: 800;
}

.irregular-subject-option small {
  grid-column: 2;
  color: #64748b;
  font-size: 12px;
  line-height: 1.4;
}

.irregular-subject-message {
  margin: 0;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 760px) {
  .irregular-subject-list {
    grid-template-columns: 1fr;
  }
}

.registration-password-field {
  grid-template-columns: minmax(0, 1fr) auto;
}

.registration-password-field input {
  color: #10237d;
  font-weight: 800;
}

.password-shuffle-button {
  width: 46px;
  border: 1px solid #c4cce0;
  border-left: 0;
  border-radius: 0 6px 6px 0;
  color: #1734c8;
  background: #f8faff;
  font: inherit;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  transition:
    color 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    transform 180ms ease;
}

.password-shuffle-button:disabled {
  color: #94a3b8;
  cursor: not-allowed;
}

.password-shuffle-button:not(:disabled):hover {
  background: #eef2ff;
  transform: translateY(-1px);
}

.registration-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 4px;
}

.registration-actions .registration-message {
  flex: 1 1 auto;
}

.registration-actions .primary-button {
  width: min(100%, 220px);
  flex: 0 0 auto;
}

.registration-action-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  gap: 10px;
}

.registration-action-buttons .ghost-button,
.registration-action-buttons .primary-button {
  width: auto;
  min-width: 0;
  padding-inline: 18px;
}

.registered-accounts-panel {
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 1px solid #d9deec;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 34px rgba(23, 32, 51, 0.08);
}

.account-directory-panel {
  gap: 18px;
  border-color: #cfd8ea;
  background:
    linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
}

.registered-accounts-panel[hidden] {
  display: none;
}

.registered-accounts-header,
.registered-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.registered-accounts-header {
  padding-bottom: 14px;
  border-bottom: 1px solid #e7ebf3;
}

.panel-kicker {
  display: inline-block;
  margin-bottom: 5px;
  color: #1734c8;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.registered-accounts-header h3,
.registered-accounts-header h2,
.registered-card-heading h3,
.registered-card-heading h4 {
  margin: 0;
  color: #172033;
}

.registered-accounts-header h2 {
  font-size: 20px;
}

.registered-accounts-header p {
  margin: 5px 0 0;
  color: #64748b;
  line-height: 1.5;
}

.directory-result-pill {
  flex: 0 0 auto;
  padding: 7px 11px;
  border: 1px solid #d9deec;
  border-radius: 999px;
  color: #475569;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 800;
}

.account-directory-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.registered-accounts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.registered-account-directory-section {
  margin-top: 18px;
}

.registered-account-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid #e7ebf3;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(23, 32, 51, 0.05);
}

.registered-card-heading {
  align-items: center;
}

.registered-card-heading h3,
.registered-card-heading h4 {
  font-size: 16px;
}

.registered-card-heading p {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.registered-card-heading span {
  min-width: 32px;
  min-height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: #1734c8;
  font-size: 12px;
  font-weight: 800;
}

.account-search-field {
  display: grid;
  gap: 7px;
}

.account-search-field label {
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.account-search-field input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid #d7deed;
  border-radius: 8px;
  color: #172033;
  background: #ffffff;
  font: inherit;
}

.account-search-field input:focus {
  border-color: #1734c8;
  box-shadow: 0 0 0 3px rgba(23, 52, 200, 0.12);
  outline: 0;
}

.registered-account-search {
  width: min(100%, 620px);
  max-width: none;
}

.compact-table-wrap {
  border: 1px solid #e7ebf3;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.registered-account-table {
  min-width: 720px;
}

.registered-account-table th,
.registered-account-table td {
  padding: 13px 12px;
}

.registered-account-table th {
  background: #f8fafc;
  white-space: nowrap;
}

.registered-account-table tr:last-child td {
  border-bottom: 0;
}

.account-identity {
  display: block;
  min-width: 190px;
}

.account-identity-copy,
.account-detail-stack,
.account-contact {
  min-width: 0;
}

.account-identity-copy strong,
.account-detail-stack strong,
.account-contact strong {
  overflow-wrap: anywhere;
}

.account-detail-stack {
  display: grid;
  gap: 5px;
}

.account-contact {
  display: grid;
  gap: 3px;
}

.account-contact span {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.account-chip {
  width: fit-content;
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  margin-top: 0 !important;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 11px !important;
  font-weight: 900;
  line-height: 1;
  text-transform: capitalize;
}

.account-chip-blue {
  border-color: #bfdbfe;
  color: #1d4ed8 !important;
  background: #eff6ff;
}

.account-chip-success {
  border-color: #bbf7d0;
  color: #166534 !important;
  background: #dcfce7;
}

.account-chip-warning {
  border-color: #fde68a;
  color: #92400e !important;
  background: #fef3c7;
}

.account-chip-muted,
.account-chip-neutral {
  border-color: #d9deec;
  color: #475569 !important;
  background: #f8fafc;
}

.account-action-group {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  gap: 8px;
}

.account-action-button {
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid #c4cce0;
  border-radius: 6px;
  color: #1734c8;
  background: #ffffff;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition:
    color 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    transform 180ms ease;
}

.account-action-button:hover {
  background: #eef2ff;
  transform: translateY(-1px);
}

.account-action-button:disabled {
  color: #64748b;
  background: #e2e8f0;
  cursor: not-allowed;
  transform: none;
}

.account-reset-button {
  color: #0f766e;
  border-color: #99f6e4;
  background: #f0fdfa;
}

.account-reset-button:hover {
  background: #ccfbf1;
}

.account-delete-button {
  color: #991b1b;
  border-color: #fecaca;
  background: #fff7f7;
}

.account-delete-button:hover {
  background: #fee2e2;
}

.empty-accounts-message {
  margin: 0;
  padding: 12px;
  border: 1px dashed #c4cce0;
  border-radius: 6px;
  color: #64748b;
  background: #ffffff;
  font-size: 13px;
  font-weight: 700;
}

.empty-accounts-message[hidden] {
  display: none;
}

.simple-dashboard {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.simple-dashboard-panel {
  width: min(100%, 620px);
}

.simple-dashboard-panel h1 {
  margin-top: 4px;
  color: #172033;
  font-size: 30px;
}

.simple-dashboard-panel .ghost-button {
  margin-top: 18px;
}

.timeline-list,
.attention-list {
  display: grid;
  gap: 12px;
  margin: 16px 0 0;
  padding: 0;
}

.timeline-list {
  list-style: none;
}

.timeline-list li,
.attention-list div {
  padding: 12px;
  border: 1px solid #e7ebf3;
  border-radius: 6px;
  background: #f8faff;
}

.timeline-list strong,
.attention-list strong {
  display: block;
  color: #172033;
}

.timeline-list span,
.attention-list span {
  display: block;
  margin-top: 5px;
  color: #64748b;
  line-height: 1.5;
}

.role-dashboard-layout .sidebar {
  background: linear-gradient(180deg, #10237d 0%, #0f2f68 100%);
}

.profile-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-bottom: 18px;
  border: 1px solid #d9deec;
  border-radius: 8px;
  background: #d9deec;
  box-shadow: 0 16px 34px rgba(23, 32, 51, 0.08);
}

.profile-strip div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 16px 18px;
  background: #ffffff;
}

.profile-strip span {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.profile-strip strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #172033;
  font-size: 17px;
}

.role-toolbar {
  align-items: end;
}

.summary-chip {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 13px;
  border: 1px solid #c4cce0;
  border-radius: 999px;
  color: #10237d;
  background: #eef2ff;
  font-size: 13px;
  font-weight: 800;
}

.compact-select {
  width: min(100%, 320px);
}

.subject-table td:nth-child(2) {
  min-width: 220px;
}

.subject-table {
  min-width: 1040px;
}

.subject-table th,
.subject-table td {
  padding-right: 12px;
  padding-left: 12px;
}

.subject-table th:nth-child(3),
.subject-table td:nth-child(3) {
  width: 76px;
}

.subject-table th:nth-child(6),
.subject-table td:nth-child(6) {
  width: 110px;
}

.subject-table th:nth-child(7),
.subject-table td:nth-child(7) {
  width: 230px;
}

.subject-table td:nth-child(3),
.subject-table td:nth-child(4) {
  font-weight: 700;
}

.subject-upload-panel {
  display: grid;
  gap: 8px;
  min-width: 220px;
}

.subject-file-input {
  width: 100%;
  max-width: 260px;
  color: #334155;
  font-size: 12px;
}

.selected-file-summary {
  margin: 0;
  color: #1734c8;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.student-teacher-cell {
  display: grid;
  gap: 8px;
  min-width: 160px;
}

.student-signature-preview {
  display: grid;
  gap: 4px;
  width: min(100%, 160px);
  padding: 8px;
  border: 1px solid #d9deec;
  border-radius: 6px;
  background: #f8faff;
}

.student-signature-preview img {
  width: 100%;
  height: 44px;
  display: block;
  object-fit: contain;
  background: #ffffff;
}

.request-table td .student-signature-preview span {
  margin-top: 0;
  color: #166534;
  font-size: 11px;
  font-weight: 800;
}

.student-status-details {
  display: grid;
  gap: 8px;
  min-width: 190px;
}

.student-remarks-display,
.request-remarks-display {
  max-width: 260px;
  padding: 9px 10px;
  border: 1px solid #fecaca;
  border-radius: 6px;
  color: #7f1d1d;
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  background: #fff7f7;
}

.student-remarks-display strong,
.student-remarks-display span {
  display: block;
}

.student-remarks-display strong {
  color: #991b1b;
  font-size: 11px;
}

.student-remarks-display span {
  margin-top: 4px;
  color: #7f1d1d;
}

.request-remarks-empty {
  color: #94a3b8;
  font-size: 12px;
  font-weight: 800;
}

.student-file-summary,
.upload-status,
.request-file-empty {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.upload-status {
  margin: 0;
  line-height: 1.4;
}

.upload-status-error {
  color: #991b1b;
}

.request-file-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 160px;
}

.request-file-link {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d9deec;
  border-radius: 6px;
  color: #1734c8;
  background: #f8faff;
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  transition:
    color 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    transform 180ms ease;
}

.request-file-link:hover {
  background: #eef2ff;
  text-decoration: none;
  transform: translateY(-1px);
}

.request-file-link strong,
.request-file-link span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.request-file-link span {
  color: #64748b;
  font-weight: 700;
}

/* Compact file links styling */
.request-file-link.compact-file-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.request-file-link.compact-file-link strong {
  font-weight: 600;
  color: #1e293b;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.request-file-link.compact-file-link span {
  font-size: 10px;
  color: #64748b;
  font-weight: 500;
}

.dashboard-empty {
  margin: 16px;
}

.faculty-request-groups {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.bulk-approval-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid #e7ebf3;
  background: #f8faff;
  box-sizing: border-box;
  width: 100%;
}

.bulk-approval-toolbar select#filter-handled-assignment {
  width: 100%;
  max-width: 340px;
  height: 38px !important;
  min-height: 38px !important;
  padding: 0 10px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  border-radius: 6px !important;
  border: 1px solid #cbd5e1 !important;
  background: #ffffff !important;
  color: #0f172a !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

.bulk-approval-toolbar[hidden] {
  display: none;
}

.bulk-approval-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #1f2f59;
  font-size: 13px;
  font-weight: 800;
}

.bulk-approval-select input,
.bulk-request-selector input {
  width: 16px;
  height: 16px;
  accent-color: #1734c8;
}

.bulk-approval-button {
  min-height: 34px;
}

.bulk-approval-count {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.bulk-request-selector {
  display: inline-grid;
  place-items: center;
}

.faculty-request-card {
  overflow: hidden;
  border: 1px solid #e7ebf3;
  border-radius: 8px;
  background: #ffffff;
}

.faculty-request-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid #e7ebf3;
  background: #f8faff;
}

.faculty-request-card-header h3 {
  min-width: 0;
  margin: 0;
  color: #172033;
  font-size: 17px;
  overflow-wrap: anywhere;
}

.faculty-request-card-header .summary-chip {
  min-height: 32px;
  white-space: nowrap;
}

.faculty-request-card {
  padding: 10px 14px;
  margin-bottom: 12px;
  border-radius: 8px;
}

.faculty-request-card-header {
  margin-bottom: 8px;
  padding-bottom: 6px;
}

.faculty-request-card-header h3 {
  font-size: 14.5px;
}

.faculty-request-table {
  min-width: 960px;
  table-layout: fixed;
}

.faculty-request-table th,
.faculty-request-table td {
  padding: 6px 8px;
  font-size: 12.5px;
}

.faculty-request-table th:nth-child(1),
.faculty-request-table td:nth-child(1) {
  width: 50px;
}

.faculty-request-table th:nth-child(4),
.faculty-request-table td:nth-child(4) {
  width: 118px;
}

.faculty-request-table th:nth-child(5),
.faculty-request-table td:nth-child(5) {
  width: 170px;
}

.faculty-request-table th:nth-child(6),
.faculty-request-table td:nth-child(6) {
  width: 100px;
}

.faculty-request-table th:nth-child(7),
.faculty-request-table td:nth-child(7) {
  width: 180px;
}

.faculty-request-table th:nth-child(8),
.faculty-request-table td:nth-child(8) {
  width: 112px;
}

.faculty-request-table td strong {
  font-size: 12.5px;
  display: block;
}

.faculty-request-table td span {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-top: 1px;
}

.approver-student-with-photo {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.approver-student-details {
  min-width: 0;
}

.approver-student-photo-button {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  padding: 0;
  overflow: hidden;
  border: 2px solid #f4cc21;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 2px 7px rgba(10, 39, 118, 0.16);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.approver-student-photo-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 11px rgba(10, 39, 118, 0.24);
}

.approver-student-photo-button:focus-visible {
  outline: 3px solid rgba(29, 58, 197, 0.25);
  outline-offset: 2px;
}

.approver-student-photo-thumbnail {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.approver-profile-preview {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 18, 59, 0.72);
  backdrop-filter: blur(3px);
}

.approver-profile-preview[hidden] {
  display: none;
}

.approver-profile-preview-card {
  position: relative;
  width: min(430px, 100%);
  padding: 52px 28px 28px;
  border: 1px solid rgba(244, 204, 33, 0.8);
  border-radius: 22px;
  background: #fff;
  text-align: center;
  box-shadow: 0 24px 70px rgba(2, 17, 60, 0.34);
}

.approver-profile-preview-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid #d5def0;
  border-radius: 11px;
  color: #17328b;
  background: #f7f9fd;
  cursor: pointer;
}

.approver-profile-preview-close:hover,
.approver-profile-preview-close:focus-visible {
  color: #fff;
  background: #1738bd;
}

.approver-profile-preview-image {
  display: block;
  width: min(300px, 100%);
  aspect-ratio: 1;
  margin: 0 auto 19px;
  border: 4px solid #f4cc21;
  border-radius: 18px;
  object-fit: cover;
  background: #eef2f9;
}

.approver-profile-preview-name {
  display: block;
  color: #071f59;
  font-size: 20px;
  line-height: 1.25;
}

.approver-profile-preview-id {
  display: block;
  margin-top: 6px;
  color: #64728f;
  font-size: 14px;
  font-weight: 700;
}

body.approver-profile-preview-open {
  overflow: hidden;
}

@media (max-width: 560px) {
  .approver-profile-preview {
    padding: 14px;
  }

  .approver-profile-preview-card {
    padding: 50px 18px 22px;
    border-radius: 18px;
  }
}

.faculty-request-table .request-file-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 80px;
  overflow-y: auto;
}

.faculty-request-table .request-file-link {
  font-size: 10.5px;
  padding: 2px 4px !important;
  border-radius: 3px;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  width: 100%;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  height: auto !important;
  min-height: unset !important;
}

.faculty-request-table .request-file-link strong {
  font-size: 10.5px;
  display: inline;
  font-weight: 500;
  color: var(--text-main);
}

.faculty-request-table .request-file-link span {
  font-size: 9.5px;
  display: inline;
  margin-left: 2px;
  color: var(--text-muted);
}

.faculty-request-table .request-remarks-display {
  max-width: 100%;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  word-break: break-word;
}

.faculty-request-table .request-action-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.faculty-request-table .request-action-button {
  min-width: 80px;
  padding: 4px 8px;
  font-size: 11.5px;
  height: 26px;
  border-radius: 4px;
}

.faculty-request-table .status-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
}

.request-action-button {
  min-width: 112px;
}

.request-approve-button {
  color: #166534;
  border-color: #bbf7d0;
  background: #f0fdf4;
  transition:
    color 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    transform 180ms ease;
}

.request-approve-button:not(:disabled):hover {
  background: #dcfce7;
  transform: translateY(-1px);
}

.request-decline-button {
  color: #991b1b;
  border-color: #fecaca;
  background: #fff7f7;
  transition:
    color 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    transform 180ms ease;
}

.request-decline-button:not(:disabled):hover {
  background: #fee2e2;
  transform: translateY(-1px);
}

.request-approve-button:disabled,
.request-decline-button:disabled {
  color: #64748b;
  border-color: #c4cce0;
  background: #e2e8f0;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
}

.role-dashboard-grid {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.78fr);
}

.role-dashboard-grid .attention-list {
  margin-top: 14px;
}

.role-dashboard-grid .attention-list div {
  background: #ffffff;
}

.settings-section {
  max-width: 920px;
}

.settings-password-section {
  width: min(100%, 460px);
  max-width: 460px;
}

.faculty-settings-section {
  width: min(100%, 680px);
  max-width: 680px;
}

.faculty-settings-section .section-heading {
  padding: 16px 18px;
}

.faculty-settings-section .section-heading h2 {
  font-size: 19px;
}

.faculty-settings-section .section-heading p {
  margin-top: 4px;
  font-size: 14px;
}

.faculty-settings-grid {
  display: grid;
  grid-template-columns: minmax(230px, 0.82fr) minmax(280px, 1fr);
  align-items: stretch;
  gap: 0;
}

.settings-password-form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.faculty-settings-section .settings-password-form {
  align-content: start;
  gap: 12px;
  padding: 16px;
}

.faculty-settings-section .field-group {
  gap: 5px;
}

.faculty-settings-section .label-row label {
  font-size: 13px;
}

.faculty-settings-section .label-row span {
  font-size: 11px;
}

.faculty-settings-section .field-group input {
  min-height: 38px;
  padding: 8px 11px;
}

.faculty-signature-panel input[type="file"]::file-selector-button {
  min-height: 30px;
  margin-right: 10px;
  padding: 6px 10px;
  border: 1px solid #c4cce0;
  border-radius: 6px;
  color: #1f2f59;
  background: #ffffff;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition:
    color 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease;
}

.faculty-signature-panel input[type="file"]::file-selector-button:hover {
  background: #eef2ff;
}

.settings-password-button {
  width: fit-content;
  min-width: 82px;
  min-height: 34px;
  padding: 7px 13px;
  font-size: 13px;
  box-shadow: 0 8px 16px rgba(29, 52, 200, 0.18);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.faculty-signature-panel {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
  border-left: 1px solid #e7ebf3;
  background: #f8fafc;
}

.faculty-signature-panel .settings-subheading {
  padding-bottom: 4px;
  border-bottom: 1px solid #e7ebf3;
}

.faculty-signature-panel .settings-subheading h3 {
  font-size: 16px;
  margin-bottom: 2px;
}

.faculty-signature-panel .settings-subheading p {
  max-width: 40ch;
  font-size: 13px;
  line-height: 1.35;
  margin-top: 2px;
  margin-bottom: 0;
}

.signature-preview-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 0;
  width: fit-content;
  height: fit-content;
  max-width: 320px;
  max-height: 260px;
  min-width: 140px;
  justify-self: center;
  margin: 0 auto;
  border: 1px dashed #b8c3d8;
  border-radius: 8px;
  color: #64748b;
  background: #ffffff;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  overflow: hidden;
  box-sizing: border-box;
  transition: all 0.25s ease;
}

.signature-preview-box.has-signature {
  border-style: solid;
  border-color: #d7deed;
  box-shadow: 0 1px 4px rgba(23, 52, 200, 0.06), inset 0 0 0 1px rgba(23, 52, 200, 0.04);
}

.signature-preview-image-wrap {
  width: fit-content;
  height: fit-content;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  cursor: pointer;
  position: relative;
  background: #fdfdfe;
  transition: background 0.2s ease;
  box-sizing: border-box;
}

.signature-preview-image-wrap:hover {
  background: #f4f6fb;
}

.signature-preview-image-wrap::after {
  content: "\1F50D";
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.signature-preview-image-wrap:hover::after {
  opacity: 0.5;
}

.signature-preview-box img {
  max-width: 280px;
  max-height: 180px;
  width: auto;
  height: auto;
  display: block;
}

.signature-empty-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 220px;
  height: 120px;
  padding: 12px 16px;
  color: #475569;
  background: #f1f5f9;
  font-weight: 600;
  box-sizing: border-box;
}

.signature-preview-meta {
  width: 100%;
  padding: 8px 12px;
  border-top: 1px solid #eef2f7;
  color: #475569;
  background: #f8fafc;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
}

.signature-preview-box span,
.signature-preview-meta {
  overflow-wrap: anywhere;
}

/* â”€â”€ Signature Lightbox Modal â”€â”€ */
.sig-lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.sig-lightbox-overlay.active {
  opacity: 1;
  visibility: visible;
}

.sig-lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
  padding: 20px 20px 16px 20px;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
  transform: scale(0.92);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.sig-lightbox-overlay.active .sig-lightbox-content {
  transform: scale(1);
}

.sig-lightbox-content img {
  display: block;
  max-width: 72vw;
  max-height: 60vh;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

.sig-lightbox-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
}

.sig-crop-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  background: #1e3a8a;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(30, 58, 138, 0.25);
  transition: background 0.2s ease, transform 0.15s ease;
}

.sig-crop-btn:hover {
  background: #2563eb;
  transform: translateY(-1px);
}

/* â”€â”€ Interactive Manual Cropper Modal â”€â”€ */
.sig-cropper-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.sig-cropper-overlay.active {
  opacity: 1;
  visibility: visible;
}

.sig-cropper-modal {
  position: relative;
  width: min(92vw, 640px);
  max-height: 90vh;
  padding: 20px;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transform: scale(0.92);
  transition: transform 0.25s ease;
}

.sig-cropper-overlay.active .sig-cropper-modal {
  transform: scale(1);
}

.sig-cropper-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 10px;
}

.sig-cropper-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.sig-cropper-instruction {
  font-size: 12px;
  color: #64748b;
  margin: 0;
}

.sig-cropper-canvas-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
  border-radius: 8px;
  overflow: hidden;
  padding: 10px;
  user-select: none;
  touch-action: none;
}

.sig-cropper-canvas-wrap canvas {
  display: block;
  max-width: 100%;
  max-height: 52vh;
  cursor: crosshair;
}

.sig-cropper-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid #e2e8f0;
  padding-top: 12px;
}

.sig-cropper-btn-apply {
  padding: 8px 18px;
  border: none;
  border-radius: 6px;
  background: #16a34a;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.3);
  transition: background 0.2s ease;
}

.sig-cropper-btn-apply:hover {
  background: #15803d;
}

.sig-cropper-btn-cancel {
  padding: 8px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* â”€â”€ Interactive Manual Cropper & Signature Editor Modal â”€â”€ */
.sig-editor-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.sig-editor-overlay.active {
  opacity: 1;
  visibility: visible;
}

.sig-editor-modal {
  position: relative;
  width: min(94vw, 760px);
  max-height: 92vh;
  padding: 20px;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform: scale(0.92);
  transition: transform 0.25s ease;
}

.sig-editor-overlay.active .sig-editor-modal {
  transform: scale(1);
}

.sig-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 10px;
}

.sig-editor-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sig-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.sig-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sig-tool-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.sig-tool-btn-accent {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.sig-tool-btn-accent:hover {
  background: #dbeafe;
  border-color: #3b82f6;
  color: #1e40af;
}

.sig-editor-viewport {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
  border-radius: 10px;
  overflow: hidden;
  padding: 12px;
  min-height: 280px;
  user-select: none;
  touch-action: none;
}

.sig-editor-viewport canvas {
  display: block;
  max-width: 100%;
  max-height: 52vh;
  border-radius: 4px;
}

.sig-editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #e2e8f0;
  padding-top: 12px;
  gap: 10px;
}

.sig-editor-hint {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}

.sig-editor-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

@media (max-width: 600px) {
  .sig-editor-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .sig-editor-actions {
    justify-content: flex-end;
  }
  .sig-editor-toolbar {
    justify-content: center;
  }
}

.sig-lightbox-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: #1e293b;
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: background 0.15s ease, transform 0.15s ease;
}

.sig-lightbox-close:hover {
  background: #dc2626;
  transform: scale(1.1);
}

@media (max-width: 480px) {
  .sig-lightbox-content {
    max-width: 95vw;
    padding: 14px;
  }
  .sig-lightbox-content img {
    max-width: 88vw;
    max-height: 60vh;
  }
  .sig-lightbox-close {
    top: -10px;
    right: -10px;
    width: 28px;
    height: 28px;
    font-size: 14px;
  }
}

.faculty-signature-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.faculty-signature-button {
  width: fit-content;
  min-width: 118px;
  min-height: 34px;
  padding: 7px 12px;
  font-size: 13px;
  box-shadow: 0 8px 16px rgba(29, 52, 200, 0.18);
}

.faculty-signature-delete-button {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.csc-dashboard-main {
  --csc-green: #1734c8;
  --csc-gold: #f4d12a;
  --csc-ink: #10237d;
  --csc-soft: #f7f9ff;
}

.csc-president-header {
  padding-bottom: 20px;
  border-color: #d7deed;
  border-bottom: 3px solid var(--csc-gold);
}

.csc-president-header h1 {
  color: var(--csc-ink);
}

.csc-dashboard-main > .stats-grid,
.csc-dashboard-main > #handled {
  display: none !important;
}

.csc-officer-card {
  border: 1px solid #cfd8f0;
  border-left: 5px solid var(--csc-green);
  background: linear-gradient(90deg, #f7f9ff 0%, #ffffff 68%);
  box-shadow: 0 10px 24px rgba(16, 35, 125, 0.07);
}

.csc-officer-card div {
  background: #fff;
}

.csc-officer-card span,
.csc-stats-grid .stat-card span {
  color: #516079;
}

.csc-officer-card strong,
.csc-stats-grid .stat-card strong {
  color: var(--csc-ink);
}

.csc-stats-grid .stat-card {
  border-color: #d7deed;
}

.csc-stats-grid .stat-card:nth-child(3) {
  border-top: 3px solid var(--csc-green);
}

.csc-stats-grid .stat-card:nth-child(4) {
  border-top: 3px solid var(--csc-gold);
}

.csc-request-toolbar {
  border: 1px solid #d7deed;
  border-left: 4px solid var(--csc-gold);
  background: var(--csc-soft);
  box-shadow: 0 8px 20px rgba(16, 35, 125, 0.06);
}

.csc-dashboard-main .csc-request-toolbar ~ #requests {
  margin-top: 0;
}

.csc-dashboard-main .faculty-request-card {
  border-color: #d7deed;
}

.csc-dashboard-main .faculty-request-card-header {
  background: #f7f9ff;
}

.csc-dashboard-main .faculty-request-card-header h3 {
  color: var(--csc-ink);
}

.csc-dashboard-main .bulk-approval-toolbar {
  border-color: #d7deed;
  background: var(--csc-soft);
}

.csc-dashboard-main .refresh-pill {
  border: 1px solid #e5bc11;
  color: var(--csc-ink);
  background: #fff7cf;
}

.csc-dashboard-main .request-approve-button {
  color: #ffffff;
  border-color: var(--csc-green);
  background: var(--csc-green);
}

.csc-dashboard-main .request-approve-button:hover:not(:disabled) {
  color: #ffffff;
  border-color: var(--csc-ink);
  background: var(--csc-ink);
}

.csc-dashboard-main .request-approve-button:focus,
.csc-dashboard-main .request-approve-button:focus-visible,
.csc-dashboard-main .request-approve-button:active {
  color: #ffffff;
  border-color: var(--csc-ink);
  background: var(--csc-ink);
}

.csc-dashboard-main .request-approve-button:disabled {
  color: #ffffff;
  border-color: #334bc7;
  background: #334bc7;
  opacity: 1;
}

.admin-account-section {
  margin-top: 18px;
}

.settings-stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-settings-main > .dashboard-header,
.admin-settings-main > .settings-stats-grid,
.admin-settings-main > .settings-dashboard-grid {
  width: min(100%, 1280px);
  margin-right: auto;
  margin-left: auto;
}

.admin-settings-main .dashboard-header {
  margin-bottom: 18px;
}

.settings-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.75fr);
  align-items: start;
  gap: 18px;
  margin-top: 18px;
}

.admin-settings-main .settings-section {
  max-width: none;
  margin-top: 0;
}

.admin-settings-main .section-heading {
  padding: 20px 22px;
}

.settings-form {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.admin-account-form {
  background: #ffffff;
}

.semester-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.semester-option {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border: 1px solid #d9deec;
  border-radius: 8px;
  background: #f8faff;
  cursor: pointer;
}

.semester-option.is-selected {
  border-color: #1734c8;
  background: #eef2ff;
  box-shadow: inset 0 0 0 1px #1734c8;
}

.semester-option:has(input:checked) {
  border-color: #1734c8;
  background: #eef2ff;
  box-shadow: inset 0 0 0 1px #1734c8;
}

.semester-option input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: #1734c8;
}

.semester-option strong,
.semester-option small {
  display: block;
}

.semester-option strong {
  color: #172033;
}

.semester-option small {
  margin-top: 5px;
  color: #64748b;
  font-weight: 700;
  line-height: 1.5;
}

.settings-card-section {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid #e7ebf3;
  border-radius: 8px;
  background: #f8faff;
}

.settings-subheading h3,
.settings-subheading p {
  margin: 0;
}

.settings-subheading h3 {
  color: #172033;
  font-size: 17px;
}

.settings-subheading p {
  margin-top: 5px;
  color: #64748b;
  line-height: 1.5;
}

.school-year-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.admin-account-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.settings-dashboard-grid .admin-account-grid {
  grid-template-columns: 1fr;
}

.settings-dashboard-grid .admin-account-section {
  position: sticky;
  top: 92px;
}

.archive-school-year-button,
.update-admin-account-button {
  width: fit-content;
}

.settings-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.settings-actions .registration-message {
  flex: 1 1 auto;
}

.settings-save-button {
  width: min(100%, 220px);
  flex: 0 0 auto;
}


@media (max-width: 480px) {
  body.dashboard-body {
    overflow: auto;
  }

  .login-page {
    min-height: 100vh;
    height: auto;
    place-items: center;
    padding: 12px;
    overflow: auto;
  }

  .login-shell {
    height: auto;
    min-height: 0;
    display: block;
  }

  .login-identity {
    padding: 22px;
  }

  .login-panel {
    border-top: 5px solid #f4d12a;
    border-left: 0;
    padding: 20px;
  }

  .brand-block-large {
    align-items: center;
    gap: 12px;
    margin-top: 0;
  }

  .brand-block-large .brand-mark {
    width: 74px;
    height: 74px;
    border-width: 4px;
  }

  .login-identity .brand-kicker {
    font-size: 13px;
  }

  .login-identity h1 {
    font-size: 25px;
  }

  .identity-tagline {
    margin-top: 16px;
    font-size: 13px;
  }

  h1 {
    font-size: 23px;
  }

  .form-options {
    align-items: flex-start;
    flex-direction: column;
  }

  .label-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .dashboard-layout {
    height: auto;
    min-height: 100vh;
    display: block;
    overflow: visible;
  }

  .sidebar {
    position: static;
    height: auto;
    overflow: visible;
  }

  .module-nav,
  .stats-grid,
  .dashboard-grid,
  .bulk-upload-grid,
  .registration-grid,
  .registration-row,
  .registration-row-three,
  .registration-row-four,
  .profile-strip,
  .faculty-settings-grid,
  .role-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-main {
    height: auto;
    overflow: visible;
    padding: 18px 12px;
  }

  .dashboard-header,
  .monitoring-toolbar,
  .section-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .school-banner-header {
    min-height: 138px;
    padding: 16px;
    background:
      linear-gradient(90deg, rgba(255, 255, 255, 0.88) 0%, rgba(255, 255, 255, 0.66) 56%, rgba(255, 255, 255, 0.2) 100%),
      url("../img/sl.jpg") center / cover no-repeat;
  }

  .school-banner-header .header-actions {
    align-self: stretch;
  }

  .compact-select {
    width: 100%;
  }

  .dashboard-header h1 {
    font-size: 25px;
  }

  .stats-grid {
    gap: 10px;
  }

  .admin-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .registration-stats-grid,
  .registration-dashboard-grid,
  .settings-stats-grid,
  .semester-options,
  .school-year-grid,
  .admin-account-grid {
    grid-template-columns: 1fr;
  }

  .filter-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .registration-form {
    padding: 14px;
  }

  .registration-form-header,
  .registration-actions,
  .registration-action-buttons,
  .registered-accounts-header,
  .account-directory-toolbar,
  .settings-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .registration-actions .primary-button,
  .registration-action-buttons .ghost-button,
  .registration-action-buttons .primary-button,
  .settings-save-button,
  .archive-school-year-button,
  .update-admin-account-button {
    width: 100%;
    min-width: 0;
  }

  .registered-accounts-grid {
    grid-template-columns: 1fr;
  }

  .registration-action-buttons {
    align-items: center;
    flex-direction: row;
    justify-content: flex-end;
  }

  .registration-action-buttons .ghost-button,
  .registration-action-buttons .primary-button {
    width: auto;
    min-width: 0;
  }

  .bulk-upload-guide {
    border-top: 1px solid #e7ebf3;
    border-left: 0;
  }

  .bulk-upload-button,
  .bulk-template-button,
  .bulk-template-choice,
  .bulk-file-cancel {
    width: 100%;
  }

  .bulk-file-field {
    grid-template-columns: 1fr;
  }

  .bulk-upload-toolbar,
  .bulk-upload-actions,
  .bulk-template-choices {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .bulk-template-menu {
    width: 100%;
  }

  .bulk-template-choices {
    position: static;
    margin-top: 8px;
  }

  .bulk-upload-actions {
    flex-direction: column;
  }

  .faculty-signature-panel {
    border-top: 1px solid #e7ebf3;
    border-left: 0;
  }
}

@media (min-width: 481px) and (max-width: 820px) {
  body.dashboard-body {
    overflow: auto;
  }

  .login-page {
    min-height: 100vh;
    height: auto;
    place-items: center;
    padding: 20px;
    overflow: auto;
  }

  .login-shell {
    width: min(100%, 440px);
    height: auto;
    min-height: 0;
    display: block;
  }

  .login-identity {
    padding: 26px;
  }

  .login-panel {
    border-top: 5px solid #f4d12a;
    border-left: 0;
  }

  .brand-block-large {
    gap: 14px;
    margin-top: 0;
  }

  .brand-block-large .brand-mark {
    width: 82px;
    height: 82px;
  }

  .login-identity h1 {
    font-size: 28px;
  }

  .identity-tagline {
    margin-top: 16px;
    font-size: 14px;
  }

  .dashboard-layout {
    height: auto;
    min-height: 100vh;
    display: block;
    overflow: visible;
  }

  .sidebar {
    position: static;
    height: auto;
    overflow: visible;
  }

  .module-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-main {
    height: auto;
    overflow: visible;
    padding: 22px;
  }

  .stats-grid,
  .dashboard-grid,
  .bulk-upload-grid,
  .registration-grid,
  .profile-strip,
  .role-dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .registration-dashboard-grid,
  .faculty-settings-grid,
  .settings-stats-grid,
  .semester-options,
  .school-year-grid,
  .admin-account-grid {
    grid-template-columns: 1fr;
  }

  .registration-row,
  .registration-row-three,
  .registration-row-four {
    grid-template-columns: 1fr;
  }

  .registration-grid-single {
    grid-template-columns: 1fr;
  }

  .monitoring-toolbar,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .school-banner-header {
    min-height: 142px;
    padding: 18px;
  }

  .school-banner-header .header-actions {
    align-self: stretch;
  }

  .compact-select {
    width: 100%;
  }

  .registration-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .account-directory-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .registration-action-buttons {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .registration-actions .primary-button,
  .registration-action-buttons .ghost-button,
  .registration-action-buttons .primary-button,
  .settings-save-button,
  .archive-school-year-button,
  .update-admin-account-button {
    width: 100%;
    min-width: 0;
  }

  .registered-accounts-grid {
    grid-template-columns: 1fr;
  }

  .registration-action-buttons {
    align-items: center;
    flex-direction: row;
    justify-content: flex-end;
  }

  .registration-action-buttons .ghost-button,
  .registration-action-buttons .primary-button {
    width: auto;
    min-width: 0;
  }

  .bulk-upload-guide {
    border-top: 1px solid #e7ebf3;
    border-left: 0;
  }

  .bulk-upload-button,
  .bulk-template-button,
  .bulk-template-choice,
  .bulk-file-cancel {
    width: 100%;
  }

  .bulk-file-field {
    grid-template-columns: 1fr;
  }

  .bulk-upload-toolbar,
  .bulk-upload-actions,
  .bulk-template-choices {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .bulk-template-menu {
    width: 100%;
  }

  .bulk-template-choices {
    position: static;
    margin-top: 8px;
  }

  .bulk-upload-actions {
    flex-direction: column;
  }

  .faculty-signature-panel {
    border-top: 1px solid #e7ebf3;
    border-left: 0;
  }
}

@media (min-width: 821px) and (max-width: 1100px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .settings-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .settings-dashboard-grid .admin-account-section {
    position: static;
  }
}

.dashboard-layout,
.role-dashboard-layout {
  height: 100vh;
  min-height: 100vh;
  display: block;
  overflow: hidden;
}

.dashboard-layout .sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 80;
  width: min(82vw, 280px);
  height: 100vh;
  transform: translateX(-100%);
  box-shadow: 20px 0 42px rgba(2, 8, 23, 0.24);
  transition:
    transform 220ms ease,
    box-shadow 220ms ease;
}

body.sidebar-open .dashboard-layout .sidebar {
  transform: translateX(0);
}

.dashboard-main {
  width: 100%;
  margin-left: 0;
  height: 100vh;
  min-width: 0;
  overflow-y: auto;
  padding-top: 76px;
  transition:
    margin-left 220ms ease,
    width 220ms ease;
}

.sidebar-toggle {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 90;
  width: 44px;
  height: 44px;
  display: none;
  place-items: center;
  gap: 4px;
  padding: 10px;
  border: 1px solid #d9deec;
  border-radius: 8px;
  color: #10237d;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 28px rgba(23, 32, 51, 0.16);
  cursor: pointer;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    transform 180ms ease;
}

.sidebar-toggle:hover {
  border-color: #1734c8;
  background: #eef2ff;
  transform: translateY(-1px);
}

.sidebar-toggle {
  display: inline-grid;
  z-index: 99;
}

.sidebar-toggle span {
  width: 20px;
  height: 2px;
  display: block;
  border-radius: 999px;
  background: currentColor;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

body.sidebar-open .sidebar-toggle span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

body.sidebar-open .sidebar-toggle span:nth-child(2) {
  opacity: 0;
}

body.sidebar-open .sidebar-toggle span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  opacity: 0;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.4);
  transition: opacity 220ms ease;
}

body.sidebar-open .sidebar-backdrop {
  opacity: 1;
  pointer-events: auto;
}

@media (min-width: 821px) {
  body.sidebar-open .dashboard-main {
    width: calc(100% - 280px);
    margin-left: 280px;
  }

  body.sidebar-open .sidebar-backdrop {
    opacity: 0;
    pointer-events: none;
  }
}

@media (max-width: 480px) {
  .dashboard-main {
    height: auto;
    min-height: 100vh;
    padding-top: 74px;
  }

  .dashboard-layout,
  .role-dashboard-layout {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .dashboard-layout .sidebar {
    position: fixed;
    height: 100vh;
    overflow-y: auto;
  }
}

@media (min-width: 481px) and (max-width: 820px) {
  .dashboard-main {
    height: auto;
    min-height: 100vh;
    padding-top: 76px;
  }

  .dashboard-layout,
  .role-dashboard-layout {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .dashboard-layout .sidebar {
    position: fixed;
    height: 100vh;
    overflow-y: auto;
  }
}

:root {
  --drawer-width: 272px;
  --drawer-mobile-width: min(86vw, 292px);
}

.dashboard-layout .sidebar {
  width: var(--drawer-width);
  padding: 24px 18px;
  border-right: 1px solid rgba(244, 209, 42, 0.16);
  background:
    linear-gradient(180deg, #10237d 0%, #0d1d69 100%);
  box-shadow: 22px 0 48px rgba(2, 8, 23, 0.18);
  transition:
    transform 240ms ease,
    box-shadow 240ms ease;
}

.dashboard-layout .sidebar-brand {
  align-items: center;
  gap: 14px;
  min-height: 68px;
  padding: 0 4px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.dashboard-layout .sidebar-brand .brand-mark {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  box-shadow: none;
}

.dashboard-layout .sidebar-brand .brand-kicker {
  font-size: 12px;
  letter-spacing: 0;
}

.dashboard-layout .sidebar-brand strong {
  font-size: 22px;
  line-height: 1.08;
}

.dashboard-layout .module-nav {
  margin-top: 22px;
}

.dashboard-layout .module-link,
.dashboard-layout .sidebar-logout {
  border-radius: 8px;
}

.dashboard-main {
  padding-top: 82px;
  transition:
    margin-left 240ms ease,
    width 240ms ease,
    padding-top 240ms ease;
}

.sidebar-toggle {
  top: 20px;
  left: 20px;
  width: 46px;
  height: 46px;
  gap: 5px;
  border-radius: 10px;
  border-color: #d7deed;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.16);
}

body.sidebar-open .sidebar-toggle {
  left: 20px;
  top: 22px;
  width: 46px;
  height: 46px;
  padding: 10px;
  color: #10237d;
  border-color: rgba(244, 209, 42, 0.78);
  background: #ffffff;
  box-shadow: 0 10px 20px rgba(2, 8, 23, 0.18);
}



.sidebar-toggle span {
  width: 21px;
}

body.sidebar-open .sidebar-toggle {
  display: none !important;
}

@media (min-width: 821px) {
  body.sidebar-open .dashboard-main {
    width: calc(100% - var(--drawer-width));
    margin-left: var(--drawer-width);
    padding-top: 28px;
  }
}

@media (max-width: 820px) {
  body:not(.sidebar-open) .sidebar-toggle {
    display: inline-grid;
  }

  .dashboard-layout .sidebar {
    width: var(--drawer-mobile-width);
  }
}

/* Custom Responsive Layout Overrides */
@media (max-width: 820px) {
  .student-stats-grid,
  .csc-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  
  .profile-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    background: #ffffff !important;
    gap: 12px !important;
    padding: 12px !important;
  }

  .profile-strip > div {
    border: 1px solid var(--border-color) !important;
    border-radius: 6px !important;
    padding: 12px !important;
  }
}

@media (max-width: 480px) {
  .student-stats-grid,
  .csc-stats-grid {
    grid-template-columns: 1fr !important;
  }
  
  .profile-strip {
    grid-template-columns: 1fr !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    gap: 10px !important;
  }

  .profile-strip > div {
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    background: #ffffff !important;
  }
}

/* --- Mobile View & Desktop Fixed Sidebar Fixes --- */

/* 1. Desktop Layout (Width > 820px): Keep sidebar fixed and open */
@media (min-width: 821px) {
  .dashboard-layout .sidebar {
    transform: translateX(0) !important;
    box-shadow: none !important;
  }
  .sidebar-toggle {
    display: none !important;
  }
  .dashboard-main {
    width: calc(100% - var(--drawer-width)) !important;
    margin-left: var(--drawer-width) !important;
    padding-top: 28px !important;
  }
}

/* 2. Mobile & Tablet Close Button Inside Sidebar */
.sidebar-close {
  display: none;
}

@media (max-width: 820px) {
  .sidebar-close {
    display: flex !important;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    z-index: 100;
    transition: background-color 150ms ease, transform 150ms ease;
  }
  .sidebar-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
  }
  .sidebar-close:active {
    transform: scale(0.95);
  }
}

/* 3. Table Styling for Compact Mobile View */
@media (max-width: 480px) {
  .request-table th,
  .request-table td {
    padding: 10px 12px !important;
    font-size: 13px !important;
  }
}

/* 4. Settings Modal Sizing & Padding Overrides */
@media (max-width: 480px) {
  body #settings {
    padding: 0.5rem !important;
  }
  body #settings .modal-card {
    border-radius: 8px !important;
  }
  body #settings .modal-body {
    padding: 1rem !important;
  }
}

/* 5. Admin Registration Mobile Stacking (Force 1-Column) */
@media (max-width: 820px) {
  .registration-grid-single {
    grid-template-columns: 1fr !important;
  }
  .student-registration-fields .registration-row:not(.registration-row-three):not(.registration-row-four):not(.registration-row-single) {
    grid-template-columns: 1fr !important;
  }
  .student-registration-fields .registration-row:not(.registration-row-three):not(.registration-row-four):not(.registration-row-single) .field-group {
    width: 100% !important;
    max-width: none !important;
  }
}

/* 6. Bulk Approval Toolbar Mobile Stack */
@media (max-width: 480px) {
  .bulk-approval-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }
  .bulk-approval-button {
    width: 100% !important;
  }
  .bulk-approval-count {
    text-align: center !important;
  }
}

/* 7. Settings Dashboard Grid and Stats Stacking on Mobile/Tablet */
@media (max-width: 820px) {
  .settings-dashboard-grid {
    grid-template-columns: 1fr !important;
  }
}
@media (max-width: 480px) {
  .stats-grid,
  .admin-stats-grid {
    grid-template-columns: 1fr !important;
  }
}

/* 8. Student Subjects Table Card-Layout on Mobile */
@media (max-width: 600px) {
  .student-subject-table {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    border: none !important;
  }
  .student-subject-table thead {
    display: none !important;
  }
  .student-subject-table tbody {
    display: block !important;
    width: 100% !important;
  }
  .student-subject-table tr {
    display: block !important;
    width: 100% !important;
    background: #ffffff !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    padding: 14px !important;
    margin-bottom: 14px !important;
    box-shadow: var(--shadow-sm) !important;
  }
  .student-subject-table td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    text-align: right !important;
    padding: 8px 0 !important;
    border: none !important;
    border-bottom: 1px solid #f1f5f9 !important;
    width: 100% !important;
    min-height: 38px !important;
    box-sizing: border-box !important;
  }
  .student-subject-table td:last-child {
    border-bottom: none !important;
    padding-bottom: 0 !important;
  }
  
  /* Add labels before the content using css pseudo elements */
  .student-subject-table td::before {
    content: "";
    font-weight: 800;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    text-align: left;
    margin-right: 12px;
    flex-shrink: 0;
  }
  .student-subject-table td:nth-child(1)::before { content: "Subject"; }
  .student-subject-table td:nth-child(2)::before { content: "Description"; }
  .student-subject-table td:nth-child(3)::before { content: "Units"; }
  .student-subject-table td:nth-child(4)::before { content: "Teacher / Prof."; }
  .student-subject-table td:nth-child(5)::before { content: "Status"; }
  .student-subject-table td:nth-child(6)::before { content: "Action"; }
  .student-subject-table td:nth-child(7)::before { content: "Files / Images"; }

  /* Particular adjustments to make elements look clean in cards */
  .student-subject-table td:nth-child(7) {
    display: block !important;
    text-align: left !important;
    border-bottom: none !important;
    padding-bottom: 0 !important;
  }
  .student-subject-table td:nth-child(7)::before {
    display: block !important;
    margin-bottom: 8px !important;
  }
  .student-subject-table .subject-upload-panel {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
    min-width: 0 !important;
    margin-top: 4px !important;
  }
  .student-subject-table .subject-file-input {
    max-width: none !important;
    width: 100% !important;
  }
  .student-subject-table .student-teacher-cell {
    min-width: 0 !important;
    display: inline-block !important;
    text-align: right !important;
  }
  .student-subject-table .student-teacher-cell strong {
    font-size: 15px !important;
    line-height: 1.3;
  }
  .student-subject-table td:nth-child(1) strong {
    font-size: 15px !important;
    line-height: 1.3;
  }
  .student-subject-table td:nth-child(6) .account-action-button {
    min-height: 38px;
    padding: 8px 13px;
    font-size: 14px;
  }
  .student-subject-table .subject-upload-panel .account-action-button {
    width: 110px !important;
    align-self: flex-end;
  }
}

/* 8a. Student Administrative Clearance Card-Layout on Mobile */
@media (max-width: 600px) {
  .student-office-table {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    border: none !important;
  }
  .student-office-table thead {
    display: none !important;
  }
  .student-office-table tbody {
    display: block !important;
    width: 100% !important;
  }
  .student-office-table tr {
    display: block !important;
    width: 100% !important;
    background: #ffffff !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    padding: 14px !important;
    margin-bottom: 14px !important;
    box-shadow: var(--shadow-sm) !important;
  }
  .student-office-table td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    min-height: 38px !important;
    padding: 8px 0 !important;
    box-sizing: border-box !important;
    border: none !important;
    border-bottom: 1px solid #f1f5f9 !important;
    text-align: right !important;
  }
  .student-office-table td:last-child {
    border-bottom: none !important;
    padding-bottom: 0 !important;
  }
  .student-office-table td::before {
    content: "";
    flex-shrink: 0;
    margin-right: 12px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
    text-align: left;
    text-transform: uppercase;
  }
  .student-office-table td:nth-child(1)::before { content: "Clearance Type"; }
  .student-office-table td:nth-child(2)::before { content: "Requirement"; }
  .student-office-table td:nth-child(3)::before { content: "Assigned Personnel"; }
  .student-office-table td:nth-child(4)::before { content: "Status"; }
  .student-office-table td:nth-child(5)::before { content: "Action"; }
  .student-office-table td:nth-child(6)::before { content: "Files / Images"; }
  .student-office-table td:nth-child(6) {
    display: block !important;
    padding-bottom: 0 !important;
    border-bottom: none !important;
    text-align: left !important;
  }
  .student-office-table td:nth-child(6)::before {
    display: block !important;
    margin-bottom: 8px !important;
  }
  .student-office-table .subject-upload-panel {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
    min-width: 0 !important;
    margin-top: 4px !important;
  }
  .student-office-table .subject-file-input {
    width: 100% !important;
    max-width: none !important;
  }
  .student-office-table .student-teacher-cell {
    display: inline-block !important;
    min-width: 0 !important;
    text-align: right !important;
  }
  .student-office-table td:nth-child(1) strong,
  .student-office-table .student-teacher-cell strong {
    font-size: 15px !important;
    line-height: 1.3;
  }
  .student-office-table td:nth-child(5) .account-action-button {
    min-height: 38px;
    padding: 8px 13px;
    font-size: 14px;
  }
  .student-office-table .subject-upload-panel .account-action-button {
    width: 110px !important;
    align-self: flex-end;
  }
}

/* 8b. Faculty / Staff Handled Subjects Table Card-Layout on Mobile */
@media (max-width: 600px) {
  .faculty-subject-table {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    border: none !important;
  }
  .faculty-subject-table thead {
    display: none !important;
  }
  .faculty-subject-table tbody {
    display: block !important;
    width: 100% !important;
  }
  .faculty-subject-table tr {
    display: block !important;
    width: 100% !important;
    background: #ffffff !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    padding: 14px !important;
    margin-bottom: 14px !important;
    box-shadow: var(--shadow-sm) !important;
  }
  .faculty-subject-table td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    text-align: right !important;
    padding: 8px 0 !important;
    border: none !important;
    border-bottom: 1px solid #f1f5f9 !important;
    width: 100% !important;
    min-height: 38px !important;
    box-sizing: border-box !important;
  }
  .faculty-subject-table td:last-child {
    border-bottom: none !important;
    padding-bottom: 0 !important;
  }
  
  /* Add labels before the content using css pseudo elements */
  .faculty-subject-table td::before {
    content: "";
    font-weight: 800;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    text-align: left;
    margin-right: 12px;
    flex-shrink: 0;
  }
  .faculty-subject-table td:nth-child(1)::before { content: "Subject"; }
  .faculty-subject-table td:nth-child(2)::before { content: "Description"; }
  .faculty-subject-table td:nth-child(3)::before { content: "Course / Section"; }
  .faculty-subject-table td:nth-child(4)::before { content: "Units"; }
  .faculty-subject-table td:nth-child(5)::before { content: "Status"; }
}

/* 9. Faculty / Staff Requests Table Card-Layout on Mobile */
@media (max-width: 600px) {
  .faculty-request-table {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    border: none !important;
  }
  .faculty-request-table thead {
    display: none !important;
  }
  .faculty-request-table tbody {
    display: block !important;
    width: 100% !important;
  }
  .faculty-request-table tr {
    display: block !important;
    width: 100% !important;
    background: #ffffff !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    padding: 14px !important;
    margin-bottom: 14px !important;
    box-shadow: var(--shadow-sm) !important;
  }
  .faculty-request-table td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    text-align: right !important;
    padding: 8px 0 !important;
    border: none !important;
    border-bottom: 1px solid #f1f5f9 !important;
    width: 100% !important;
    min-height: 38px !important;
    box-sizing: border-box !important;
  }
  .faculty-request-table td:last-child {
    border-bottom: none !important;
    padding-bottom: 0 !important;
  }
  
  /* Add labels before the content using css pseudo elements */
  .faculty-request-table td::before {
    content: "";
    font-weight: 800;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    text-align: left;
    margin-right: 12px;
    flex-shrink: 0;
  }
  .faculty-request-table td:nth-child(1)::before { content: "Select"; }
  .faculty-request-table td:nth-child(2)::before { content: "Student"; }
  .faculty-request-table td:nth-child(3)::before { content: "Subject"; }
  .faculty-request-table td:nth-child(4)::before { content: "Submitted"; }
  .faculty-request-table td:nth-child(5)::before { content: "Files"; }
  .faculty-request-table td:nth-child(6)::before { content: "Status"; }
  .faculty-request-table td:nth-child(7)::before { content: "Remarks"; }
  .faculty-request-table td:nth-child(8)::before { content: "Action"; }

  /* Particular adjustments to make elements look clean in cards */
  .faculty-request-table td:nth-child(1) .bulk-request-selector {
    display: inline-grid !important;
  }
  .faculty-request-table td:nth-child(5) {
    display: block !important;
    text-align: left !important;
  }
  .faculty-request-table td:nth-child(5)::before {
    display: block !important;
    margin-bottom: 6px !important;
  }
  .faculty-request-table .request-file-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    width: 100% !important;
  }
  .faculty-request-table .request-file-link {
    width: 100% !important;
    text-align: left !important;
    box-sizing: border-box !important;
  }
  
  .faculty-request-table td:nth-child(8) {
    display: block !important;
    text-align: left !important;
    border-bottom: none !important;
    padding-bottom: 0 !important;
  }
  .faculty-request-table td:nth-child(8)::before {
    display: block !important;
    margin-bottom: 8px !important;
  }
  .faculty-request-table .request-action-group {
    display: flex !important;
    gap: 8px !important;
    width: 100% !important;
  }
  .faculty-request-table .request-action-button {
    flex: 1 !important;
    width: 50% !important;
    min-height: 38px !important;
  }
}

/* --- Document Preview Modal System --- */
.document-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 200ms ease;
}

.document-preview-overlay.is-visible {
  opacity: 1;
}

.document-preview-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 920px;
  height: 85vh;
  max-height: 850px;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  transform: scale(0.96);
  transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.document-preview-overlay.is-visible .document-preview-card {
  transform: scale(1);
}

.document-preview-card-image {
  width: fit-content;
  height: auto;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
}

.document-preview-card-image .document-preview-header {
  flex: 0 0 auto;
  flex-wrap: wrap;
}

.document-preview-card-image .document-preview-title-wrap {
  flex: 1 1 220px;
}

.document-preview-card-image .document-preview-header-actions {
  flex: 0 1 auto;
  flex-wrap: wrap;
  margin-left: auto;
}

.document-preview-card-image .document-preview-body {
  flex: 0 1 auto;
  max-height: calc(100vh - 150px);
  max-height: calc(100dvh - 150px);
}

.document-preview-card-image .document-preview-content {
  flex: 0 0 auto;
  max-width: 100%;
  max-height: 100%;
}

.document-preview-card-image .document-preview-image {
  display: block;
  flex: 0 0 auto;
}

.document-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.document-preview-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.document-preview-icon {
  font-size: 24px;
  line-height: 1;
}

.document-preview-filename {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

.document-preview-meta {
  color: var(--text-muted, #64748b);
  font-size: 12px;
}

.document-preview-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.document-preview-zoom-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  background: #ffffff;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 6px;
  margin-right: 6px;
}

.preview-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text-main, #334155);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
}

.preview-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.preview-close-btn {
  font-size: 20px;
  padding: 2px 10px;
  color: #64748b;
}

.preview-close-btn:hover {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}

.preview-download-btn {
  background: #10237d;
  color: #ffffff;
  border-color: #10237d;
}

.preview-download-btn:hover {
  background: #0d1d69;
  color: #ffffff;
}

.preview-zoom-value {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  min-width: 42px;
  text-align: center;
}

.document-preview-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 16px;
  background: #f1f5f9;
}

.document-preview-content {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: auto;
}

.document-preview-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  transition: transform 150ms ease;
}

.document-preview-iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 6px;
  background: #ffffff;
}

.document-preview-text {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.document-preview-unsupported {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 16px;
}

.unsupported-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.document-preview-unsupported h3 {
  margin: 0 0 8px 0;
  font-size: 18px;
  color: #0f172a;
}

.document-preview-unsupported p {
  margin: 0;
  font-size: 14px;
  color: #64748b;
}

@media (max-width: 640px) {
  .document-preview-card:not(.document-preview-card-image) {
    height: 92vh;
    max-height: none;
    border-radius: 8px;
  }
  .document-preview-card-image {
    width: fit-content;
    height: auto;
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 8px;
  }
  .document-preview-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .document-preview-header-actions {
    justify-content: space-between;
  }
  .document-preview-filename {
    max-width: 200px;
  }
}

/* --- Global Modern Search Bar Design --- */
input[type="text"][id*="search"],
input[type="search"],
.search-field input,
.activity-control-input[id*="search"],
.account-search-field input,
.registered-account-search input,
.form-input[id*="search"] {
  height: 40px !important;
  min-height: 40px !important;
  padding: 8px 14px !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  color: #0f172a !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease !important;
}

input[type="text"][id*="search"]:focus,
input[type="search"]:focus,
.search-field input:focus,
.activity-control-input[id*="search"]:focus,
.account-search-field input:focus,
.registered-account-search input:focus,
.form-input[id*="search"]:focus {
  border-color: #10237d !important;
  box-shadow: 0 0 0 3.5px rgba(16, 35, 125, 0.14) !important;
  outline: none !important;
}

input[type="text"][id*="search"]::placeholder,
input[type="search"]::placeholder,
.search-field input::placeholder,
.activity-control-input[id*="search"]::placeholder,
.account-search-field input::placeholder,
.registered-account-search input::placeholder,
.form-input[id*="search"]::placeholder {
  color: #64748b !important;
  font-weight: 400 !important;
  opacity: 0.95 !important;
}

.search-field select {
  height: 40px !important;
  min-height: 40px !important;
  padding: 8px 12px !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  color: #0f172a !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
  transition: border-color 180ms ease, box-shadow 180ms ease !important;
  cursor: pointer;
}

.search-field select:focus {
  border-color: #10237d !important;
  box-shadow: 0 0 0 3.5px rgba(16, 35, 125, 0.14) !important;
  outline: none !important;
}

/* ==========================================================================
   Input Field Left Icon Utility Classes
   ========================================================================== */
.input-icon-group {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-icon-group > i.input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  color: #64748b;
  pointer-events: none;
  z-index: 5;
  transition: color 150ms ease;
}

.input-icon-group input,
.input-icon-group select,
.input-icon-group textarea {
  padding-left: 38px !important;
}

.input-icon-group:focus-within > i.input-icon {
  color: #10237d;
}

/* Keep the Admin Monitoring request-search placeholder fully visible. */
.admin-dashboard-shell #section-requests .search-field .input-icon-group input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Admin navigation shell: compact page bar with desktop/mobile drawer toggle. */
.admin-dashboard-shell .dashboard-main {
  width: 100% !important;
  margin-left: 0 !important;
  padding: 20px 24px 28px !important;
}

.admin-dashboard-shell .dashboard-header {
  width: 100% !important;
  max-width: none !important;
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  margin: 0 0 20px !important;
  padding: 14px 18px;
  border: 1px solid #d7deed;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(15, 35, 92, 0.08);
}

.admin-dashboard-shell .dashboard-header > div {
  min-width: 0;
}

.admin-dashboard-shell .dashboard-header h1 {
  margin: 0;
  color: #10237d;
  font-size: 27px;
  line-height: 1.15;
}

.admin-dashboard-shell .dashboard-header .dashboard-subtitle {
  margin-top: 4px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.35;
}

.admin-dashboard-shell .sidebar-toggle,
.admin-dashboard-shell.sidebar-open .sidebar-toggle {
  display: inline-grid !important;
}

.admin-dashboard-shell .dashboard-header > .sidebar-toggle {
  position: static !important;
  inset: auto !important;
  z-index: 1;
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  padding: 13px;
  gap: 5px;
  border: 1px solid #1734c8;
  border-radius: 13px;
  color: #ffffff;
  background: #1734c8;
  box-shadow: 0 7px 16px rgba(23, 52, 200, 0.22);
}

.admin-dashboard-shell .dashboard-header > .sidebar-toggle span {
  width: 22px;
  background: currentColor;
}

.admin-dashboard-shell .dashboard-header > .sidebar-toggle:hover {
  color: #10237d;
  border-color: #e5bc11;
  background: #f4d12a;
  transform: translateY(-1px);
}

.admin-dashboard-shell.sidebar-open .dashboard-header > .sidebar-toggle {
  color: #10237d;
  border-color: #e5bc11;
  background: #f4d12a;
  box-shadow: 0 7px 16px rgba(244, 209, 42, 0.22);
  transform: rotate(90deg);
}

.admin-dashboard-shell.sidebar-open .dashboard-header > .sidebar-toggle span:nth-child(1),
.admin-dashboard-shell.sidebar-open .dashboard-header > .sidebar-toggle span:nth-child(2),
.admin-dashboard-shell.sidebar-open .dashboard-header > .sidebar-toggle span:nth-child(3) {
  opacity: 1;
  transform: none;
}

.admin-dashboard-shell.sidebar-open .dashboard-header > .sidebar-toggle:hover {
  transform: rotate(90deg) scale(1.03);
}

@media (min-width: 821px) {
  .admin-dashboard-shell .dashboard-layout .sidebar {
    transform: translateX(-100%) !important;
    box-shadow: 22px 0 48px rgba(2, 8, 23, 0.18) !important;
  }

  .admin-dashboard-shell.sidebar-open .dashboard-layout .sidebar {
    transform: translateX(0) !important;
  }

  .admin-dashboard-shell.sidebar-open .dashboard-main {
    width: calc(100% - var(--drawer-width)) !important;
    margin-left: var(--drawer-width) !important;
  }

  .admin-dashboard-shell .sidebar-backdrop,
  .admin-dashboard-shell.sidebar-open .sidebar-backdrop {
    opacity: 0;
    pointer-events: none;
  }
}

@media (max-width: 820px) {
  .admin-dashboard-shell .dashboard-main,
  .admin-dashboard-shell.sidebar-open .dashboard-main {
    width: 100% !important;
    margin-left: 0 !important;
    padding: 14px 14px 24px !important;
  }

  .admin-dashboard-shell .dashboard-header {
    min-height: 72px;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 14px;
  }

  .admin-dashboard-shell .dashboard-header > .sidebar-toggle {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
    padding: 11px;
    border-radius: 11px;
  }

  .admin-dashboard-shell .dashboard-header h1 {
    font-size: 22px;
  }

  .admin-dashboard-shell .dashboard-header .dashboard-subtitle {
    display: none;
  }
}

/* Student and approver dashboard header/sidebar toggle. */
.role-dashboard-shell .dashboard-main {
  width: 100% !important;
  margin-left: 0 !important;
  padding: 28px !important;
}

.role-dashboard-shell .dashboard-header {
  justify-content: flex-start !important;
  gap: 16px;
}

.role-dashboard-shell .dashboard-header.has-active-term {
  position: relative;
}

.role-dashboard-shell .dashboard-header.has-active-term > div:first-of-type {
  padding-right: 260px;
}

.role-dashboard-shell .dashboard-header.has-active-term > .active-term-badge {
  position: absolute;
  top: 14px;
  right: 18px;
  z-index: 2;
}

.role-dashboard-shell .role-compact-header {
  min-height: 82px;
  align-items: center !important;
  margin-bottom: 20px !important;
  padding: 14px 18px;
  border: 1px solid #d7deed;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(15, 35, 92, 0.08);
}

.role-dashboard-shell .role-compact-header h1 {
  margin: 0;
  color: #10237d;
  font-size: 27px;
  line-height: 1.15;
}

.role-dashboard-shell .role-compact-header .dashboard-subtitle {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.35;
}

.role-dashboard-shell .approver-activity-header > div:last-child {
  margin-left: auto;
}

.role-dashboard-shell .sidebar-toggle,
.role-dashboard-shell.sidebar-open .sidebar-toggle {
  display: inline-grid !important;
}

.role-dashboard-shell .dashboard-header > .sidebar-toggle {
  position: static !important;
  inset: auto !important;
  z-index: 1;
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  padding: 13px;
  gap: 5px;
  border: 1px solid #1734c8;
  border-radius: 13px;
  color: #ffffff;
  background: #1734c8;
  box-shadow: 0 7px 16px rgba(23, 52, 200, 0.22);
}

.role-dashboard-shell .school-banner-header > .sidebar-toggle {
  align-self: flex-end;
}

/* Keep approver banner toggles level with the Requesting/Handled heading. */
.role-dashboard-shell:not(.student-dashboard-shell) .school-banner-header {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  align-content: end;
  align-items: start !important;
  column-gap: 16px;
}

.role-dashboard-shell:not(.student-dashboard-shell) .school-banner-header > .sidebar-toggle {
  align-self: start;
}

.role-dashboard-shell .dashboard-header > .sidebar-toggle span {
  width: 22px;
  background: currentColor;
}

.role-dashboard-shell .dashboard-header > .sidebar-toggle:hover {
  color: #10237d;
  border-color: #e5bc11;
  background: #f4d12a;
  transform: translateY(-1px);
}

.role-dashboard-shell.sidebar-open .dashboard-header > .sidebar-toggle {
  color: #10237d;
  border-color: #e5bc11;
  background: #f4d12a;
  box-shadow: 0 7px 16px rgba(244, 209, 42, 0.22);
  transform: rotate(90deg);
}

.role-dashboard-shell.sidebar-open .dashboard-header > .sidebar-toggle span:nth-child(1),
.role-dashboard-shell.sidebar-open .dashboard-header > .sidebar-toggle span:nth-child(2),
.role-dashboard-shell.sidebar-open .dashboard-header > .sidebar-toggle span:nth-child(3) {
  opacity: 1;
  transform: none;
}

.role-dashboard-shell.sidebar-open .dashboard-header > .sidebar-toggle:hover {
  transform: rotate(90deg) scale(1.03);
}

@media (min-width: 821px) {
  .role-dashboard-shell .dashboard-layout .sidebar {
    transform: translateX(-100%) !important;
    box-shadow: 22px 0 48px rgba(2, 8, 23, 0.18) !important;
  }

  .role-dashboard-shell.sidebar-open .dashboard-layout .sidebar {
    transform: translateX(0) !important;
  }

  .role-dashboard-shell.sidebar-open .dashboard-main {
    width: calc(100% - var(--drawer-width)) !important;
    margin-left: var(--drawer-width) !important;
  }

  .role-dashboard-shell .sidebar-backdrop,
  .role-dashboard-shell.sidebar-open .sidebar-backdrop {
    opacity: 0;
    pointer-events: none;
  }
}

@media (max-width: 820px) {
  .role-dashboard-shell .dashboard-main,
  .role-dashboard-shell.sidebar-open .dashboard-main {
    width: 100% !important;
    margin-left: 0 !important;
    padding: 14px !important;
  }

  .role-dashboard-shell .dashboard-header {
    gap: 12px;
  }

  .role-dashboard-shell .dashboard-header.has-active-term > div:first-of-type {
    padding-right: 0;
  }

  .role-dashboard-shell .dashboard-header.has-active-term > .active-term-badge {
    top: 10px;
    right: 12px;
    min-height: 30px;
    padding: 6px 9px;
    font-size: 11px;
  }

  .role-dashboard-shell .role-compact-header.has-active-term {
    min-height: 108px;
    padding-top: 50px;
  }

  .role-dashboard-shell .role-compact-header {
    min-height: 72px;
    padding: 11px 12px;
    border-radius: 14px;
  }

  .role-dashboard-shell .dashboard-header > .sidebar-toggle {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
    padding: 11px;
    border-radius: 11px;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .school-banner-header {
    grid-template-columns: 44px minmax(0, 1fr);
    column-gap: 12px;
  }

  .role-dashboard-shell .role-compact-header h1 {
    font-size: 22px;
  }

  .role-dashboard-shell .role-compact-header .dashboard-subtitle {
    display: none;
  }

  .role-dashboard-shell .approver-activity-header > div:last-child {
    width: 100%;
    margin-left: 0;
  }
}

.student-dashboard-shell .school-banner-header {
  align-items: flex-start !important;
  padding-top: 44px;
}

.student-dashboard-shell .school-banner-header > .sidebar-toggle {
  align-self: flex-start;
}

@media (max-width: 820px) {
  .student-dashboard-shell .school-banner-header {
    padding-top: 24px;
  }
}

/* ========================================================================== 
   Mobile viewport hardening
   Keeps every dashboard inside the device viewport without changing desktop.
   ========================================================================== */
@media (max-width: 820px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  body.dashboard-body {
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
  }

  img,
  svg,
  video,
  canvas,
  iframe {
    max-width: 100%;
  }

  .dashboard-layout,
  .role-dashboard-layout,
  .dashboard-main {
    width: 100% !important;
    max-width: 100vw !important;
    min-width: 0 !important;
  }

  .dashboard-main,
  .admin-dashboard-shell .dashboard-main,
  .role-dashboard-shell .dashboard-main {
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden !important;
    padding: 14px 14px calc(24px + env(safe-area-inset-bottom)) !important;
  }

  .dashboard-main > *,
  .dashboard-header > *,
  .settings-dashboard-grid > *,
  .settings-content-panel > *,
  .monitoring-toolbar > *,
  .section-heading > * {
    min-width: 0;
    max-width: 100%;
  }

  .dashboard-header,
  .school-banner-header,
  .dashboard-section,
  .dashboard-panel,
  .monitoring-toolbar,
  .settings-dashboard-grid,
  .settings-content-panel,
  .settings-section,
  .registered-accounts-panel,
  .registered-account-card,
  .account-directory-panel,
  .subject-directory-section,
  .activity-toolbar-container,
  .activity-table-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .dashboard-header,
  .section-heading,
  .registered-accounts-header,
  .registered-card-heading,
  .account-directory-toolbar,
  .activity-filter-controls {
    flex-wrap: wrap;
  }

  .table-wrap,
  .archive-table-wrap,
  .subject-directory-table-wrap,
  .activity-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto !important;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  .table-wrap:focus-within,
  .archive-table-wrap:focus-within,
  .subject-directory-table-wrap:focus-within,
  .activity-table-wrap:focus-within {
    outline: 2px solid rgba(23, 52, 200, 0.18);
    outline-offset: 2px;
  }

  .search-field,
  .account-search-field,
  .registered-account-search,
  .subject-directory-field,
  .subject-directory-search,
  .input-icon-group,
  .field-group,
  .compact-select {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  input,
  select,
  textarea,
  button {
    max-width: 100%;
  }

  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea {
    font-size: 16px !important;
  }

  .modal-card,
  .archive-modal-card,
  .completed-modal-panel,
  .subject-import-mode-card,
  .subject-selection-modal,
  .edit-account-modal,
  .student-photo-dialog-card,
  .document-preview-card {
    max-width: calc(100vw - 24px) !important;
    max-height: calc(100vh - 24px) !important;
    max-height: calc(100dvh - 24px) !important;
  }

  #settings,
  .archive-modal,
  .completed-modal-overlay,
  .subject-import-mode-backdrop,
  .subject-selection-modal-backdrop,
  .edit-account-modal-backdrop,
  .student-photo-dialog,
  .document-preview-overlay {
    padding: 12px !important;
  }

  #settings .modal-body,
  .archive-modal-body,
  .completed-modal-body,
  .edit-account-modal-body,
  .subject-selection-modal-body,
  .student-photo-dialog-body {
    max-height: calc(100vh - 150px) !important;
    max-height: calc(100dvh - 150px) !important;
    overflow-y: auto !important;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }

  #decline-remarks-modal > div,
  #confirm-approval-modal > div,
  #activity-details-modal-overlay > div {
    width: min(100%, calc(100vw - 24px)) !important;
    max-width: calc(100vw - 24px) !important;
    max-height: calc(100vh - 24px) !important;
    max-height: calc(100dvh - 24px) !important;
  }
}

@media (max-width: 600px) {
  body.login-body {
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }

  .login-page {
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    min-height: 100vh;
    min-height: 100dvh;
    height: auto;
    padding: 12px;
    overflow-x: hidden;
  }

  .login-shell,
  .login-identity,
  .login-panel,
  .login-form,
  .login-details,
  .login-form .field-group,
  .login-form .input-icon-group {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .login-shell {
    display: block;
  }

  .login-panel {
    padding: 20px;
    border-top: 5px solid #f4d12a;
    border-left: 0;
    overflow-x: hidden;
  }

  .login-form input,
  .login-form select,
  .login-form button {
    width: 100%;
    min-width: 0;
  }

  .login-form .label-row,
  .login-security-note,
  .brand-block-large {
    min-width: 0;
    max-width: 100%;
  }

  .login-form .label-row > *,
  .brand-block-large > div {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .dashboard-main,
  .admin-dashboard-shell .dashboard-main,
  .role-dashboard-shell .dashboard-main {
    padding: 10px 10px calc(20px + env(safe-area-inset-bottom)) !important;
  }

  .admin-dashboard-shell .dashboard-header {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 66px;
    margin-bottom: 12px !important;
    padding: 10px;
    border-radius: 12px;
  }

  .admin-dashboard-shell .dashboard-header > .sidebar-toggle {
    grid-column: 1;
    grid-row: 1;
  }

  .admin-dashboard-shell .dashboard-header > div:first-of-type {
    grid-column: 2;
    grid-row: 1;
  }

  .admin-dashboard-shell .dashboard-header > .active-term-badge {
    grid-column: 1 / -1;
    position: static !important;
    width: 100%;
    margin: 0 !important;
    white-space: normal;
    text-align: center;
    line-height: 1.25;
  }

  .admin-dashboard-shell .dashboard-header h1,
  .role-dashboard-shell .role-compact-header h1,
  .school-banner-header h1 {
    overflow-wrap: anywhere;
    font-size: clamp(20px, 6vw, 23px) !important;
  }

  .role-dashboard-shell .dashboard-header.has-active-term > .active-term-badge {
    position: static !important;
    inset: auto !important;
    width: 100%;
    order: 3;
    margin: 0 !important;
    white-space: normal;
    text-align: center;
    line-height: 1.25;
  }

  .role-dashboard-shell .role-compact-header.has-active-term {
    min-height: 0;
    padding-top: 10px;
  }

  .student-dashboard-shell .school-banner-header {
    width: 100% !important;
    max-width: 100% !important;
    margin-inline: 0 !important;
  }

  .monitoring-toolbar,
  .section-heading,
  .settings-section,
  .account-directory-panel,
  .registered-account-card,
  .activity-toolbar-container {
    padding: 12px !important;
  }

  .monitoring-toolbar,
  .section-heading,
  .registered-accounts-header,
  .account-directory-toolbar,
  .archive-list-heading,
  .archive-modal-header,
  .archive-modal-footer,
  .completed-modal-header,
  .student-photo-dialog-actions {
    align-items: stretch !important;
    flex-direction: column !important;
  }

  .filter-group {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-button,
  .filter-group > button,
  .filter-group > select {
    width: 100%;
    min-width: 0;
  }

  .section-heading h2,
  .registered-accounts-header h2,
  .registered-card-heading h3 {
    overflow-wrap: anywhere;
  }

  .refresh-pill,
  .directory-result-pill,
  .summary-chip {
    align-self: flex-start;
    max-width: 100%;
    white-space: normal;
  }

  .settings-sidebar {
    width: 100%;
    padding: 10px;
    gap: 10px;
  }

  .settings-sidebar-group {
    min-width: 0;
  }

  .settings-sidebar-item {
    min-height: 44px;
    white-space: normal;
  }

  .subject-directory-toolbar {
    width: 100%;
    grid-template-columns: 1fr !important;
    margin: 14px 0;
    padding: 12px;
  }

  .edit-account-modal-header,
  .subject-selection-modal-header,
  .subject-selection-modal-footer,
  .subject-modal-toolbar {
    padding: 12px !important;
  }

  #edit-student-fields-group > div[style*="grid-template-columns"],
  #edit-staff-fields-group > div[style*="grid-template-columns"],
  #edit-account-form > div > div[style*="grid-template-columns: minmax"] {
    grid-template-columns: 1fr !important;
  }

  .subject-selection-modal-footer,
  .edit-account-modal-footer {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px !important;
  }

  .subject-selection-modal-footer button,
  .edit-account-modal-footer button {
    width: 100% !important;
    min-width: 0 !important;
    padding-inline: 10px !important;
  }

  .archive-modal-header,
  .archive-modal-body,
  .archive-modal-footer,
  .completed-modal-header,
  .completed-modal-body {
    padding: 14px !important;
  }

  .archive-modal-close,
  .completed-modal-close,
  .modal-close-btn,
  .student-photo-dialog-close {
    min-width: 42px;
    min-height: 42px;
    align-self: flex-end;
  }

  .document-preview-overlay {
    padding: 8px !important;
  }

  .document-preview-card:not(.document-preview-card-image) {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px) !important;
    height: calc(100vh - 16px);
    height: calc(100dvh - 16px);
    max-height: calc(100vh - 16px) !important;
    max-height: calc(100dvh - 16px) !important;
  }

  .document-preview-card-image {
    width: fit-content;
    height: auto;
    max-width: calc(100vw - 16px) !important;
    max-height: calc(100vh - 16px) !important;
    max-height: calc(100dvh - 16px) !important;
  }

  .document-preview-header {
    padding: 10px 12px;
  }

  .document-preview-header-actions {
    flex-wrap: wrap;
  }

  .document-preview-zoom-controls {
    order: 3;
    width: 100%;
    justify-content: center;
    margin-right: 0;
  }

  .document-preview-body {
    padding: 8px;
  }

  /* Registered accounts become readable cards instead of clipped columns. */
  .compact-table-wrap {
    overflow: visible !important;
  }

  .registered-account-table,
  .registered-account-table tbody {
    display: block;
    width: 100%;
    min-width: 0 !important;
  }

  .registered-account-table thead {
    display: none;
  }

  .registered-account-table tbody > tr:not(.student-year-group):not(.student-course-group) {
    display: block;
    width: 100%;
    margin: 0 0 12px;
    padding: 12px;
    border: 1px solid #dce4ef;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(15, 35, 92, 0.06);
  }

  .registered-account-table tbody > tr:not(.student-year-group):not(.student-course-group) > td {
    display: grid;
    grid-template-columns: minmax(86px, 0.38fr) minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    width: 100%;
    padding: 9px 0 !important;
    border: 0;
    border-bottom: 1px solid #edf1f7;
    overflow-wrap: anywhere;
  }

  .registered-account-table tbody > tr:not(.student-year-group):not(.student-course-group) > td:last-child {
    display: block;
    padding-bottom: 0 !important;
    border-bottom: 0;
  }

  .registered-account-table tbody > tr:not(.student-year-group):not(.student-course-group) > td::before {
    color: #64748b;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.045em;
    text-transform: uppercase;
  }

  .registered-account-table td:nth-child(1)::before { content: "Name"; }
  #registered-students-body td:nth-child(2)::before { content: "Academic Details"; }
  #registered-staff-body td:nth-child(2)::before { content: "Employment"; }
  .registered-account-table td:nth-child(3)::before { content: "Contact"; }
  .registered-account-table td:nth-child(4)::before {
    content: "Actions";
    display: block;
    margin-bottom: 8px;
  }

  .registered-account-table .student-year-group,
  .registered-account-table .student-course-group {
    display: block;
    width: 100%;
  }

  .registered-account-table .student-year-group th,
  .registered-account-table .student-course-group th {
    display: block;
    width: 100%;
    white-space: normal;
  }

  .registered-account-table .account-action-group {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 6px;
  }

  .registered-account-table .account-action-button {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding: 6px 5px;
    white-space: normal;
    line-height: 1.15;
  }
}

@media (max-width: 380px) {
  .login-page {
    padding: 8px;
  }

  .login-identity {
    padding: 18px 14px;
  }

  .login-panel {
    padding: 18px 14px;
  }

  .dashboard-main,
  .admin-dashboard-shell .dashboard-main,
  .role-dashboard-shell .dashboard-main {
    padding-inline: 8px !important;
  }

  .filter-group,
  .subject-selection-modal-footer,
  .edit-account-modal-footer,
  .registered-account-table .account-action-group {
    grid-template-columns: 1fr !important;
  }

  .student-profile-short-name {
    display: none;
  }

  .student-header-actions {
    grid-template-columns: minmax(0, 1fr) 44px !important;
  }

  .student-profile-trigger {
    width: 44px;
    padding: 3px !important;
  }
}

/* Keep the mobile drawer and Logout inside the visible phone viewport. */
@media (max-width: 820px) {
  .dashboard-layout .sidebar {
    height: 100vh !important;
    height: 100dvh !important;
    min-height: 0 !important;
    max-height: 100vh;
    max-height: 100dvh;
    overflow: hidden !important;
    padding-bottom: calc(14px + env(safe-area-inset-bottom)) !important;
  }

  .dashboard-layout .module-nav {
    flex: 1 1 auto;
    min-height: 0;
    align-content: start;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .dashboard-layout .sidebar-logout {
    flex: 0 0 auto;
    margin-top: 12px;
  }
}

/* Compact professional header for School Personnel on phones. */
@media (max-width: 560px) {
  .role-dashboard-shell:not(.student-dashboard-shell) .school-banner-header {
    display: grid !important;
    grid-template-columns: 38px minmax(0, 1fr) !important;
    grid-template-rows: auto auto;
    align-content: start;
    align-items: center !important;
    gap: 10px 8px;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 0;
    margin-inline: 0 !important;
    padding: 10px 12px 12px !important;
    border-radius: 12px;
    background:
      linear-gradient(90deg, rgba(255, 255, 255, 0.94) 0%, rgba(255, 255, 255, 0.88) 42%, rgba(255, 255, 255, 0.38) 72%, rgba(255, 255, 255, 0.12) 100%),
      url("../img/sl.jpg") center / cover no-repeat;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .school-banner-header > .sidebar-toggle {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    width: 38px;
    height: 38px;
    min-width: 38px;
    flex-basis: 38px;
    margin: 0;
    padding: 9px;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .school-banner-header.has-active-term > .active-term-badge {
    position: static !important;
    inset: auto !important;
    order: initial;
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    min-height: 34px;
    margin: 0 !important;
    padding: 6px 8px;
    overflow: hidden;
    font-size: 11px;
    line-height: 1.2;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .school-banner-header > div:first-of-type {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
    padding: 0 !important;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .school-banner-header h1 {
    margin: 0;
    font-size: 19px !important;
    line-height: 1.2;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .school-banner-header .dashboard-subtitle {
    display: block;
    margin-top: 5px;
    overflow: hidden;
    color: #1f2f59;
    font-size: 12px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Dedicated tablet layout: balanced spacing and two-row dashboard headers. */
@media (min-width: 561px) and (max-width: 1024px) {
  .admin-dashboard-shell .dashboard-main,
  .role-dashboard-shell .dashboard-main,
  .role-dashboard-shell.sidebar-open .dashboard-main {
    padding: 18px !important;
  }

  .student-stats-grid,
  .csc-stats-grid,
  .role-dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .profile-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .table-wrap {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  .student-dashboard-shell .school-banner-header {
    display: grid !important;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-content: start;
    align-items: center !important;
    gap: 12px 10px;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 0;
    margin-inline: 0 !important;
    padding: 14px 16px 16px !important;
    border-radius: 14px;
    background:
      linear-gradient(90deg, rgba(255, 255, 255, 0.94) 0%, rgba(255, 255, 255, 0.88) 42%, rgba(255, 255, 255, 0.38) 72%, rgba(255, 255, 255, 0.12) 100%),
      url("../img/sl.jpg") center / cover no-repeat;
  }

  .student-dashboard-shell .school-banner-header > .sidebar-toggle {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    flex-basis: 44px;
    margin: 0;
    padding: 11px;
  }

  .student-dashboard-shell .school-banner-header.has-active-term > div:first-of-type {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
    padding: 0 !important;
  }

  .student-dashboard-shell .student-header-actions {
    position: static;
    grid-column: 2 / 4;
    grid-row: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center;
    gap: 10px;
    min-width: 0;
  }

  .student-dashboard-shell .student-header-actions .active-term-badge {
    width: 100%;
    min-height: 38px;
    margin: 0 !important;
    padding: 7px 10px;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.2;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .student-dashboard-shell .school-banner-header h1,
  .role-dashboard-shell:not(.student-dashboard-shell) .school-banner-header h1 {
    margin: 0;
    font-size: 23px !important;
    line-height: 1.2;
  }

  .student-dashboard-shell .school-banner-header .dashboard-subtitle,
  .role-dashboard-shell:not(.student-dashboard-shell) .school-banner-header .dashboard-subtitle {
    display: block;
    margin-top: 5px;
    overflow: hidden;
    color: #1f2f59;
    font-size: 13px;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .school-banner-header {
    display: grid !important;
    grid-template-columns: 44px minmax(0, 1fr) !important;
    grid-template-rows: auto auto;
    align-content: start;
    align-items: center !important;
    gap: 12px 10px;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 0;
    margin-inline: 0 !important;
    padding: 14px 16px 16px !important;
    border-radius: 14px;
    background: #ffffff;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .school-banner-header > .sidebar-toggle {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    flex-basis: 44px;
    margin: 0;
    padding: 11px;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .school-banner-header.has-active-term > .active-term-badge {
    position: static !important;
    inset: auto !important;
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    min-height: 38px;
    order: initial;
    margin: 0 !important;
    padding: 7px 10px;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.2;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .school-banner-header > div:first-of-type {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
    padding: 0 !important;
  }
}

/* Professional document preview controls for phones and tablets. */
@media (max-width: 1024px) {
  .document-preview-overlay {
    padding: 12px !important;
  }

  .document-preview-card {
    max-width: calc(100vw - 24px) !important;
    max-height: calc(100vh - 24px) !important;
    max-height: calc(100dvh - 24px) !important;
    border-radius: 12px;
  }

  .document-preview-card-image .document-preview-title-wrap {
    flex: 1 1 auto;
  }

  .document-preview-header {
    gap: 10px;
    padding: 12px 14px;
  }

  .document-preview-title-wrap {
    min-width: 0;
  }

  .document-preview-filename {
    max-width: min(42vw, 300px);
  }

  .document-preview-header-actions {
    flex-wrap: wrap;
    gap: 7px;
  }

  .document-preview-zoom-controls {
    margin-right: 0;
  }

  .preview-btn {
    min-height: 38px;
  }

  .document-preview-body {
    padding: 10px;
  }
}

@media (max-width: 640px) {
  .document-preview-overlay {
    align-items: center;
    padding: 8px !important;
  }

  .document-preview-card-image {
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    max-height: calc(100vh - 16px) !important;
    max-height: calc(100dvh - 16px) !important;
  }

  .document-preview-card-image .document-preview-header,
  .document-preview-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
  }

  .document-preview-card-image .document-preview-title-wrap,
  .document-preview-title-wrap {
    flex: none;
    width: 100%;
    min-height: 0;
  }

  .document-preview-icon {
    flex: 0 0 auto;
    font-size: 21px;
  }

  .document-preview-title-wrap > div {
    min-width: 0;
  }

  .document-preview-filename {
    max-width: calc(100vw - 88px);
    font-size: 14px;
  }

  .document-preview-meta {
    display: block;
    margin-top: 2px;
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .document-preview-card-image .document-preview-header-actions,
  .document-preview-header-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px;
    gap: 8px;
    width: 100%;
    margin-left: 0;
  }

  .preview-download-btn {
    grid-column: 1;
    grid-row: 1;
    width: fit-content;
    min-height: 42px;
    padding-inline: 14px;
  }

  .preview-close-btn {
    grid-column: 2;
    grid-row: 1;
    width: 42px;
    min-width: 42px;
    min-height: 42px;
    padding: 4px;
  }

  .document-preview-zoom-controls {
    grid-column: 1 / -1;
    grid-row: 2;
    order: initial;
    width: 100%;
    min-height: 44px;
    margin: 0;
    padding: 3px 6px;
    justify-content: center;
  }

  .document-preview-zoom-controls .preview-btn {
    min-width: 42px;
    min-height: 36px;
  }

  .document-preview-card-image .document-preview-body {
    max-height: calc(100vh - 178px);
    max-height: calc(100dvh - 178px);
  }

  .document-preview-body {
    padding: 6px;
  }
}

/* Consistent section headers across all Approver dashboards. */
.role-dashboard-shell:not(.student-dashboard-shell) .dashboard-main > .dashboard-section > .section-heading {
  position: relative;
  align-items: center;
  min-height: 68px;
  padding: 15px 18px 15px 22px;
  border-bottom: 1px solid #d8e0ef;
  background: linear-gradient(135deg, #ffffff 0%, #f5f8ff 100%);
}

.role-dashboard-shell:not(.student-dashboard-shell) .dashboard-main > .dashboard-section > .section-heading::before {
  content: "";
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: 0;
  width: 4px;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(180deg, #1734c8, #e5bc11);
}

.role-dashboard-shell:not(.student-dashboard-shell) .dashboard-main > .dashboard-section > .section-heading > div {
  min-width: 0;
}

.role-dashboard-shell:not(.student-dashboard-shell) .dashboard-main > .dashboard-section > .section-heading h2 {
  color: #10237d;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.25;
}

.role-dashboard-shell:not(.student-dashboard-shell) .dashboard-main > .dashboard-section > .section-heading p {
  margin-top: 4px;
  max-width: 720px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.4;
}

.role-dashboard-shell:not(.student-dashboard-shell) .dashboard-main > .dashboard-section > .section-heading .refresh-pill {
  align-self: center;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid #b9e8c9;
  box-shadow: 0 4px 10px rgba(22, 101, 52, 0.08);
  white-space: nowrap;
}

.role-dashboard-shell:not(.student-dashboard-shell) .faculty-request-card {
  border-color: #d8e0ef;
  box-shadow: 0 5px 14px rgba(15, 35, 92, 0.06);
}

.role-dashboard-shell:not(.student-dashboard-shell) .faculty-request-card-header {
  min-height: 48px;
  margin: 0 0 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #d8e0ef;
  border-left: 3px solid #1734c8;
  background: linear-gradient(90deg, #eef3ff 0%, #fafbff 100%);
}

.role-dashboard-shell:not(.student-dashboard-shell) .faculty-request-card-header h3 {
  color: #10237d;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.3;
}

.role-dashboard-shell:not(.student-dashboard-shell) .faculty-request-card-header .summary-chip {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid #cbd7f5;
  color: #1734c8;
  background: #ffffff;
  font-size: 11px;
  white-space: nowrap;
}

@media (max-width: 1024px) {
  .role-dashboard-shell:not(.student-dashboard-shell) .dashboard-main > .dashboard-section > .section-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center !important;
    gap: 8px 12px;
    min-height: 62px;
    padding: 13px 14px 13px 18px !important;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .dashboard-main > .dashboard-section > .section-heading > div {
    grid-column: 1;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .dashboard-main > .dashboard-section > .section-heading .refresh-pill {
    grid-column: 2;
    align-self: center;
  }
}

@media (max-width: 560px) {
  .role-dashboard-shell:not(.student-dashboard-shell) .dashboard-main > .dashboard-section > .section-heading h2 {
    font-size: 17px;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .dashboard-main > .dashboard-section > .section-heading p {
    display: -webkit-box;
    overflow: hidden;
    font-size: 12px;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .faculty-request-card-header {
    gap: 8px;
    padding: 9px 10px;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .faculty-request-card-header h3 {
    font-size: 14px;
  }
}

/* Professional Approver page headers for mobile and tablet. */
@media (max-width: 1024px) {
  .role-dashboard-shell:not(.student-dashboard-shell) .role-compact-header.has-active-term {
    display: grid !important;
    grid-template-columns: 44px minmax(0, 1fr) !important;
    grid-template-rows: auto auto;
    align-content: start;
    align-items: center !important;
    gap: 12px 10px;
    width: 100%;
    min-height: 0;
    padding: 14px 16px 16px !important;
    border-radius: 14px;
    text-align: left;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .role-compact-header > .sidebar-toggle {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    flex-basis: 44px;
    margin: 0;
    padding: 11px;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .role-compact-header.has-active-term > .active-term-badge {
    position: static !important;
    inset: auto !important;
    grid-column: 2;
    grid-row: 1;
    order: initial;
    width: 100%;
    min-height: 38px;
    margin: 0 !important;
    padding: 7px 10px;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.2;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .role-compact-header.has-active-term > div:first-of-type {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
    padding: 0 !important;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .role-compact-header h1 {
    margin: 0;
    color: #10237d;
    font-size: 23px !important;
    line-height: 1.2;
    text-align: left;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .role-compact-header .dashboard-subtitle {
    display: block !important;
    margin-top: 5px;
    overflow: hidden;
    color: #64748b;
    font-size: 13px;
    line-height: 1.4;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .approver-activity-header {
    display: grid !important;
    grid-template-columns: 44px minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 12px 10px !important;
    padding: 14px 16px !important;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .approver-activity-header > div:first-of-type {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .approver-activity-header > div:last-child {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    margin: 0;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
  }
}

@media (max-width: 560px) {
  .role-dashboard-shell:not(.student-dashboard-shell) .role-compact-header.has-active-term {
    grid-template-columns: 38px minmax(0, 1fr) !important;
    gap: 10px 8px;
    padding: 10px 12px 12px !important;
    border-radius: 12px;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .role-compact-header > .sidebar-toggle {
    width: 38px;
    height: 38px;
    min-width: 38px;
    flex-basis: 38px;
    padding: 9px;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .role-compact-header.has-active-term > .active-term-badge {
    min-height: 34px;
    padding: 6px 8px;
    font-size: 11px;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .role-compact-header h1 {
    font-size: 19px !important;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .role-compact-header .dashboard-subtitle {
    font-size: 12px;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .approver-activity-header {
    grid-template-columns: 38px minmax(0, 1fr) !important;
    gap: 10px 8px !important;
    padding: 10px 12px !important;
  }
}

/* Prevent the Approver filter container's desktop flex-basis becoming height on phones. */
@media (max-width: 600px) {
  .role-dashboard-shell:not(.student-dashboard-shell) #bulk-approval-toolbar > div:last-child {
    flex: 0 0 auto !important;
    align-self: stretch;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) #filter-handled-assignment {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
}

/* Keep login password visibility controls fixed at the input's right edge. */
.login-form .password-visibility-toggle {
  right: 6px;
  width: 36px !important;
  min-width: 36px !important;
  max-width: 36px !important;
  height: 36px;
  padding: 0 !important;
}

/* Keep every dashboard top bar visible while its page content scrolls. */
.dashboard-main > .dashboard-header,
.dashboard-main > .dashboard-container > .dashboard-header {
  position: sticky !important;
  top: 0;
  z-index: 65;
  isolation: isolate;
  background-color: #ffffff !important;
}

@media (max-width: 820px) {
  body.dashboard-body {
    overflow-x: hidden !important;
    overflow-x: clip !important;
    overflow-y: visible !important;
  }

  body.dashboard-body .dashboard-main {
    overflow-x: hidden !important;
    overflow-x: clip !important;
    overflow-y: visible !important;
  }
}

/* Desktop admin header: align it with the viewport top and sidebar edge. */
@media (min-width: 1025px) {
  .admin-dashboard-shell .dashboard-main {
    padding-top: 0 !important;
  }

  .admin-dashboard-shell .dashboard-main > .dashboard-header {
    width: calc(100% + 24px) !important;
    margin-top: 0 !important;
    margin-left: -24px !important;
  }

  .student-dashboard-shell .dashboard-main {
    padding-top: 0 !important;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .dashboard-main {
    padding-top: 0 !important;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .role-compact-header {
    min-height: 148px;
    align-items: center !important;
    padding: 22px 24px;
    overflow: hidden;
    background:
      linear-gradient(90deg, rgba(255, 255, 255, 0.94) 0%, rgba(255, 255, 255, 0.88) 42%, rgba(255, 255, 255, 0.38) 72%, rgba(255, 255, 255, 0.12) 100%),
      url("../img/sl.jpg") center / cover no-repeat;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .role-compact-header > .sidebar-toggle,
  .role-dashboard-shell:not(.student-dashboard-shell) .role-compact-header > div:first-of-type {
    align-self: center !important;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .role-compact-header h1 {
    color: #0b2545;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .role-compact-header .dashboard-subtitle {
    color: #1f2f59;
    font-weight: 700;
  }
}

/* Shared dashboard footer. */
.system-footer {
  width: 100%;
  margin-top: 28px;
  padding: 16px 12px 18px;
  border-top: 1px solid rgba(16, 35, 125, 0.16);
  color: #64748b;
  font-size: 12px;
  line-height: 1.55;
  text-align: center;
}

.system-footer p {
  margin: 0;
}

.system-footer p:last-child {
  color: #10237d;
  font-weight: 700;
}

@media (max-width: 820px) {
  .system-footer {
    margin-top: 20px;
    padding: 14px 8px 16px;
    font-size: 11px;
  }
}

/* Keep the existing compact header sizes while showing the school banner on phones and tablets. */
@media (max-width: 1024px) {
  .student-dashboard-shell .school-banner-header,
  .role-dashboard-shell:not(.student-dashboard-shell) .school-banner-header,
  .role-dashboard-shell:not(.student-dashboard-shell) .role-compact-header {
    background:
      linear-gradient(90deg, rgba(255, 255, 255, 0.94) 0%, rgba(255, 255, 255, 0.88) 42%, rgba(255, 255, 255, 0.38) 72%, rgba(255, 255, 255, 0.12) 100%),
      url("../img/sl.jpg") center / cover no-repeat !important;
  }

  .student-dashboard-shell .school-banner-header {
    background:
      linear-gradient(90deg, rgba(255, 255, 255, 0.94) 0%, rgba(255, 255, 255, 0.88) 42%, rgba(255, 255, 255, 0.38) 72%, rgba(255, 255, 255, 0.12) 100%),
      url("../img/sl.jpg") center / contain no-repeat !important;
    background-color: #ffffff !important;
  }

  .role-dashboard-shell:not(.student-dashboard-shell) .school-banner-header,
  .role-dashboard-shell:not(.student-dashboard-shell) .role-compact-header {
    background:
      linear-gradient(90deg, rgba(255, 255, 255, 0.94) 0%, rgba(255, 255, 255, 0.88) 42%, rgba(255, 255, 255, 0.38) 72%, rgba(255, 255, 255, 0.12) 100%),
      url("../img/sl.jpg") center / contain no-repeat !important;
    background-color: #ffffff !important;
  }
}

/* Touch-friendly signature crop editor for phones and tablets. */
@media (max-width: 1024px), (pointer: coarse) {
  .sig-editor-overlay {
    padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
    overflow: hidden;
  }

  .sig-editor-modal {
    width: min(100%, 760px);
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    padding: 12px;
    gap: 9px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .sig-editor-header {
    min-height: 42px;
    padding-right: 42px;
  }

  .sig-editor-header .sig-lightbox-close {
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
  }

  .sig-editor-toolbar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 8px;
  }

  .sig-tool-btn {
    min-height: 44px;
    justify-content: center;
    padding: 8px;
    touch-action: manipulation;
  }

  .sig-editor-viewport {
    min-height: clamp(220px, 42vh, 360px);
    padding: 8px;
    touch-action: none;
  }

  .sig-editor-viewport canvas {
    touch-action: none;
    cursor: grab;
  }

  .sig-editor-viewport canvas:active {
    cursor: grabbing;
  }

  .sig-editor-hint {
    text-align: center;
  }

  .sig-editor-actions > button {
    min-height: 44px;
    touch-action: manipulation;
  }
}

@media (max-width: 560px) {
  .sig-editor-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sig-editor-actions {
    width: 100%;
  }

  .sig-editor-actions > button {
    flex: 1 1 0;
  }
}

/* Keep the desktop crop editor equally easy to drag and usable on shorter screens. */
@media (min-width: 1025px) and (pointer: fine) {
  .sig-editor-modal {
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .sig-editor-viewport canvas {
    cursor: grab;
    touch-action: none;
  }

  .sig-editor-viewport canvas:active {
    cursor: grabbing;
  }
}
