/* Стрелка — пульт маршрутизации трафика.
   Чёрный фон, линии в 1px, данные крупнее подписей, все числа моноширинные.
   Один акцент — лайм: им же светится «показано» (proxy) и всё живое.
   Жёлтый — перенаправление, красный — отказ; оба только в данных. */

:root {
  --bg: #F4F4F1;
  --s1: #FFFFFF;
  --s2: #ECECE7;
  --s3: #E2E2DC;
  --line: rgba(14, 16, 17, .08);
  --line-2: rgba(14, 16, 17, .15);
  --ink: #111416;
  --ink-2: #4D555B;
  --ink-3: #6B7277; /* вспомогательный текст: контраст ≈4.6:1 на белом */

  --go: #8DB816;      /* показано, живое */
  --go-ink: #4C6505;  /* лайм для текста на светлом */
  --warn: #D6950F;
  --stop: #DD4A36;
  --rail: #B9BDB8;
  --rail-dim: #D9DBD6;

  --focus: #4C6505;
  --sel: rgba(141, 184, 22, .16);

  /* Шкала текста: 7 ступеней вместо 18 разных размеров */
  --fs-1: 11.5px;  /* метки, бейджи */
  --fs-2: 12.5px;  /* подписи, подсказки */
  --fs-3: 13.5px;  /* интерфейс, таблицы */
  --fs-4: 15px;    /* основной текст, поля */
  --fs-5: 17px;    /* заголовки блоков */
  --fs-6: 22px;    /* заголовки разделов, крупные числа */
  --fs-7: 28px;    /* суммы, главные цифры */
  --fs-8: 32px;    /* заголовок экрана */

  /* Скругления: 5 ступеней вместо 12 */
  --r-xs: 6px;     /* мелочь в строке: код, флажки, чипы */
  --r-sm: 10px;    /* кнопки, поля */
  --r-md: 14px;    /* блоки внутри карточек */
  --r-lg: 18px;    /* карточки и панели */
  --r-xl: 24px;    /* окна */
  --r-pill: 999px;

  --sans: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121110; --s1: #191715; --s2: #201E1B; --s3: #2A2724;
    /* «Тёплый уголь»: мелкое зерно, как на фото, и затемнённые края */
    --tex: radial-gradient(130% 95% at 50% 40%, transparent 55%, rgba(0, 0, 0, .45)),
      radial-gradient(rgba(255, 240, 220, .045) .6px, transparent .9px) 0 0 / 5px 5px,
      radial-gradient(rgba(255, 240, 220, .035) .6px, transparent .9px) 2px 3px / 7px 7px;
    --line: rgba(240, 232, 222, .08); --line-2: rgba(240, 232, 222, .14);
    --ink: #EDEAE6; --ink-2: #ABA59E; --ink-3: #76706A;
    --go: #C6F432; --go-ink: #C6F432; --warn: #F2B544; --stop: #F25F4C;
    --rail: #57524C; --rail-dim: #2E2A26;
    --focus: #C6F432; --sel: rgba(198, 244, 50, .1);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121110; --s1: #191715; --s2: #201E1B; --s3: #2A2724;
    /* «Тёплый уголь»: мелкое зерно, как на фото, и затемнённые края */
    --tex: radial-gradient(130% 95% at 50% 40%, transparent 55%, rgba(0, 0, 0, .45)),
      radial-gradient(rgba(255, 240, 220, .045) .6px, transparent .9px) 0 0 / 5px 5px,
      radial-gradient(rgba(255, 240, 220, .035) .6px, transparent .9px) 2px 3px / 7px 7px;
  --line: rgba(240, 232, 222, .08); --line-2: rgba(240, 232, 222, .14);
  --ink: #EDEAE6; --ink-2: #ABA59E; --ink-3: #76706A;
  --go: #C6F432; --go-ink: #C6F432; --warn: #F2B544; --stop: #F25F4C;
  --rail: #57524C; --rail-dim: #2E2A26;
  --focus: #C6F432; --sel: rgba(198, 244, 50, .1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
/* Полос прокрутки нигде нет, сама прокрутка остаётся (как в CRM Omnix). */
* { scrollbar-width: none !important; }
*::-webkit-scrollbar { width: 0; height: 0; display: none; }
/* Каркас как в CRM: страница сама не прокручивается и не пружинит на краях,
   шапка стоит на месте, прокручивается только main под ней. */
html { -webkit-text-size-adjust: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  margin: 0; height: 100%; height: 100dvh; overflow: hidden; overscroll-behavior: none;
  display: flex; flex-direction: column;
  background: var(--tex, none), var(--bg); color: var(--ink); font: 400 var(--fs-3)/1.5 var(--sans); -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: var(--fs-4); }
h3 { font-size: var(--fs-3); }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: .92em; }
code { background: var(--s2); padding: 1px 5px; border-radius: var(--r-xs); }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: var(--sel); }
.hint { color: var(--ink-3); font-size: var(--fs-3); }
.err { color: var(--stop); font-size: var(--fs-3); min-height: 1.2em; }

