/* Emi AI — интерфейс запуска рекламы.
   Раскладка: шапка на всю ширину, ниже три колонки — меню, раздел, чат. */

:root {
  --ink: #1F2228;
  --ink-2: #45414D;
  --muted: #6E6878;
  --line: #E8E5EE;
  --line-soft: #F0EEF4;
  --paper: #FFFFFF;
  --ground: #F6F5F8;

  --accent: #7960EF;
  --accent-deep: #4A35B8;
  --accent-tint: #F1EEFD;
  --accent-tint-2: #F3F0FE;

  --ok: #1F7A5A;
  --ok-deep: #1A6349;
  --ok-tint: #E4F2EC;
  --warn: #C77700;
  --warn-deep: #8A5600;
  --warn-tint: #FBF0E0;
  --bad: #B23A3A;

  --radius: 16px;      /* карточки */
  --radius-sm: 8px;    /* кнопки, поля, чипы — заметно строже карточек */
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Golos Text", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--ground);
  font-size: 15px;
  line-height: 1.5;
}

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

h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
h2 { margin: 0; font-size: 19px; font-weight: 700; }
h3 { margin: 0; font-size: 16px; font-weight: 600; }
p { margin: 0; }

.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.prose { line-height: 1.55; color: var(--ink-2); max-width: 62ch; }

/* ─── Шапка ─────────────────────────────────────────────────────────── */

.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.top-left, .top-right { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.logo { display: block; height: 28px; width: auto; }

.context {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px;
  border-left: 1px solid var(--line); padding-left: 14px;
  font-size: 14px; color: var(--ink-2);
}

.balance { display: flex; align-items: baseline; gap: 8px; font-size: 14px; }
.balance b { font-weight: 600; }

.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--ink); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}

.chip {
  font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-2);
  background: var(--ground); border: 0; cursor: pointer;
  padding: 8px 11px; border-radius: 9px;
  display: flex; align-items: center; gap: 8px;
}
.chip:hover { background: var(--line-soft); }
.chip[aria-expanded="true"] { background: var(--accent-tint); color: var(--ink); }
.chip .mark {
  width: 20px; height: 20px; border-radius: 6px; flex-shrink: 0;
  background: var(--ink); color: #fff;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* Разделы в шапке: текст с подчёркиванием у активного.
   Заливка здесь спорила с логотипом и переключателем площадки. */
.topnav { display: flex; gap: 20px; margin-left: 4px; }
.topnav a {
  font-size: 14px; color: var(--muted); text-decoration: none;
  padding: 4px 0; border-bottom: 2px solid transparent;
}
.topnav a:hover { color: var(--ink-2); }
.topnav a.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }

