@font-face {
  font-family: Manrope;
  src: url('/cabinet/manrope-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
}
@font-face {
  font-family: Manrope;
  src: url('/cabinet/manrope-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
}
@font-face {
  font-family: Manrope;
  src: url('/cabinet/manrope-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
}
:root,
html[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0b1020;
  --rail: #080c18;
  --surface: #151d30;
  --surface-2: #1b2540;
  --text: #f5f7fb;
  --muted: #acb6ca;
  --border: #2a354b;
  --accent: #2878ff;
  --accent-soft: rgba(40, 120, 255, 0.16);
  --highlight: #ffe15a;
  --good: #3ddc97;
  --bad: #ff83b9;
  --card-active-bg: #f5f7fb;
  --card-active-text: #101522;
}
html[data-theme='light'] {
  color-scheme: light;
  --bg: #f5f7fb;
  --rail: #0b1020;
  --surface: #ffffff;
  --surface-2: #eef2f9;
  --text: #101522;
  --muted: #52617b;
  --border: #d6ddeb;
  --accent: #1551c0;
  --accent-soft: #e6eeff;
  --card-active-bg: #101522;
  --card-active-text: #f5f7fb;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    15px/1.5 Manrope,
    system-ui,
    sans-serif;
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
.muted {
  color: var(--muted);
}
.eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--accent);
}
#notice:not(:empty) {
  position: fixed;
  inset: 16px 16px auto auto;
  z-index: 30;
  width: min(360px, calc(100vw - 32px));
  height: fit-content;
  max-height: min(240px, calc(100dvh - 32px));
  overflow: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 8px 28px #0002;
  font-size: 13px;
  line-height: 1.5;
  pointer-events: auto;
}
.notice-message {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.notice-icon {
  color: var(--muted);
  flex: none;
  padding-top: 1px;
}
.notice-close {
  flex: none;
  width: 28px;
  height: 28px;
  margin: -4px -6px -4px 0;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
}
.notice-close:hover,
.notice-close:focus-visible {
  background: var(--accent-soft);
  color: var(--text);
}
@supports (backdrop-filter: blur(16px)) or (-webkit-backdrop-filter: blur(16px)) {
  #notice:not(:empty) {
    background: rgb(21 29 48 / 84%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-color: rgb(172 182 202 / 22%);
  }
  html[data-theme='light'] #notice:not(:empty) {
    background: rgb(255 255 255 / 86%);
    border-color: rgb(82 97 123 / 22%);
  }
}
@media (prefers-reduced-transparency: reduce) {
  #notice:not(:empty),
  html[data-theme='light'] #notice:not(:empty) {
    background: var(--surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

.primary {
  border: 0;
  border-radius: 10px;
  padding: 10px 18px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.primary:disabled {
  opacity: 0.6;
}
.ghost {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px;
  background: transparent;
  cursor: pointer;
}
.ghost:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
input[type='text'],
input[type='password'],
input[type='search'],
select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

/* вход */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
  background: radial-gradient(circle at 15% 85%, #1c2a55 0%, var(--bg) 60%);
}
.login-card {
  width: min(440px, 100%);
  display: grid;
  gap: 14px;
  padding: 36px;
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.login-card h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.1;
}
.login-card form {
  display: grid;
  gap: 10px;
}

/* каркас */
.app {
  display: grid;
  grid-template-columns: 56px 1fr;
  min-height: 100vh;
}
.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 0;
  background: var(--rail);
  border-right: 1px solid var(--border);
  z-index: 10;
}
.rail-logo {
  margin-bottom: 2px;
}
.rail-spacer {
  flex: 1;
}
.rail button {
  position: relative;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #acb6ca;
  cursor: pointer;
}
.rail button:hover,
.rail button[aria-expanded='true'] {
  background: #151d30;
  color: #f5f7fb;
}
.rail button.active {
  background: #151d30;
  color: #f5f7fb;
}
.rail button.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
}
.rail svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.panel {
  position: fixed;
  left: 56px;
  top: 0;
  bottom: 0;
  width: 240px;
  padding: 18px 12px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 9;
  box-shadow: 8px 0 32px rgba(0, 0, 0, 0.25);
}
.panel-title {
  margin: 0 8px 14px;
  font-weight: 700;
}
.panel button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.panel button:hover {
  background: var(--surface-2);
  color: var(--text);
}
.panel button[aria-current='page'] {
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 600;
}
main#content {
  padding: 0 28px 40px;
  min-width: 0;
}
.head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 0;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.head-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #2878ff, #42ceff 50%, #ffe15a);
  color: #0b1020;
}
.head-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.head h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}
.head p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
.head-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

