/* ═══════════════════════════════════════════════════════════
   PedagogAI v2 — Dark Theme
   Версия: 1.0 (2026-06-16)
   ═══════════════════════════════════════════════════════════ */

:root {
    /* Палитра */
    --bg:         #0f172a;
    --surface:    #1e293b;
    --surface-2:  #273345;
    --surface-3:  #334155;
    --border:     #334155;
    --border-soft:#1f2a3a;
    --text:       #f1f5f9;
    --text-mut:   #94a3b8;
    --text-dim:   #64748b;
    --accent:     #3b82f6;
    --accent-h:   #2563eb;
    --accent-2:   #1e40af;
    --success:    #10b981;
    --success-bg: #064e3b;
    --warning:    #f59e0b;
    --danger:     #ef4444;
    --danger-bg:  #7f1d1d;

    /* Геометрия */
    --radius:     10px;
    --radius-sm:  6px;
    --gap:        1rem;

    /* Тени */
    --shadow:     0 1px 3px rgba(0,0,0,.4), 0 4px 12px rgba(0,0,0,.25);
    --shadow-lg:  0 8px 32px rgba(0,0,0,.45);
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ─── Контейнер ─── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ─── Header ─── */
header {
    background: linear-gradient(135deg, var(--accent-2) 0%, var(--accent) 100%);
    box-shadow: var(--shadow);
    padding: 1rem 0;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

header h1 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: -.01em;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: rgba(255,255,255,.92);
    font-size: .9rem;
}

.btn-logout {
    background: rgba(255,255,255,.12);
    color: #fff;
    text-decoration: none;
    padding: .45rem .9rem;
    border-radius: var(--radius-sm);
    font-size: .85rem;
    transition: background .15s ease;
    border: 1px solid rgba(255,255,255,.18);
}

.btn-logout:hover {
    background: rgba(255,255,255,.22);
}

/* ─── Карточки ─── */
main.container {
    padding-bottom: 3rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.card h2 {
    margin: 0 0 1.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border);
}

.card h3 {
    margin: 0 0 .9rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
}

/* ─── Формы ─── */
form { margin: 0; }

.form-group {
    margin-bottom: 1.1rem;
}

.form-group label {
    display: block;
    margin-bottom: .4rem;
    font-size: .88rem;
    font-weight: 500;
    color: var(--text-mut);
    letter-spacing: .01em;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: .65rem .85rem;
    font-family: inherit;
    font-size: .95rem;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-dim);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface-3);
    box-shadow: 0 0 0 3px rgba(59,130,246,.18);
}

textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%2394a3b8' d='M6 8L0 0h12z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
    cursor: pointer;
}

input[type="file"] {
    padding: .5rem;
    cursor: pointer;
}

input[type="file"]::file-selector-button {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: .45rem .9rem;
    border-radius: var(--radius-sm);
    margin-right: .75rem;
    cursor: pointer;
    font-weight: 500;
    transition: background .15s ease;
}

input[type="file"]::file-selector-button:hover {
    background: var(--accent-h);
}

/* ─── Радио / чекбоксы ─── */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: .25rem 0;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .55rem .75rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text);
    font-size: .92rem;
    font-weight: 400;
    transition: all .15s ease;
    margin: 0;
}

.radio-group label:hover {
    background: var(--surface-3);
    border-color: var(--accent);
}

.radio-group input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ─── Кнопки ─── */
button,
.btn-primary,
.btn-secondary {
    font-family: inherit;
    font-size: .95rem;
    font-weight: 500;
    padding: .7rem 1.4rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background .15s ease, transform .05s ease, opacity .15s ease;
    border: none;
}

button:active { transform: translateY(1px); }

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

.btn-primary {
    background: var(--accent);
    color: #fff;
    margin-top: .5rem;
    box-shadow: 0 2px 6px rgba(59,130,246,.35);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-h);
    box-shadow: 0 4px 12px rgba(59,130,246,.45);
}

.btn-secondary {
    background: var(--surface-3);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--surface-2);
    border-color: var(--accent);
}

.btn-danger {
    background: #dc3545;
    color: #fff;
    box-shadow: 0 2px 6px rgba(220, 53, 69, .35);
}

.btn-danger:hover:not(:disabled) {
    background: #c82333;
    box-shadow: 0 4px 12px rgba(220, 53, 69, .45);
}

/* ═══════════════════════════════════════════════════════════
   Расширенные настройки (RAG & Enhancer) — обновлено под dark
   ═══════════════════════════════════════════════════════════ */