/* ---------- шапка ---------- */
.bar {
  position: relative; z-index: 20; flex: none;
  display: flex; align-items: center; gap: 24px; height: 56px;
  padding: 0 max(16px, calc((100vw - 1360px) / 2));
  background: transparent;
  border-bottom: 1px solid var(--line);
}
.mark { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; }
.mark svg { width: 26px; height: 18px; }
.mark path { stroke: var(--ink); stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.mark circle { fill: var(--go); }
.mark span { font-weight: 600; font-size: var(--fs-4); letter-spacing: -.02em; }

.tabs { display: flex; gap: 2px; height: 100%; }
.tabs button {
  position: relative; border: 0; background: none; cursor: pointer; height: 100%;
  padding: 0 12px; color: var(--ink-3); font-weight: 500;
  transition: color .15s var(--ease);
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--ink); }
.tabs button[aria-selected="true"]::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: var(--ink); border-radius: var(--r-pill); }

.health { margin-left: auto; display: flex; gap: 18px; font-size: var(--fs-2); color: var(--ink-3); white-space: nowrap; }
.health span { display: inline-flex; align-items: center; gap: 6px; }
.health b { font: 500 var(--fs-2) var(--mono); color: var(--ink-2); }
.bar-tools { display: flex; gap: 16px; padding-left: 18px; border-left: 1px solid var(--line); }

/* ---------- точки состояния ---------- */
.lamp { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--rail); flex: none; }
.lamp.g { background: var(--go); }
.lamp.y { background: var(--warn); }
.lamp.r { background: var(--stop); }
.lamp.off { background: var(--ink-3); opacity: .4; }

main {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 20px max(16px, calc((100vw - 1360px) / 2)) 64px;
}

/* ---------- кнопки, поля, свои контролы ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: var(--r-sm); cursor: pointer; font-weight: 500; font-size: var(--fs-3);
  border: 1px solid var(--line-2); background: var(--s1);
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.btn:hover { border-color: var(--ink-3); }
/* Главная кнопка одна — салатовая .btn.go (account.css); .primary оставлен как её синоним. */
.btn.primary { background: var(--go); color: #0B0C0D; border-color: var(--go); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--stop); }
.btn.danger:hover { border-color: var(--stop); }
.btn:disabled { opacity: .5; cursor: progress; }
.btn.sm { height: 28px; padding: 0 9px; border-radius: var(--r-xs); }
.btn.sm:disabled { cursor: default; opacity: .35; }
.link { border: 0; background: none; padding: 0; color: var(--ink-2); cursor: pointer; font-size: var(--fs-3); font-weight: 500; }
.link:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }
.link.danger { color: var(--stop); }

input:not([type="checkbox"]):not([type="radio"]), textarea {
  width: 100%; border: 1px solid var(--line-2); background: var(--s1);
  border-radius: var(--r-sm); padding: 7px 10px; font-size: var(--fs-3); min-height: 36px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
/* Поля растут сами по мере набора — без уголка для растягивания. */
textarea { resize: none; overflow-y: auto; line-height: 1.45; field-sizing: content; max-height: 60vh; overscroll-behavior: contain; }
/* User-Agent дорастает до пяти строк, дальше прокручивается внутри. */
.probe textarea { max-height: calc(5 * 1.45em + 16px); }
input:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--sel); }
label { display: grid; gap: 6px; font-size: var(--fs-2); color: var(--ink-2); }

