:root {
  --ink: #13213c;
  --muted: #6f7c93;
  --line: #e5eaf3;
  --surface: #ffffff;
  --canvas: #f4f7fc;
  --blue: #2563eb;
  --blue-dark: #1748b3;
  --cyan: #0891b2;
  --green: #159a68;
  --purple: #7c3aed;
  --danger: #dc3651;
  --shadow: 0 18px 45px rgba(31, 57, 101, .09);
  --radius: 20px;
  --type-page-title: clamp(28px, 2.5vw, 36px);
  --type-section-title: 18px;
  --type-body: 13px;
  --type-caption: 11px;
  --student-name-size: 16px;
  --student-code-size: 13px;
  --student-name-color: var(--ink);
  --student-code-color: #607089;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(circle at 8% 0%, #e7f0ff 0, transparent 27rem), var(--canvas);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
.min-width-0 { min-width: 0; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.app-container { width: min(1480px, calc(100% - 36px)); margin: 0 auto; padding-left: 0; padding-right: 0; }
.page-content { flex: 1; padding-top: 30px; padding-bottom: 46px; }

.app-navbar {
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid rgba(218, 226, 240, .88);
  background: rgba(255,255,255,.88); backdrop-filter: blur(16px);
}
.navbar-inner { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand, .nav-actions, .nav-home, .admin-chip { display: inline-flex; align-items: center; }
.brand { gap: 10px; font-size: 19px; font-weight: 600; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 13px; display: inline-grid; place-items: center;
  color: white; font-size: 20px; background: linear-gradient(135deg, #225de7, #09a7c6);
  box-shadow: 0 9px 18px rgba(37, 99, 235, .23);
}
.nav-actions { gap: 9px; }
.nav-home, .admin-chip, .nav-logout {
  min-height: 40px; border-radius: 12px; border: 1px solid transparent; background: transparent;
  color: #536179; font-weight: 600;
}
.nav-home { gap: 8px; padding: 0 13px; }
.nav-home:hover, .nav-home.active { color: var(--blue); background: #eef4ff; }
.admin-chip { gap: 9px; padding: 5px 12px 5px 5px; border-color: var(--line); background: #fff; }
.admin-chip:hover, .admin-chip.active { border-color: #b9cdf9; color: var(--blue); }
.admin-avatar { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: #e8efff; color: var(--blue); font-size: 12px; font-weight: 800; }
.nav-logout-form { margin: 0; }
.nav-logout { width: 40px; padding: 0; cursor: pointer; border-color: var(--line); background: #fff; }
.nav-logout:hover { color: var(--danger); border-color: #ffc7d0; }

.page-heading { margin-bottom: 24px; display: flex; justify-content: space-between; align-items: end; gap: 22px; }
.page-heading h1 { margin: 7px 0 5px; font-size: var(--type-page-title); letter-spacing: -.035em; font-weight: 800; }
.page-heading p { margin: 0; color: var(--muted); }
.back-link { display: inline-flex; align-items: center; gap: 7px; color: var(--blue); font-size: 14px; font-weight: 700; }
.eyebrow { display: inline-flex; align-items: center; gap: 7px; color: var(--blue); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.heading-actions, .qr-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.heading-context, .class-context-line, .admin-class-meta, .session-badges { display: flex; flex-wrap: wrap; gap: 9px; color: var(--muted); font-size: var(--type-body); }
.context-chip, .plain-badge { padding: 6px 9px; border-radius: 999px; background: #fff; border: 1px solid var(--line); }

.btn-gradient, .btn-secondary-app, .btn-outline-app, .btn-danger-app, .btn-success-app {
  min-height: 42px; padding: 0 16px; border: 0; border-radius: 12px; display: inline-flex;
  justify-content: center; align-items: center; gap: 8px; font-weight: 700; cursor: pointer; transition: .18s ease;
}
.btn-gradient { color: #fff; background: linear-gradient(135deg, var(--blue), #168dbb); box-shadow: 0 10px 22px rgba(37,99,235,.22); }
.btn-gradient:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 13px 25px rgba(37,99,235,.29); }
.btn-gradient:disabled { opacity: .55; box-shadow: none; cursor: not-allowed; transform: none; }
.btn-secondary-app, .btn-outline-app { color: #30415e; background: #fff; border: 1px solid #dce4f0; }
.btn-secondary-app:hover, .btn-outline-app:hover { color: var(--blue); border-color: #a9c2f6; background: #f7faff; }
.btn-danger-app { color: #bc2843; background: #fff0f3; border: 1px solid #ffd1d9; }
.btn-danger-app:hover { color: #fff; background: var(--danger); }
.btn-success-app { color: #08764e; background: #e8f8f1; border: 1px solid #bce9d5; }
.btn-lg { min-height: 48px; padding-inline: 21px; }
.btn-xl { min-height: 54px; }
.btn-sm-app { min-height: 35px; padding: 0 11px; border-radius: 9px; font-size: 13px; }

.panel-card, .section-block, .session-summary-card {
  background: var(--surface); border: 1px solid rgba(220, 227, 239, .92); border-radius: var(--radius); box-shadow: var(--shadow);
}
.panel-card { padding: 23px; }
.section-block { padding: 26px; }
.panel-header, .panel-header-row, .section-toolbar { display: flex; align-items: center; gap: 13px; }
.panel-header { margin-bottom: 19px; }
.panel-header-row, .section-toolbar { justify-content: space-between; }
.panel-header h2, .section-toolbar h2 { margin: 0 0 3px; font-size: var(--type-section-title); font-weight: 800; }
.panel-header p, .section-toolbar p { margin: 0; color: var(--muted); font-size: var(--type-body); }
.panel-icon { flex: 0 0 auto; width: 43px; height: 43px; border-radius: 13px; display: grid; place-items: center; font-size: 18px; }
.icon-blue { color: #245ed5; background: #eaf0ff; }
.icon-green { color: #10865a; background: #e6f8f0; }
.icon-purple { color: #7434d2; background: #f1eafd; }
.icon-cyan { color: #087d98; background: #e3f7fb; }

.stats-grid, .mini-stats-grid { display: grid; gap: 16px; }
.stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 22px; }
.stat-card { position: relative; overflow: hidden; min-height: 144px; display: flex; gap: 16px; padding: 21px; border-radius: 18px; border: 1px solid var(--line); background: #fff; box-shadow: 0 12px 28px rgba(31,57,101,.06); }
.stat-card::after { content: ""; position: absolute; width: 95px; height: 95px; border-radius: 50%; right: -32px; top: -33px; background: currentColor; opacity: .07; }
.stat-icon { width: 44px; height: 44px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 14px; color: currentColor; background: color-mix(in srgb, currentColor 11%, white); font-size: 19px; }
.stat-blue { color: #2761dd; }.stat-green { color: #13855c; }.stat-purple { color: #7c3aed; }.stat-cyan { color: #087f99; }
.stat-value { color: var(--ink); font-size: 30px; font-weight: 800; line-height: 1; }
.stat-label { color: var(--ink); font-weight: 700; margin-top: 7px; }
.stat-note { color: var(--muted); font-size: 12px; margin-top: 7px; }
.mini-stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 19px; }
.mini-stat { padding: 15px 18px; display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 15px; }
.mini-stat > i { color: var(--blue); font-size: 21px; }
.mini-stat strong { display: block; font-size: 23px; }.mini-stat span { color: var(--muted); font-size: 13px; }

.term-switcher { margin-bottom: 20px; padding: 15px 18px; display: grid; grid-template-columns: auto 1fr minmax(160px, 210px) minmax(160px, 210px); align-items: end; gap: 16px; background: #ecf3ff; border: 1px solid #dbe8ff; border-radius: 16px; }
.term-switcher-icon { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 13px; color: white; background: var(--blue); }
.term-switcher-copy strong { display: block; margin-bottom: 3px; }.term-switcher-copy { color: var(--muted); }
.term-select-field span { display: block; margin-bottom: 5px; font-size: 12px; color: #55647a; font-weight: 700; }

.toolbar-controls, .inline-tools, .header-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.search-box { min-width: 260px; min-height: 40px; display: flex; align-items: center; gap: 9px; padding: 0 12px; border: 1px solid #dbe2ee; border-radius: 11px; background: #fff; color: #7b879c; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
.search-box.compact { min-width: 220px; }
.segmented-filter { display: flex; padding: 3px; background: #eef2f8; border-radius: 11px; }
.segmented-filter button { min-height: 33px; border: 0; border-radius: 8px; padding: 0 11px; background: transparent; color: #657187; font-size: 13px; font-weight: 700; }
.segmented-filter button.active { color: var(--blue); background: #fff; box-shadow: 0 3px 10px rgba(42,62,96,.08); }

.class-list, .session-list, .admin-class-list { display: grid; gap: 12px; margin-top: 19px; }
.class-row { display: grid; grid-template-columns: minmax(260px, 1.6fr) minmax(190px, .9fr) minmax(180px, .8fr) auto; align-items: center; gap: 22px; padding: 17px 18px; border: 1px solid var(--line); border-radius: 16px; transition: .18s ease; }
.class-row:hover { border-color: #b9ccf3; box-shadow: 0 9px 22px rgba(42,70,119,.08); transform: translateY(-1px); }
.class-main { display: flex; align-items: start; gap: 13px; }
.class-text h3, .session-info h3, .admin-class-title-line h3 { margin: 0; font-size: 16px; font-weight: 800; }
.class-text p, .session-info p, .admin-class-item p { margin: 3px 0 7px; color: var(--muted); font-size: 13px; }
.course-badge, .status-badge { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; border-radius: 999px; padding: 6px 9px; font-size: 11px; font-weight: 800; }
.course-badge { flex: 0 0 auto; }
.badge-theory { color: #2559cb; background: #e9f0ff; }.badge-practice { color: #087955; background: #e5f8ef; }
.course-badge.mini { padding: 4px 8px; }
.progress-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); margin-bottom: 7px; }
.progress-meta strong { color: #39475f; }
.app-progress { height: 7px; border-radius: 99px; background: #edf1f7; overflow: hidden; }
.app-progress .progress-bar { border-radius: 99px; background: linear-gradient(90deg, var(--blue), #16a2bd); }
.class-meta { display: grid; gap: 7px; color: #55647a; font-size: 13px; }
.open-class-btn { min-width: 76px; min-height: 40px; display: inline-flex; justify-content: center; align-items: center; gap: 6px; border-radius: 11px; color: var(--blue); background: #eef4ff; font-weight: 800; }
.open-class-btn:hover { color: #fff; background: var(--blue); }

.admin-layout, .workspace-grid, .qr-workspace, .class-control-grid, .class-data-grid { display: grid; gap: 19px; align-items: start; }
.admin-layout { grid-template-columns: minmax(310px, .78fr) minmax(520px, 1.5fr); }
.workspace-grid { grid-template-columns: minmax(0, 1.35fr) minmax(380px, .8fr); }
.workspace-column { display: grid; gap: 19px; }
.qr-workspace { grid-template-columns: minmax(360px, .78fr) minmax(430px, 1.1fr); }
.class-control-grid { grid-template-columns: minmax(0, 1.35fr) minmax(390px, .75fr); margin-bottom: 19px; }
.class-data-grid { grid-template-columns: minmax(0, 1.55fr) minmax(430px, .85fr); }
.sticky-panel { position: sticky; top: 91px; }
.admin-filter-grid { display: grid; grid-template-columns: 1.4fr repeat(3, minmax(130px, .7fr)); gap: 9px; }
.admin-class-card { border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.admin-class-item { display: flex; align-items: center; gap: 13px; padding: 15px; }
.class-avatar { width: 43px; height: 43px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 13px; color: var(--blue); background: #eaf1ff; }
.admin-class-title-line { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.class-settings-collapse { border-top: 1px solid var(--line); background: #f8faff; }
.class-settings-form { padding: 15px; display: grid; grid-template-columns: repeat(3, minmax(130px, 1fr)); gap: 12px; align-items: end; }
.settings-name { grid-column: span 2; }.settings-save { align-self: end; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-stack { display: grid; gap: 15px; }
.field-full { grid-column: 1 / -1; }.field-wide { grid-column: span 1; }
.form-field label { display: block; margin-bottom: 6px; color: #34425a; font-size: var(--type-body); font-weight: 700; }
.form-field label span { color: var(--danger); }.form-field small, .field-help { color: var(--muted); font-size: 11px; }
.form-control, .form-select { min-height: 43px; border-color: #dbe2ee; border-radius: 11px; color: var(--ink); }
.form-control:focus, .form-select:focus { border-color: #8cb1fa; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.input-with-icon { position: relative; }.input-with-icon > i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: #7b89a0; z-index: 2; }
.input-with-icon .form-control { padding-left: 40px; }.large-input .form-control { min-height: 49px; }
.input-suffix { display: flex; }.input-suffix .form-control { border-radius: 11px 0 0 11px; }.input-suffix span { min-width: 58px; display: grid; place-items: center; padding: 0 10px; border: 1px solid #dbe2ee; border-left: 0; border-radius: 0 11px 11px 0; color: #68768c; background: #f6f8fb; font-size: 12px; }
.classification-note, .login-note, .privacy-note { display: flex; gap: 9px; align-items: start; padding: 11px 13px; border-radius: 11px; color: #47607d; background: #f1f6ff; font-size: 12px; }
.file-drop { min-height: 80px; display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px dashed #aebfde; border-radius: 13px; background: #f8fbff; cursor: pointer; }
.file-drop > i { color: var(--green); font-size: 29px; }.file-drop-text { display: grid; flex: 1; }.file-drop-text small, .file-name { color: var(--muted); font-size: 11px; }.file-drop input { position: absolute; opacity: 0; pointer-events: none; }.upload-form { display: grid; gap: 12px; }
.compact-import-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; gap: 10px; }
.compact-file-drop { min-height: 64px; padding: 10px 13px; }
.compact-file-drop > i { font-size: 24px; }.compact-file-drop .file-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-submit-btn { min-width: 126px; }
.panel-divider { margin: 17px 0 14px; display: flex; align-items: center; gap: 12px; color: #8590a2; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.panel-divider::before, .panel-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.student-add-grid { display: grid; grid-template-columns: .45fr 1fr 1.55fr; gap: 13px; align-items: end; }
.student-add-grid .form-button-field { align-self: end; }
.gps-card { min-height: 72px; display: flex; align-items: center; gap: 12px; padding: 13px; border-radius: 13px; background: #f5f9ff; border: 1px solid #dfe9fa; }
.gps-mode-toggle { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid #dfe7f3; border-radius: 12px; background: #fff; cursor: pointer; }.gps-mode-copy { display: grid; gap: 2px; }.gps-mode-copy strong { color: #24344c; font-size: 13px; }.gps-mode-copy small { color: var(--muted); font-size: 12px; }.gps-mode-toggle input { position: absolute; opacity: 0; pointer-events: none; }.gps-toggle-track { position: relative; width: 46px; height: 26px; flex: 0 0 auto; border-radius: 999px; background: #bdc8d8; transition: background .2s ease; }.gps-toggle-track span { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(31, 48, 75, .2); transition: transform .2s ease; }.gps-mode-toggle input:checked + .gps-toggle-track { background: #24a775; }.gps-mode-toggle input:checked + .gps-toggle-track span { transform: translateX(20px); }.gps-mode-toggle input:focus-visible + .gps-toggle-track { outline: 3px solid rgba(55, 121, 224, .25); outline-offset: 2px; }.gps-card.gps-disabled { opacity: .72; background: #f6f7f9; }
.gps-icon { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 12px; color: #0a8660; background: #ddf6eb; }
.gps-card p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }.gps-card small { color: #8290a4; }.gps-card-copy { min-width: 0; flex: 1; }.gps-location-actions { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }.gps-retry-button, .gps-map-link { display: inline-flex; align-items: center; gap: 5px; margin-top: 7px; padding: 5px 9px; border: 1px solid #cbd8ed; border-radius: 8px; color: #31557d; background: #fff; font-size: 12px; font-weight: 700; text-decoration: none; }.gps-retry-button:hover, .gps-map-link:hover { border-color: #8ba8cf; color: #23466e; background: #f8fbff; }.gps-retry-button[hidden], .gps-map-link[hidden] { display: none; }
.status-dot { width: 10px; height: 10px; margin-left: auto; border-radius: 50%; background: #9da9ba; }.status-dot.loading { animation: pulse 1.2s infinite; }.status-dot.success { background: var(--green); }.status-dot.error { background: var(--danger); }

.table-scroll { overflow: auto; border: 1px solid var(--line); border-radius: 14px; }
.large-table-scroll { max-height: 520px; }.app-table { width: 100%; min-width: 760px; border-collapse: collapse; }
.app-table th { position: sticky; top: 0; z-index: 2; padding: 11px 13px; background: #f6f8fc; color: #657289; border-bottom: 1px solid var(--line); font-size: var(--type-caption); text-transform: uppercase; letter-spacing: .035em; white-space: nowrap; }
.app-table td { padding: 12px 13px; border-bottom: 1px solid #edf0f5; font-size: var(--type-body); vertical-align: middle; }.app-table tr:last-child td { border-bottom: 0; }.app-table tbody tr:hover { background: #fbfcff; }
.student-name { color: var(--student-name-color); font-size: var(--student-name-size); font-weight: 800; line-height: 1.35; }
.student-code { color: var(--student-code-color); font-size: var(--student-code-size); font-weight: 650; line-height: 1.35; font-variant-numeric: tabular-nums; }
.row-menu-btn, .icon-action { width: 36px; height: 36px; display: inline-grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 10px; color: #5e6c82; background: #fff; cursor: pointer; }
.icon-action:hover, .row-menu-btn:hover { color: var(--blue); border-color: #aec6f5; }.icon-action.primary { color: #fff; border-color: var(--blue); background: var(--blue); }.icon-action.danger { color: var(--danger); }.session-actions form { margin: 0; }
.edit-student-box, .edit-student-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }.edit-student-form { flex: 1; }.edit-student-form .form-control, .edit-student-form .form-select { min-width: 110px; flex: 1; }
.student-list-identity { display: grid; justify-items: start; gap: 4px; }
.study-mode-badge { width: fit-content; display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px; border-radius: 999px; font-size: 10px; font-weight: 800; line-height: 1.2; white-space: nowrap; }
.study-mode-badge.mode-cham_chi { color: #245ed5; background: #e9f0ff; }
.study-mode-badge.mode-tu_hoc { color: #087955; background: #e5f8ef; }
.study-mode-select { min-width: 130px; }
.transferred-students-card { margin-top: 16px; padding: 0; overflow: hidden; }
.transferred-students-card details > summary { list-style: none; }
.transferred-students-card details > summary::-webkit-details-marker { display: none; }
.transferred-students-summary { min-height: 78px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 15px 20px; cursor: pointer; }
.transferred-students-summary:hover { background: #f8faff; }
.transferred-students-summary > span:nth-child(2) { display: grid; gap: 3px; }
.transferred-students-summary > span:nth-child(2) > strong { font-size: var(--type-section-title); }
.transferred-students-summary small { color: var(--muted); font-size: var(--type-caption); }
.transferred-count { min-width: 30px; height: 30px; display: grid; place-items: center; border-radius: 999px; color: #52647e; background: #edf2f8; font-size: 12px; font-weight: 800; }
.transferred-chevron { color: #738198; transition: transform .18s ease; }
.transferred-students-card details[open] .transferred-chevron { transform: rotate(180deg); }
.transferred-students-content { padding: 0 18px 18px; border-top: 1px solid var(--line); }
.transferred-student-table-wrap { max-height: 360px; margin-top: 16px; }
.transferred-student-table { min-width: 760px; }
.transferred-student-actions { display: flex; justify-content: flex-end; gap: 8px; }
.transferred-student-actions form { margin: 0; }
.presence-toggle { min-height: 34px; border: 0; border-radius: 10px; padding: 0 10px; font-weight: 700; font-size: 12px; }.presence-toggle.present { color: #08734f; background: #e5f7ef; }.presence-toggle.absent { color: #9a4c58; background: #fff0f2; }
.gps-text { white-space: nowrap; color: #4d5d75; }.token-code { max-width: 120px; color: #6043a6; }.inline-save-status { min-height: 22px; color: var(--green); font-size: 12px; }

/* Đánh giá sinh viên theo từng buổi học */
#resultTable { min-width: 1520px; }
.label-filter { width: auto; min-width: 190px; min-height: 40px; }
.evaluation-legend { margin: -2px 0 11px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 15px; color: #657187; font-size: 11px; }
.evaluation-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 9px; height: 9px; display: inline-block; border-radius: 50%; }
.legend-dot.green { background: #34a853; }.legend-dot.blue { background: #3b82f6; }.legend-dot.orange { background: #f59e0b; }.legend-dot.red { background: #e5484d; }.legend-dot.gray { background: #8a94a6; }
.student-evaluation-row > td { transition: background-color .18s ease; }
#resultTable .student-evaluation-row.label-green > td { background-color: #eaf8ef; }
#resultTable .student-evaluation-row.label-blue > td { background-color: #eaf3ff; }
#resultTable .student-evaluation-row.label-orange > td { background-color: #fff4df; }
#resultTable .student-evaluation-row.label-red > td { background-color: #ffebee; }
#resultTable .student-evaluation-row.label-gray > td { background-color: #f0f2f5; }
#resultTable .student-evaluation-row.label-green > td:first-child { box-shadow: inset 4px 0 #34a853; }
#resultTable .student-evaluation-row.label-blue > td:first-child { box-shadow: inset 4px 0 #3b82f6; }
#resultTable .student-evaluation-row.label-orange > td:first-child { box-shadow: inset 4px 0 #f59e0b; }
#resultTable .student-evaluation-row.label-red > td:first-child { box-shadow: inset 4px 0 #e5484d; }
#resultTable .student-evaluation-row.label-gray > td:first-child { box-shadow: inset 4px 0 #8a94a6; }
#resultTable .student-evaluation-row.label-green:hover > td { background-color: #def4e6; }
#resultTable .student-evaluation-row.label-blue:hover > td { background-color: #dfedff; }
#resultTable .student-evaluation-row.label-orange:hover > td { background-color: #ffedcf; }
#resultTable .student-evaluation-row.label-red:hover > td { background-color: #ffe1e6; }
#resultTable .student-evaluation-row.label-gray:hover > td { background-color: #e8ebef; }
.evaluation-points { width: 82px; min-height: 36px; padding: 6px 8px; }
.evaluation-label-select { width: 205px; min-height: 36px; padding-top: 6px; padding-bottom: 6px; font-size: 12px; }
.evaluation-note { width: 230px; min-height: 36px; padding: 6px 9px; }
.student-evaluation-row .evaluation-points,
.student-evaluation-row .evaluation-label-select,
.student-evaluation-row .evaluation-note { background-color: rgba(255,255,255,.82); }
.evaluation-save-cell { width: 48px; text-align: center; }
.evaluation-save-button { color: var(--green); background: rgba(255,255,255,.88); }
.evaluation-save-button:disabled { opacity: .7; }

.class-student-scroll, .session-list-scroll { max-height: 650px; }
.history-panel { min-width: 0; padding: 20px; }
.history-header { margin-bottom: 13px; }
.session-list { gap: 10px; margin-top: 0; }
.session-list-scroll { overflow-y: auto; padding-right: 4px; scrollbar-gutter: stable; }
.session-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 13px 12px 13px 15px; border: 1px solid var(--line); border-radius: 14px; background: #fff; transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.session-item:hover { border-color: #bed0f4; box-shadow: 0 7px 18px rgba(36,65,113,.07); transform: translateY(-1px); }
.session-item.session-open { border-left: 4px solid var(--green); background: #fbfffd; }
.session-item-body { min-width: 0; }
.session-title-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.session-title-line h3 { min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 800; }
.session-meta-line { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); font-size: 11px; }
.session-meta-line span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.session-meta-line i { color: #7184a2; }
.session-actions { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; }
.status-open { color: #08734f; background: #e4f8ef; }.status-closed { color: #59677d; background: #edf0f5; }.status-expired { color: #a56208; background: #fff4dc; }
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.3s infinite; }

.confirm-dialog { padding: 29px; align-items: center; border: 0; border-radius: 22px; text-align: center; box-shadow: 0 28px 70px rgba(28,49,88,.22); }
.confirm-dialog-icon { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; color: var(--danger); background: #fff0f3; font-size: 24px; }
.confirm-dialog h2 { margin: 16px 0 7px; font-size: 22px; font-weight: 800; }
.confirm-dialog p { max-width: 410px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.confirm-dialog p strong { color: var(--ink); }
.confirm-dialog-actions { width: 100%; margin-top: 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.confirm-delete-button { color: #fff; border-color: var(--danger); background: var(--danger); }
.confirm-delete-button:hover { color: #fff; background: #bd2942; }

.session-summary-card { margin-bottom: 19px; padding: 22px 25px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.session-summary-main h2 { margin: 11px 0 5px; font-size: 24px; }.session-summary-main p { margin: 0; color: var(--muted); }
.attendance-ring { --value: 0; width: 104px; height: 104px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--green) calc(var(--value) * 1%), #e9edf3 0); position: relative; }
.attendance-ring::after { content: ""; position: absolute; inset: 9px; border-radius: inherit; background: white; }.attendance-ring > div { z-index: 1; text-align: center; }.attendance-ring strong { font-size: 24px; }.attendance-ring small { display: block; color: var(--muted); font-size: 10px; }

.qr-display-card { text-align: center; }.qr-title { display: flex; align-items: center; gap: 12px; text-align: left; }.qr-title h2 { margin: 0; font-size: 18px; }.qr-title p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.qr-frame { width: min(100%, 370px); aspect-ratio: 1; margin: 20px auto; padding: 18px; border: 1px solid #dce5f3; border-radius: 22px; background: #fff; box-shadow: inset 0 0 0 7px #f3f7fc; }.qr-frame img { width: 100%; height: 100%; object-fit: contain; }
.qr-frame { position: relative; display: grid; place-items: center; }
.qr-frame img { grid-area: 1 / 1; transition: opacity .18s ease; }
.qr-image-status { grid-area: 1 / 1; display: none; max-width: 250px; justify-items: center; gap: 10px; color: var(--muted); text-align: center; font-size: 12px; }
.qr-image-status .spinner-border { width: 28px; height: 28px; color: var(--blue); }
.qr-frame.qr-loading img, .qr-frame.qr-error img { opacity: 0; }
.qr-frame.qr-loading .qr-image-status, .qr-frame.qr-error .qr-image-status { display: grid; }
.qr-frame.qr-error .qr-image-status .spinner-border { display: none; }
.qr-frame.qr-error .qr-image-status::before { content: "!"; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; color: var(--danger); background: #ffedf0; font-size: 20px; font-weight: 800; }
.countdown-card { margin: 0 auto 17px; max-width: 370px; padding: 13px; border-radius: 12px; background: #f6f9fd; }.countdown-head { display: flex; justify-content: space-between; margin-bottom: 8px; color: var(--muted); font-size: 12px; }.countdown-head strong { color: var(--blue); }
.qr-actions { justify-content: center; }.live-count { text-align: right; }.live-count strong { display: block; font-size: 24px; }.live-count span { color: var(--muted); font-size: 11px; }
.live-list { max-height: 610px; overflow: auto; display: grid; gap: 8px; }.live-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 11px; padding: 11px; border: 1px solid var(--line); border-radius: 12px; }.live-number { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; color: var(--blue); background: #edf3ff; font-size: 11px; font-weight: 800; }.live-item div { display: grid; }.live-item .student-code { margin-top: 2px; }.live-item time { color: var(--muted); font-size: var(--type-caption); }.live-check { color: var(--green); }.live-placeholder, .empty-live { padding: 45px 20px; text-align: center; color: var(--muted); }

.checkin-page, .login-page { min-height: calc(100vh - 190px); display: grid; place-items: center; padding: 18px 0; }
.checkin-card { width: min(100%, 510px); padding: 28px; border-radius: 24px; border: 1px solid var(--line); background: #fff; box-shadow: 0 25px 60px rgba(32,59,107,.13); text-align: center; }
.checkin-brand { display: flex; align-items: center; justify-content: center; gap: 11px; }.checkin-brand div { display: grid; text-align: left; }.checkin-brand div span { color: var(--muted); font-size: 11px; }
.checkin-status-icon { width: 78px; height: 78px; margin: 24px auto 13px; display: grid; place-items: center; border-radius: 50%; font-size: 33px; }.checkin-status-icon.success { color: #087950; background: #e3f8ef; }.checkin-status-icon.error { color: #c92e48; background: #ffedf0; }
.checkin-card h1 { margin: 0; font-size: 25px; font-weight: 800; }.checkin-message { margin: 8px 0 21px; color: var(--muted); }.checkin-student-identity { margin: -8px 0 20px; display: grid; justify-items: center; gap: 2px; }.checkin-student-identity .study-mode-badge { margin-top: 6px; }.checkin-form { text-align: left; }.checkin-gps { margin-top: 1px; }.privacy-note { margin: 13px 0 0; justify-content: center; }
.success-panel, .error-panel { display: flex; gap: 11px; text-align: left; padding: 14px; border-radius: 13px; }.success-panel { color: #086e4b; background: #e6f8f0; }.error-panel { color: #a42c40; background: #fff0f2; }.success-panel div, .error-panel div { display: grid; }.success-panel span, .error-panel span { font-size: 12px; opacity: .82; }

.login-card { width: min(100%, 900px); min-height: 520px; display: grid; grid-template-columns: .92fr 1.08fr; overflow: hidden; border: 1px solid var(--line); border-radius: 26px; background: #fff; box-shadow: 0 28px 70px rgba(28,57,108,.15); }
.login-visual { position: relative; overflow: hidden; display: grid; place-items: center; min-height: 430px; color: #fff; background: linear-gradient(145deg, #174bc3, #089cb5); }
.login-visual::before, .login-visual::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.1); }.login-visual::before { width: 270px; height: 270px; left: -115px; top: -85px; }.login-visual::after { width: 220px; height: 220px; right: -90px; bottom: -70px; }
.login-qr { z-index: 2; width: 135px; height: 135px; display: grid; place-items: center; border-radius: 31px; font-size: 67px; color: #125aca; background: #fff; box-shadow: 0 25px 45px rgba(0,29,92,.24); }.login-orbit { position: absolute; border: 1px solid rgba(255,255,255,.25); border-radius: 50%; }.orbit-one { width: 240px; height: 240px; }.orbit-two { width: 340px; height: 340px; }
.login-content { padding: clamp(30px, 5vw, 55px); align-self: center; }.login-content h1 { margin: 10px 0 7px; font-size: 31px; font-weight: 800; letter-spacing: -.035em; }.login-content > p { margin: 0 0 24px; color: var(--muted); }.login-note { margin-top: 17px; }.static-alert { position: static !important; margin: 0 0 16px; }
.password-field .form-control { padding-right: 46px; }.password-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; border-radius: 9px; color: #6c7890; background: transparent; }.password-toggle:hover { color: var(--blue); background: #eef4ff; }

.app-alert { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border: 1px solid; border-radius: 13px; box-shadow: 0 9px 23px rgba(30,53,91,.08); background: #fff; }
.app-alert-success { color: #08734e; border-color: #b9e8d2; background: #effbf6; }.app-alert-warning { color: #87550d; border-color: #f1d8a7; background: #fff9eb; }.app-alert-danger { color: #a52d43; border-color: #f4c2cb; background: #fff3f5; }.app-alert-info { color: #2456b3; border-color: #c8d8f7; background: #f2f6ff; }
.toast-stack { position: fixed; top: 83px; right: 22px; z-index: 70; width: min(390px, calc(100% - 32px)); display: grid; gap: 9px; }.alert-close { margin-left: auto; border: 0; background: transparent; color: inherit; opacity: .7; }

.empty-state, .empty-inline { text-align: center; color: var(--muted); }.empty-state { padding: 45px 20px; }.compact-empty { padding: 30px 18px; }.empty-state h3 { color: var(--ink); margin: 10px 0 5px; font-size: 18px; }.empty-state p { margin: 0 0 14px; }.empty-icon { width: 53px; height: 53px; margin: 0 auto; display: grid; place-items: center; border-radius: 17px; color: var(--blue); background: #eaf1ff; font-size: 22px; }.empty-inline { padding: 30px; display: grid; gap: 6px; }.app-footer { display: flex; justify-content: center; gap: 9px; padding: 22px; color: #7c889b; font-size: 12px; }.footer-dot { opacity: .5; }

.matrix-scroll { max-height: 68vh; }.matrix-table { min-width: 900px; }.sticky-col { position: sticky; left: 0; z-index: 3; background: #fff; }.matrix-table thead .sticky-col { z-index: 4; background: #f6f8fc; }.attendance-mark { color: var(--green); }.absence-mark { color: #c8ced8; }.text-center { text-align: center; }

@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(.85); } }

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .class-row { grid-template-columns: 1.4fr 1fr auto; }.class-meta { display: none; }
  .admin-layout, .workspace-grid, .class-control-grid, .class-data-grid { grid-template-columns: 1fr; }.sticky-panel { position: static; }
  .admin-filter-grid { grid-template-columns: 1fr 1fr; }.admin-filter-grid .search-box { grid-column: 1 / -1; }
}
@media (max-width: 820px) {
  .app-container { width: min(100% - 24px, 1480px); }
  .page-content { padding-top: 21px; }.page-heading { align-items: flex-start; flex-direction: column; }.heading-actions { width: 100%; }
  .term-switcher { grid-template-columns: auto 1fr; }.term-select-field { grid-column: span 1; }
  .qr-workspace { grid-template-columns: 1fr; }.login-card { grid-template-columns: 1fr; }.login-visual { display: none; }
  .class-settings-form { grid-template-columns: 1fr 1fr; }.settings-name { grid-column: span 1; }
  .student-add-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  .app-container { width: min(100% - 18px, 1480px); }.navbar-inner { min-height: 62px; }.brand { font-size: 16px; }.brand-mark { width: 36px; height: 36px; }.nav-home { display: none !important; }
  .stats-grid, .mini-stats-grid { grid-template-columns: 1fr 1fr; }.stat-card { min-height: 122px; padding: 16px; }.stat-note { display: none; }
  .term-switcher { grid-template-columns: 1fr; }.term-switcher-icon { display: none; }
  .section-block, .panel-card { padding: 17px; border-radius: 16px; }.section-toolbar, .panel-header-row { align-items: stretch; flex-direction: column; }.toolbar-controls, .header-tools { width: 100%; }.search-box { min-width: 0; width: 100%; }.segmented-filter { width: 100%; }.segmented-filter button { flex: 1; }
  .class-row { grid-template-columns: 1fr auto; gap: 13px; }.class-progress-wrap { grid-column: 1 / -1; order: 3; }.class-main { min-width: 0; }.course-badge { display: none; }
  .admin-filter-grid, .class-settings-form, .form-grid, .student-add-grid, .compact-import-form { grid-template-columns: 1fr; }.admin-filter-grid .search-box, .field-full, .settings-name { grid-column: auto; }
  .compact-file-drop .file-name { max-width: 95px; }.import-submit-btn { width: 100%; }
  .class-student-scroll, .session-list-scroll { max-height: none; }
  .session-item { grid-template-columns: 1fr; }.session-actions { justify-content: flex-start; }
  .session-title-line { align-items: flex-start; }.session-title-line h3 { white-space: normal; }
  .checkin-card { padding: 21px 17px; }.login-content { padding: 27px 20px; }.session-summary-card { align-items: flex-start; }.attendance-ring { width: 86px; height: 86px; }
  .qr-frame { padding: 12px; }.app-footer .footer-dot, .app-footer span:last-child { display: none; }
}

/* ================================================================
   App layout 2026 — compact, responsive and optimized for long lists
   ================================================================ */
body.admin-layout-shell {
  overflow-x: hidden;
  background: #f5f7fb;
}
.admin-app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
}
.app-sidebar {
  position: sticky;
  top: 0;
  z-index: 55;
  height: 100vh;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  color: #dce7fb;
  background: linear-gradient(180deg, #10213e 0%, #152b4d 100%);
  box-shadow: 12px 0 32px rgba(19, 42, 76, .09);
}
.sidebar-brand {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 6px;
  color: #fff;
}
.sidebar-brand:hover { color: #fff; }
.sidebar-brand .brand-mark { width: 38px; height: 38px; border-radius: 12px; box-shadow: none; }
.sidebar-brand-copy, .sidebar-user-copy { min-width: 0; display: grid; }
.sidebar-brand-copy strong { font-size: 15px; line-height: 1.2; }
.sidebar-brand-copy small, .sidebar-user-copy small { color: #8fa2c1; font-size: 10px; }
.sidebar-nav { display: grid; gap: 5px; margin-top: 28px; }
.sidebar-section-label { margin: 15px 10px 5px; color: #8295b4; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.sidebar-link {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
  border-radius: 11px;
  color: #afbdd3;
  font-size: 13px;
  font-weight: 650;
}
.sidebar-link i { width: 20px; text-align: center; font-size: 16px; }
.sidebar-link:hover { color: #fff; background: rgba(255,255,255,.07); }
.sidebar-link.active { color: #fff; background: linear-gradient(135deg, #2868eb, #168daa); box-shadow: 0 8px 20px rgba(16, 107, 206, .24); }
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: auto;
  padding: 12px 8px 0;
  border-top: 1px solid rgba(255,255,255,.09);
}
.sidebar-user .admin-avatar { flex: 0 0 auto; color: #fff; background: rgba(255,255,255,.12); }
.sidebar-user-copy { flex: 1; }
.sidebar-user-copy strong { overflow: hidden; color: #fff; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user .nav-logout { min-height: 34px; width: 34px; color: #aebdd3; border-color: rgba(255,255,255,.12); background: rgba(255,255,255,.06); }
.sidebar-user .nav-logout:hover { color: #fff; background: #b9324a; }
.app-main-column { min-width: 0; }
.mobile-topbar { display: none; }
.app-page-content {
  width: 100%;
  max-width: 1640px;
  min-width: 0;
  margin: 0 auto;
  padding: 22px clamp(18px, 2.25vw, 34px) 32px;
}

/* Public student/login layout */
.public-app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.public-navbar { border-bottom: 1px solid rgba(218,226,240,.9); background: rgba(255,255,255,.9); backdrop-filter: blur(14px); }
.public-navbar-inner { min-height: 64px; display: flex; align-items: center; justify-content: space-between; }
.public-nav-note { display: inline-flex; align-items: center; gap: 7px; color: #627189; font-size: 12px; font-weight: 600; }
.public-nav-note i { color: var(--green); }
.public-page-content { flex: 1; }

/* Denser shared chrome */
.app-page-content .page-heading { margin-bottom: 16px; }
.app-page-content .page-heading h1 { margin: 5px 0 3px; font-size: var(--type-page-title); }
.app-page-content .compact-heading { align-items: center; }
.app-page-content .panel-card { padding: 18px; border-radius: 16px; box-shadow: 0 9px 28px rgba(31,57,101,.055); }
.app-page-content .section-block { padding: 19px; border-radius: 16px; box-shadow: 0 9px 28px rgba(31,57,101,.055); }
.app-page-content .panel-header { margin-bottom: 14px; }
.app-page-content .panel-icon { width: 39px; height: 39px; border-radius: 11px; }
.app-page-content .form-control,
.app-page-content .form-select { min-height: 40px; border-radius: 10px; font-size: 13px; }
.app-page-content .btn-gradient,
.app-page-content .btn-secondary-app,
.app-page-content .btn-outline-app,
.app-page-content .btn-danger-app,
.app-page-content .btn-success-app { min-height: 40px; border-radius: 10px; font-size: 13px; }
.app-page-content .btn-lg { min-height: 44px; }

/* Dashboard uses the viewport efficiently */
.app-page-content .term-switcher { margin-bottom: 14px; padding: 11px 14px; border-radius: 13px; }
.app-page-content .term-switcher-icon { width: 39px; height: 39px; }
.app-page-content .stats-grid { gap: 11px; margin-bottom: 14px; }
.app-page-content .stat-card { min-height: 94px; gap: 12px; padding: 15px; border-radius: 14px; }
.app-page-content .stat-icon { width: 39px; height: 39px; border-radius: 11px; }
.app-page-content .stat-value { font-size: 25px; }
.app-page-content .stat-label { margin-top: 4px; font-size: 12px; }
.app-page-content .stat-note { margin-top: 3px; font-size: 10px; }
.app-page-content .section-toolbar { gap: 12px; }
.app-page-content .class-list { gap: 8px; margin-top: 14px; }
.app-page-content .class-row { gap: 16px; padding: 12px 14px; border-radius: 13px; }
.app-page-content .open-class-btn { min-height: 37px; }

/* Admin list stays aligned with the visible screen */
.app-page-content .admin-layout { gap: 15px; grid-template-columns: minmax(300px, .72fr) minmax(560px, 1.5fr); }
.app-page-content .admin-class-list {
  max-height: calc(100vh - 276px);
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
}
.app-page-content .admin-class-card { border-radius: 12px; }
.app-page-content .admin-class-item { padding: 12px; }

/* Class detail: task tabs replace a long stacked page */
.heading-title-line { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.heading-title-line h1 { margin-top: 0 !important; }
.heading-title-line .course-badge { align-self: center; }
.class-overview-strip {
  display: flex;
  align-items: stretch;
  gap: 9px;
  margin-bottom: 13px;
}
.class-overview-strip article {
  min-width: 140px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.overview-icon { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 10px; }
.class-overview-strip strong, .class-overview-strip small { display: block; }
.class-overview-strip strong { font-size: 18px; line-height: 1; }
.class-overview-strip small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.workspace-tabs {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 13px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #eaf0f8;
}
.workspace-tabs button, .workspace-tabs a {
  min-height: 39px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border: 0;
  border-radius: 9px;
  color: #5d6c83;
  background: transparent;
  font-size: 13px;
  font-weight: 750;
}
.workspace-tabs button strong { min-width: 22px; padding: 2px 6px; border-radius: 999px; color: #738198; background: rgba(255,255,255,.7); font-size: 10px; }
.workspace-tabs button:hover, .workspace-tabs a:hover { color: var(--blue); }
.workspace-tabs button.active { color: var(--blue); background: #fff; box-shadow: 0 4px 13px rgba(34,58,96,.09); }
.workspace-tabs a { margin-left: auto; }
.attendance-workspace-grid { display: grid; grid-template-columns: minmax(330px, .7fr) minmax(520px, 1.35fr); gap: 14px; align-items: start; }
.student-workspace-grid { display: grid; grid-template-columns: minmax(330px, .68fr) minmax(560px, 1.5fr); gap: 14px; align-items: start; }
.student-add-compact { grid-template-columns: .65fr 1.35fr; gap: 10px; }
.student-management-card .compact-import-form { grid-template-columns: 1fr; }
.student-management-card .import-submit-btn { width: 100%; }
.student-table { min-width: 640px; }
.session-list-viewport, .student-table-viewport { max-height: calc(100vh - 265px); overflow-y: auto; scrollbar-gutter: stable; }
.session-list-viewport { padding-right: 3px; }
.app-page-content .session-item { padding: 11px 10px 11px 13px; }

/* Result screen: seven useful columns instead of an extra-wide technical table */
.compact-session-summary { padding: 14px 18px; }
.session-summary-title-line { display: flex; align-items: center; gap: 10px; }
.session-summary-title-line h2 { margin: 0; font-size: 19px; }
.compact-session-summary .session-summary-main p { margin-top: 6px; font-size: 12px; }
.attendance-progress-summary { min-width: min(390px, 42vw); display: grid; grid-template-columns: auto minmax(120px, 1fr) auto; align-items: center; gap: 11px; }
.attendance-summary-number strong { font-size: 22px; }.attendance-summary-number span { color: var(--muted); font-size: 12px; }
.attendance-progress-summary .app-progress { --value: 0; height: 9px; }
.attendance-progress-summary .progress-bar { width: calc(var(--value) * 1%); }
.attendance-progress-summary > strong { color: var(--green); font-size: 13px; }
.result-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.panel-title-compact { display: flex; align-items: center; gap: 11px; flex: 0 0 auto; }
.panel-title-compact h2 { margin: 0; font-size: 18px; font-weight: 800; }
.panel-title-compact p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.result-tools { justify-content: flex-end; }
.result-helper-row { min-height: 29px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 9px; }
.result-helper-row .evaluation-legend { margin: 0; }
.result-helper-row .inline-save-status { min-height: auto; }
#resultTable.result-table { width: 100%; min-width: 1080px; table-layout: fixed; }
#resultTable.result-table th:nth-child(1) { width: 220px; }
#resultTable.result-table th:nth-child(2) { width: 142px; }
#resultTable.result-table th:nth-child(3) { width: 90px; }
#resultTable.result-table th:nth-child(4) { width: 230px; }
#resultTable.result-table th:nth-child(5) { width: auto; }
#resultTable.result-table th:nth-child(6) { width: 58px; }
#resultTable.result-table th:nth-child(7) { width: 190px; }
#resultTable.result-table td { padding: 10px 12px; }
.student-identity { min-width: 0; display: grid; }
.student-identity .student-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.student-identity .student-code { margin-top: 2px; }
.student-identity .study-mode-badge { margin-top: 5px; }
.attendance-time { color: var(--muted); font-size: 10px; }
.attendance-toggle-form { display: grid; justify-items: start; gap: 4px; }
.result-table .evaluation-points { width: 100%; min-height: 38px; font-size: 13px; }
.bonus-editor { display: grid; gap: 4px; }
.bonus-editor small { color: #087955; font-size: 9px; font-weight: 750; white-space: nowrap; }
.bonus-editor .evaluation-points:disabled { color: #087955; border-color: #cceadd; background: #f0faf6; opacity: 1; cursor: not-allowed; }
.result-table .evaluation-label-select { width: 100%; min-height: 38px; font-size: 13px; }
.result-table .evaluation-note { width: 100%; min-height: 38px; font-size: 13px; }
.verification-details { position: relative; color: #52627a; }
.verification-details summary { display: inline-flex; align-items: center; gap: 5px; list-style: none; color: var(--blue); cursor: pointer; font-size: 11px; font-weight: 700; }
.verification-details summary::-webkit-details-marker { display: none; }
.verification-details > div { width: 100%; min-width: 0; margin-top: 7px; padding: 8px 0 0; border-top: 1px solid var(--line); background: transparent; }
.verification-details p { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 6px; margin: 0 0 6px; font-size: 10px; }
.verification-details p:last-child { margin-bottom: 0; }.verification-details p span { overflow-wrap: anywhere; }
.result-helper-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.verification-toggle-all { min-height: 34px; display: inline-flex; align-items: center; gap: 7px; padding: 0 11px; border: 1px solid #cddbf2; border-radius: 9px; color: var(--blue); background: #f7faff; font-size: 11px; font-weight: 750; }
.verification-toggle-all:hover, .verification-toggle-all[aria-pressed="true"] { color: #fff; border-color: var(--blue); background: var(--blue); }
.result-table-viewport { max-height: calc(100vh - 324px); overflow: auto; scrollbar-gutter: stable; }
.page-hidden { display: none !important; }
.list-pagination {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
}
.list-pagination > div { display: flex; align-items: center; gap: 7px; }
.list-pagination button { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; color: #53647c; background: #fff; }
.list-pagination button:hover:not(:disabled) { color: #fff; border-color: var(--blue); background: var(--blue); }
.list-pagination button:disabled { opacity: .42; cursor: not-allowed; }
.list-pagination strong { min-width: 44px; color: #46566e; text-align: center; }

/* Attendance matrix keeps only the useful identity column frozen */
.matrix-scroll-hint { display: none; margin: -3px 0 9px; color: var(--muted); font-size: 11px; }
.matrix-scroll { max-height: calc(100vh - 255px); }
.matrix-table { width: 100%; min-width: max(100%, var(--matrix-min-width, 100%)); table-layout: fixed; }
.matrix-table .student-matrix-column { left: 0; width: 250px; min-width: 250px; max-width: 250px; }
.matrix-student-cell { min-width: 0; display: flex; align-items: center; gap: 9px; }
.matrix-index { width: 25px; height: 25px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 8px; color: #64748b; background: #eef2f7; font-size: 10px; font-weight: 800; }
.matrix-student { min-width: 0; display: grid; }
.matrix-student .student-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.matrix-student .student-code { margin-top: 2px; }
.matrix-student .study-mode-badge { margin-top: 4px; }
.matrix-table .total-points-column { left: 250px; width: 110px; min-width: 110px; max-width: 110px; border-right: 1px solid #dfe6f1; background: #fbfcff; box-shadow: 5px 0 10px rgba(31,57,101,.04); }
.matrix-table thead .total-points-column { background: #f1f5fb; }
.bonus-total { min-width: 58px; display: inline-flex; justify-content: center; padding: 5px 9px; border-radius: 9px; color: #6941c6; background: #f1eaff; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.matrix-table .session-column { padding-inline: 7px; }
.matrix-table .session-column strong, .matrix-table .session-column small { display: block; }
.matrix-table .session-column strong { color: #4f5f78; font-size: 13px; line-height: 1.2; }
.matrix-table .session-column small { margin-top: 4px; color: #7d8ba1; font-size: 10px; line-height: 1.2; white-space: nowrap; }
.matrix-table td { height: 48px; padding: 7px 8px; }

@media (max-width: 1200px) {
  .admin-app-shell { grid-template-columns: 78px minmax(0, 1fr); }
  .app-sidebar { padding-inline: 11px; }
  .sidebar-brand { justify-content: center; padding: 0; }
  .sidebar-brand-copy, .sidebar-user-copy, .sidebar-section-label, .sidebar-link span { display: none; }
  .sidebar-nav { margin-top: 25px; }
  .sidebar-link { justify-content: center; padding: 0; }
  .sidebar-user { justify-content: center; padding-inline: 0; }
  .sidebar-user .admin-avatar { display: none; }
  .attendance-workspace-grid, .student-workspace-grid { grid-template-columns: minmax(300px, .72fr) minmax(470px, 1.25fr); }
  .result-toolbar { align-items: flex-start; flex-direction: column; }
  .result-tools { width: 100%; justify-content: flex-start; }
  .result-table-viewport { max-height: calc(100vh - 360px); }
}

@media (max-width: 980px) {
  .app-page-content .admin-layout, .attendance-workspace-grid, .student-workspace-grid { grid-template-columns: 1fr; }
  .app-page-content .sticky-panel { position: static; }
  .app-page-content .admin-class-list, .session-list-viewport, .student-table-viewport { max-height: none; overflow-y: visible; }
  .attendance-workspace-grid .create-session-card { max-width: none; }
  .result-table-viewport { max-height: none; }
}

@media (max-width: 820px) {
  .admin-app-shell { display: block; }
  .app-sidebar { display: none; }
  .mobile-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    border-bottom: 1px solid var(--line);
    background: rgba(255,255,255,.94);
    backdrop-filter: blur(14px);
  }
  .mobile-topbar .brand { font-size: 15px; }
  .mobile-topbar .brand-mark { width: 35px; height: 35px; border-radius: 10px; }
  .mobile-topbar-actions { display: flex; gap: 7px; }
  .mobile-nav-button { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; color: #607087; background: #f1f4f8; }
  .mobile-nav-button.active { color: #fff; background: var(--blue); }
  .app-page-content { padding: 16px 12px 26px; }
  .app-page-content .page-heading { flex-direction: column; align-items: stretch; }
  .app-page-content .heading-actions > * { flex: 1; }
  .app-page-content .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .app-page-content .stat-note { display: none; }
  .class-overview-strip { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); }
  .class-overview-strip article { min-width: 0; padding: 9px; }
  .workspace-tabs { overflow-x: auto; }
  .workspace-tabs { scrollbar-width: none; }
  .workspace-tabs::-webkit-scrollbar { display: none; }
  .workspace-tabs button, .workspace-tabs a { flex: 0 0 auto; }
  .session-summary-card.compact-session-summary { align-items: stretch; flex-direction: column; }
  .session-summary-title-line { align-items: flex-start; flex-direction: column; gap: 7px; }
  .attendance-progress-summary { min-width: 0; width: 100%; }
  .result-tools .search-box { width: 100%; }
  .result-helper-row { align-items: flex-start; flex-direction: column; }
  .result-helper-actions { width: 100%; justify-content: space-between; }
  .matrix-scroll-hint { display: block; }

  .responsive-table-wrap { overflow: visible; border: 0; background: transparent; }
  .responsive-card-table, #resultTable.result-table { min-width: 0; display: block; table-layout: auto; }
  .responsive-card-table thead { display: none; }
  .responsive-card-table tbody { display: grid; gap: 10px; }
  .responsive-card-table tr[data-search-row] {
    display: grid;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: #fff;
    box-shadow: 0 5px 15px rgba(31,57,101,.05);
  }
  .responsive-card-table tr[data-search-row] > td {
    width: 100% !important;
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 9px 11px !important;
    border-bottom: 1px solid #edf0f5;
    background: transparent !important;
    box-shadow: none !important;
    text-align: left !important;
  }
  .responsive-card-table tr[data-search-row] > td:last-child { border-bottom: 0; }
  .responsive-card-table tr[data-search-row] > td::before { content: attr(data-label); color: #78859a; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .035em; }
  .responsive-card-table .edit-row { display: block; margin-top: -10px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 13px 13px; background: #f8faff; }
  .responsive-card-table .edit-row > td { display: block; }
  .responsive-card-table .edit-student-box, .responsive-card-table .edit-student-form { align-items: stretch; flex-direction: column; }
  .responsive-card-table .evaluation-note, .responsive-card-table .evaluation-label-select, .responsive-card-table .evaluation-points { width: 100%; }
  .responsive-card-table .attendance-toggle-form { grid-template-columns: auto 1fr; align-items: center; }
  .responsive-card-table .verification-details > div { min-width: 0; box-shadow: none; }
  .responsive-card-table .student-identity .student-name { white-space: normal; }
  .result-table .student-evaluation-row[class*="label-"] { border-left: 4px solid #d7deea; }
  .result-table .student-evaluation-row.label-green { border-left-color: #34a853; }
  .result-table .student-evaluation-row.label-blue { border-left-color: #3b82f6; }
  .result-table .student-evaluation-row.label-orange { border-left-color: #f59e0b; }
  .result-table .student-evaluation-row.label-red { border-left-color: #e5484d; }
  .result-table .student-evaluation-row.label-gray { border-left-color: #8a94a6; }
}

@media (max-width: 620px) {
  .public-nav-note { display: none; }
  .app-page-content .stats-grid { gap: 8px; }
  .app-page-content .stat-card { min-height: 88px; padding: 12px; }
  .app-page-content .stat-value { font-size: 21px; }
  .app-page-content .term-switcher { padding: 12px; }
  .heading-title-line { align-items: flex-start; flex-direction: column; gap: 7px; }
  .class-overview-strip article { justify-content: center; text-align: center; }
  .class-overview-strip .overview-icon { display: none; }
  .workspace-tabs { padding: 4px; }
  .workspace-tabs button, .workspace-tabs a { flex: 1 1 0; justify-content: center; padding-inline: 7px; }
  .workspace-tabs button strong { display: none; }
  .workspace-tabs a { margin-left: 0; }
  .workspace-tabs span { display: inline; }
  .student-add-compact { grid-template-columns: 1fr; }
  .student-add-compact .field-full { grid-column: auto; }
  .session-item { grid-template-columns: 1fr; }
  .session-actions { justify-content: flex-start; }
  .result-tools { display: grid; grid-template-columns: 1fr; }
  .result-tools .label-filter { width: 100%; }
  .responsive-card-table tr[data-search-row] > td { grid-template-columns: 78px minmax(0, 1fr); }
}
