/* =====================================================================
   humbl partners — дизайн-система v2 (подключается после styles.css)
   Токены, шрифт, элементы управления, таблицы, карточки, меню, карточка
   сайта, уведомления и диалоги. Светлая и тёмная тема.
   ===================================================================== */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f4f5f8;
  --surface-3: #eceef3;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-2: #344054;
  --muted: #667085;
  --accent: #3b5bfd;
  --accent-hover: #2b47e0;
  --accent-soft: #eef1ff;
  --accent-text: #2f4bd8;
  --ring: rgba(59, 91, 253, .22);
  --good: #0f8a5f; --good-soft: #e6f6ee;
  --bad: #d92d20; --bad-soft: #fdeceb;
  --warn: #b54708; --warn-soft: #fff4e5;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 6px 16px -4px rgba(16, 24, 40, .10), 0 2px 6px -2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 24px 48px -12px rgba(16, 24, 40, .22);
  --h-control: 36px;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398a2b3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  --search-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398a2b3' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
  --grid: #eef0f4;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0e13; --surface: #12161d; --surface-2: #181d26; --surface-3: #202632;
    --border: #232a36; --border-strong: #313a49; --text: #e7eaf0; --text-2: #c3c9d4; --muted: #8b96a8;
    --accent: #6b8cff; --accent-hover: #87a2ff; --accent-soft: #19213b; --accent-text: #9db3ff; --ring: rgba(107, 140, 255, .32);
    --good: #3dd598; --good-soft: rgba(61, 213, 152, .12); --bad: #ff6b60; --bad-soft: rgba(255, 107, 96, .12);
    --warn: #f7b955; --warn-soft: rgba(247, 185, 85, .12);
    --shadow-xs: none; --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-md: 0 8px 24px -6px rgba(0, 0, 0, .5); --shadow-lg: 0 24px 56px -12px rgba(0, 0, 0, .7);
    --grid: #1c222c; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0e13; --surface: #12161d; --surface-2: #181d26; --surface-3: #202632;
  --border: #232a36; --border-strong: #313a49; --text: #e7eaf0; --text-2: #c3c9d4; --muted: #8b96a8;
  --accent: #6b8cff; --accent-hover: #87a2ff; --accent-soft: #19213b; --accent-text: #9db3ff; --ring: rgba(107, 140, 255, .32);
  --good: #3dd598; --good-soft: rgba(61, 213, 152, .12); --bad: #ff6b60; --bad-soft: rgba(255, 107, 96, .12);
  --warn: #f7b955; --warn-soft: rgba(247, 185, 85, .12);
  --shadow-xs: none; --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-md: 0 8px 24px -6px rgba(0, 0, 0, .5); --shadow-lg: 0 24px 56px -12px rgba(0, 0, 0, .7);
  --grid: #1c222c; color-scheme: dark;
}

/* ---------- База ---------- */
body {
  font: 14px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; letter-spacing: -0.003em;
}
h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 13px; font-weight: 600; color: var(--text-2); }
.small { color: var(--muted); }
a { color: var(--accent-text); }
::selection { background: var(--ring); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); border-radius: 6px; }

/* ---------- Поля и списки ---------- */
input[type="search"], input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"],
input:not([type]), select, textarea {
  height: var(--h-control); padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs);
  transition: border-color .15s, box-shadow .15s, background-color .15s; outline: none; min-width: 0;
}
textarea { height: auto; padding: 10px 12px; line-height: 1.5; }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
select {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 34px;
  background-image: var(--chevron); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
  font-weight: 500;
}
select option { background: var(--surface); color: var(--text); }
input[type="search"] {
  padding-left: 34px; background-image: var(--search-ico); background-repeat: no-repeat; background-position: 11px center; background-size: 16px;
}
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; cursor: pointer; }
input[type="range"] { accent-color: var(--accent); }
input[type="date"]::-webkit-calendar-picker-indicator { opacity: .6; cursor: pointer; }