/* галочка */
input[type="checkbox"]:not(.switch > input):not(.tog > input) {
  appearance: none; width: 16px; height: 16px; margin: 0; flex: none; cursor: pointer; position: relative;
  border: 1px solid var(--line-2); border-radius: var(--r-xs); background: var(--s1);
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
input[type="checkbox"]:not(.switch > input):not(.tog > input):checked { background: var(--ink); border-color: var(--ink); }
input[type="checkbox"]:not(.switch > input):not(.tog > input):checked::after {
  content: ''; position: absolute; left: 4.5px; top: 1.5px; width: 5px; height: 9px;
  border: solid var(--bg); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.check { display: inline-flex; flex-direction: row; align-items: center; gap: 8px; cursor: pointer; font-size: var(--fs-3); color: var(--ink-2); }

/* тумблер: капсула с кружком; включён — лайм, кружок справа */
.switch { display: inline-flex; flex-direction: row; align-items: center; gap: 10px; cursor: pointer; color: var(--ink-2); font-size: var(--fs-3); user-select: none; }
.switch input, .tog input {
  appearance: none; width: 36px; height: 20px; border: 0; border-radius: var(--r-pill); margin: 0; flex: none;
  background: var(--s3); box-shadow: inset 0 0 0 1px var(--line-2);
  position: relative; cursor: pointer; transition: background .2s var(--ease), box-shadow .2s var(--ease);
}
.switch input::after, .tog input::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--ink-2); transition: transform .22s var(--ease), background .2s var(--ease);
}
.switch input:hover, .tog input:hover { box-shadow: inset 0 0 0 1px var(--ink-3); }
.switch input:checked, .tog input:checked { background: var(--go); box-shadow: none; }
.switch input:checked::after, .tog input:checked::after { transform: translateX(16px); background: #000; }
.switch input:focus-visible, .tog input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch:has(input:checked) span { color: var(--ink); }
.tog { justify-self: end; }

/* выпадающий список: свой, вместо системного меню */
select.enhanced { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.dd { position: relative; min-width: 0; }
.dd-btn {
  width: 100%; min-height: 36px; display: flex; align-items: center; gap: 8px; text-align: left;
  border: 1px solid var(--line-2); background: var(--s1); border-radius: var(--r-sm); padding: 0 30px 0 10px;
  cursor: pointer; font-size: var(--fs-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative;
}
.dd-btn::after {
  content: ''; position: absolute; right: 12px; top: 50%; width: 6px; height: 6px; margin-top: -5px;
  border: solid var(--ink-3); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); transition: transform .15s var(--ease);
}
.dd-btn[aria-expanded="true"] { border-color: var(--focus); box-shadow: 0 0 0 3px var(--sel); }
.dd-btn[aria-expanded="true"]::after { transform: translateY(3px) rotate(-135deg); }
.dd-btn span { overflow: hidden; text-overflow: ellipsis; }
.dd-list {
  position: fixed; z-index: 50; min-width: 180px; max-height: 320px; overflow: auto; margin: 0; padding: 4px; list-style: none;
  background: var(--s1); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  box-shadow: 0 12px 32px -8px rgba(0, 0, 0, .35);
  animation: dd-in .14s var(--ease);
}
@keyframes dd-in { from { opacity: 0; transform: translateY(-4px); } }
.dd-list .dd-grp { padding: 8px 9px 3px; font-size: var(--fs-1); color: var(--ink-3); }
.dd-list .dd-opt { padding: 6px 9px; border-radius: var(--r-xs); cursor: pointer; font-size: var(--fs-3); display: flex; justify-content: space-between; gap: 12px; }
.dd-list .dd-opt[aria-selected="true"] { color: var(--ink); font-weight: 500; }
.dd-list .dd-opt[aria-selected="true"]::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--go); align-self: center; }
.dd-list .dd-opt.active { background: var(--s2); }

/* календарь: свой, вместо системного */
input[type="date"].enhanced { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.dp { position: relative; min-width: 0; }
.dp-btn { width: 100%; height: 36px; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line-2); background: var(--s1); border-radius: var(--r-sm); color: var(--ink); font: var(--fs-2) var(--mono); cursor: pointer; transition: border-color .15s; }
.dp-btn svg { width: 14px; height: 14px; flex: none; fill: none; stroke: var(--ink-3); stroke-width: 1.4; stroke-linecap: round; }
.dp-btn.empty span { color: var(--ink-3); }
.dp-btn:hover { border-color: color-mix(in srgb, var(--ink) 25%, transparent); }
.dp-btn[aria-expanded="true"] { border-color: var(--focus); box-shadow: 0 0 0 3px var(--sel); }
.dp-pop { position: fixed; z-index: 50; width: 272px; padding: 12px; background: var(--s1); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: 0 18px 44px rgba(0, 0, 0, .4); animation: dd-in .14s var(--ease); }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dp-head b { font-size: var(--fs-3); font-weight: 600; text-transform: capitalize; }
.dp-nav { width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.dp-nav:hover { background: var(--s2); color: var(--ink); }
.dp-nav svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.dp-week, .dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-week span { text-align: center; font-size: var(--fs-1); color: var(--ink-3); padding: 4px 0; }
.dp-day { height: 32px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: var(--fs-2) var(--mono); cursor: pointer; }
.dp-day:hover { background: var(--s2); }
.dp-day.out { color: var(--ink-3); opacity: .55; }
.dp-day.today { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--go) 60%, transparent); }
.dp-day.on { background: var(--go); color: #0B0C0D; font-weight: 600; }
.dp-foot { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.dp-link { border: 0; background: none; padding: 4px 6px; border-radius: 6px; font-size: var(--fs-2); color: var(--go-ink); cursor: pointer; }
.dp-link:hover { background: var(--s2); }
/* числа без системных стрелок-счётчиков */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* сегменты */
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 2px; gap: 2px; width: fit-content; background: var(--s1); }
.seg label { display: block; cursor: pointer; position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: var(--r-xs); color: var(--ink-2); font-size: var(--fs-3); transition: background .15s var(--ease), color .15s var(--ease); }
.seg span:hover { color: var(--ink); }
.seg input:checked + span { background: var(--s3); color: var(--ink); }
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }

/* ---------- панели ---------- */
.panel { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r-md); min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 14px 16px 0; flex-wrap: wrap; }
.panel-head .sub, .sub { color: var(--ink-3); font-size: var(--fs-2); margin-top: 2px; }
.sec-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.legend { display: flex; gap: 14px; font-size: var(--fs-2); color: var(--ink-3); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- пульт: шапка, показатели ---------- */
.desk-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.flows { display: flex; flex-wrap: wrap; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--s1); }
.flows button {
  display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; border-radius: var(--r-xs);
  padding: 5px 12px; cursor: pointer; color: var(--ink-3); font-size: var(--fs-3); transition: background .15s var(--ease), color .15s var(--ease);
}
.flows button b { font: 500 var(--fs-3) var(--mono); color: var(--ink-2); }
.flows button:hover { color: var(--ink); }
.flows button[aria-checked="true"] { background: var(--s3); color: var(--ink-2); }
.flows button[aria-checked="true"] b { color: var(--ink); }
.live { display: inline-flex; align-items: center; gap: 8px; font: var(--fs-2) var(--mono); color: var(--ink-3); }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--go); position: relative; }
.pulse::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid var(--go); animation: ping 2s var(--ease) infinite; }
@keyframes ping { from { opacity: .8; transform: scale(.5); } to { opacity: 0; transform: scale(1.6); } }
.live.lost .pulse { background: var(--stop); }
.live.lost .pulse::after { display: none; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; margin-bottom: 14px; }
.kpi { background: var(--s1); padding: 14px 16px 12px; display: grid; gap: 4px; min-width: 0; align-content: start; }
.kpi .k-label { font-size: var(--fs-2); color: var(--ink-3); display: flex; align-items: center; gap: 7px; }
.kpi .k-val { font: 500 var(--fs-7)/1.15 var(--mono); letter-spacing: -.03em; color: var(--ink); white-space: nowrap; }
.kpi .k-val small { font: 400 var(--fs-3) var(--mono); color: var(--ink-3); letter-spacing: 0; margin-left: 4px; }
.kpi .k-foot { font: var(--fs-2) var(--mono); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi svg { display: block; width: 100%; height: 30px; margin-top: 4px; }
.kpi .spark { fill: none; stroke: var(--go); stroke-width: 1.5; stroke-linejoin: round; }
.kpi .spark-area { fill: var(--go); opacity: .08; }
.share { display: flex; height: 6px; border-radius: var(--r-pill); overflow: hidden; gap: 2px; margin-top: 16px; background: var(--s2); }
.share i { display: block; height: 100%; transition: flex-grow .4s var(--ease); }
.share .g { background: var(--go); } .share .y { background: var(--warn); } .share .r { background: var(--stop); }
.share-legend { display: flex; gap: 12px; font: var(--fs-2) var(--mono); color: var(--ink-3); margin-top: 7px; }
.share-legend span { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- схема потоков ---------- */
.board { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: stretch; }
.yard-panel { display: flex; flex-direction: column; }
.yard { overflow-x: auto; overscroll-behavior-x: contain; padding: 4px 8px 0; }
/* Схема шире панели — край мягко гаснет со стороны, куда можно прокрутить. */
.yard.more-r { mask-image: linear-gradient(90deg, #000 calc(100% - 56px), transparent); }
.yard.more-l { mask-image: linear-gradient(90deg, transparent, #000 56px); }
.yard.more-l.more-r { mask-image: linear-gradient(90deg, transparent, #000 56px, #000 calc(100% - 56px), transparent); }

/* Сводка под схемой: ссылка, настройки и выходы с долями. */
.flow-info { margin-top: auto; border-top: 1px solid var(--line); padding: 14px 16px 16px; display: grid; gap: 14px; }
.facts { display: flex; flex-wrap: wrap; gap: 10px 28px; align-items: center; }
.fact { display: grid; gap: 2px; min-width: 0; }
.fact span { font-size: var(--fs-2); color: var(--ink-3); }
.fact b { font: 500 var(--fs-3) var(--mono); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fact.link-fact { flex: 1 1 280px; }
.copy-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.copy-row b { min-width: 0; }
.exits { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.exits li { display: grid; grid-template-columns: 22px minmax(0, 1.3fr) minmax(0, 1fr) 70px minmax(90px, .8fr); gap: 12px; align-items: center; padding: 9px 12px; background: var(--s1); font-size: var(--fs-3); }
.exits.with-conv li { grid-template-columns: 22px minmax(0, 1.3fr) minmax(0, 1fr) 70px minmax(90px, .8fr) 56px 84px; }
.exits .cv { color: var(--go-ink); }
.exits li.head .cv { color: var(--ink-3); }
.exits li.off { color: var(--ink-3); }
.exits li.head { background: var(--s2); font-size: var(--fs-2); color: var(--ink-3); padding: 7px 12px; }
.exits .ord { font: var(--fs-2) var(--mono); color: var(--ink-3); }
.exits .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exits .ex-act { display: flex; align-items: center; gap: 7px; font: var(--fs-2) var(--mono); color: var(--ink-2); white-space: nowrap; overflow: hidden; }
.exits .n { font: 500 var(--fs-3) var(--mono); text-align: right; }
.exits .sh { display: grid; grid-template-columns: minmax(0, 1fr) 36px; gap: 8px; align-items: center; font: var(--fs-2) var(--mono); color: var(--ink-3); text-align: right; }
.exits .sh .meter { height: 5px; border-radius: var(--r-pill); background: var(--s3); overflow: hidden; }
.exits .sh .meter i { display: block; height: 100%; border-radius: var(--r-pill); transition: width .4s var(--ease); }
.exits .sh .meter i.g { background: var(--go); } .exits .sh .meter i.y { background: var(--warn); } .exits .sh .meter i.r { background: var(--stop); }
/* Схема в натуральных пикселях: длинный поток прокручивается внутри панели. */
.yard svg { display: block; max-width: none; }
.yard .rail { stroke: var(--rail); fill: none; stroke-linecap: round; stroke-linejoin: round; transition: stroke .3s var(--ease), opacity .3s var(--ease); }
.yard .rail.main { stroke: var(--rail); }
.yard .rail.off { stroke: var(--rail-dim); stroke-dasharray: 2 5; }
.yard .flowline { fill: none; stroke-linecap: round; stroke-linejoin: round; opacity: .55; transition: stroke-width .5s var(--ease); }
.yard .flowline.g { stroke: var(--go); } .yard .flowline.y { stroke: var(--warn); } .yard .flowline.r { stroke: var(--stop); }
.yard .node { fill: var(--s1); stroke: var(--rail); stroke-width: 1.5; }
.yard .dot { r: 3; }
.yard .dot.g { fill: var(--go); } .yard .dot.y { fill: var(--warn); } .yard .dot.r { fill: var(--stop); }
.yard text { fill: var(--ink); font-family: var(--sans); font-size: var(--fs-3); }
.yard .t-name { font-weight: 500; }
.yard .t-sub { fill: var(--ink-3); font-size: var(--fs-1); font-family: var(--mono); }
.yard .t-hits { font-family: var(--mono); font-size: var(--fs-4); font-weight: 500; }
.yard .t-share { fill: var(--ink-3); font-family: var(--mono); font-size: var(--fs-1); }
.yard .t-in { font-weight: 600; font-size: var(--fs-3); }
.yard .term .bulb { stroke: none; }
.yard .term .ring { fill: none; stroke-width: 1.5; opacity: 0; }
.yard .term.flash .ring { animation: ring 1s var(--ease); }
@keyframes ring { from { opacity: .9; r: 6; } to { opacity: 0; r: 16; } }
.yard.routed .rail, .yard.routed .flowline, .yard.routed .term { opacity: .18; }
.yard.routed .rail.lit { opacity: 1; stroke: var(--ink); stroke-width: 2.5; }
.yard.routed .term.lit { opacity: 1; }

/* ---------- проверка посетителя ---------- */
.probe { display: grid; gap: 11px; padding: 0 16px 16px; }
.probe .panel-head { padding: 14px 0 2px; }
.probe .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.probe textarea.mono, .probe input.mono { font-size: var(--fs-2); }
.verdict:empty { display: none; }
.verdict { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 10px; font-size: var(--fs-3); }
.verdict .say { display: flex; gap: 9px; align-items: center; font-weight: 500; font-size: var(--fs-3); overflow-wrap: anywhere; }
.verdict dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; color: var(--ink-2); }
.verdict dt { color: var(--ink-3); }
.verdict dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- график и география ---------- */
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; margin: 14px 0; }
.chart-wrap { position: relative; padding: 12px 16px 14px; }
.chart { width: 100%; height: 170px; display: block; overflow: visible; }
.chart .bar-g { fill: var(--go); } .chart .bar-y { fill: var(--warn); } .chart .bar-r { fill: var(--stop); }
.chart .col { transition: opacity .15s var(--ease); }
.chart.hovering .col { opacity: .35; }
.chart.hovering .col.on { opacity: 1; }
.chart .hit { fill: transparent; }
.chart .axis { stroke: var(--line-2); }
.chart text { fill: var(--ink-3); font-size: var(--fs-1); font-family: var(--mono); }
.tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 150px;
  background: var(--s1); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 8px 10px;
  box-shadow: 0 10px 28px -10px rgba(0, 0, 0, .4); font-size: var(--fs-2); display: grid; gap: 3px;
}
.tip b { font: 500 var(--fs-2) var(--mono); color: var(--ink-3); }
.tip span { display: flex; align-items: center; gap: 7px; justify-content: space-between; }
.tip span em { font: normal var(--fs-2) var(--mono); color: var(--ink); margin-left: auto; }

.geo { list-style: none; margin: 0; padding: 12px 16px 16px; display: grid; gap: 9px; }
.geo li { display: grid; grid-template-columns: 34px minmax(0, 1fr) 72px; gap: 10px; align-items: center; font: var(--fs-2) var(--mono); }
.geo li b { font-weight: 500; color: var(--ink); }
.geo li .meter { height: 6px; border-radius: var(--r-pill); background: var(--s2); overflow: hidden; }
.geo li .meter i { display: block; height: 100%; background: var(--ink-2); border-radius: var(--r-pill); transition: width .4s var(--ease); }
.geo li > span:last-child { text-align: right; color: var(--ink-3); }
.geo .none { display: block; color: var(--ink-3); font-family: var(--sans); }

/* ---------- журнал ---------- */
.log .panel-head { padding-bottom: 12px; }
.table-wrap { overflow: auto; max-height: 520px; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-2); }
th { position: sticky; top: 0; z-index: 1; background: var(--s1); text-align: left; font-weight: 500; font-size: var(--fs-2); color: var(--ink-3); padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { height: 34px; padding: 4px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; font-family: var(--mono); color: var(--ink-2); }
td:first-child, th:first-child { padding-left: 16px; }
td:last-child, th:last-child { padding-right: 16px; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
td .muted { color: var(--ink-3); margin-left: 8px; }
td .main { color: var(--ink); }
td.empty { text-align: center; color: var(--ink-3); padding: 32px 12px; font-family: var(--sans); white-space: normal; }
tr.fresh td { animation: fresh .6s var(--ease); }
@keyframes fresh { from { background: var(--sel); } }
.route { display: inline-flex; align-items: center; gap: 7px; font-family: var(--sans); color: var(--ink); }
.flag { display: inline-block; font: var(--fs-1) var(--mono); padding: 1px 6px; border-radius: var(--r-xs); margin-right: 4px; background: var(--s2); color: var(--ink-2); }
.flag.bot { background: color-mix(in srgb, var(--stop) 14%, transparent); color: var(--stop); }
.flag.dc { background: color-mix(in srgb, var(--warn) 16%, transparent); color: color-mix(in srgb, var(--warn) 80%, var(--ink)); }

/* ---------- правила ---------- */
.rules-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 28px; align-items: start; }
.flow-list h2 { font-size: var(--fs-2); font-weight: 500; color: var(--ink-3); }
.flow-list ul { list-style: none; margin: 10px 0 14px; padding: 0; display: grid; gap: 1px; }
.flow-list li button[data-alias] {
  width: 100%; text-align: left; border: 0; background: none; cursor: pointer;
  padding: 7px 10px; border-radius: var(--r-xs); display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
}
.flow-list li button[data-alias] span { font-family: var(--mono); font-size: var(--fs-3); }
.flow-list li button[data-alias]:hover { background: var(--s2); }
.flow-list li button[data-alias][aria-current="true"] { background: var(--s1); box-shadow: inset 0 0 0 1px var(--line-2); }
.flow-list li small { color: var(--ink-3); font-size: var(--fs-2); transition: opacity .15s; }
.flow-list li { position: relative; }
.flow-list li .row-del { position: absolute; right: 6px; top: 50%; translate: 0 -50%; }
.flow-list li:hover small, .flow-list li:focus-within small { opacity: 0; }
.flow-edit h2 { font-size: var(--fs-6); letter-spacing: -.02em; }

.rule-list { list-style: none; margin: 0 0 14px; padding: 0; background: var(--s1); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.rule-list:empty { display: none; }
.rule-list li {
  display: grid; grid-template-columns: 28px minmax(0, 1.2fr) minmax(0, 1fr) 64px 40px; gap: 14px; align-items: center;
  padding: 11px 14px; border-bottom: 1px solid var(--line);
}
.rule-list li:last-child { border-bottom: 0; }
.rule-list li.disabled > :not(.tog) { opacity: .4; }
.rule-list .ord { font: 500 var(--fs-2) var(--mono); color: var(--ink-3); }
.rule-list .what b { display: block; font-weight: 500; }
.rule-list .what span, .rule-list .then span { color: var(--ink-3); font-size: var(--fs-2); overflow-wrap: anywhere; }
.rule-list .then { display: flex; gap: 8px; align-items: center; }
.rule-list .then span { font-family: var(--mono); color: var(--ink-2); }
.rule-list .hits { text-align: right; font: 500 var(--fs-3) var(--mono); }
.rule-list li.default { background: var(--s2); }
.rule-list button.what { border: 0; background: none; padding: 0; text-align: left; cursor: pointer; min-width: 0; }
.rule-list button.what:hover b { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }
.rule-list li.editing { display: block; padding: 0; }
.head-tools { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.list-actions { margin: 0 0 22px; }

.raw summary { cursor: pointer; color: var(--ink-3); font-size: var(--fs-3); font-weight: 500; padding: 6px 0; }
.raw summary:hover { color: var(--ink); }
.raw .hint { margin: 6px 0 10px; }
.raw textarea { font: var(--fs-2)/1.55 var(--mono); }
.raw-actions { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; }

/* ---------- редактор правил ---------- */
.ed { display: grid; gap: 18px; padding: 18px; background: var(--s1); box-shadow: inset 2px 0 0 var(--go); }
.rule-list li.editing .ed { background: color-mix(in srgb, var(--s2) 55%, var(--s1)); }
.flow-form { margin-bottom: 18px; }
.flow-form .ed { border: 1px solid var(--line); border-radius: var(--r-md); }
.ed-top { display: flex; gap: 16px; align-items: end; flex-wrap: wrap; }
.ed-name { flex: 1 1 280px; }
.ed-pos { display: flex; gap: 6px; align-items: center; font-size: var(--fs-2); color: var(--ink-3); }
.ed-pos b { font-family: var(--mono); color: var(--ink); font-weight: 500; }
.ed-pos span { margin-right: 4px; }
.ed-sec h3 { font-size: var(--fs-2); font-weight: 500; color: var(--ink-3); margin-bottom: 10px; }
.ed-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.grp, .grp-items { display: grid; gap: 8px; }
.grp.sub { padding: 10px 0 10px 14px; border-left: 1px solid var(--line-2); }
.grp-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: var(--fs-3); color: var(--ink-2); }
.grp-head .dd { width: auto; }
.cond { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .8fr) minmax(0, 1.4fr) 30px; gap: 8px; align-items: center; }
.cond .c-val { font-family: var(--mono); font-size: var(--fs-3); }
.c-what { display: flex; gap: 6px; min-width: 0; }
.c-what .dd { flex: 1 1 auto; }
.c-what .c-param { flex: 1 1 100px; min-width: 0; font-family: var(--mono); font-size: var(--fs-3); }
.x { width: 30px; height: 30px; border: 0; background: none; border-radius: var(--r-xs); color: var(--ink-3); cursor: pointer; font-size: var(--fs-5); line-height: 1; }
.x:hover { background: var(--s2); color: var(--stop); }
.grp-add { display: flex; gap: 16px; align-items: baseline; flex-wrap: wrap; }
.grp-add .hint { margin-left: auto; font-size: var(--fs-2); }
.empty-cond { margin: 0; }
.reads { margin: 12px 0 0; font-size: var(--fs-3); color: var(--ink-2); padding: 9px 12px; border-radius: var(--r-sm); background: var(--s2); border-left: 2px solid var(--go); }
.act { display: grid; gap: 10px; }
.act .hint { margin: 0; }
.act-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.act-row:empty { display: none; }
.act-row .a-url-l { flex: 1 1 280px; }
.act-row .a-url { font-family: var(--mono); font-size: var(--fs-3); }
.act-row .a-status-l { flex: 0 1 230px; }
.macros { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: var(--fs-2); color: var(--ink-3); }
.macros button { border: 1px solid var(--line-2); background: var(--s1); border-radius: var(--r-xs); padding: 2px 7px; font: var(--fs-2) var(--mono); cursor: pointer; color: var(--ink-2); }
.macros button:hover { border-color: var(--ink-3); color: var(--ink); }
.ed-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ed-actions .ed-err { flex: 1 1 200px; min-height: 0; }
.alias-in { display: flex; align-items: center; border: 1px solid var(--line-2); background: var(--s1); border-radius: var(--r-xs); padding-left: 10px; color: var(--ink-3); font: var(--fs-3) var(--mono); min-height: 34px; }
.alias-in:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px var(--sel); }
.alias-in > input.f-alias, .alias-in > input.f-alias:focus { border: 0; background: none; padding-left: 1px; box-shadow: none; font: var(--fs-3) var(--mono); }

/* ---------- блок-лист ---------- */
.block-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 32px; align-items: start; }
.block-form { display: grid; gap: 12px; padding: 16px; }
.block-form input[name="value"] { font-family: var(--mono); }
.block-lists { display: grid; gap: 26px; }
.block-lists h3 { font-size: var(--fs-2); font-weight: 500; color: var(--ink-3); }
.chips { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { display: inline-flex; align-items: center; gap: 2px; padding: 3px 3px 3px 10px; border-radius: var(--r-xs); background: var(--s1); border: 1px solid var(--line); font: var(--fs-2) var(--mono); }
.chips button { border: 0; background: none; cursor: pointer; width: 22px; height: 22px; border-radius: var(--r-xs); color: var(--ink-3); line-height: 1; }
.chips button:hover { background: var(--s2); color: var(--stop); }
.chips .none { background: none; border: 0; padding-left: 0; color: var(--ink-3); font-family: var(--sans); }

/* ---------- адаптив ---------- */
@media (max-width: 1100px) {
  .board, .split { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .bar { flex-wrap: wrap; height: auto; padding-top: 10px; gap: 4px 14px; }
  .tabs { height: 40px; order: 4; width: 100%; }
  .tabs button { padding: 0 10px; }
  .health { margin-left: 0; order: 3; width: 100%; overflow-x: auto; padding-bottom: 2px; }
  .bar-tools { margin-left: auto; border-left: 0; padding-left: 0; }
  .kpi .k-val { font-size: var(--fs-6); }
  .exits li { grid-template-columns: 18px minmax(0, 1fr) 56px; }
  .exits .ex-act, .exits .sh { display: none; }
  .exits.with-conv li { grid-template-columns: 18px minmax(0, 1fr) 52px 40px 64px; gap: 8px; }
  .rules-layout, .block-layout { grid-template-columns: 1fr; gap: 20px; }
  .rule-list li { grid-template-columns: 20px minmax(0, 1fr) 40px; }
  .rule-list .then { grid-column: 2; }
  .rule-list .hits { grid-column: 3; grid-row: 1; }
  .rule-list .tog { grid-column: 3; grid-row: 2; }
  .probe .row2 { grid-template-columns: 1fr; }
  .cond { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) 30px; }
  .cond .c-what { grid-column: 1 / 3; grid-row: 1; }
  .cond > :nth-child(2) { grid-column: 1; grid-row: 2; }
  .cond > :nth-child(3) { grid-column: 2 / 4; grid-row: 2; }
  .cond > :nth-child(4) { grid-column: 3; grid-row: 1; }
  .grp-add .hint { margin-left: 0; width: 100%; }
  .ed { padding: 14px 12px; }
}
@media (max-width: 420px) {
  .kpis { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* выбор домена у ссылки потока — своё меню вместо системного списка */
.lh { position: relative; display: inline-block; margin-left: 8px; vertical-align: 0; }
.lh-btn { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 7px 0 9px; border-radius: var(--r-pill); border: 1px solid var(--line-2); background: var(--s2); color: var(--ink-2); font: 500 var(--fs-2) var(--mono); cursor: pointer; transition: border-color .15s, color .15s; }
.lh-btn:hover, .lh-btn[aria-expanded="true"] { border-color: color-mix(in srgb, var(--go) 55%, transparent); color: var(--ink); }
.lh-btn svg { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.lh-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.lh-menu { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: max-content; min-width: 260px; max-width: min(380px, calc(100vw - 40px)); padding: 6px; display: grid; gap: 2px; border-radius: 14px; background: var(--s2); border: 1px solid var(--line-2); box-shadow: 0 18px 44px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .2); animation: lhIn .14s ease-out; }
.lh-menu[hidden] { display: none; }
@keyframes lhIn { from { opacity: 0; transform: translateY(-4px); } }
.lh-opt { display: grid; grid-template-columns: minmax(0, 1fr) 14px; grid-template-areas: "d c" "n c"; align-items: center; column-gap: 14px; padding: 9px 12px; border: 0; border-radius: 9px; background: none; color: var(--ink); font: 500 var(--fs-3) var(--mono); text-align: left; cursor: pointer; }
.lh-opt span { grid-area: d; color: inherit; font: inherit; letter-spacing: normal; text-transform: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lh-opt em { grid-area: n; margin-top: 2px; font: normal var(--fs-1) system-ui, sans-serif; color: var(--go-ink); }
.lh-opt svg { grid-area: c; width: 14px; height: 14px; fill: none; stroke: var(--go); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.lh-opt:hover, .lh-opt:focus-visible { background: var(--s3); outline: none; }
.lh-opt.on { background: color-mix(in srgb, var(--go) 9%, transparent); }
.lh-opt.on svg { opacity: 1; }
