/* ════════════════════════════════════════════════════════════════════
   МОДУЛЬ «Анализ конкурентов»
   Все классы префиксованы `.comp-*`, чтобы не пересекались с глобальными
   `.pill`, `.btn`, `.card` системы. Дизайн-токены модуля локальные —
   объявлены прямо в .comp-root, чтобы не загрязнять глобальный :root.
   ════════════════════════════════════════════════════════════════════ */

#tab-competitors .comp-root {
    /* ── Калибровка под эталон Stitch (Executive Suite), СВЕТЛАЯ тема ──
       Та же палитра, что у паспорта: холодная бумага #F8F9FB, серый текст
       #6A7180, индиго-акцент #373A67, приглушённые статусы (шалфей/кирпич/
       индиго). Scoped к #tab-competitors .comp-root — глобальный апп не
       задет. Тёмные значения — в блоке [data-theme="dark"] ниже. */
    --c-ink:     #181B26;          /* text-primary */
    --c-ink-2:   #2D3142;
    --c-muted:   #6A7180;          /* text-secondary */
    --c-muted-2: #9AA1AE;          /* status-not-started */
    --c-line:    #E3E7EE;          /* border */
    --c-line-2:  #ECEEF3;
    --c-bg:      #F8F9FB;          /* page-bg */
    --c-white:   #FFFFFF;          /* surface */

    --c-us:      #373A67;   /* primary — наш продукт */
    --c-us-bg:   #ECECF5;   /* accent-tint */
    --c-good:    #4E8A6A;   /* status-completed — шалфей */
    --c-good-bg: #E4F0EA;
    --c-bad:     #9A3324;   /* status-overdue — кирпич */
    --c-bad-bg:  #F4E7E3;
    --c-neut:    #8A6D2E;   /* tertiary — мягкий амбер */
    --c-neut-bg: #F2ECDB;
    --c-info:    #4E5180;   /* status-in-progress — индиго */
    --c-info-bg: #ECECF5;

    --c-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);

    color: var(--c-ink);
    font-size: var(--text-base);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    background: var(--c-bg);
    min-height: 100%;
    padding-bottom: 60px;
}

/* ── Калибровка под эталон Stitch, ТЁМНАЯ тема ──
   Значения из Stitch dark tailwind.config: фон #161826, поверхность
   #1F2233, граница #343852, текст #E8E9F0/#9CA1B4, осветлённые статусы. */
[data-theme="dark"] #tab-competitors .comp-root {
    --c-ink:     #E8E9F0;
    --c-ink-2:   #C8CBDA;
    --c-muted:   #9CA1B4;
    --c-muted-2: #7E8398;
    --c-line:    #343852;
    --c-line-2:  #2A2E45;
    --c-bg:      #161826;
    --c-white:   #1F2233;

    --c-us:      #8589C7;
    --c-us-bg:   #24263A;
    --c-good:    #6FB089;
    --c-good-bg: rgba(111, 176, 137, 0.16);
    --c-bad:     #CF5B45;
    --c-bad-bg:  rgba(207, 91, 69, 0.16);
    --c-neut:    #CBB06A;
    --c-neut-bg: rgba(203, 176, 106, 0.16);
    --c-info:    #8589C7;
    --c-info-bg: #24263A;

    --c-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.40);
}

/* ── Layout: content + sticky actions-rail ───────────────────────── */
.comp-content-grid {
    display: grid;
    grid-template-columns: 1fr 232px;
    gap: var(--space-6);
    padding: 20px 32px 0;
    align-items: start;
}
.comp-content-main { min-width: 0; }
.comp-actions-rail { position: sticky; top: 16px; align-self: start; }

/* ── Subtab navigation ───────────────────────────────────────────── */
.comp-subtabs {
    background: var(--c-bg);
    padding: 0 32px;
    display: flex;
    gap: var(--space-2);
    border-bottom: 1px solid var(--c-line);
}
.comp-subtab {
    border: 1px solid transparent;
    border-bottom: 0;
    background: transparent;
    padding: 8px 12px 8px;
    font: inherit;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--c-muted);
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: -1px;
    white-space: nowrap;
}
.comp-subtab:hover { color: var(--c-ink); }
.comp-subtab.is-active {
    background: var(--c-white);
    color: var(--c-ink);
    border-color: var(--c-line);
    border-bottom-color: var(--c-white);
    font-weight: 600;
}

/* ── Actions rail (sticky right column) ──────────────────────────── */
.comp-rail-eyebrow {
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--c-muted);
    margin-bottom: 10px;
}
.comp-rail-list { display: flex; flex-direction: column; gap: var(--space-2); }
.comp-rail-btn {
    border: 1px solid var(--c-line);
    background: var(--c-white);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    font: inherit;
    font-size: var(--text-sm);
    color: var(--c-ink);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    text-align: left;
}
.comp-rail-btn:hover { background: var(--c-line-2); }
.comp-rail-btn svg { color: var(--c-muted); flex-shrink: 0; }
.comp-rail-version {
    background: var(--c-white);
    border: 1px solid var(--c-line);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    line-height: 1.45;
}
.comp-rv-num  { font-size: var(--text-sm);   font-weight: 600; }
.comp-rv-meta { font-size: var(--text-xs); color: var(--c-muted); }

/* ── Cards / padding utilities ───────────────────────────────────── */
.comp-card {
    background: var(--c-white);
    border: 1px solid var(--c-line);
    border-radius: var(--radius-lg);
}
.comp-pad-lg { padding: 20px 24px; }
.comp-pad-md { padding: var(--space-4); }
.comp-pad-sm { padding: var(--space-3); }

/* ── Buttons ─────────────────────────────────────────────────────── */
.comp-btn {
    border: 1px solid var(--c-line);
    background: var(--c-white);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--c-ink);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}
.comp-btn:hover { background: var(--c-line-2); }
.comp-btn.is-primary {
    background: var(--c-ink-2);
    color: var(--c-white);
    border-color: var(--c-ink-2);
}
.comp-btn.is-primary:hover { background: #1F1F37; }
.comp-btn.is-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--c-muted);
}
.comp-btn.is-ghost:hover { background: var(--c-line-2); color: var(--c-ink); }
.comp-btn.is-sm { padding: var(--space-2); font-size: var(--text-xs); }

/* ── Pills (small uppercase badges) ──────────────────────────────── */
.comp-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    background: var(--c-line-2);
    color: var(--c-muted);
}
.comp-pill .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.comp-pill.is-us   { background: var(--c-us-bg);   color: var(--c-us); }
.comp-pill.is-good { background: var(--c-good-bg); color: var(--c-good); }
.comp-pill.is-bad  { background: var(--c-bad-bg);  color: var(--c-bad); }
.comp-pill.is-neut { background: var(--c-neut-bg); color: var(--c-neut); }
.comp-pill.is-info { background: var(--c-info-bg); color: var(--c-info); }
/* Cased label (sentence-case вместо UPPERCASE) для категорий и плотных мест */
.comp-pill.is-cased { text-transform: none; letter-spacing: normal; font-weight: 600; }

