@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);
}
.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;
}
