:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --brand: #235cf6;
  --brand-2: #072b67;
  --brand-3: #19c878;
  --border: #e2e8f0;
  --danger: #dc2626;
  --shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}
.hidden {
  display: none !important;
}
body {
  margin: 0;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  background: radial-gradient(circle at top right, #ecfdf5 0, var(--bg) 32%);
  color: var(--ink);
}

.auth-layout {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 22px;
}
.auth-card h1 {
  margin: 0 0 6px;
  font-size: 28px;
}
.auth-logo {
  display: block;
  width: min(210px, 80%);
  height: auto;
  margin: 0 auto 12px;
}
.auth-card p {
  margin: 0 0 16px;
  color: var(--muted);
}
.auth-form {
  display: grid;
  gap: 12px;
}
label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}
input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--ink);
  background: #fff;
}
input:focus,
textarea:focus,
select:focus {
  outline: 0;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.2);
}

button,
.btn-secondary {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.15s ease;
}
button {
  background: linear-gradient(135deg, var(--brand), #235cf6);
  color: #fff;
  box-shadow: 0 8px 20px rgba(35, 92, 246, 0.22);
}
button:hover {
  transform: translateY(-1px);
}
.btn-secondary {
  background: #fff;
  color: #0f172a;
  border: 1px solid var(--border);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: none;
}

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

.topbar {
  border-bottom: 1px solid var(--border);
  background: #fff;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: #001c45;
  text-decoration: none;
  overflow: hidden;
  flex: 0 0 auto;
}
.brand-mark img {
  width: 42px;
  height: 42px;
  display: block;
}
.brand-logo {
  display: block;
  width: 128px;
  max-width: 34vw;
  height: auto;
}
.topbar h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}
.topbar p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  background: #dcfce7;
  color: #166534;
}
.pill.muted {
  background: #f1f5f9;
  color: #334155;
}
.muted {
  color: var(--muted);
}

.app-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: calc(100vh - 74px);
}
.sidebar {
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  padding: 12px;
  display: grid;
  gap: 12px;
  align-content: start;
  align-self: start;
  position: sticky;
  top: 0;
  height: calc(100vh - 74px);
  overflow: auto;
}
.sidebar-head {
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: linear-gradient(135deg, #eff6ff, #f8fafc);
  padding: 10px 12px;
}
.sidebar-title {
  display: block;
  font-size: 12px;
  font-weight: 800;
  color: #0f172a;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.sidebar-subtitle {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #475569;
}
.nav-group {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 8px;
  display: grid;
  gap: 6px;
}
.nav-group-title {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 4px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  border-radius: 10px;
  padding: 8px 10px;
  text-align: left;
  color: #1e293b;
  border: 1px solid transparent;
  background: transparent;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: 0.15s ease;
}

.nav-badges {
  display: inline-flex;
  gap: 4px;
  flex: 0 0 auto;
}

.nav-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.nav-badge--danger {
  background: #dc2626;
}
.nav-badge--warning {
  background: #f97316;
}
.nav-item:hover {
  border-color: #bfdbfe;
  background: #f0f9ff;
  color: #0c4a6e;
}
.nav-item.active {
  color: #0b3b7a;
  border-color: #93c5fd;
  background: linear-gradient(135deg, #dbeafe, #eff6ff);
  box-shadow: inset 3px 0 0 #2563eb;
}

.content {
  padding: 16px;
}
.content--custom {
  min-width: 0;
}
.custom-root {
  min-width: 0;
}
.content--custom .custom-content-wrap {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.kpi-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  box-shadow: var(--shadow);
}
.kpi-card span {
  display: block;
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.kpi-card strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  color: #0f172a;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.toolbar h2 {
  margin: 0;
  font-size: 26px;
}
.toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.toolbar-actions input {
  width: 260px;
  max-width: 100%;
}

.table-wrap {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: auto;
  box-shadow: var(--shadow);
}
table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  border-bottom: 1px solid var(--border);
  padding: 11px 10px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}
th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #f8fafc;
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
tbody tr:nth-child(even) {
  background: #fcfdff;
}
td .row-actions {
  display: flex;
  gap: 6px;
}
td .row-actions button {
  padding: 7px 10px;
  font-size: 12px;
  border-radius: 10px;
}

.pagination {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}
#pageStatus {
  font-size: 13px;
  color: #475569;
  background: #fff;
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 10px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.55);
  display: grid;
  place-items: center;
  padding: 12px;
  z-index: 3000;
}
.modal-backdrop.hidden {
  display: none;
}
.modal {
  width: min(760px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 16px;
  box-shadow: var(--shadow);
}
.modal h3 {
  margin: 0 0 12px;
  font-size: 22px;
}
#modalForm {
  display: grid;
  gap: 10px;
}
.modal-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  max-width: 420px;
  border-radius: 12px;
  background: #0f172a;
  color: #fff;
  font-size: 13px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  z-index: 999;
}
.toast.hidden {
  display: none;
}
.toast.error {
  background: #b91c1c;
}