/* ── Eyebrow + headings (типографика) ────────────────────────────── */
.comp-eyebrow {
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--c-muted);
}
.comp-h2 { font-size: var(--text-md); font-weight: 600; margin: var(--space-0); }
.comp-h3 { font-size: var(--text-sm); font-weight: 600; margin: var(--space-0); color: var(--c-ink-2); }

/* ── Logo bubble (инициалы на цветном фоне) ──────────────────────── */
.comp-logo {
    width: 36px; height: 36px;
    border-radius: var(--radius-md);
    background: var(--c-line-2);
    color: var(--c-white);
    font-weight: 700;
    font-size: var(--text-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.comp-logo.is-sm { width: 26px; height: 26px; border-radius: var(--radius-sm); font-size: var(--text-xs); }
.comp-logo.is-lg { width: 52px; height: 52px; border-radius: var(--radius-lg); font-size: var(--text-base); }

/* Категорийные бейджи (используются вместе с .comp-pill.is-cased) */
.comp-cat-direct    { background: var(--c-bad-bg);  color: var(--c-bad); }
.comp-cat-indirect  { background: var(--c-info-bg); color: var(--c-info); }
.comp-cat-potential { background: var(--c-neut-bg); color: var(--c-neut); }

/* ── Input ───────────────────────────────────────────────────────── */
.comp-input {
    border: 1px solid var(--c-line);
    background: var(--c-white);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: var(--text-sm);
    color: var(--c-ink);
    width: 100%;
}
.comp-input:focus {
    outline: none;
    border-color: var(--c-ink-2);
    box-shadow: 0 0 0 3px rgba(45, 45, 74, 0.08);
}
.comp-input::placeholder { color: var(--c-muted-2); }

.comp-divider { height: 1px; background: var(--c-line); }

.comp-root a { color: var(--c-info); text-decoration: none; }
.comp-root a:hover { text-decoration: underline; }

/* ── NEW-бейдж в сайдбаре (рядом с пунктом «Анализ конкурентов») ── */
.side-link .side-new-badge {
    display: inline-block;
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.06em;
    background: var(--c-neut, #C77B2E);
    color: #fff;
    padding: 2px 4px;
    border-radius: var(--radius-xs);
    margin-left: 6px;
    vertical-align: middle;
}

/* ── CompetitorTag (мини-лого + short) ───────────────────────────── */
.comp-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 2px 8px 2px 3px;
    background: var(--c-white);
    border: 1px solid var(--c-line);
    border-radius: var(--radius-pill);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--c-ink-2);
    line-height: 1;
}
.comp-tag-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    color: #fff;
    font-size: var(--text-xs);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ── Compare-table ячейки ────────────────────────────────────────── */
.comp-stars       { display: inline-flex; gap: 1px; }
.comp-cell-empty  { color: var(--c-muted-2); }
.comp-bool        { display: inline-flex; line-height: 1; }
.comp-bool-yes    { color: var(--c-good); }
.comp-bool-no     { color: var(--c-bad); font-size: var(--text-lg); font-weight: 700; }
.comp-text-cell   { font-size: var(--text-sm); }

/* ── Screen container (in-tab) ───────────────────────────────────── */
.comp-screen {
    display: block;
    min-height: 200px;
}
/* Плавная смена под-вкладок: класс навешивается заново после рендера,
   reflow в JS перезапускает анимацию. */
.comp-screen.is-switching {
    animation: comp-screen-in 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
    will-change: opacity;
}
@keyframes comp-screen-in {
    from { opacity: 0; transform: translateY(3px); }
    to   { opacity: 1; transform: translateY(0); }
}
/* Содержимое экрана проявляется отдельным отложенным слоем — только
   прозрачность, без transform (гладко на любом объёме контента). */
.comp-screen.is-switching > * {
    animation: comp-screen-rise 1s ease-out 0.1s both;
}
@keyframes comp-screen-rise {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .comp-screen.is-switching,
    .comp-screen.is-switching > * { animation: none; }
}

/* ── Overview screen ─────────────────────────────────────────────── */
.comp-overview { display: flex; flex-direction: column; gap: var(--space-4); }

.comp-insights-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.comp-insights-list {
    margin: var(--space-0);
    padding-left: 22px;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.comp-insights-list li {
    font-size: var(--text-base);
    line-height: 1.55;
    color: var(--c-ink);
}
.comp-insight-input { width: 100%; }
.comp-insight-edit-row {
    display: flex; align-items: center; gap: var(--space-2);
    list-style: decimal;
}
.comp-insight-edit-row .comp-insight-input { flex: 1; }
.comp-insight-del {
    padding: 4px 8px !important;
    min-width: 28px;
    font-size: var(--text-md) !important;
    line-height: 1 !important;
    color: var(--c-muted);
}
.comp-insight-del:hover { color: var(--c-bad); background: var(--c-bad-bg) !important; }
.comp-insight-add-row { list-style: none; margin-top: 6px; }

.comp-methods-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
}
.comp-method-tile {
    background: var(--c-white);
    border: 1px solid var(--c-line);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    cursor: pointer;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    font: inherit;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.comp-method-tile:hover {
    border-color: var(--c-ink-2);
    box-shadow: var(--c-shadow-sm);
}
.comp-method-tile-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-2);
}
.comp-method-tile-sub {
    font-size: var(--text-xs);
    color: var(--c-muted);
    margin-top: 2px;
}

