/* Reference UI layer: visual-only styling for the three supplied CRM mockups. */
:root {
  --ref-canvas: #f3f8fd;
  --ref-card: #fff;
  --ref-ink: #10264b;
  --ref-muted: #607aa0;
  --ref-line: #dbe7f3;
  --ref-navy: #082b49;
  --ref-blue: #1467ef;
  --ref-shadow: 0 5px 18px rgba(22, 67, 115, .07);
  --ref-radius: 13px;
}

body { background: var(--ref-canvas); color: var(--ref-ink); font-size: 15px; }
.app-shell { grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { padding: 22px 16px 16px; background: linear-gradient(180deg, #082b49 0%, #083657 62%, #062842 100%); }
.brand { padding: 0 7px 22px; gap: 11px; }
.brand-mark { width: 46px; height: 46px; border-radius: 13px; background: #fff; color: var(--ref-blue); font-size: 13px; }
.brand strong { font-size: 16px; }
.brand small { color: #a8bfd4; font-size: 11px; }
.nav-group { margin: 17px 10px 7px; color: #88a3bd; font-size: 10px; letter-spacing: .1em; }
.nav-item { min-height: 40px; padding: 9px 11px; gap: 11px; border-radius: 9px; color: #c0d1e1; font-size: 14px; }
.nav-item.active { background: var(--ref-blue); box-shadow: 0 5px 12px rgba(20,103,239,.26); }
.nav-icon, .nav-icon .ui-icon { width: 19px; height: 19px; }
.sidebar-foot { padding: 15px 9px 3px; }
.sidebar-foot strong { font-size: 12px; }
.sidebar-foot small { font-size: 10px; }

.topbar { min-height: 92px; height: 92px; padding: 17px 28px; gap: 14px; background: rgba(255,255,255,.96); }
.topbar h1 { font-size: 32px; letter-spacing: -.045em; }
.page-heading { min-width: 170px; }
.eyebrow, .dashboard-kicker { font-size: 11px; }
.global-search { max-width: 470px; margin-left: auto; margin-right: auto; }
.global-search input { height: 48px; font-size: 14px; border-radius: 11px; }
.icon-button, .menu-button, .back-top-button { width: 42px; height: 42px; border-radius: 11px; }
.viewer-preview-button { min-height: 42px; padding-inline: 14px; font-size: 13px; border-radius: 10px; }
.profile-button { min-height: 46px; }
.profile-copy strong { font-size: 14px; }
.profile-copy small { font-size: 11px; }
.avatar { width: 42px; height: 42px; }

.content { max-width: 1540px; padding: 28px 30px 50px; }
.dashboard-intro { margin-bottom: 22px; }
.dashboard-intro h2 { font-size: 30px; letter-spacing: -.04em; }
.dashboard-intro p, .section-heading p { font-size: 14px; }
.dashboard-kpis, .module-metrics { gap: 12px; }
.metric { min-height: 118px; padding: 18px; border-radius: var(--ref-radius); box-shadow: var(--ref-shadow); }
.metric-label { font-size: 13px; color: #263d62; }
.metric-value { margin: 10px 0 5px; font-size: 29px; letter-spacing: -.035em; }
.metric-note { font-size: 12px; }
.metric-icon { width: 39px; height: 39px; border-radius: 11px; }
.metric-icon .ui-icon { width: 21px; height: 21px; }
.status-strip { gap: 12px; margin: 12px 0 16px; }
.status-card { min-height: 104px; padding: 15px; border-radius: var(--ref-radius); box-shadow: var(--ref-shadow); }
.status-card > div > span { font-size: 12px; }
.status-card strong { font-size: 25px; }
.status-card small { font-size: 11px; }
.status-icon { width: 38px; height: 38px; }
.inactive-summary-card { width: 100%; display: flex; align-items: center; gap: 14px; margin: 0 0 16px; padding: 15px 18px; border: 1px solid var(--ref-line); border-radius: var(--ref-radius); background: #fff; color: var(--ref-ink); box-shadow: var(--ref-shadow); text-align: left; cursor: pointer; }
.inactive-summary-card:hover { border-color: #b9d1ed; background: #fbfdff; }
.inactive-summary-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: #edf3fb; color: #193a65; }
.inactive-summary-card > span:nth-child(2) { display: grid; grid-template-columns: auto auto; align-items: baseline; gap: 3px 16px; flex: 1; }
.inactive-summary-card strong { font-size: 14px; }
.inactive-summary-card b { font-size: 21px; }
.inactive-summary-card small { grid-column: 1 / -1; color: var(--ref-muted); font-size: 12px; }
.inactive-summary-card em { color: var(--ref-blue); font-size: 12px; font-style: normal; font-weight: 700; }
.dashboard-operations-grid { grid-template-columns: 1.1fr 1fr; gap: 16px; }
.panel { border-radius: var(--ref-radius); box-shadow: var(--ref-shadow); }
.panel h2 { font-size: 19px; }
.panel-subtitle { font-size: 12px; }
.panel-link { font-size: 12px; }
.donut-chart { width: 166px; height: 166px; }
.donut-chart strong { font-size: 25px; }
.donut-legend span, .donut-legend strong { font-size: 12px; }
.exam-schedule { gap: 5px; }
.exam-schedule button { padding: 12px 0; }
.activity-feed-panel { margin-top: 16px; }

.section-heading { margin-bottom: 20px; }
.section-heading h2 { font-size: 28px; letter-spacing: -.035em; }
.heading-actions { gap: 9px; }
.action-button, .secondary-button { min-height: 42px; padding: 9px 14px; border-radius: 9px; font-size: 13px; }
.table-toolbar { padding: 13px; margin-bottom: 14px; gap: 12px; border-radius: var(--ref-radius); background: #fff; border: 1px solid var(--ref-line); }
.search, .filter { min-height: 44px; padding: 10px 13px; border-radius: 9px; font-size: 13px; }
.result-count { font-size: 12px; }
.student-list-actions { display: flex; justify-content: flex-end; margin: -4px 0 10px; }
.students-page-table { max-height: calc(100vh - 298px); border-radius: var(--ref-radius); }
.students-page-table .students-table { min-width: 1320px; }
.students-page-table th, .students-page-table td { height: 47px; padding: 10px 13px; font-size: 13px; }
.students-page-table th { position: sticky; top: 0; z-index: 5; background: #f6faff; color: #58749a; font-size: 10px; }
.students-page-table .student-name b { font-size: 13px; }
.students-page-table .badge { font-size: 11px; padding: 5px 9px; }
.row-action { min-height: 32px; padding: 6px 8px; font-size: 11px; border-radius: 8px; }
.row-action .ui-icon { width: 14px; height: 14px; }
.inactive-toggle { width: 37px; height: 21px; padding: 2px; border: 0; border-radius: 99px; background: #cbd6e4; cursor: pointer; }
.inactive-toggle span { display: block; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: transform .16s ease; }
.inactive-toggle.is-on { background: #2563eb; }
.inactive-toggle.is-on span { transform: translateX(16px); }
.inactive-toggle.is-processing { background: #f59e0b; cursor: wait; }
.inactive-toggle:disabled { opacity: .75; cursor: wait; }

.inactive-filter-card { display: grid; grid-template-columns: minmax(220px, 1.3fr) 150px 170px 190px auto auto; align-items: end; gap: 12px; padding: 14px; margin-bottom: 15px; border: 1px solid var(--ref-line); border-radius: var(--ref-radius); background: #fff; box-shadow: var(--ref-shadow); }
.inactive-filter-card .filter-field { min-width: 0; }
.inactive-filter-card .filter-field > span { font-size: 11px; font-weight: 700; }
.inactive-filter-card .filter, .inactive-filter-card .search { width: 100%; }
.inactive-table-wrap { border-radius: var(--ref-radius); }
.inactive-table { min-width: 1240px; }
.inactive-table th, .inactive-table td { height: 48px; padding: 10px 13px; font-size: 13px; }
.inactive-table th { position: sticky; top: 0; z-index: 5; background: #f6faff; font-size: 10px; }
.inactive-reactivate { background: #16a34a; color: #fff; border-color: #16a34a; }
.inactive-reactivate:hover { background: #12823b; color: #fff; }
.inactive-table td > .empty { padding: 24px; }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -280px; width: 260px; transition: left .22s ease; }
  .sidebar.open { left: 0; }
  .sidebar-overlay.open { display: block; }
  .menu-button { display: grid; place-items: center; }
  .inactive-filter-card { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .topbar { min-height: 84px; height: auto; padding: 15px 16px; flex-wrap: wrap; }
  .topbar h1 { font-size: 27px; }
  .global-search { order: 4; flex-basis: 100%; max-width: none; }
  .content { padding: 20px 16px 40px; }
  .dashboard-kpis, .module-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-operations-grid { grid-template-columns: 1fr; }
  .inactive-filter-card { grid-template-columns: 1fr; }
  .inactive-summary-card { align-items: flex-start; flex-wrap: wrap; }
  .inactive-summary-card em { margin-left: 54px; }
}
.promotion-kpi-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin:16px 0}
.student-pagination{display:flex;align-items:center;justify-content:center;gap:12px;margin:18px 0}
.student-pagination button{min-width:42px;height:42px;border:1px solid var(--border);border-radius:10px;background:var(--surface);color:var(--primary);font-weight:700}
.student-pagination button:disabled{opacity:.45}
@media(max-width:760px){.promotion-kpi-row{grid-template-columns:1fr}}
.staff-groups-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px;margin:18px 0}.staff-group-panel{margin-top:20px;padding:20px;border:1px solid var(--border,#e2e8f0);border-radius:16px;background:var(--surface,#fff)}.staff-group-user{display:flex;flex-direction:column;gap:4px;margin-bottom:16px}.staff-group-user strong{font-size:18px}.staff-group-user span{color:var(--muted,#64748b);font-size:14px}@media(max-width:700px){.staff-groups-grid{grid-template-columns:1fr}}
.settings-group-builder{display:grid;gap:14px;min-width:0}.settings-group-builder>div:first-child{display:grid;gap:6px;min-width:0}.settings-group-builder input{box-sizing:border-box;max-width:100%;min-width:0}.settings-group-create-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.settings-group-date-control,.settings-group-custom-control{display:grid;align-content:start;gap:8px;min-width:0;padding:14px;border:1px solid var(--border,#dbe4f0);border-radius:12px;background:var(--surface-soft,#f8fafc)}.settings-group-date-control .date-picker-control{min-width:0}.settings-group-date-control button,.settings-group-custom-control button{justify-self:start;max-width:100%;white-space:normal}@media(max-width:700px){.settings-group-create-grid{grid-template-columns:1fr}}
.settings-group-list{display:grid;gap:10px;min-width:0}.settings-group-list-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.settings-group-list-heading>div{display:grid;gap:3px;min-width:0}.settings-group-list-heading small,.group-archived-label{color:var(--muted,#64748b)}.settings-group-list .table-wrap{max-height:360px;overflow:auto;border:1px solid var(--border,#dbe4f0);border-radius:12px}.settings-group-list table{width:100%;table-layout:auto}.settings-group-list td,.settings-group-list th{padding:10px 12px;vertical-align:middle}.settings-group-list td:first-child{min-width:180px}.settings-group-list td:first-child strong,.settings-group-list td:first-child small{display:block;overflow-wrap:anywhere}.group-management-actions{display:flex;align-items:center;gap:6px;flex-wrap:wrap;min-width:0}.group-management-actions .table-action{white-space:nowrap}.table-action.warning{color:#9a5b00;border-color:#f2c66d}.table-action.danger,.action-button.danger{color:#b42318;border-color:#f3aaa3}.group-change-preview{display:grid;grid-template-columns:minmax(90px,.45fr) minmax(0,1fr);gap:10px 16px;align-items:start;padding:14px;border:1px solid var(--border,#dbe4f0);border-radius:12px;background:var(--surface-soft,#f8fafc)}.group-change-preview strong{overflow-wrap:anywhere}.notice.warning{border-color:#f2c66d;background:#fff8e8}.notice.warning p{margin:.4rem 0 0}@media(max-width:700px){.settings-group-list table,.settings-group-list thead,.settings-group-list tbody,.settings-group-list tr,.settings-group-list th,.settings-group-list td{display:block}.settings-group-list thead{display:none}.settings-group-list tr{padding:10px;border-bottom:1px solid var(--border,#dbe4f0)}.settings-group-list td{display:grid;grid-template-columns:90px minmax(0,1fr);gap:8px;padding:5px 0;min-width:0!important}.settings-group-list td:before{content:attr(data-label);font-weight:700;color:var(--muted,#64748b)}.group-change-preview{grid-template-columns:1fr}}

/* Global premium color system: visual-only overrides shared by every CRM role/page. */
:root {
  --navy: #0B1F3A;
  --navy-2: #173B6D;
  --blue: #2563EB;
  --blue-soft: #DBEAFE;
  --ink: #0F172A;
  --muted: #64748B;
  --line: #D9E3F0;
  --canvas: #F5F7FB;
  --green: #16A34A;
  --green-soft: #DCFCE7;
  --amber: #F59E0B;
  --amber-soft: #FEF3C7;
  --red: #DC2626;
  --red-soft: #FEE2E2;
  --slate-soft: #F1F5F9;
  --purple: #7C3AED;
  --purple-soft: #EDE9FE;
  --cyan: #06B6D4;
}

body { background: var(--canvas); color: var(--ink); }
.sidebar { background: linear-gradient(165deg, #0B1F3A 0%, #102F59 58%, #24346F 100%); }
.nav-item { color: #C7D7EC; }
.nav-item:hover { background: rgba(124,58,237,.22); color: #fff; }
.nav-item.active { background: var(--blue); box-shadow: 0 7px 18px rgba(37,99,235,.38), inset 3px 0 #93C5FD; }
.nav-icon { color: #DBEAFE; }
.nav-group { color: #A9BFE0; }
.sidebar-foot { border-top-color: rgba(219,234,254,.2); }
.topbar { background: #fff; border-bottom-color: #D9E3F0; box-shadow: 0 3px 16px rgba(11,31,58,.05); }
.global-search input, .search { border-color: #BFDBFE; background: #F8FBFF; }
.global-search input:focus, .search:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(37,99,235,.12); }
.icon-button, .menu-button, .profile-button { border-color: #D9E3F0; }
.icon-button:hover, .menu-button:hover { color: var(--blue); border-color: #93C5FD; background: #EFF6FF; }
.avatar { background: var(--purple-soft); color: var(--purple); }
.metric, .panel, .status-card, .detail-card, .table-toolbar, .inactive-filter-card { border-color: #D9E3F0; box-shadow: 0 6px 20px rgba(37,99,235,.07); }
.metric { border-top: 3px solid var(--blue); }
.metric-green { border-top-color: var(--green); }
.metric-amber { border-top-color: var(--amber); }
.metric-cyan { border-top-color: var(--cyan); }
.metric-purple, .metric-violet { border-top-color: var(--purple); }
.metric-slate { border-top-color: #94A3B8; }
.metric-icon { background: var(--blue-soft); color: var(--blue); }
.metric-green .metric-icon { background: var(--green-soft); color: var(--green); }
.metric-amber .metric-icon { background: var(--amber-soft); color: var(--amber); }
.metric-cyan .metric-icon { background: #CFFAFE; color: #0891B2; }
.metric-purple .metric-icon, .metric-violet .metric-icon { background: var(--purple-soft); color: var(--purple); }
.metric-note i { background: var(--blue); }
.metric-green .metric-note i { background: var(--green); }
.metric-amber .metric-note i { background: var(--amber); }
.metric-cyan .metric-note i { background: var(--cyan); }
.metric-purple .metric-note i, .metric-violet .metric-note i { background: var(--purple); }
.status-card:nth-child(1) { border-left: 3px solid var(--green); }
.status-card:nth-child(2) { border-left: 3px solid var(--amber); }
.status-card:nth-child(3) { border-left: 3px solid var(--red); }
.status-card:nth-child(4) { border-left: 3px solid var(--purple); }
.table-wrap { border-color: #CBDDF2; box-shadow: 0 5px 18px rgba(22,67,115,.06); }
table tbody tr:nth-child(even) { background: #F8FBFF; }
table tbody tr:hover { background: #DBEAFE !important; }
th { background: #EFF6FF; color: #49688F; }
.badge.paid, .badge.pass { background: var(--green-soft); color: var(--green); }
.badge.partial, .badge.scheduled { background: var(--amber-soft); color: #B45309; }
.badge.unpaid, .badge.fail { background: var(--red-soft); color: var(--red); }
.badge.notEntered { background: var(--purple-soft); color: var(--purple); }
.badge.neutral { background: #E2E8F0; color: #475569; }
.primary-button, .action-button.primary, .button-primary { background: var(--blue); color: #fff; box-shadow: 0 5px 14px rgba(37,99,235,.25); }
.primary-button:hover, .action-button.primary:hover, .button-primary:hover { background: #1D4ED8; }
button.success, .success-button { background: var(--green); color: #fff; }
button.danger, .danger-button { background: var(--red); color: #fff; }
button.warning, .warning-button { background: var(--amber); color: #fff; }
.secondary-button { border-color: #C4B5FD; background: var(--purple-soft); color: var(--purple); }
.filter.active, .exam-pills button.active { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 4px 12px rgba(37,99,235,.25); }
.filter:not(.active), .exam-pills button { border-color: #C4B5FD; }
.modal, .modal-card, .utility-panel { border-top: 4px solid var(--blue); box-shadow: 0 22px 60px rgba(11,31,58,.2); }
.modal-heading, .modal-header { background: linear-gradient(90deg, #EFF6FF, #EDE9FE); }
.exam-date-group summary { background: #DBEAFE; }
.exam-date-group.tone-1 summary { background: #EDE9FE; }
.exam-date-group.tone-2 summary { background: #DCFCE7; }
.exam-status { background: var(--amber-soft); color: #B45309; }
.exam-report-status.sent { background: var(--green-soft); color: var(--green); }
.exam-report-status.late { background: var(--red-soft); color: var(--red); }
.exam-actions .exam-pass { border-color: #86EFAC; color: var(--green); background: #F0FDF4; }
.exam-actions .exam-fail { border-color: #FCA5A5; color: var(--red); background: #FFF5F5; }
.exam-actions .exam-absent { border-color: #C4B5FD; color: var(--purple); background: var(--purple-soft); }
.exam-risk-options .ready { background: var(--green-soft); border-color: #86EFAC; }
.exam-risk-options .medium { background: var(--amber-soft); border-color: #FCD34D; }
.exam-risk-options .severe { background: var(--red-soft); border-color: #FCA5A5; }
.inactive-toggle.is-on { background: var(--blue); }
.inactive-toggle.is-processing { background: var(--amber); }
.readonly-banner, .notice.info { background: var(--blue-soft); border-color: #BFDBFE; }
.notice.error { background: var(--red-soft); border-color: #FCA5A5; }
.skeleton { background: linear-gradient(90deg, #DBEAFE 25%, #F8FAFC 50%, #EDE9FE 75%); }

/* Final layout polish: keep dense data readable without escaping its container. */
.exam-workspace, .exam-date-group, .exam-table-wrap, .exam-table-wrap table,
.panel, .table-wrap, .modal-card, .utility-panel { min-width: 0; }
.exam-page-head > *, .exam-date-group summary > *, .exam-actions, .exam-report-status { min-width: 0; }
.exam-date-group summary { flex-wrap: wrap; }
.exam-date-group summary h2 { overflow-wrap: anywhere; }
.exam-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; white-space: normal; }
.exam-actions button { margin: 0; max-width: 100%; overflow-wrap: anywhere; }
.exam-workspace th, .exam-workspace td { max-width: 240px; overflow-wrap: anywhere; }
.exam-workspace td:first-child { min-width: 150px; }
.exam-risk-options { flex-wrap: wrap; min-width: 0; }
.exam-risk-options label { min-width: 0; flex: 1 1 170px; overflow-wrap: anywhere; }
.inactive-table-panel { padding: 15px; }
.inactive-table-wrap { overflow-x: auto; }
.inactive-table { min-width: 1080px; table-layout: fixed; }
.inactive-table th, .inactive-table td { height: 41px; padding: 7px 9px; font-size: 12px; }
.inactive-table th { font-size: 9px; }
.inactive-table th:nth-child(1), .inactive-table td:nth-child(1) { width: 7%; }
.inactive-table th:nth-child(2), .inactive-table td:nth-child(2) { width: 16%; }
.inactive-table th:nth-child(3), .inactive-table td:nth-child(3) { width: 10%; }
.inactive-table th:nth-child(4), .inactive-table td:nth-child(4) { width: 12%; }
.inactive-table th:nth-child(5), .inactive-table td:nth-child(5), .inactive-table th:nth-child(6), .inactive-table td:nth-child(6), .inactive-table th:nth-child(7), .inactive-table td:nth-child(7) { width: 8%; }
.inactive-table th:nth-child(8), .inactive-table td:nth-child(8) { width: 10%; }
.inactive-table th:nth-child(9), .inactive-table td:nth-child(9) { width: 8%; }
.inactive-table th:nth-child(10), .inactive-table td:nth-child(10) { width: 8%; }
.inactive-table th:nth-child(11), .inactive-table td:nth-child(11), .inactive-table th:nth-child(12), .inactive-table td:nth-child(12) { width: 7%; }
.inactive-table .student-name, .inactive-table .col-school { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inactive-table .badge { font-size: 10px; padding: 4px 6px; }
.inactive-table .action-button, .inactive-table .table-action { min-height: 29px; padding: 5px 7px; font-size: 10px; }
.inactive-kpis .metric { min-height: 102px; padding: 14px; }
.inactive-filter-card { padding: 11px; gap: 9px; margin-bottom: 11px; box-shadow: 0 3px 12px rgba(22,67,115,.05); }
.inactive-filter-card .filter-field > span { font-size: 10px; }
.students-page-table { max-height: calc(100vh - 255px); }
.students-page-table .students-table { min-width: 1180px; }
.students-page-table th, .students-page-table td { height: 43px; padding: 8px 10px; }
.students-page-table .student-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.students-workspace { min-width: 0; }
.students-list-pane { min-width: 0; }
.student-pagination { display: none; }
@media (max-width: 900px) {
  .inactive-table { min-width: 1000px; }
  .exam-actions { gap: 4px; }
}

/* Final compact workspace pass for Admin and Staff views. */
.content { padding: 22px 26px 34px; }
.section-heading { margin-bottom: 14px; }
.metrics, .module-metrics, .dashboard-kpis { gap: 11px; }
.metric { min-height: 104px; padding: 15px; }
.metric-value { margin: 7px 0 3px; }
.panel { padding: 15px; }
.dashboard-operations-grid { gap: 12px; margin-top: 10px; }
.dashboard-operations-grid > .panel { min-height: 0; padding: 14px; }
.table-toolbar { gap: 9px; margin-bottom: 11px; padding: 10px; }
.table-wrap { max-width: 100%; }
.compact-table th, .compact-table td { height: 42px; padding: 8px 10px; }
.compact-table th { font-size: 11px; }
.compact-table td { font-size: 13px; }
.badge { padding: 5px 8px; font-size: 11px; }
.action-button, .secondary-button { min-height: 40px; padding: 8px 13px; font-size: 13px; }
.page-dashboard .exam-schedule { width: 100%; min-width: 0; }
.page-dashboard .exam-schedule > button { grid-template-columns: 48px minmax(0,1fr) 76px; width: 100%; min-width: 0; gap: 7px; padding: 7px 4px; }
.page-dashboard .exam-schedule > button > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.page-dashboard .exam-schedule > button i { justify-self: stretch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-dashboard .panel-header { min-width: 0; }
.page-dashboard .panel-header > * { min-width: 0; }
.page-dashboard .panel-header h2, .page-dashboard .panel-subtitle { overflow-wrap: anywhere; }
.exam-page-head, .exam-page-head > *, .exam-kpi, .exam-date-group, .exam-date-group summary { min-width: 0; }
.exam-page-head { margin-bottom: 14px; }
.exam-kpis { gap: 12px; }
.exam-kpi { padding: 16px; gap: 16px; min-height: 104px; }
.exam-kpi strong { font-size: 30px; }
.exam-date-group { margin: 10px 0; }
.exam-workspace th, .exam-workspace td { padding: 8px 9px; }
.exam-workspace td { font-size: 13px; }
.exam-actions button { min-height: 30px; padding: 5px 8px; font-size: 11px; }
@media (max-width: 1100px) {
  .content { padding: 20px 20px 30px; }
  .dashboard-operations-grid { gap: 10px; }
}

/* Desktop fit: primary Admin/Staff tables use the available viewport width. */
@media (min-width: 1101px) {
  .students-page-table, .inactive-table-wrap { overflow-x: hidden; }
  .students-page-table .students-table, .inactive-table { min-width: 0; width: 100%; table-layout: fixed; }
  .students-page-table th, .students-page-table td, .inactive-table th, .inactive-table td { padding: 7px 7px; font-size: 11px; }
  .students-page-table .col-row-action { width: 6.5%; min-width: 0; }
  .students-page-table .row-action { width: 100%; min-width: 0; padding: 5px 4px; font-size: 10px; }
  .students-page-table .row-action span { display: none; }
  .students-page-table .inactive-toggle { transform: scale(.9); transform-origin: center; }
  .inactive-table .action-button, .inactive-table .table-action { padding: 4px 5px; font-size: 9px; }
  .inactive-table .student-name, .inactive-table .col-school { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* Final Admin/Staff containment: compact actions and the reduced inactive schema. */
.inactive-table { min-width: 0 !important; width: 100%; table-layout: fixed; }
.inactive-table th:nth-child(1), .inactive-table td:nth-child(1) { width: 10%; }
.inactive-table th:nth-child(2), .inactive-table td:nth-child(2) { width: 25%; }
.inactive-table th:nth-child(3), .inactive-table td:nth-child(3) { width: 14%; }
.inactive-table th:nth-child(4), .inactive-table td:nth-child(4) { width: 19%; }
.inactive-table th:nth-child(5), .inactive-table td:nth-child(5) { width: 12%; text-align: center; }
.inactive-table th:nth-child(6), .inactive-table td:nth-child(6) { width: 9%; text-align: center; }
.inactive-table th:nth-child(7), .inactive-table td:nth-child(7), .inactive-table th:nth-child(8), .inactive-table td:nth-child(8) { width: 10.5%; text-align: center; }
.inactive-table .student-name b { font-size: 13px; }
.inactive-table .inactive-days { text-align: center; font-variant-numeric: tabular-nums; }
.inactive-table .table-action, .inactive-table .inactive-reactivate { max-width: 100%; white-space: nowrap; }
.exam-workspace .exam-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; min-width: 210px; }
.exam-workspace .exam-actions button { flex: 0 1 auto; white-space: nowrap; }
.exam-workspace table { table-layout: fixed; }
.exam-workspace th, .exam-workspace td { overflow: hidden; text-overflow: ellipsis; }
.exam-workspace th:last-child, .exam-workspace td:last-child { width: 31%; overflow: visible; }
.page-dashboard .exam-schedule > button { overflow: hidden; }

/* Micro-spacing only: reclaim a few pixels between Roll No and Student. */
.students-page-table .students-table th:nth-child(1),
.students-page-table .students-table td:nth-child(1) { padding-right: 3px; }
.students-page-table .students-table th:nth-child(2),
.students-page-table .students-table td:nth-child(2) { padding-left: 4px; }

/* Reusable responsive safety utilities. */
.no-overlap, .no-overlap *, .cell-flex-safe, .cell-flex-safe > *,
.responsive-grid > *, .action-group > *, .table-responsive-safe > * { min-width: 0; }
.cell-safe, .cell-safe > *, .text-safe { min-width: 0; }
.no-overlap { overflow-wrap: anywhere; word-break: normal; }
.truncate-safe { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.responsive-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 14px; }
.action-group { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
.mobile-stack { display: flex; min-width: 0; }
.table-responsive-safe { width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; overflow-y: visible; -webkit-overflow-scrolling: touch; }
.cell-flex-safe { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }

/* Global containment for every role and component. */
*, *::before, *::after { box-sizing: border-box; }
main, .content, .content > *, .panel, .metric, .modal-backdrop, .modal-card,
.utility-panel, .form-card, .table-wrap, .table-toolbar, .filter-cluster { min-width: 0; }
button, input, select, textarea { max-width: 100%; }
button { overflow-wrap: anywhere; }
.panel-header, .section-heading, .heading-actions, .topbar-actions { min-width: 0; flex-wrap: wrap; }
.panel-header > *, .section-heading > *, .heading-actions > * { min-width: 0; }
.panel-header h2, .section-heading h2, .panel-subtitle, .section-heading p { overflow-wrap: anywhere; }
.modal-backdrop { padding: 16px; overflow: auto; }
.modal-card, .confirm-modal, .utility-panel { width: min(100%, 760px); max-height: calc(100vh - 32px); overflow: auto; }
.modal-form-grid, .form-grid { min-width: 0; }
.modal-actions, .form-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 9px; }
.table-wrap table { max-width: 100%; }

/* Stable column contracts remove the source of table collisions. */
@media (min-width: 1101px) {
  .students-page-table .students-table th:nth-child(1), .students-page-table .students-table td:nth-child(1) { width: 8%; }
  .students-page-table .students-table th:nth-child(2), .students-page-table .students-table td:nth-child(2) { width: 20%; }
  .students-page-table .students-table th:nth-child(3), .students-page-table .students-table td:nth-child(3) { width: 11%; }
  .students-page-table .students-table th:nth-child(4), .students-page-table .students-table td:nth-child(4) { width: 14%; }
  .students-page-table .students-table th:nth-child(5), .students-page-table .students-table td:nth-child(5),
  .students-page-table .students-table th:nth-child(6), .students-page-table .students-table td:nth-child(6),
  .students-page-table .students-table th:nth-child(7), .students-page-table .students-table td:nth-child(7) { width: 5.5%; }
  .students-page-table .students-table th:nth-child(8), .students-page-table .students-table td:nth-child(8) { width: 9%; }
  .students-page-table .students-table th:nth-child(n+9), .students-page-table .students-table td:nth-child(n+9) { width: 4.5%; }
  .exam-workspace .exam-actions { flex-wrap: nowrap; white-space: nowrap; }
  .exam-workspace .exam-actions button { flex: 0 0 30px; width: 30px; padding-inline: 0; }
  .exam-workspace .exam-actions button span { display: none; }
}

@media (max-width: 1024px) {
  .content { padding: 18px 16px 28px; }
  .topbar { padding: 14px 18px; }
  .dashboard-operations-grid, .report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exam-workspace .exam-actions { min-width: 180px; }
  .exam-workspace th:last-child, .exam-workspace td:last-child { width: 28%; }
  .students-page-table .students-table, .inactive-table { min-width: 0 !important; }
  .students-page-table th, .students-page-table td, .inactive-table th, .inactive-table td { padding: 6px 6px; font-size: 10px; }
  .students-page-table .row-action span { display: none; }
}
@media (max-width: 820px) {
  .dashboard-operations-grid, .report-grid, .responsive-grid { grid-template-columns: 1fr 1fr; }
  .metrics, .module-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table-toolbar { flex-wrap: wrap; }
  .table-toolbar .search-wrap, .table-toolbar .filter-cluster { flex: 1 1 100%; max-width: none; }
  .filter-cluster { display: flex; flex-wrap: wrap; }
  .filter-field { flex: 1 1 180px; min-width: 0; }
  .exam-actions { justify-content: flex-start; }
}
@media (max-width: 600px) {
  .topbar { min-height: 78px; padding: 12px 14px; }
  .topbar-actions { gap: 6px; }
  .content { padding: 14px 12px 24px; }
  .dashboard-operations-grid, .report-grid, .responsive-grid, .metrics, .module-metrics { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; gap: 10px; }
  .heading-actions, .action-group, .modal-actions, .form-actions { width: 100%; justify-content: stretch; }
  .heading-actions > button, .action-group > button, .modal-actions > button, .form-actions > button { flex: 1 1 150px; }
  .panel { padding: 12px; }
  .exam-kpis { grid-template-columns: 1fr; }
  .exam-workspace .exam-actions { min-width: 0; width: 100%; }
  .exam-workspace .exam-actions button { flex: 1 1 120px; }
  .exam-workspace table { table-layout: auto; min-width: 680px; }
  .students-page-table, .inactive-table-wrap { overflow-x: auto; }
  .students-page-table .students-table, .inactive-table { min-width: 680px !important; }
  .modal-backdrop { padding: 8px; }
  .modal-card, .confirm-modal, .utility-panel { max-height: calc(100vh - 16px); border-radius: 12px; }
  .modal-form-grid, .form-grid { grid-template-columns: 1fr; }
  .global-search { order: 3; flex-basis: 100%; margin: 0; max-width: none; }
}
@media (max-width: 390px) {
  .topbar h1 { font-size: 24px; }
  .topbar-actions .icon-button { width: 36px; height: 36px; }
  .action-group > button, .modal-actions > button, .form-actions > button { flex-basis: 100%; }
  .exam-workspace .exam-actions button { flex-basis: 100%; }
}

/* Icon-first action groups prevent long labels from colliding in dense tables. */
.exam-actions button { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 0; white-space: nowrap; }
@media (min-width: 821px) {
  .exam-actions button span { display: none; }
  .exam-workspace .exam-actions { min-width: 175px; }
  .exam-workspace th:last-child, .exam-workspace td:last-child { width: 24%; }
}
@media (max-width: 820px) {
  .exam-actions button { flex: 1 1 92px; }
  .exam-workspace table { min-width: 720px; }
}

/* Transactional group workflow: flexible controls, never overlapping. */
.group-select-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:center;min-width:0}.group-select-row select{width:100%;min-width:0}.group-create-area{display:grid;gap:12px;min-width:0;padding:14px;border:1px solid var(--border,#dbe4f0);border-radius:14px;background:var(--surface-soft,#f8fafc)}.settings-group-create-grid{display:grid;grid-template-columns:minmax(120px,.55fr) minmax(220px,1.2fr) auto;gap:10px;align-items:end;min-width:0}.settings-group-create-grid>*{min-width:0}.settings-group-create-grid label,.settings-group-create-grid [data-group-create-date]{display:grid;gap:6px}.settings-group-create-grid select,.settings-group-create-grid input{width:100%;min-width:0;box-sizing:border-box}.group-delete-option{display:grid;grid-template-columns:auto minmax(140px,.7fr) minmax(180px,1fr);align-items:center;gap:10px;padding:12px;border:1px solid var(--border,#dbe4f0);border-radius:12px}.group-delete-option select{width:100%;min-width:0}.settings-group-builder{display:grid;gap:14px;min-width:0}
@media(max-width:820px){.settings-group-create-grid{grid-template-columns:1fr}.settings-group-create-grid .action-button{width:100%}.group-select-row{grid-template-columns:1fr}.group-select-row .secondary-button{width:100%}.group-delete-option{grid-template-columns:auto minmax(0,1fr)}.group-delete-option select{grid-column:2}}