.form-panel {
  border: 1px solid var(--border);
  background: #ffffff;
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.form-panel h3 {
  margin: 0 0 6px;
}
.stack-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  max-width: 760px;
}
.result-box {
  margin-top: 18px;
  padding: 14px;
  border-radius: 12px;
  background: #0f172a;
  color: #e2e8f0;
  overflow-x: auto;
}
.error-text {
  color: #b91c1c;
  font-weight: 700;
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  padding: 12px;
}

.health-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.health-banner-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.health-banner strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.health-banner-meta {
  font-size: 12px;
  color: #334155;
}

.health-status-ok {
  background: #ecfdf5;
  border-left: 4px solid #22c55e;
}

.health-status-warn {
  background: #fffbeb;
  border-left: 4px solid #f59e0b;
}

.health-status-crit {
  background: #fef2f2;
  border-left: 4px solid #ef4444;
}

.health-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.health-card span {
  display: block;
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.health-card strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
  color: #0f172a;
}

.health-block {
  border-top: 1px solid var(--border);
  padding: 12px;
}

.health-block h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.health-table {
  width: 100%;
  border-collapse: collapse;
}

.health-table th,
.health-table td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 8px;
  font-size: 13px;
}

.health-footnote {
  margin: 10px 0 0;
  color: #64748b;
  font-size: 12px;
}

.health-issues {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.health-issues li {
  font-size: 13px;
}

.health-issue-ok {
  color: #166534;
}

.health-issue-warn {
  color: #92400e;
}

.health-issue-crit {
  color: #b91c1c;
}

.flashcards-browser {
  padding: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.flashcards-filters {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(320px, 1fr);
  gap: 12px;
}

.flashcards-browser__summary {
  margin-top: 14px;
}

.flashcards-summary-card,
.flashcards-empty-state,
.flashcards-empty-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.flashcards-summary-card strong,
.flashcards-empty-card strong {
  display: block;
  font-size: 15px;
  color: #0f172a;
}

.flashcards-summary-card span,
.flashcards-empty-state,
.flashcards-empty-card span {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: #475569;
}

.flashcards-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.flashcards-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  padding: 12px;
  box-shadow: var(--shadow);
}

.flashcards-card__delete {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  padding: 0;
  background: rgba(15, 23, 42, 0.84);
  color: #fff;
  box-shadow: none;
  z-index: 2;
}

.flashcards-card__delete:hover {
  transform: none;
  background: #b91c1c;
}

.flashcards-card__frame {
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #f8fafc, #eef2ff);
  display: grid;
  place-items: center;
}

.flashcards-card__frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #fff;
}

.flashcards-card__placeholder {
  font-size: 13px;
  color: #64748b;
  padding: 24px;
  text-align: center;
}

.flashcards-card__meta {
  display: grid;
  margin-top: 10px;
}

.flashcards-card__meta strong {
  font-size: 13px;
  color: #0f172a;
}

.pill-danger {
  background: #fee2e2;
  color: #991b1b;
}