.comp-mini { display: flex; flex-direction: column; gap: var(--space-2); min-height: 110px; justify-content: center; }
.comp-mini-row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); }
.comp-mini-num { font-size: var(--text-3xl); font-weight: 700; color: var(--c-ink); line-height: 1; }
.comp-mini-num--us { color: var(--c-us); }
.comp-mini-label { font-size: var(--text-xs); color: var(--c-muted); }
.comp-mini-pills { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.comp-mini-svg { width: 100%; height: 110px; display: block; }

.comp-mini-swot {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-1);
    height: 110px;
}
.comp-mini-swot-cell {
    border-radius: var(--radius-xs);
    padding: var(--space-2);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.comp-mini-swot-label { font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.08em; }
.comp-mini-swot-num   { font-size: var(--text-2xl);  font-weight: 700; line-height: 1; }

.comp-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.comp-hypotheses { display: flex; flex-direction: column; gap: var(--space-2); }
.comp-hypothesis {
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;
    cursor: pointer;
    transition: border-color .12s ease;
}
.comp-hypothesis:hover { border-color: var(--c-ink-2); }
.comp-hypothesis-tail {
    display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0;
}
.comp-hypo-del {
    padding: 4px 8px !important;
    min-width: 28px;
    font-size: var(--text-md) !important;
    line-height: 1 !important;
    color: var(--c-muted);
}
.comp-hypo-del:hover { color: var(--c-bad); background: var(--c-bad-bg) !important; }
.comp-hypothesis-body { flex: 1; }
.comp-hypothesis-text { font-size: var(--text-base); line-height: 1.5; color: var(--c-ink); }
.comp-hypothesis-meta {
    display: flex;
    gap: var(--space-3);
    margin-top: 8px;
    font-size: var(--text-xs);
    color: var(--c-muted);
}

@media (max-width: 1024px) {
    .comp-methods-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .comp-methods-grid { grid-template-columns: 1fr; }
}

/* ── List screen ─────────────────────────────────────────────────── */
.comp-list-screen {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: var(--space-4);
    align-items: start;
}
.comp-list-side {
    overflow: hidden;
    position: sticky;
    top: 22px;
    max-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
}
.comp-list-header {
    padding: var(--space-3);
    border-bottom: 1px solid var(--c-line);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.comp-search { position: relative; }
.comp-search-icon {
    position: absolute;
    left: 9px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--c-muted-2);
    line-height: 0;
}
.comp-search .comp-input { padding-left: 32px; }
.comp-filter-row { display: flex; gap: var(--space-1); }
.comp-filter-btn {
    flex: 1;
    justify-content: center;
    padding: 8px 4px;
    font-size: var(--text-xs);
}
.comp-list-add { justify-content: center; }
.comp-list-items {
    flex: 1;
    overflow-y: auto;
}
.comp-list-item {
    all: unset;
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3);
    border-bottom: 1px solid var(--c-line);
    border-left: 3px solid transparent;
    cursor: pointer;
    background: transparent;
}
.comp-list-item:hover { background: var(--c-line-2); }
.comp-list-item.is-active {
    background: var(--c-us-bg);
    border-left-color: var(--c-us);
}
.comp-list-item-body { flex: 1; min-width: 0; }
.comp-list-item-top {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: 3px;
}
.comp-list-item-name {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--c-ink);
}
.comp-list-item-desc {
    font-size: var(--text-xs);
    color: var(--c-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.comp-list-item-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    font-size: var(--text-xs);
    color: var(--c-muted-2);
}
.comp-list-item-date { color: var(--c-muted-2); }
.comp-list-empty {
    padding: 24px 16px;
    color: var(--c-muted);
    font-size: var(--text-sm);
    text-align: center;
}

/* ── Dossier ─────────────────────────────────────────────────────── */
.comp-dossier { display: flex; flex-direction: column; gap: var(--space-4); }
.comp-dossier-head-row {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
}
.comp-dossier-head-body { flex: 1; }
.comp-dossier-head-actions {
    display: flex; flex-direction: column; gap: var(--space-2); align-items: stretch;
    flex-shrink: 0;
}
.comp-dossier-del { color: var(--c-bad) !important; }
.comp-dossier-del:hover { background: var(--c-bad-bg) !important; }
.comp-dossier-more {
    width: 100%;
    justify-content: center;
    padding: 6px 10px !important;
}

/* «…»-меню досье */
.comp-dossier-menu {
    position: absolute;
    z-index: 1500;
    background: var(--c-white);
    border: 1px solid var(--c-line);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 32px rgba(20, 20, 40, 0.14);
    padding: var(--space-2);
    display: flex; flex-direction: column;
    min-width: 180px;
}
.comp-dossier-menu-item {
    display: flex; align-items: center; gap: var(--space-2);
    padding: 8px 12px;
    background: transparent; border: none; border-radius: var(--radius-sm);
    cursor: pointer; font-family: inherit; font-size: var(--text-sm);
    color: var(--c-ink);
    text-align: left;
}
.comp-dossier-menu-item:hover { background: var(--c-line-2); }
.comp-dossier-menu-item svg { color: var(--c-muted); flex-shrink: 0; }
.comp-dossier-menu-item:hover svg { color: var(--c-ink-2); }

/* Empty-state для модалок досье */
.comp-empty-block {
    padding: 24px 12px;
    text-align: center;
    color: var(--c-muted);
    font-size: var(--text-sm);
}

/* Empty-state для сравнения, когда конкурентов ещё нет:
   показываем 4 группы критериев как методологический референс. */
.comp-cmp-empty-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-3);
    margin: 20px 0 24px;
    text-align: left;
}
.comp-cmp-empty-group {
    background: var(--c-bg, #F5F5F7);
    border: 1px solid var(--c-line, #E8E8EE);
    border-radius: var(--radius-lg);
    padding: var(--space-3);
}
.comp-cmp-empty-group-title {
    font-size: var(--text-xs); font-weight: 600; letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--c-muted, #6E6E83);
    margin-bottom: 8px;
}
.comp-cmp-empty-list {
    margin: var(--space-0); padding: var(--space-0); list-style: none;
    display: flex; flex-direction: column; gap: var(--space-1);
}
.comp-cmp-empty-list li {
    font-size: var(--text-sm);
    color: var(--c-ink, #1A1A2E);
    padding-left: 14px;
    position: relative;
    line-height: 1.45;
}
.comp-cmp-empty-list li::before {
    content: "·";
    position: absolute;
    left: 4px;
    color: var(--c-muted-2, #9999AA);
    font-weight: 700;
}
.comp-cmp-go-list { margin-top: 8px; }

.comp-dossier-modal-toolbar {
    display: flex; gap: var(--space-2); align-items: center;
    margin-bottom: 14px;
}

/* Список файлов в модалке */
.comp-files-list {
    display: flex; flex-direction: column; gap: var(--space-2);
}
.comp-file-row {
    display: grid;
    grid-template-columns: 22px 1fr auto auto;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2);
    background: var(--c-line-2);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
}
.comp-file-row-icon { display: inline-flex; }
.comp-file-row-name { color: var(--c-ink); font-weight: 500; }
.comp-file-row-size { color: var(--c-muted-2); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--text-xs); }
.comp-file-row-date { color: var(--c-muted); font-size: var(--text-xs); }

/* Форма ввода комментария */
.comp-comments-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--space-2);
    margin-bottom: 14px;
    align-items: stretch;
}
.comp-comments-form .comp-input { resize: vertical; }
.comp-comments-form .comp-btn { align-self: flex-end; }