/* Флажки-фильтры как «таблетки» */
.filters .check, .row-actions > .check {
  height: var(--h-control); padding: 0 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  font-weight: 500; color: var(--text-2); transition: background-color .15s, border-color .15s, color .15s; box-shadow: var(--shadow-xs);
}
.filters .check:hover, .row-actions > .check:hover { border-color: var(--border-strong); }
.filters .check:has(input:checked), .row-actions > .check:has(input:checked) { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.field.inline > span { font-weight: 500; }

/* ---------- Кнопки ---------- */
.btn {
  height: var(--h-control); padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 550; box-shadow: var(--shadow-xs);
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s; justify-content: center;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { box-shadow: 0 0 0 3px var(--ring); border-radius: var(--radius-sm); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(59, 91, 253, .3); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger:hover { filter: brightness(.95); }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 7px; }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Сегментированный переключатель */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; overflow: visible; }
.seg button { height: 28px; padding: 0 12px; border: 0 !important; border-radius: 7px; background: transparent; color: var(--muted); font-weight: 550; font-size: 13px; transition: background-color .15s, color .15s; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- Раскладка страницы ---------- */
.pagehead {
  position: sticky; top: 0; z-index: 5; padding: 14px 28px; margin-bottom: 2px;
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent;
}
.pagehead .field.inline select { min-width: 220px; }
.filters { padding: 12px 28px 0; gap: 8px; }
.filters input[type="number"] { width: 96px; }
.kpis { padding: 14px 28px; gap: 12px; }
.table-wrap { padding: 0 28px 40px; }
.hint { margin: 12px 28px 0; border: 1px solid color-mix(in srgb, var(--warn) 25%, transparent); font-size: 13px; }
#view-overview > .card, #view-share > .card, .ov-grid { margin-left: 28px; margin-right: 28px; }
.ov-top { padding: 0 28px; }
#view-ai > .card, #view-similar > .card { margin: 14px 28px 0; }
.check-input { margin: 14px 28px 0; }
.settings { padding: 14px 28px 40px !important; gap: 14px; }
.sitecmp { padding: 0 28px 28px; }

/* ---------- Карточки и показатели ---------- */
.card { border-radius: var(--radius); border-color: var(--border); box-shadow: var(--shadow); padding: 16px 18px; }
.card h2 { margin-bottom: 10px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.card h2 .small { font-weight: 400; }
.kpi { border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); position: relative; }
.kpi b { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.2; margin-bottom: 2px; }
.kpi span { font-size: 12.5px; line-height: 1.4; }
.kpis.hero .kpi b { font-size: 26px; }
.kpis.hero .kpi:first-child { background: linear-gradient(135deg, var(--accent-soft), var(--surface) 70%); border-color: color-mix(in srgb, var(--accent) 25%, var(--border)); }

/* ---------- Таблицы ---------- */
table { border-radius: var(--radius); box-shadow: var(--shadow); border-color: var(--border); }
th {
  background: var(--surface-2); color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
th[data-sort]:hover, th[data-csort]:hover, th[data-ssort]:hover { color: var(--text); }
td { padding: 11px 12px; border-bottom-color: var(--border); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color .1s; }
tbody tr.row:hover, tbody tr[data-domain]:hover { background: var(--surface-2); }
table.mini { box-shadow: none; border-radius: var(--radius-sm); font-size: 13px; }
table.mini th { position: static; padding: 8px 10px; font-size: 11px; }
table.mini td { padding: 8px 10px; }
.card table.mini { border: 1px solid var(--border); }
tr.ours-row td, tr.ours td { background: color-mix(in srgb, var(--good-soft) 70%, transparent); }
.empty { padding: 40px 20px; color: var(--muted); }

/* ---------- Метки ---------- */
.tag, .badge, .st, .eng {
  display: inline-flex; align-items: center; gap: 4px; height: 21px; padding: 0 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 550; line-height: 1; border: 0; vertical-align: middle;
}
.tag { background: var(--surface-3); color: var(--text-2); }
.eng { background: transparent; border: 1px solid var(--border); color: var(--text-2); }
.pill { height: 19px; min-width: 19px; display: inline-grid; place-items: center; padding: 0 6px; font-size: 11px; }
.pill.hot { background: var(--bad); color: #fff; }
.sharebar { background: var(--surface-3); border-radius: 999px; }
.sharebar i { background: var(--accent); border-radius: 999px; }
.bar { background: var(--surface-3); border-radius: 999px; }
.bar i { background: var(--accent); border-radius: 999px; }

/* ---------- Меню слева ---------- */
.layout { grid-template-columns: 236px minmax(0, 1fr); }
.sidebar { padding: 14px 10px 12px; gap: 1px; overflow-y: auto; background: var(--surface); }
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 10px 14px; font-size: 15px; color: var(--muted); }
.logo-mark {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; flex: none;
  background: linear-gradient(135deg, var(--accent), #7a5cff); color: #fff; font-weight: 700; font-size: 15px; box-shadow: 0 2px 6px rgba(59, 91, 253, .35);
}
.nav-group { padding: 14px 12px 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); opacity: .85; }
.nav-group:first-of-type { padding-top: 4px; }
.nav { position: relative; height: 36px; padding: 0 10px; gap: 11px; border-radius: 8px; color: var(--text-2); font-weight: 500; font-size: 13.5px; transition: background-color .12s, color .12s; }
.nav:hover { background: var(--surface-2); color: var(--text); }
.nav.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav.active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
svg.ni { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .9; }
.nav .nl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot { gap: 10px; padding: 12px 4px 0; }
.side-foot #statusText { line-height: 1.45; }
.side-foot .progress { height: 4px; border-radius: 999px; }
.side-foot .progress i { border-radius: 999px; }
.side-foot .seg.lang { align-self: flex-start; }
.me { display: flex; align-items: center; gap: 8px; margin: 0; padding: 6px; border-radius: 10px; background: var(--surface-2); }
.me[hidden] { display: none; }
.avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); font-weight: 650; font-size: 12px; flex: none; }
.me-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; font-size: 13px; }