/* выручка */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.toolbar select {
  width: auto;
}
.cards {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(200px, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.card-metric {
  text-align: left;
  padding: 16px 18px;
  min-height: 120px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.card-metric.selected {
  background: var(--card-active-bg);
  color: var(--card-active-text);
  border-color: transparent;
}
.card-metric .label {
  font-weight: 600;
  font-size: 14px;
}
.card-metric .value {
  font-size: 26px;
  font-weight: 700;
}
.card-metric .delta {
  font-size: 12px;
  opacity: 0.8;
}
.delta.up {
  color: var(--good);
}
.delta.down {
  color: var(--bad);
}
.panel-box {
  margin-top: 18px;
  padding: 18px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.chart {
  width: 100%;
  height: 300px;
  display: block;
}
.chart .grid {
  stroke: var(--border);
  stroke-dasharray: 3 4;
}
.chart .axis {
  fill: var(--muted);
  font-size: 11px;
}
.chart .line {
  fill: none;
  stroke: url(#spectrum);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chart .line.prev {
  stroke: var(--muted);
  stroke-dasharray: 5 5;
  stroke-width: 1.5;
}
.chart .area {
  fill: url(#spectrum-fill);
}
.chart .dot {
  fill: var(--bg);
  stroke: #ffe15a;
  stroke-width: 2;
}
.chart .val {
  fill: var(--text);
  font-size: 11px;
}
.legend {
  display: flex;
  gap: 18px;
  justify-content: flex-end;
  font-size: 12px;
  color: var(--muted);
}
.legend span::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  background: linear-gradient(
    90deg,
    #2878ff,
    #42ceff,
    #a58bff,
    #ff83b9,
    #ffe15a
  );
  vertical-align: -1px;
}
.legend span.prev::before {
  background: var(--muted);
}

/* таблицы */
.customer-filter {
  margin: 0 0 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.customer-filter .filter-text {
  margin: 0 0 10px;
  word-break: break-word;
}
.customer-filter .toolbar + .toolbar {
  margin-top: 10px;
}
.scroll-sentinel {
  height: 1px;
}
.count {
  margin: 0 0 10px;
  color: var(--muted);
}
table.data {
  width: 100%;
  border-collapse: collapse;
}
table.data th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
table.data td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
}
table.data td.link {
  color: var(--accent);
  font-weight: 600;
}
.empty {
  padding: 40px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 16px;
}
@media (max-width: 720px) {
  main#content {
    padding: 0 16px 32px;
  }
  .panel {
    width: calc(100vw - 56px);
  }
  table.data th:nth-child(2),
  table.data td:nth-child(2) {
    display: none;
  }
}
[hidden] {
  display: none !important;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 13px;
}
.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 9px;
  font: inherit;
}
.form-field textarea {
  min-height: 100px;
  resize: vertical;
}
.editor-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(260px, 0.8fr);
  gap: 32px;
  margin-top: 20px;
  align-items: start;
}
.editor-fields {
  min-width: 0;
}
.preview-stack {
  display: grid;
  gap: 24px;
  position: sticky;
  top: 24px;
}
.push-preview,
.block-editor {
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  padding: 24px;
  overflow-wrap: anywhere;
}
.push-preview.ios {
  border-radius: 30px;
  background: var(--surface-2);
}
.push-preview p {
  white-space: pre-wrap;
}
.image-placeholder {
  padding: 24px;
  border: 1px dashed var(--border);
  color: var(--muted);
}
.email-frame {
  width: 100%;
  height: 640px;
  border: 1px solid #2a3142;
  border-radius: 8px;
  background: #fff;
}
.source-preview {
  white-space: pre-wrap;
  max-height: 400px;
  overflow: auto;
}
.toolbar {
  flex-wrap: wrap;
}
.toolbar .form-field {
  min-width: 140px;
  margin: 0;
}
button[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.block-editor {
  margin: 12px 0;
  border-radius: 12px;
}
@media (max-width: 850px) {
  .editor-grid {
    grid-template-columns: 1fr;
  }
  .preview-stack {
    position: static;
  }
}
.filter-group {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin: 20px 0;
  background: var(--surface);
}
.filter-group h2 {
  font-size: 16px;
}
.filter-rule {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  padding: 12px 0;
}
.filter-rule .form-field {
  flex: 1;
  min-width: 130px;
}
.filter-rule > button {
  margin-bottom: 12px;
}
.live-count {
  font-size: 24px;
  font-weight: 700;
  color: var(--good);
  margin: 24px 0 8px;
}
.confirmation {
  max-width: 540px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px;
}
.confirmation::backdrop {
  background: rgba(0, 0, 0, 0.6);
}
.confirmation button {
  margin-right: 10px;
}
.flow-schema {
  margin-top: 24px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
}
.flow-nodes {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.flow-node {
  padding: 16px 28px;
  min-width: 260px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: var(--accent-soft);
  text-align: center;
}
.flow-arrow {
  color: var(--accent);
  font-size: 24px;
}
.usage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin: 28px 0;
}
.usage-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  background: var(--surface);
}
.usage-card h2 {
  font-size: 16px;
  margin-top: 0;
}
.usage-value {
  font-size: 28px;
  font-weight: 700;
  margin: 12px 0;
}
@media (max-width: 700px) {
  .usage-grid {
    grid-template-columns: 1fr;
  }
}
/* Familiar campaign workflow, using Roketavia's own palette and assets. */
.manager-tools {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.manager-tools .form-field {
  margin: 0;
  min-width: 160px;
  flex: 1;
}
.manager-tools .form-field:first-child {
  flex: 2;
}
.status-badge,
.metric-chip {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 9px;
  font-size: 12px;
}
.status-badge.draft {
  color: var(--highlight);
}
.status-badge.launched {
  color: var(--good);
  border-color: var(--good);
}
.composer-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  margin: 20px 0;
}
.section-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-heading h2 {
  margin: 0;
  font-size: 17px;
}
.step-number {
  font-size: 12px;
  color: var(--accent);
  border: 1px solid var(--border);
  padding: 5px 8px;
  border-radius: 6px;
}
.platform-picker {
  display: flex;
  gap: 12px;
  margin: 12px 0;
}
.platform-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 8px;
}
.platform-choice input {
  width: auto;
  accent-color: var(--accent);
}
.phone-preview {
  width: 240px;
  min-height: 390px;
  margin: 0 auto;
  padding: 28px 14px;
  border: 5px solid #748296;
  border-radius: 36px;
  color: #f5f7fb;
  background:
    radial-gradient(ellipse at 20% 10%, #237bb0, transparent 65%),
    linear-gradient(145deg, #0f2548, #363564);
  box-shadow: 0 14px 30px #0002;
}
.phone-preview.android {
  border-radius: 22px;
  background:
    radial-gradient(ellipse at 90% 70%, #256950, transparent 70%),
    linear-gradient(160deg, #102d44, #121d34);
}
.phone-platform,
.phone-date {
  text-align: center;
  font-size: 11px;
}
.phone-time {
  text-align: center;
  font-size: 44px;
  letter-spacing: -2px;
  margin-top: 18px;
}
.phone-notification {
  background: #101521e8;
  border: 1px solid #ffffff25;
  border-radius: 14px;
  padding: 14px;
  margin-top: 26px;
  overflow-wrap: anywhere;
}
.phone-notification small {
  display: block;
  color: #bec9de;
  font-size: 10px;
  margin-bottom: 8px;
}
.phone-notification strong {
  font-size: 13px;
  display: block;
}
.phone-notification p {
  font-size: 12px;
  white-space: pre-wrap;
}
.filter-summary {
  max-height: 200px;
  overflow: auto;
  white-space: pre-wrap;
  color: var(--muted);
  font-size: 12px;
}
.data {
  font-size: 13px;
}
.data td,
.data th {
  padding: 16px 12px;
}
.data tr:hover td {
  background: var(--accent-soft);
}
.filter-group {
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}
.push-test-dialog {
  width: min(1080px, 96vw);
  max-width: none;
  max-height: 92vh;
  overflow: auto;
  padding: 24px;
}
.push-test-dialog > .section-heading {
  justify-content: space-between;
}
.test-dialog-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  gap: 24px;
  align-items: start;
  margin: 20px 0;
}
.test-message-preview {
  min-width: 0;
}
.test-dialog-footer {
  position: sticky;
  bottom: -24px;
  padding: 20px 0 8px;
  background: var(--surface);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
}
.composer-card > .phone-preview {
  margin: 20px auto;
}
@media (max-width: 850px) {
  .test-dialog-grid {
    grid-template-columns: 1fr;
  }
  .push-test-dialog {
    padding: 16px;
  }
  .test-dialog-footer {
    bottom: -16px;
  }
}

.condition-tree {
  margin: 24px 0;
  outline-offset: 6px;
}
.tree-group {
  position: relative;
  border-left: 2px solid #6383ec;
  padding: 12px 0 12px 24px;
  margin: 16px 0 16px 14px;
}
.tree-group.or {
  border-color: #b392ed;
  border-radius: 8px 0 0 8px;
  background: rgba(139, 105, 210, 0.04);
}
.tree-badge {
  color: #8ba9ff;
  font-size: 12px;
  letter-spacing: 0.06em;
}
.or > .tree-badge {
  color: #c8a9ff;
}
.tree-condition {
  position: relative;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.tree-condition::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 25px;
  width: 18px;
  border-top: 2px solid #6383ec;
}
.or > .tree-condition::before {
  border-color: #b392ed;
}
.condition-summary {
  font-size: 15px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}
.negative-condition {
  color: #e59171;
}
.tree-row-actions,
.tree-group-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0;
}
.tree-row-actions button,
.tree-group-actions button {
  padding: 4px 9px;
  font-size: 12px;
}
.condition-edit {
  padding: 16px;
  margin: 12px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.condition-edit > .toolbar {
  margin: 12px 0;
}

.segment-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 32px;
  align-items: start;
  margin-bottom: 24px;
}
.segment-tree-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  background: var(--surface);
}
.segment-info {
  padding: 20px;
  border-left: 1px solid var(--border);
}
.segment-info h3 {
  font-size: 12px;
  color: var(--muted);
  margin: 24px 0 8px;
}
.segment-title {
  font: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  border-bottom: 1px dashed var(--muted);
  padding: 4px 0;
  max-width: 100%;
  width: 520px;
}
@media (max-width: 1000px) {
  .segment-workspace {
    grid-template-columns: 1fr;
  }
  .segment-info {
    border-left: 0;
    border-top: 1px solid var(--border);
  }
  .tree-group {
    padding-left: 16px;
    margin-left: 4px;
  }
}

@media (hover: hover) {
  .tree-row-actions {
    opacity: 0;
    transition: opacity 120ms ease;
  }
  .tree-condition:hover > .tree-row-actions,
  .tree-condition:focus-within > .tree-row-actions {
    opacity: 1;
  }
}
.theme-moon {
  display: none;
}
html[data-theme='light'] .theme-sun {
  display: none;
}
html[data-theme='light'] .theme-moon {
  display: block;
}
.rail .platform-clock {
  width: 52px;
  height: 50px;
  padding: 3px 0;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  color: #d9e2f5;
}
.clock-time {
  display: flex;
  align-items: baseline;
  gap: 1px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.clock-digits {
  font-size: 16px;
  font-weight: 650;
}
.clock-period {
  font-size: 6px;
}
.clock-city {
  max-width: 48px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
  line-height: 1.3;
}
.profile-data {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 12px 20px;
}
.profile-data dt {
  color: var(--muted);
}
.profile-data dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.device-summary {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  overflow-wrap: anywhere;
}
.permission-granted {
  color: var(--good);
}
@media (max-width: 600px) {
  .profile-data {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

/* T9.9: fixed gradient, no moving or flashing light. */
.rail .platform-clock {
  transition: box-shadow 250ms ease;
}
.clock-time {
  background-image: linear-gradient(
    110deg,
    #2878ff,
    #42ceff,
    #a58bff,
    #ff83b9,
    #ffe15a
  );
  background-clip: text;
  -webkit-background-clip: text;
  transition: color 250ms ease;
}
.platform-clock:hover .clock-time,
.platform-clock:focus-visible .clock-time {
  color: transparent;
}
.rail .platform-clock:hover,
.rail .platform-clock:focus-visible {
  box-shadow:
    -2px 0 10px #2878ff33,
    2px 0 10px #ff83b933,
    0 2px 10px #ffe15a22;
}
@media (prefers-reduced-motion: reduce) {
  .rail .platform-clock,
  .clock-time {
    transition: none;
  }
}

.rail-defs {
  position: absolute;
  pointer-events: none;
}
.rail button:is(:hover, :focus-visible, .active, [aria-expanded='true']) > svg {
  stroke: url('#rail-rainbow');
  filter: drop-shadow(0 0 3px #a58bff55);
}
.rail-tooltip {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 30;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 4px 16px #0003;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  visibility: hidden;
  opacity: 0;
  transition:
    opacity 150ms ease,
    visibility 150ms;
}
.rail
  button:not(.tooltip-dismissed):is(:hover, :focus-visible)
  > .rail-tooltip {
  visibility: visible;
  opacity: 1;
  transition-delay: 150ms;
}
@media (prefers-reduced-motion: reduce) {
  .rail-tooltip {
    transition: none;
  }
}

/* Keep time inside the rail, including 12-hour periods. */
.rail .platform-clock {
  box-sizing: border-box;
  padding: 3px 1px;
  min-width: 0;
}
.clock-time {
  flex-direction: column;
  align-items: center;
  gap: 1px;
  max-width: 100%;
}
.clock-digits {
  font-size: 14px;
  letter-spacing: 0;
  white-space: nowrap;
}
.clock-period {
  font-size: 8px;
  line-height: 1;
}
.screen-state {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-block: 20px;
}

.loading-state {
  display: grid;
  gap: 14px;
}
.skeleton {
  height: 24px;
  border-radius: 6px;
  background: var(--border);
  opacity: 0.5;
  animation: skeleton-pulse 1.3s ease-in-out infinite alternate;
}
.skeleton:nth-child(3) {
  width: 75%;
}
.skeleton:nth-child(4) {
  width: 50%;
}
@keyframes skeleton-pulse {
  to {
    opacity: 0.2;
  }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none;
  }
}
.empty {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--muted);
}
.error-state {
  color: var(--text);
}

#notice[data-kind='error'] .notice-icon {
  color: var(--bad);
  font-weight: 700;
}
#notice[data-kind='success'] .notice-icon {
  color: var(--accent);
}

/* T13: wide areas own their scroll; the page stays viewport-wide. */
.app {
  grid-template-columns: 56px minmax(0, 1fr);
}
.table-scroll {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  border-radius: 10px;
}
.table-scroll table {
  min-width: 640px;
  width: 100%;
}
.table-scroll:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.head {
  flex-wrap: wrap;
}
.head > :nth-child(2) {
  min-width: 0;
  flex: 1 1 180px;
  overflow-wrap: anywhere;
}
.head-icon {
  flex-shrink: 0;
}
.head-actions {
  flex-wrap: wrap;
}
.toolbar > *,
.manager-tools > *,
.form-field {
  min-width: 0;
  max-width: 100%;
}
.panel {
  width: min(240px, calc(100vw - 72px));
  overflow-y: auto;
}
.app:has(.panel:not([hidden])) main#content {
  margin-inline-start: min(240px, calc(100vw - 72px));
}
.confirmation {
  box-sizing: border-box;
  width: min(540px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  overscroll-behavior: contain;
}
.push-test-dialog {
  width: min(1080px, calc(100vw - 32px));
}
.confirmation button {
  max-width: 100%;
  overflow-wrap: anywhere;
}
.condition-tree {
  max-width: 100%;
  overflow-x: auto;
}
pre {
  max-width: 100%;
  overflow: auto;
}
@media (max-width: 1024px) {
  main#content {
    padding-inline: 20px;
  }
  .head-actions {
    width: 100%;
  }
  .editor-grid,
  .segment-workspace {
    grid-template-columns: minmax(0, 1fr);
  }
  .preview-stack {
    position: static;
  }
}
@media (max-width: 800px) {
  .manager-tools {
    flex-wrap: wrap;
  }
  .profile-data {
    grid-template-columns: 130px minmax(0, 1fr);
  }
  .confirmation {
    padding: 18px;
  }
}

/* T18: сценарии по группам и цепочка шагов */
.flow-group {
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px 16px;
  background: var(--surface);
}
.flow-group summary {
  cursor: pointer;
  font-weight: 600;
  padding: 8px 0;
}
.flow-node p {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
}
.flow-node .phone-preview {
  margin: 12px auto;
  text-align: left;
}
.flow-node .toolbar {
  justify-content: center;
  margin-top: 10px;
}
@media (max-width: 700px) {
  .flow-node {
    min-width: 0;
    width: 100%;
    padding: 14px 16px;
  }
  .flow-schema {
    padding: 16px;
  }
}
.flow-text-dialog .error {
  color: var(--bad);
}
.flow-text-dialog .form-field {
  display: block;
  margin: 12px 0;
}
.flow-text-dialog textarea {
  min-height: 90px;
}
.flow-text-dialog .toolbar .form-field {
  flex: 1;
  min-width: 110px;
}
.flow-text-dialog {
  max-width: 760px;
  width: calc(100vw - 32px);
}
.status-badge.sending {
  color: var(--accent);
  border-color: var(--accent);
}
.status-badge.paused {
  color: var(--highlight);
}
/* Раздел «Проблемы» */
#issues {
  position: relative;
}
.rail-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--highlight);
  color: var(--bg);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.rail-badge.error {
  background: var(--bad);
  color: #fff;
}
.issue-card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--highlight);
  border-radius: 12px;
  padding: 16px 20px;
  margin: 14px 0;
  background: var(--surface);
}
.issue-card.error {
  border-left-color: var(--bad);
}
.issue-card p {
  overflow-wrap: anywhere;
}
.issue-head {
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
}
.status-badge.error {
  color: var(--bad);
  border-color: var(--bad);
}