/* Комментарии — широкие карточки на всю ширину */
.comp-comments-list {
    display: flex; flex-direction: column; gap: var(--space-2);
}
.comp-comment-card {
    background: var(--c-white);
    border: 1px solid var(--c-line);
    border-radius: var(--radius-lg);
    padding: 8px 12px;
    display: flex; flex-direction: column; gap: var(--space-2);
}
.comp-comment-card.is-user   { border-left: 3px solid var(--c-info); background: #FCFDFF; }
.comp-comment-card.is-system { border-left: 3px solid var(--c-line); background: var(--c-line-2); }
.comp-comment-head {
    display: flex; align-items: center; gap: var(--space-2);
    font-size: var(--text-xs);
    flex-wrap: wrap;
}
.comp-comment-author { font-weight: 600; color: var(--c-ink-2); }
.comp-comment-date {
    margin-left: auto;
    color: var(--c-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: var(--text-xs);
}
.comp-comment-del {
    background: transparent; border: none; cursor: pointer;
    width: 22px; height: 22px;
    color: var(--c-muted-2);
    border-radius: var(--radius-xs);
    font-size: var(--text-base); line-height: 1;
    opacity: 0; transition: opacity .12s ease;
    margin-left: 4px;
}
.comp-comment-card:hover .comp-comment-del { opacity: 1; }
.comp-comment-del:hover { color: var(--c-bad); background: var(--c-bad-bg); }
.comp-comment-text {
    font-size: var(--text-sm); line-height: 1.5; color: var(--c-ink);
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* Заметки */
.comp-notes-wrap { display: flex; flex-direction: column; gap: var(--space-2); }
.comp-notes-input {
    min-height: 200px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
}
.comp-notes-status {
    font-size: var(--text-xs);
    color: var(--c-muted);
    text-align: right;
    min-height: 14px;
}
.comp-dossier-head-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: 4px;
}
.comp-dossier-head-title .comp-h2 { font-size: var(--text-xl); }
.comp-dossier-head-meta {
    display: flex;
    gap: var(--space-3);
    align-items: center;
    margin-bottom: 10px;
}
.comp-dossier-site {
    font-size: var(--text-sm);
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}
.comp-dossier-desc {
    font-size: var(--text-base);
    line-height: 1.55;
}
.comp-dossier-text {
    font-size: var(--text-sm);
    line-height: 1.55;
}

.comp-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}
.comp-products { display: flex; flex-direction: column; gap: var(--space-2); }
.comp-product-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    border: 1px solid var(--c-line);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
}
.comp-product-price { color: var(--c-muted); }

.comp-strengths  { border-top: 3px solid var(--c-good); }
.comp-weaknesses { border-top: 3px solid var(--c-bad); }
.comp-points {
    margin: var(--space-0);
    padding-left: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.comp-points li {
    display: flex;
    gap: var(--space-2);
    font-size: var(--text-sm);
    line-height: 1.5;
}
.comp-bullet { flex-shrink: 0; margin-top: 2px; line-height: 0; }
.comp-bullet-good { color: var(--c-good); }
.comp-bullet-bad  { color: var(--c-bad); font-size: var(--text-md); line-height: 16px; margin-top: 0; font-weight: 700; }

.comp-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.comp-sources { display: flex; flex-direction: column; gap: var(--space-2); }
.comp-source-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2);
    border: 1px solid var(--c-line);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
}
.comp-source-row a {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}
.comp-source-date { color: var(--c-muted); }

.comp-files { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.comp-file-chip {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2);
    border: 1px solid var(--c-line);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
}
.comp-file-chip-size { color: var(--c-muted-2); }

.comp-log { display: flex; flex-direction: column; }
.comp-log-row {
    display: grid;
    grid-template-columns: 84px 140px 1fr;
    gap: var(--space-3);
    padding: 8px 0;
    border-bottom: 1px solid var(--c-line);
    font-size: var(--text-sm);
}
.comp-log-row.is-last { border-bottom: none; }
.comp-log-date   { color: var(--c-muted); }
.comp-log-author { color: var(--c-ink-2); }
.comp-log-text   { color: var(--c-ink); }

@media (max-width: 1024px) {
    .comp-list-screen { grid-template-columns: 1fr; }
    .comp-list-side {
        position: static;
        max-height: none;
    }
    .comp-list-items { max-height: 400px; }
    .comp-grid-2 { grid-template-columns: 1fr; }
    .comp-log-row { grid-template-columns: 84px 1fr; }
    .comp-log-author { display: none; }
}

/* ── Compare screen ──────────────────────────────────────────────── */
.comp-cmp { display: flex; flex-direction: column; gap: var(--space-3); }
.comp-cmp-toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}
.comp-cmp-toolbar-label {
    font-size: var(--text-xs);
    color: var(--c-muted);
    margin-right: 6px;
}
.comp-cmp-wrap { overflow: hidden; }
.comp-cmp-scroll { overflow-x: auto; }
.comp-cmp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}
.comp-cmp-head-criterion {
    position: sticky;
    left: 0;
    background: var(--c-white);
    border-bottom: 2px solid var(--c-line);
    border-right: 1px solid var(--c-line);
    padding: 12px 16px;
    text-align: left;
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--c-muted);
    min-width: 240px;
    z-index: 1;
}
.comp-cmp-head-col {
    background: var(--c-white);
    border-bottom: 2px solid var(--c-line);
    border-right: 1px solid var(--c-line);
    padding: 8px 12px;
    text-align: center;
    min-width: 120px;
}
.comp-cmp-head-col.is-us {
    background: var(--c-us-bg);
    border-bottom-color: var(--c-us);
}
.comp-cmp-col-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
}
.comp-cmp-col-name {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--c-ink);
    line-height: 1.3;
}
.comp-cmp-col-name.is-us { color: var(--c-us); }

.comp-cmp-row-label {
    position: sticky;
    left: 0;
    background: var(--c-white);
    border-bottom: 1px solid var(--c-line);
    border-right: 1px solid var(--c-line);
    padding: 8px 16px;
    font-size: var(--text-sm);
    color: var(--c-ink-2);
    z-index: 1;
}
.comp-cmp-cell {
    padding: 8px 12px;
    border-bottom: 1px solid var(--c-line);
    border-right: 1px solid var(--c-line);
    text-align: center;
    vertical-align: middle;
}
.comp-cmp-cell.is-us { background: rgba(74, 61, 154, 0.045); }
.comp-cmp-cell--editable { cursor: pointer; transition: background 0.12s ease; }
.comp-cmp-cell--editable:hover { background: rgba(74, 61, 154, 0.06); }
/* Лидер строки — мягкая отметка --dusk (CompetitorsLogic.rowLeaders). */
.comp-cmp-cell.is-leader {
    background: var(--dusk-tint);
    box-shadow: inset 0 0 0 1.5px var(--dusk);
    border-radius: 6px;
}
.comp-cmp-cell.is-leader.is-us { background: var(--dusk-tint); }

.comp-cmp-group-row {
    cursor: pointer;
}
.comp-cmp-group-row > td {
    background: var(--c-bg);
    padding: 8px 16px;
    border-bottom: 1px solid var(--c-line);
}
.comp-cmp-group-head {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--c-ink-2);
}
.comp-cmp-chev {
    display: inline-block;
    transition: transform .15s ease;
}
.comp-cmp-chev.is-closed { transform: rotate(-90deg); }
.comp-cmp-group-count { color: var(--c-muted-2); font-weight: 500; }

.comp-cmp-legend {
    display: flex;
    gap: var(--space-3);
    font-size: var(--text-xs);
    color: var(--c-muted);
    padding: 0 4px;
}
.comp-cmp-legend > span {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}