.advanced-options {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    margin: 1.5rem 0;
}

.advanced-options h3 {
    margin: 0 0 1rem;
    color: var(--text);
    font-size: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .65rem .85rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: .6rem;
    cursor: pointer;
    color: var(--text);
    font-size: .92rem;
    transition: all .15s ease;
}

.checkbox-label:hover {
    background: var(--surface-3);
    border-color: var(--accent);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════
   Информационные сообщения
   ═══════════════════════════════════════════════════════════ */
.info-text {
    color: var(--text-mut);
    font-size: .9rem;
    margin-bottom: 1rem;
}

.success {
    background: var(--success-bg);
    border: 1px solid var(--success);
    color: #d1fae5;
    padding: .85rem 1rem;
    border-radius: var(--radius-sm);
    margin-top: 1rem;
    font-size: .92rem;
}

.error {
    background: var(--danger-bg);
    border: 1px solid var(--danger);
    color: #fecaca;
    padding: .85rem 1rem;
    border-radius: var(--radius-sm);
    margin-top: 1rem;
    font-size: .92rem;
}

.topic-grade-warning {
    background: #422006;
    border: 1px solid var(--warning);
    color: #fde68a;
    padding: .7rem .9rem;
    border-radius: var(--radius-sm);
    margin: .5rem 0 0;
    font-size: .88rem;
    line-height: 1.4;
}

.no-textbook-warning {
    background: #422006;
    border: 1px solid var(--warning);
    color: #fde68a;
    padding: .75rem 1rem;
    border-radius: var(--radius-sm);
    margin: 0 0 1rem;
    font-size: .9rem;
    line-height: 1.45;
}
.no-textbook-warning[hidden] { display: none; }
.no-textbook-warning strong { color: #fef3c7; }
.result-draft-note { margin-top: .75rem; }

.loading {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-mut);
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-top: 1rem;
    text-align: center;
    font-size: .95rem;
}

/* ═══════════════════════════════════════════════════════════
   Результаты генерации
   ═══════════════════════════════════════════════════════════ */
#result {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    gap: 1rem;
}

.result-header h3 {
    margin: 0;
    color: var(--accent);
    font-size: 1.1rem;
}

.result-meta {
    display: flex;
    gap: 1rem;
    font-size: .85rem;
    color: var(--text-mut);
    flex-wrap: wrap;
}

.result-meta span {
    white-space: nowrap;
    padding: .25rem .6rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 4px;
}

.result-content {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1.5rem;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text);
    white-space: normal;
    overflow-x: auto;
    max-height: 70vh;
    overflow-y: auto;
}

.result-content br + br {
    display: block;
    content: "";
    margin-top: .5rem;
}

/* === Стили для markdown-рендера (marked.js) === */
.result-content h1,
.result-content h2,
.result-content h3,
.result-content h4 {
  font-weight: 700;
  line-height: 1.3;
  margin: 18px 0 8px;
  color: inherit;
}
.result-content h1 { font-size: 1.6em; }
.result-content h2 { font-size: 1.35em; }
.result-content h3 { font-size: 1.15em; }
.result-content h4 { font-size: 1.05em; }

.result-content p {
  margin: 8px 0;
  line-height: 1.5;
}

.result-content ul,
.result-content ol {
  margin: 8px 0;
  padding-left: 28px;
}
.result-content li {
  margin: 4px 0;
  line-height: 1.5;
}

.result-content strong { font-weight: 700; }
.result-content em     { font-style: italic; }

.result-content code {
  background: rgba(0, 0, 0, 0.06);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: Consolas, Monaco, monospace;
  font-size: 0.92em;
}

.result-content hr {
  border: none;
  border-top: 1px solid #ddd;
  margin: 16px 0;
}