.crm-users-browser,
.account-browser {
  padding: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.crm-users-browser__hero,
.account-browser__hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 18px;
  border: 1px solid #dbeafe;
  border-radius: 18px;
  background: linear-gradient(135deg, #eff6ff, #f8fafc 58%, #ecfdf5 100%);
}

.crm-users-browser__eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #2563eb;
}

.crm-users-browser__hero h3,
.account-browser__hero h3 {
  margin: 0;
  font-size: 24px;
}

.crm-users-browser__hero p,
.account-browser__hero p {
  margin: 8px 0 0;
  max-width: 720px;
  color: #475569;
  line-height: 1.5;
}

.crm-users-browser__search {
  min-width: 280px;
}

.crm-users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.crm-user-card,
.account-card,
.account-form,
.account-notice,
.crm-user-empty {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  padding: 16px;
  box-shadow: var(--shadow);
}

.crm-user-card__head,
.crm-user-card__actions,
.crm-user-card__meta,
.crm-user-card__badges,
.account-grid {
  display: flex;
  gap: 10px;
}

.crm-user-card__head,
.crm-user-card__meta {
  justify-content: space-between;
  align-items: flex-start;
}

.crm-user-card__head strong {
  display: block;
  font-size: 16px;
}

.crm-user-card__head span,
.crm-user-card__meta span,
.account-card__meta {
  color: #475569;
  font-size: 13px;
}

.crm-user-card__meta {
  margin-top: 10px;
  flex-wrap: wrap;
}

.crm-user-card__views {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.crm-view-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  background: #eef2ff;
  color: #4338ca;
}

.crm-view-chip.muted {
  background: #f1f5f9;
  color: #64748b;
}

.crm-user-card__actions {
  margin-top: 14px;
  flex-wrap: wrap;
}

.crm-permissions-group + .crm-permissions-group {
  margin-top: 14px;
}

.crm-permissions-group strong {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
}

.crm-permissions-checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.crm-permissions-check {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
}

.crm-permissions-check input {
  width: auto;
  margin: 0;
}

.account-grid {
  margin-top: 16px;
  flex-wrap: wrap;
}

.account-card {
  flex: 1 1 280px;
}

.account-card__label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}

.account-card strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}

