/* ===========================================================================
   Панель «Парсер Авито» — дизайн-система v2
   Светлый минимализм, один акцент — тёмно-синий #1F3864. Две темы на переменных.
   Чистый HTML/CSS под Jinja: семантические классы + CSS-переменные. Без фреймворков.
   =========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Onest:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ---------- СВЕТЛАЯ ТЕМА (по умолчанию) ---------- */
:root,
:root[data-theme="light"] {
    --bg: #eaecef;
    --bg-soft: #f3f4f6;
    --panel: #ffffff;
    --panel-2: #f7f8fa;
    --panel-solid: #ffffff;
    --line: #e9ebef;
    --line-2: #d9dde2;
    --text: #1d2024;
    --text-2: #43474d;
    --muted: #767d86;
    --faint: #a2a8b0;
    --accent: #1F3864;
    --accent-2: #2a4a82;
    --accent-ink: #1F3864;
    --accent-soft: #eaeff7;
    --accent-line: #cdd8ea;
    --green: #1f7a39;
    --green-soft: #e7f3ec;
    --green-line: #b5d8c1;
    --red: #c41f1c;
    --red-soft: #fbebea;
    --red-line: #efc2c0;
    --amber: #9a6a16;
    --amber-soft: #f6efdf;
    --amber-line: #e6d4ab;
    --radius: 10px;
    --radius-sm: 7px;
    --radius-lg: 14px;
    --shadow: 0 1px 2px rgba(20, 30, 50, .05);
    --shadow-card: 0 1px 3px rgba(20, 30, 50, .07);
    --shadow-pop: 0 14px 40px rgba(20, 30, 50, .16);
    --ring: 0 0 0 3px var(--accent-soft);
    --font: 'Onest', -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, "SF Mono", Consolas, monospace;
    color-scheme: light;
}

/* ---------- ТЁМНАЯ ТЕМА ---------- */
:root[data-theme="dark"] {
    --bg: #0f1318;
    --bg-soft: #171c23;
    --panel: #181d24;
    --panel-2: #1e242c;
    --panel-solid: #181d24;
    --line: #262d36;
    --line-2: #313b45;
    --text: #e8ecf2;
    --text-2: #b9c1cc;
    --muted: #8a95a3;
    --faint: #5f6975;
    --accent: #7ba4df;
    --accent-2: #9cbceb;
    --accent-ink: #cdddf6;
    --accent-soft: rgba(123, 164, 223, .14);
    --accent-line: rgba(123, 164, 223, .32);
    --green: #56c184;
    --green-soft: rgba(86, 193, 132, .14);
    --green-line: rgba(86, 193, 132, .34);
    --red: #e57063;
    --red-soft: rgba(229, 112, 99, .15);
    --red-line: rgba(229, 112, 99, .36);
    --amber: #d6a44e;
    --amber-soft: rgba(214, 164, 78, .14);
    --amber-line: rgba(214, 164, 78, .32);
    --shadow: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-card: 0 1px 4px rgba(0, 0, 0, .4);
    --shadow-pop: 0 18px 50px rgba(0, 0, 0, .55);
    --ring: 0 0 0 3px var(--accent-soft);
    color-scheme: dark;
}

* { box-sizing: border-box; }
::selection { background: var(--accent-soft); color: var(--accent-ink); }

svg { width: 18px; height: 18px; flex-shrink: 0; vertical-align: middle; }

html, body {
    margin: 0; padding: 0; min-height: 100vh;
    background: var(--bg); color: var(--text);
    font-family: var(--font); font-size: 14px; line-height: 1.5;
    -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
body { transition: background .2s ease, color .2s ease; }
h1, h2, h3, h4 { font-weight: 700; }
.num { font-family: var(--mono); font-feature-settings: "tnum" 1; letter-spacing: -.01em; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }

/* ===== Каркас ===== */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 248px; flex-shrink: 0; background: var(--panel);
    border-right: 1px solid var(--line-2); padding: 16px 12px;
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 7px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 7px; }

.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 16px; }
.brand-mark {
    width: 38px; height: 38px; border-radius: 9px;
    background: var(--accent); color: #fff; display: grid; place-items: center;
    font-weight: 800; font-size: 18px; letter-spacing: .5px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
:root[data-theme="dark"] .brand-mark { background: var(--accent-soft); color: var(--accent-ink); box-shadow: inset 0 0 0 1px var(--accent-line); }
.brand-text strong { display: block; font-size: 14.5px; font-weight: 700; letter-spacing: .1px; }
.brand-text small { color: var(--muted); font-size: 11.5px; }

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 11px; border-radius: var(--radius-sm);
    color: var(--text-2); font-weight: 500; font-size: 13.5px;
    border-left: 2.5px solid transparent; cursor: pointer;
    transition: background .12s, color .12s, border-color .12s;
}
.nav-item:hover { background: var(--bg-soft); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-ink); border-left-color: var(--accent); font-weight: 600; }
.nav-item.active .nav-ico { color: var(--accent); }
.nav-ico { display: inline-flex; width: 18px; height: 18px; align-items: center; justify-content: center; color: var(--muted); flex-shrink: 0; }
.nav-ico svg { width: 17px; height: 17px; }

.nav-group-title {
    display: flex; align-items: center; gap: 11px;
    padding: 14px 11px 6px; font-size: 10.5px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .08em; color: var(--faint);
    border-radius: var(--radius-sm); cursor: pointer;
}
a.nav-group-title:hover { color: var(--accent); }
.nav-group-title .nav-ico svg { width: 16px; height: 16px; }
.nav-sub { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 4px 9px; padding-left: 11px; border-left: 1px solid var(--line-2); }
.nav-sub .nav-item { font-size: 13px; padding: 7px 10px; }
.nav-loner { margin-top: 2px; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 14px 6px 4px; }
.status-line { color: var(--muted); font-size: 11.5px; display: flex; align-items: center; gap: 8px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }

.content { flex: 1; min-width: 0; padding: 26px 34px 64px; max-width: 1320px; }

/* ===== Переключатель темы ===== */
.theme-toggle {
    position: fixed; top: 22px; right: 24px; z-index: 200;
    width: 38px; height: 38px; border-radius: var(--radius-sm);
    display: inline-grid; place-items: center;
    background: var(--panel); border: 1px solid var(--line-2);
    color: var(--muted); cursor: pointer; box-shadow: var(--shadow-card);
    transition: background .12s, border-color .12s, color .12s;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent-line); background: var(--bg-soft); }
.theme-toggle svg { width: 19px; height: 19px; display: block; }
.theme-toggle .ti { display: none; }
:root[data-theme="dark"] .theme-toggle .ti-sun { display: block; }
:root[data-theme="light"] .theme-toggle .ti-moon { display: block; }

/* ===== Заголовок страницы ===== */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; padding-right: 56px; }
.page-head h1 { margin: 0 0 6px; font-size: 24px; font-weight: 800; letter-spacing: -.4px; }
.page-head .sub { color: var(--muted); margin: 0; font-size: 13.5px; max-width: 760px; }
.muted { color: var(--muted); margin: 0; }

/* ===== Кнопки ===== */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 15px; border-radius: var(--radius-sm);
    border: 1px solid var(--line-2); cursor: pointer;
    font-size: 13px; font-weight: 600; font-family: var(--font);
    transition: background .12s, border-color .12s, color .12s, box-shadow .12s, transform .06s;
    white-space: nowrap; background: var(--panel); color: var(--text);
}
.btn svg { width: 15px; height: 15px; }
.btn[hidden] { display: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
:root[data-theme="dark"] .btn-primary { color: #0f1318; }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-ghost:hover { background: var(--bg-soft); border-color: var(--accent-line); color: var(--accent); }
.btn-run { color: var(--green); border-color: var(--green-line); }
.btn-run:hover { background: var(--green-soft); }
.btn-stop { color: var(--red); border-color: var(--red-line); }
.btn-stop:hover { background: var(--red-soft); }

.icon-btn {
    background: var(--panel); border: 1px solid var(--line-2); cursor: pointer;
    width: 36px; height: 36px; border-radius: var(--radius-sm);
    display: inline-grid; place-items: center; color: var(--muted);
    transition: background .12s, border-color .12s, color .12s;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--bg-soft); border-color: var(--accent-line); color: var(--accent); }
.icon-danger:hover { background: var(--red-soft); border-color: var(--red-line); color: var(--red); }

/* ===== Бейджи ===== */
.status-badge, .tag {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
    white-space: nowrap; border: 1px solid transparent; line-height: 1.5;
}
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-badge[data-state="never"]   { background: var(--bg-soft); color: var(--muted); border-color: var(--line-2); }
.status-badge[data-state="running"] { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-line); }
.status-badge[data-state="done"]    { background: var(--green-soft); color: var(--green); border-color: var(--green-line); }
.status-badge[data-state="stopped"] { background: var(--bg-soft); color: var(--muted); border-color: var(--line-2); }
.status-badge[data-state="error"]   { background: var(--red-soft); color: var(--red); border-color: var(--red-line); }
.status-badge[data-state="running"]::before { animation: pulse 1.1s infinite; box-shadow: 0 0 0 0 currentColor; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

.tag-off { background: var(--bg-soft); color: var(--muted); border-color: var(--line-2); }
.tag-client { background: var(--green-soft); color: var(--green); border-color: var(--green-line); }
.tag-important { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-line); }
.tag-other { background: var(--bg-soft); color: var(--muted); border-color: var(--line-2); }
/* пометки риска совета (база знаний): зелёный/жёлтый/красный */
.tag-risk-green { background: var(--green-soft); color: var(--green); border-color: var(--green-line); }
.tag-risk-yellow { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-line); }
.tag-risk-red { background: var(--red-soft); color: var(--red); border-color: var(--red-line); }

/* ===== Карточки ===== */
.card { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow-card); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; }

.job-card { padding: 0; display: flex; flex-direction: column; gap: 0; transition: border-color .12s, box-shadow .12s, transform .1s; overflow: hidden; box-shadow: 0 1px 2px rgba(20,30,50,.05), 0 6px 16px rgba(20,30,50,.06); }
:root[data-theme="dark"] .job-card { box-shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 16px rgba(0,0,0,.35); }
.job-card:hover { border-color: var(--accent-line); box-shadow: var(--shadow-pop); transform: translateY(-1px); }
.job-card > .job-top { padding: 16px 18px 0; }
.job-card > .job-url { margin: 12px 18px 0; }
.job-card > .job-meta { padding: 12px 18px 0; }
.job-card > .job-foot { margin-top: 14px; padding: 13px 18px; background: var(--panel-2); border-top: 1px solid var(--line); }
.job-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.job-title h3 { margin: 0; font-size: 15.5px; font-weight: 700; letter-spacing: -.1px; }
.job-url { color: var(--muted); font-size: 12px; line-height: 1.45; word-break: break-all; display: block;
    font-family: var(--mono); background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
    padding: 8px 10px; max-height: 56px; overflow: hidden; position: relative; }
.job-url:hover { color: var(--accent); border-color: var(--accent-line); }
.job-meta { display: flex; flex-wrap: wrap; gap: 7px 18px; color: var(--muted); font-size: 12.5px; }
.job-meta span { display: inline-flex; align-items: center; gap: 6px; }
.job-meta b { color: var(--text); font-family: var(--mono); font-weight: 600; }
.job-meta svg { width: 14px; height: 14px; opacity: .7; }
.job-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding-top: 13px; border-top: 1px solid var(--line); }
.job-foot .spacer { margin-left: auto; }
.job-actions { display: flex; align-items: center; gap: 7px; }
.job-card .btn { padding: 8px 12px; font-size: 12.5px; }
.job-card .icon-btn { width: 34px; height: 34px; }