/* Отчёт кампании */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.stat-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-card small,
.stat-card span {
  color: var(--muted);
}
.stat-card strong {
  font-size: 22px;
}
.progress {
  height: 8px;
  border-radius: 4px;
  background: var(--surface-2);
  overflow: hidden;
  margin: 10px 0 4px;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.4s;
}
.status-badge.scheduled {
  color: var(--accent);
}

.phone-notification .push-image {
  display: block;
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  border-radius: 8px;
  margin-top: 8px;
}

.authenticator-setup {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
}
.authenticator-qr {
  width: 240px;
  height: 240px;
  max-width: 100%;
  flex-shrink: 0;
  background: #fff;
}
.login-card:has(.authenticator-setup) {
  width: min(720px, 100%);
}
.authenticator-setup > label {
  flex: 1 1 260px;
  min-width: 0;
}
.authenticator-setup input {
  width: 100%;
  min-width: 0;
}

/* ---------- Визуальный редактор писем ---------- */
dialog.studio {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: #0f1219;
  color: inherit;
}
dialog.studio[open] {
  display: flex;
  flex-direction: column;
}
.studio-top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid #2a3142;
  flex-wrap: wrap;
}
.studio-top .form-field {
  margin: 0;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.studio-top select {
  width: auto;
}
.studio-grow {
  flex: 1;
}
.studio-size {
  font-size: 13px;
  color: #9aa3b5;
  padding: 4px 10px;
  border: 1px solid #2a3142;
  border-radius: 999px;
}
.studio-size.warn {
  color: #ffb4a8;
  border-color: #a8473b;
}
.studio-seg {
  display: inline-flex;
  border: 1px solid #2a3142;
  border-radius: 8px;
  overflow: hidden;
}
.studio-seg button {
  border: 0;
  border-radius: 0;
}
.studio-seg button.active {
  background: #7c5cff;
  color: #fff;
}
.studio-body {
  flex: 1;
  display: grid;
  grid-template-columns: 260px 1fr 320px;
  min-height: 0;
}
.studio-left,
.studio-side {
  overflow: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.studio-left {
  border-right: 1px solid #2a3142;
}
.studio-side {
  border-left: 1px solid #2a3142;
}
.studio-side h3 {
  margin: 0;
}
.studio-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.studio-tiles.wide {
  grid-template-columns: 1fr;
}
.studio-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 12px 10px;
  min-height: 52px;
  border: 1px solid #2a3142;
  border-radius: 10px;
  background: #171b26;
  color: inherit;
  cursor: grab;
  text-align: left;
  width: 100%;
}
.studio-tile:hover {
  border-color: #7c5cff;
}
.studio-lib-row {
  display: flex;
  gap: 4px;
  align-items: stretch;
}
.studio-x {
  border: 1px solid #2a3142;
  border-radius: 10px;
  background: transparent;
  color: #9aa3b5;
  cursor: pointer;
}
.studio-group {
  margin-top: 6px;
}
.studio-canvas {
  overflow: auto;
  background: #e9ebf0;
  display: flex;
  justify-content: center;
  padding: 24px;
}
.studio-frame {
  width: 100%;
  max-width: 860px;
  height: 100%;
  min-height: 600px;
  border: 0;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 24px rgb(0 0 0 / 15%);
}
.studio-canvas.mobile .studio-frame {
  max-width: 390px;
}
.studio-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.studio-colors input {
  width: 36px;
  height: 28px;
  padding: 0;
  border: 1px solid #2a3142;
  border-radius: 6px;
  background: none;
}

/* ---------- Фирменный стиль: спокойный, как у Apple, с радугой RocKit ----------
   Радуга — только на главных кнопках, линиях прогресса, активных индикаторах и фокусе.
   Логотип, часы и нижние кнопки меню не трогаем. Текст всегда контрастный к фону. */
:root,
html[data-theme='dark'] {
  --rainbow: linear-gradient(
    90deg,
    #2878ff,
    #42ceff,
    #a58bff,
    #ff83b9,
    #ffe15a
  );
  --line-strong: #5a6680;
  --accent-soft: rgba(255, 255, 255, 0.07);
  --disabled-bg: #232c42;
  --disabled-text: #7f8aa3;
}
html[data-theme='light'] {
  --line-strong: #8a96ad;
  --accent-soft: #eceff4;
  --disabled-bg: #e3e8f2;
  --disabled-text: #5f6b82;
}
/* Главная кнопка — монохром, как у Apple: тёмная в светлой теме, светлая в тёмной.
   Радуга — только подводка при наведении и фокусе. */
.primary {
  border: 2px solid transparent;
  padding: 8px 16px;
  border-radius: 12px;
  color: var(--bg);
  background:
    linear-gradient(var(--text), var(--text)) padding-box,
    linear-gradient(var(--text), var(--text)) border-box;
}
.primary:hover:not(:disabled),
.primary:focus-visible {
  outline: none;
  background:
    linear-gradient(var(--text), var(--text)) padding-box,
    var(--rainbow) border-box;
}
.primary:disabled {
  opacity: 1;
  background: var(--disabled-bg);
  color: var(--disabled-text);
  cursor: not-allowed;
}
.ghost {
  border-color: var(--line-strong);
  color: var(--text);
  border-radius: 12px;
}
.ghost:hover:not(:disabled),
.ghost:focus-visible {
  outline: none;
  border-color: transparent;
  background:
    linear-gradient(var(--surface-2), var(--surface-2)) padding-box,
    var(--rainbow) border-box;
}
.ghost:disabled {
  opacity: 1;
  color: var(--disabled-text);
  background: var(--disabled-bg);
  border-color: transparent;
}
/* Нажатые переключатели — как сегменты в macOS: инверсия цвета. */
button[aria-pressed='true'] {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}
/* Поле в фокусе — радужная рамка. */
input:not(
    [type='checkbox'],
    [type='radio'],
    [type='color'],
    [type='file'],
    [type='range']
  ):focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: transparent;
  background:
    linear-gradient(var(--surface-2), var(--surface-2)) padding-box,
    var(--rainbow) border-box;
}
.form-field
  input:not(
    [type='checkbox'],
    [type='radio'],
    [type='color'],
    [type='file'],
    [type='range']
  ):focus-visible,
.form-field select:focus-visible,
.form-field textarea:focus-visible {
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    var(--rainbow) border-box;
}
.progress-fill,
.rail button.active::before {
  background: var(--rainbow);
}
.status-badge.sending,
.status-badge.scheduled {
  color: var(--text);
  border-color: var(--line-strong);
}
.status-badge.sending::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--rainbow);
  vertical-align: 1px;
}
.flow-node {
  border-color: var(--line-strong);
  background: var(--surface-2);
}
.flow-arrow {
  color: var(--muted);
}
.filter-group {
  border-left-color: var(--line-strong);
}
.table-scroll:focus-visible {
  outline-color: var(--text);
}
#notice[data-kind='success'] .notice-icon {
  color: var(--good);
}
/* Визуальный редактор: цвета темы кабинета (светлая и тёмная). */
dialog.studio {
  background: var(--bg);
  color: var(--text);
}
.studio-top,
.studio-left,
.studio-side,
.studio-seg,
.studio-tile,
.studio-x,
.studio-colors input {
  border-color: var(--border);
}
.studio-tile {
  background: var(--surface);
  color: var(--text);
}
.studio-tile:hover,
.studio-tile:focus-visible {
  outline: none;
  border-color: transparent;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    var(--rainbow) border-box;
}
.studio-seg button.active {
  background: var(--text);
  color: var(--bg);
}
.studio-size,
.studio-x {
  color: var(--muted);
}
.studio-canvas {
  background: var(--surface-2);
}
.push-preview .push-image {
  display: block;
  width: 100%;
  max-height: 180px;
  margin-top: 8px;
  object-fit: cover;
  border-radius: 10px;
}

/* ---------- Редизайн, этап 1: палитра Apple ----------
   Тёмная тема — чёрная, как в macOS; светлая — серо-белая гамма Apple.
   Радугу можно выключить кнопкой в нижней панели (html[data-rainbow='off']). */
