:root {
  --bg: #0b1220;
  --panel: #131c2e;
  --panel-2: #1a2740;
  --line: #2b3b5b;
  --text: #e5edf8;
  --muted: #9db0cc;
  --accent: #7cb3ff;
  --accent-2: #4f8cff;
  --ok: #22c55e;
  --err: #ef4444;
  --radius: 16px;
  --shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Montserrat", Arial, sans-serif;
  line-height: 1.45;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(79, 140, 255, 0.12), transparent 28%),
    radial-gradient(circle at top left, rgba(124, 179, 255, 0.08), transparent 18%),
    var(--bg);
}

body.ui-compact {
  font-size: 15px;
  line-height: 1.38;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  backdrop-filter: blur(12px);
  background: rgba(11, 18, 32, 0.86);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.brand-link {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.4px;
  color: #fff;
  text-decoration: none;
}

.brand-link:hover {
  color: #dbe8fb;
}

.brand-version {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

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

.menu a {
  color: #c8d8f1;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.menu a:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.15);
}

.menu a.active {
  color: #08111f;
  border-color: transparent;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.lang-switch-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  min-width: 170px;
  max-width: 230px;
  width: auto;
  padding: 8px 36px 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    var(--panel-2);
  color: #e7f0ff;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  letter-spacing: 0.01em;
  background-image:
    linear-gradient(45deg, transparent 50%, #d9e5f8 50%),
    linear-gradient(135deg, #d9e5f8 50%, transparent 50%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 13px) 50%,
    0 0;
  background-size:
    5px 5px,
    5px 5px,
    100% 100%;
  background-repeat: no-repeat;
}

.lang-switch-select:hover {
  border-color: rgba(255, 255, 255, 0.38);
}

.lang-switch-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 179, 255, 0.22);
}

.menu a,
.subnav a,
button,
.button {
  transition: transform 0.12s ease, filter 0.12s ease, background-color 0.12s ease;
}

.menu a:hover,
.subnav a:hover,
button:hover,
.button:hover {
  filter: brightness(1.06);
}

button:active,
.button:active,
.menu a:active,
.subnav a:active {
  transform: translateY(1px);
}

.subnav {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.subnav a {
  text-decoration: none;
  color: #c8d8f1;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.86rem;
  font-weight: 700;
}

.subnav a.active {
  color: #08111f;
  border-color: transparent;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

.container {
  width: min(1200px, 93vw);
  margin: 24px auto 48px;
}

.container-narrow {
  width: min(420px, 92vw);
  margin-top: 84px;
}

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01)), var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

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

h1 {
  font-size: clamp(1.2rem, 2.8vw, 1.65rem);
  line-height: 1.2;
  margin-bottom: 10px;
}

.search-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.search-card-head h1 {
  margin-bottom: 0;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

h2 {
  font-size: 1.1rem;
  line-height: 1.25;
  margin-bottom: 8px;
}

.muted {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

label {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: #d6e4fa;
}

input[type="text"],
input[type="password"],
input[type="file"],
input[type="number"],
input[type="time"],
textarea,
select {
  width: 100%;
  background: var(--panel-2);
  color: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 0.95rem;
  line-height: 1.35;
  font-family: inherit;
}

input::placeholder,
textarea::placeholder {
  color: #9caecc;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

button,
.button {
  border: 0;
  border-radius: 11px;
  padding: 10px 14px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  font-family: inherit;
}

button:disabled,
.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button.primary,
.button.primary {
  color: #08111f;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 18px rgba(79, 140, 255, 0.25);
}

button.secondary,
.button.secondary {
  color: #fff;
  background: linear-gradient(180deg, #556882, #42536d);
}

button.danger,
.button.danger {
  color: #fff;
  background: linear-gradient(180deg, #d63a3a, #b61f1f);
}

button.small,
.button.small {
  font-size: 0.8rem;
  padding: 7px 10px;
  border-radius: 10px;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}

.inline.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.inline.filters input[type="text"] {
  max-width: 350px;
}

.inline.filters select {
  width: auto;
  min-width: 160px;
}

.settings-check {
  display: flex;
  align-items: flex-end;
  min-height: 58px;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.row input[type="text"] {
  flex: 1;
}

.row-checkboxes {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.row-checkboxes label {
  margin-bottom: 0;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0;
  margin-right: 10px;
}

.search-input-wrap {
  display: flex;
  position: relative;
  gap: 10px;
}

.search-input-wrap input[type="text"] {
  padding-right: 44px;
}

.search-clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
}

.search-clear-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.answer-ok {
  color: var(--ok);
  font-weight: 700;
}

.answer-bad {
  color: #ff8f8f;
  font-weight: 700;
}

.result-card .result-question div {
  margin-top: 6px;
}

.result-answer-wrap {
  margin-top: 10px;
}

.result-meta {
  margin-top: 10px;
}

.result-answer-wrap .label {
  color: #d5e2f8;
  font-weight: 700;
  margin-right: 6px;
}

.candidate-answer {
  margin: 4px 6px 4px 0;
}

.candidate-answer.confirm-armed {
  background: linear-gradient(180deg, #f0b35f, #d58d2d);
  color: #1b1f2b;
}

.confirm-submit.confirm-armed {
  background: linear-gradient(180deg, #f0b35f, #d58d2d);
  color: #1b1f2b;
}

.training-mark-answer.confirm-armed {
  background: linear-gradient(180deg, #f0b35f, #d58d2d);
  color: #1b1f2b;
}

.confidence-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

.confidence-badge.confidence-high {
  color: #0d2416;
  background: linear-gradient(180deg, #5de593, #2fbe6a);
}

.confidence-badge.confidence-mid {
  color: #2b200d;
  background: linear-gradient(180deg, #ffd68f, #eeb159);
}

.confidence-badge.confidence-low {
  color: #2d1212;
  background: linear-gradient(180deg, #ffaca8, #f06b66);
}

.similar-hints {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.similar-item {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  padding: 10px;
}

.similar-item-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.training-content {
  min-height: 120px;
}

.training-card {
  display: grid;
  gap: 12px;
}

.training-answer-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 7px;
}

.training-answer {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 9px 11px;
  background: rgba(255, 255, 255, 0.02);
}

.training-answer.training-answer-correct {
  border-color: rgba(34, 197, 94, 0.45);
  color: #c7f7d8;
}

.training-answer.training-answer-wrong {
  border-color: rgba(239, 68, 68, 0.45);
  color: #ffd2d2;
}

.quiz-options {
  display: grid;
  gap: 8px;
}

.quiz-setup-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.quiz-setup-row label {
  margin-bottom: 0;
}

.quiz-step-chip {
  color: #d6e8ff;
  border-color: rgba(124, 179, 255, 0.45);
  background: rgba(124, 179, 255, 0.16);
}

.quiz-option {
  text-align: left;
}

.quiz-option.quiz-correct {
  color: #0d2416;
  background: linear-gradient(180deg, #5de593, #2fbe6a);
}

.quiz-option.quiz-wrong {
  color: #2d1212;
  background: linear-gradient(180deg, #ffaca8, #f06b66);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-chip {
  display: inline-block;
  border: 1px solid rgba(124, 179, 255, 0.4);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  color: #cfe1ff;
  background: rgba(124, 179, 255, 0.12);
}

.review-flag {
  display: inline-block;
  margin-top: 8px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.76rem;
  font-weight: 700;
  color: #1b1f2b;
  background: linear-gradient(180deg, #ffd38a, #f4b85d);
}

mark.hl {
  border-radius: 5px;
  padding: 0 4px;
  background: #ffe089;
  color: #202020;
  font-weight: 700;
}

.flash {
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-weight: 600;
}

.flash.success {
  color: #bcf2cd;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.flash.error {
  color: #ffc8c8;
  background: rgba(239, 68, 68, 0.13);
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.metric {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 13px;
  background: rgba(255, 255, 255, 0.02);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
}

.metric strong {
  font-size: 1.3rem;
  line-height: 1.2;
  color: #fff;
}

.metrics.compact .metric strong {
  font-size: 1rem;
  line-height: 1.25;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.table-wrap {
  overflow-x: auto;
}

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

.table th,
.table td {
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 11px 9px;
  vertical-align: top;
  font-size: 0.9rem;
  line-height: 1.45;
}

.table th {
  color: #fff;
}

.table td.actions {
  white-space: nowrap;
}

.table td.actions form,
.table td.actions .button {
  margin-right: 6px;
}

.admin-list-toolbar {
  justify-content: space-between;
  gap: 12px;
}

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

.pager-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
}

.pager-jump label {
  margin-bottom: 0;
  font-size: 0.8rem;
  font-weight: 700;
}

.pager-jump input[type="number"] {
  width: 86px;
  min-width: 0;
  padding: 7px 8px;
  border-radius: 10px;
}

.pager .pager-current {
  cursor: default;
}

.pager .pager-gap {
  color: var(--muted);
  font-weight: 700;
  padding: 0 2px;
}

.admin-list-wrap {
  overflow-x: visible;
}

.list-table {
  table-layout: fixed;
}

.list-table td {
  word-break: break-word;
  overflow-wrap: anywhere;
}

.list-table td.actions {
  white-space: normal;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-start;
}

.list-table td.actions form,
.list-table td.actions .button {
  margin-right: 0;
}

.list-table td.actions button,
.list-table td.actions .button {
  white-space: nowrap;
}

.divider {
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  margin: 16px 0;
}

body.ui-compact .nav {
  padding: 11px 18px;
}

body.ui-compact .menu a {
  font-size: 0.84rem;
  padding: 6px 10px;
}

body.ui-compact .subnav a {
  font-size: 0.8rem;
  padding: 6px 10px;
}

body.ui-compact .container {
  margin: 16px auto 30px;
}

body.ui-compact .card {
  padding: 14px;
  margin-bottom: 12px;
}

body.ui-compact h1 {
  font-size: clamp(1.05rem, 2.3vw, 1.4rem);
  margin-bottom: 8px;
}

body.ui-compact h2 {
  font-size: 1rem;
  margin-bottom: 6px;
}

body.ui-compact .muted {
  font-size: 0.84rem;
  line-height: 1.4;
}

body.ui-compact input[type="text"],
body.ui-compact input[type="password"],
body.ui-compact input[type="file"],
body.ui-compact input[type="number"],
body.ui-compact input[type="time"],
body.ui-compact textarea,
body.ui-compact select {
  padding: 8px 10px;
  font-size: 0.87rem;
}

body.ui-compact button,
body.ui-compact .button {
  padding: 8px 11px;
  font-size: 0.84rem;
}

body.ui-compact .metrics {
  gap: 8px;
}

body.ui-compact .metric {
  padding: 10px;
}

body.ui-compact .metric span {
  font-size: 0.76rem;
}

body.ui-compact .metric strong {
  font-size: 1.05rem;
}

body.ui-compact .table th,
body.ui-compact .table td {
  font-size: 0.82rem;
  padding: 8px 7px;
}

@media (max-width: 820px) {
  .container {
    width: min(96vw, 1200px);
  }

  .nav {
    padding: 12px;
    align-items: flex-start;
    flex-direction: column;
  }

  .lang-switch {
    width: 100%;
    justify-content: flex-start;
  }

  .lang-switch-select {
    width: min(100%, 300px);
    max-width: 100%;
  }

  .inline.filters input[type="text"] {
    max-width: none;
  }

  .inline.filters select {
    width: 100%;
  }

  .quiz-setup-row select {
    max-width: none !important;
  }

  .search-input-wrap input[type="text"] {
    padding-right: 50px;
  }

  .search-clear-btn {
    width: 34px;
    height: 34px;
    font-size: 1.2rem;
    right: 7px;
  }
}

@media (max-width: 1100px) {
  .admin-list-wrap {
    overflow-x: auto;
  }
}