.result-actions {
    display: flex;
    gap: .75rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════
   История генераций
   ═══════════════════════════════════════════════════════════ */
.history-list {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.history-item {
    background: var(--surface-2);
    padding: 1rem 1.1rem;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent);
    transition: all .15s ease;
}

.history-item:hover {
    background: var(--surface-3);
    transform: translateX(3px);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .4rem;
}

.history-header strong {
    color: var(--accent);
    font-size: .95rem;
    font-weight: 600;
}

.history-date {
    color: var(--text-dim);
    font-size: .8rem;
}

.history-topic {
    color: var(--text);
    margin-bottom: .5rem;
    font-weight: 500;
    font-size: .95rem;
}

.history-meta {
    display: flex;
    gap: .5rem;
    font-size: .8rem;
    color: var(--text-mut);
    flex-wrap: wrap;
}

.history-meta span {
    padding: .2rem .55rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
}

/* ═══════════════════════════════════════════════════════════
   Скроллбары (Webkit)
   ═══════════════════════════════════════════════════════════ */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: var(--bg);
}
::-webkit-scrollbar-thumb {
    background: var(--surface-3);
    border-radius: 5px;
    border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* ═══════════════════════════════════════════════════════════
   MathJax — чтобы формулы вписывались в тёмную тему
   ═══════════════════════════════════════════════════════════ */
mjx-container {
    color: var(--text) !important;
}

/* ═══════════════════════════════════════════════════════════
   Адаптивность
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .container { padding: 0 1rem; }
    header .container { flex-direction: column; align-items: flex-start; gap: .75rem; }
    header h1 { font-size: 1.2rem; }
    .card { padding: 1.25rem; }
    .form-row { grid-template-columns: 1fr; }

    .result-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .result-meta { gap: .5rem; }
    .result-actions { flex-direction: column; }
    .result-actions button { width: 100%; }

    .history-header { flex-direction: column; align-items: flex-start; gap: .4rem; }
    .history-meta { flex-direction: row; flex-wrap: wrap; }
}

/* ──────────────────────────────────────────────────
   PedagogAI v2 — Layout (Sidebar + Top-Nav + Tabs)
   Версия: 1.1 (2026-06-16)
   ────────────────────────────────────────────────── */

/* Header */
.app-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 24px;
  background: var(--bg-secondary, #1a1d23);
  border-bottom: 1px solid var(--border-color, #2a2e36);
  margin-bottom: 0;
}
.logo { font-size: 1.3em; font-weight: 600; color: var(--text-primary, #e8eaed); }
.badge-v2 {
  background: var(--accent-primary, #4a9eff); color: #fff;
  font-size: 0.6em; padding: 2px 8px; border-radius: 4px;
  margin-left: 4px; vertical-align: middle;
}
.badge-admin {
  background: #d97757; color: #fff;
  font-size: 0.75em; padding: 2px 6px; border-radius: 3px; margin-left: 4px;
}
.header-right { display: flex; align-items: center; gap: 16px; }
.user-info { color: var(--text-secondary, #aaa); }
.btn-logout {
  color: var(--text-secondary, #aaa); text-decoration: none;
  padding: 6px 12px; border: 1px solid var(--border-color, #2a2e36);
  border-radius: 6px; transition: all 0.15s;
}
.btn-logout:hover { color: #fff; border-color: #d97757; }

.btn-help {
  color: #fde68a;
  border-color: #f59e0b;
}
.btn-help:hover {
  color: #fff;
  border-color: #fbbf24;
  background: #422006;
}

.help-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  background: #1e3a5f;
  border: 1px solid #3b82f6;
  color: #dbeafe;
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  margin: 0 0 1rem;
  font-size: .9rem;
  line-height: 1.45;
}
.help-banner[hidden] { display: none; }
.help-banner p { margin: 0; }
.help-banner a { color: #fde68a; }
.help-banner-dismiss {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid rgba(255,255,255,.25);
  color: inherit;
  border-radius: 6px;
  padding: .3rem .7rem;
  cursor: pointer;
}

.help-body { margin: 0; }
.help-article {
  max-width: 760px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  color: var(--text, #f1f5f9);
  line-height: 1.55;
}
.help-article h1 { font-size: 1.7rem; margin: .2rem 0 1rem; }
.help-article h2 { font-size: 1.15rem; margin: 1.8rem 0 .6rem; }
.help-kicker {
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: .75rem;
  color: var(--text-mut, #94a3b8);
  margin: 0;
}
.help-lead { font-size: 1.05rem; color: var(--text-secondary, #d4dae8); }
.help-toc {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .9rem;
  margin: 1.2rem 0 1.6rem;
  padding: .9rem 1rem;
  background: var(--surface, #1e293b);
  border: 1px solid var(--border, #334155);
  border-radius: var(--radius-sm);
}
.help-toc a { color: #93c5fd; text-decoration: none; font-size: .9rem; }
.help-toc a:hover { text-decoration: underline; }
.help-article ol, .help-article ul { padding-left: 1.3rem; }
.help-article li { margin: .35rem 0; }
.help-article code {
  background: var(--surface-2, #273345);
  padding: .1rem .35rem;
  border-radius: 4px;
  font-size: .9em;
}
.help-updated { margin-top: 2.2rem; color: var(--text-mut, #94a3b8); font-size: .9rem; }
.help-article a { color: #93c5fd; }

/* Top-Nav */
.top-nav {
  display: flex; gap: 4px; padding: 0 24px;
  background: var(--bg-secondary, #1a1d23);
  border-bottom: 1px solid var(--border-color, #2a2e36);
}
.nav-tab {
  padding: 12px 20px; background: none; border: none;
  color: var(--text-secondary, #aaa); cursor: pointer;
  font-size: 0.95em; border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.nav-tab:hover { color: var(--text-primary, #e8eaed); }
.nav-tab.active {
  color: var(--accent-primary, #4a9eff);
  border-bottom-color: var(--accent-primary, #4a9eff);
}

/* Layout */
.app-layout {
  display: grid; grid-template-columns: 300px 1fr;
  min-height: calc(100vh - 110px);
}

/* Sidebar */
.sidebar {
  background: var(--bg-secondary, #1a1d23);
  border-right: 1px solid var(--border-color, #2a2e36);
  padding: 20px; overflow-y: auto;
}
.sidebar-block {
  margin-bottom: 24px;
  padding: 16px;
  background: var(--bg-primary, #14171c);
  border-radius: 8px;
  border: 1px solid var(--border-color, #2a2e36);
}
.sidebar-block h3 {
  margin: 0 0 12px 0; font-size: 0.95em;
  color: var(--text-primary, #e8eaed);
}
.sidebar-label {
  display: block; margin: 10px 0 4px 0;
  font-size: 0.85em; color: var(--text-secondary, #aaa);
}
.sidebar-select, .sidebar-input {
  width: 100%; padding: 8px 10px;
  background: var(--bg-secondary, #1a1d23);
  color: var(--text-primary, #e8eaed);
  border: 1px solid var(--border-color, #2a2e36);
  border-radius: 6px; font-size: 0.9em;
  box-sizing: border-box;
}
.sidebar-select:disabled { opacity: 0.4; cursor: not-allowed; }
.radio-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; cursor: pointer;
  color: var(--text-primary, #e8eaed); font-size: 0.9em;
}
.radio-row small { color: var(--text-secondary, #aaa); }

/* Main Area */
.main-area { padding: 24px 32px; overflow-y: auto; }
.tab-content { display: none; }
.tab-content.active { display: block; }
.tab-content h2 { margin-top: 0; color: var(--text-primary, #e8eaed); }

/* Form */
.field-label {
  display: block; margin: 16px 0 6px 0;
  font-weight: 500; color: var(--text-primary, #e8eaed);
}
.field-input, .field-textarea {
  width: 100%; padding: 10px 12px;
  background: var(--bg-secondary, #1a1d23);
  color: var(--text-primary, #e8eaed);
  border: 1px solid var(--border-color, #2a2e36);
  border-radius: 6px; font-size: 0.95em;
  box-sizing: border-box; font-family: inherit;
}
.field-textarea { resize: vertical; min-height: 70px; }
.model-indicator {
  margin: 16px 0; padding: 12px 14px;
  background: rgba(74, 158, 255, 0.08);
  border: 1px solid rgba(74, 158, 255, 0.2);
  border-radius: 6px; font-size: 0.9em;
  color: var(--text-primary, #e8eaed);
}
.model-indicator small { color: var(--text-secondary, #aaa); }
.form-actions {
  display: flex; gap: 12px; margin-top: 20px;
}
.btn-primary {
  flex: 1; padding: 12px 20px;
  background: var(--accent-primary, #4a9eff); color: #fff;
  border: none; border-radius: 6px; font-size: 1em;
  cursor: pointer; font-weight: 500;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-secondary {
  padding: 12px 20px;
  background: transparent; color: var(--text-secondary, #aaa);
  border: 1px solid var(--border-color, #2a2e36);
  border-radius: 6px; cursor: pointer;
}

/* Result */
.result-block {
  margin-top: 32px; padding: 20px;
  background: var(--bg-secondary, #1a1d23);
  border-radius: 8px;
  border: 1px solid var(--border-color, #2a2e36);
}

/* History */
.history-list { list-style: none; padding: 0; }
.history-item {
  padding: 12px 16px; margin-bottom: 8px;
  background: var(--bg-secondary, #1a1d23);
  border: 1px solid var(--border-color, #2a2e36);
  border-radius: 6px; color: var(--text-primary, #e8eaed);
}
.history-item small { color: var(--text-secondary, #aaa); margin-left: 8px; }

/* Placeholder */
.placeholder-box {
  padding: 40px; text-align: center;
  background: var(--bg-secondary, #1a1d23);
  border: 1px dashed var(--border-color, #2a2e36);
  border-radius: 8px;
  color: var(--text-secondary, #aaa);
}

/* Admin tab */
.admin-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 16px 0 24px;
}
.admin-stat {
  min-width: 110px;
  padding: 12px 14px;
  background: var(--bg-secondary, #1a1d23);
  border: 1px solid var(--border-color, #2a2e36);
  border-radius: 8px;
}
.admin-stat-n {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary, #e8eaed);
}
.admin-stat-l {
  font-size: 0.8rem;
  color: var(--text-secondary, #aaa);
}
.admin-invite-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
  margin: 12px 0 24px;
  padding: 14px;
  background: var(--bg-secondary, #1a1d23);
  border: 1px solid var(--border-color, #2a2e36);
  border-radius: 8px;
}
.admin-invite-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary, #aaa);
}
.admin-invite-form input {
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color, #2a2e36);
  background: var(--bg-primary, #0f1115);
  color: var(--text-primary, #e8eaed);
}
.btn-primary-inline {
  padding: 10px 14px;
  border: none;
  border-radius: 6px;
  background: #3d7eff;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.admin-table-wrap {
  overflow-x: auto;
  margin: 8px 0 28px;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.admin-table th,
.admin-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-color, #2a2e36);
  vertical-align: top;
}
.admin-table th {
  color: var(--text-secondary, #aaa);
  font-weight: 600;
}
.admin-table code {
  font-size: 0.85rem;
  word-break: break-all;
}
.admin-row-muted {
  opacity: 0.55;
}
.admin-flash {
  margin: 12px 0;
  padding: 10px 12px;
  border-radius: 6px;
}
.admin-flash-ok {
  background: rgba(46, 160, 67, 0.15);
  border: 1px solid rgba(46, 160, 67, 0.4);
}
.admin-flash-err {
  background: rgba(248, 81, 73, 0.12);
  border: 1px solid rgba(248, 81, 73, 0.35);
}
.admin-hint {
  color: var(--text-secondary, #aaa);
  font-size: 0.85rem;
  margin-bottom: 24px;
}

.trial-banner {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(61, 126, 255, 0.12);
  border: 1px solid rgba(61, 126, 255, 0.35);
}
.trial-banner-ok {
  background: rgba(46, 160, 67, 0.15);
  border-color: rgba(46, 160, 67, 0.4);
}
.trial-banner-err {
  color: #f85149;
  margin-bottom: 8px;
}
.trial-invite-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.trial-invite-form input {
  flex: 1 1 180px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color, #2a2e36);
  background: var(--bg-primary, #0f1115);
  color: var(--text-primary, #e8eaed);
}

/* Адаптив */
@media (max-width: 900px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--border-color, #2a2e36); }
  .top-nav { overflow-x: auto; }
}

/* ════════════════════════════════════════════════════════════
   Тонкая настройка — расширенные подписи для .setting-row
   (дополняет .checkbox-label, не ломает старую стилистику)
   Добавлено 2026-06-19
   ════════════════════════════════════════════════════════════ */

/* Карточка становится «вертикальной» — заголовок сверху, подсказка снизу */
.checkbox-label.setting-row {
    display: block;
    padding: .75rem .9rem;
}

/* Чекбокс + заголовок — в одну строку */
.checkbox-label.setting-row input[type="checkbox"] {
    vertical-align: middle;
    margin-right: .55rem;
}

.checkbox-label.setting-row .setting-title {
    font-weight: 500;
    font-size: .95rem;
    color: var(--text);
    vertical-align: middle;
}

/* Подсказка — на отдельной строке, мельче, приглушённо */
.checkbox-label.setting-row .setting-hint {
    display: block;
    margin-left: 1.85rem;       /* отступ под чекбоксом, выровнено с заголовком */
    margin-top: .35rem;
    font-size: .78rem;
    line-height: 1.4;
    color: var(--text);
    opacity: .65;
    font-style: italic;
}

/* Малая подпись «(для опытных)» в заголовке h3 */
.advanced-options h3 small {
    font-size: .72rem;
    font-weight: 400;
    opacity: .55;
    margin-left: .35rem;
}

/* На hover подсказка чуть «оживает» — подсказывает интерактивность */
.checkbox-label.setting-row:hover .setting-hint {
    opacity: .85;
}