:root,
html[data-theme='dark'] {
  --bg: #000000;
  --rail: #0e0e10;
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --text: #f5f5f7;
  --muted: #a1a1a6;
  --border: #38383a;
  --line-strong: #636366;
  --accent: #409cff;
  --accent-soft: rgba(255, 255, 255, 0.08);
  --disabled-bg: #2c2c2e;
  --disabled-text: #8e8e93;
  --card-active-bg: #f5f5f7;
  --card-active-text: #000000;
  --good: #30d158;
  --bad: #ff6961;
}
html[data-theme='light'] {
  --bg: #f5f5f7;
  --rail: #0e0e10;
  --surface: #ffffff;
  --surface-2: #f2f2f7;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --border: #d2d2d7;
  --line-strong: #8e8e93;
  --accent: #0066cc;
  --accent-soft: #e8e8ed;
  --disabled-bg: #e8e8ed;
  --disabled-text: #6e6e73;
  --card-active-bg: #1d1d1f;
  --card-active-text: #ffffff;
  --good: #1f7a36;
  --bad: #c4001a;
}
html[data-rainbow='off'] {
  --rainbow: linear-gradient(var(--text), var(--text));
}
body {
  font-family:
    -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Manrope,
    system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.login {
  background: var(--bg);
}
.rail button {
  color: #a1a1a6;
}
.rail button:hover,
.rail button[aria-expanded='true'],
.rail button.active {
  background: #2c2c2e;
  color: #f5f5f7;
}
/* Нажатый переключатель (язык, режим) — контрастная инверсия и при наведении. */
button.ghost[aria-pressed='true'],
button.ghost[aria-pressed='true']:hover:not(:disabled),
button.ghost[aria-pressed='true']:focus-visible {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
/* Кнопка радуги в нижней панели. */
#rainbow svg path {
  stroke: currentColor;
  stroke-width: 2;
}
#rainbow[aria-pressed='true'] .rb1 {
  stroke: #2878ff;
}
#rainbow[aria-pressed='true'] .rb2 {
  stroke: #ff83b9;
}
#rainbow[aria-pressed='true'] .rb3 {
  stroke: #ffe15a;
}
.rail button[aria-pressed] {
  background: transparent;
  border-color: transparent;
  color: #a1a1a6;
}
.rail button[aria-pressed]:hover {
  background: #2c2c2e;
}

/* ---------- Кнопки как на макете: без радужной подсветки ----------
   Радуга остаётся только на подчёркивании вкладок, линиях прогресса, точках статуса
   и рамке поля в фокусе. Кнопки — спокойные, как в macOS. */
:root,
html[data-theme='dark'] {
  --pri-bg: #f5f5f7;
  --pri-hover: #d1d1d6;
  --pri-tx: #000000;
  --seg-on: #636366;
  --seg-on-tx: #ffffff;
}
html[data-theme='light'] {
  --pri-bg: #1d1d1f;
  --pri-hover: #3a3a3c;
  --pri-tx: #ffffff;
  --seg-on: #ffffff;
  --seg-on-tx: #1d1d1f;
}
/* Размер кнопки задаётся только в обычном состоянии: при наведении меняется лишь цвет,
   иначе кнопка «прыгает» (например, на входе: 12px → 8px). */
.primary {
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 8px 15px;
}
.primary,
.primary:hover:not(:disabled),
.primary:focus-visible {
  border-color: transparent;
  background: var(--pri-bg);
  color: var(--pri-tx);
  font-weight: 600;
  filter: none;
  box-shadow: none;
}
.primary:hover:not(:disabled) {
  background: var(--pri-hover);
}
.ghost {
  border: 1px solid var(--line-strong);
  border-radius: 9px;
}
.ghost,
.ghost:hover:not(:disabled),
.ghost:focus-visible {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--text);
}
.ghost:hover:not(:disabled) {
  background: var(--surface-2);
}
.primary:focus-visible,
.ghost:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}
.primary:disabled,
.ghost:disabled {
  border-color: transparent;
  background: var(--disabled-bg);
  color: var(--disabled-text);
}
/* Нажатый переключатель — как выбранный сегмент в macOS. */
button.ghost[aria-pressed='true'],
button.ghost[aria-pressed='true']:hover:not(:disabled),
button.ghost[aria-pressed='true']:focus-visible {
  background: var(--seg-on);
  color: var(--seg-on-tx);
  border-color: var(--seg-on);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}
html[data-theme='light'] button.ghost[aria-pressed='true'] {
  border-color: var(--line-strong);
}
/* Плитки визуального редактора — без радуги, спокойная рамка. */
.studio-tile:hover,
.studio-tile:focus-visible {
  background: var(--surface-2);
  border-color: var(--line-strong);
}
.studio-seg button.active {
  background: var(--seg-on);
  color: var(--seg-on-tx);
}

/* ---------- Редизайн, этап 2: вход ----------
   Одна карточка по центру, радужное сияние на фоне (выключается кнопкой радуги),
   по одному шагу за раз; текст ошибки — только когда что-то не так. */
.login {
  position: relative;
  overflow: hidden;
  background: var(--bg);
}
.login-aurora {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.login-aurora span {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.42;
}
.login-aurora span:nth-child(1) {
  width: 620px;
  height: 620px;
  left: -160px;
  bottom: -260px;
  background: #2878ff;
}
.login-aurora span:nth-child(2) {
  width: 520px;
  height: 520px;
  left: 30%;
  bottom: -300px;
  background: #a58bff;
}
.login-aurora span:nth-child(3) {
  width: 560px;
  height: 560px;
  right: 10%;
  bottom: -320px;
  background: #ff83b9;
  opacity: 0.38;
}
.login-aurora span:nth-child(4) {
  width: 520px;
  height: 520px;
  right: -180px;
  bottom: -200px;
  background: #ffe15a;
  opacity: 0.32;
}
.login-aurora span:nth-child(5) {
  width: 420px;
  height: 420px;
  left: 10%;
  top: -240px;
  background: #42ceff;
  opacity: 0.22;
}
html[data-theme='light'] .login-aurora span {
  opacity: 0.3;
}
html[data-rainbow='off'] .login-aurora {
  display: none;
}
.login-card,
.login-card:has(.authenticator-setup) {
  position: relative;
  width: min(380px, 100%);
  padding: 34px 30px;
  gap: 14px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
.login-logo {
  justify-self: center;
}
.login-card h1 {
  font-size: 24px;
  text-align: center;
  letter-spacing: -0.02em;
}
#people-login,
.login-card form {
  display: grid;
  gap: 10px;
}
.login-card input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 13px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}
.login-card input[aria-invalid='true'] {
  border-color: var(--bad);
  box-shadow: 0 0 0 1px var(--bad);
}
.login-card .primary,
.login-wide {
  width: 100%;
  padding: 12px;
}
.login-code {
  text-align: center;
  letter-spacing: 0.12em;
  font-size: 16px;
}
.login-error {
  margin: 0;
  color: var(--bad);
  font-size: 13px;
  text-align: center;
}
.login-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.login-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.login-links:empty {
  display: none;
}
.login-link {
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  padding: 4px;
  cursor: pointer;
}
.login-link:hover,
.login-link:focus-visible {
  color: var(--text);
}
.login-steps {
  display: flex;
  justify-content: center;
  gap: 6px;
}
.login-steps span {
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: var(--line-strong);
}
.login-steps span.on {
  width: 18px;
  background: var(--rainbow);
}
#people-login .authenticator-qr {
  justify-self: center;
  width: 168px;
  height: 168px;
  padding: 10px;
  border-radius: 14px;
  box-sizing: content-box;
}
.login-manual summary {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  cursor: pointer;
  list-style: none;
}
.login-manual summary::-webkit-details-marker {
  display: none;
}
.login-manual input {
  margin-top: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}
.login-codes {
  margin: 0;
  padding: 12px;
  border-radius: 10px;
  background: var(--surface-2);
  text-align: center;
  font-size: 14px;
  line-height: 1.7;
}

/* ---------- Редизайн, этап 3: боковое меню с подписями, шапки и вкладки ---------- */
:root,
html[data-theme='dark'] {
  --rail: #0e0e10;
  --side-hover: #2c2c2e;
}
html[data-theme='light'] {
  --rail: #ebebef;
  --side-hover: #dcdce1;
}
.app {
  grid-template-columns: 232px minmax(0, 1fr);
}
.rail {
  width: 232px;
  box-sizing: border-box;
  align-items: stretch;
  gap: 1px;
  padding: 16px 12px 12px;
  overflow-y: auto;
}
.rail > button[data-group],
.panel {
  display: none !important;
}
.side-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 8px 12px;
}
.side-brand .rail-logo {
  width: 26px;
  height: 26px;
  margin: 0;
}
.side-word {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.rail .side-brand .platform-clock {
  width: auto;
  height: auto;
  margin: 0 0 0 auto;
  padding: 4px 6px;
  flex-direction: row;
  color: var(--muted);
}
.side-brand .clock-time {
  flex-direction: row;
  align-items: baseline;
  gap: 2px;
}
.side-brand .clock-digits {
  font-size: 12px;
  font-weight: 600;
}
.side-brand .clock-city {
  display: none;
}
.side-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.side-group {
  margin: 14px 10px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.rail .side-item {
  width: 100%;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
}
.rail .side-item:hover {
  background: var(--side-hover);
  color: var(--text);
}
.side-item svg {
  width: 17px;
  height: 17px;
  flex: none;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.rail .side-item[aria-current='page'] {
  background: var(--side-hover);
  font-weight: 600;
}
.side-item[aria-current='page'] svg {
  stroke: var(--text);
}
.side-item[aria-current='page']::after {
  content: '';
  width: 6px;
  height: 6px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--rainbow);
}
.side-item + .side-item[data-section='settings'] {
  margin-top: 12px;
}
.side-account {
  margin: 8px 0 0;
  padding: 0 10px;
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.side-account:empty {
  display: none;
}
.rail-bottom {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.rail .rail-bottom button {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  color: var(--muted);
}
.rail .rail-bottom button:hover,
.rail .rail-bottom button.active {
  background: var(--side-hover);
  color: var(--text);
}
.rail-bottom #logout {
  margin-left: auto;
}
.rail-bottom .rail-tooltip {
  display: none;
}
/* Шапка страницы: раздел мелко, заголовок крупно, действия справа. */
.head {
  align-items: flex-end;
  padding: 22px 0 14px;
  margin-bottom: 16px;
}
.head-icon {
  display: none;
}
.head-crumb {
  margin: 0 0 2px;
  font-size: 12px;
  color: var(--muted);
}
.head h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.02em;
}
/* Вкладки настроек. */
.page-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: -16px 0 20px;
  border-bottom: 1px solid var(--border);
}
.page-tabs button {
  position: relative;
  border: 0;
  background: none;
  padding: 10px 0 11px;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}
.page-tabs button:hover {
  color: var(--text);
}
.page-tabs button[aria-current='page'] {
  color: var(--text);
  font-weight: 600;
}
.page-tabs button[aria-current='page']::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--rainbow);
}
/* Сегментированный переключатель, как в macOS. */
.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 10px;
  background: var(--surface-2);
  margin: 4px 0 8px;
}
.segmented button.ghost,
.segmented button.ghost:hover:not(:disabled) {
  border: 0;
  border-radius: 8px;
  padding: 6px 14px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}
