:root {
  /* UI/UX Pro Max - Minimalism & Swiss Style Color Palette */
  --primary-color: #1a56db;       /* Clear, accessible blue for primary actions */
  --primary-hover: #1e40af;
  --secondary-color: #f3f4f6;     /* Soft gray for secondary buttons/surfaces */
  --secondary-hover: #e5e7eb;
  --danger-color: #dc2626;        /* Clear red for destructive actions */
  --danger-hover: #b91c1c;
  --warning-color: #f59e0b;       /* Amber for warnings/edits */
  --warning-hover: #d97706;

  --bg-app: #f8fafc;              /* Soft off-white for app background */
  --bg-surface: #ffffff;          /* Pure white for bento box tiles */

  --text-main: #111827;           /* High contrast text */
  --text-muted: #4b5563;          /* Secondary text */
  --text-faint: #9ca3af;

  --border-color: #e5e7eb;        /* Soft borders */

  /* Radii for modern bento-box feel */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  /* Soft UI Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-normal: 250ms ease-in-out;

  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.dashboardContainer {
  max-width: 1800px;
  margin: 0 auto;
  padding: 32px 24px;
}

.editorContainer {
  padding-top: 22px;
  padding-bottom: 18px;
}

/* Typography */
h1, h2, h3, h4 {
  color: var(--text-main);
  margin-top: 0;
  letter-spacing: -0.02em;
}

h1 { font-size: 2.25rem; font-weight: 700; margin-bottom: 4px; }
h2 { font-size: 1.5rem; font-weight: 600; margin-bottom: 16px; }
h3 { font-size: 1.125rem; font-weight: 600; }

.subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-top: 0;
}

.userMeta {
  color: var(--text-faint);
  font-size: 0.9rem;
  margin-top: 8px;
}

/* Forms & Inputs */
label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
}

input, select, textarea {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-main);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.15);
}

input:disabled, select:disabled, textarea:disabled {
  background: var(--secondary-color);
  color: var(--text-faint);
  cursor: not-allowed;
}