.menu-wrap { position: relative; }
.menu {
  position: absolute; top: calc(100% + 10px); z-index: 20;
  width: 290px; background: var(--paper);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 32px rgba(31, 34, 40, 0.14);
  padding: 8px;
}
.menu.right { right: 0; } .menu.left { left: 0; }
.menu-title {
  padding: 8px 10px 10px; font-size: 12px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.menu-item {
  width: 100%; font: inherit; text-align: left;
  background: none; border: 0; cursor: pointer;
  padding: 10px; border-radius: var(--radius-sm);
  display: flex; align-items: center; gap: 11px;
}
.menu-item:hover { background: var(--ground); }
.menu-item[aria-selected="true"] { background: var(--accent-tint); }
.menu-item:disabled { cursor: default; color: var(--muted); }
.menu-item:disabled:hover { background: none; }
.menu-item .mark {
  width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0;
  background: var(--line-soft); color: var(--muted);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.menu-item[aria-selected="true"] .mark { background: var(--ink); color: #fff; }
.menu-item .body { flex: 999 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.menu-item .body b { font-size: 14px; font-weight: 600; }
.menu-item .body span { font-size: 13px; color: var(--muted); }

/* ─── Раскладка ─────────────────────────────────────────────────────── */

.shell {
  display: flex; flex-wrap: wrap; gap: 20px;
  padding: 22px 24px 48px; align-items: flex-start;
}
.rail { flex: 1 1 220px; max-width: 256px; display: flex; flex-direction: column; gap: 16px; }

/* Мастер кампании: колонку с разделом держим узкой, чтобы строка
   не растягивалась на пол-экрана и текст читался. Меню не трогаем. */
.shell.narrow { max-width: 1340px; margin: 0 auto; width: 100%; }
.shell.narrow .work { max-width: 680px; }
.work { flex: 999 1 460px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.side {
  flex: 1 1 320px; max-width: 376px;
  /* Чат занимает всю высоту экрана и остаётся на месте, пока
     прокручивается раздел: разговор идёт параллельно работе. */
  position: sticky; top: 84px; align-self: flex-start;
}

.card {
  background: var(--paper); border-radius: var(--radius); padding: 24px;
  display: flex; flex-direction: column; gap: 18px;
}
.card.tight { padding: 16px; gap: 14px; }
.card.accent { background: var(--accent-tint-2); }
.card.dark { background: var(--ink); color: #fff; }
.card.dark .muted { color: #B5AFC2; }

.head { display: flex; flex-wrap: wrap; gap: 12px; align-items: baseline; justify-content: space-between; }

/* ─── Меню разделов ─────────────────────────────────────────────────── */

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  text-decoration: none; color: var(--ink-2);
  padding: 10px 11px; border-radius: var(--radius-sm);
  font-size: 14px;
}
.nav a:hover { background: var(--ground); }
.nav a.on { background: var(--accent-tint); color: var(--ink); font-weight: 600; }
.nav .step {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  background: var(--line-soft); color: var(--muted);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.nav .step.done { background: var(--ok); color: #fff; }
.nav a.on .step { background: var(--accent); color: #fff; }

.progress { display: flex; flex-direction: column; gap: 9px; }
.progress .bar { height: 6px; border-radius: 3px; background: #E4E1EA; overflow: hidden; }
.progress .bar i { display: block; height: 100%; background: var(--accent); }
.progress .bar i.full { background: var(--ok); }

/* ─── Элементы ──────────────────────────────────────────────────────── */

.btn {
  font: inherit; font-size: 14px; font-weight: 600;
  border-radius: var(--radius-sm); cursor: pointer; padding: 12px 18px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
}
.btn:hover { background: var(--ground); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #000; }
.btn.light { background: #fff; border-color: #fff; color: var(--ink); }
.btn.small { padding: 8px 14px; font-size: 13px; border-radius: var(--radius-sm); }
.btn.ghost { border-color: transparent; background: none; }
.btn:focus-visible, a:focus-visible, input:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.spread { justify-content: space-between; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-size: 14px; font-weight: 600; }
.field input, .field textarea {
  font: inherit; font-size: 15px; padding: 13px 15px;
  border: 1px solid #DCD8E4; border-radius: var(--radius-sm);
  background: var(--paper); color: var(--ink);
}
.field input:focus, .field textarea:focus { border-color: var(--accent); outline: none; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.four { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

.pick {
  display: flex; flex-wrap: wrap; gap: 13px; align-items: center;
  border: 1px solid var(--line); border-radius: 12px; padding: 14px 15px;
  cursor: pointer;
}
.pick.on { border: 2px solid var(--accent); padding: 13px 14px; background: #FBFAFF; }
.pick input[type="checkbox"], .pick input[type="radio"] {
  width: 18px; height: 18px; accent-color: var(--accent); margin: 0; flex-shrink: 0;
}
.pick .body { flex: 999 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pick .body b { font-size: 15px; font-weight: 600; }
.pick .body span { font-size: 13px; color: var(--muted); }
.pick .val { flex: 0 0 auto; font-size: 15px; font-weight: 600; }

.tag {
  display: inline-flex; align-items: center; align-self: flex-start;
  font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: var(--line-soft); color: var(--ink-2); white-space: nowrap;
}
.tag.ok { background: var(--ok-tint); color: var(--ok-deep); }
.tag.warn { background: var(--warn-tint); color: var(--warn-deep); }
.tag.info { background: var(--accent-tint); color: var(--accent-deep); }

.banner {
  display: flex; gap: 12px; align-items: flex-start;
  border-radius: 13px; padding: 15px 17px; font-size: 14px; line-height: 1.55;
}
.banner.ok { background: var(--ok-tint); color: var(--ok-deep); }
.banner.warn { background: var(--warn-tint); color: #6B4300; }
.banner.info { background: var(--accent-tint-2); color: var(--ink-2); }
.banner svg { flex-shrink: 0; margin-top: 2px; }

.rows { display: flex; flex-direction: column; }
.rows .row {
  display: flex; flex-wrap: wrap; gap: 13px; align-items: baseline;
  padding: 13px 0; border-top: 1px solid var(--line-soft);
}
.rows .row dt, .rows .row .k { flex: 0 0 150px; font-size: 14px; color: var(--muted); }
.rows .row dd, .rows .row .v { margin: 0; flex: 999 1 180px; min-width: 0; font-weight: 500; }

/* В узких карточках подпись и значение стоят в одну строку по краям */
.rows.compact .row { justify-content: space-between; align-items: baseline; gap: 10px; }
.rows.compact .row .k { flex: 1 1 auto; }
.rows.compact .row .v { flex: 0 0 auto; text-align: right; font-weight: 600; }

.kpi { display: flex; flex-direction: column; gap: 5px; }
.kpi .label { font-size: 13px; color: var(--muted); }
.kpi .value { font-size: 26px; font-weight: 700; }

.thumb {
  aspect-ratio: 4 / 3; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 10px; font-size: 12px; color: var(--muted);
}

/* ─── Чат ───────────────────────────────────────────────────────────── */

.chat {
  background: var(--paper); border-radius: var(--radius);
  display: flex; flex-direction: column; overflow: hidden;
  height: calc(100vh - 108px);
  min-height: 420px;
}
.chat-head {
  padding: 14px 16px; border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 11px; flex-shrink: 0;
}
.chat-head img { width: 30px; height: 30px; flex-shrink: 0; }
.chat-head .who { flex: 999 1 auto; min-width: 0; display: flex; flex-direction: column; }
.chat-head .who b { font-size: 15px; font-weight: 600; }
.chat-head .who span { font-size: 12px; color: var(--muted); }

.thread {
  flex: 1 1 auto; overflow-y: auto;
  padding: 16px; display: flex; flex-direction: column; gap: 14px;
}
.msg { font-size: 14px; line-height: 1.55; white-space: pre-line; }
.msg.me {
  align-self: flex-end; max-width: 88%;
  background: var(--accent-tint); border-radius: 14px 14px 4px 14px;
  padding: 10px 13px;
}
.msg.emi { max-width: 94%; }
.msg.typing { color: var(--muted); }

.proposal { border: 1px solid #DCD8E4; border-radius: 13px; overflow: hidden; }
.proposal .top-part {
  padding: 12px 14px; background: #FBFAFF;
  display: flex; flex-direction: column; gap: 5px;
}
.proposal .kind {
  font-size: 12px; font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--accent-deep);
}
.proposal b { font-size: 15px; line-height: 1.35; }
.proposal p { font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.proposal .buttons {
  padding: 10px 14px; border-top: 1px solid var(--line-soft);
  display: flex; gap: 8px;
}

.composer {
  flex-shrink: 0; padding: 14px 16px; border-top: 1px solid var(--line-soft);
  display: flex; flex-direction: column; gap: 10px;
}
.hints { display: flex; flex-wrap: wrap; gap: 6px; }
.hints button {
  font: inherit; font-size: 13px; color: var(--ink-2);
  background: var(--ground); border: 0; cursor: pointer;
  padding: 7px 12px; border-radius: 999px;
}
.hints button:hover { background: var(--line-soft); }
.ask {
  display: flex; gap: 8px; align-items: center;
  border: 1px solid #DCD8E4; border-radius: 12px; padding: 4px 4px 4px 13px;
}
.ask input {
  flex: 999 1 auto; min-width: 0; font: inherit; font-size: 14px;
  border: 0; outline: none; padding: 9px 0; background: transparent; color: var(--ink);
}
.ask .send {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 9px;
  background: var(--accent); border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.ask .send:disabled { background: #C9C2E8; cursor: default; }

/* ─── Мелочи ────────────────────────────────────────────────────────── */

.status-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.status-dot.live { background: var(--ok); }
.status-dot.off { background: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-size: 14px;
  padding: 12px 20px; border-radius: 12px; z-index: 60;
  box-shadow: 0 10px 30px rgba(31, 34, 40, 0.25);
}

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.spin { animation: spin 1.1s linear infinite; transform-origin: 50% 50%; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }

@media (max-width: 900px) {
  .shell { padding: 16px; }
  .side { position: static; }
  .chat { height: auto; min-height: 480px; }
  .rail, .side { max-width: none; flex-basis: 100%; }
  .two, .three, .four { grid-template-columns: 1fr; }
  .chat { max-height: none; }
}


/* ─── Таблицы списков ───────────────────────────────────────────────── */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs button {
  font: inherit; font-size: 16px; font-weight: 600; color: var(--muted);
  background: none; border: 0; cursor: pointer;
  padding: 12px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button:hover { color: var(--ink-2); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--ink); }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters .search {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid #DCD8E4; border-radius: var(--radius-sm);
  padding: 0 12px; flex: 1 1 220px; max-width: 320px; background: var(--paper);
}
.filters .search:focus-within { border-color: var(--accent); }
.filters .search input {
  font: inherit; font-size: 14px; border: 0; outline: none;
  padding: 9px 0; width: 100%; background: transparent; color: var(--ink);
}

.filter-btn {
  font: inherit; font-size: 14px; color: var(--ink-2);
  background: var(--paper); border: 1px solid #DCD8E4; cursor: pointer;
  padding: 9px 13px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
.filter-btn:hover { background: var(--ground); }
/* Изменённый фильтр подсвечен: иначе не вспомнить, почему список короткий */
.filter-btn.on { background: var(--accent-tint); border-color: var(--accent-tint); color: var(--ink); }
.filter-btn[aria-expanded="true"] { border-color: var(--accent); }

/* Таблица шире экрана прокручивается внутри себя, страница — нет */
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th {
  text-align: left; font-weight: 500; font-size: 13px; color: var(--muted);
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.list td {
  padding: 13px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top;
}
table.list tr:hover td { background: var(--ground); }
table.list tr.clickable { cursor: pointer; }
table.list .name { color: var(--ink); text-decoration: none; display: inline-block; }
table.list a.name:hover { text-decoration: underline; color: var(--accent-deep); }
table.list .right { text-align: right; }
table.list .id { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
table.list .name { font-weight: 500; }
table.list .sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
table.list .total-row td { background: var(--ground); font-weight: 600; }

/* Компактная таблица внутри ответа чата */
table.list.compact { font-size: 13px; }
table.list.compact th { padding: 6px 8px; }
table.list.compact td { padding: 8px; }
table.list.compact .id { font-size: 11px; }

/* Заголовок-кнопка: подпись и значок сортировки.
   В правых столбцах значок уходит влево, чтобы цифры держали край. */
table.list th button.sort {
  font: inherit; font-size: 13px; font-weight: 500; color: var(--muted);
  background: none; border: 0; cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; gap: 5px;
}
table.list th button.sort:hover { color: var(--ink-2); }
table.list th button.sort.on { color: var(--ink); font-weight: 600; }

.status-cell { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }

.summary { display: flex; flex-wrap: wrap; gap: 8px; }
.summary-chip {
  font: inherit; font-size: 13px; color: var(--ink-2);
  background: var(--line-soft); border: 1px solid transparent; cursor: pointer;
  padding: 6px 11px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 7px;
}
.summary-chip:hover { background: #E8E5EE; }
.summary-chip.on { background: var(--accent-tint); border-color: var(--accent); color: var(--ink); }

.preview {
  width: 56px; height: 42px; border-radius: 8px; object-fit: cover;
  background: var(--line-soft); display: block;
}

/* Выбор строк и действия с ними */
.check {
  width: 18px; height: 18px; box-sizing: border-box; border-radius: 5px;
  border: 1.5px solid #C7C2D0; background: var(--paper); cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.check.on { background: var(--accent); border-color: var(--accent); }
.check:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
table.list th.pick-col, table.list td.pick-col { box-sizing: border-box; width: 38px; min-width: 38px; padding-right: 8px; }
table.list tr.picked td { background: #F7F5FE; }
table.list tr.picked:hover td { background: var(--accent-tint); }
table.list .picked-row td { background: #F7F5FE; font-weight: 600; }
table.list td.name-cell { position: relative; padding-right: 44px; min-width: 240px; }
.more {
  position: absolute; top: 10px; right: 6px;
  width: 28px; height: 28px; border: 0; border-radius: 6px; background: none;
  cursor: pointer; color: #9A93A6; display: inline-flex; align-items: center; justify-content: center;
}
.more:hover, .more.on { background: var(--line-soft); color: var(--ink); }
.row-menu { position: fixed; z-index: 30; width: 230px; padding: 6px; top: auto; }
.row-menu .menu-item { padding: 9px 10px; font-size: 14px; justify-content: space-between; }
.row-menu .sep { height: 1px; background: var(--line-soft); margin: 5px 4px; }

.bulk-bar {
  position: sticky; bottom: 16px; z-index: 4; margin-top: 14px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  background: var(--ink); color: #fff; border-radius: 12px;
  padding: 8px 8px 8px 14px; box-shadow: 0 12px 32px rgba(31, 34, 40, 0.24);
}
.bulk-bar .count {
  display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600;
  padding-right: 12px; margin-right: 4px; border-right: 1px solid rgba(255,255,255,0.14);
}
.bulk-bar .check { background: #fff; border-color: #fff; }
.bulk-bar button.act {
  font: inherit; font-size: 14px; font-weight: 500; color: #fff;
  background: rgba(255,255,255,0.08); border: 0; cursor: pointer;
  padding: 9px 13px; border-radius: var(--radius-sm); white-space: nowrap;
}
.bulk-bar button.act:hover { background: rgba(255,255,255,0.16); }
.bulk-bar button.act.emi { background: var(--accent); display: flex; align-items: center; gap: 8px; }
.bulk-bar button.act.emi:hover { background: var(--accent-deep); }
.bulk-bar button.act.close { background: none; padding: 9px 10px; }
.bulk-bar .check svg { stroke: var(--ink); }
table.list td.num, table.list td.right { white-space: nowrap; }

/* Таблица отфильтрована чатом */
.emi-filter {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  background: var(--accent-tint-2); border: 1px solid #DCD3FB;
  border-radius: 12px; padding: 12px 14px; margin-bottom: 12px;
}
.emi-filter img { width: 28px; height: 28px; flex-shrink: 0; }
.emi-filter .text { flex: 999 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 3px; font-size: 14px; }
.emi-filter .text b { color: var(--accent-deep); font-weight: 600; }
.emi-filter .question { color: var(--ink); }
.emi-filter .muted { font-size: 13px; }

/* Причина отклонения под статусом */
.reason {
  margin-top: 5px; min-width: 220px; max-width: 300px; font-size: 13px; line-height: 1.4; color: var(--ink-2);
  white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.reason b { font-weight: 600; }
.reason .more-reasons { color: var(--muted); }

/* ─── Аналитика ──────────────────────────────────────────────────────── */
.an-report { font: inherit; font-size: 15px; color: var(--ink-2); background: none; border: 0; cursor: pointer; padding: 0; display: flex; align-items: center; gap: 7px; }
.an-report b { color: var(--ink); font-weight: 600; }
.an-builder { gap: 12px; }
.an-row { display: flex; gap: 12px; align-items: flex-start; }
.an-label { flex: 0 0 110px; font-size: 13px; color: var(--muted); padding-top: 8px; }
.an-items { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }
.an-chip {
  font-size: 14px; color: var(--ink); background: var(--accent-tint); border-radius: var(--radius-sm);
  padding: 6px 7px 6px 11px; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
.an-chip.soft { background: var(--ground); }
.an-chip .n { font-size: 12px; color: var(--accent-deep); font-weight: 600; margin-right: 6px; }
.an-chip .x { width: 20px; height: 20px; border: 0; border-radius: 5px; background: none; cursor: pointer; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.an-chip .x:hover { background: #E3DDFB; color: var(--ink); }
.an-add {
  font: inherit; font-size: 14px; color: var(--accent-deep); background: var(--paper);
  border: 1px dashed #C9BEF7; border-radius: var(--radius-sm); padding: 6px 12px; cursor: pointer; white-space: nowrap;
}
.an-add:hover, .an-add[aria-expanded="true"] { background: #FBFAFF; }
.an-preset { font: inherit; font-size: 13px; color: var(--ink-2); background: var(--ground); border: 0; border-radius: var(--radius-sm); padding: 8px 11px; cursor: pointer; }
.an-preset.on { background: var(--ink); color: #fff; }
.an-dates { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.an-dates input { font: inherit; font-size: 13px; color: var(--ink); border: 1px solid #DCD8E4; border-radius: var(--radius-sm); padding: 6px 8px; background: var(--paper); }
.an-compare { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); cursor: pointer; margin-left: 4px; }
.an-metric {
  font: inherit; font-size: 13px; color: var(--muted); background: var(--paper); border: 1px solid #DCD8E4;
  border-radius: var(--radius-sm); padding: 6px 11px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.an-metric.on { color: var(--ink); background: var(--accent-tint); border-color: var(--accent-tint); }
.an-metric .site { font-size: 11px; font-weight: 600; color: var(--ok); background: var(--ok-tint); padding: 1px 6px; border-radius: 999px; }

.an-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.an-kpi {
  font: inherit; text-align: left; background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  padding: 13px 15px; cursor: pointer; display: flex; flex-direction: column; gap: 4px;
}
.an-kpi.on { border: 2px solid var(--accent); padding: 12px 14px; }
.an-kpi .title { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.an-kpi .sw { width: 8px; height: 8px; border-radius: 2px; }
.an-kpi .value { font-size: 21px; font-weight: 700; letter-spacing: -0.01em; }
.an-kpi .delta { font-size: 12px; }

.an-legend { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; font-size: 13px; color: var(--ink-2); }
.an-legend span { display: inline-flex; align-items: center; gap: 7px; }
.an-legend i.bar { width: 10px; height: 10px; border-radius: 2px; background: #B9AAF7; }
.an-legend i.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.an-steps { display: flex; background: var(--ground); border-radius: var(--radius-sm); padding: 3px; }
.an-steps button { font: inherit; font-size: 13px; color: var(--muted); background: none; border: 0; border-radius: 6px; padding: 5px 11px; cursor: pointer; }
.an-steps button.on { background: var(--paper); color: var(--ink); }
.an-chart { display: flex; gap: 10px; }
.an-y { display: flex; flex-direction: column; justify-content: space-between; height: 220px; font-size: 11px; color: #9A93A6; text-align: right; min-width: 44px; }
.an-plot-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.an-plot {
  position: relative; height: 220px; border-bottom: 1px solid var(--line);
  background-image: linear-gradient(var(--line-soft) 1px, transparent 1px); background-size: 100% 33.33%;
}
.an-cols { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 3px; }
.an-col { flex: 1; min-width: 0; height: 100%; position: relative; display: flex; align-items: flex-end; }
.an-col .bar { width: 100%; background: #B9AAF7; border-radius: 3px 3px 0 0; min-height: 1px; }
.an-col .bar.weekend { background: #DDD5FB; }
.an-col:hover .bar { background: var(--accent); }
.an-col .dot { position: absolute; left: 50%; width: 7px; height: 7px; margin: 0 0 -3.5px -3.5px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 2px #fff; z-index: 2; }
.an-col .tip {
  display: none; position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); z-index: 5;
  background: var(--ink); color: #fff; border-radius: 10px; padding: 9px 12px; font-size: 12px; line-height: 1.55; white-space: nowrap;
  box-shadow: 0 8px 20px rgba(31, 34, 40, 0.22); pointer-events: none;
}
.an-col .tip b { font-size: 13px; }
.an-col:hover .tip { display: block; bottom: 60%; }
.an-line { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.an-line svg { width: 100%; height: 100%; overflow: visible; display: block; }
.an-x { display: flex; gap: 3px; font-size: 11px; color: #9A93A6; }
.an-x span { flex: 1; min-width: 0; text-align: center; white-space: nowrap; overflow: visible; }

.an-table td { white-space: nowrap; }
.an-node { display: inline-flex; align-items: center; gap: 8px; }
.an-node .chev { line-height: 0; transition: transform 0.15s; }
.an-node .chev.open { transform: rotate(90deg); }
.an-tag { font-size: 11px; font-weight: 500; color: var(--muted); background: var(--line-soft); padding: 1px 6px; border-radius: 999px; }
.an-empty { gap: 10px; }

/* ─── Картинки: загрузка и конкуренты ────────────────────────────────── */
.uploads { display: flex; flex-wrap: wrap; gap: 12px; align-items: stretch; }
.dropzone {
  flex: 1 1 280px; min-height: 172px; box-sizing: border-box; position: relative;
  border: 2px dashed #C9BEF7; border-radius: 14px; background: #FBFAFF; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 18px; text-align: center; font-size: 13px;
}
.dropzone b { font-size: 15px; }
.dropzone.over, .dropzone:hover { border-color: var(--accent); background: var(--accent-tint); }
.upload { flex: 0 0 172px; display: flex; flex-direction: column; gap: 5px; }
.upload .frame { position: relative; width: 172px; height: 172px; border-radius: 12px; overflow: hidden; border: 2px solid var(--accent); box-sizing: border-box; background: var(--line-soft); }
.upload .frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.upload .remove { position: absolute; top: 7px; right: 7px; width: 24px; height: 24px; border-radius: 6px; border: 0; background: rgba(31, 34, 40, 0.6); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.upload .name { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload .size { font-size: 12px; }

.rivals {
  display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 2px;
  padding: 2px 2px 10px; margin: 0 -2px; overscroll-behavior-x: contain;
}
.rival {
  flex: 0 0 220px; scroll-snap-align: start; border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; display: flex; flex-direction: column; background: var(--paper);
}
.rival.on { border: 2px solid var(--accent); }
.rival .pic { position: relative; aspect-ratio: 1; background: var(--line-soft); }
.rival .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rival .days { position: absolute; top: 7px; left: 7px; font-size: 11px; font-weight: 600; color: #fff; background: rgba(31, 34, 40, 0.78); padding: 3px 7px; border-radius: 999px; }
.rival .live { position: absolute; top: 7px; right: 7px; font-size: 10px; font-weight: 600; color: var(--ok-deep); background: var(--ok-tint); padding: 2px 6px; border-radius: 999px; }
.rival .note { position: absolute; bottom: 7px; left: 7px; right: 7px; font-size: 10px; color: #fff; background: rgba(31, 34, 40, 0.55); padding: 2px 6px; border-radius: 5px; text-align: center; }
.rival .body { padding: 10px 11px 11px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.rival .meta { display: flex; flex-direction: column; gap: 1px; font-size: 11px; color: var(--muted); }
.rival .meta b { font-size: 13px; color: var(--ink); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rival .domain { color: var(--muted); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rival .domain:hover { text-decoration: underline; }
.rival .why {
  font-size: 12px; line-height: 1.45; color: var(--ink-2); background: #FBFAFF; border-radius: 8px; padding: 7px 9px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.rival .why b { color: var(--accent-deep); font-weight: 600; }
.rival .btn { margin-top: auto; padding: 7px 10px; font-size: 12px; }
.rivals-wrap { position: relative; }
.rivals-wrap .slide {
  position: absolute; top: 96px; z-index: 3; width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0;
  box-shadow: 0 4px 14px rgba(31, 34, 40, 0.18);
}
.rivals-wrap .slide:hover { background: var(--ground); }
.rivals-wrap .slide[hidden] { display: none; }
.rivals-wrap .slide.prev { left: -12px; }
.rivals-wrap .slide.next { right: -12px; }
.rivals-wrap .slide.prev span { display: inline-block; transform: rotate(180deg); }

.brief { border: 2px solid var(--accent); }
.brief .eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent-deep); }
.brief-row { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; }
.brief-row figure { margin: 0; display: flex; flex-direction: column; gap: 6px; width: 180px; }
.brief-row figure img, .brief-row .placeholder { width: 180px; height: 180px; object-fit: cover; border-radius: 12px; display: block; }
.brief-row .placeholder { background: var(--ground); border: 2px dashed var(--line); box-sizing: border-box; display: flex; align-items: center; justify-content: center; text-align: center; padding: 16px; font-size: 13px; color: var(--muted); }
.brief-row img.faded { opacity: 0.55; }
.brief-row figcaption { font-size: 12px; color: var(--muted); font-weight: 600; }
.brief-text { flex: 1 1 280px; display: flex; flex-direction: column; gap: 9px; font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.brief-text p { margin: 0; }
.brief-text b { color: var(--ink); font-weight: 600; }
.brief-text .prompt { background: var(--ground); border-radius: 10px; padding: 12px 14px; font-size: 13px; color: var(--ink); }
.brief-row .placeholder.busy { border-color: var(--accent); color: var(--accent-deep); background: var(--accent-tint); animation: pulse 1.6s ease-in-out infinite; }
.brief-row img.result { outline: 2px solid var(--accent); outline-offset: 2px; }
@keyframes pulse { 50% { opacity: 0.6; } }

/* Шаги впереди незаполненного закрыты */
.nav .locked { display: flex; align-items: center; gap: 11px; padding: 10px 11px; border-radius: 10px; font-size: 14px; color: #B5AFC2; cursor: not-allowed; }
.nav .locked .step { opacity: 0.6; }
.next-locked { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; text-align: right; }
.next-locked .muted { font-size: 13px; max-width: 320px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.brief textarea { font: inherit; font-size: 14px; line-height: 1.5; border: 1px solid #DCD8E4; border-radius: var(--radius-sm); padding: 10px 12px; resize: vertical; width: 100%; box-sizing: border-box; }
.brief textarea:focus { outline: none; border-color: var(--accent); }

/* Тексты объявлений: правка на месте */
.ad-text-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0; }
.link-btn { font: inherit; font-size: 13px; color: var(--accent-deep); background: none; border: 0; padding: 0; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.ad-editor .field { display: flex; flex-direction: column; gap: 6px; }
.ad-editor .label-row { display: flex; justify-content: space-between; align-items: baseline; }
.ad-editor label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.ad-editor .counter { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ad-editor input, .ad-editor textarea, .ad-editor select {
  font: inherit; font-size: 15px; color: var(--ink); background: var(--paper);
  border: 1px solid #DCD8E4; border-radius: var(--radius-sm); padding: 10px 12px; width: 100%; box-sizing: border-box;
}
.ad-editor textarea { resize: vertical; line-height: 1.5; font-size: 14px; }
.ad-editor input:focus, .ad-editor textarea:focus, .ad-editor select:focus { outline: none; border-color: var(--accent); }
.ad-editor select { max-width: 260px; }

/* Варианты заголовков от Emi */
.ideas { display: flex; flex-direction: column; gap: 12px; background: var(--accent-tint-2); border-radius: 14px; padding: 16px; }
.idea-list { display: flex; flex-direction: column; gap: 8px; }
.idea { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; background: var(--paper); border-radius: 12px; padding: 12px 14px; }
.idea.added { opacity: 0.6; }
.idea-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.idea-body .tag { align-self: flex-start; font-size: 11px; }
.idea-body b { font-size: 15px; }
.idea-body .text { font-size: 14px; color: var(--ink-2); }
.idea-body .basis { font-size: 12px; }
.idea-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }

/* ─── Уведомления ────────────────────────────────────────────────────── */
.bell { position: relative; }
.bell.on { background: var(--accent-tint); }
.bell-count { position: absolute; top: 1px; right: 0; min-width: 16px; height: 16px; border-radius: 8px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; padding: 0 3px; box-sizing: border-box; }
.notif-menu { width: 370px; padding: 0; overflow: hidden; }
.notif-menu-head { padding: 13px 16px 10px; display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; }
.notif-menu-head a { font-size: 13px; text-decoration: none; }
.notif-mini { padding: 11px 16px; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 6px; }
.notif-mini .row { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; line-height: 1.35; }
.notif-mini .row .muted { font-size: 12px; white-space: nowrap; }
.notif-mini .why { font-size: 13px; line-height: 1.4; }
.notif-menu-foot { padding: 10px 16px; border-top: 1px solid var(--line-soft); background: #FBFAFF; font-size: 12px; color: var(--muted); }

.tg-block { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 14px; }
.tg-icon { width: 40px; height: 40px; border-radius: 12px; background: #E8F4FB; display: flex; align-items: center; justify-content: center; flex-shrink: 0; line-height: 0; }
.tg-text { flex: 999 1 300px; display: flex; flex-direction: column; gap: 3px; font-size: 14px; }
.tg-text .muted { font-size: 13px; }
.tab-count { margin-left: 6px; color: var(--bad); }

.notif-card { border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 9px; }
.notif-card.money { border-color: #F1D9B5; background: #FFFDF9; }
.notif-card .top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; font-size: 12px; }
.notif-card .kind { font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent-deep); }
.notif-card .title { font-size: 17px; line-height: 1.35; }
.notif-card p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.notif-card p b { color: var(--ink); font-weight: 600; }
.notif-card .bottom { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; }
.notif-card .deadline { font-size: 12px; }
.notif-card .verdict { font-size: 13px; font-weight: 600; padding: 7px 11px; border-radius: 8px; align-self: flex-start; background: var(--line-soft); color: var(--ink-2); }
.notif-card .verdict.approved { background: var(--ok-tint); color: var(--ok-deep); }
.notif-event { display: flex; flex-direction: column; gap: 3px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.notif-event .when { font-size: 12px; }
.ask-channel { align-items: center; flex-wrap: wrap; }

/* Создание кампании в Авито */
.launch-log ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.launch-log li { display: flex; gap: 10px; font-size: 14px; line-height: 1.45; }
.launch-log .mark { width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; background: var(--ok-tint); color: var(--ok-deep); }
.launch-log li.warn .mark { background: var(--warn-tint); color: var(--warn-deep); }
.launch-log li.error .mark { background: #FBE9E9; color: var(--bad); }
.launch-log li.wait .mark { background: var(--accent-tint); color: var(--accent-deep); }
.launched { border: 2px solid var(--ok); }
.launched .eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ok-deep); }
.ad-editor .counter.over { color: var(--bad); font-weight: 600; }

/* Диалог подтверждения */
.dialog-backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgba(31, 34, 40, 0.42);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: fade-in 0.15s ease-out;
}
.dialog {
  width: 100%; max-width: 440px; background: var(--paper); border-radius: 18px;
  padding: 24px; box-shadow: 0 24px 64px rgba(31, 34, 40, 0.28);
  display: flex; flex-direction: column; gap: 14px; animation: pop-in 0.18s ease-out;
}
.dialog h2 { margin: 0; font-size: 21px; line-height: 1.3; }
.dialog-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--line-soft); color: var(--ink-2); }
.dialog-icon.accent { background: var(--accent-tint); color: var(--accent-deep); }
.dialog-icon.danger { background: #FBE9E9; color: var(--bad); }
.dialog-text { margin: 0; font-size: 15px; line-height: 1.55; color: var(--ink-2); }
.dialog-rows { background: var(--ground); border-radius: 12px; padding: 4px 14px; }
.dialog-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; font-size: 15px; }
.dialog-row + .dialog-row { border-top: 1px solid var(--line); }
.dialog-note { font-size: 13px; line-height: 1.5; color: var(--muted); }
.dialog-note.accent { color: var(--ink-2); background: var(--accent-tint-2); border-radius: 10px; padding: 10px 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.btn.danger { background: var(--bad); border-color: var(--bad); }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

/* ─── Вход ───────────────────────────────────────────────────────────── */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--ground); box-sizing: border-box; }
.auth-card { width: 100%; max-width: 380px; background: var(--paper); border-radius: 18px; padding: 30px 28px; box-shadow: 0 12px 40px rgba(31, 34, 40, 0.08); display: flex; flex-direction: column; gap: 14px; }
.auth-card .logo { height: 30px; width: auto; align-self: flex-start; }
.auth-card h1 { margin: 4px 0 0; font-size: 24px; }
.auth-form { display: flex; flex-direction: column; gap: 8px; }
.auth-form label { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-top: 6px; }
.auth-form input { font: inherit; font-size: 15px; padding: 11px 12px; border: 1px solid #DCD8E4; border-radius: var(--radius-sm); }
.auth-form input:focus { outline: none; border-color: var(--accent); }
.auth-form .btn { margin-top: 12px; justify-content: center; }
.auth-error { margin: 4px 0 0; font-size: 13px; color: var(--bad); }
.auth-note { font-size: 13px; margin: 0; }
button.avatar { border: 0; cursor: pointer; font: inherit; }
