:root {
  color-scheme: dark;
  --bg: #0b0f14;
  --panel: #121821;
  --panel-2: #17202b;
  --line: #263241;
  --text: #eef4f8;
  --muted: #92a1af;
  --accent: #31c6a4;
  --accent-2: #e0b15e;
  --danger: #ef6461;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select {
  font: inherit;
}
.app-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: #0d1219;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 28px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06100d;
  font-weight: 900;
}
.brand small, .list-row small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.nav {
  display: grid;
  gap: 6px;
}
.nav a, .logout button, .ghost-button {
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  padding: 10px 12px;
  background: transparent;
}
.nav a:hover, .logout button:hover, .ghost-button:hover {
  color: var(--text);
  border-color: var(--line);
  background: var(--panel);
}
.logout {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 22px;
}
.logout button { width: 100%; text-align: left; cursor: pointer; }
.content {
  padding: 28px;
  min-width: 0;
}
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 24px;
}
h1, h2, p { margin-top: 0; }
h1 { font-size: 28px; margin-bottom: 0; }
h2 { font-size: 18px; margin-bottom: 16px; }
.eyebrow {
  color: var(--accent);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.metric, .panel, .wizard-step, .login-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .18);
}
.metric {
  padding: 18px;
}
.metric span { color: var(--muted); }
.metric strong {
  display: block;
  font-size: 30px;
  margin-top: 6px;
}
.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}
.panel, .wizard-step {
  padding: 18px;
  margin-bottom: 18px;
}
.toolbar, .actions, .form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}
.primary-button, .danger-button {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
}
.primary-button {
  background: var(--accent);
  color: #06100d;
}
.danger-button {
  background: rgba(239, 100, 97, .14);
  color: #ffaaa8;
  border: 1px solid rgba(239, 100, 97, .34);
}
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}
th { color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); }
.status {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(49, 198, 164, .12);
  color: #8ae8d4;
}
.form-grid, .answers-grid, .details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
label, .stack {
  display: grid;
  gap: 7px;
}
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: #0d131b;
  color: var(--text);
}
textarea { min-height: 110px; resize: vertical; }
.json-area { min-height: 360px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
legend { color: var(--accent-2); padding: 0 6px; }
.step-badge {
  display: inline-flex;
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}
.preview-image {
  max-width: 280px;
  border-radius: 8px;
  border: 1px solid var(--line);
  margin-top: 10px;
}
.preview-image.wide { max-width: 100%; }
.telegram-preview {
  display: grid;
  gap: 10px;
  max-width: 520px;
  padding: 14px;
  border: 1px solid #2a3a4c;
  border-radius: 8px;
  background: #0e1620;
}
.telegram-image {
  display: grid;
  place-items: center;
  min-height: 150px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}
.telegram-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.telegram-buttons span {
  padding: 9px;
  border-radius: 8px;
  text-align: center;
  background: #1f6f91;
}
.list { display: grid; gap: 8px; }
.list-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}
.answer-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel-2);
}
.test-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 18px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.alert {
  padding: 12px;
  margin-bottom: 16px;
  border-radius: 8px;
  border: 1px solid rgba(239, 100, 97, .35);
  background: rgba(239, 100, 97, .12);
}
.alert.success {
  border-color: rgba(49, 198, 164, .35);
  background: rgba(49, 198, 164, .12);
}
.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  padding: 24px;
  display: grid;
  gap: 16px;
}
.login-brand { margin-bottom: 4px; }
.checkbox {
  display: flex;
  align-items: center;
}
.checkbox input { width: auto; }

@media (max-width: 920px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .logout { position: static; margin-top: 18px; }
  .metric-grid, .two-column, .form-grid, .answers-grid { grid-template-columns: 1fr; }
  .topbar, .test-header { align-items: flex-start; flex-direction: column; }
}


.quick-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr);
  gap: 18px;
  align-items: start;
}
.hint {
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid rgba(224, 177, 94, .35);
  border-radius: 8px;
  background: rgba(224, 177, 94, .10);
  color: #f0d59d;
}
@media (max-width: 920px) {
  .quick-grid { grid-template-columns: 1fr; }
}

.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
code { color: var(--muted); white-space: pre-wrap; }
@media (max-width: 920px) { .check-grid { grid-template-columns: 1fr; } }