/* ── SWOT screen ─────────────────────────────────────────────────── */
.comp-swot { display: flex; flex-direction: column; gap: var(--space-5); }
.comp-swot-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}
.comp-swot-quadrant {
    border: 1px solid;
    border-radius: var(--radius-lg);
    padding: 16px 16px 12px;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    min-height: 280px;
    transition: box-shadow .12s ease;
}
.comp-swot-quadrant.is-drop-target {
    box-shadow: 0 0 0 3px rgba(45, 45, 74, 0.18);
}
.comp-swot-q-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}
.comp-swot-q-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-base);
    font-weight: 600;
}
.comp-swot-q-tag {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: var(--text-xs);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.comp-swot-q-sub {
    font-size: var(--text-xs);
    opacity: 0.75;
    margin-top: 4px;
}
.comp-swot-items {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.comp-swot-card {
    background: var(--c-white);
    border: 1px solid;
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    cursor: grab;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    user-select: none;
    position: relative;
}
.comp-swot-card-del {
    position: absolute;
    top: 4px; right: 4px;
    width: 22px; height: 22px;
    background: transparent; border: none; cursor: pointer;
    color: var(--c-muted-2);
    border-radius: var(--radius-xs);
    font-size: var(--text-base); line-height: 1;
    opacity: 0; transition: opacity .12s ease;
}
.comp-swot-card:hover .comp-swot-card-del { opacity: 1; }
.comp-swot-card-del:hover { color: var(--c-bad); background: var(--c-bad-bg); }
.comp-swot-card:active { cursor: grabbing; }
.comp-swot-card.is-dragging { opacity: 0.5; }
.comp-swot-card-text {
    font-size: var(--text-sm);
    line-height: 1.5;
    color: var(--c-ink);
}
.comp-swot-tags { display: flex; gap: var(--space-1); flex-wrap: wrap; }
.comp-swot-empty {
    text-align: center;
    color: var(--c-muted);
    font-size: var(--text-xs);
    padding: var(--space-3);
    font-style: italic;
}

/* Стратегии */
.comp-strategies-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}
.comp-strategy {
    border: 1px solid var(--c-line);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    background: var(--c-white);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.comp-strategy-head {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
}
.comp-strategy-tag {
    font-size: var(--text-xs);
    font-weight: 700;
    padding: 2px 8px;
    background: var(--c-ink-2);
    color: #fff;
    border-radius: var(--radius-xs);
    letter-spacing: 0.04em;
}
.comp-strategy-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--c-ink-2);
}
.comp-strategy-hint {
    font-size: var(--text-xs);
    color: var(--c-muted);
    line-height: 1.4;
}
.comp-strategy-input {
    border: 1px solid var(--c-line);
    border-radius: var(--radius-sm);
    padding: var(--space-2);
    font: inherit;
    font-size: var(--text-sm);
    color: var(--c-ink);
    background: var(--c-bg);
    resize: vertical;
    margin-top: 4px;
}

@media (max-width: 900px) {
    .comp-swot-grid { grid-template-columns: 1fr; }
    .comp-strategies-grid { grid-template-columns: 1fr; }
}

/* ── Map screen ──────────────────────────────────────────────────── */
.comp-map-screen { display: flex; flex-direction: column; gap: var(--space-3); }
.comp-map-tabs {
    display: flex;
    gap: var(--space-1);
    align-items: center;
    border-bottom: 1px solid var(--c-line);
}
.comp-map-tab {
    all: unset;
    cursor: pointer;
    padding: 8px 16px;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--c-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.comp-map-tab:hover { color: var(--c-ink); }
.comp-map-tab.is-active {
    color: var(--c-ink);
    border-bottom-color: var(--c-ink-2);
}
.comp-map-tab-id {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: var(--text-xs);
    color: var(--c-muted-2);
    margin-right: 6px;
}
.comp-map-new-btn { margin-left: 8px; }
.comp-map-edit-btn { margin-left: 6px; }
.comp-map-del-btn  { margin-left: 6px; color: var(--c-bad) !important; }
.comp-map-del-btn:hover { background: var(--c-bad-bg) !important; }
.comp-map-axis-name {
    background: var(--c-line-2);
    border-radius: var(--radius-md);
    padding: var(--space-2);
    font-size: var(--text-sm);
    color: var(--c-ink);
    font-weight: 500;
}

.comp-map-body {
    display: grid;
    grid-template-columns: 1fr 240px;
    gap: var(--space-4);
    align-items: start;
}

.comp-map-axes {
    display: flex;
    gap: var(--space-3);
    margin-bottom: 14px;
}
.comp-map-axis { flex: 1; }
.comp-map-axis-range {
    display: flex;
    justify-content: space-between;
    font-size: var(--text-xs);
    color: var(--c-muted);
    margin-top: 4px;
}

.comp-map-plot {
    position: relative;
    aspect-ratio: 16 / 11;
    background: var(--c-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--c-line);
    overflow: hidden;
    touch-action: none;
}

/* Сетка: Y-шкала слева, плот, X-шкала снизу, единица «%». */
.comp-map-plot-grid {
    display: grid;
    grid-template-columns: 32px 1fr 18px;
    grid-template-rows: 1fr 22px 14px;
    grid-template-areas:
        "yscale plot   yunit"
        "yblank xscale yblank2"
        "yblank xunit  yblank3";
    gap: 4px;
    align-items: stretch;
}
.comp-map-plot-grid > .comp-map-plot { grid-area: plot; aspect-ratio: auto; }
.comp-map-y-scale {
    grid-area: yscale;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
    font-size: 10px;
    color: var(--c-muted);
    padding-right: 4px;
    font-variant-numeric: tabular-nums;
}
.comp-map-x-scale {
    grid-area: xscale;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 10px;
    color: var(--c-muted);
    padding-top: 2px;
    font-variant-numeric: tabular-nums;
}
.comp-map-y-unit {
    grid-area: yunit;
    font-size: 10px;
    color: var(--c-muted);
    align-self: end;
    justify-self: center;
}
.comp-map-x-unit {
    grid-area: xunit;
    font-size: 10px;
    color: var(--c-muted);
    text-align: center;
}
.comp-map-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.comp-map-point {
    position: absolute;
    cursor: grab;
    user-select: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 2;
    touch-action: none;
}
.comp-map-point.is-dragging { cursor: grabbing; }
.comp-map-dot {
    border-radius: 50%;
    color: #fff;
    font-size: var(--text-xs);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(20, 20, 40, 0.18);
    border: 1.5px solid #fff;
}
.comp-map-dot.is-us {
    font-size: var(--text-xs);
    border: 2px solid #fff;
    box-shadow: 0 0 0 4px rgba(74, 61, 154, 0.18), 0 2px 8px rgba(74, 61, 154, 0.35);
}
.comp-map-point-label {
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--c-ink-2);
    margin-top: 2px;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.85);
    padding: 0 4px;
    border-radius: var(--radius-xs);
}
.comp-map-point-label.is-us { font-weight: 700; color: var(--c-us); }