.segmented button.ghost:hover:not(:disabled) {
  background: var(--side-hover);
}
.segmented button.ghost[aria-pressed='true'],
.segmented button.ghost[aria-pressed='true']:hover:not(:disabled) {
  background: var(--seg-on);
  color: var(--seg-on-tx);
  border: 0;
}
/* Превью пуша — в цветах темы. */
.push-preview.ios {
  background: var(--surface-2);
}
/* Узкий экран: меню — только иконки. */
@media (max-width: 900px) {
  .app {
    grid-template-columns: 64px minmax(0, 1fr);
  }
  .rail {
    width: 64px;
    padding: 12px 8px;
  }
  .side-word,
  .side-group,
  .side-item span,
  .side-account,
  .side-brand .platform-clock {
    display: none;
  }
  .rail .side-item {
    justify-content: center;
    padding: 9px 0;
  }
  .side-item[aria-current='page']::after {
    display: none;
  }
  .rail-bottom {
    flex-direction: column;
  }
  .rail-bottom #logout {
    margin-left: 0;
  }
}
.head > .head-text {
  flex: 1 1 180px;
  min-width: 0;
}
.head > .head-actions {
  flex: 0 1 auto;
  margin-left: auto;
  justify-content: flex-end;
}
.rail button.side-item > svg,
.rail button.side-item:is(:hover, :focus-visible) > svg {
  stroke: var(--muted);
}
.rail button.side-item[aria-current='page'] > svg {
  stroke: var(--text);
}
.rail button.side-item > svg,
.rail .rail-bottom button > svg {
  filter: none;
}
.rail .rail-bottom button:is(:hover, :focus-visible, .active) > svg {
  stroke: currentColor;
}