/* ---------- Карточка сайта (выезжающая панель) ---------- */
.drawer-back { background: rgba(10, 14, 22, .32); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); animation: fade .18s ease-out; }
.drawer { background: var(--bg); box-shadow: var(--shadow-lg); border-left-color: var(--border); animation: slide-in .22s cubic-bezier(.2, .8, .2, 1); }
.dr-head { padding: 16px 22px; align-items: center; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.dr-head h2 { font-size: 18px; font-weight: 650; }
.dr-body { gap: 14px; }
.statuses button { height: 28px; padding: 0 12px; border-color: var(--border); font-weight: 550; transition: transform .05s, box-shadow .15s; }
.statuses button:hover { border-color: var(--border-strong); }
.statuses button.on { outline: none; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Уведомления (toast) ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; max-width: min(420px, calc(100vw - 32px)); }
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 12px 12px 12px 14px; min-width: 260px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-md);
  animation: toast-in .22s cubic-bezier(.2, .8, .2, 1); font-size: 13.5px; line-height: 1.45;
}
.toast.out { animation: toast-out .18s ease-in forwards; }
.toast svg { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin-top: 1px; }
.toast .t-ico { color: var(--accent); }
.toast.success .t-ico { color: var(--good); }
.toast.error .t-ico { color: var(--bad); }
.toast.warn .t-ico { color: var(--warn); }
.toast .t-msg { flex: 1; min-width: 0; word-break: break-word; }
.toast .t-close { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 2px; border-radius: 6px; display: grid; }
.toast .t-close:hover { color: var(--text); background: var(--surface-2); }
.toast .t-close svg { width: 15px; height: 15px; margin: 0; }
@keyframes toast-in { from { transform: translateY(10px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toast-out { to { transform: translateY(6px); opacity: 0; } }

/* ---------- Диалог подтверждения ---------- */
.dialog {
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0; width: min(440px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.dialog[open] { animation: dialog-in .2s cubic-bezier(.2, .8, .2, 1); }
.dialog::backdrop { background: rgba(10, 14, 22, .45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.dialog-body { padding: 22px 22px 6px; font-size: 14px; line-height: 1.55; }
.dialog-body h3 { margin: 0 0 6px; font-size: 16px; color: var(--text); }
.dialog-body p { margin: 0; color: var(--text-2); }
.dialog-body code { display: inline-block; margin-top: 8px; padding: 6px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; font-size: 14px; user-select: all; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 22px 18px; }
@keyframes dialog-in { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Загрузка ---------- */
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Вход ---------- */
.login { background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.login form { max-width: 380px; padding: 28px; gap: 14px; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.login .logo { padding: 0 0 6px; font-size: 15px; }
.login h1 { font-size: 22px; }
.login .btn.primary { height: 40px; }
.login input { height: 40px; }

/* ---------- Адаптив ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 200px minmax(0, 1fr); }
  .pagehead, .filters, .kpis, .table-wrap, .sitecmp { padding-left: 20px; padding-right: 20px; }
  #view-overview > .card, #view-share > .card, .ov-grid, #view-ai > .card, #view-similar > .card, .check-input, .hint { margin-left: 20px; margin-right: 20px; }
}
@media (max-width: 700px) {
  .layout { grid-template-columns: 60px minmax(0, 1fr); }
  .nav-group { display: none; }
  .sidebar .logo { justify-content: center; padding: 4px 0 12px; }
  .sidebar .logo .nl { display: none; }
  .nav { justify-content: center; padding: 0; }
  .nav.active::before { left: -6px; }
  .pagehead, .filters, .kpis, .table-wrap, .sitecmp { padding-left: 16px; padding-right: 16px; }
  #view-overview > .card, #view-share > .card, .ov-grid, #view-ai > .card, #view-similar > .card, .check-input, .hint { margin-left: 16px; margin-right: 16px; }
  .pagehead .field.inline select { min-width: 0; max-width: 60vw; }
}
@media (max-width: 520px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; top: 0; z-index: 10; height: auto; flex-direction: row; align-items: center; justify-content: flex-start;
    gap: 2px; padding: 6px 8px; border-right: 0; border-bottom: 1px solid var(--border); overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .sidebar .logo, .sidebar .nav-group, .sidebar .side-foot { display: none; }
  .nav { flex: 0 0 44px; height: 40px; justify-content: center; padding: 0; }
  .nav .nl { display: none; }
  .nav .pill { position: absolute; top: 1px; right: 1px; margin: 0; }
  .nav.active::before { left: 10px; right: 10px; top: auto; bottom: -6px; width: auto; height: 3px; border-radius: 3px 3px 0 0; }
  .pagehead { position: static; }
  .toasts { right: 12px; left: 12px; bottom: 12px; align-items: stretch; }
}
.loading-row { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; color: var(--muted); padding: 6px 2px; }

/* Скрытые элементы всегда скрыты, даже если у класса задан display */
[hidden] { display: none !important; }
/* «Призрачные» кнопки в панелях фильтров выглядят как обычные */
.filters .btn.ghost, .row-actions .btn.ghost, .check-input .btn.ghost { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-xs); color: var(--text); }
.filters .btn.ghost:hover, .row-actions .btn.ghost:hover, .check-input .btn.ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }
#weightsBtn { margin-left: auto; }
/* Кнопки в строках таблиц — компактные и тихие */
td .btn.small.ghost { color: var(--accent-text); }
td .btn.small.ghost:hover { background: var(--accent-soft); }

/* ---------- Лента событий ---------- */
.ev { grid-template-columns: 30px 1fr auto; padding: 12px 16px; border-radius: var(--radius); box-shadow: var(--shadow); transition: border-color .15s; }
.ev:hover { border-color: var(--border-strong); }
.ev.unread { border-left: 1px solid var(--border); box-shadow: inset 3px 0 0 var(--accent), var(--shadow); }
.ev .ico { font-size: 0; line-height: 0; }
.ev-day { text-transform: capitalize; font-size: 12px; letter-spacing: .02em; margin: 16px 0 6px; }
.ev-dot { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--surface-3); color: var(--muted); flex: none; vertical-align: middle; }
.ev-dot svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
li > .ev-dot { width: 20px; height: 20px; border-radius: 6px; margin-right: 4px; }
li > .ev-dot svg { width: 12px; height: 12px; }
.ev-good { background: var(--good-soft); color: var(--good); }
.ev-bad { background: var(--bad-soft); color: var(--bad); }
.ev-accent { background: var(--accent-soft); color: var(--accent-text); }
.ev-warn { background: var(--warn-soft); color: var(--warn); }
.ev-violet { background: color-mix(in srgb, #7a5cff 14%, transparent); color: #7a5cff; }
.kpis.hero { grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); }
.kpis.hero .kpi span { font-size: 12px; }

/* Страница входа: логотип и язык видны всегда */
.login .logo, .login .seg.lang { display: flex !important; }
.login .seg.lang { display: inline-flex !important; }
.nav svg.ni { width: 18px; height: 18px; font-size: 0; }

/* ---------- Низ меню ---------- */
.side-foot { gap: 12px; }
.foot-status { display: flex; flex-direction: column; gap: 8px; }
.foot-status .btn { width: 100%; }
.foot-user { display: flex; align-items: center; gap: 6px; padding-top: 10px; border-top: 1px solid var(--border); min-height: 40px; }
.foot-user .me { background: transparent; padding: 0; flex: 1 1 auto; min-width: 0; }
.foot-user .grow { flex: 1; }
.foot-user .me:not([hidden]) + .grow { display: none; }
.foot-user .seg.lang { margin: 0; padding: 2px; border-radius: 8px; }
.foot-user .seg.lang button { height: 24px; padding: 0 8px; font-size: 11.5px; border-radius: 6px; }
.side-foot .seg.lang { align-self: auto; }

/* ---------- Бренды ---------- */
.brand-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.brand-cols > div { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--surface-2); min-height: 84px; }
.brand-cols h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 12.5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot-good { background: var(--good); }
.dot-bad { background: var(--bad); }
.chips { gap: 6px; }
.chip {
  height: 28px; padding: 0 4px 0 11px; gap: 4px; font-size: 13px; font-weight: 550; border-radius: 999px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-xs);
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--good); margin-right: 3px; }
.chip.comp::before { background: var(--bad); }
.chip.comp { background: var(--surface); color: var(--text); }
.chip button { display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border-radius: 50%; color: var(--muted); }
.chip button:hover { background: var(--surface-3); color: var(--text); }
.chip button svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.brand-find { margin-top: 14px; }
.brand-find input { width: 100%; }
.brand-find .results:not(:empty) { margin-top: 8px; border: 1px solid var(--border); border-radius: 10px; padding: 4px 12px; background: var(--surface); box-shadow: var(--shadow-md); max-height: 320px; overflow: auto; }
.brand-find .results li { padding: 8px 0; }
.brand-find .results li:last-child { border-bottom: 0; }
.brand-find .acts { display: flex; gap: 6px; align-items: center; }
@media (max-width: 700px) { .brand-cols { grid-template-columns: 1fr; } }

/* ---------- Мои рынки ---------- */
.mk-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 12px; }
.mk-bar input[type="search"] { width: 240px; }
.mk-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px;
  max-height: 380px; overflow-y: auto; padding: 2px; margin: 0 -2px;
}
.mk {
  display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); transition: background-color .12s, border-color .12s; user-select: none;
}
.mk:hover { border-color: var(--border-strong); background: var(--surface-2); }
.mk input { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }
.mk-check { width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--border-strong); display: grid; place-items: center; flex: none; transition: background-color .12s, border-color .12s; }
.mk-check svg { width: 12px; height: 12px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.mk.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.mk.on .mk-check { background: var(--accent); border-color: var(--accent); }
.mk.on .mk-check svg { opacity: 1; }
.mk:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--ring); }
.mk-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.mk-n { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mk.empty .mk-name { color: var(--muted); }
.mk-foot { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }

/* ---------- Бренды на сайте (карточка) ---------- */
table.sb td { vertical-align: top; }
.sb-pages { display: flex; flex-wrap: wrap; gap: 4px; max-width: 360px; }
.sb-pages .tag { height: 20px; font-size: 11px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.sb-pages .tag b { font-weight: 650; color: var(--text); margin-left: 2px; }
#siteBrands [data-sb-more] { margin-top: 8px; }
.sb-pages { flex-wrap: nowrap; max-width: 330px; overflow: hidden; align-items: center; }
.sb-pages .tag { max-width: 120px; flex: 0 1 auto; }
.sb-pages .small { white-space: nowrap; cursor: help; }
.dialog:has(.tg-preview) { width: min(640px, calc(100vw - 32px)); }
.tg-preview { display: block; width: 100%; border-radius: 12px; margin: 6px 0 12px; border: 1px solid var(--border); }
.tg-caption { font-size: 13.5px; line-height: 1.5; color: var(--text-2); max-height: 260px; overflow: auto; }
.tg-caption u { color: var(--accent-text); text-decoration: none; }

/* ---------- Команда ---------- */
table.team td { vertical-align: middle; padding-top: 10px; padding-bottom: 10px; }
.tm-user { display: flex; align-items: center; gap: 12px; }
.tm-user .avatar { width: 34px; height: 34px; font-size: 13px; }
.tm-user .small { margin-top: 1px; }
.tm-role { height: 32px; font-size: 13px; min-width: 160px; }
.tm-acts { display: inline-flex; gap: 6px; justify-content: flex-end; white-space: nowrap; }
.tm-acts .btn.ghost { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-xs); color: var(--text); }
.tm-acts .btn.ghost:hover { background: var(--surface-2); }
.tm-acts .btn.tm-danger { color: var(--bad); }
.tm-acts .btn.tm-danger:hover { background: var(--bad-soft); border-color: transparent; }
tr.tm-off td { opacity: .6; }
#teamCard .row-actions input[type="email"], #teamCard .row-actions input:not([type]) { flex: 1 1 200px; }

/* ---------- Карточка бренда ---------- */
.brand-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.brand-kpis > div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.brand-kpis b { display: block; font-size: 20px; font-weight: 650; letter-spacing: -0.02em; }
.brand-kpis span { font-size: 12px; color: var(--muted); }
.targets .grow .small + .small { margin-top: 2px; }
/* Скрытый флажок внутри плитки рынка — привязан к плитке, иначе при клике браузер прокручивает страницу к нему */
.mk { position: relative; }
.mk input { left: 0; top: 0; }
.mk-grid { overflow-anchor: none; }

/* ===== Пространства ===== */
.ws-box { padding: 0 14px 10px; }
.ws-box select { width: 100%; font-weight: 600; }
.ws-name { display: block; padding: 7px 10px; border-radius: 10px; background: var(--surface-2, rgba(127,127,127,.12)); font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-input { width: 100%; min-width: 260px; }
.tg-steps { margin: 4px 0 12px; padding-left: 20px; line-height: 1.6; }
#tgToken, #tgChat { flex: 1 1 280px; min-width: 0; }
#wsNewName { flex: 1 1 260px; min-width: 0; }
@media (max-width: 700px) { .sidebar .ws-box { display: none; } }