.inlineTableSelect {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  padding: 6px 10px;
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Buttons (UI/UX Max standard: 150-300ms hover, cursor-pointer) */
button {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color var(--transition-normal), border-color var(--transition-normal), color var(--transition-normal), transform var(--transition-fast);
  background: var(--primary-color);
  color: white;
}

button:focus-visible {
  outline: 3px solid rgba(26, 86, 219, 0.25);
  outline-offset: 2px;
}

button:hover:not(:disabled) {
  background: var(--primary-hover);
}

button:active:not(:disabled) {
  transform: scale(0.98);
}

button:disabled {
  background: var(--border-color);
  color: var(--text-faint);
  cursor: not-allowed;
}

.secondaryBtn {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.secondaryBtn:hover:not(:disabled) {
  background: var(--secondary-hover);
  border-color: #d1d5db;
}

.dangerBtn {
  background: var(--danger-color);
  color: white;
}

.dangerBtn:hover:not(:disabled) {
  background: var(--danger-hover);
}

.actionBtn {
  padding: 8px 12px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.actionEditBtn {
  background: var(--primary-color);
  color: white;
  box-shadow: var(--shadow-sm);
}

.actionEditBtn:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: var(--shadow-md);
}

.actionRemoveBtn {
  background: #fff7f7;
  color: var(--danger-color);
  border: 1px solid #fca5a5;
}

.actionRemoveBtn:hover:not(:disabled) {
  background: #fee2e2;
  border-color: var(--danger-color);
}

/* Bento Box & Surface Areas */
.tableSection, .metricCard, .otpLoginCard, .scoreHighlightCard {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}

/* Topbar & Headers */
.mainNavbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.navBrand {
  font-size: 1.25rem;
  color: var(--text-main);
  white-space: nowrap;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: default;
  gap: 4px;
}

.navBrand:hover:not(:disabled),
.navBrand:disabled {
  background: transparent;
  color: var(--text-main);
}

.navBrand:disabled {
  opacity: 1;
}

.navBrandButton {
  cursor: pointer;
}

.navBrandButton:hover:not(:disabled) {
  color: var(--primary-color);
}

.navLinks {
  display: flex;
  gap: 8px;
  flex: 1;
  margin-left: 32px;
  overflow-x: auto;
  scrollbar-width: none;
}

.navLinks::-webkit-scrollbar {
  display: none;
}

.navLink {
  background: transparent;
  color: var(--text-muted);
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.navLink:hover {
  background: var(--primary-color);
  color: #ffffff;
}

.navLink.active {
  background: var(--primary-color);
  color: #ffffff;
}

.navUser {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}

.userInfo {
  display: flex;
  flex-direction: column;
  text-align: right;
}

.userEmail {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.userRole {
  font-size: 0.75rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.topbarActions {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

/* Filter Bar */
.filtersBar {
  margin-bottom: 24px;
}

.filtersTopActions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filtersTopActionsLeft {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.filtersSearchRow {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.filtersSearchRow label {
  flex: 1 1 300px;
}


.filtersPanel {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  padding-top: 18px;
  border-top: 1px solid var(--border-color);
}

.filtersPanelHeader {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.filtersPanelHeader h2 {
  margin: 0;
  font-size: 1rem;
}

.filtersPanelHint {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.activeFiltersSummary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

.activeFilterChips {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 8px;
}

.activeFilterChip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 6px 10px;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 0.85rem;
  line-height: 1.25;
}

.activeFilterChip span {
  color: #2563eb;
  font-weight: 600;
}

.activeFilterChip strong {
  overflow: hidden;
  max-width: 240px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activeFilterRemoveBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #1e40af;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
}

.activeFilterRemoveBtn:hover {
  background: #dbeafe;
}

.clearFiltersBtn {
  flex-shrink: 0;
  min-height: 38px;
}

/* Metrics Grid (Bento Box Style) */
.metricsGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.metricCard {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  transition: box-shadow var(--transition-normal);
}

.metricCard:hover {
  box-shadow: var(--shadow-md);
}

.metricCard span {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metricCard strong {
  color: var(--primary-color);
  font-size: 2.25rem;
  line-height: 1;
}

.homeMetricsPanel,
.homeCoursesPanel {
  margin-bottom: 24px;
}

.homeChartsGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.homeChartCard {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #ffffff;
}

.homeCoursesBySchoolGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 18px;
}

.homeCourseSchoolCard {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #ffffff;
}

.homeChartHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.homeChartHeader h3 {
  margin: 0;
}

.homeChartHeader span {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: right;
}

.homeChartFrame,
.homeCoursesChart {
  min-width: 0;
}

.homeCoursesChart {
  overflow: hidden;
  width: 100%;
}

/* Tabs */
.tabBar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none; /* Firefox */
}

.tabBar::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.tabBtn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.tabBtn:hover {
  background: var(--primary-color);
  color: #ffffff;
}

.tabBtnActive {
  background: var(--primary-color);
  color: #ffffff;
  border-bottom-color: transparent;
}

.tabBtnActive:hover {
  background: var(--primary-hover);
  color: #ffffff;
}

/* Tables (Swiss Style, clean lines) */
.tableWrap {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden; /* Prevent horizontal scroll */
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed; /* Force columns to fit within the viewport */
  text-align: left;
}

th {
  background: var(--bg-app);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 6px;
  border-bottom: 1px solid var(--border-color);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sortableHeaderBtn {
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  justify-content: flex-start;
  gap: 6px;
  white-space: nowrap;
}

.sortableHeaderBtn:hover:not(:disabled) {
  background: transparent;
  color: var(--primary-color);
}

.sortableHeaderBtn:active:not(:disabled) {
  transform: none;
}

.sortableHeaderIcon {
  flex: 0 0 auto;
  color: var(--text-faint);
  font-size: 0.75rem;
  letter-spacing: 0;
}

.sortableHeaderIconActive {
  color: var(--primary-color);
}

td {
  padding: 10px 6px;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  word-wrap: break-word; /* Allow breaking long words like emails */
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--secondary-color);
}

tbody tr.has-observation td {
  background-color: #fffbeb;
}

tbody tr.has-observation:hover td {
  background-color: #fef3c7;
}

tbody tr.has-observation td:first-child {
  box-shadow: inset 4px 0 0 var(--warning-color);
}

/* Specific Column Widths for Main Table to prevent squishing */
.ageCol { width: 45px; }
.nifCol { width: 90px; }
.phoneCol { width: 95px; }
.escolaCol { width: 85px; }
.interviewCol { width: 125px; }
.missingDataCol { width: 150px; }
.matriculaCol { width: 70px; text-align: center; }
.matriculaCol input { margin: 0 auto; }
.actionsHeader { width: 150px; }

.actionsCell {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.actionsCell button {
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  line-height: 1.15;
  white-space: normal;
}

.actionsCell .actionEditBtn {
  min-height: 44px;
  padding: 10px 12px;
  font-size: 0.86rem;
}

.actionsCell .actionRemoveBtn,
.actionsCell .dangerBtn {
  font-weight: 650;
}


/* Badges */
.statusBadge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.statusNeutral { background: var(--secondary-color); color: var(--text-muted); }
.statusGreen { background: #dcfce7; color: #166534; }
.statusBlue { background: #dbeafe; color: #1d4ed8; }
.statusYellow { background: #fef3c7; color: #92400e; }
.statusRed { background: #fee2e2; color: #991b1b; }

.auditLogTableWrap {
  max-height: 68vh;
  overflow: auto;
}

.auditLogTable {
  min-width: 980px;
  table-layout: auto;
}

.auditLogStickyHeader th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.auditDrawerOverlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  justify-content: flex-end;
  background: rgba(15, 23, 42, 0.38);
}

.auditDrawer {
  width: min(860px, 100%);
  height: 100%;
  overflow: auto;
  background: #ffffff;
  padding: 24px;
  box-shadow: -18px 0 40px rgba(15, 23, 42, 0.2);
}

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

.auditDiff {
  border: 1px solid #d0d7de;
  border-radius: 6px;
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
}

.auditDiffRow {
  display: grid;
  grid-template-columns: 28px minmax(120px, 180px) 1fr;
  gap: 8px;
  padding: 7px 10px;
  border-bottom: 1px solid #d8dee4;
  background: #ffffff;
  color: #24292f;
  white-space: pre-wrap;
  word-break: break-word;
}

.auditDiffRow:last-child {
  border-bottom: none;
}

.auditDiffRowRemoved {
  background: #ffebe9;
  color: #82071e;
}

.auditDiffRowAdded {
  background: #dafbe1;
  color: #116329;
}

.auditExtraBlock {
  margin: 0;
  padding: 12px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  background: #f6f8fa;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Pagination */
.paginationBar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 16px 0;
  gap: 16px;
  flex-wrap: wrap;
}

.paginationInfo {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0;
}

.paginationActions {
  display: flex;
  gap: 8px;
}

/* Editor Grid */
.editorSection {
  padding: 18px 24px;
}

.editorGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px 20px;
}

.editorFullWidth {
  grid-column: 1 / -1;
}

.editorPdfField {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.editorPdfLabel {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
}

.editorPdfCurrentPanel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 10px;
  max-width: 500px;
  padding: 10px 12px;
  border: 1px solid #dbeafe;
  border-radius: var(--radius-md);
  background: #f8fbff;
}

.editorPdfCurrentText {
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 700;
}

.editorPdfCurrentLink {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border: 1px solid rgba(26, 86, 219, 0.25);
  border-radius: var(--radius-sm);
  background: #eff6ff;
  color: var(--primary-color);
  font-size: 0.92rem;
  font-weight: 800;
  text-decoration: none;
  transition: background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), color var(--transition-fast);
}

.editorPdfCurrentLink:hover,
.editorPdfCurrentLink:focus-visible {
  background: #dbeafe;
  border-color: rgba(26, 86, 219, 0.45);
  color: var(--primary-hover);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.12);
  outline: none;
}

.editorPdfNativeInput {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.editorPdfPicker {
  min-height: 64px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-md);
  background: #f8fafc;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.editorPdfPicker:hover {
  background: #f1f5f9;
  border-color: rgba(26, 86, 219, 0.45);
}

.editorPdfPicker.isDragging {
  background: #eff6ff;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.14);
}

.editorPdfPicker.isDragging .editorPdfPickerIcon {
  background: var(--primary-color);
  color: #ffffff;
}

.editorPdfNativeInput:focus-visible + .editorPdfPicker {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.15);
}

.editorPdfPickerIcon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #dbeafe;
  color: var(--primary-color);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.editorPdfPickerContent {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.editorPdfPickerTitle {
  color: var(--text-main);
  font-size: 0.98rem;
  font-weight: 800;
}

.editorPdfFileName {
  min-width: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editorPdfStatus {
  grid-column: 1 / -1;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
}

.editorGroupHeader {
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary-color);
  border-radius: var(--radius-md);
  background: #f8fafc;
}

.editorGroupHeader h2 {
  margin: 0;
  font-size: 1rem;
}

.editorGroupHeader p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.criteriaHeader {
  margin-top: 24px;
  margin-bottom: 12px;
}

.editorToggleField {
  position: relative;
  gap: 10px;
}

.editorToggleLabel {
  line-height: 1.2;
}

.editorToggleInput {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.editorToggleControl {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 12px 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #f9fafb;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), color var(--transition-fast);
}

.editorToggleText {
  min-width: 0;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.2;
}

.editorToggleSwitch {
  position: relative;
  flex: 0 0 46px;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: #d1d5db;
  transition: background var(--transition-fast);
}

.editorToggleKnob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}

.editorToggleField:hover .editorToggleControl {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.editorToggleInput:focus-visible + .editorToggleControl {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.15);
}

.editorToggleInput:checked + .editorToggleControl {
  border-color: rgba(220, 38, 38, 0.45);
  background: #fff1f2;
  color: var(--danger-color);
}

.editorToggleInput:checked + .editorToggleControl .editorToggleSwitch {
  background: var(--danger-color);
}

.editorToggleInput:checked + .editorToggleControl .editorToggleKnob {
  transform: translateX(20px);
}

.editorToggleInput:checked + .editorToggleControl:hover {
  border-color: rgba(220, 38, 38, 0.65);
  background: #fee2e2;
}

.editorActions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
}

.editorActions button {
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  line-height: 1.2;
}

.editorActions button:last-child {
  min-width: 120px;
  min-height: 48px;
  padding-inline: 24px;
  box-shadow: var(--shadow-sm);
}

.editorActions button:last-child:hover:not(:disabled) {
  box-shadow: var(--shadow-md);
}

.editorActions .secondaryBtn {
  min-width: 96px;
}

.editorActions .dangerBtn {
  margin-right: auto;
  background: #fff7f7;
  color: var(--danger-color);
  border: 1px solid #fca5a5;
}

.editorActions .dangerBtn:hover:not(:disabled) {
  background: #fee2e2;
  border-color: var(--danger-color);
}

.sectionDivider {
  border: 0;
  border-top: 1px solid var(--border-color);
  margin: 28px 0;
}

.interviewConfigSection {
  margin-top: 16px;
}

.configBlock {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.configBlockHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.configBlockHeader h3 {
  margin-bottom: 4px;
}

.configBlockHeader .subtitle {
  margin-bottom: 0;
  font-size: 0.95rem;
}

.configTableWrap {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.configTable {
  min-width: 720px;
}

.configTable input,
.configTable select {
  min-width: 150px;
}

.tableActionCell {
  text-align: right;
  white-space: nowrap;
}

.configActions {
  margin-top: 28px;
}

/* Score Highlight (Bento Box highlight) */
.scoreHighlightCard {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0e7ff 100%);
  border-color: #bae6fd;
  text-align: center;
  align-items: center;
  margin: 24px 0;
}

.scoreHighlightCard span { color: #0369a1; text-transform: uppercase; font-size: 0.9rem; font-weight: 600; }
.scoreHighlightCard strong { color: #0c4a6e; font-size: 3rem; font-weight: 700; margin: 8px 0; }
.scoreHighlightCard p { color: #0284c7; font-size: 1.1rem; margin: 0; }

/* Misc */
.errorBox {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger-color);
  padding: 16px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  font-weight: 500;
}

.successBox {
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  color: #166534;
  padding: 16px;
  border-radius: var(--radius-md);
  margin: 0 0 24px;
  font-weight: 600;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
}

a:hover {
  text-decoration: underline;
  color: var(--primary-hover);
}

.studentCell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cardHeader {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.cardHeaderText h2 {
  margin-bottom: 0;
}

.cardSubtitle {
  margin-top: 4px;
}

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

.searchCompactField {
  flex: 1 1 220px;
  min-width: 0;
}

.filterMenuToggle {
  flex-shrink: 0;
  min-height: 44px;
  margin-left: auto;
  border-color: #c7d2fe;
  color: var(--primary-color);
  white-space: nowrap;
}

.filterMenuToggle:hover:not(:disabled),
.filterMenuToggleOpen {
  background: #eff6ff;
  border-color: var(--primary-color);
  color: var(--primary-hover);
}

.filterCountBadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--primary-color);
  color: #ffffff;
  font-size: 0.78rem;
  line-height: 1;
}

.filterMenuChevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  transition: transform var(--transition-fast);
}

.filterMenuToggleOpen .filterMenuChevron {
  transform: rotate(180deg);
}

.reportRangeField {
  flex: 1 1 280px;
  min-width: 0;
}

.reportRangeInputs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.reportRangeInputs input[type="date"] {
  flex: 1 1 130px;
  min-width: 0;
  width: auto;
}

.reportRangeSeparator {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  flex-shrink: 0;
}

.quickPdfLink {
  font-size: 0.85rem;
  font-weight: 600;
}

/* Mobile record cards */
.mobileCards {
  display: none;
}

.mobileRecordCard {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mobileRecordCard.has-observation {
  background-color: #fffbeb;
  border-left: 4px solid var(--warning-color);
}

.mobileRecordCard__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.mobileRecordCard__title {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.3;
  word-break: break-word;
}

.mobileRecordCard__meta {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.mobileRecordCard__badge {
  margin-top: 8px;
}

.mobileRecordCard__pdf {
  flex-shrink: 0;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-app);
  text-decoration: none;
  font-size: 0.85rem;
}

.mobileRecordCard__pdf:hover {
  text-decoration: none;
  background: var(--secondary-color);
}

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

.mobileField {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.mobileField--full {
  grid-column: 1 / -1;
}

.mobileField__label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
}

.mobileField__value {
  font-size: 0.92rem;
  color: var(--text-main);
  word-break: break-word;
}

.mobileField__value select,
.mobileField__value input[type="checkbox"] {
  width: 100%;
  max-width: 100%;
}

.mobileRecordCard__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--border-color);
}

.mobileRecordCard__actions button {
  width: 100%;
  min-height: 44px;
}

.mobileScrollHint {
  display: none;
  margin: 0 0 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.tableWrap--scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.emptyRow {
  text-align: center;
  padding: 32px;
  color: var(--text-faint);
}

.loginScreen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.loginIntro {
  max-width: 560px;
  text-align: center;
}

.loginEyebrow {
  display: inline-flex;
  margin-bottom: 10px;
  color: var(--primary-color);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.otpLoginCard {
  width: 100%;
  max-width: 440px;
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.loginStepHeader {
  padding-bottom: 4px;
}

.loginStepHeader h2 {
  margin-bottom: 4px;
}

.loginStepHeader p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.loginLoadingHint {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
}

/* ——— Responsive: tablet ——— */
@media (max-width: 1024px) {
  .dashboardContainer {
    padding: 16px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  .tableSection,
  .metricCard,
  .otpLoginCard {
    padding: 18px;
  }

  h1 {
    font-size: 1.75rem;
  }

  .metricsGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 24px;
  }

  .metricCard strong {
    font-size: 1.75rem;
  }

  .responsiveCards .tableWrap {
    display: none;
  }

  .responsiveCards .mobileCards {
    display: grid;
    gap: 14px;
  }

  .responsiveCards .mobileScrollHint {
    display: none;
  }

  .tableWrap--scroll .mobileScrollHint {
    display: block;
  }

  .tableWrap--scroll table {
    min-width: 640px;
    table-layout: auto;
  }

  .filtersSearchRow,
  .filtersBar .topbarActions,
  .topbarActions {
    flex-direction: column;
    align-items: stretch;
  }

  .filtersSearchRow {
    align-items: stretch;
  }

  .filtersSearchRow label,
  .filtersBar label,
  .topbarActions label {
    flex: 1 1 auto;
    width: 100%;
  }

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

  .activeFilterChip strong {
    max-width: min(58vw, 320px);
  }

  .clearFiltersBtn {
    width: 100%;
    min-height: 44px;
  }

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

  .filterMenuToggle,
  .filtersSearchRow .secondaryBtn,
  .filtersSearchRow button {
    width: 100%;
    margin-left: 0 !important;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .topbarActions {
    width: 100%;
  }

  /* FIX: navMenuToggle mobile */
  .navMenuToggle {
    width: auto;
    align-self: flex-start;
  }

  .topbarActions button:not(.navMenuToggle) {
    width: 100%;
    min-height: 44px;
  }

  .tabBar {
    position: sticky;
    top: 56px;
    z-index: 20;
    background: var(--bg-surface);
    margin: 0 -18px 16px;
    padding: 8px 18px 12px;
    border-bottom: 1px solid var(--border-color);
    gap: 6px;
  }

  .tabBtn {
    padding: 10px 14px;
    min-height: 44px;
    font-size: 0.88rem;
  }

  .paginationBar {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 12px;
  }

  .paginationActions {
    justify-content: stretch;
    gap: 10px;
  }

  .paginationActions button {
    flex: 1;
    min-height: 44px;
  }

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

  .editorActions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .editorActions button {
    width: 100%;
    min-height: 44px;
  }

  .configBlockHeader {
    flex-direction: column;
  }

  .configBlockHeader button {
    width: 100%;
    min-height: 44px;
  }

  .scoreHighlightCard strong {
    font-size: 2.25rem;
  }

  .usersSection .tableWrap {
    display: block;
    overflow-x: auto;
  }

  .usersSection table {
    min-width: 520px;
    table-layout: auto;
  }

  .calendarSection {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .calendarSection .fc-toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .calendarSection .fc-toolbar-title {
    font-size: 1.1rem;
  }
}

/* ——— Responsive: phone ——— */
@media (max-width: 768px) {
  body.navMenuOpen {
    overflow: hidden;
  }

  .mainNavbar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top));
    gap: 0;
  }

  .navTopRow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
  }

  .navBrand {
    font-size: 1.05rem;
  }

  .navMenuToggle {
    display: inline-flex;
    /* FIX: navMenuToggle mobile */
    width: auto;
    align-self: flex-start;
    min-height: 44px;
    padding: 8px 14px;
  }

  .navLinks {
    display: none;
    flex-direction: column;
    width: 100%;
    margin: 12px 0 0;
    gap: 6px;
    max-height: min(60vh, 400px);
    overflow-y: auto;
  }

  .navLinks--open {
    display: flex;
  }

  .navLink {
    width: 100%;
    justify-content: flex-start;
    min-height: 44px;
    padding: 12px 14px;
    text-align: left;
  }

  .navUser {
    width: 100%;
    margin: 12px 0 0;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    justify-content: space-between;
    gap: 12px;
  }

  .userInfo {
    text-align: left;
    min-width: 0;
  }

  .userEmail {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 55vw;
  }

  .logoutBtn {
    flex-shrink: 0;
    min-height: 44px;
  }

  .navBackdrop {
    /* FIX: navMenuToggle mobile */
    position: fixed;
    inset: 0;
    z-index: 40;
    border: none;
    background: rgba(15, 23, 42, 0.45);
    color: transparent;
    cursor: pointer;
    padding: 0;
    width: auto;
    min-height: 0;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    transform: none;
  }

  .navBackdrop:hover:not(:disabled),
  .navBackdrop:active:not(:disabled),
  .navBackdrop:focus,
  .navBackdrop:focus-visible {
    background: rgba(15, 23, 42, 0.45);
    color: transparent;
    box-shadow: none;
    outline: none;
    transform: none;
  }

  .mainNavbar {
    position: sticky;
    top: 0;
    z-index: 50;
  }

  .dashboardContainer {
    padding: 12px;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }

  h1 {
    font-size: 1.45rem;
  }

  .subtitle {
    font-size: 0.95rem;
  }

  .metricsGrid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .metricCard {
    padding: 16px;
  }

  .metricCard strong {
    font-size: 1.5rem;
  }

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

  .tableSection {
    padding: 14px;
  }

  .tabBar {
    top: 0;
    margin-left: -14px;
    margin-right: -14px;
    padding-left: 14px;
    padding-right: 14px;
  }

  .loginScreen {
    padding: 24px 16px;
    justify-content: flex-start;
    padding-top: max(48px, env(safe-area-inset-top));
  }

  .otpLoginCard {
    margin-top: 16px;
  }

  .otpLoginCard button {
    min-height: 48px;
  }

  input,
  select,
  textarea,
  button {
    font-size: 16px;
  }

  .inlineTableSelect {
    font-size: 16px;
    min-height: 44px;
  }
}

@media (max-width: 400px) {
  .metricsGrid {
    grid-template-columns: 1fr;
  }
}

/* Desktop: hide mobile menu control */
@media (min-width: 769px) {
  .navMenuToggle,
  .navBackdrop {
    display: none !important;
  }

  .navTopRow {
    display: contents;
  }
}

/* ============================================================
   Acessibilidade: respeitar preferência de movimento reduzido
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   Banners de aviso (stale refresh / limite de registos)
   ============================================================ */
.warningBanner {
  background: #fff7e6;
  border: 1px solid #f0d59a;
  border-left: 6px solid #e0a800;
  color: #7a5a00;
  border-radius: 8px;
  padding: 10px 16px;
  margin: 12px 16px 0;
  font-size: 0.82rem;
}

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

.warningBanner__dismiss {
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid #e0a800;
  background: transparent;
  color: #7a5a00;
  cursor: pointer;
  font-weight: 600;
  width: auto;
  flex-shrink: 0;
}

/* ============================================================
   Banner de integridade de dados (super_admin)
   ============================================================ */
.dataHealthBanner {
  background: #fdecec;
  border: 1px solid #f5b5b5;
  border-left: 6px solid #c0392b;
  color: #7d1f1f;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 12px 16px 0;
}

.dataHealthBanner__title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #a32626;
}

.dataHealthBanner__meta {
  margin-top: 4px;
  font-size: 0.82rem;
}

.dataHealthBanner__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.dataHealthBanner__btn {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #c0392b;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  width: auto;
}

.dataHealthBanner__btn--solid {
  background: #c0392b;
  color: #fff;
}

.dataHealthBanner__btn--ghost {
  background: transparent;
  color: #a32626;
}

.dataHealthBanner__tableWrap {
  margin-top: 10px;
  max-height: 280px;
  overflow: auto;
  border: 1px solid #f0c4c4;
  border-radius: 6px;
  background: #fff;
}

.dataHealthBanner__table {
  width: 100%;
  border-collapse: collapse;
}

.dataHealthBanner__table th,
.dataHealthBanner__table td {
  text-align: left;
  padding: 6px 8px;
  font-size: 0.75rem;
  border-bottom: 1px solid #f0dada;
  white-space: nowrap;
}

.dataHealthBanner__cell--wrap {
  white-space: normal !important;
}

.dataHealthBanner__cell--recommendation {
  min-width: 220px;
}

/* ============================================================
   Skeleton loading (carregamento inicial)
   ============================================================ */
@keyframes skeletonPulse {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

.skeletonBar {
  height: 14px;
  border-radius: 6px;
  background: #e2e8f0;
  animation: skeletonPulse 1.4s ease-in-out infinite;
}

.skeletonRow td {
  padding: 14px 12px;
}

.skeletonCard {
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fff;
}

.skeletonBar--short {
  width: 60%;
}

/* ============================================================
   Badge de observações nos cartões mobile
   ============================================================ */
.mobileRecordCard__obsBadge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fef3c7;
  border: 1px solid #f1d48a;
  color: #92600a;
  font-size: 0.75rem;
  font-weight: 700;
}

/* ============================================================
   Indicador de frescura dos dados
   ============================================================ */
.lastUpdatedHint {
  font-size: 0.78rem;
  color: var(--text-muted, #64748b);
  align-self: center;
  white-space: nowrap;
}