.comp-map-hint {
    font-size: var(--text-xs);
    color: var(--c-muted);
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.comp-map-legend { display: flex; flex-direction: column; gap: var(--space-2); }
.comp-map-legend-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
}
.comp-map-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}
.comp-map-legend-name { flex: 1; font-weight: 500; }
.comp-map-legend-name.is-us { font-weight: 600; }
.comp-map-cats { display: flex; flex-direction: column; gap: var(--space-2); }
.comp-map-cat-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
}
.comp-map-cat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

@media (max-width: 1024px) {
    .comp-map-body { grid-template-columns: 1fr; }
}

/* ── Porter screen ───────────────────────────────────────────────── */
.comp-porter { display: flex; flex-direction: column; gap: var(--space-4); }
.comp-porter-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr 1fr;
    grid-template-rows: auto auto auto;
    gap: var(--space-4);
    align-items: stretch;
}
.comp-porter-cell-top    { grid-column: 2 / 3; grid-row: 1 / 2; }
.comp-porter-cell-left   { grid-column: 1 / 2; grid-row: 2 / 3; }
.comp-porter-cell-center { grid-column: 2 / 3; grid-row: 2 / 3; display: flex; align-items: center; justify-content: center; }
.comp-porter-cell-right  { grid-column: 3 / 4; grid-row: 2 / 3; }
.comp-porter-cell-bottom { grid-column: 2 / 3; grid-row: 3 / 4; }
.comp-porter-force { height: 100%; display: flex; flex-direction: column; gap: var(--space-2); }
.comp-porter-force-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-2);
}
.comp-porter-factors {
    margin: var(--space-0);
    padding-left: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}
.comp-porter-factors li {
    display: flex;
    gap: var(--space-2);
    font-size: var(--text-sm);
    line-height: 1.5;
}
.comp-porter-bullet {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    margin-top: 8px;
    flex-shrink: 0;
}
.comp-porter-force-text {
    font-size: var(--text-xs);
    color: var(--c-muted);
    line-height: 1.5;
    padding-top: 8px;
    border-top: 1px solid var(--c-line);
}
.comp-porter-center {
    width: 100%;
    min-height: 200px;
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--space-2);
    box-shadow: 0 4px 14px rgba(20, 20, 40, 0.06);
    text-align: center;
    align-items: center;
}
.comp-porter-center .comp-pill { align-self: center; }
.comp-porter-center-eyebrow {
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.12em;
}
.comp-porter-center-text {
    font-size: var(--text-xs);
    color: var(--c-ink-2);
    line-height: 1.5;
    margin-top: 4px;
}

.comp-porter-attractiveness {
    display: grid;
    grid-template-columns: 180px 1fr 1fr;
    gap: var(--space-5);
    align-items: center;
}
.comp-porter-donut { text-align: center; }
.comp-porter-donut-svg { width: 160px; height: 96px; }
.comp-porter-verdict { font-size: var(--text-sm); line-height: 1.5; color: var(--c-ink-2); }
.comp-porter-bars { display: flex; flex-direction: column; gap: var(--space-1); }
.comp-porter-bar-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
}
.comp-porter-bar-name {
    flex: 1;
    color: var(--c-muted);
}
.comp-porter-bar-track {
    flex: 2;
    height: 6px;
    background: var(--c-line);
    border-radius: var(--radius-xs);
    overflow: hidden;
}
.comp-porter-bar-fill {
    display: block;
    height: 100%;
}
.comp-porter-bar-label {
    width: 60px;
    text-align: right;
    font-weight: 600;
}

@media (max-width: 1024px) {
    .comp-porter-grid { grid-template-columns: 1fr; grid-template-rows: auto; }
    .comp-porter-cell-top,
    .comp-porter-cell-left,
    .comp-porter-cell-center,
    .comp-porter-cell-right,
    .comp-porter-cell-bottom { grid-column: 1 / 2; grid-row: auto; }
    .comp-porter-attractiveness { grid-template-columns: 1fr; }
}

/* ── BCG screen ──────────────────────────────────────────────────── */
.comp-bcg { display: flex; flex-direction: column; gap: var(--space-4); }
.comp-bcg-axes-grid {
    display: grid;
    grid-template-columns: 32px 1fr;
    grid-template-rows: 1fr 32px;
    gap: var(--space-2);
}
.comp-bcg-y-axis {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--text-xs);
    color: var(--c-muted);
    padding: 8px 0;
}
.comp-bcg-y-axis-name {
    font-weight: 600;
    color: var(--c-ink-2);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: var(--text-xs);
}
.comp-bcg-x-axis {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--text-xs);
    color: var(--c-muted);
    padding: 0 8px;
}
.comp-bcg-x-axis-name {
    font-weight: 600;
    color: var(--c-ink-2);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: var(--text-xs);
}

.comp-bcg-matrix {
    position: relative;
    aspect-ratio: 16 / 11;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: var(--space-1);
    background: var(--c-line);
    border-radius: var(--radius-lg);
    overflow: hidden;
    touch-action: none;
}
.comp-bcg-sector {
    padding: var(--space-3);
    position: relative;
}
.comp-bcg-sector-title {
    font-size: var(--text-sm);
    font-weight: 700;
}
.comp-bcg-sector-sub {
    font-size: var(--text-xs);
    opacity: 0.8;
}

.comp-bcg-bubble {
    position: absolute;
    cursor: grab;
    user-select: none;
    z-index: 2;
    touch-action: none;
}
.comp-bcg-bubble.is-dragging { cursor: grabbing; }
.comp-bcg-bubble-dot {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: 700;
    color: #fff;
    text-align: center;
    line-height: 1;
}
.comp-bcg-bubble-label {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: var(--text-xs);
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.85);
    padding: 0 4px;
    border-radius: var(--radius-xs);
}

.comp-bcg-hint {
    font-size: var(--text-xs);
    color: var(--c-muted);
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.comp-bcg-bottom {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: var(--space-4);
}

.comp-bcg-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}
.comp-bcg-table th {
    color: var(--c-muted);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    padding: var(--space-2);
    border-bottom: 1px solid var(--c-line);
}
.comp-bcg-th-l { text-align: left;  }
.comp-bcg-th-r { text-align: right; }
.comp-bcg-table td {
    padding: var(--space-2);
    border-bottom: 1px solid var(--c-line);
}
.comp-bcg-prod-name {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.comp-bcg-prod-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.comp-bcg-prod-label { font-weight: 500; }
.comp-bcg-prod-label.is-us { font-weight: 600; }
.comp-bcg-num,
.comp-bcg-rev {
    text-align: right;
}
.comp-bcg-actions {
    text-align: right; white-space: nowrap;
}
.comp-bcg-actions .comp-btn {
    padding: 4px 6px !important;
    min-width: 26px;
    font-size: var(--text-sm) !important;
}
.comp-bcg-del { color: var(--c-muted); }
.comp-bcg-del:hover { color: var(--c-bad); background: var(--c-bad-bg) !important; }
.comp-bcg-num {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--c-muted);
}