/* ===== Пустые состояния ===== */
.empty { text-align: center; padding: 64px 20px; }
.empty-ico { width: 56px; height: 56px; margin: 0 auto 16px; display: grid; place-items: center; border-radius: 16px; background: var(--accent-soft); color: var(--accent); }
.empty-ico svg { width: 27px; height: 27px; }
.empty h2 { margin: 0 0 8px; font-weight: 700; font-size: 18px; }
.empty p { max-width: 420px; margin: 0 auto; color: var(--muted); }
.empty .btn { margin-top: 18px; }

/* ===== Формы ===== */
.form { padding: 4px 2px; max-width: 940px; display: flex; flex-direction: column; gap: 18px; }
.form-card { padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; }
.form-row { display: flex; flex-direction: column; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.section-title { margin: 8px 0 0; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); border-top: 1px solid var(--line); padding-top: 18px; }
.section-title:first-child { border-top: none; padding-top: 0; }

label { font-weight: 600; font-size: 13px; display: flex; flex-direction: column; gap: 7px; color: var(--text); }
input[type="text"], input[type="url"], input[type="number"], input[type="time"], input[type="password"], textarea, select {
    background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
    color: var(--text); padding: 10px 12px; font-size: 13.5px; font-family: var(--font); width: 100%;
    transition: border-color .12s, box-shadow .12s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
select { appearance: none; -webkit-appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23767d86'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; padding-right: 30px; }
.hint { font-weight: 400; color: var(--muted); font-size: 11.5px; line-height: 1.45; margin-top: 1px; }

.form-checks { display: flex; flex-wrap: wrap; gap: 12px 24px; padding-top: 4px; }
.check { flex-direction: row; align-items: center; gap: 9px; font-weight: 500; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }
.form-foot { display: flex; gap: 11px; padding-top: 18px; border-top: 1px solid var(--line); }

.flash { display: flex; align-items: center; gap: 9px; background: var(--green-soft); color: var(--green); border: 1px solid var(--green-line); padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-weight: 500; font-size: 13px; }
.flash svg { width: 18px; height: 18px; }

/* ===== Таблицы ===== */
.table-wrap { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow-card); overflow: hidden; }
.table-scroll { overflow-x: auto; max-width: 100%; }
.table-scroll::-webkit-scrollbar { height: 9px; }
.table-scroll::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 9px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
    position: sticky; top: 0; background: var(--panel-2); z-index: 2;
    text-align: left; font-weight: 700; color: var(--muted); font-size: 11px;
    text-transform: uppercase; letter-spacing: .05em; padding: 11px 14px;
    border-bottom: 1px solid var(--line-2); white-space: nowrap; cursor: default;
}
thead th.sortable { cursor: pointer; }
thead th.sortable:hover { color: var(--accent); }
thead th.num, td.num { text-align: right; white-space: nowrap; }
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--text-2); }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--bg-soft); }
td .strong { color: var(--text); font-weight: 600; }
td.num { font-family: var(--mono); color: var(--text); font-feature-settings: "tnum" 1; }
.cell-title { display: flex; flex-direction: column; gap: 2px; max-width: 340px; }
.cell-title .t { color: var(--text); font-weight: 600; line-height: 1.35; }
.cell-title .s { color: var(--muted); font-size: 11.5px; }
.cell-link { color: var(--accent); display: inline-flex; align-items: center; gap: 5px; }
.cell-link svg { width: 13px; height: 13px; }
.delta { font-family: var(--mono); font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.delta svg { width: 13px; height: 13px; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }
.delta.flat { color: var(--muted); }
.avatar { width: 30px; height: 30px; border-radius: 7px; object-fit: cover; background: var(--panel-2); border: 1px solid var(--line); flex-shrink: 0; }
.cell-thumb { display: flex; align-items: center; gap: 11px; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { margin-left: auto; }
.search { position: relative; flex: 1; max-width: 340px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); }
.search input { padding-left: 34px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel); color: var(--text-2); font-size: 12.5px; font-weight: 600; cursor: pointer; transition: all .12s; }
.chip:hover { border-color: var(--accent-line); color: var(--accent); }
.chip.active { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-line); }
.table-foot { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }

