/* Комета — стили админки */
:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --text: #1d2330;
    --muted: #697386;
    --line: #e3e6ec;
    --accent: #3b4fd8;
    --accent-ink: #ffffff;
    --accent-soft: #eef0fd;
    --ok: #1f8a4c;
    --warn: #a86400;
    --warn-soft: #fff6e6;
    --error: #c23434;
    --error-soft: #fdeeee;
    --success-soft: #eaf7ef;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 4px 16px rgba(20, 30, 50, .05);
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #12151b;
        --surface: #1a1e26;
        --text: #e6e9ef;
        --muted: #9aa3b2;
        --line: #2a303b;
        --accent: #7d8cff;
        --accent-ink: #0f1220;
        --accent-soft: #23284a;
        --ok: #4cc27e;
        --warn: #f0b04a;
        --warn-soft: #2e2615;
        --error: #ff7b7b;
        --error-soft: #331c1e;
        --success-soft: #16291e;
        --shadow: none;
    }
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--accent); }
code { font: 13px/1.4 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }
h1 { font-size: 24px; line-height: 1.25; margin: 0 0 8px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.break { word-break: break-all; }

/* Верхняя панель */
.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 0 24px;
    height: 56px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}
.brand, .card-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    letter-spacing: .01em;
}
.card-brand { margin-bottom: 20px; color: var(--muted); font-size: 14px; }
.brand-mark {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: radial-gradient(circle at 70% 30%, #fff 0 18%, var(--accent) 19% 100%);
    box-shadow: -6px 4px 0 -4px var(--accent), -11px 7px 0 -7px var(--accent);
}
.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
    color: var(--muted);
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 6px;
}
.nav a:hover { color: var(--text); background: var(--bg); }
.nav a.active { color: var(--text); background: var(--accent-soft); }
.logout { display: flex; align-items: center; gap: 12px; margin: 0; }
.who { color: var(--muted); font-size: 14px; }

/* Раскладки */
.content { max-width: 1120px; margin: 0 auto; padding: 28px 24px 48px; }
.center { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; }
.page-head { margin-bottom: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; margin-bottom: 20px; }
.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 0 0 24px; }

/* Карточки и панели */
.card, .panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card { width: 100%; padding: 32px; }
.card-narrow { max-width: 400px; }
.card-medium { max-width: 560px; }
.card-wide { max-width: 760px; }
.panel { padding: 20px; margin-bottom: 20px; }
.grid .panel { margin-bottom: 0; }
.panel-warn { background: var(--warn-soft); border-color: transparent; }
.panel-warn ul { margin: 0; padding-left: 20px; }

/* Формы */
.form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.form-inline { margin-top: 12px; text-align: center; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; flex: 1; }
label.narrow { flex: 0 0 140px; }
input[type=text], input[type=email], input[type=password], input[type=url] {
    font: inherit;
    font-weight: 400;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    width: 100%;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.code-input { font-size: 20px !important; letter-spacing: .25em; text-align: center; }
fieldset { border: 0; border-top: 1px solid var(--line); padding: 16px 0 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 12px; }
legend { font-weight: 700; padding-right: 8px; }
.row { display: flex; gap: 12px; }
.error { color: var(--error); margin: 0; font-size: 14px; }
@media (max-width: 600px) { .row { flex-direction: column; } label.narrow { flex: 1; } }

/* Кнопки */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font: inherit;
    font-weight: 600;
    padding: 9px 16px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn-block { width: 100%; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); padding: 6px 10px; }
.btn-link { border: 0; background: none; color: var(--accent); font-weight: 400; padding: 0; cursor: pointer; font: inherit; }
.btn-small { padding: 4px 10px; font-size: 13px; }

/* Сообщения */
.flashes { width: 100%; max-width: 760px; margin: 0 auto 16px; }
.content .flashes { max-width: none; }
.flash { padding: 10px 14px; border-radius: 8px; margin: 0 0 12px; font-size: 14px; }
.flash-success { background: var(--success-soft); color: var(--ok); }
.flash-error { background: var(--error-soft); color: var(--error); }
.flash-warning { background: var(--warn-soft); color: var(--warn); }

/* Таблицы и списки */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line); padding: 6px 8px; }
.table td { border-bottom: 1px solid var(--line); padding: 8px; vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table form { margin: 0; }
.badge { display: inline-block; white-space: nowrap; padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 12px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 24px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

.checks { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 4px; }
.checks li { display: flex; justify-content: space-between; gap: 16px; padding: 6px 10px; border-radius: 6px; font-size: 14px; }
.checks li::before { content: "✓"; color: var(--ok); margin-right: 8px; }
.checks li.fail { background: var(--error-soft); }
.checks li.fail::before { content: "✕"; color: var(--error); }
.checks li.warn::before { content: "!"; color: var(--warn); }
.checks li span:first-child { flex: 1; }

/* 2FA */
.setup-2fa { display: flex; gap: 24px; align-items: center; margin: 20px 0; }
.qr { flex: 0 0 180px; background: #fff; border-radius: 8px; padding: 6px; }
.qr svg { display: block; width: 100%; height: auto; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.secret { display: inline-block; margin-top: 4px; padding: 4px 8px; background: var(--bg); border-radius: 6px; user-select: all; }
@media (max-width: 600px) { .setup-2fa { flex-direction: column; } }

.codes { list-style: none; padding: 0; margin: 16px 0 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.codes code { display: block; padding: 8px 12px; background: var(--bg); border-radius: 6px; text-align: center; font-size: 15px; letter-spacing: .05em; user-select: all; }