.comp-bcg-legend { display: flex; flex-direction: column; gap: var(--space-2); font-size: var(--text-sm); }
.comp-bcg-legend-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.comp-bcg-legend-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
}
.comp-bcg-legend-note {
    font-size: var(--text-xs);
    color: var(--c-muted);
    line-height: 1.5;
}

@media (max-width: 1024px) {
    .comp-bcg-bottom { grid-template-columns: 1fr; }
}

/* ── Адаптивность ────────────────────────────────────────────────── */
@media (max-width: 1280px) {
    .comp-content-grid {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }
    .comp-actions-rail {
        position: static;
        order: 2;
    }
}
@media (max-width: 1024px) {
    .comp-subtabs { padding: 0 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .comp-content-grid { padding: 16px 16px 0; }
}
@media (max-width: 768px) {
    .comp-subtab { padding: var(--space-2); font-size: var(--text-xs); }
}

/* ── Модальные диалоги ─────────────────────────────────────────────── */
.comp-modal-root {
    position: fixed; inset: 0; pointer-events: none; z-index: 2000;
    /* Модалка монтируется в document.body — ВНЕ #tab-competitors .comp-root,
       где объявлены --c-* токены. Без повторного объявления здесь окно модалки
       (background:var(--c-white)) и границы резолвятся в «ничто» → прозрачное
       окно, сквозь которое просвечивает страница. Дублируем СВЕТЛУЮ палитру. */
    --c-ink:     #181B26;
    --c-ink-2:   #2D3142;
    --c-muted:   #6A7180;
    --c-muted-2: #9AA1AE;
    --c-line:    #E3E7EE;
    --c-line-2:  #ECEEF3;
    --c-bg:      #F8F9FB;
    --c-white:   #FFFFFF;
    --c-us:      #373A67;
    --c-us-bg:   #ECECF5;
    --c-good:    #4E8A6A;
    --c-good-bg: #E4F0EA;
    --c-bad:     #9A3324;
    --c-bad-bg:  #F4E7E3;
    --c-neut:    #8A6D2E;
    --c-neut-bg: #F2ECDB;
    --c-info:    #4E5180;
    --c-info-bg: #ECECF5;
    --c-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
}
/* Тёмная тема модалки — те же значения, что у .comp-root[data-theme=dark]. */
[data-theme="dark"] .comp-modal-root {
    --c-ink:     #E8E9F0;
    --c-ink-2:   #C8CBDA;
    --c-muted:   #9CA1B4;
    --c-muted-2: #7E8398;
    --c-line:    #343852;
    --c-line-2:  #2A2E45;
    --c-bg:      #161826;
    --c-white:   #1F2233;
    --c-us:      #8589C7;
    --c-us-bg:   #24263A;
    --c-good:    #6FB089;
    --c-good-bg: rgba(111, 176, 137, 0.16);
    --c-bad:     #CF5B45;
    --c-bad-bg:  rgba(207, 91, 69, 0.16);
    --c-neut:    #CBB06A;
    --c-neut-bg: rgba(203, 176, 106, 0.16);
    --c-info:    #8589C7;
    --c-info-bg: #24263A;
    --c-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.40);
}
body.comp-modal-open { overflow: hidden; }
.comp-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(20, 20, 40, 0.45);
    display: flex; align-items: center; justify-content: center;
    padding: var(--space-6);
    opacity: 0;
    transition: opacity 150ms ease-out;
    pointer-events: auto;
    backdrop-filter: blur(2px);
}
.comp-modal-overlay.is-visible { opacity: 1; }
.comp-modal-overlay.is-leaving { opacity: 0; }
.comp-modal-window {
    background: var(--c-white);
    border-radius: var(--radius-xl);
    box-shadow: 0 16px 48px rgba(20, 20, 40, 0.22), 0 2px 8px rgba(20, 20, 40, 0.08);
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 48px);
    display: flex; flex-direction: column;
    transform: translateY(8px) scale(0.98);
    opacity: 0;
    transition: transform 150ms ease-out, opacity 150ms ease-out;
}
.comp-modal-overlay.is-visible .comp-modal-window {
    transform: translateY(0) scale(1);
    opacity: 1;
}
.comp-modal-window.is-sm { max-width: 380px; }
.comp-modal-window.is-lg { max-width: 720px; }
.comp-modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--c-line);
    gap: var(--space-3);
}
.comp-modal-title {
    margin: var(--space-0); font-size: var(--text-base); font-weight: 600; color: var(--c-ink);
    line-height: 1.3;
}
.comp-modal-close {
    background: transparent; border: none; cursor: pointer;
    width: 28px; height: 28px; border-radius: var(--radius-md);
    font-size: var(--text-xl); line-height: 1; color: var(--c-muted);
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.comp-modal-close:hover { background: var(--c-line-2); color: var(--c-ink); }
.comp-modal-close.is-floating {
    position: absolute; top: 10px; right: 12px;
}
.comp-modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1 1 auto;
    color: var(--c-ink-2);
    font-size: var(--text-sm);
    line-height: 1.5;
}
.comp-modal-msg { margin: var(--space-0); }
.comp-modal-footer {
    display: flex; justify-content: flex-end; gap: var(--space-2);
    padding: 12px 20px;
    border-top: 1px solid var(--c-line);
    background: var(--c-line-2);
    border-bottom-left-radius: 14px;
    border-bottom-right-radius: 14px;
}
.comp-modal-form { display: flex; flex-direction: column; gap: var(--space-3); }
.comp-modal-field { display: flex; flex-direction: column; gap: var(--space-2); }
.comp-modal-label {
    font-size: var(--text-xs); font-weight: 600; color: var(--c-ink-2);
    text-transform: uppercase; letter-spacing: 0.06em;
}
.comp-modal-req { color: var(--c-bad); margin-left: 2px; }
.comp-modal-hint { font-size: var(--text-xs); color: var(--c-muted); line-height: 1.45; }
.comp-modal-form-error {
    background: var(--c-bad-bg); color: var(--c-bad);
    padding: var(--space-2); border-radius: var(--radius-md); font-size: var(--text-xs);
}
.comp-btn.is-danger {
    background: var(--c-bad); color: #fff;
}
.comp-btn.is-danger:hover { background: #B11A2C; }

/* Структурированный контент в body (для истории, экспорта) */
.comp-modal-list { list-style: none; margin: var(--space-0); padding: var(--space-0); display: flex; flex-direction: column; gap: var(--space-2); }
.comp-modal-list li {
    display: grid; grid-template-columns: 90px 140px 1fr; gap: var(--space-2);
    align-items: baseline; font-size: var(--text-sm);
    padding-bottom: 10px; border-bottom: 1px dashed var(--c-line);
}
.comp-modal-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.comp-modal-list .ml-date { color: var(--c-muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--text-xs); }
.comp-modal-list .ml-author { color: var(--c-ink-2); font-weight: 500; }
.comp-modal-list .ml-text { color: var(--c-ink-2); }
@media (max-width: 600px) {
    .comp-modal-list li { grid-template-columns: 1fr; gap: 2px; }
}

/* Скрытый file input триггер */
.comp-hidden-file { display: none; }

/* Чип привязки к плану в правой панели */
.comp-rail-plan-chip {
    display: flex; align-items: center; gap: var(--space-2);
    width: 100%; padding: var(--space-2); margin-top: 6px;
    background: var(--c-bg-2); border: 1px solid var(--c-line);
    border-radius: var(--radius-md); cursor: pointer; text-align: left;
    font-size: var(--text-xs); color: var(--c-accent); font-weight: 500;
    transition: background 0.15s;
}
.comp-rail-plan-chip:hover { background: var(--c-accent-light, #eef2ff); }
.comp-rail-plan-chip svg { flex-shrink: 0; color: var(--c-accent); }
.comp-rail-plan-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ══════════════════════════════════════════════════════════════════
   ОБЗОР — «Конкурентное поле»: сетка карточек (перенос Stitch db1caea6).
   v2: высота по контенту (без пустых простыней), всегда есть акцент-
   карточка PrimeBPM. Палитра — токены модуля --c-* (ремап на app).
   ══════════════════════════════════════════════════════════════════ */
.comp-overview--cards { display: flex; flex-direction: column; gap: 14px; }
.comp-ov-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.comp-ov-sub { font-size: 12px; color: var(--c-muted); margin-top: 4px; }
.comp-ov-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
    gap: 12px;
    align-items: start;
}
.comp-ov-card {
    display: flex; flex-direction: column; gap: 9px;
    text-align: left;
    background: var(--c-white);
    border: 1px solid var(--c-line);
    border-radius: 12px;
    padding: 14px;
    cursor: pointer;
    transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease;
    box-shadow: var(--c-shadow-sm, 0 1px 2px rgba(15,23,42,.05));
}
button.comp-ov-card { font: inherit; }
.comp-ov-card:hover {
    border-color: var(--c-accent);
    box-shadow: 0 6px 16px rgba(15,23,42,.08);
    transform: translateY(-1px);
}
.comp-ov-card.is-us {
    border-color: var(--c-accent);
    background: var(--c-accent-light);
    cursor: default;
}
.comp-ov-card.is-us:hover { transform: none; box-shadow: var(--c-shadow-sm, 0 1px 2px rgba(15,23,42,.05)); }
.comp-ov-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.comp-ov-logo {
    width: 38px; height: 38px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 13px; flex: 0 0 auto;
}
.comp-ov-badge {
    font-size: 9.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
    color: #fff; background: var(--c-accent); padding: 4px 8px; border-radius: 999px;
}
.comp-ov-tag {
    font-size: 11px; color: var(--c-muted);
    background: var(--c-bg-2, var(--c-line-2)); border: 1px solid var(--c-line);
    padding: 3px 8px; border-radius: 999px; white-space: nowrap;
}
.comp-ov-name { font-size: 15.5px; font-weight: 600; color: var(--c-ink); line-height: 1.25; }
.comp-ov-desc {
    font-size: 12.5px; color: var(--c-muted); line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    min-height: 0;
}
.comp-ov-bullets {
    margin: 0; padding: 0; list-style: none;
    display: flex; flex-direction: column; gap: 4px;
    font-size: 12px; color: var(--c-ink-2);
}
.comp-ov-bullets li { position: relative; padding-left: 15px; line-height: 1.35; }
.comp-ov-bullets li::before {
    content: ""; position: absolute; left: 3px; top: 7px;
    width: 5px; height: 5px; border-radius: 50%; background: var(--c-accent);
}
.comp-ov-bullets--empty { color: var(--c-muted-2); font-style: italic; font-size: 11.5px; }
.comp-ov-foot {
    display: flex; gap: 10px; padding-top: 9px; margin-top: 2px;
    border-top: 1px solid var(--c-line);
}
.comp-ov-stat { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.comp-ov-stat--seg { margin-left: auto; text-align: right; }
.comp-ov-stat-lbl {
    font-size: 9px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    color: var(--c-muted-2);
}
.comp-ov-stat-val { font-size: 13px; font-weight: 600; color: var(--c-ink); font-variant-numeric: tabular-nums; }
/* плитка «Добавить» — как обычная карточка, не доминирует */
.comp-ov-card--add {
    align-items: center; justify-content: center; text-align: center;
    gap: 8px; min-height: 120px;
    background: transparent; border: 1px dashed var(--c-line);
    color: var(--c-muted); box-shadow: none;
}
.comp-ov-card--add:hover {
    border-color: var(--c-accent); color: var(--c-accent);
    background: var(--c-accent-light); transform: none; box-shadow: none;
}
.comp-ov-add-plus { color: var(--c-accent); display: inline-flex; }
.comp-ov-add-title { font-size: 13px; font-weight: 600; color: var(--c-ink); }

@media (max-width: 768px) {
    .comp-ov-grid { grid-template-columns: 1fr; }
}

/* ── Сравнительная таблица: футер «Сводка + AI-рекомендация»
   (перенос Stitch ef2d38db: Market Growth Trends + AI Recommendation) ── */
.comp-cmp-footer {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 14px;
    margin-top: 14px;
}
.comp-cmp-summary {
    background: var(--c-white);
    border: 1px solid var(--c-line);
    border-radius: 12px;
    padding: 16px 18px;
    box-shadow: var(--c-shadow-sm, 0 1px 2px rgba(15,23,42,.05));
}
.comp-cmp-summary-stats { display: flex; gap: 28px; margin-top: 12px; }
.comp-cmp-summary-stat { display: flex; flex-direction: column; gap: 2px; }
.comp-cmp-summary-num { font-size: 30px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; color: var(--c-ink); }
.comp-cmp-summary-num--adv { color: var(--c-good); }
.comp-cmp-summary-num--gap { color: var(--c-bad); }
.comp-cmp-summary-lbl { font-size: 12px; color: var(--c-muted); }
.comp-cmp-ai {
    background: var(--c-accent);
    border-radius: 12px;
    padding: 16px 18px;
    color: #fff;
    display: flex; flex-direction: column; gap: 8px;
}
.comp-cmp-ai-head {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 700; letter-spacing: .02em;
}
.comp-cmp-ai-head svg { opacity: .9; }
.comp-cmp-ai-text { margin: 0; font-size: 13px; line-height: 1.5; color: rgba(255,255,255,.9); }
@media (max-width: 768px) {
    .comp-cmp-footer { grid-template-columns: 1fr; }
}

/* Обзор-карточки лежат прямо на фоне (как Stitch) — снимаем внешнюю
   рамку/тень контейнера .comp-screen только для вида-сетки, чтобы не
   было «коробки в коробке» вокруг карточек. */
.comp-screen:has(.comp-overview--cards) {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 0 !important;
}