/* ===== KPI-плитки ===== */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 16px 17px; box-shadow: var(--shadow-card); position: relative; overflow: hidden; }
.kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.kpi-label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.kpi-ico svg { width: 16px; height: 16px; }
.kpi-value { font-family: var(--mono); font-size: 27px; font-weight: 600; letter-spacing: -.02em; line-height: 1; }
.kpi-value small { font-size: 15px; color: var(--muted); font-weight: 500; }
.kpi-foot { margin-top: 9px; display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.kpi-spark { position: absolute; right: 0; bottom: 0; left: 0; height: 30px; opacity: .5; }
.kpi.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="dark"] .kpi.accent { background: var(--accent-soft); border-color: var(--accent-line); color: var(--text); }
.kpi.accent .kpi-label, .kpi.accent .kpi-foot { color: rgba(255,255,255,.78); }
:root[data-theme="dark"] .kpi.accent .kpi-label, :root[data-theme="dark"] .kpi.accent .kpi-foot { color: var(--muted); }
.kpi.accent .kpi-ico { background: rgba(255,255,255,.16); color: #fff; }
:root[data-theme="dark"] .kpi.accent .kpi-ico { background: var(--accent-soft); color: var(--accent-ink); }

/* ===== Сетки дашборда ===== */
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
.grid-2-eq { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .grid-2, .grid-2-eq { grid-template-columns: 1fr; } }
.panel-card { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 18px 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.panel-head .muted { font-size: 12px; }

/* ===== Графики ===== */
.chart { width: 100%; display: block; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; font-size: 12px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg-swatch { width: 11px; height: 11px; border-radius: 3px; }
.tip { position: fixed; pointer-events: none; background: var(--panel-solid); border: 1px solid var(--line-2); box-shadow: var(--shadow-pop); border-radius: 8px; padding: 8px 11px; font-size: 12px; z-index: 300; opacity: 0; transition: opacity .1s; }
.tip b { font-family: var(--mono); }

/* ===== Авитолог-инсайты ===== */
.insight { display: flex; gap: 13px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.insight:last-child { border-bottom: none; }
.insight-ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.insight-ico svg { width: 17px; height: 17px; }
.insight.up .insight-ico { background: var(--green-soft); color: var(--green); }
.insight.warn .insight-ico { background: var(--amber-soft); color: var(--amber); }
.insight.info .insight-ico { background: var(--accent-soft); color: var(--accent); }
.insight-body { flex: 1; }
.insight-body p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--text-2); }
.insight-body p b { color: var(--text); font-weight: 700; }
.insight-time { color: var(--faint); font-size: 11.5px; margin-top: 4px; display: block; }

.ai-card { background: var(--accent); color: #fff; border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow-card); }
:root[data-theme="dark"] .ai-card { background: var(--panel); border: 1px solid var(--accent-line); }
.ai-card .ai-tag { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: rgba(255,255,255,.8); margin-bottom: 12px; }
:root[data-theme="dark"] .ai-card .ai-tag { color: var(--accent-ink); }
.ai-card .ai-tag svg { width: 15px; height: 15px; }
.ai-card p { margin: 0 0 8px; font-size: 14.5px; line-height: 1.6; }
.ai-card .ai-quote { font-size: 16px; font-weight: 600; line-height: 1.55; }
.ai-card .btn { margin-top: 14px; background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.2); color: #fff; }
.ai-card .btn:hover { background: rgba(255,255,255,.24); }
:root[data-theme="dark"] .ai-card .btn { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-ink); }

/* ===== Список «прогон» / расписание ===== */
.run-list { display: flex; flex-direction: column; }
.run-row { display: flex; align-items: center; gap: 13px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.run-row:last-child { border-bottom: none; }
.run-bullet { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.run-bullet.done { background: var(--green); }
.run-bullet.run { background: var(--accent); animation: pulse 1.1s infinite; }
.run-bullet.err { background: var(--red); }
.run-row .r-title { font-weight: 600; color: var(--text); }
.run-row .r-meta { color: var(--muted); font-size: 12px; }
.run-row .r-time { margin-left: auto; font-family: var(--mono); font-size: 12.5px; color: var(--muted); }

/* Расписание — недельная решётка */
.sched-grid { display: grid; grid-template-columns: 64px 1fr; gap: 0; }
.sched-rows { display: flex; flex-direction: column; }
.sched-day { display: grid; grid-template-columns: 64px 1fr; align-items: center; border-top: 1px solid var(--line); min-height: 52px; }
.sched-day:first-child { border-top: none; }
.sched-day .d-name { font-weight: 700; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.sched-slots { display: flex; flex-wrap: wrap; gap: 7px; padding: 9px 0; }
.slot { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent-ink); border: 1px solid var(--accent-line); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.slot .num { font-size: 12.5px; }
.slot.muted { background: var(--bg-soft); color: var(--muted); border-color: var(--line-2); }

/* Здоровье */
.health-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.health-card { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-card); display: flex; flex-direction: column; gap: 12px; }
.health-top { display: flex; align-items: center; gap: 11px; }
.health-led { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.health-led.ok { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.health-led.warn { background: var(--amber); box-shadow: 0 0 0 4px var(--amber-soft); }
.health-led.err { background: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.health-top h3 { margin: 0; font-size: 14.5px; font-weight: 700; }
.health-top .h-sub { color: var(--muted); font-size: 12px; }
.health-metrics { display: flex; flex-direction: column; gap: 9px; }
.h-metric { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; }
.h-metric .l { color: var(--muted); }
.h-metric .v { font-family: var(--mono); font-weight: 600; color: var(--text); }
.progress { height: 7px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.progress.ok span { background: var(--green); }
.progress.warn span { background: var(--amber); }
.progress.err span { background: var(--red); }

/* Лог-консоль */
.console { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 14px 16px; font-family: var(--mono); font-size: 12px; line-height: 1.9; max-height: 280px; overflow-y: auto; }
.console .ln { display: flex; gap: 12px; white-space: nowrap; }
.console .t { color: var(--faint); }
.console .lv-ok { color: var(--green); }
.console .lv-warn { color: var(--amber); }
.console .lv-err { color: var(--red); }
.console .msg { color: var(--text-2); white-space: pre-wrap; }

/* Вход */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); padding: 34px 32px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 24px; text-align: center; }
.auth-brand .brand-mark { width: 52px; height: 52px; font-size: 24px; border-radius: 13px; }
.auth-brand h1 { margin: 0; font-size: 19px; }
.auth-brand p { margin: 0; color: var(--muted); font-size: 13px; }
.auth-card .form-row { margin-bottom: 15px; }
.auth-card .btn-primary { width: 100%; justify-content: center; padding: 11px; margin-top: 6px; }

/* Утилиты */
.row { display: flex; align-items: center; gap: 10px; }

/* ===== Дополнения для расширенных экранов ===== */
/* Хлебные крошки */
.crumbs { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); margin-bottom: 14px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { color: var(--faint); }
.crumbs b { color: var(--text); font-weight: 600; }

/* Баннеры-варианты (info/plain) */
.flash.info { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-line); }
.flash.plain { background: var(--panel-2); color: var(--text-2); border-color: var(--line-2); font-weight: 400; }
.flash.amber { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-line); }

/* Бейдж «новая» */
.badge-new { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--accent-soft); color: var(--accent-ink); border: 1px solid var(--accent-line); }

/* Кнопки выбора ниши (звезда + счётчик) */
.pick-row { display: flex; flex-wrap: wrap; gap: 9px; }
.pick { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel); color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; transition: all .12s; }
.pick svg { width: 15px; height: 15px; color: var(--muted); }
.pick .cnt { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.pick:hover { border-color: var(--accent-line); color: var(--accent); }
.pick:hover svg { color: var(--accent); }
.pick.active { background: var(--accent); color: #fff; border-color: var(--accent); }
:root[data-theme="dark"] .pick.active { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-line); }
.pick.active svg, .pick.active .cnt { color: rgba(255,255,255,.85); }
:root[data-theme="dark"] .pick.active svg, :root[data-theme="dark"] .pick.active .cnt { color: var(--accent-ink); }

/* Карточка рекомендации ИИ */
.rec-card { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 20px 22px; }
.rec-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.rec-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.rec-meta { color: var(--muted); font-size: 12px; font-family: var(--mono); margin: 4px 0 0; }
.rec-body { margin-top: 16px; display: flex; flex-direction: column; gap: 14px; color: var(--text-2); font-size: 13.5px; line-height: 1.6; }
.rec-body p { margin: 0; }
.rec-body b { color: var(--text); }
.rec-foot { display: flex; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.section-h { display: flex; align-items: center; gap: 9px; margin: 6px 0 14px; font-size: 16px; font-weight: 700; }
.section-h svg { width: 18px; height: 18px; color: var(--accent); }
.section-h .muted { font-size: 13px; font-weight: 400; }

/* Мини-графики в плитках (svg sparkline-area) */
.mini-chart { width: 100%; height: 92px; display: block; }
.mini-card { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 14px 16px; }
.mini-card .mc-title { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 10px; }
.mini-card .mc-title svg { width: 14px; height: 14px; color: var(--muted); }
.mc-empty { color: var(--muted); font-size: 12.5px; text-align: center; padding: 24px 8px; }

/* Большой график-обёртка (карточка конкурента, история) */
.big-chart { width: 100%; height: 300px; display: block; }

/* Карточка фото-объявления (галерея конкурентов) */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.photo-card { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow-card); overflow: hidden; display: flex; flex-direction: column; transition: border-color .12s, box-shadow .12s, transform .1s; }
.photo-card:hover { border-color: var(--accent-line); box-shadow: var(--shadow-pop); transform: translateY(-1px); }
.photo-thumb { position: relative; aspect-ratio: 4 / 3; background: var(--panel-2); overflow: hidden; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-rank { position: absolute; left: 10px; bottom: 10px; background: rgba(15,19,24,.78); color: #fff; font-family: var(--mono); font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 6px; }
.photo-promo { position: absolute; left: 10px; top: 10px; background: var(--panel); color: var(--text-2); font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-2); }
.photo-body { padding: 14px 15px; display: flex; flex-direction: column; gap: 7px; }
.photo-body h4 { margin: 0; font-size: 14px; font-weight: 700; line-height: 1.35; }
.photo-seller { color: var(--muted); font-size: 12.5px; }
.photo-views { font-family: var(--mono); font-size: 22px; font-weight: 600; line-height: 1; margin-top: 2px; }
.photo-views small { font-family: var(--font); font-size: 12px; color: var(--muted); font-weight: 500; }
.photo-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.photo-price { font-family: var(--mono); font-weight: 600; color: var(--text); }
.photo-track { color: var(--muted); font-size: 11.5px; }

/* Сетка карточек продавцов (конкуренты-аналитика) */
.seller-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.seller-card { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 15px 16px; cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.seller-card:hover { border-color: var(--accent-line); box-shadow: var(--shadow-pop); }
.seller-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.seller-top h4 { margin: 0; font-size: 14.5px; font-weight: 700; line-height: 1.3; }
.seller-share { display: flex; align-items: center; gap: 8px; margin: 11px 0 9px; }
.seller-bar { flex: 1; height: 5px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; }
.seller-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.seller-bar.green span { background: var(--green); }
.seller-stats { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--muted); }
.seller-stats b { color: var(--text); font-family: var(--mono); font-weight: 600; }
.seller-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 11px; padding-top: 11px; border-top: 1px solid var(--line); }
.mini-spark { width: 84px; height: 26px; }

/* Аккордеон магазинов (экономика) */
.shop-acc { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow-card); margin-bottom: 14px; overflow: hidden; }
.shop-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px 18px; cursor: pointer; }
.shop-head h4 { margin: 0; font-size: 15px; font-weight: 700; flex: 1; min-width: 200px; }
.shop-head .sh-m { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.shop-head .sh-m b { color: var(--text); font-family: var(--mono); font-weight: 600; }
.shop-head .sh-m.pos b { color: var(--green); }
.shop-body { border-top: 1px solid var(--line); }
.txt-pos { color: var(--green); }
.txt-neg { color: var(--red); }
tr.row-neg td { background: var(--red-soft); }

/* Картинки — конструктор и галерея */
.builder-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .builder-grid { grid-template-columns: 1fr; } }
.gen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.gen-card { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 14px 15px; display: flex; flex-direction: column; gap: 11px; }
.gen-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.gen-tag { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--green-soft); color: var(--green); border: 1px solid var(--green-line); }
.gen-tag.scratch { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-line); }
.gen-date { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.gen-thumb { aspect-ratio: 4 / 3; border-radius: var(--radius-sm); background: var(--panel-2); border: 1px solid var(--line); display: grid; place-items: center; color: var(--faint); overflow: hidden; }
.gen-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gen-thumb svg { width: 30px; height: 30px; }
.ba { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ba figure { margin: 0; }
.ba figcaption { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.ba .gen-thumb { aspect-ratio: 4 / 3; }
.gen-desc { font-size: 12.5px; color: var(--text-2); line-height: 1.5; max-height: 168px; overflow-y: auto; }
.gen-foot { display: flex; gap: 8px; padding-top: 4px; }
.gen-foot .btn { padding: 7px 12px; font-size: 12px; flex: 1; justify-content: center; }
.gen-mono { font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* Титулованный бокс (товары по нишам, стиль фото) */
.titled-box { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 16px 18px; }
.box-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.box-head h4 { margin: 0; font-size: 14.5px; font-weight: 700; }
.box-head .b-state { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.box-head .b-state.std { color: var(--accent); }
.collapse-row { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer; padding: 8px 0; }
.collapse-row:hover { color: var(--accent); }
.collapse-row svg { width: 14px; height: 14px; }
.step-label { font-size: 13px; color: var(--text-2); margin: 4px 0 0; }

.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.gap-sm { gap: 7px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.divider { height: 1px; background: var(--line); margin: 4px 0; }
[hidden] { display: none !important; }
.screen { display: none; }
.screen.active { display: block; }

/* ===========================================================================
   СОВМЕСТИМОСТЬ С РАБОЧИМ app.js — графики на живых данных и модальные окна.
   Дизайн-система выше (v2) описывает svg-графики, рисуемые из data-pts; здесь —
   механизм [data-chart][data-series], который уже подключён к данным из БД,
   плюс модалки стратегий/гипотез. Цвета берутся из тех же переменных.
   =========================================================================== */
.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; margin-bottom: 18px; }
.chart-card { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 14px 16px; }
.chart-card .mc-title, .chart-card .chart-title { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 10px; }
.chart-card .chart-title svg { width: 14px; height: 14px; color: var(--muted); }
.chart-box { width: 100%; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-empty { color: var(--muted); font-size: 12px; padding: 18px 4px; text-align: center; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: var(--accent-soft); stroke: none; }
.chart-dot { fill: var(--panel); stroke: var(--accent); stroke-width: 2; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-axis { fill: var(--muted); font-size: 12px; font-family: var(--mono); }

/* Спарклайн внутри таблиц/карточек */
.spark { width: 120px; height: 30px; display: inline-block; vertical-align: middle; }
.spark .chart-svg { height: 30px; }
.spark .chart-empty { padding: 0; font-size: 10px; }

/* Модальные окна (стратегии, гипотезы) */
.modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
body.modal-open { overflow: hidden; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .45); }
.modal-card { position: relative; z-index: 1; width: 100%; max-width: 520px; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); padding: 22px 24px; max-height: 86vh; overflow: auto; }
.modal-x { position: absolute; top: 12px; right: 12px; background: none; border: none; color: var(--muted); cursor: pointer; padding: 4px; }
.modal-x:hover { color: var(--red); }
.modal-x svg { width: 22px; height: 22px; }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.modal-head h3 { margin: 0; font-size: 18px; font-weight: 700; }
.detail-dl { margin: 14px 0 0; }
.detail-dl dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; margin-top: 12px; }
.detail-dl dd { margin: 3px 0 0; font-size: 13.5px; line-height: 1.5; }

/* ===========================================================================
   СЛОЙ СОВМЕСТИМОСТИ СО СТАРЫМИ ЭКРАНАМИ
   Эти классы дизайн-система v2 не переописывает; берём их из прежней версии,
   но они используют те же CSS-переменные → автоматически перекрашиваются в новую
   тему. Так вторичные экраны (таблицы, разборы, доски) не «облезают», пока
   витринные экраны Авитолога переписаны под новый дизайн.
   =========================================================================== */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { padding: 11px 14px; text-align: left; vertical-align: middle; color: var(--text-2); }
.data-table thead th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; border-bottom: 1px solid var(--line-2); position: sticky; top: 0; background: var(--panel-2); }
.data-table tbody tr { border-bottom: 1px solid var(--line); transition: background .1s; }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-soft); }
.cell-img img { width: 60px; height: 46px; object-fit: cover; border-radius: 6px; display: block; background: var(--bg-soft); }
.cell-price { font-weight: 600; white-space: nowrap; font-family: var(--mono); font-size: 12.5px; color: var(--text); }
.cell-addr { max-width: 200px; color: var(--muted); }
.cell-date { color: var(--muted); white-space: nowrap; font-size: 12px; font-family: var(--mono); }
.cell-title { max-width: 340px; font-weight: 500; }
.delta-up { color: var(--red); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-weight: 600; font-family: var(--mono); }
.delta-down { color: var(--green); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-weight: 600; font-family: var(--mono); }
.delta-up svg, .delta-down svg { width: 13px; height: 13px; }

.table-tools { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.search-box { position: relative; flex: 0 1 320px; }
.search-box svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--faint); pointer-events: none; }
.search-box input { padding-left: 34px; }
.table-tools .count, .count { color: var(--muted); font-size: 12.5px; }