.account-notice {
  margin-top: 14px;
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.account-form {
  margin-top: 14px;
  display: grid;
  gap: 12px;
  max-width: 520px;
}

.account-form__actions {
  display: flex;
  justify-content: flex-start;
}

.crm-entitlements-editor {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #f8fafc;
}

.crm-entitlements-editor__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.crm-entitlements-editor__head strong {
  font-size: 14px;
  color: #0f172a;
}

.crm-entitlements-editor p {
  margin: 0;
  font-size: 12px;
  color: #475569;
}

.tests-browser {
  padding: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.tests-browser__filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}

.tests-browser__filters--wide {
  grid-column: span 2;
}

.tests-browser__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.tests-browser__table {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.tests-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.tests-table th,
.tests-table td {
  border-bottom: 1px solid var(--border);
  padding: 12px 10px;
  vertical-align: top;
}

.tests-table th:nth-child(1),
.tests-table td:nth-child(1) {
  width: 92px;
}

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

.tests-table__id {
  font-weight: 800;
  color: #0f172a;
}

.tests-table__prompt-text {
  font-size: 14px;
  line-height: 1.45;
  color: #0f172a;
  white-space: normal;
  word-break: break-word;
}

.tests-table__prompt-meta {
  margin-top: 6px;
  font-size: 12px;
  color: #64748b;
}

.tests-table__actions {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  align-items: center;
}

.tests-table__actions button {
  padding: 6px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.tests-table__empty {
  padding: 18px 8px;
  color: #64748b;
}

.tests-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px;
}

.tests-bulk-helper {
  margin: 0 0 8px;
  color: #475569;
  font-size: 13px;
}

.tests-bulk-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tests-bulk-review {
  max-height: 52vh;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.tests-bulk-review table {
  width: 100%;
  border-collapse: collapse;
}

.tests-bulk-review th,
.tests-bulk-review td {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.tests-warning-list {
  margin: 12px 0 0;
  padding-left: 18px;
  max-height: 320px;
  overflow: auto;
  color: #92400e;
  font-size: 13px;
}

.tests-warning-note,
.tests-ok-note {
  margin: 10px 0 0;
  font-size: 13px;
}

.tests-warning-note {
  color: #92400e;
}
.tests-ok-note {
  color: #047857;
}

.tests-excel-confirm {
  display: grid;
  gap: 8px;
}

.tests-review {
  padding: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.tests-review__toolbar {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tests-review__toolbar label {
  min-width: min(420px, 100%);
}

.tests-review__blocks,
.review-question-list {
  display: grid;
  gap: 10px;
}

.test-block-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
}

.test-block-row strong,
.test-block-row span {
  display: block;
}

.test-block-row strong {
  color: #0f172a;
}

.test-block-row span {
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
}

.test-block-row__status {
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
}

.test-block-row--pending .test-block-row__status {
  background: #f1f5f9;
  color: #334155;
}

.test-block-row--reviewed {
  border-color: #86efac;
  background: #f0fdf4;
}

.test-block-row--reviewed .test-block-row__status {
  background: #dcfce7;
  color: #166534;
}

.test-block-row--failed {
  border-color: #fdba74;
  background: #fff7ed;
}

.test-block-row--failed .test-block-row__status {
  background: #ffedd5;
  color: #9a3412;
}

.tests-review--detail {
  display: grid;
  gap: 14px;
}

.review-detail-head {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
}

.review-counter {
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px;
  border-radius: 10px;
  background: #eff6ff;
}

.review-counter strong {
  font-size: 20px;
  color: #1d4ed8;
}

.review-counter span {
  color: #475569;
  font-size: 12px;
}

.review-checks {
  display: grid;
  gap: 8px;
}

.review-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #334155;
}

.review-check input {
  width: 16px;
  height: 16px;
}

.review-check--failed {
  color: #9a3412;
}

.review-failure {
  display: grid;
  gap: 6px;
}

.review-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  width: fit-content;
}

.review-tabs button {
  background: transparent;
  color: #334155;
  box-shadow: none;
}

.review-tabs button.active {
  background: #2563eb;
  color: #fff;
}

.review-question-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    opacity 0.35s ease,
    transform 0.35s ease;
}

.review-question-card.is-dirty {
  border-color: #f59e0b;
  background: #fffbeb;
}

.review-question-card.is-saved {
  border-color: #86efac;
  background: #f0fdf4;
}

.review-question-card.is-reviewed {
  opacity: 0;
  transform: translateY(-8px);
  border-color: #86efac;
  background: #f0fdf4;
}

.review-question-card__meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #64748b;
  font-size: 12px;
}

.review-question-card__meta strong {
  color: #0f172a;
}

.review-question-card__actions,
.review-pager {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.review-block-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.review-pager {
  justify-content: center;
}

.syllabus-browser {
  padding: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.syllabus-browser__topbar {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 14px;
}

.syllabus-browser__search {
  width: min(360px, 100%);
}

.syllabus-browser__roots {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.syllabus-roots-table {
  width: 100%;
  border-collapse: collapse;
}

.syllabus-roots-table th,
.syllabus-roots-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.syllabus-roots-table th:nth-child(1),
.syllabus-roots-table td:nth-child(1) {
  width: 96px;
}

.syllabus-roots-table th:nth-child(3),
.syllabus-roots-table td:nth-child(3) {
  width: 220px;
}

.syllabus-roots-table tr.is-selected {
  background: #eff6ff;
}

.syllabus-roots-table__number {
  font-weight: 800;
  color: #0f172a;
}

.syllabus-roots-table__title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.syllabus-roots-table__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.syllabus-roots-table__actions.is-compact,
.syllabus-node-card__actions.is-compact,
.topic-image-card__actions.is-compact {
  flex-wrap: nowrap;
}

.syllabus-roots-table__actions.is-compact button,
.syllabus-node-card__actions.is-compact button,
.topic-image-card__actions.is-compact button {
  padding: 8px 10px;
  font-size: 12px;
}

.syllabus-empty {
  padding: 18px 10px;
  color: #64748b;
}

.syllabus-editor {
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.syllabus-editor__header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #eff6ff, #f8fafc 60%, #ecfdf5 100%);
}

.syllabus-editor__crumbs {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.syllabus-editor__crumbs a {
  color: #0b3b7a;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.syllabus-editor__eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #2563eb;
}

.syllabus-editor__header > div:first-child {
  flex: 1 1 auto;
}

.syllabus-editor__header-actions {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.syllabus-editor__body {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.syllabus-node-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  padding: 14px;
}

.syllabus-node-card.depth-1 {
  border-color: #bfdbfe;
  background: #f8fbff;
}

.syllabus-node-card.depth-2 {
  margin-left: 22px;
  background: #fcfdff;
}

.syllabus-node-card.depth-3 {
  margin-left: 44px;
}

.syllabus-node-card__head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.syllabus-node-card__head strong {
  font-size: 14px;
  color: #0f172a;
}

.syllabus-node-card__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.syllabus-node-card__children {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.topic-images-accordion {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
}

.topic-images-accordion__toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 0;
  box-shadow: none;
  background: linear-gradient(135deg, #eff6ff, #f8fafc);
  color: #0f172a;
}

.topic-images-accordion__panel {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.topic-images-uploader {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.topic-images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.topic-image-card {
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  padding: 12px;
  box-shadow: var(--shadow);
}

.topic-image-card__preview {
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #f8fafc, #eef2ff);
  display: grid;
  place-items: center;
}

.topic-image-card__preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #fff;
}

.topic-image-card__body {
  display: grid;
  gap: 10px;
}

.topic-image-card__token {
  font-size: 12px;
  font-weight: 700;
  color: #4338ca;
  background: #eef2ff;
  border-radius: 10px;
  padding: 8px 10px;
}

@media (max-width: 980px) {
  .app-layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    grid-template-columns: 1fr;
    position: static;
    height: auto;
    overflow: visible;
  }
  .nav-group {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    align-items: start;
  }
  .nav-group-title {
    grid-column: 1 / -1;
  }
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }
  .flashcards-filters {
    grid-template-columns: 1fr;
  }
  .crm-users-browser__hero,
  .account-browser__hero {
    flex-direction: column;
  }
  .crm-users-browser__search {
    min-width: 0;
    width: 100%;
  }
  .tests-browser__filters {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
  .tests-browser__filters--wide {
    grid-column: span 2;
  }
  .syllabus-editor__header {
    flex-direction: column;
  }
  .topic-images-uploader {
    grid-template-columns: 1fr;
  }
  .syllabus-roots-table th:nth-child(3),
  .syllabus-roots-table td:nth-child(3) {
    width: auto;
  }
}

@media (max-width: 640px) {
  .topbar {
    flex-wrap: wrap;
  }
  .topbar-right {
    width: 100%;
  }
  .nav-group {
    grid-template-columns: 1fr;
  }
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .toolbar-actions {
    width: 100%;
  }
  .toolbar-actions input {
    width: 100%;
  }
  .tests-browser__filters,
  .tests-form-grid {
    grid-template-columns: 1fr;
  }
  .tests-browser__filters--wide {
    grid-column: span 1;
  }
  .syllabus-node-card.depth-2,
  .syllabus-node-card.depth-3 {
    margin-left: 0;
  }
  .syllabus-roots-table__actions.is-compact,
  .syllabus-node-card__actions.is-compact,
  .topic-image-card__actions.is-compact {
    flex-wrap: wrap;
  }
  .topic-image-card {
    grid-template-columns: 1fr;
  }
  .tests-table th:nth-child(1),
  .tests-table td:nth-child(1),
  .tests-table th:nth-child(3),
  .tests-table td:nth-child(3) {
    width: auto;
  }
}
