/* Тема: светлая по умолчанию, независимо от настроек системы. Тёмная
   включается только явным выбором — атрибутом data-theme на <html>, который
   ставит переключатель в шапке (и восстанавливает из cookie `gar-theme`). */
:root {
    color-scheme: light;

    --bg: #f4f6f9;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #dfe5ec;
    --text: #16212e;
    --muted: #6b7a8d;
    --accent: #2563eb;
    --accent-weak: #e8f0fe;
    --ok: #16a34a;
    --warn: #d97706;
    --err: #dc2626;
    --cloud-mid: #a8552a;
    --cloud-hot: #e8622a;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 33, 46, .06), 0 8px 24px rgba(16, 33, 46, .06);
}

:root[data-theme="dark"] {
    color-scheme: dark;

    --bg: #0f1520;
    --surface: #161e2b;
    --surface-2: #1b2534;
    --border: #2a3648;
    --text: #e6edf6;
    --muted: #93a3b8;
    --accent: #5b8cff;
    --accent-weak: #1d2b45;
    --cloud-mid: #d98150;
    --cloud-hot: #ff7a3d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

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

a { color: var(--accent); }

header.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 10px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-weight: 700;
    letter-spacing: .3px;
}
.brand small { font-weight: 400; color: var(--muted); letter-spacing: 0; }

nav.tabs { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }

nav.tabs button {
    border: 0;
    background: transparent;
    color: var(--muted);
    padding: 8px 14px;
    border-radius: 8px;
    font: inherit;
    cursor: pointer;
}
nav.tabs button:hover { background: var(--surface-2); color: var(--text); }
nav.tabs button.active { background: var(--accent-weak); color: var(--accent); font-weight: 600; }

.theme-toggle {
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--muted);
    padding: 6px 12px;
    border-radius: 8px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent); }

.health {
    font-size: 13px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.dot.ok { background: var(--ok); }
.dot.err { background: var(--err); }

main { max-width: 1180px; margin: 0 auto; padding: 24px; }

section.view { display: none; }
section.view.active { display: block; }

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

.card > h2 { margin: 0 0 4px; font-size: 18px; }
.card > p.hint { margin: 0 0 18px; color: var(--muted); font-size: 14px; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

label.field { display: block; margin-bottom: 14px; }
label.field > span {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}

input[type=text], input[type=number], input[type=url], textarea, select {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
}
textarea { min-height: 110px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 6px 18px; }
.checks label { display: flex; gap: 8px; align-items: center; font-size: 14px; cursor: pointer; }

button.btn, a.btn {
    display: inline-block;
    text-decoration: none;
    border: 1px solid transparent;
    background: var(--accent);
    color: #fff;
    padding: 10px 18px;
    border-radius: 8px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
button.btn:hover, a.btn:hover { filter: brightness(1.07); }
button.btn:disabled, a.btn:disabled { opacity: .55; cursor: not-allowed; }
button.btn.ghost, a.btn.ghost { background: transparent; color: var(--accent); border-color: var(--border); }
button.btn.small, a.btn.small { padding: 6px 12px; font-size: 13px; font-weight: 500; }

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

.progress { margin-top: 16px; display: none; }
.progress.visible { display: block; }
.bar { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s ease; }
.log {
    margin-top: 10px;
    max-height: 170px;
    overflow: auto;
    font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--muted);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
}

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
}
.stat b { display: block; font-size: 22px; line-height: 1.2; }
.stat span { font-size: 12px; color: var(--muted); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; font-weight: 600; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { max-height: 460px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }

.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.ok { background: rgba(22, 163, 74, .13); color: var(--ok); }
.pill.warn { background: rgba(217, 119, 6, .14); color: var(--warn); }
.pill.err { background: rgba(220, 38, 38, .13); color: var(--err); }
.pill.muted { background: var(--surface-2); color: var(--muted); }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; font-size: 13px; }

.headings-tree { font-size: 14px; }
.headings-tree div { padding: 1px 0; }
.headings-tree .lv1 { font-weight: 700; }
.headings-tree .lv2 { padding-left: 16px; }
.headings-tree .lv3 { padding-left: 32px; color: var(--muted); }
.headings-tree .lv4, .headings-tree .lv5, .headings-tree .lv6 { padding-left: 48px; color: var(--muted); }

.notice { padding: 10px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 14px; }
.notice.err { background: rgba(220, 38, 38, .1); color: var(--err); }
.notice.ok { background: rgba(22, 163, 74, .1); color: var(--ok); }
.notice.warn { background: rgba(217, 119, 6, .12); color: var(--warn); }

.counter { font-size: 12px; color: var(--muted); margin-top: 4px; }

details { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; background: var(--surface-2); }
details > summary { cursor: pointer; font-weight: 600; }
details[open] > summary { margin-bottom: 10px; }

.jobs-list { display: grid; gap: 8px; }
.job-item {
    display: flex; gap: 12px; align-items: center; justify-content: space-between;
    padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2);
}
.job-item small { color: var(--muted); }

@media (max-width: 720px) {
    main { padding: 14px; }
    header.topbar { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
    .health { order: 3; width: 100%; }
}

/* --- Облака слов --- */
/* Зоны печатаются подряд, а не по вкладкам: SEO-специалисту нужно видеть
   основной текст, анкоры и заголовки рядом, не переключаясь. */
.cloud-zone { display: block; }
.cloud-zone + .cloud-zone {
    margin-top: 22px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}
.cloud-zone-title { font-size: 15px; margin: 0 0 12px; }

.cloud-title { font-size: 14px; margin: 0 0 10px; color: var(--muted); text-align: center; }

/* Пометка «необязательно» у подписи поля и приглушённый текст в таблицах. */
.field .opt { font-style: normal; font-weight: 400; color: var(--muted); font-size: 11px; }
td .muted, span.muted { color: var(--muted); }

.cloud {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px 12px;
    padding: 18px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-2);
    min-height: 200px;
    line-height: 1.15;
}

.cloud .cw { white-space: nowrap; cursor: default; }
.cloud .cw.w1 { color: var(--muted); }
.cloud .cw.w2 { color: var(--cloud-mid); font-weight: 600; }
.cloud .cw.w3 { color: var(--cloud-hot); font-weight: 700; }
.cloud .cw.missing { text-decoration: underline dotted currentColor; text-underline-offset: 3px; }