.auth-error { background: var(--red-soft); border: 1px solid var(--red-line); color: var(--red); padding: 10px 13px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; }

.demo-badge { display: inline-flex; align-items: center; gap: 7px; background: var(--amber-soft); color: var(--amber); border: 1px solid var(--amber-line); border-radius: var(--radius-sm); padding: 7px 12px; font-size: 12px; font-weight: 600; margin-bottom: 18px; }
.demo-badge svg { width: 15px; height: 15px; }

.kpi-sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.kpi-sub.up { color: var(--green); }
.kpi-sub.down { color: var(--red); }

.attention { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.att-item { display: flex; align-items: center; gap: 12px; padding: 12px 15px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--panel); font-size: 13.5px; box-shadow: var(--shadow-card); }
.att-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.att-item.risk { border-color: var(--red-line); background: var(--red-soft); color: var(--red); }
.att-item.move { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-ink); }
.att-item.approve { border-color: var(--green-line); background: var(--green-soft); color: var(--green); }
.att-item .att-go { margin-left: auto; display: inline-flex; opacity: .6; }
.att-item .att-go svg { width: 16px; height: 16px; }

.nav-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.nav-card { display: flex; align-items: center; gap: 14px; padding: 18px 20px; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow-card); transition: border-color .12s, box-shadow .12s, transform .1s; }
.nav-card:hover { border-color: var(--accent-line); box-shadow: var(--shadow-pop); transform: translateY(-1px); }
.nav-card .nc-ico { width: 44px; height: 44px; border-radius: 11px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex-shrink: 0; }
.nav-card .nc-ico svg { width: 22px; height: 22px; }
.nav-card h3 { margin: 0 0 3px; font-size: 15.5px; font-weight: 700; }
.nav-card p { margin: 0; color: var(--muted); font-size: 12.5px; }

