/* SMS Hub — бренд SIG (docs/brand/SIG-brand.md у sig-analytics) у токенах кіту групи (docs/kit/layout/COMPONENTS.md). Кольори прототипу не використовуються. */

/* ── Шрифт SIG: Raleway (lining-цифри), системний стек як fallback ── */
@font-face { font-family: "Raleway"; font-style: normal; font-weight: 400; font-display: swap; src: url("brand/fonts/Raleway-Regular.ttf") format("truetype"); }
@font-face { font-family: "Raleway"; font-style: normal; font-weight: 700; font-display: swap; src: url("brand/fonts/Raleway-Bold.ttf") format("truetype"); }

/* ── Токени. Оболонка — завжди SIG; компанії групи змінюють лише --brand власної сторінки (правило кіту). ── */
:root {
  --sig-navy: #13132A; --sig-magenta: #C250AE; --sig-violet: #9A469E; --sig-lime: #D0F53A; --sig-pink: #C84490; --sig-indigo: #534191;
  --brand: var(--sig-violet);        /* акцент у світлій темі */
  --font: "Raleway", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --r-card: 16px; --r-ctl: 10px; --gap: 18px;
  /* світла тема */
  --bg: #F5F4FA; --surface: #FFFFFF; --surface-2: #EFEDF7; --border: #E3E0F0; --border-strong: #C4BEDB;
  --ink: #0F0C10; --ink-2: #58526A; --ink-3: #6E6882;
  --ok: #2C7A3D; --bad: #B42318; --warn: #A8500C;
  --sky: #1A66B8; --amber: #A8500C; --pink: #B4237A; --teal: #0E7C86; --violet: #4F36E0;
  --brand-soft: color-mix(in srgb, var(--brand) 12%, var(--surface));
  color-scheme: light;
}
/* темна тема: за системою (якщо не задано html[data-theme="light"]) … */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: var(--sig-magenta);
    --bg: var(--sig-navy); --surface: #1B1B3A; --surface-2: #232347; --border: #FFFFFF1A; --border-strong: #FFFFFF3D;
    --ink: #F4F2FA; --ink-2: #ADA7BE; --ink-3: #8F899F;
    --ok: #7FD48F; --bad: #FF8A7A; --warn: #FFB36B;
    --sky: #6CB6FF; --amber: #FFB36B; --pink: #FF8AC8; --teal: #5FD4D0; --violet: #A99BFF;
    color-scheme: dark;
  }
}
/* … або явно через html[data-theme="dark"] */
:root[data-theme="dark"] {
  --brand: var(--sig-magenta);
  --bg: var(--sig-navy); --surface: #1B1B3A; --surface-2: #232347; --border: #FFFFFF1A; --border-strong: #FFFFFF3D;
  --ink: #F4F2FA; --ink-2: #ADA7BE; --ink-3: #8F899F;
  --ok: #7FD48F; --bad: #FF8A7A; --warn: #FFB36B;
  --sky: #6CB6FF; --amber: #FFB36B; --pink: #FF8AC8; --teal: #5FD4D0; --violet: #A99BFF;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font); }
a { color: var(--brand); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
h1:focus { outline: none; }
code { font-size: 13px; }

/* ── Сітка: бокове меню + основна колонка (шапка + вміст) ── */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
/* Бокове меню — завжди темне (SIG): власні токени незалежно від теми, фірмовий градієнт із затемненням під текстом */
.side { position: sticky; top: 0; height: 100vh; padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; color-scheme: dark;
  --brand: var(--sig-magenta); --bg: var(--sig-navy); --surface: #1B1B3A; --surface-2: #232347; --border: #FFFFFF1A; --border-strong: #FFFFFF3D;
  --ink: #FFFFFF; --ink-2: #C9C5DA; --ink-3: #9D98B4; --brand-soft: color-mix(in srgb, var(--brand) 22%, var(--surface));
  color: var(--ink); border-right: 1px solid var(--border);
  background: linear-gradient(180deg, color-mix(in srgb, var(--sig-navy) 72%, transparent), color-mix(in srgb, var(--sig-navy) 88%, transparent)), url("brand/bg.jpg") center / cover no-repeat, var(--sig-navy); }
.logo { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; text-decoration: none; color: var(--ink); }
.logo img { display: block; height: 30px; width: auto; }
.nav-it { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r-ctl); color: var(--ink-2); text-decoration: none; font-weight: 600; }
.nav-it:hover { background: var(--surface-2); color: var(--ink); }
/* активний пункт: бренд-підкладка + ЄДИНИЙ lime-акцент оболонки — смужка ліворуч */
.nav-it.active { background: var(--brand-soft); color: var(--ink); box-shadow: inset 3px 0 0 var(--sig-lime); }
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.user { display: flex; align-items: center; gap: 10px; padding: 8px 12px; color: var(--ink-2); }
.user .ava { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); color: var(--ink); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.user .who { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.user .who b { font-size: 14px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user .who a { font-size: 12px; }
.theme { margin: 4px 0; } .theme .seg { display: flex; } .theme .seg button { flex: 1; padding: 6px 4px; font-size: 12px; }

/* ── Шапка (за прототипом): назва, перемикач компанії, роль. Завжди темна — продовження бокового меню ── */
.main-col { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 10px 20px; flex-wrap: wrap;
  min-height: 56px; padding: 10px 24px; color-scheme: dark; background: var(--sig-navy); color: #FFFFFF; border-bottom: 1px solid #FFFFFF1A; }
.top .prod { display: flex; align-items: baseline; gap: 12px; }
.top .prod b { font-size: 16px; letter-spacing: .01em; }
.top .prod span { color: #C9C5DA; font-size: 13px; }
.top .ctx { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.top .co { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; color: #C9C5DA; }
.top .co label { display: flex; align-items: center; gap: 8px; }
.top .co b { color: #FFFFFF; }
.top select { height: 34px; background: #232347; color: #FFFFFF; border-color: #FFFFFF3D; }
.top .role { font-size: 13px; color: #C9C5DA; padding: 5px 12px; border: 1px solid #FFFFFF3D; border-radius: 999px; white-space: nowrap; }
main { padding: 24px; display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }

/* ── Шапка сторінки ── */
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.head .ttl { display: flex; align-items: flex-start; gap: 12px; }
.head .ttl .squares { margin-top: 12px; }
.head h1 { margin: 0; font-size: 30px; line-height: 1.15; letter-spacing: -.01em; }
.head .sub { color: var(--ink-2); margin-top: 4px; }
.head .acts { display: flex; gap: 8px; flex-wrap: wrap; }
/* мотив SIG — два маленькі квадрати (pink + indigo) */
.squares { display: inline-flex; gap: 3px; flex: none; } .squares i { display: block; width: 8px; height: 8px; } .squares i:first-child { background: var(--sig-pink); } .squares i:last-child { background: var(--sig-indigo); }

/* ── Контроли ── */
select, .inp { height: 38px; padding: 0 12px; border-radius: var(--r-ctl); border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); font: inherit; }
label.inline { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.seg button { border: 0; background: none; color: var(--ink-2); padding: 7px 12px; border-radius: 9px; font: 600 13px var(--font); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--brand); color: #fff; }
.btn { height: 34px; padding: 0 14px; border-radius: var(--r-ctl); border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); font: 600 13px var(--font); cursor: pointer; }
.btn.primary { background: var(--brand); color: #fff; border-color: transparent; }
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; white-space: nowrap; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }

/* ── Картки ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 18px 20px; min-width: 0; }
.card h2 { margin: 0; font-size: 18px; }
.card.narrow { max-width: 560px; }
.card .h-card { font-size: 20px; margin: 0 0 8px; }
.card .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.note { color: var(--ink-3); font-size: 13px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.stub .steps { margin: 12px 0; padding-left: 22px; max-width: 86ch; } .stub .steps li { margin: 6px 0; }
.scope { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.scope .lbl { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--brand-soft); color: var(--ink); font-size: 12px; font-weight: 600; white-space: nowrap; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; margin-top: 6px; }
.facts > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.facts .lbl { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.facts .pill { align-self: flex-start; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.pill.bad { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.pill.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.pill.muted { background: var(--surface-2); color: var(--ink-2); }
.empty { padding: 18px; border: 1px dashed var(--border-strong); border-radius: 12px; color: var(--ink-2); }
.empty .squares { margin-right: 10px; vertical-align: 1px; }

/* ── Поля форм, таблиці, банер (Фаза 2: шаблони й кампанії) ── */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.grow, .grow { flex: 1 1 160px; }
.min0 { min-width: 0; }
.lbl { display: block; font-size: 12px; color: var(--ink-2); font-weight: 700; }
.hint { font-size: 12px; color: var(--ink-3); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.hint.warn { color: var(--warn); }
.field .inp, .field select { width: 100%; }
.inp:disabled, select:disabled { opacity: .75; cursor: not-allowed; }
textarea.inp.area { height: auto; min-height: 112px; padding: 10px 12px; line-height: 1.45; resize: vertical; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.mono.sm, td.sm { font-size: 12px; }
fieldset.plain { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn.ghost { border-color: transparent; background: none; color: var(--brand); }
abbr.i { text-decoration: none; cursor: help; color: var(--ink-3); font-weight: 400; }
.chip.var { border: 0; cursor: pointer; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.chip.var:hover { background: color-mix(in srgb, var(--brand) 24%, var(--surface)); }
.chip.bad { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.chip.muted { background: var(--surface-2); color: var(--ink-2); }

.tbl-wrap { overflow-x: auto; }
.tbl { border-collapse: collapse; width: 100%; }
.tbl th { text-align: left; font-size: 12px; color: var(--ink-2); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; background: var(--surface); }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: top; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl.rows tbody tr { cursor: pointer; }
.tbl.rows tbody tr:hover td { background: var(--surface-2); }
.tbl tr.sel td { background: var(--brand-soft); }
.tbl tr.off td { color: var(--ink-3); }
.tbl .t-name { color: var(--ink); font-weight: 700; text-decoration: none; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.list-card { padding-bottom: 8px; }
.skeleton { border-radius: 12px; background: linear-gradient(90deg, var(--surface-2), color-mix(in srgb, var(--surface-2) 40%, var(--surface)), var(--surface-2)); background-size: 200% 100%; animation: sk 1.4s ease-in-out infinite; margin: 8px 0; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.banner { position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 10px 40px 12px 14px; border-radius: 12px; overflow: hidden; border: 1px solid; }
.banner.ok { background: color-mix(in srgb, var(--ok) 12%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 40%, transparent); color: var(--ink); }
.banner.bad { background: color-mix(in srgb, var(--bad) 10%, var(--surface)); border-color: color-mix(in srgb, var(--bad) 40%, transparent); color: var(--ink); }
.banner ul { margin: 4px 0 0; padding-left: 18px; }
.banner-x { position: absolute; right: 8px; top: 6px; border: 0; background: none; color: var(--ink-2); font-size: 20px; cursor: pointer; line-height: 1; }
.banner-timer { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: currentColor; opacity: .25; transform-origin: left; animation: banner-t 10s linear forwards; }
.banner.ok .banner-timer { color: var(--ok); } .banner.bad .banner-timer { color: var(--bad); }
@keyframes banner-t { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ── «Шаблони і кампанії»: списки зліва, картка справа (прототип) ── */
.tpl-grid { display: grid; grid-template-columns: minmax(360px, 1fr) minmax(0, 1.3fr); gap: var(--gap); align-items: start; }
/* у вузьких таблицях довгі імена кампаній (Manual_viber_ret_rep_client_RM) переносяться будь-де, чіпи — у два рядки */
.tbl .mono { overflow-wrap: anywhere; }
.tbl .chip { white-space: normal; height: auto; min-height: 24px; padding: 3px 10px; line-height: 1.3; }
.tbl td.nw { white-space: nowrap; }
.tpl-left { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.tpl-card { display: flex; flex-direction: column; gap: 16px; }
.tpl-card .card-head { margin-bottom: 0; align-items: flex-start; }
.tpl-title { font-size: 20px; margin: 0 0 4px; overflow-wrap: anywhere; }
.tpl-card .note .pill { margin-left: 6px; }
.chan-row { display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: flex-end; }
.chan-row .seg { height: 38px; align-items: center; }
.text-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 2px; }
.counter { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.counter .bad { color: var(--bad); font-weight: 700; }
.msgs { margin: 4px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.msgs li { padding-left: 18px; position: relative; }
.msgs li::before { position: absolute; left: 0; font-weight: 700; }
.msgs li.bad { color: var(--bad); } .msgs li.bad::before { content: "✕"; }
.msgs li.warn { color: var(--warn); } .msgs li.warn::before { content: "!"; left: 4px; }
.subcard { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.subcard .row { margin-bottom: 0; }
.sub-h { font-weight: 700; font-size: 14px; }
.subcard.dup { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
.link-row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.link-row > .field:first-child { flex: 0 1 220px; }
code.url { display: block; padding: 9px 12px; border-radius: var(--r-ctl); background: var(--surface); border: 1px solid var(--border); font-size: 12px; overflow-wrap: anywhere; color: var(--ink-2); }
.preview-row { align-items: start; }
.bubble { border-radius: 16px 16px 16px 4px; padding: 10px 14px 12px; background: var(--brand-soft); border: 1px solid var(--border); max-width: 420px; }
.bubble .from { font-size: 12px; font-weight: 700; color: var(--brand); margin-bottom: 4px; }
.bubble .msg { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.versions td.vno { width: 48px; font-weight: 700; }
.versions td.vact { width: 1%; white-space: nowrap; text-align: right; }
.versions details summary { cursor: pointer; color: var(--ink-3); font-size: 12px; }
.versions .vtext { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 4px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); font-size: 12px; }
.new-camp { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.new-camp > .field:not(.grow) { flex: 0 1 180px; }
.inline-edit { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.inline-edit .inp { height: 30px; min-width: 200px; }
.inline-edit select { height: 30px; }

/* ── «Нова розсилка» (Фаза 3): чотири блоки зліва, прескоринг і прев'ю справа (прототип Main) ── */
.send-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 380px); gap: var(--gap); align-items: start; }
.send-left, .send-right { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.step-card { display: flex; flex-direction: column; gap: 14px; }
.step-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.step-h h2 { flex: 1 1 auto; }
.step { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 26px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 13px; }
.seg.sm button { padding: 4px 10px; font-size: 12px; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.chk input, .rule input[type=checkbox], .save-ver input { width: 17px; height: 17px; accent-color: var(--brand); margin: 0; }
.seg-chip { border: 1px solid transparent; cursor: pointer; font: 600 12px var(--font); white-space: normal; height: auto; min-height: 26px; padding: 4px 10px; text-align: left; max-width: 100%; }
.seg-chip.on { background: var(--brand); color: #fff; }
.seg-chip.add { background: none; border: 1px dashed var(--border-strong); color: var(--ink-2); }
.crit-box { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.crit { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(0, auto) 88px 28px; gap: 8px 12px; align-items: center; padding: 9px 12px;
  border-bottom: 1px solid var(--border); }
.crit:last-child { border-bottom: 0; }
.crit.base { background: var(--surface-2); }
.crit.add { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.crit-name { font-weight: 600; font-size: 13px; }
.crit-params { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; }
.crit-params select { height: 32px; }
.crit-left { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.crit-x { border: 0; background: none; color: var(--ink-3); font-size: 18px; cursor: pointer; line-height: 1; }
.crit-x:hover { color: var(--bad); }
.num-inp { width: 84px; height: 32px; padding: 0 8px; }
.promo-inp { width: 150px; height: 32px; }
.inp.mini { width: 60px; height: 28px; padding: 0 6px; display: inline-block; }
.aud-total { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.aud-total b { font-size: 22px; font-variant-numeric: tabular-nums; }
.chan-row .field.fb { flex: 0 1 130px; }
.save-ver { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; font-size: 13px;
  background: color-mix(in srgb, var(--warn) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
.inp.sm { font-size: 12px; }
details.utm summary { cursor: pointer; color: var(--ink-2); font-size: 13px; font-weight: 600; margin-bottom: 8px; }
details.utm .grid4 { margin-bottom: 8px; }
.rules { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 24px; }
.rules-col { min-width: 0; }
.lbl.caps { text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.rule { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.rule:last-child { border-bottom: 0; }
.rule .grow { flex: 1 1 auto; min-width: 0; }
.rule .num { font-variant-numeric: tabular-nums; font-weight: 700; }
.rule .num.muted, .rule.off { color: var(--ink-3); }
.rule .lock { color: var(--ink-3); flex: none; }
label.rule { cursor: pointer; }
.warn-t { color: var(--warn); font-weight: 700; }

.funnel { display: flex; flex-direction: column; gap: 12px; }
.funnel .row { margin-bottom: 0; }
.funnel .dim { opacity: .55; transition: opacity .2s; }
.big-num { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.big-num b { font-size: 34px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.bar { display: block; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; background: var(--brand); min-width: 2px; }
.bar.big { height: 10px; margin-top: 6px; }
.reasons { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; font-size: 13px; }
.reason { display: grid; grid-template-columns: minmax(0, 1fr) 72px 64px; gap: 8px; align-items: center; }
.reason .num { text-align: right; font-variant-numeric: tabular-nums; }
.reason.hard .bar i, .legend .sw.hard { background: var(--bad); }
.reason.opt .bar i, .legend .sw.opt { background: var(--ink-3); }
.legend { margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.ops { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.ops b { font-size: 15px; font-variant-numeric: tabular-nums; }
.cost { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.cost-sum { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tbl.sum td, .tbl.sum th { padding: 6px 8px; }
.test-row { display: flex; gap: 8px; margin-top: 10px; }
.test-row select { flex: 1 1 auto; min-width: 0; }
.tests { margin: 10px 0 4px; padding: 0; list-style: none; font-size: 12px; display: flex; flex-direction: column; gap: 4px; color: var(--ink-2); }
.send-btn { height: 50px; font-size: 15px; width: 100%; }
.send-why { margin-top: -8px; }
.pill.info { background: color-mix(in srgb, var(--sky) 16%, transparent); color: var(--sky); }

.modal-back { position: fixed; inset: 0; z-index: 60; background: rgba(10, 10, 25, .55); }
.modal { position: fixed; z-index: 61; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: var(--r-card); padding: 22px 24px; box-shadow: 0 24px 60px rgba(0,0,0,.35);
  display: flex; flex-direction: column; gap: 14px; }
.modal h2 { margin: 0; font-size: 20px; }
dl.confirm { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 0; font-size: 14px; }
dl.confirm dt { color: var(--ink-2); font-weight: 600; }
dl.confirm dd { margin: 0; overflow-wrap: anywhere; }

/* ── «Історія розсилок» ── */
.hist td { vertical-align: middle; }
.hist tr.detail td { background: var(--surface-2); cursor: default; }
.hist-detail { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 18px; padding: 6px 2px; }
ul.kv { margin: 4px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
ul.kv li { display: flex; justify-content: space-between; gap: 12px; }
ul.kv b { font-variant-numeric: tabular-nums; }

/* ── «Реєстр відмов» (прототип Optout): форма зліва, записи справа ── */
.optout-grid { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.optout-form { display: flex; flex-direction: column; gap: 14px; }
.optout-list .row { margin-bottom: 6px; }
.optout-list .filters { margin-bottom: 0; }
.optout-list .filters .inp { width: 220px; }
textarea.inp.area.sm { min-height: 72px; }
.imports { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.imp { display: flex; flex-direction: column; gap: 1px; }
.hist td.camp { min-width: 220px; max-width: 320px; }

/* ── «Налаштування» (Фаза 1, прототип Settings): компанія → бренд, блоки в сітці, одна кнопка «Зберегти»; «Доступи», «Сегменти» ── */
.seg a { display: inline-flex; align-items: center; color: var(--ink-2); padding: 7px 12px; border-radius: 9px; font: 600 13px var(--font); text-decoration: none; }
.seg a:hover { color: var(--ink); }
.seg a[aria-current="true"] { background: var(--brand); color: #fff; }
.set-scope { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.set-brand { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: var(--gap); align-items: start; }
.set-grid > .wide { grid-column: 1 / -1; }
.set-card { display: flex; flex-direction: column; gap: 14px; }
.set-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.set-h h2 { flex: 1 1 auto; }
.set-h.sub { margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--border); }
.set-h.sub .sub-h { flex: 1 1 auto; }
.scope-tag { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); border: 1px solid var(--border-strong); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.set-rows { display: flex; flex-direction: column; }
.set-rows > div { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.set-rows > div:last-child { border-bottom: 0; }
.set-rows > div > span { color: var(--ink-2); }
.set-rows > div > b { font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; }
.inp.short { max-width: 140px; }
.inp.date { flex: 0 0 160px; }
.win-rows { display: flex; flex-direction: column; gap: 10px; }
.win-row { display: grid; grid-template-columns: 130px minmax(0, 340px); align-items: center; gap: 6px 12px; }
.time-range { display: flex; align-items: center; gap: 6px; }
.time-range .inp { flex: 1 1 0; min-width: 0; }
.add-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.add-row .inp { flex: 1 1 160px; min-width: 0; height: 34px; }
.chip.snd { gap: 4px; padding-right: 4px; }
.chip .x { border: 0; background: none; color: var(--ink-2); cursor: pointer; font: 700 14px var(--font); line-height: 1; padding: 2px 5px; border-radius: 999px; }
.chip .x:hover { background: color-mix(in srgb, var(--ink) 10%, transparent); color: var(--ink); }
.chip.off { background: var(--surface-2); color: var(--ink-3); text-decoration: line-through; }
.chip.new, .tbl tr.new td { box-shadow: inset 0 0 0 1px var(--brand); }
.tbl tr.removed td { text-decoration: line-through; color: var(--ink-3); }
.tbl td.act { text-align: right; }
.tbl td.act .pill { margin-right: 4px; }
.hol-wrap { max-height: 280px; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; }
.tbl.hol td { padding: 6px 10px; }
.tbl.dom td { vertical-align: middle; }
.dom-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.tbl .dom-name .mono { white-space: nowrap; overflow-wrap: normal; }
.tbl.dom input[type=radio], .tbl.dom input[type=checkbox], .tbl.acc input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--brand); margin: 0; }
ul.set-warn { margin: 0; padding: 10px 14px 10px 28px; border-radius: 12px; background: color-mix(in srgb, var(--warn) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
.acc-user { display: flex; flex-direction: column; gap: 2px; min-width: 180px; }
.acc-user .pill { align-self: flex-start; }
.acc-grants { display: flex; flex-wrap: wrap; gap: 6px; }
.acc-grants .chip { gap: 4px; padding-right: 4px; }
.acc-grants .chip.global { background: color-mix(in srgb, var(--brand) 22%, var(--surface)); }
.acc-new { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.acc-new > .field { flex: 1 1 200px; }
.acc-new > .field.narrow { flex: 0 1 220px; }
.acc-grant-row td { background: var(--surface-2); }
.perm-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.tbl .perm-chips .chip { min-height: 22px; padding: 2px 8px; font-size: 11px; }
.seg-desc { color: var(--ink-2); font-size: 12px; margin-top: 2px; overflow-wrap: break-word; }
.tbl.segs td.seg-name { min-width: 220px; }
.tbl.segs td.seg-name b { margin-right: 6px; }
.tbl.segs td { vertical-align: middle; }
.seg-who { display: block; overflow-wrap: anywhere; }
.seg-acts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; min-width: 150px; }

/* ── Підказки (кожна кнопка дії має data-tip) ── */
.tip { position: fixed; z-index: 100; max-width: 300px; padding: 8px 10px; border-radius: 8px; background: var(--ink); color: var(--bg); font-size: 12px; line-height: 1.4; pointer-events: none; }

/* ── Вхід і «немає доступу»: фірмовий фон, картка на склі ── */
.auth-screen { min-height: 100dvh; display: grid; place-items: center; padding: 24px; position: relative; color: #fff;
  background: var(--sig-navy) url("brand/bg.jpg") center / cover no-repeat; }
.auth-card { width: min(420px, 100%); padding: 40px 36px 32px; text-align: center; background: rgba(19,19,42,.72); border: 1px solid rgba(255,255,255,.14);
  border-radius: 16px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 24px 60px rgba(0,0,0,.45); }
.auth-logo { height: 48px; width: auto; display: block; margin: 0 auto 26px; }
.auth-card h1 { font-size: 26px; line-height: 1.2; font-weight: 400; margin: 0 0 6px; letter-spacing: -.01em; }
.auth-card h1 b { font-weight: 700; }
.auth-sub { margin: 0 0 26px; color: rgba(255,255,255,.75); line-height: 1.5; }
.auth-btn { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; padding: 14px 18px; border-radius: 10px; background: #fff; color: var(--sig-navy);
  font-weight: 700; font-size: 16px; text-decoration: none; transition: transform .12s ease, box-shadow .12s ease; }
.auth-btn:hover { transform: translateY(-1px); box-shadow: 0 0 0 3px var(--sig-lime); }
.auth-btn.ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.35); }
.auth-btn svg { width: 20px; height: 20px; flex: none; }
.auth-row { display: flex; gap: 10px; } .auth-row .auth-btn { font-size: 15px; padding: 12px 14px; }
.auth-err { margin: 0 0 18px; padding: 10px 12px; border-radius: 10px; background: rgba(255,138,122,.14); border: 1px solid rgba(255,138,122,.5); color: #FFB3A7; font-size: 14px; text-align: left; }
.auth-squares { justify-content: center; margin: 28px 0 0; display: flex; }
.auth-foot { position: absolute; left: 0; right: 0; bottom: 18px; text-align: center; font-size: 12px; color: rgba(255,255,255,.45); }
.auth-foot a { color: inherit; text-decoration: none; }

/* ── Вузькі екрани: меню над контентом (робочі місця — десктоп) ── */
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px; }
  .side .logo { padding: 4px 8px; }
  .side-foot { margin-top: 0; padding-top: 0; border-top: 0; flex-direction: row; flex-wrap: wrap; align-items: center; width: 100%; }
  .top { position: static; padding: 10px 16px; }
  main { padding: 16px; }
  .facts { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1180px) {
  .tpl-grid, .send-grid, .optout-grid { grid-template-columns: minmax(0, 1fr); }
  .hist-detail { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .grid2, .grid3, .grid4, .rules { grid-template-columns: minmax(0, 1fr); }
  .inp.date { flex: 1 1 100%; }
  .win-row { grid-template-columns: minmax(0, 1fr); }
  .crit { grid-template-columns: minmax(0, 1fr) 70px 24px; }
  .crit-params { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
  .ops { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .optout-list .filters .inp { width: 100%; }
}