/* Превью пуша — экран телефона с карточкой уведомления, как в iOS и Android. */
.phone-shot {
  width: 260px;
  max-width: 100%;
  min-height: 300px;
  margin: 0 auto 14px;
  padding: 26px 12px 14px;
  box-sizing: border-box;
  border: 8px solid #1d1d1f;
  border-radius: 38px;
  background: linear-gradient(160deg, #3a2a8c, #0e0e10 70%);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.phone-shot.android {
  border-radius: 26px;
  background: linear-gradient(160deg, #0f4c5c, #0e0e10 70%);
}
.phone-time {
  margin: 0 0 6px;
  text-align: center;
  color: #ffffff;
  font-size: 40px;
  font-weight: 300;
  letter-spacing: -0.02em;
}
.phone-card {
  border-radius: 18px;
  padding: 10px 12px;
  background: rgba(245, 245, 247, 0.94);
  color: #1d1d1f;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.android .phone-card {
  border-radius: 14px;
}
.phone-card-top {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #424245;
  margin-bottom: 4px;
}
.phone-app-icon {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: #000000;
}
.phone-when {
  margin-left: auto;
}
.phone-card strong {
  display: block;
}
.phone-card p {
  margin: 2px 0 0;
  white-space: pre-wrap;
}
.phone-card .push-image {
  margin-top: 8px;
  max-height: 140px;
}
.phone-card .image-placeholder {
  margin-top: 8px;
  padding: 10px;
  font-size: 12px;
  color: #424245;
}
.phone-os {
  margin: auto 0 0;
  text-align: center;
  font-size: 11px;
  color: #d2d2d7;
}
/* Плотные таблицы, как в Maestra. */
table.data th,
table.data td {
  padding: 10px 12px;
}
table.data {
  font-size: 14px;
}

/* ---------- Списки как на макете: поиск в шапке, вкладки, меню «⋯», строки-ссылки ---------- */
.menu-wrap {
  position: relative;
  display: inline-flex;
}
.menu-pop {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  min-width: 200px;
  padding: 5px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
}
.menu-item {
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  padding: 8px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.menu-item:hover:not(:disabled),
.menu-item:focus-visible {
  background: var(--surface-2);
  outline: none;
}
.menu-item:disabled {
  color: var(--disabled-text);
  cursor: default;
}
.ghost.more-button {
  width: 36px;
  padding: 6px 0;
  font-size: 16px;
  line-height: 1;
}
.head-search {
  width: 220px;
  box-sizing: border-box;
  padding: 8px 12px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
.head-search.wide-search {
  flex: 1 1 260px;
  width: auto;
}
.list-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: -16px 0 14px;
  border-bottom: 1px solid var(--border);
}
.list-bar .page-tabs {
  margin: 0;
  border-bottom: 0;
}
.list-bar .segmented {
  margin: 0 0 6px;
}
tr.row-link {
  cursor: pointer;
}
tr.row-link:hover td,
tr.row-link:focus-visible td {
  background: var(--surface-2);
}
tr.row-link:focus-visible {
  outline: none;
}
.link-button {
  border: 0;
  background: none;
  padding: 0;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link-button:hover {
  color: var(--text);
}
/* Статусы — мягкие «таблетки»; у идущих — радужная точка. */
.status-badge,
.status-badge.draft,
.status-badge.launched,
.status-badge.paused,
.status-badge.scheduled,
.status-badge.sending,
.status-badge.active,
.status-badge.inactive {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 99px;
  padding: 3px 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}
.status-badge.draft,
.status-badge.inactive {
  color: var(--muted);
}
.status-badge.paused::before,
.status-badge.scheduled::before,
.status-badge.launched::before,
.status-badge.active::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
}
.status-badge.launched::before,
.status-badge.active::before {
  background: var(--good);
}
.status-badge.sending::before {
  margin-right: 0;
}
.customer-filter:empty {
  display: none;
}
.customer-tools {
  align-items: flex-end;
}

/* ---------- Превью пуша: iPhone 18 Pro и Android, экран блокировки ---------- */
.device {
  width: 280px;
  max-width: 100%;
  aspect-ratio: 9 / 19.5;
  margin: 0 auto 18px;
  padding: 10px;
  box-sizing: border-box;
  border-radius: 56px;
  background: linear-gradient(
    145deg,
    #8e8e93,
    #3a3a3c 30%,
    #1c1c1e 70%,
    #636366
  );
  box-shadow:
    inset 0 0 0 2px #2c2c2e,
    0 18px 40px rgba(0, 0, 0, 0.35);
}
.device.android {
  border-radius: 40px;
  background: linear-gradient(145deg, #48484a, #1c1c1e 60%, #3a3a3c);
}
.device-screen {
  position: relative;
  height: 100%;
  border-radius: 46px;
  overflow: hidden;
  padding: 12px 12px 10px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  color: #ffffff;
  background:
    radial-gradient(120% 70% at 20% 0%, #2878ff 0%, transparent 55%),
    radial-gradient(90% 60% at 100% 30%, #ff83b9 0%, transparent 55%),
    radial-gradient(110% 70% at 50% 100%, #a58bff 0%, transparent 60%), #0b0b14;
}
.android .device-screen {
  border-radius: 32px;
  background:
    radial-gradient(120% 70% at 0% 0%, #42ceff 0%, transparent 55%),
    radial-gradient(100% 60% at 100% 100%, #ffe15a 0%, transparent 55%), #0b0b14;
}
.device-status {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 26px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
}
.device-island {
  position: absolute;
  left: 50%;
  top: 2px;
  width: 92px;
  height: 26px;
  border-radius: 20px;
  background: #000000;
  transform: translateX(-50%);
}
.device-camera {
  position: absolute;
  left: 50%;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #000000;
  transform: translateX(-50%);
}
.deep-link-note .note,
.deep-link-note p {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.device-status-icons {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.device-status-icons svg {
  display: block;
}
.device-app-logo {
  padding: 0;
  background: transparent;
  object-fit: cover;
}
.device-app-letter {
  padding: 0;
  display: grid;
  place-items: center;
  background: #5b5bd6;
  color: #ffffff;
  font-weight: 700;
  font-size: 15px;
}
.device-date {
  margin: 18px 0 0;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  text-transform: capitalize;
  opacity: 0.9;
}
.device-clock {
  margin: -4px 0 14px;
  text-align: center;
  font-size: 66px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.android .device-clock {
  font-size: 58px;
  font-weight: 400;
}
.device-notification {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 10px 11px;
  border-radius: 20px;
  background: rgba(245, 245, 247, 0.72);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  color: #1d1d1f;
  font-size: 12.5px;
  line-height: 1.3;
}
.android .device-notification {
  border-radius: 16px;
  background: rgba(30, 30, 36, 0.82);
  color: #f5f5f7;
}
.device-app-icon {
  width: 30px;
  height: 30px;
  flex: none;
  padding: 4px;
  box-sizing: border-box;
  border-radius: 8px;
  background: #000000;
}
.android .device-app-icon {
  width: 22px;
  height: 22px;
  padding: 3px;
  border-radius: 50%;
}
.device-notification-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.device-notification-meta {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  opacity: 0.75;
}
.device-notification-text strong {
  display: block;
  margin-top: 1px;
}
.device-notification-text p {
  margin: 1px 0 0;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.device-thumb {
  width: 38px;
  height: 38px;
  flex: none;
  object-fit: cover;
  border-radius: 7px;
  margin-top: 14px;
}
.device-image {
  display: block;
  width: 100%;
  max-height: 120px;
  object-fit: cover;
  border-radius: 10px;
  margin-top: 8px;
}
.device-image-error {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  opacity: 0.7;
}
.device-bottom {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
}
.android .device-bottom {
  justify-content: center;
}
.device-round {
  display: grid;
  place-items: center;
  color: #ffffff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.device-home {
  width: 110px;
  height: 4px;
  border-radius: 4px;
  background: #ffffff;
  align-self: flex-end;
  margin-bottom: 2px;
}
.android .device-home {
  width: 80px;
}
.menu-pop {
  position: fixed;
}
.head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.head-actions input.head-search {
  width: 220px;
}
.customer-tools input.head-search.wide-search {
  width: auto;
}
/* Имя в таблице — как текст-ссылка, без рамки кнопки. */
table.data td > button.ghost:first-child {
  border: 0;
  padding: 0;
  background: none;
  font-weight: 600;
  text-align: left;
}
table.data td > button.ghost:first-child:hover {
  background: none;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.device-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}
.device-row .device {
  width: 236px;
  margin: 0;
}
.device-row .device-clock {
  font-size: 56px;
}
.device-row .android .device-clock,
.device-row .device.android .device-clock {
  font-size: 50px;
}
.device-row .device {
  width: 280px;
}
.device-row .device-clock {
  font-size: 66px;
}
.device-row .device.android .device-clock {
  font-size: 58px;
}
.preview-stack > .segmented,
#previews > .segmented,
.segmented + .device-row {
  margin-top: 0;
}
/* Обои телефонов — фирменное радужное сияние, как на экране входа. */
.device-screen,
.android .device-screen {
  background:
    radial-gradient(
      60% 34% at 8% 96%,
      rgba(40, 120, 255, 0.85),
      transparent 70%
    ),
    radial-gradient(
      52% 30% at 40% 104%,
      rgba(165, 139, 255, 0.85),
      transparent 70%
    ),
    radial-gradient(
      54% 32% at 74% 102%,
      rgba(255, 131, 185, 0.8),
      transparent 70%
    ),
    radial-gradient(
      48% 30% at 102% 90%,
      rgba(255, 225, 90, 0.7),
      transparent 70%
    ),
    radial-gradient(
      60% 26% at 26% -4%,
      rgba(66, 206, 255, 0.45),
      transparent 70%
    ),
    #000000;
}
html[data-rainbow='off'] .device-screen {
  background:
    radial-gradient(80% 40% at 50% 100%, #2c2c2e, transparent 70%), #000000;
}
.campaign-preview {
  margin-top: 16px;
}
.campaign-preview .segmented {
  display: flex;
  width: max-content;
  margin: 0 auto 12px;
}
.editor-grid > .campaign-preview {
  margin-top: 0;
  position: sticky;
  top: 16px;
  align-self: start;
}
.step-number {
  display: none;
}
/* Карточка клиента: данные слева, вкладки справа. */
.profile-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.profile-layout > .composer-card {
  position: sticky;
  top: 16px;
}
.profile-layout .profile-data {
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 8px 12px;
  font-size: 13px;
}
.profile-main .list-bar {
  margin-top: 0;
}
.profile-main > .composer-card,
.profile-main > div > .composer-card {
  margin-top: 0;
}
@media (max-width: 1000px) {
  .profile-layout {
    grid-template-columns: 1fr;
  }
  .profile-layout > .composer-card {
    position: static;
  }
}
.flow-group-title {
  margin: 18px 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

/* Топографический фон: линии высот, почти незаметные, на всех экранах */
main#content {
  position: relative;
  isolation: isolate;
}
main#content::before {
  content: '';
  position: fixed;
  inset: 0 0 0 60px;
  z-index: -1;
  pointer-events: none;
  background: var(--rainbow);
  opacity: 0.09;
  -webkit-mask: url('topo.svg') center / cover no-repeat;
  mask: url('topo.svg') center / cover no-repeat;
}
html[data-theme='light'] main#content::before {
  opacity: 0.13;
}
/* Пасхалка: топофон живёт вместе с радугой — выключил радугу, ушли и горы. */
html[data-rainbow='off'] main#content::before {
  display: none;
}
@media (max-width: 900px) {
  main#content::before {
    inset: 0 0 0 64px;
  }
}

/* Меню слева: в покое только иконки, при наведении выезжает поверх
   страницы, уходит мышь — сворачивается обратно. */
.app {
  grid-template-columns: 60px minmax(0, 1fr);
}
.rail {
  width: 60px;
  padding: 16px 10px 12px;
  overflow-x: hidden;
  z-index: 30;
  transition:
    width 0.2s ease 0.25s,
    box-shadow 0.2s ease 0.25s;
}
.rail .side-item {
  padding: 7px 11px;
  overflow: hidden;
  white-space: nowrap;
}
.side-word,
.side-item > span,
.rail .side-brand .platform-clock,
.side-account,
.side-group {
  white-space: nowrap;
  transition: opacity 0.15s ease 0.25s;
}
.rail:not(:hover):not(:has(:focus-visible))
  :is(
    .side-word,
    .side-item > span,
    .side-brand .platform-clock,
    .side-account
  ) {
  opacity: 0;
}
.rail:not(:hover):not(:has(:focus-visible)) .side-group {
  color: transparent;
  position: relative;
}
.rail:not(:hover):not(:has(:focus-visible)) .side-group::before {
  content: '';
  position: absolute;
  left: 2px;
  right: 2px;
  top: 50%;
  border-top: 1px solid var(--border);
}
.rail:not(:hover):not(:has(:focus-visible))
  .side-item[aria-current='page']::after {
  display: none;
}
.rail:not(:hover):not(:has(:focus-visible)) .rail-bottom {
  flex-direction: column;
}
.rail:not(:hover):not(:has(:focus-visible)) .rail-bottom #logout {
  margin-left: 0;
}
@media (hover: hover) and (min-width: 901px) {
  .rail:is(:hover, :has(:focus-visible)) {
    width: 232px;
    box-shadow: 12px 0 40px rgb(0 0 0 / 0.28);
    transition-delay: 0.08s;
  }
  .rail:is(:hover, :has(:focus-visible))
    :is(
      .side-word,
      .side-item > span,
      .side-brand .platform-clock,
      .side-account,
      .side-group
    ) {
    transition-delay: 0.12s;
  }
}
html[data-theme='light'] .rail:is(:hover, :has(:focus-visible)) {
  box-shadow: 12px 0 40px rgb(0 0 0 / 0.1);
}

/* Схема сценария: свой фон — сетка точек, как на холсте; блоки по цепочке,
   выбранный шаг — радужная рамка, настройки шага справа. */
.flow-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}
.flow-canvas {
  position: relative;
  min-height: 560px;
  padding: 56px 24px 48px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background-color: var(--bg);
  background-image: radial-gradient(
    circle,
    var(--line-strong) 1px,
    transparent 1.5px
  );
  background-size: 22px 22px;
  overflow: auto;
}
.flow-canvas-status {
  position: absolute;
  top: 16px;
  left: 18px;
}
.flow-chain {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.flow-step {
  position: relative;
  display: flex;
  justify-content: center;
}
.flow-step + .flow-step {
  margin-top: 34px;
}
.flow-step + .flow-step::before {
  content: '';
  position: absolute;
  top: -34px;
  left: 50%;
  height: 34px;
  border-left: 1.5px solid var(--line-strong);
}
.flow-step + .flow-step::after {
  content: '';
  position: absolute;
  top: -8px;
  left: calc(50% - 4px);
  border: 4px solid transparent;
  border-top: 5px solid var(--line-strong);
}
.flow-block {
  width: 260px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.12);
  transition: transform 0.12s ease;
}
.flow-block:hover {
  transform: translateY(-1px);
  background: var(--surface);
}
.flow-block[aria-pressed='true'],
.flow-block[aria-pressed='true']:hover {
  border-color: transparent;
  color: var(--text);
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    var(--rainbow) border-box;
}
.flow-block strong {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}
.flow-block small {
  font-size: 12px;
  color: var(--muted);
}
.flow-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
}
.flow-branch {
  position: absolute;
  left: calc(50% + 130px + 28px);
  top: 50%;
  transform: translateY(-50%);
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.flow-branch::before {
  content: '';
  position: absolute;
  right: 100%;
  top: 50%;
  width: 28px;
  border-top: 1.5px dashed var(--line-strong);
}
.flow-inspector {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}
.flow-inspector h2 {
  margin: 0;
  font-size: 16px;
}
.flow-inspector p {
  margin: 0;
}
.flow-send {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
}
.flow-send .device {
  align-self: center;
  transform: scale(0.82);
  transform-origin: top center;
  margin-bottom: -95px;
}
.flow-mail {
  width: 100%;
  box-sizing: border-box;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.flow-mail p {
  margin: 6px 0 0;
  color: var(--muted);
  white-space: pre-wrap;
}
@media (max-width: 1100px) {
  .flow-board {
    grid-template-columns: minmax(0, 1fr);
  }
  .flow-inspector {
    position: static;
  }
  .flow-branch {
    display: none;
  }
}

/* Новая кампания: вкладки под названием, переключатель телефона по центру. */
.composer-tabs {
  margin-top: 18px;
}
.preview-stack > .segmented {
  justify-self: center;
}
.composer-card .live-count {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 16px 0 4px;
}

.composer-studio {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin: 12px 0;
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
}
.composer-studio p {
  margin: 0;
}

.flow-send .email-frame {
  width: 100%;
  height: 420px;
}
/* «+» между шагами схемы и варианты A/B-теста. */
.flow-step.flow-add + .flow-step {
  margin-top: 18px;
}
.flow-step + .flow-step.flow-add {
  margin-top: 18px;
}
.flow-step + .flow-step.flow-add::before {
  top: -18px;
  height: 18px;
}
.flow-step.flow-add + .flow-step::before {
  top: -18px;
  height: 18px;
}
.flow-step.flow-add::after,
.flow-step.flow-add + .flow-step::after {
  top: -8px;
}
.flow-step.flow-add::after {
  display: none;
}
.rail ~ main button.flow-plus,
button.flow-plus {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  line-height: 1;
}
button.flow-plus:hover {
  border-color: var(--text);
}
.flow-variants {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.flow-variant {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.flow-variant small {
  display: block;
  color: var(--muted);
}
/* Системное письмо-приглашение над списком сценариев нашего проекта. */
.system-flow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 16px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.system-flow-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.system-flow-text p {
  margin: 6px 0 4px;
  color: var(--muted);
}
.system-flow-text small {
  color: var(--muted);
}
/* Условие шага: строки правил; цель сценария — кнопка в углу схемы. */
.condition-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0;
}
.condition-row {
  align-items: flex-end;
  flex-wrap: wrap;
}
.flow-canvas-status {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rail ~ main button.flow-goal,
button.ghost.flow-goal {
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
}

/* Полоса черновика сценария: правки не мешают работающей версии. */
.flow-draft-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 16px;
}
.flow-draft-bar .toolbar {
  margin-left: auto;
}

/* Ветка «Нет» шага цепочки: компактная колонка справа от проверки, под подписью ветки. */
.flow-no-branch {
  position: absolute;
  left: calc(50% + 130px + 28px);
  top: calc(50% + 22px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 200px;
  padding-left: 12px;
  border-left: 1.5px dashed var(--line-strong);
}
.flow-no-branch .flow-block {
  width: 100%;
  padding: 8px 10px;
}
.flow-no-branch .flow-block strong {
  font-size: 13px;
}
.flow-branch-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
@media (max-width: 1100px) {
  .flow-no-branch {
    position: static;
    width: auto;
    margin: 12px 0 0 24px;
  }
}

/* Обновление страницы: пока проверяется сохранённый вход, форму входа не показываем. */
html.booting #login {
  visibility: hidden;
}

/* ---------- Конструктор сценариев 2.0, этап 1 ----------
   Фон — меркаторская сетка (меридианы через равный шаг, параллели расходятся к северу),
   очень тихо. Блоки со значками типа и цифрами. Радуга — только тонкими линиями. */
.flow-canvas.flow-grid {
  background-color: var(--bg);
  /* Сетка растягивается на всю высоту схемы (не повторяется по вертикали), линейка — только сверху. */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='720' height='6'%3E%3Cpath fill='none' stroke='%238c96aa' stroke-opacity='.28' d='M24 0v6M48 0v6M72 0v6M96 0v6M144 0v6M168 0v6M192 0v6M216 0v6M264 0v6M288 0v6M312 0v6M336 0v6M384 0v6M408 0v6M432 0v6M456 0v6M504 0v6M528 0v6M552 0v6M576 0v6M624 0v6M648 0v6M672 0v6M696 0v6'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 720 720' preserveAspectRatio='none'%3E%3Cg fill='none' stroke='%238c96aa' stroke-opacity='.16'%3E%3Cpath vector-effect='non-scaling-stroke' d='M0 720H720M0 618H720M0 527H720M0 444H720M0 369H720M0 301H720M0 239H720M0 182H720M0 129H720M0 81H720M0 37H720'/%3E%3Cpath vector-effect='non-scaling-stroke' d='M0 0V720M120 0V720M240 0V720M360 0V720M480 0V720M600 0V720'/%3E%3C/g%3E%3C/svg%3E");
  background-size:
    720px 6px,
    720px 100%;
  background-repeat: repeat-x, repeat-x;
  background-position:
    0 0,
    0 0;
  background-attachment: local, local;
  cursor: grab;
  outline: none;
}
.flow-canvas.flow-panning {
  cursor: grabbing;
  user-select: none;
}
.flow-canvas:focus-visible {
  box-shadow: 0 0 0 2px var(--line-strong);
}
.flow-chain {
  cursor: default;
}
.flow-tools {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
}
.rail ~ main button.flow-tool,
button.flow-tool {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}
button.flow-tool:hover {
  background: var(--surface-2);
}
.flow-zoom-value {
  min-width: 42px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.flow-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.flow-icon {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-2);
}
.flow-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.flow-icon-start {
  color: #30d158;
  background: rgb(48 209 88 / 0.14);
}
.flow-icon-email {
  color: #42ceff;
  background: rgb(66 206 255 / 0.14);
}
.flow-icon-push {
  color: #a58bff;
  background: rgb(165 139 255 / 0.16);
}
.flow-icon-wait {
  color: #e5b800;
  background: rgb(255 214 10 / 0.14);
}
.flow-icon-reaction {
  color: #ff9f0a;
  background: rgb(255 159 10 / 0.14);
}
.flow-icon-condition {
  color: var(--muted);
}
.flow-icon-limit {
  color: #ff6961;
  background: rgb(255 105 97 / 0.14);
}
.flow-icon-split {
  color: #ff83b9;
  background: rgb(255 131 185 / 0.14);
}
.flow-icon-control {
  color: #8e8e93;
}
.flow-icon-exit {
  color: #8e8e93;
}
.flow-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  width: 100%;
  margin-top: 4px;
  padding-top: 7px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
/* Строка счётчиков шага — обычный текст, переносится внутри блока. */
small.flow-metrics {
  display: block;
  white-space: normal;
}
.flow-metric {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.flow-metric b {
  color: var(--text);
  font-weight: 600;
}
.flow-metric-icon svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -2px;
}
.flow-money {
  color: #30d158;
  font-weight: 600;
}
html[data-theme='light'] .flow-money {
  color: #1f7a36;
}
.flow-block strong,
.flow-block small {
  overflow-wrap: anywhere;
}
.flow-kv {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}
.flow-k {
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-2);
}
.flow-k span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}
.flow-k b {
  display: block;
  margin-top: 2px;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}
/* Выделенные для копирования блоки: тонкая радужная рамка (при выключенной радуге — обычная). */
.flow-block.flow-picked {
  border-color: transparent;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    var(--rainbow) border-box;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.flow-selbar {
  position: sticky;
  bottom: 12px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  max-width: calc(100% - 24px);
  margin: 24px auto 0;
  padding: 6px 8px 6px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.25);
  font-size: 13px;
}
.flow-selbar[hidden] {
  display: none;
}
/* «Прогнать на клиенте»: путь клиента на схеме и по шагам справа. */
.flow-simulating .flow-block[data-send]:not(.flow-sim-on, .flow-sim-skip) {
  opacity: 0.45;
}
.flow-block.flow-sim-skip {
  border-style: dashed;
  opacity: 0.7;
}
.flow-block {
  position: relative;
}
.flow-sim-step {
  position: absolute;
  top: -10px;
  left: -10px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--card-active-bg);
  color: var(--card-active-text);
  font-size: 11px;
  font-weight: 700;
}
.flow-sim {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}
.flow-sim li {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  align-items: start;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.4;
}
.flow-sim li:last-child {
  border-bottom: 0;
}
.flow-sim li.flow-sim-skip span:last-child,
.flow-sim li.flow-sim-stop span:last-child {
  color: var(--muted);
}
.flow-sim li.flow-sim-stop span:last-child {
  font-weight: 600;
}

/* Ветки по условиям: колонки слева от цепочки. */
.flow-paths {
  position: absolute;
  right: calc(50% + 130px + 28px);
  top: calc(50% + 22px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 210px;
}
.flow-path {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 12px;
  border-right: 1.5px dashed var(--line-strong);
}
.flow-path .flow-block {
  width: 100%;
  padding: 8px 10px;
}
@media (max-width: 1100px) {
  .flow-paths {
    position: static;
    width: auto;
    margin: 12px 24px 0 0;
  }
}

/* Готовые механики. */
.flow-text-dialog.mechanics {
  width: min(680px, calc(100vw - 32px));
}
.mechanics-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 60vh;
  overflow: auto;
}
.mechanic {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.mechanic > div {
  flex: 1;
  min-width: 0;
}
.mechanic p {
  margin: 4px 0 8px;
  font-size: 13px;
}

/* Usage: полоса расхода — радужная (или одноцветная при выключенной радуге); порог — янтарная, превышение — красная. */
.usage-bar {
  height: 6px;
  margin: 10px 0 6px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
}
.usage-bar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  /* Радуга при включённой теме; при выключенной --rainbow — сплошной цвет текста. */
  background: var(--rainbow);
}
.usage-bar.usage-warn i {
  background: #ff9f0a;
  opacity: 1;
}
.usage-bar.usage-over i {
  background: #ff453a;
  opacity: 1;
}
.usage-plan {
  margin-bottom: 14px;
}

/* Прирост к контролю, заметки, миникарта. */
.flow-canvas-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 420px);
}
.flow-lift {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.flow-lift.up {
  color: #30d158;
}
.flow-lift.down {
  color: #ff453a;
}
html[data-theme='light'] .flow-lift.up {
  color: #1f7a36;
}
.flow-notes {
  position: absolute;
  top: 60px;
  right: 12px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 200px;
}
.rail ~ main button.flow-note,
button.flow-note {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.flow-canvas-wrap {
  position: relative;
  min-width: 0;
}
/* Холст прокручивается внутри: миникарта и панель выделения всегда на виду. */
.flow-canvas-wrap .flow-canvas {
  height: calc(100vh - 210px);
  min-height: 520px;
}
.flow-minimap {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  width: 150px;
  height: 96px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
  cursor: pointer;
}
.flow-minimap-block {
  position: absolute;
  border-radius: 2px;
  background: var(--line-strong);
}
.flow-minimap-view {
  position: absolute;
  border: 1.5px solid var(--text);
  border-radius: 3px;
  opacity: 0.8;
}
@media (max-width: 1100px) {
  .flow-minimap,
  .flow-notes {
    display: none;
  }
}

/* ---------- CJM: карта пути клиента ---------- */
.cjm-total {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}
.cjm-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}
.cjm-main {
  min-width: 0;
  overflow-x: auto;
}
.cjm-funnel {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 26px;
  padding: 12px 0;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--accent-soft), transparent);
  color: var(--text);
}
.cjm-funnel .cjm-lane {
  padding-left: 10px;
  color: var(--text);
}
.cjm-funnel-body {
  min-width: 0;
}
.cjm-cols {
  display: grid;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  gap: 12px;
  text-align: center;
}
.cjm-fn {
  display: block;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}
.cjm-fd {
  font-size: 11px;
  color: var(--muted);
}
.cjm-fc.worst .cjm-fd {
  color: #ff453a;
  font-weight: 600;
}
.cjm-fsv {
  display: block;
  width: 100%;
  height: 64px;
  margin-top: 6px;
}
html[data-rainbow='off'] .cjm-edge {
  stroke: currentColor;
  stroke-opacity: 0.7;
}
.cjm-grid {
  position: relative;
  display: grid;
  grid-template-columns: 96px repeat(var(--n), minmax(150px, 1fr));
  gap: 10px 12px;
}
.cjm-lane {
  padding: 8px 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}
.cjm-stage,
.cjm-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-radius: 12px;
  background: var(--accent-soft);
}
.cjm-stage b {
  font-size: 13px;
}
.cjm-stage .flow-chip {
  align-self: flex-start;
}
.cjm-stage small {
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}
.rail ~ main button.cjm-item,
button.cjm-item {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
}
button.cjm-item > span:last-of-type {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.rail ~ main button.cjm-item.active,
.rail ~ main button.cjm-item.picked,
button.cjm-item.active,
button.cjm-item.picked {
  border-color: transparent;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    var(--rainbow) border-box;
}
button.cjm-item .flow-icon {
  width: 20px;
  height: 20px;
  border-radius: 6px;
}
button.cjm-item .flow-icon svg {
  width: 13px;
  height: 13px;
}
.cjm-loss {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  color: #ff453a;
  font-weight: 700;
  font-size: 11px;
}
.cjm-loss i {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 5px;
  background: var(--card-active-bg);
  color: var(--card-active-text);
  font-style: normal;
  font-size: 10px;
}
.cjm-pin {
  position: absolute;
  top: -8px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  box-sizing: border-box;
  border-radius: 9px;
  background: var(--card-active-bg);
  color: var(--card-active-text);
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.cjm-task,
button.cjm-item small {
  width: 100%;
  color: var(--muted);
  font-size: 11px;
}
button.cjm-item small.on {
  color: #30d158;
}
.rail ~ main button.cjm-add,
button.cjm-add {
  padding: 4px;
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
}
.cjm-empty {
  color: var(--muted);
  font-size: 12px;
}
.cjm-side h3 {
  margin: 8px 0 0;
  font-size: 13px;
}
.cjm-comments {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.cjm-comment p {
  margin: 2px 0 0;
  font-size: 13px;
  white-space: pre-wrap;
}
.cjm-comment small {
  color: var(--muted);
}
@media (max-width: 1100px) {
  .cjm-board {
    grid-template-columns: minmax(0, 1fr);
  }
}
/* Отчёты → Воронки: нейтрально, радуга — только тонкими линиями узкого перехода. */
.fn-tabs {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin: 4px 0 10px;
  border-bottom: 1px solid var(--border);
}
.fn-tab {
  position: relative;
  padding: 8px 0 10px;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.fn-tab.on {
  color: var(--text);
  font-weight: 600;
}
.fn-tab.on::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--rainbow);
}
.fn-tools {
  align-items: flex-end;
}
.fn-tools .segmented {
  margin: 0 0 2px;
}
.fn-tools .form-field {
  flex: 0 0 auto;
}
.fn-work {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 12px;
  align-items: start;
}
.fn-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.fn-card {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  min-width: 0;
}
.fn-card h2 {
  margin: 0 0 4px;
  font-size: 15px;
}
.fn-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.fn-row .segmented {
  margin: 0;
}
.fn-chart {
  margin-top: 12px;
  color: var(--text);
}
.fn-cols {
  display: grid;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  gap: 12px;
  text-align: center;
}
.fn-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  min-width: 0;
}
.fn-col:disabled {
  cursor: default;
  opacity: 1;
}
.fn-col:not(:disabled):hover {
  background: var(--side-hover);
}
.fn-col.on {
  border-color: var(--line-strong);
}
.fn-s {
  font-size: 12px;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fn-n {
  font-size: 22px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.fn-d {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.fn-d.good,
.fn-traits .good,
.flow-k b.good {
  color: var(--good);
}
.fn-d.bad,
.flow-k b.bad {
  color: var(--bad);
}
.fn-sv {
  display: block;
  width: 100%;
  height: 120px;
  margin: 10px 0 6px;
}
html[data-rainbow='off'] .fn-edge {
  stroke: currentColor;
  stroke-opacity: 0.7;
}
.fn-two {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 12px;
}
.fn-table {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
  font-size: 12px;
}
.fn-table th {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-align: left;
}
.fn-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.fn-table tr:last-child td {
  border-bottom: 0;
}
.fn-hm {
  text-align: center;
  font-weight: 600;
  border-radius: 6px;
  background: color-mix(
    in srgb,
    var(--text) calc(var(--hm, 0) * 100%),
    transparent
  );
}
.fn-hist {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 124px;
  padding-top: 8px;
}
.fn-hist div {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  color: var(--muted);
}
.fn-hist i {
  display: block;
  width: 100%;
  border-radius: 5px 5px 2px 2px;
  background: var(--text);
  opacity: 0.32;
}
.fn-hist .med i {
  opacity: 0.95;
}
.fn-hist .med {
  color: var(--text);
  font-weight: 600;
}
.fn-side {
  width: auto;
}
.fn-side .flow-kv {
  width: 100%;
}
.fn-traits {
  width: 100%;
}
.fn-why {
  display: flex;
  justify-content: space-between;
  padding: 6px 0 0;
  font-size: 12px;
}
.fn-why b {
  font-variant-numeric: tabular-nums;
}
.fn-mbar {
  height: 5px;
  margin-top: 4px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
}
.fn-mbar i {
  display: block;
  height: 100%;
  background: var(--text);
  opacity: 0.7;
}
.fn-task {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  padding: 10px;
  border-radius: 12px;
  background: var(--surface-2);
}
.fn-task h3,
.fn-task p {
  margin: 0;
}
@media (max-width: 1100px) {
  .fn-work,
  .fn-two {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Черновик: изменённые блоки и сравнение с рабочей версией. */
.flow-block.flow-changed {
  box-shadow: inset 3px 0 0 var(--text);
}
.flow-changed-badge {
  align-self: flex-start;
  margin-top: 6px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 10px;
  font-weight: 600;
}
.flow-diff-dialog {
  width: min(760px, calc(100vw - 32px));
}
.flow-diff {
  max-height: 60vh;
  overflow: auto;
}
.flow-diff-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.flow-diff-table th {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-align: left;
}
.flow-diff-table td {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  overflow-wrap: anywhere;
}
.flow-diff-table td:first-child {
  width: 30%;
}
.flow-diff-kind {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}
.flow-diff-was {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent);
}
.flow-diff-added .flow-diff-kind {
  color: var(--good);
}
.flow-diff-removed .flow-diff-kind {
  color: var(--bad);
}
/* Свободная раскладка схемы: блоки перетаскиваются, стрелки рисуются поверх; CSS-соединители скрыты. */
.flow-chain {
  position: relative;
  isolation: isolate;
}
.flow-edges {
  position: absolute;
  inset: 0;
  overflow: visible;
  pointer-events: none;
  color: var(--line-strong);
  z-index: 0;
}
.flow-edge {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}
.flow-edge-branch {
  stroke-dasharray: 4 4;
}
.flow-chain.flow-free .flow-step::before,
.flow-chain.flow-free .flow-step::after,
.flow-chain.flow-free .flow-no-branch,
.flow-chain.flow-free .flow-path {
  border-color: transparent;
}
.flow-chain.flow-free .flow-step::before,
.flow-chain.flow-free .flow-step::after {
  display: none;
}
.flow-chain .flow-step > .flow-block,
.flow-no-branch,
.flow-path {
  touch-action: none;
}
.flow-dragging {
  cursor: grabbing;
  opacity: 0.92;
}
.flow-dragging .flow-block {
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}
/* Проверка DNS домена отправки. */
.email-dns {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.email-dns h3 {
  margin: 0;
  font-size: 14px;
}
.email-dns-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.email-dns-row {
  display: grid;
  grid-template-columns: 18px 60px minmax(0, 1fr);
  gap: 6px;
  align-items: baseline;
  font-size: 13px;
}
.email-dns-mark {
  font-weight: 700;
}
.email-dns-row.ok .email-dns-mark {
  color: var(--good);
}
.email-dns-row.bad .email-dns-mark {
  color: #ff9f0a;
}
.email-dns-hint {
  grid-column: 2 / -1;
  color: var(--muted);
  font-size: 12px;
}
/* Формы на сайте. */
.form-url-block {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}
.form-url-block h3 {
  margin: 0;
  font-size: 15px;
}
.form-url {
  width: 100%;
  min-height: 72px;
  box-sizing: border-box;
  font:
    12px ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--surface-2);
  color: var(--text);
  overflow-wrap: anywhere;
}
.form-map-dialog {
  width: min(640px, calc(100vw - 32px));
}
.form-map {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 45vh;
  overflow: auto;
}
.form-map-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 8px;
  align-items: end;
}
.form-attr {
  box-sizing: border-box;
  width: 100%;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
.form-error {
  margin-top: 2px;
  color: #ff9f0a;
  font-size: 12px;
}
/* Доставляемость email. */
.dl-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.dl-tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.dl-tile span,
.dl-tile small {
  color: var(--muted);
  font-size: 12px;
}
.dl-tile b {
  font-size: 22px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.dl-tile.ok b {
  color: var(--good);
}
.dl-tile.warn b {
  color: #ff9f0a;
}
.dl-tile.bad b {
  color: var(--bad);
}
/* Трекер сайта. */
.site-tracker {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.site-tracker h2 {
  margin: 0;
  font-size: 16px;
}
.site-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(760px, 100%);
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.wa-var-row {
  grid-template-columns: minmax(0, 1fr) 150px 110px;
}
.flow-icon-whatsapp {
  color: #30d158;
  background: rgb(48 209 88 / 0.16);
}

/* UTM-метки рассылки: поля сеткой, как в блоке меток Maestra. */
.utm-editor {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.utm-editor > summary {
  cursor: pointer;
  font-weight: 600;
}
.utm-editor[open] > summary {
  margin-bottom: 12px;
}
.utm-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 16px;
}
@media (max-width: 900px) {
  .utm-grid {
    grid-template-columns: 1fr;
  }
}

/* Бренды: плашки над списками, как в Maestra. */
.brand-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 16px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  width: fit-content;
  max-width: 100%;
}
.brand-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.brand-chip[aria-pressed='true'] {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}
.brand-count {
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
}
.brand-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}
.brand-list {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}
.brand-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 2fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.brand-row .muted {
  margin: 0;
}
.brand-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Палитра блоков сценария: перетащить на схему или нажать. */
.flow-palette {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.flow-palette-item {
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: 7px;
  padding: 5px 11px 5px 6px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
  cursor: grab;
}
.flow-palette-item:active {
  cursor: grabbing;
}
.flow-palette-item .flow-icon {
  width: 22px;
  height: 22px;
}
.flow-canvas-wrap .flow-palette + .flow-canvas {
  height: calc(100vh - 252px);
}
.flow-dropping .flow-add .flow-plus {
  opacity: 0.35;
}
.flow-dropping .flow-add.flow-drop-ok .flow-plus {
  opacity: 1;
  outline: 2px dashed var(--accent, #7c5cff);
  outline-offset: 6px;
}
.flow-dropping .flow-add.flow-drop-over .flow-plus {
  transform: scale(1.25);
  background: var(--accent, #7c5cff);
  color: #fff;
}
.flow-palette-soon {
  cursor: default;
  opacity: 0.45;
}
.flow-palette-soon small {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.flow-palette-item
  + .flow-palette-soon:not(.flow-palette-soon + .flow-palette-soon) {
  margin-left: 10px;
}

.brand-logo {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex-shrink: 0;
}
.brand-row,
.brand-name,
.brand-chip {
  min-width: 0;
  overflow-wrap: anywhere;
}

.campaign-fate {
  display: block;
  flex-basis: 100%;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
.revenue-peak-row {
  background: var(--accent-soft);
}
.chart .revenue-peak {
  fill: var(--accent);
  stroke: var(--text);
  stroke-width: 2;
}

.subscription-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: normal;
}
.subscription-cell .toolbar {
  margin: 0;
}
.import-progress {
  white-space: normal;
  overflow-wrap: anywhere;
  max-width: 100%;
}

.import-file-picker {
  margin-bottom: 20px;
}
.import-file-name {
  min-width: 0;
  overflow-wrap: anywhere;
}