.strat-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.strat-tag { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--accent-soft); color: var(--accent-ink); border: 1px solid var(--accent-line); }
.tag-muted { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--bg-soft); color: var(--muted); border: 1px solid var(--line-2); }
.chip-n { font-family: var(--mono); opacity: .7; margin-left: 2px; }

.comp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.comp-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 7px; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow-card); transition: border-color .12s, box-shadow .12s; }
.comp-card:hover { border-color: var(--accent-line); box-shadow: var(--shadow-pop); }
.comp-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.comp-top h3 { margin: 0; font-size: 15px; font-weight: 700; }
.comp-top h3 a { color: var(--text); }
.comp-top h3 a:hover { color: var(--accent); }
.comp-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.comp-stat { font-size: 12px; display: flex; align-items: baseline; gap: 6px; }
.comp-stat .v { font-weight: 600; font-family: var(--mono); font-size: 13.5px; color: var(--text); }
.comp-stat .k { color: var(--muted); font-size: 10.5px; }
.comp-share-row { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-bottom: 3px; }
.comp-share-row strong { color: var(--text); font-family: var(--mono); }
.mini-bar { height: 6px; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--line); overflow: hidden; }
.mini-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.comp-spark-wrap { display: flex; align-items: center; gap: 8px; }
.comp-spark-label { font-size: 9.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.comp-spark { height: 30px; }
.comp-cta { font-size: 12px; font-weight: 600; color: var(--accent); display: inline-flex; align-items: center; gap: 6px; }
.comp-cta svg { width: 14px; height: 14px; }

.timeline { position: relative; padding-left: 26px; margin: 8px 0; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 4px; bottom: 4px; width: 2px; background: var(--line-2); }
.tl-item { position: relative; padding: 0 0 18px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ""; position: absolute; left: -22px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--panel); border: 2px solid var(--accent); }
.tl-item.win::before { border-color: var(--green); background: var(--green); }
.tl-item.replace::before { border-color: var(--red); background: var(--red); }
.tl-kind { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.tl-title { font-weight: 600; font-size: 14px; margin: 2px 0; }
.tl-note { color: var(--muted); font-size: 12.5px; }
.result-win { color: var(--green); font-weight: 600; }
.result-neutral { color: var(--muted); font-weight: 600; }
.result-bad { color: var(--red); font-weight: 600; }

.filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filter-label { color: var(--muted); font-size: 12.5px; font-weight: 600; margin-right: 4px; }

.ev-row { display: flex; gap: 14px; align-items: baseline; padding: 11px 16px; border-top: 1px solid var(--line); }
.ev-row:first-child { border-top: none; }
.ev-when { color: var(--muted); font-size: 11.5px; white-space: nowrap; min-width: 130px; text-transform: uppercase; letter-spacing: .04em; }
.ev-text { font-size: 13.5px; }

.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; align-items: start; }
.board-col { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.board-head { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.board-count { background: var(--panel); border: 1px solid var(--line-2); border-radius: 999px; padding: 1px 8px; font-size: 11px; color: var(--text); }
.board-empty { color: var(--muted); font-size: 12px; text-align: center; padding: 14px 0; }
.hyp-card { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius-sm); box-shadow: var(--shadow-card); padding: 12px 13px; margin-bottom: 10px; }
.hyp-card:last-child { margin-bottom: 0; }
.hyp-card.clickable { cursor: pointer; transition: border-color .12s; }
.hyp-card.clickable:hover { border-color: var(--accent-line); }
.hyp-title { font-weight: 600; font-size: 13.5px; margin-bottom: 5px; }
.hyp-where { font-size: 11.5px; color: var(--accent); margin-bottom: 6px; }
.hyp-reason { font-size: 12px; margin-bottom: 8px; color: var(--text-2); }
.hyp-window { font-size: 12px; color: var(--muted); }

.empty-card { text-align: center; padding: 48px 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-card .empty-ico { width: 56px; height: 56px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-bottom: 6px; }
.empty-card .empty-ico svg { width: 27px; height: 27px; }
.empty-card h3 { margin: 0; font-size: 18px; font-weight: 700; }
.empty-card p { margin: 0; max-width: 460px; color: var(--muted); }
.empty-card .btn { margin-top: 12px; }

.analysis-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; margin-bottom: 9px; }
.analysis-head svg { width: 17px; height: 17px; color: var(--accent); }
.analysis-points { margin: 0; padding-left: 20px; }
.analysis-points li { font-size: 13px; margin-bottom: 4px; color: var(--text-2); }
.analysis-reason { margin: 0 0 8px; font-size: 13.5px; color: var(--text-2); }
.analysis-sub { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.analysis-lesson { margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--line-2); font-size: 13px; font-weight: 600; display: flex; gap: 7px; align-items: flex-start; }
.analysis-lesson svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; color: var(--accent); }

