:root {
  --bg: #f2f3f7;
  --card: #ffffff;
  --text: #1f2933;
  --muted: #6b7280;
  --brand: #ac3a3a;
  --accent: #0ea5e9;
  --danger: #dc2626;
  --shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
  --bs-primary: #ac3a3a;
  --bs-primary-rgb: 172, 58, 58;
  --bs-link-color: #ac3a3a;
  --bs-link-hover-color: #922f2f;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  height: 70px;
  min-height: 70px;
  padding: 0 14px;
  background: #ffffff;
  color: #111111;
  border-bottom: 1px solid #e4e6ee;
}
.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.brand img {
  display: block;
  height: 50px;
  width: auto;
}
.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  white-space: nowrap;
  overflow-x: auto;
  max-width: calc(100% - 220px);
}
.nav a {
  display: inline-flex;
  align-items: center;
  color: #111111;
  text-decoration: none;
  margin-left: 0;
  font-size: 0.86rem;
  line-height: 1.2;
  padding: 4px 6px;
  border-radius: 6px;
}
.nav a:hover { color: #111111; background: rgba(0, 0, 0, 0.06); }
.logout { font-weight: 600; }

.app-container {
  max-width: 100%;
  margin: 12px auto 10px;
  padding: 0 12px;
  width: 100%;
  flex: 1 0 auto;
}

.footer {
  text-align: center;
  padding: 16px;
  color: var(--muted);
  margin-top: auto;
}

.dashboard-hero {
  background: linear-gradient(120deg, #ac3a3a, #f3b0b0);
  color: #fff;
  padding: 22px 24px;
  border-radius: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
.dashboard-grid-secondary {
  grid-template-columns: 1fr 1.5fr;
}
.dashboard-kpi {
  border: 1px solid #e5eaf4;
}
.dashboard-kpi-title {
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #55627a;
  margin-bottom: 6px;
}
.dashboard-kpi-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 8px;
  color: #0f172a;
}
.dashboard-split {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.dashboard-chip {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
}
.dashboard-chip-ok { background: #dcfce7; color: #166534; }
.dashboard-chip-warn { background: #ffedd5; color: #9a3412; }
.dashboard-chip-muted { background: #e2e8f0; color: #334155; }
.dashboard-progress {
  display: flex;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: #e5e7eb;
}
.dashboard-progress span { height: 100%; display: block; }
.dashboard-progress-ok { background: #16a34a; }
.dashboard-progress-warn { background: #f59e0b; }
.dashboard-progress-muted { background: #64748b; }
.dashboard-card {
  border: 1px solid #e5eaf4;
}
.dashboard-card-title {
  font-size: 1rem;
  margin-bottom: 12px;
}
.dashboard-activity-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(130px, 1fr));
  gap: 10px;
}
.dashboard-activity-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px;
}
.dashboard-activity-label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #64748b;
  margin-bottom: 6px;
}
.dashboard-activity-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1;
}
.dashboard-top-list {
  display: grid;
  gap: 10px;
}
.dashboard-top-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 10px;
}
.dashboard-top-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
}
.dashboard-top-label {
  font-size: 0.84rem;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dashboard-top-value {
  font-size: 0.9rem;
  color: #1e3a8a;
}
.dashboard-top-bar {
  height: 7px;
  border-radius: 999px;
  overflow: hidden;
  background: #dbeafe;
}
.dashboard-top-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #f3b0b0, #ac3a3a);
}
.import-select-checkbox {
  accent-color: #0f6cbf;
  width: 1rem !important;
  height: 1rem !important;
  min-width: 1rem;
  min-height: 1rem;
  max-width: 1rem;
  max-height: 1rem;
  display: inline-block;
  vertical-align: middle;
  margin: 0;
  padding: 0;
}
.btn.btn-copy-import {
  --bs-btn-bg: #0f6cbf;
  --bs-btn-border-color: #0f6cbf;
  --bs-btn-hover-bg: #0d5fa8;
  --bs-btn-hover-border-color: #0d5fa8;
  --bs-btn-active-bg: #0c5392;
  --bs-btn-active-border-color: #0c5392;
  color: #fff;
  background: #0f6cbf;
  border-color: #0f6cbf;
}
.btn.btn-copy-import:hover,
.btn.btn-copy-import:focus {
  background: #0d5fa8;
  border-color: #0d5fa8;
  color: #fff;
}

.hero {
  background: linear-gradient(120deg, #1e3a8a, #0ea5e9);
  color: #fff;
  padding: 32px;
  border-radius: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.card {
  background: var(--card);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

.card.narrow { max-width: 420px; margin: 20px auto; }

.grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-2 { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-2 .actions { grid-column: 1 / -1; }
.tests-create-actions { margin-top: 8px; }

h1, h2, h3 { margin-top: 0; }

label { display: block; font-weight: 600; margin-bottom: 8px; }
input, select, textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.88rem;
  margin-top: 4px;
}

input.readonly-info {
  background: #f1f5f9;
  color: #64748b;
  cursor: not-allowed;
  pointer-events: none;
  border-style: dashed;
}

textarea { resize: vertical; }

.btn {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
}

.btn-primary,
.btn.btn-primary {
  --bs-btn-bg: #ac3a3a;
  --bs-btn-border-color: #ac3a3a;
  --bs-btn-hover-bg: #922f2f;
  --bs-btn-hover-border-color: #922f2f;
  --bs-btn-active-bg: #7f2828;
  --bs-btn-active-border-color: #7f2828;
}
.btn-outline-primary,
.btn.btn-outline-primary {
  --bs-btn-color: #ac3a3a;
  --bs-btn-border-color: #ac3a3a;
  --bs-btn-hover-bg: #ac3a3a;
  --bs-btn-hover-border-color: #ac3a3a;
  --bs-btn-active-bg: #922f2f;
  --bs-btn-active-border-color: #922f2f;
}
.btn:hover { background: #922f2f; }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
.btn-xs {
  --bs-btn-padding-y: 0.05rem;
  --bs-btn-padding-x: 0.35rem;
  --bs-btn-font-size: 0.72rem;
  --bs-btn-border-radius: 0.3rem;
  line-height: 1.15;
}

.link { background: none; border: none; color: var(--brand); cursor: pointer; text-decoration: underline; padding: 0; }
.link.danger { color: var(--danger); }

.sort-link { color: var(--brand); text-decoration: none; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.sort-label { text-decoration: underline; }

.header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.inline-actions { display: flex; align-items: center; gap: 10px; }
.students-title {
  font-size: 1.7rem;
  font-weight: 700;
}
.students-title-wrap {
  margin-top: 13px;
  margin-bottom: 18px;
}
.students-filters {
  padding: 10px;
  width: fit-content;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}
.students-filters-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
}
.students-filters label {
  font-size: 0.8rem;
  margin-bottom: 4px;
  width: 210px;
  min-width: 0;
}
.students-filters .form-control,
.students-filters .form-select {
  min-height: 30px;
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
  max-width: 210px;
  min-width: 0;
}
.students-filters textarea.notes-compact {
  min-height: 30px;
  height: 30px;
}
.students-filters .multi-select-trigger {
  min-height: 30px;
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
  margin-top: 4px;
  font-size: 0.875rem;
  line-height: 1.15;
}
.students-list-panel {
  width: fit-content;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}
.students-list-panel .students-filters,
.students-list-panel .students-list-card {
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}
.students-filters .tests-create-actions {
  margin-top: 4px;
}
.tests-editor-title {
  margin: 0 0 8px;
  font-size: 1.7rem;
  font-weight: 400;
}
.tests-editor-card {
  width: 66%;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}
.tests-fields-6-panel {
  width: min(100%, calc(6 * 210px + 5 * 6px + 20px));
  max-width: calc(6 * 210px + 5 * 6px + 20px);
}
.tests-fields-6-panel .students-filters {
  width: 100%;
  max-width: 100%;
}
.tests-fields-6-panel .students-filters-grid {
  width: 100%;
  max-width: 100%;
}
.tests-fields-6-panel .students-filters form {
  width: 100%;
}
.tests-fields-6-panel .students-filters-grid > label {
  width: calc((100% - 5 * 6px) / 6);
  max-width: calc((100% - 5 * 6px) / 6);
  min-width: calc((100% - 5 * 6px) / 6);
  flex: 0 0 calc((100% - 5 * 6px) / 6);
}
.students-filters-actions .btn-sm {
  --bs-btn-padding-y: 0.12rem;
  --bs-btn-padding-x: 0.45rem;
  --bs-btn-font-size: 0.875rem;
  --bs-btn-border-radius: 0.3rem;
  line-height: 1.15;
}
.duplicates-group-card .tests-create-actions {
  justify-content: flex-end;
}
.admin-list-filters {
  padding: 10px;
  width: fit-content;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}
.admin-list-filters-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  justify-content: flex-start;
}
.admin-list-filters label {
  font-size: 0.8rem;
  margin-bottom: 4px;
  width: 210px;
  flex: 0 0 210px;
  min-width: 210px;
}
.admin-list-filters .form-control,
.admin-list-filters .form-select {
  min-height: 30px;
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
  max-width: 210px;
  min-width: 0;
}
.admin-list-filters textarea.notes-compact {
  min-height: 30px;
  height: 30px;
}
.admin-list-filters .multi-select-trigger {
  min-height: 30px;
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
  margin-top: 4px;
  font-size: 0.875rem;
  line-height: 1.15;
  border-radius: 8px;
}
.admin-list-panel {
  width: min(100%, calc(var(--filters-visible-count, var(--filters-count, 4)) * 210px + (var(--filters-visible-count, var(--filters-count, 4)) - 1) * 8px + 24px));
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}
.admin-list-panel .admin-list-filters,
.admin-list-panel .admin-list-card {
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}
.admin-list-panel .admin-list-filters form {
  width: 100%;
}
.admin-list-panel .students-list-card,
.admin-list-panel .courses-list-card,
.admin-list-panel .sites-list-card {
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}
.admin-list-card .table {
  width: 100%;
  table-layout: auto;
}
.admin-list-card .table th {
  white-space: nowrap;
}
.admin-list-card .table td {
  white-space: nowrap;
}
.courses-list-card,
.sites-list-card {
  min-height: auto;
  display: block;
}
.courses-list-card .table-scroll,
.sites-list-card .table-scroll {
  min-height: 0;
  max-height: none;
}
#course-list-card #list-tests-table th:nth-child(2),
#course-list-card #list-tests-table td:nth-child(2) {
  text-align: center;
}
.student-enrollment-panel {
  width: fit-content;
  max-width: 100%;
  margin: 12px auto 0;
}
.student-enrollment-card {
  width: fit-content;
  max-width: 100%;
}
.student-enrollment-card .table-scroll {
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
  padding-right: 8px;
  scrollbar-gutter: stable both-edges;
  overflow-y: auto;
  overflow-x: auto;
}
.student-enrollment-card .student-enrollment-table {
  width: max-content;
  min-width: 0;
  table-layout: auto;
  box-shadow: none;
}
.student-enrollment-card .student-enrollment-table th,
.student-enrollment-card .student-enrollment-table td {
  white-space: nowrap;
}
.student-enrollment-table th:nth-child(1),
.student-enrollment-table td:nth-child(1) {
  text-align: center;
}
.student-enrollment-table td:nth-child(1) input[type="checkbox"] {
  margin: 0 auto;
  display: block;
}
.student-enrollment-table td:nth-child(1),
.student-enrollment-table td:nth-child(2),
.student-enrollment-table td:nth-child(3) {
  vertical-align: middle;
}
.student-enrollment-table th:nth-child(4),
.student-enrollment-table td:nth-child(4) {
  text-align: left;
  min-width: 9.6rem;
  width: 9.6rem;
  padding-right: 10px;
}
.student-enrollment-table th:last-child,
.student-enrollment-table td:last-child {
  text-align: left !important;
}
.student-enrollment-table td:nth-child(4) input[type="date"] {
  width: 100%;
  min-width: 0;
  max-width: none;
  box-sizing: border-box;
}
.students-list-card {
  min-height: clamp(305px, calc(100vh - 435px), 665px);
  display: flex;
  flex-direction: column;
}
.students-list-card .table-scroll {
  min-height: clamp(240px, calc(100vh - 645px), 420px);
  max-height: calc(100vh - 175px);
}
.students-list-card.students-list-card-import {
  min-height: 0;
}
.students-list-card.students-list-card-import .table-scroll {
  min-height: 0;
}

@media (max-width: 1400px) {
  .students-list-card {
    min-height: clamp(285px, calc(100vh - 405px), 565px);
  }
}
@media (max-width: 900px) {
  .admin-list-filters-grid {
    flex-wrap: wrap;
  }
  .students-list-card {
    min-height: 285px;
  }
}
@media (max-width: 560px) {
  .students-filters,
  .admin-list-filters,
  .students-filters-grid,
  .admin-list-filters-grid,
  .admin-list-panel,
  .students-list-panel {
    width: 100%;
  }
  .tests-editor-card {
    width: 100%;
  }
  .students-filters label,
  .admin-list-filters label {
    width: 100%;
  }
  .students-list-card {
    min-height: 265px;
  }
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.table-scroll {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  overflow-x: auto;
}
.table-scroll.no-limit {
  max-height: none;
  overflow-y: visible;
}
.simulation-card { margin-top: 12px; padding: 14px; background: #f8fafc; }
.table th, .table td { padding: 7px 8px; border-bottom: 1px solid #e5e7eb; }
.table th { text-align: left; background: #f8fafc; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.02em; position: sticky; top: 0; z-index: 2; white-space: nowrap; }
.table.table-compact th,
.table.table-compact td { font-size: 0.75rem; padding: 5px 6px; }
.table td input,
.table td select,
.table td textarea { margin-top: 0; }
.table-input-compact {
  font-size: 0.8rem;
  padding: 6px 8px;
  min-height: 30px;
}
.order-text-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}
.order-text-inline .table-input-compact {
  flex: 1;
}
.table td.actions { display: table-cell; white-space: nowrap; vertical-align: middle; }
.table td.actions > a,
.table td.actions > form { display: inline-block; vertical-align: middle; }
.table td.actions > form { margin: 0 0 0 6px; }
.students-list-table th:last-child,
.students-list-table td.actions,
.admin-list-card .table th:last-child,
.admin-list-card .table td.actions {
  text-align: right;
}
.table td.actions > a.link {
  color: #0f6cbf;
}
.table th.numeric-col,
.table td.numeric-col {
  text-align: center;
}
.table th.status-col,
.table td.status-col {
  text-align: center;
}
.courses-list-card .table th:nth-child(6),
.courses-list-card .table td:nth-child(6),
.courses-list-card .table th:nth-child(7),
.courses-list-card .table td:nth-child(7),
.courses-list-card .table th:nth-child(8),
.courses-list-card .table td:nth-child(8) {
  text-align: center;
}
.actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.actions .ml-auto { margin-left: auto; }
.multi-select { position: relative; }
.multi-select-trigger { width: 100%; min-width: 0; text-align: left; padding: 10px 12px; margin-top: 6px; border: 1px solid #d1d5db; border-radius: 10px; cursor: pointer; font-size: 0.95rem; font-weight: 400; }
.multi-select-panel { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: rgba(246, 246, 246, 0.8); backdrop-filter: blur(5px); border: 1px solid #b5b5b5; border-radius: 10px; box-shadow: var(--shadow); padding: 8px; display: none; max-height: 220px; overflow-y: auto; z-index: 5; }
.multi-select.open .multi-select-panel { display: block; }
.multi-select[data-select="students_filter_course_ids"] .multi-select-panel {
  left: 0;
  right: auto;
  width: 150%;
  max-width: min(150%, 540px);
  max-height: 440px;
}
.multi-select[data-select="course_id"] .multi-select-panel {
  left: 0;
  right: auto;
  width: 150%;
  max-width: min(150%, 540px);
  max-height: 440px;
}
.multi-select-item { display: grid; grid-template-columns: 18px 1fr; font-weight: 400; font-size: 0.95rem; column-gap: 10px; align-items: center; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.multi-select-item input { margin: 0; }
.multi-select-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 400; }
.multi-select-item:hover {  }
.multi-select-hidden { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.actions.spaced { margin-top: 28px; }

.alert {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 10px;
  border-radius: 10px;
  margin-bottom: 12px;
}

.muted { color: var(--muted); }
.inline-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.inline-form label { flex: 1; min-width: 160px; }

.question-card { border: 1px solid #e2e8f0; border-radius: 14px; padding: 16px; margin-top: 16px; }
.question-head { display: flex; justify-content: space-between; align-items: center; }

.list { list-style: none; padding: 0; margin: 10px 0; }
.list li { padding: 8px 10px; border: 1px solid #e5e7eb; border-radius: 10px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.list li.correct { border-color: #34d399; background: #ecfdf3; }
.list li.selected { border-color: #93c5fd; }

.tag { background: #e2e8f0; color: #334155; padding: 2px 8px; border-radius: 999px; font-size: 0.75rem; }

.checkbox, .radio { display: flex; gap: 10px; align-items: center; font-weight: 500; }
.progress { color: var(--muted); margin-bottom: 8px; }

.student-main-card { padding: 18px; }
.student-question-card { padding: 18px; margin-top: 12px; margin-bottom: 12px; }
.student-question-text { font-size: 0.9375rem; line-height: 1.3; font-weight: 700; }
.student-answer-card { padding: 14px 18px; margin-top: 6px; cursor: pointer; width: 80%; margin-left: auto; margin-right: auto; margin-bottom: 4px; }
.student-answer-card.selected { background: #5588ff; border-color: #334488; color: #ffffff; }
.student-answer-text { width: 100%; font-size: 0.8rem; line-height: 1.25; }
.student-question-actions { margin-top: 12px; }

.review-item { border-bottom: 1px dashed #e2e8f0; padding-bottom: 12px; margin-bottom: 12px; }
.result-score { font-size: 2rem; text-align: center; }
.result-history-card { margin-top: 12px; }
.review-question { margin-top: 14px; }
.review-bad { background: #fee2e2; border-color: #fecaca; }
.list li .tag { white-space: nowrap; }
.student-test-actions { display: flex; align-items: center; gap: 12px; }
.student-test-actions .link { margin-left: auto; }
.student-test-card { text-align: center; }
.student-test-number { font-size: 1.5rem; margin-bottom: 12px; }
.student-test-actions { justify-content: center; }
.student-test-actions .link { margin-left: 24px; }
.list li .tag-right { margin-left: auto; }
.student-login-wrap {
  min-height: calc(100vh - 190px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.student-login-card {
  width: min(100%, 420px);
}
.student-login-image {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 12px;
}
.student-login-password {
  background: #fffdca;
  border: 1px solid #000;
}
.admin-login-user {
  background: #fff;
  border: 1px solid #000;
}

.question-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; }
.question-controls { display: flex; align-items: center; gap: 12px; }
.question-actions { display: flex; align-items: center; gap: 10px; }
.question-index { font-weight: 600; color: var(--muted); }
.question-nav #auto-save-status { text-align: center; flex: 1; }
.answers-grid { display: grid; gap: 12px; margin-top: 12px; }
.answer-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.answer-row .radio { align-self: center; padding-top: 12px; }
.answer-row .radio input[type="radio"] { transform: scale(1.2); }
.actions.split { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.actions.split form:first-child { justify-self: start; }
.actions.split form:last-child { justify-self: end; }
.inline-warning { color: #b45309; font-weight: 600; text-align: center; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #b91c1c; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.ok { background: #dcfce7; color: #166534; }
.badge.bad { background: #fee2e2; color: #991b1b; }
.is-hidden { display: none !important; }
.assign-mode-card { min-height: calc(100vh - 180px); display: flex; flex-direction: column; }
.table-scroll.full-height { flex: 1; min-height: 0; }
.assign-table-scroll { max-height: max(220px, calc(100vh - 700px)); }
.admin-list-card.assign-mode-card {
  min-height: auto;
  display: block;
}
#assign-tests-card .assign-table-scroll {
  overflow-x: hidden;
}
#assign-tests-table {
  width: 100%;
  table-layout: auto;
}
#assign-tests-table th {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
  vertical-align: middle;
}
#assign-tests-table td {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  vertical-align: middle;
}
#assign-tests-table th:nth-child(1),
#assign-tests-table td:nth-child(1) {
  width: 68px;
  text-align: center;
}
#assign-tests-table th:nth-child(7),
#assign-tests-table td:nth-child(7) {
  width: 9.6rem;
}
#assign-tests-table th:nth-child(8),
#assign-tests-table td:nth-child(8) {
  text-align: left;
}
#assign-tests-table .sort-link {
  white-space: nowrap;
}
#assign-tests-table td:nth-child(7) .table-input-compact,
#assign-tests-table td:nth-child(8) .table-input-compact {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.drag-cell { width: 28px; }
.drag-handle { cursor: grab; user-select: none; color: #64748b; font-weight: 700; }
.drag-handle:active { cursor: grabbing; }
.test-row.dragging { opacity: 0.5; }
.test-row.test-row-draft td { background: #ffdddd; }

@media (max-width: 720px) {
  .topbar { flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; }
  .nav { margin-left: auto; white-space: nowrap; }
  .nav a { display: inline-block; margin-left: 6px; margin-right: 0; }
  .header-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .inline-form { flex-direction: column; }
  .app-container { padding: 0 8px; margin-top: 8px; }
  .table th, .table td { padding: 6px 6px; }
}