.market-status { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 18px; }
.ms-card { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 16px 18px; }
.ms-card.ms-up { border-color: var(--green-line); background: var(--green-soft); }
.ms-card.ms-down { border-color: var(--red-line); background: var(--red-soft); }
.ms-label { color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.ms-value { font-size: 22px; font-weight: 700; letter-spacing: -.3px; font-family: var(--mono); }
.ms-card.ms-up .ms-value { color: var(--green); }
.ms-card.ms-down .ms-value { color: var(--red); }
.ms-pct { font-family: var(--mono); margin-left: 6px; }
.ms-sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.ms-card .mini-bar { margin-top: 8px; }

.strat-table tr.row-accepted { background: var(--green-soft); }
.strat-table tr.row-accepted:hover { background: var(--green-soft); }
.strat-sub { color: var(--muted); font-size: 12.5px; }
.strat-users { font-size: 12.5px; }

.econ-store { padding: 0; margin-bottom: 12px; overflow: hidden; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow-card); }
.econ-store details > summary { list-style: none; cursor: pointer; padding: 14px 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.econ-store details > summary::-webkit-details-marker { display: none; }
.econ-store summary:hover { background: var(--bg-soft); }
.econ-store-name { font-weight: 700; font-size: 15px; flex: 1 1 240px; }
.econ-store-metrics { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--muted); }
.econ-store-metrics b { color: var(--text); font-family: var(--mono); font-weight: 600; }
.econ-store details[open] > summary { border-bottom: 1px solid var(--line); }
.econ-store .table-wrap { padding: 0 4px 4px; border: none; box-shadow: none; }

/* Вход / установка пароля — центрирование карточки (старый класс-обёртка) */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.auth-body .auth-card { max-width: 380px; width: 100
/* Вход / установка пароля — центрирование карточки (старый класс-обёртка) */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.auth-body .auth-card { max-width: 380px; width: 100%; padding: 34px 32px; }
.auth-title { margin: 0 0 16px; font-size: 22px; font-weight: 800; letter-spacing: -.3px; }
.auth-sub { margin: -8px 0 18px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.auth-submit { width: 100%; justify-content: center; margin-top: 6px; padding: 11px 15px; }

/* Хлебные крошки: последний пункт (.here) — тёмный и жирный, как в макете */
.crumbs .here { color: var(--text); font-weight: 600; }

/* Разворачивающийся блок «Требования Авито к фото» (экран Картинки) */
details.rules-toggle > summary { list-style: none; }
details.rules-toggle > summary::-webkit-details-marker { display: none; }
details.rules-toggle[open] > summary svg { transform: rotate(90deg); }
details.rules-toggle .rules-list { margin: 8px 0 2px; padding-left: 20px; line-height: 1.55; color: var(--text-2); font-size: 13px; }
details.rules-toggle .rules-list li { margin-bottom: 4px; }

/* Спарклайн в подвале карточки продавца (рисуется рабочим механизмом [data-chart]) */
.mini-spark { width: 84px; height: 26px; flex-shrink: 0; }
.mini-spark .chart-svg { height: 26px; width: 100%; }

/* Компактный мини-график в карточке (mini-card): растягиваем spark на высоту блока */
.mini-chart { width: 100%; height: 92px; display: block; }
.mini-chart .chart-svg { width: 100%; height: 92px; }
.mini-chart .chart-empty { padding: 30px 4px; }

/* Аккордеон магазинов (Экономика) на <details> */
details.shop-acc > summary { list-style: none; }
details.shop-acc > summary::-webkit-details-marker { display: none; }
details.shop-acc .shop-body { padding: 0; }
details.shop-acc .shop-body .table-scroll { padding: 0 2px 2px; }

/* Внутренности модалки стратегий */
.strat-sub { margin: 18px 0 8px; font-size: 14px; font-weight: 700; }
.strat-users { margin: 0; padding-left: 18px; line-height: 1.7; color: var(--text-2); }
.strat-users li { margin-bottom: 4px; }
.strat-status-form { display: flex; flex-direction: column; gap: 10px; }
.rec-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ===== Пояснения происхождения данных (шаг 5: плашки, метки, подписи) ===== */
.rule-banner { display: flex; gap: 11px; align-items: flex-start; background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--radius); padding: 12px 15px; margin-bottom: 18px; }
.rule-banner > svg { width: 18px; height: 18px; color: var(--accent); flex: 0 0 auto; margin-top: 1px; }
.rule-banner .rb-body { font-size: 12.5px; line-height: 1.5; }
.rule-banner .rb-body strong { display: block; font-weight: 700; margin-bottom: 2px; color: var(--accent-ink); }
.rule-banner .rb-body span { color: var(--muted); }

.marks { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mark { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; line-height: 1.5; white-space: nowrap; border: 1px solid transparent; cursor: default; }
.mark-ok { background: var(--green-soft); color: var(--green); border-color: var(--green-line); }
.mark-accent { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-line); }
.mark-warn { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-line); }
.mark-muted { background: var(--bg-soft); color: var(--muted); border-color: var(--line-2); }

.caption { display: block; color: var(--muted); font-size: 11px; font-weight: 400; margin-top: 3px; line-height: 1.4; }

.prov-service { margin-top: 14px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 16px; }
.prov-service .ps-title { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 10px; }
.prov-service .ps-title svg { width: 14px; height: 14px; }
.prov-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 2px 22px; }
.prov-grid > div { font-size: 12.5px; display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding: 5px 0; }
.prov-grid .k { color: var(--muted); }
.prov-grid .v { font-weight: 600; font-family: var(--mono); text-align: right; }
.prov-grid .prov-wide { grid-column: 1 / -1; }

/* Рейтинг лидеров: подсветка строк авто-топа (важные) */
.data-table tr.row-top td { background: var(--accent-soft); }
.data-table tr.row-top td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
