:root {
  --bg: #101622;
  --surface: #171f2e;
  --surface-2: #202a3a;
  --surface-3: #263246;
  --line: rgba(226, 232, 240, 0.14);
  --text: #f3f7fb;
  --muted: #a9b5c6;
  --accent: #6d9eff;
  --accent-2: #58c895;
  --amber: #f0bf67;
  --red: #f07d7d;
  --radius: 8px;
}

.admin-split {
  align-items: start;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
}

.static-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.panel-body,
.target-form .panel-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.client-section {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.client-section h3 {
  margin: 0;
  font-size: 14px;
}

.client-note {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.client-note span {
  color: var(--muted);
  font-size: 12px;
}

.mono {
  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    "Liberation Mono",
    monospace;
}

.admin-split {
  align-items: start;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
}

.static-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.panel-body,
.target-form .panel-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.client-section {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.client-section h3 {
  margin: 0;
  font-size: 14px;
}

.client-note {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.client-note span {
  color: var(--muted);
  font-size: 12px;
}

.mono {
  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    "Liberation Mono",
    monospace;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  height: 100%;
  color-scheme: dark;
}

body {
  margin: 0;
  height: 100%;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

body.is-locked {
  overflow: hidden;
}

body.is-locked .sidebar,
body.is-locked .app {
  visibility: hidden;
  opacity: 0;
}

body.is-booting .login-screen {
  display: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: 24px;
  background: #0f1520;
}

.login-screen.is-visible {
  display: grid;
}

.login-card {
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.login-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.login-brand,
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #08111f;
  font-weight: 900;
}

.login-head h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1;
}

.login-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.login-error {
  min-height: 18px;
  margin: -2px 0 14px;
  color: #ffb4b4;
  font-size: 13px;
  font-weight: 700;
}

.login-button,
.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0 14px;
  color: inherit;
  text-decoration: none;
}

.login-button,
.primary-button {
  background: #f8fafc;
  color: #070b12;
  font-weight: 800;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--text);
}

.ghost-button {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

.icon-button {
  width: 38px;
  padding: 0;
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--text);
  font-size: 18px;
}

.menu-button {
  display: none;
  flex: 0 0 auto;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: 260px;
  padding: 22px 16px;
  background: #121927;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 25;
  border: 0;
  background: rgba(5, 9, 15, 0.62);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--radius);
  color: var(--muted);
  text-decoration: none;
  font-weight: 750;
}

.nav-link:hover,
.nav-link.is-active {
  background: var(--surface-2);
  color: #fff;
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 800;
}

.app {
  min-height: 100vh;
  margin-left: 260px;
}

.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 22, 34, 0.96);
  position: sticky;
  top: 0;
  z-index: 10;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: 28px;
}

h2 {
  margin: 0;
  font-size: 18px;
}

.topbar-actions,
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.view {
  display: none;
  padding: 22px 24px 40px;
}

.view.is-visible {
  display: block;
}

#view-funnels.is-visible {
  display: block;
  padding: 0;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.metric {
  min-height: 108px;
  padding: 16px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.metric strong {
  display: block;
  margin-top: 12px;
  font-size: 28px;
  line-height: 1;
}

.metric small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.panel-header,
.dialog-header {
  min-height: 58px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-header.compact {
  min-height: 50px;
}

.muted {
  color: var(--muted);
}

.list,
.dialog-list {
  display: grid;
}

.list-item,
.dialog-list-item {
  width: 100%;
  min-height: 62px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 12px 16px;
}

.list-item {
  display: grid;
  gap: 4px;
}

.list-item strong,
.dialog-list-item strong {
  font-size: 14px;
}

.list-item span,
.dialog-list-item em,
.dialog-list-item small {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.field,
.search {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.field input,
.field select,
.field textarea,
.search input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  padding: 9px 11px;
  outline: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search input:focus,
select:focus,
textarea:focus {
  border-color: rgba(109, 158, 255, 0.8);
  box-shadow: 0 0 0 3px rgba(109, 158, 255, 0.14);
}

.native-select-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.select-ui {
  position: relative;
  width: 100%;
  min-width: 190px;
}

.select-button {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 36px 7px 11px;
  background: var(--surface-2);
  color: var(--text);
  text-align: left;
  font-size: 13px;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select-button::after {
  content: "";
  position: absolute;
  right: 13px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-65%) rotate(45deg);
}

.select-ui.is-open .select-button {
  border-color: rgba(109, 158, 255, 0.85);
  box-shadow: 0 0 0 3px rgba(109, 158, 255, 0.14);
}

.select-list {
  position: absolute;
  inset: calc(100% + 6px) 0 auto 0;
  z-index: 35;
  max-height: min(238px, 52vh);
  overflow: auto;
  padding: 6px;
  border: 1px solid rgba(226, 232, 240, 0.18);
  border-radius: var(--radius);
  background: #101724;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.36);
}

.select-option {
  width: 100%;
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  padding: 0 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  text-align: left;
}

.select-option:hover,
.select-option.is-selected {
  background: var(--accent);
  color: #07101d;
}

textarea {
  resize: vertical;
  line-height: 1.4;
}

.toolbar {
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.toolbar .search {
  width: min(460px, 100%);
}

.table-panel {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.025);
}

tr[data-user-row] {
  cursor: pointer;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: var(--radius);
  background: var(--surface-3);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.badge.ok {
  color: #b7f5d5;
  background: rgba(88, 200, 149, 0.14);
}

.badge.warn {
  color: #ffe1a6;
  background: rgba(240, 191, 103, 0.14);
}

.badge.bad {
  color: #ffc6c6;
  background: rgba(240, 125, 125, 0.14);
}

.dialog-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr) 330px;
  gap: 0;
  height: calc(100vh - 120px);
  min-height: 560px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.dialog-list-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  border-right: 1px solid var(--line);
}

.dialog-list-panel .search,
.dialog-list-panel select,
.dialog-list-panel .select-ui {
  margin: 12px 14px 0;
}

.dialog-list {
  min-height: 0;
  margin-top: 12px;
  overflow: auto;
}

.dialog-list-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.dialog-list-item.is-active,
.dialog-list-item:hover {
  background: var(--surface-2);
}

.avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--surface-3);
  color: #fff;
  font-weight: 900;
}

.dialog-title-block {
  min-width: 0;
}

.dialog-title-block strong,
.dialog-title-block em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dialog-thread-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.dialog-header {
  justify-content: flex-start;
}

.dialog-header-copy {
  min-width: 0;
  margin-right: auto;
}

.dialog-header-copy h2,
.dialog-header-copy p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dialog-header-avatar {
  flex: 0 0 auto;
}

.dialog-thread {
  min-height: 0;
  padding: 18px 28px;
  overflow: auto;
  background: #121927;
}

.message {
  width: min(78%, 640px);
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.message.is-out,
.message.is-out_edit {
  margin-left: auto;
  background: rgba(109, 158, 255, 0.13);
  border-color: rgba(109, 158, 255, 0.22);
}

.message p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.42;
}

.message-media {
  display: grid;
  gap: 8px;
}

.message-photo,
.message-video {
  width: min(100%, 420px);
  max-height: 360px;
  border-radius: var(--radius);
  object-fit: cover;
  background: #0b111c;
}

.message-audio {
  width: min(100%, 360px);
}

.message-file {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
}

.media-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 800;
}

.file-id-chip {
  justify-self: start;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 9px;
  background: rgba(109, 158, 255, 0.14);
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
}

.message small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.reply-box {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: #121927;
}

.compose-attach,
.compose-send {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  font-size: 24px;
  font-weight: 800;
  cursor: pointer;
}

.compose-send {
  background: #f8fafc;
  color: #07101d;
}

.compose-attach input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.compose-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  flex: 1 1 auto;
  min-width: 0;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-2);
}

.compose-field textarea {
  min-height: 46px;
  max-height: 132px;
  border: 0;
  padding: 13px 16px 7px;
  background: transparent;
  box-shadow: none;
  resize: none;
}

.compose-field textarea:focus {
  border-color: transparent;
  box-shadow: none;
}

.file-name {
  display: block;
  min-width: 0;
  padding: 0 16px 9px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-card {
  padding: 16px;
  overflow: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  border-left: 1px solid var(--line);
}

.client-card h2 {
  margin-bottom: 12px;
}

.client-grid {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.client-grid > div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.client-grid > div > span:not(.badge) {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.broadcast-layout {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 16px;
}

.broadcast-composer {
  padding-bottom: 16px;
}

.broadcast-composer form {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.broadcast-meta {
  display: block;
  margin-top: 5px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.broadcast-submit-row {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 10px;
}

.broadcast-audience {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid rgba(109, 158, 255, 0.28);
  border-radius: var(--radius);
  background: rgba(109, 158, 255, 0.08);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.broadcast-audience strong {
  color: var(--text);
}

.media-list,
.file-id-box {
  display: grid;
  gap: 8px;
}

.media-list-empty,
.media-list-item,
.file-id-result {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.media-list-empty {
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
}

.media-list-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 7px 8px;
  cursor: grab;
}

.media-list-item:active {
  cursor: grabbing;
}

.media-list-item.is-dragging {
  opacity: 0.5;
}

.media-thumb {
  width: 44px;
  height: 44px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid rgba(109, 158, 255, 0.24);
  border-radius: 10px;
  background: rgba(109, 158, 255, 0.12);
  color: var(--accent);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0;
}

.media-thumb img,
.media-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-list-body {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.media-list-body strong {
  font-size: 12px;
}

.media-list-body em {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-file-id,
.file-id-result code {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-list-item button,
.file-id-result button {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
}

.file-id-box {
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.file-id-result {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 9px;
}

.file-id-result button {
  grid-column: span 1;
}

.segment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
}

.checkbox-line input {
  width: 16px;
  height: 16px;
}

.form-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.action-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.action-row button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
}

.funnel-shell {
  display: grid;
  grid-template-columns: 290px minmax(680px, 1fr) 340px;
  gap: 0;
  height: calc(100vh - 76px);
  min-height: 560px;
  overflow: hidden;
  border-top: 1px solid var(--line);
}

.funnel-left,
.funnel-inspector {
  padding: 16px;
  overflow: auto;
  border: 0;
  border-radius: 0;
  background: var(--surface);
}

.funnel-left .panel-header,
.funnel-inspector .panel-header {
  margin: -16px -16px 14px;
}

.funnel-left {
  border-right: 1px solid var(--line);
}

.funnel-inspector {
  border-left: 1px solid var(--line);
}

.funnel-canvas {
  position: relative;
  min-height: 0;
  overflow: auto;
  border: 0;
  border-radius: 0;
  background-color: #0f1724;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 24px 24px;
}

.funnel-edges {
  position: absolute;
  left: 0;
  top: 0;
  width: 1700px;
  height: 980px;
  pointer-events: none;
  overflow: visible;
}

.funnel-edges path,
.funnel-edges line {
  fill: none;
  stroke: rgba(109, 158, 255, 0.48);
  stroke-width: 3;
}

.funnel-actions {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}

.funnel-actions button {
  flex: 1;
}

.node-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.node-list-item {
  width: 100%;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px;
  background: var(--surface-2);
  color: inherit;
  text-align: left;
}

.node-list-item:hover,
.node-list-item.is-active {
  border-color: rgba(109, 158, 255, 0.55);
  background: #253149;
}

.node-list-item strong,
.node-list-item span {
  display: block;
}

.node-list-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.flow-node {
  position: absolute;
  width: 230px;
  min-height: 118px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: grab;
  user-select: none;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.16);
}

.flow-node.is-selected {
  border-color: rgba(109, 158, 255, 0.75);
  box-shadow: 0 0 0 3px rgba(109, 158, 255, 0.14);
}

.flow-node.kind-message {
  border-color: rgba(88, 200, 149, 0.5);
}

.flow-node.kind-condition {
  border-color: rgba(240, 191, 103, 0.5);
}

.flow-node.kind-calculation {
  border-color: rgba(109, 158, 255, 0.6);
}

.flow-node span,
.flow-node em {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.flow-node strong {
  display: block;
  margin: 8px 0;
}

.inspector-form {
  display: grid;
  gap: 12px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  max-width: 420px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0c111b;
  color: var(--text);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

@media (max-width: 1180px) {
  .metrics,
  .split,
  .broadcast-layout,
  .dialog-layout,
  .funnel-shell {
    grid-template-columns: 1fr;
  }

  .dialog-layout,
  .funnel-shell {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .dialog-list-panel,
  .dialog-thread-panel,
  .client-card {
    max-height: none;
  }

  .dialog-list {
    max-height: 340px;
  }

  .dialog-thread {
    height: 62vh;
    min-height: 360px;
  }

  .funnel-canvas {
    height: 620px;
  }

  .client-card {
    min-height: 220px;
  }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 24px 0 64px rgba(0, 0, 0, 0.38);
  }

  body.sidebar-open {
    overflow: hidden;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .app {
    margin-left: 0;
  }

  .menu-button {
    display: grid;
  }

  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    height: auto;
    min-height: 68px;
    align-items: center;
  }
}

@media (max-width: 760px) {
  .topbar {
    padding: 12px;
    gap: 10px;
  }

  .toolbar,
  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .view {
    padding: 14px 12px 28px;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .segment-grid,
  .broadcast-submit-row {
    grid-template-columns: 1fr;
  }

  .dialog-thread {
    height: 58vh;
    min-height: 320px;
    padding: 12px;
  }

  .message {
    width: min(94%, 640px);
  }

  .funnel-canvas {
    height: 560px;
  }

  .funnel-edges {
    width: 960px;
  }

  .flow-node {
    width: 210px;
  }

  .media-list-item,
  .file-id-result {
    grid-template-columns: 1fr;
  }

  .reply-box {
    gap: 8px;
    padding: 12px;
  }

  .compose-attach,
  .compose-send {
    flex-basis: 44px;
    width: 44px;
    height: 44px;
  }
}

/* MaxVPN-style admin pass: fixed work surfaces, compact chats, sane overflow. */
:root {
  --radius: 18px;
  --accent: var(--blue);
}

html,
body {
  height: 100%;
  overflow: hidden;
}

.sidebar,
.app,
.topbar,
.view,
.panel,
.dialog-layout,
.broadcast-layout,
.funnel-shell,
.dialog-thread-panel,
.dialog-list-panel,
.client-card,
.funnel-left,
.funnel-canvas,
.funnel-inspector {
  min-width: 0;
}

.app {
  height: 100vh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.topbar {
  position: relative;
  top: auto;
  z-index: 15;
  flex: 0 0 auto;
}

.topbar > div:first-of-type {
  min-width: 0;
}

.topbar h1 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.view {
  min-height: 0;
  height: 100%;
  overflow: auto;
}

#view-dialogs.is-visible,
#view-funnels.is-visible {
  overflow: hidden;
}

#view-dialogs.is-visible {
  padding: 8px 20px 20px;
}

.dialog-layout {
  height: 100%;
  min-height: 0;
  grid-template-columns: minmax(300px, 360px) minmax(420px, 1fr) minmax(300px, 360px);
  gap: 0;
  border-radius: var(--radius);
}

.dialog-list-panel .search,
.dialog-list-panel select,
.dialog-list-panel .select-ui {
  width: auto;
}

.dialog-header {
  min-width: 0;
}

.dialog-header-copy {
  min-width: 0;
  overflow: hidden;
}

.dialog-thread {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  padding: 16px;
}

.message {
  width: fit-content;
  max-width: min(72%, 680px);
  margin: 0;
  border-radius: 16px;
  overflow-wrap: anywhere;
}

.message.is-in {
  align-self: flex-start;
}

.message.is-out,
.message.is-out_edit {
  align-self: flex-end;
  margin-left: 0;
}

.message p strong {
  color: #fff;
  font-weight: 900;
}

.message-media {
  max-width: 100%;
}

.message-voice-media {
  width: min(380px, 100%);
  grid-template-columns: minmax(0, 1fr);
  padding: 2px 0;
}

.message-audio {
  width: 100%;
  max-width: 340px;
  height: 36px;
}

.client-card {
  min-width: 0;
}

.client-grid {
  grid-template-columns: 1fr;
}

#view-broadcasts.is-visible {
  overflow: hidden;
  padding: 20px;
}

.broadcast-layout {
  height: 100%;
  min-height: 0;
  grid-template-columns: minmax(360px, 520px) minmax(0, 1fr);
  align-items: stretch;
}

.broadcast-composer,
.table-panel {
  min-height: 0;
}

.broadcast-composer {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.broadcast-composer form {
  min-height: 0;
  overflow: auto;
  scrollbar-gutter: stable;
}

.table-panel {
  display: flex;
  flex-direction: column;
}

.table-panel .panel-header {
  flex: 0 0 auto;
}

.table-panel table {
  min-width: 960px;
}

.button-builder {
  display: grid;
  gap: 10px;
}

.button-preview {
  display: grid;
  gap: 8px;
}

.button-preview-empty {
  min-height: 42px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(226, 232, 240, 0.22);
  border-radius: 12px;
  color: var(--muted);
  font-size: 13px;
}

.button-preview-row {
  display: flex;
  gap: 8px;
  min-width: 0;
  min-height: 42px;
  padding: 4px;
  border-radius: 14px;
}

.button-preview-chip {
  min-width: 0;
  flex: 1 1 0;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(109, 158, 255, 0.38);
  border-radius: 12px;
  background: rgba(109, 158, 255, 0.13);
  color: var(--text);
  cursor: grab;
  font-weight: 850;
}

.button-preview-chip:active {
  cursor: grabbing;
}

.button-preview-chip.is-dragging {
  opacity: 0.45;
}

.button-preview-chip span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.button-preview-chip button {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.button-new-row-drop {
  min-height: 34px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(226, 232, 240, 0.22);
  border-radius: 12px;
  color: var(--muted);
  font-size: 12px;
}

.add-button-dashed {
  min-height: 46px;
  border: 1px dashed rgba(226, 232, 240, 0.32);
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
}

.add-button-dashed span {
  margin-right: 8px;
  font-size: 22px;
  line-height: 0;
  vertical-align: -2px;
}

.button-modal {
  width: min(560px, calc(100vw - 28px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
}

.button-modal::backdrop {
  background: rgba(5, 9, 15, 0.68);
}

.button-modal-card {
  display: grid;
  gap: 0;
}

.button-modal-head {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.button-modal-body {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.button-modal-actions {
  padding: 0 16px 16px;
}

.button-modal-actions .primary-button {
  width: 100%;
}

#view-funnels.is-visible {
  height: 100%;
}

.funnel-shell {
  height: 100%;
  min-height: 0;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr) minmax(300px, 360px);
  border-top: 1px solid var(--line);
}

.funnel-left,
.funnel-inspector {
  min-height: 0;
}

.funnel-canvas {
  min-height: 0;
}

.flow-node {
  max-width: calc(100vw - 36px);
}

@media (max-width: 1180px) {
  html,
  body {
    overflow: auto;
  }

  .app {
    height: auto;
    min-height: 100vh;
    display: block;
  }

  .view,
  #view-dialogs.is-visible,
  #view-broadcasts.is-visible,
  #view-funnels.is-visible {
    height: auto;
    overflow: visible;
  }

  .dialog-layout {
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    grid-template-rows: minmax(620px, 72vh) auto;
  }

  .client-card {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .client-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .broadcast-layout {
    height: auto;
    grid-template-columns: 1fr;
  }

  .broadcast-composer form {
    overflow: visible;
  }

  .funnel-shell {
    height: auto;
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    grid-template-rows: minmax(620px, 72vh) auto;
  }

  .funnel-inspector {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 900px) {
  .app {
    margin-left: 0;
  }

  .sidebar {
    z-index: 40;
  }
}

@media (max-width: 760px) {
  .view,
  #view-dialogs.is-visible,
  #view-broadcasts.is-visible {
    padding: 12px;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .dialog-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(540px, 68vh) auto;
  }

  .dialog-list-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .dialog-list {
    max-height: 300px;
  }

  .dialog-thread {
    height: auto;
    min-height: 0;
  }

  .message {
    max-width: 92%;
  }

  .client-grid,
  .segment-grid,
  .broadcast-submit-row {
    grid-template-columns: 1fr;
  }

  .button-preview-row {
    flex-wrap: wrap;
  }

  .button-preview-chip {
    flex-basis: 100%;
  }

  .funnel-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 560px auto;
  }

  .funnel-left {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

.dialog-layout {
  grid-template-columns: minmax(300px, 392px) minmax(560px, 1fr) minmax(300px, 392px);
}

.reply-box {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 44px;
  grid-template-areas: "attach field voice";
  align-items: end;
  gap: 10px;
  min-height: 74px;
  padding: 10px 20px 14px;
  background: #121927;
}

.reply-box.is-recording {
  grid-template-columns: 52px minmax(0, 1fr) 52px 62px;
  grid-template-areas:
    "record record record record"
    "attach field cancel stop";
}

.recording-bar {
  grid-area: record;
  display: none;
  align-items: center;
  gap: 14px;
  min-height: 42px;
  margin-left: 62px;
  padding: 0 20px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 22px;
  background: rgba(31, 43, 62, 0.92);
  color: var(--text);
}

.reply-box.is-recording .recording-bar {
  display: flex;
}

.recording-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #c85861;
}

.recording-bar strong {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.compose-attach,
.compose-send,
.compose-voice,
.compose-record-cancel,
.compose-record-stop {
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 50%;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

.compose-attach {
  grid-area: attach;
  width: 52px;
  height: 52px;
  border: 1px solid transparent;
  background: rgba(31, 43, 62, 0.96);
  color: #b7c8dc;
}

.compose-field {
  grid-area: field;
  min-height: 52px;
  border-radius: 18px;
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(31, 43, 62, 0.92);
}

.compose-field:focus-within {
  border-color: rgba(109, 158, 255, 0.48);
  box-shadow: 0 0 0 2px rgba(109, 158, 255, 0.08);
}

.compose-field textarea {
  min-height: 50px;
  padding: 14px 16px 7px;
  color: var(--text);
  line-height: 1.32;
}

.compose-field textarea::placeholder {
  color: rgba(226, 232, 240, 0.62);
}

.compose-voice {
  grid-area: voice;
  width: 44px;
  height: 52px;
  border: 0;
  background: transparent;
  color: #b7c8dc;
}

.compose-send {
  grid-area: voice;
  width: 52px;
  height: 52px;
  border: 1px solid transparent;
  background: #6d9eff;
  color: #07101d;
}

.compose-record-cancel {
  grid-area: cancel;
  display: none;
  width: 52px;
  height: 52px;
  border: 1px solid transparent;
  background: rgba(31, 43, 62, 0.96);
  color: #c7d4e3;
}

.compose-record-stop {
  grid-area: stop;
  display: none;
  width: 58px;
  height: 58px;
  border: 0;
  background: #bd5159;
  color: #d8e3ee;
}

.compose-record-stop span {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: currentColor;
}

.compose-attach:hover,
.compose-voice:hover,
.compose-send:hover,
.compose-record-cancel:hover,
.compose-record-stop:hover {
  border-color: rgba(109, 158, 255, 0.35);
  color: var(--text);
  transform: translateY(-1px);
}

.compose-attach svg,
.compose-send svg,
.compose-voice svg,
.compose-record-cancel svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.compose-voice svg {
  width: 26px;
  height: 26px;
}

.compose-send svg {
  width: 23px;
  height: 23px;
}

.compose-send svg path:first-child,
.voice-play svg path {
  fill: currentColor;
  stroke: none;
}

.reply-box:not(.has-draft) .compose-send,
.reply-box:not(.is-recording) .compose-record-cancel,
.reply-box:not(.is-recording) .compose-record-stop {
  display: none;
}

.reply-box.has-draft .compose-voice,
.reply-box.is-recording .compose-voice,
.reply-box.is-recording .compose-send {
  display: none;
}

.reply-box.is-recording .compose-record-cancel,
.reply-box.is-recording .compose-record-stop {
  display: grid;
}

.file-name:not(:empty) {
  padding: 0 16px 8px;
}

.file-name:not(:empty)::before {
  content: "Файл: ";
  color: var(--accent);
}

.message-voice-media {
  width: min(430px, 100%);
}

.voice-player {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: min(360px, 100%);
  padding: 10px 12px;
  border-radius: 20px;
  background: rgba(31, 43, 62, 0.86);
}

.voice-play {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: #c9d8e8;
  color: #0e1826;
}

.voice-play svg {
  width: 22px;
  height: 22px;
}

.voice-body {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.voice-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.voice-bars {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 32px;
  overflow: hidden;
}

.voice-bars span {
  flex: 0 0 3px;
  height: var(--bar);
  border-radius: 999px;
  background: #9fb3c8;
  opacity: 0.86;
}

.voice-player.is-playing .voice-bars span {
  background: #6d9eff;
}

.voice-duration {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .dialog-layout {
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .dialog-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(540px, 68vh) auto;
  }

  .reply-box,
  .reply-box.is-recording {
    grid-template-columns: 46px minmax(0, 1fr) 46px;
    grid-template-areas:
      "record record record"
      "attach field voice";
    gap: 8px;
    min-height: 66px;
    padding: 9px;
  }

  .reply-box.is-recording {
    grid-template-columns: 46px minmax(0, 1fr) 46px 50px;
    grid-template-areas:
      "record record record record"
      "attach field cancel stop";
  }

  .recording-bar {
    min-height: 38px;
    margin-left: 54px;
    padding: 0 14px;
  }

  .recording-bar strong {
    font-size: 16px;
  }

  .compose-attach,
  .compose-send,
  .compose-record-cancel {
    width: 46px;
    height: 46px;
  }

  .compose-voice {
    width: 42px;
    height: 46px;
  }

  .compose-record-stop {
    width: 50px;
    height: 50px;
  }

  .compose-field {
    min-height: 46px;
    border-radius: 16px;
  }

  .compose-field textarea {
    min-height: 44px;
    padding: 12px 13px 6px;
  }

  .voice-player {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 8px;
    min-width: 0;
  }

  .voice-play {
    width: 40px;
    height: 40px;
  }
}

/* Dialog alignment pass based on the live MAX VPN admin, adjusted for this bot:
   Telegram bot/admin outgoing messages are on the left; user replies are on the right. */
#view-dialogs.is-visible {
  height: 100%;
  min-height: 0;
  padding: 20px 28px 28px;
}

.dialog-layout {
  height: 100%;
  min-height: 0;
  grid-template-columns: minmax(300px, 392px) minmax(560px, 1fr) minmax(300px, 392px);
  border-radius: 18px;
}

.dialog-list-panel .panel-header.compact {
  min-height: 64px;
  padding: 14px 16px 12px;
}

.dialog-list-panel .search,
.dialog-list-panel select,
.dialog-list-panel .select-ui {
  margin: 12px 16px 0;
}

.dialog-list-item {
  min-height: 74px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

.dialog-list-item .avatar,
.dialog-header-avatar {
  border-radius: 999px;
}

.dialog-thread-panel {
  background: #121927;
}

.dialog-header {
  min-height: 82px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.dialog-thread {
  padding: 16px;
  gap: 8px;
  background: #121927;
}

.message {
  max-width: min(72%, 680px);
  padding: 9px 13px;
  border-radius: 14px;
  line-height: 1.45;
  word-break: break-word;
}

.message.is-bot {
  align-self: flex-start;
  margin-right: auto;
  background: var(--surface-2);
  border-color: var(--line);
  border-bottom-left-radius: 4px;
}

.message.is-user {
  align-self: flex-end;
  margin-left: auto;
  background: #223252;
  border-color: rgba(109, 158, 255, 0.3);
  border-bottom-right-radius: 4px;
}

.message.is-bot small {
  text-align: left;
}

.message.is-user small {
  text-align: right;
}

.message p {
  font-size: 14px;
  line-height: 1.45;
}

.client-card {
  background: var(--surface);
}

@media (max-width: 1180px) {
  #view-dialogs.is-visible {
    height: auto;
    padding: 16px;
  }

  .dialog-layout {
    grid-template-columns: minmax(300px, 392px) minmax(0, 1fr);
    grid-template-rows: minmax(620px, 72vh) auto;
  }
}

@media (max-width: 760px) {
  #view-dialogs.is-visible {
    padding: 12px;
    overflow-x: hidden;
  }

  .dialog-layout {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .dialog-header {
    min-height: 70px;
  }

  .dialog-header .secondary-button {
    display: none;
  }

  .dialog-thread-panel,
  .dialog-list-panel,
  .client-card {
    width: 100%;
    max-width: 100%;
  }

  .dialog-thread-panel {
    flex: 0 0 68vh;
    min-height: 540px;
  }

  .dialog-thread {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .message {
    max-width: min(92%, calc(100vw - 48px));
  }
}

/* Final responsive hardening. This file intentionally ends with the
   breakpoint truth so older desktop passes above cannot leak into mobile. */
:root {
  --sidebar-width: 260px;
}

html,
body {
  max-width: 100%;
}

.app,
.view,
.panel,
.dialog-layout,
.broadcast-layout,
.metrics,
.split,
.toolbar,
.topbar,
.dialog-thread,
.reply-box,
.broadcast-composer,
.table-panel {
  max-width: 100%;
}

.app {
  width: calc(100vw - var(--sidebar-width));
}

.view {
  width: 100%;
}

.field,
.search,
.select-ui,
.select-button,
input,
textarea,
select {
  min-width: 0;
}

.select-ui {
  min-width: 0;
}

.select-list {
  max-width: min(100%, calc(100vw - 24px));
}

.panel-header {
  min-width: 0;
}

.panel-header .action-row {
  justify-content: flex-end;
}

.action-row {
  flex-wrap: wrap;
}

.action-row button {
  white-space: nowrap;
}

.table-panel {
  min-width: 0;
  overflow: auto;
  overscroll-behavior-x: contain;
  scrollbar-gutter: stable;
}

.table-panel table {
  width: 100%;
  min-width: 820px;
}

#view-broadcasts .table-panel table {
  min-width: 1180px;
  table-layout: fixed;
}

#view-broadcasts .table-panel th,
#view-broadcasts .table-panel td {
  padding: 10px 9px;
}

#view-broadcasts .table-panel th:nth-child(1),
#view-broadcasts .table-panel td:nth-child(1) {
  width: 38px;
}

#view-broadcasts .table-panel th:nth-child(2),
#view-broadcasts .table-panel td:nth-child(2) {
  width: 56px;
}

#view-broadcasts .table-panel th:nth-child(3),
#view-broadcasts .table-panel td:nth-child(3) {
  width: 220px;
}

#view-broadcasts .table-panel th:nth-child(4),
#view-broadcasts .table-panel td:nth-child(4) {
  width: 108px;
}

#view-broadcasts .table-panel th:nth-child(5),
#view-broadcasts .table-panel td:nth-child(5) {
  width: 104px;
}

#view-broadcasts .table-panel th:nth-child(6),
#view-broadcasts .table-panel td:nth-child(6) {
  width: 136px;
}

#view-broadcasts .table-panel th:nth-child(7),
#view-broadcasts .table-panel td:nth-child(7) {
  width: 150px;
}

#view-broadcasts .table-panel th:nth-child(8),
#view-broadcasts .table-panel td:nth-child(8) {
  width: 190px;
}

#view-broadcasts .table-panel th:nth-child(9),
#view-broadcasts .table-panel td:nth-child(9) {
  width: 138px;
}

.broadcast-meta,
td .muted {
  overflow-wrap: anywhere;
}

.broadcast-delivery,
.broadcast-errors,
.broadcast-timing {
  display: grid;
  gap: 4px;
  min-width: 0;
  line-height: 1.25;
}

.broadcast-delivery strong,
.broadcast-timing strong {
  font-size: 13px;
}

#view-broadcasts .broadcast-delivery .muted,
#view-broadcasts .broadcast-timing .muted {
  font-weight: 500;
}

.broadcast-errors {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.broadcast-layout {
  width: 100%;
}

.broadcast-composer,
.broadcast-layout > .table-panel {
  min-width: 0;
}

.file-id-result {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.button-preview-row {
  min-width: 0;
}

.button-preview-chip {
  max-width: 100%;
}

.button-modal {
  max-height: calc(100dvh - 24px);
  overflow: auto;
}

#view-dialogs.is-visible {
  min-width: 0;
}

.dialog-layout {
  width: 100%;
  min-width: 0;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr) minmax(280px, 340px);
}

.dialog-list-panel,
.dialog-thread-panel,
.client-card {
  min-width: 0;
}

.dialog-header {
  min-width: 0;
}

.dialog-header-copy,
.dialog-title-block {
  min-width: 0;
}

.dialog-thread-panel {
  min-width: 0;
}

.message {
  min-width: 0;
}

.message-voice-media,
.voice-player {
  max-width: 100%;
}

@media (max-width: 1260px) {
  .dialog-layout {
    grid-template-columns: minmax(300px, 392px) minmax(0, 1fr);
    grid-template-rows: minmax(620px, 72vh) auto;
  }

  .client-card {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 1180px) {
  .broadcast-layout {
    grid-template-columns: 1fr;
  }

  #view-broadcasts.is-visible {
    overflow: visible;
  }

  .broadcast-composer form {
    overflow: visible;
  }
}

@media (max-width: 900px) {
  html,
  body {
    overflow: auto;
  }

  .app {
    width: 100%;
    margin-left: 0;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .menu-button {
    display: grid;
  }

  .topbar {
    position: sticky;
    top: 0;
    min-height: 66px;
    padding: 12px 14px;
  }

  .view,
  #view-dialogs.is-visible,
  #view-broadcasts.is-visible {
    height: auto;
    padding: 14px;
    overflow: visible;
  }

  .metrics,
  .split,
  .broadcast-layout {
    grid-template-columns: 1fr;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .toolbar .search,
  .toolbar .select-ui {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .topbar {
    gap: 10px;
  }

  .topbar h1 {
    font-size: 22px;
  }

  .topbar-actions {
    flex-direction: row;
  }

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel-header .action-row {
    justify-content: flex-start;
    width: 100%;
  }

  .dialog-layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
    grid-template-columns: none;
    grid-template-rows: none;
    overflow: visible;
  }

  .dialog-list-panel,
  .dialog-thread-panel,
  .client-card {
    width: 100%;
    max-width: 100%;
  }

  .dialog-list {
    max-height: 260px;
  }

  .dialog-thread-panel {
    flex: none;
    min-height: min(620px, 78dvh);
  }

  .dialog-thread {
    min-height: 0;
    height: auto;
    overflow-x: hidden;
  }

  .reply-box,
  .reply-box.is-recording {
    width: 100%;
    grid-template-columns: 46px minmax(0, 1fr) 46px;
  }

  .message {
    max-width: min(94%, calc(100vw - 46px));
  }

  .client-grid,
  .segment-grid,
  .broadcast-submit-row {
    grid-template-columns: 1fr;
  }

  .media-list-item,
  .file-id-result {
    grid-template-columns: 1fr;
  }

  .file-id-result button {
    justify-self: start;
  }

  .button-preview-row {
    flex-wrap: wrap;
  }

  .button-preview-chip {
    flex: 1 1 calc(50% - 8px);
  }

  .button-new-row-drop {
    min-height: 40px;
  }
}

@media (max-width: 480px) {
  .view,
  #view-dialogs.is-visible,
  #view-broadcasts.is-visible {
    padding: 12px;
  }

  .topbar {
    padding: 10px 12px;
  }

  .eyebrow {
    font-size: 10px;
  }

  .dialog-header {
    gap: 10px;
    min-height: 66px;
    padding: 10px 12px;
  }

  .dialog-thread {
    padding: 12px;
  }

  .reply-box,
  .reply-box.is-recording {
    gap: 7px;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    padding: 8px;
  }

  .reply-box.is-recording {
    grid-template-columns: 44px minmax(0, 1fr) 44px 48px;
  }

  .recording-bar {
    margin-left: 0;
  }

  .compose-attach,
  .compose-send,
  .compose-record-cancel {
    width: 44px;
    height: 44px;
  }

  .compose-voice {
    width: 40px;
    height: 44px;
  }

  .compose-record-stop {
    width: 48px;
    height: 48px;
  }

  .button-preview-chip {
    flex-basis: 100%;
  }

  .toast {
    right: 12px;
    bottom: 12px;
    left: 12px;
    max-width: none;
  }
}

/* MAX VPN dialog port: final override for the chat shell and composer. */
#view-dialogs.is-visible {
  height: calc(100dvh - 112px);
  min-height: 520px;
  padding: 20px 28px 28px;
  overflow: hidden;
}

.dialog-layout {
  display: grid;
  grid-template-columns: minmax(300px, 392px) minmax(560px, 1fr) minmax(300px, 392px);
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.dialog-list-panel,
.dialog-thread-panel,
.client-card {
  min-width: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
}

.dialog-list-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.dialog-list-panel .panel-header.compact {
  flex: 0 0 auto;
  min-height: 64px;
  margin: 0;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.dialog-list-panel .search,
.dialog-list-panel select,
.dialog-list-panel .select-ui {
  flex: 0 0 auto;
  margin: 12px 16px 0;
}

.dialog-list {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 12px;
  overflow-y: auto;
  overflow-x: hidden;
}

.dialog-list-item {
  min-height: 74px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  cursor: pointer;
}

.dialog-list-item.is-active {
  background: rgba(109, 158, 255, 0.16);
}

.dialog-thread-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  background: #121927;
}

.dialog-header {
  min-height: 72px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.dialog-thread {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  padding: 16px;
  overflow-y: auto;
  overflow-x: hidden;
  background: #121927;
}

.message {
  display: flex;
  flex-direction: column;
  width: fit-content;
  max-width: min(72%, 680px);
  min-width: 0;
  margin: 0;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text);
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.message.is-bot {
  align-self: flex-start;
  margin-right: auto;
  background: #1a2d40;
  border-bottom-left-radius: 4px;
}

.message.is-user {
  align-self: flex-end;
  margin-left: auto;
  background: #223252;
  border-color: rgba(109, 158, 255, 0.3);
  border-bottom-right-radius: 4px;
}

.message > p {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
}

.message small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.message.is-bot small {
  text-align: left;
}

.message.is-user small {
  text-align: right;
}

.message-media,
.message-file,
.message-voice-media {
  max-width: 100%;
}

.message-media + p,
.message-voice-media + p {
  margin-top: 8px;
}

.voice-player {
  max-width: 100%;
}

.reply-box {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 0 0 auto;
  gap: 0;
  min-height: 0;
  padding: 0;
  border-top: 1px solid var(--line);
  background: #121927;
}

.reply-compose-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-width: 0;
  padding: 10px 14px;
}

.reply-queue {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  padding: 10px 14px 6px;
  border-bottom: 1px solid var(--line);
}

.reply-queue[hidden] {
  display: none;
}

.reply-qitem {
  position: relative;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 14px;
  background: rgba(31, 43, 62, 0.92);
  color: var(--text);
}

.reply-qitem-media {
  width: 92px;
  height: 68px;
}

.reply-qitem-media img,
.reply-qitem-media span {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  object-fit: cover;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.reply-qitem-file {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(360px, 100%);
  min-height: 42px;
  padding: 0 42px 0 12px;
}

.reply-qitem-file strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-qitem-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(8, 13, 23, 0.76);
  color: var(--text);
  cursor: pointer;
}

.recording-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  margin: 10px 14px 0;
  padding: 0 18px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 22px;
  background: rgba(31, 43, 62, 0.92);
  color: var(--text);
}

.recording-bar[hidden],
.reply-box:not(.is-recording) .recording-bar {
  display: none;
}

.compose-attach,
.compose-send,
.compose-voice,
.compose-record-cancel,
.compose-record-stop {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 50%;
  cursor: pointer;
}

.compose-attach,
.compose-record-cancel {
  border: 1px solid transparent;
  background: rgba(31, 43, 62, 0.96);
  color: #b7c8dc;
}

.compose-field {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 52px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 18px;
  background: rgba(31, 43, 62, 0.92);
}

.compose-field textarea {
  min-height: 50px;
  max-height: 140px;
  padding: 14px 16px 7px;
  color: var(--text);
  line-height: 1.32;
}

.compose-field textarea::placeholder {
  color: rgba(226, 232, 240, 0.62);
}

.file-name {
  display: none;
}

.compose-voice {
  width: 44px;
  border: 0;
  background: transparent;
  color: #b7c8dc;
}

.compose-send {
  border: 1px solid transparent;
  background: #6d9eff;
  color: #07101d;
}

.compose-record-cancel {
  display: none;
}

.compose-record-stop {
  display: none;
  width: 58px;
  height: 58px;
  border: 0;
  background: #bd5159;
  color: #d8e3ee;
}

.reply-box:not(.has-draft) .compose-send,
.reply-box:not(.is-recording) .compose-record-cancel,
.reply-box:not(.is-recording) .compose-record-stop {
  display: none;
}

.reply-box.has-draft .compose-voice,
.reply-box.is-recording .compose-voice,
.reply-box.is-recording .compose-send {
  display: none;
}

.reply-box.is-recording .compose-record-cancel,
.reply-box.is-recording .compose-record-stop {
  display: grid;
}

.client-card {
  overflow-y: auto;
  overflow-x: hidden;
  border-left: 1px solid var(--line);
  background: var(--surface);
}

@media (max-width: 1360px) {
  .dialog-layout {
    grid-template-columns: minmax(286px, 360px) minmax(0, 1fr) minmax(286px, 340px);
  }
}

@media (max-width: 1180px) {
  #view-dialogs.is-visible {
    height: auto;
    min-height: 0;
    padding: 16px;
    overflow: visible;
  }

  .dialog-layout {
    grid-template-columns: minmax(300px, 392px) minmax(0, 1fr);
    grid-template-rows: minmax(620px, 72dvh) auto;
    overflow: hidden;
  }

  .client-card {
    grid-column: 1 / -1;
    max-height: 420px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 760px) {
  #view-dialogs.is-visible {
    padding: 12px;
  }

  .dialog-layout {
    display: flex;
    flex-direction: column;
    height: auto;
    overflow: hidden;
  }

  .dialog-list-panel {
    flex: 0 0 auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .dialog-list {
    max-height: 300px;
  }

  .dialog-thread-panel {
    flex: 0 0 72dvh;
    min-height: 520px;
  }

  .dialog-header {
    min-height: 66px;
    padding: 10px 12px;
  }

  .dialog-thread {
    padding: 12px;
  }

  .message {
    max-width: min(92%, calc(100vw - 54px));
  }

  .reply-compose-row {
    gap: 7px;
    padding: 8px;
  }

  .reply-queue {
    padding: 8px 8px 4px;
  }

  .recording-bar {
    margin: 8px 8px 0;
  }

  .compose-attach,
  .compose-send,
  .compose-record-cancel {
    width: 44px;
    height: 44px;
  }

  .compose-voice {
    width: 40px;
    height: 44px;
  }

  .compose-record-stop {
    width: 48px;
    height: 48px;
  }

  .compose-field {
    min-height: 44px;
    border-radius: 16px;
  }

  .compose-field textarea {
    min-height: 42px;
    padding: 11px 12px 6px;
  }
}

.channels-stack {
  display: grid;
  gap: 16px;
}

.channel-provider-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  padding: 16px;
}

.channel-provider-card {
  align-items: center;
  border: 0;
  border-radius: var(--radius);
  color: #fff;
  display: grid;
  font-weight: 850;
  gap: 16px;
  grid-template-columns: 56px minmax(0, 1fr);
  min-height: 92px;
  padding: 18px 22px;
  text-align: left;
}

.channel-provider-card strong {
  font-size: 18px;
}

.channel-provider-telegram {
  background: linear-gradient(135deg, #2aa7df, #1f85c7);
}

.channel-provider-vk {
  background: linear-gradient(135deg, #4b83c4, #3568a9);
}

.channel-provider-icon,
.connected-channel-icon {
  align-items: center;
  background: rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  display: inline-flex;
  font-weight: 900;
  justify-content: center;
  text-transform: uppercase;
}

.channel-provider-icon {
  height: 44px;
  width: 44px;
}

.connected-channel-list {
  display: grid;
}

.connected-channel-card {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 188px;
  transition: background 0.2s ease;
}

.connected-channel-card + .connected-channel-card {
  border-top: 1px solid var(--line);
}

.connected-channel-card.is-highlighted {
  background: rgba(109, 158, 255, 0.1);
}

.connected-channel-side {
  align-content: start;
  border-right: 1px solid var(--line);
  display: grid;
  gap: 7px;
  grid-template-columns: 72px minmax(0, 1fr);
  padding: 20px;
}

.connected-channel-side .muted,
.connected-channel-side strong,
.connected-channel-side small {
  grid-column: 2;
}

.connected-channel-side strong {
  font-size: 18px;
  line-height: 1.2;
}

.connected-channel-side small {
  color: var(--muted);
  font-weight: 750;
}

.connected-channel-icon {
  color: #fff;
  font-size: 19px;
  grid-row: span 3;
  height: 56px;
  width: 56px;
}

.connected-channel-icon.telegram {
  background: #2aa7df;
}

.connected-channel-icon.vk {
  background: #4b83c4;
}

.connected-channel-main {
  display: grid;
  gap: 14px;
  padding: 20px 22px;
}

.channel-summary-line,
.channel-owner,
.channel-action-grid,
.channel-row-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.channel-summary-line {
  justify-content: space-between;
}

.channel-summary-line span,
.channel-owner {
  font-size: 17px;
  font-weight: 800;
}

.channel-summary-line strong,
.channel-owner strong {
  color: var(--accent);
}

.channel-token-form {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 12px;
  padding: 12px;
}

.channel-token-form[hidden] {
  display: none;
}

.channel-switch-list {
  display: grid;
  gap: 9px;
}

.channel-event-row {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-height: 34px;
}

.channel-event-row > span:first-child {
  display: grid;
  gap: 2px;
}

.channel-event-row small {
  color: var(--muted);
  font-size: 12px;
}

.channel-row-actions {
  flex: 0 0 auto;
}

.channel-row-actions button {
  min-height: 30px;
}

.channel-action-grid {
  flex-wrap: wrap;
}

.vk-connect-button {
  align-items: center;
  display: inline-flex;
  justify-content: center;
  text-decoration: none;
}

.channel-process {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.channel-process summary {
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.channel-process-body {
  display: grid;
  gap: 12px;
  padding-top: 12px;
}

.channel-empty {
  color: var(--muted);
  padding: 10px 0;
}

.vk-endpoints {
  display: grid;
  gap: 14px;
}

.vk-endpoint-row {
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 10px;
  grid-template-columns: 130px minmax(0, 1fr) auto;
  padding: 12px;
}

.vk-endpoint-row span {
  color: var(--muted);
  font-size: 13px;
}

.vk-endpoint-row code {
  color: var(--text);
  font-size: 13px;
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  .channel-provider-grid,
  .connected-channel-card {
    grid-template-columns: 1fr;
  }

  .connected-channel-side {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .channel-summary-line,
  .channel-event-row {
    align-items: stretch;
    display: grid;
  }

  .vk-endpoint-row {
    align-items: stretch;
    grid-template-columns: 1fr;
  }
}

.admin-split {
  align-items: start;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
}

.static-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.panel-body,
.target-form .panel-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.client-section {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.client-section h3 {
  margin: 0;
  font-size: 14px;
}

.client-note {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.client-note span {
  color: var(--muted);
  font-size: 12px;
}

.mono {
  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    "Liberation Mono",
    monospace;
}

/* Broadcast mobile shell: composer stays primary, campaigns open as a right drawer. */
.broadcast-list-toggle,
.broadcast-list-close {
  display: none;
}

.broadcast-list-backdrop {
  display: none;
}

.broadcast-list-toggle svg,
.broadcast-list-close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

@media (max-width: 900px) {
  body.broadcast-list-open {
    overflow: hidden;
  }

  #view-broadcasts.is-visible {
    height: calc(100dvh - 66px);
    min-height: 0;
    padding: 0;
    overflow: hidden;
  }

  .broadcast-layout {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    border-radius: 0;
  }

  .broadcast-composer {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100%;
    min-height: 0;
    padding-bottom: 0;
    overflow: hidden;
    border-radius: 0;
  }

  .broadcast-composer > .panel-header {
    align-items: center;
    flex-direction: row;
    justify-content: space-between;
    min-height: 64px;
    padding: 14px 16px;
  }

  .broadcast-composer form {
    min-height: 0;
    padding: 14px 16px 24px;
    overflow: auto;
  }

  .broadcast-list-toggle {
    display: grid;
    flex: 0 0 auto;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    place-items: center;
    border-radius: 50%;
  }

  .broadcast-list-backdrop {
    position: fixed;
    inset: 0;
    z-index: 85;
    display: block;
    border: 0;
    background: rgba(5, 9, 15, 0.58);
  }

  .broadcast-list-backdrop[hidden] {
    display: none !important;
  }

  .broadcast-list-panel {
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 90;
    width: min(520px, calc(100vw - 44px));
    max-width: calc(100vw - 44px);
    height: 100dvh;
    max-height: none;
    overflow: auto;
    overscroll-behavior: contain;
    transform: translateX(100%);
    border-top: 0;
    border-right: 0;
    border-bottom: 0;
    border-left: 1px solid var(--line);
    border-radius: 0;
    background: var(--surface);
    box-shadow: -28px 0 70px rgba(0, 0, 0, 0.42);
    transition: transform 0.2s ease;
  }

  body.broadcast-list-open .broadcast-list-panel {
    transform: translateX(0);
  }

  .broadcast-list-panel > .panel-header {
    position: sticky;
    top: 0;
    z-index: 1;
    align-items: center;
    flex-direction: row;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
  }

  .broadcast-list-panel > .panel-header .action-row {
    justify-content: flex-end;
    width: auto;
    margin-left: auto;
  }

  .broadcast-list-close {
    display: grid;
    flex: 0 0 auto;
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    place-items: center;
    border-radius: 50%;
  }
}

@media (max-width: 760px) {
  #view-broadcasts.is-visible {
    height: calc(100dvh - 72px);
  }

  .broadcast-list-panel {
    width: min(430px, calc(100vw - 44px));
  }

  .broadcast-list-panel > .panel-header {
    min-height: 62px;
  }

  .broadcast-list-panel > .panel-header .action-row {
    gap: 8px;
  }

  .broadcast-list-panel #delete-selected-broadcasts,
  .broadcast-list-panel #reload-broadcasts {
    min-height: 40px;
    padding: 0 12px;
    font-size: 13px;
  }
}

/* Broadcast editor cleanup. */
.broadcast-composer .select-ui {
  z-index: 2;
}

.broadcast-composer .select-list {
  position: static;
  inset: auto;
  max-height: 280px;
  margin-top: 8px;
  box-shadow: none;
}

.select-list .select-option:hover,
.select-list .select-option:focus-visible,
.select-list .select-option.is-selected {
  background: #6d9eff;
  color: #07101d;
}

.select-list .select-option.is-selected {
  font-weight: 900;
}

.broadcast-buttons-field {
  gap: 8px;
}

.broadcast-media-editor {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding-top: 2px;
}

.broadcast-media-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.broadcast-media-head h3 {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.media-position-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-width: 188px;
  overflow: hidden;
  padding: 4px;
  border: 1px solid rgba(109, 158, 255, 0.3);
  border-radius: 999px;
  background: rgba(16, 24, 37, 0.92);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.media-position-toggle label {
  display: grid;
  cursor: pointer;
}

.media-position-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.media-position-toggle span {
  display: grid;
  min-height: 34px;
  place-items: center;
  border-radius: 14px;
  color: #b8c2d4;
  font-size: 12px;
  font-weight: 900;
  transition:
    background 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease;
}

.media-position-toggle input:checked + span {
  background: #6d9eff;
  box-shadow: 0 8px 20px rgba(109, 158, 255, 0.24);
  color: #07101d;
}

.media-position-toggle input:focus-visible + span {
  box-shadow: 0 0 0 3px rgba(109, 158, 255, 0.2);
}

.media-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: end;
}

.media-file-id-field {
  gap: 0;
}

.media-upload-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 10px;
  align-items: center;
  min-height: 52px;
  padding: 10px 12px;
  border: 1px dashed rgba(148, 163, 184, 0.3);
  border-radius: 16px;
  background: rgba(31, 43, 62, 0.45);
  cursor: pointer;
}

.media-upload-line input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.media-upload-line span {
  color: var(--text);
  font-weight: 900;
}

.media-upload-line em {
  grid-column: 2;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.media-upload-line::before {
  content: "+";
  display: grid;
  width: 34px;
  height: 34px;
  grid-row: span 2;
  place-items: center;
  border-radius: 50%;
  background: rgba(109, 158, 255, 0.16);
  color: var(--accent);
  font-size: 22px;
  font-weight: 800;
}

.broadcast-media-editor.is-uploading .media-upload-line {
  cursor: progress;
  opacity: 0.76;
}

.media-upload-progress {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(109, 158, 255, 0.32);
  border-radius: 16px;
  background: rgba(109, 158, 255, 0.11);
}

.media-upload-progress[hidden] {
  display: none;
}

.media-upload-progress > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.media-upload-progress strong,
.media-upload-progress span {
  font-size: 13px;
  font-weight: 900;
}

.media-upload-progress span {
  color: #9fc0ff;
}

.media-upload-progress progress {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: rgba(8, 13, 23, 0.82);
}

.media-upload-progress progress::-webkit-progress-bar {
  background: rgba(8, 13, 23, 0.82);
}

.media-upload-progress progress::-webkit-progress-value {
  border-radius: 999px;
  background: #6d9eff;
}

.media-upload-progress progress::-moz-progress-bar {
  border-radius: 999px;
  background: #6d9eff;
}

.media-upload-progress em {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.media-list {
  gap: 8px;
}

.media-insert-line {
  height: 3px;
  border-radius: 999px;
  background: #6d9eff;
  box-shadow:
    0 0 0 3px rgba(109, 158, 255, 0.12),
    0 0 18px rgba(109, 158, 255, 0.4);
}

.media-list-item {
  grid-template-columns: 44px minmax(0, 1fr) 34px;
  min-height: 60px;
  border-radius: 14px;
}

.media-file-id {
  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    "Liberation Mono",
    monospace;
}

.media-list-empty {
  border-style: dashed;
  background: transparent;
}

.file-id-result {
  display: none;
}

.avatar img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.client-grid > div {
  display: grid;
  align-content: start;
  gap: 4px;
}

.client-grid .badge {
  width: max-content;
  justify-self: start;
  margin: 0;
}

.client-tags {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-2);
}

.client-tags-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  max-width: 100%;
  padding: 0 10px;
  border: 1px solid rgba(109, 158, 255, 0.32);
  border-radius: 10px;
  background: rgba(109, 158, 255, 0.15);
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}

.tag-chip button {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.tag-empty {
  color: var(--muted);
  font-size: 12px;
}

.tag-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
}

.tag-picker {
  position: relative;
  min-width: 0;
}

.tag-form input,
.tag-form button {
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(16, 24, 37, 0.72);
  color: var(--text);
}

.tag-form input {
  width: 100%;
  padding: 0 12px;
}

.tag-form button {
  background: rgba(109, 158, 255, 0.18);
  color: var(--accent);
  font-size: 20px;
  font-weight: 900;
}

.tag-suggestion-list {
  position: absolute;
  inset: calc(100% + 7px) 0 auto 0;
  z-index: 45;
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: min(250px, 48vh);
  overflow: auto;
  padding: 10px;
  border: 1px solid rgba(226, 232, 240, 0.18);
  border-radius: 18px;
  background: #101724;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.36);
}

.tag-suggestion-list button {
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 12px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-size: 13px;
  font-weight: 900;
}

.tag-suggestion-list button:hover,
.tag-suggestion-list button:focus-visible {
  background: #6d9eff;
  color: #07101d;
}

.tag-suggestion-empty {
  min-height: 36px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

#view-broadcasts .table-panel tr[data-broadcast-row] {
  cursor: pointer;
}

#view-broadcasts .table-panel tr[data-broadcast-row]:hover td {
  background: rgba(109, 158, 255, 0.05);
}

.broadcast-preview-modal {
  width: min(760px, calc(100vw - 28px));
}

.broadcast-preview-body {
  gap: 14px;
  max-height: min(70dvh, 720px);
  overflow: auto;
}

.broadcast-preview-media {
  display: grid;
  gap: 10px;
}

.broadcast-preview-media figure {
  display: grid;
  gap: 7px;
  margin: 0;
}

.broadcast-preview-media img,
.broadcast-preview-media video {
  width: 100%;
  max-height: 420px;
  border-radius: 16px;
  object-fit: contain;
  background: #0c1420;
}

.broadcast-preview-media audio {
  width: 100%;
}

.broadcast-preview-media figcaption {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.broadcast-preview-file {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  font-weight: 900;
}

.broadcast-preview-text {
  white-space: pre-wrap;
  padding: 12px 14px;
  border: 1px solid rgba(109, 158, 255, 0.22);
  border-radius: 16px;
  background: #1a2d40;
  line-height: 1.45;
}

.broadcast-preview-buttons {
  display: grid;
  gap: 8px;
}

.broadcast-preview-buttons > div {
  display: flex;
  gap: 8px;
}

.broadcast-preview-buttons a {
  flex: 1 1 0;
  min-width: 0;
  min-height: 38px;
  display: grid;
  place-items: center;
  padding: 0 12px;
  border: 1px solid rgba(109, 158, 255, 0.4);
  border-radius: 12px;
  background: rgba(109, 158, 255, 0.16);
  color: var(--text);
  text-align: center;
  text-decoration: none;
  font-weight: 900;
}

.broadcast-preview-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.funnel-message-editor {
  height: calc(100vh - 76px);
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
  overflow: hidden;
  border-top: 1px solid var(--line);
  font-weight: 400;
}

.funnel-message-editor .muted,
.funnel-message-editor .field,
.funnel-message-editor input,
.funnel-message-editor textarea,
.funnel-message-editor select,
.funnel-message-editor .select-button,
.funnel-message-editor .select-option {
  font-weight: 400;
}

.funnel-message-editor .secondary-button,
.funnel-message-editor .ghost-button,
.funnel-message-editor .primary-button {
  font-weight: 600;
}

.funnel-message-editor button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.funnel-board-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: #0f1724;
}

.funnel-board-head {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(17, 24, 36, 0.94);
}

.funnel-board-head h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.funnel-board-head p {
  margin: 0;
}

.funnel-board {
  min-height: 0;
  overflow: auto;
  background-color: #0f1724;
  background-image:
    radial-gradient(circle, rgba(226, 232, 240, 0.16) 1px, transparent 1px),
    linear-gradient(rgba(226, 232, 240, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(226, 232, 240, 0.03) 1px, transparent 1px);
  background-position:
    0 0,
    0 0,
    0 0;
  background-size:
    24px 24px,
    120px 120px,
    120px 120px;
}

.funnel-message-list {
  width: max-content;
  min-width: 100%;
  min-height: 100%;
  display: grid;
  grid-template-columns: repeat(4, 264px);
  grid-auto-rows: 176px;
  gap: 48px 58px;
  align-content: start;
  padding: 48px 56px 72px;
}

.funnel-message-node {
  position: relative;
  width: 264px;
  min-height: 176px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid rgba(226, 232, 240, 0.18);
  border-radius: 8px;
  padding: 14px;
  background: rgba(248, 250, 252, 0.96);
  color: #111827;
  text-align: left;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
}

.funnel-message-node::after {
  content: "";
  position: absolute;
  top: 50%;
  left: calc(100% + 1px);
  width: 58px;
  height: 1px;
  background: rgba(109, 158, 255, 0.62);
}

.funnel-message-node:nth-child(4n)::after,
.funnel-message-node:last-child::after {
  display: none;
}

.funnel-message-node:hover,
.funnel-message-node:focus-visible {
  border-color: rgba(109, 158, 255, 0.9);
  box-shadow:
    0 0 0 3px rgba(109, 158, 255, 0.2),
    0 18px 42px rgba(0, 0, 0, 0.22);
  outline: none;
}

.funnel-message-node.is-active {
  border-color: #58c895;
  box-shadow:
    0 0 0 3px rgba(88, 200, 149, 0.22),
    0 18px 42px rgba(0, 0, 0, 0.24);
}

.funnel-message-node-index {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #111827;
  color: #f8fafc;
  font-size: 14px;
  font-weight: 700;
}

.funnel-message-node-body {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.funnel-message-node-title,
.funnel-message-node-preview,
.funnel-message-node-meta span {
  min-width: 0;
}

.funnel-message-node-title {
  color: #0f172a;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}

.funnel-message-node-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.funnel-message-node-meta span {
  max-width: 100%;
  border-radius: 999px;
  padding: 3px 7px;
  background: #e7eef7;
  color: #475569;
  font-size: 11px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.funnel-message-node-preview {
  color: #334155;
  font-size: 12px;
  line-height: 1.45;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

.funnel-board-empty,
.funnel-message-empty {
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 1px dashed rgba(226, 232, 240, 0.18);
  border-radius: 8px;
  color: var(--muted);
}

.funnel-message-inspector {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: #141c2a;
  overflow: hidden;
}

.funnel-message-inspector .panel-header {
  min-height: 74px;
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.funnel-message-inspector .panel-header > div:first-child {
  min-width: 0;
}

.funnel-message-header-actions {
  display: grid;
  grid-template-columns: minmax(112px, auto) minmax(92px, auto);
  gap: 8px;
  flex: 0 0 auto;
}

.funnel-message-header-actions button {
  min-width: 0;
  white-space: nowrap;
}

.funnel-message-form {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(260px, 1fr) auto;
  gap: 14px;
  padding: 16px;
  overflow: auto;
}

.funnel-message-placeholder-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.funnel-message-placeholder-row span {
  border: 1px solid rgba(240, 191, 103, 0.34);
  border-radius: 999px;
  padding: 5px 8px;
  background: rgba(240, 191, 103, 0.12);
  color: #ffd997;
  font-size: 12px;
}

.funnel-message-form textarea {
  min-height: 360px;
  resize: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.5;
}

.funnel-message-media-row {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(130px, 0.42fr) minmax(0, 1fr);
  align-items: start;
}

.schedule-panel {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(16, 24, 37, 0.58);
}

.schedule-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: start;
}

.schedule-panel strong {
  font-size: 16px;
}

.schedule-head > span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.schedule-head .ghost-button {
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.schedule-mode {
  display: grid;
  gap: 10px;
}

.schedule-radio {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
}

.schedule-radio input {
  appearance: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin: 0;
  border: 2px solid rgba(226, 232, 240, 0.24);
  border-radius: 50%;
  background: transparent;
}

.schedule-radio input::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #07101d;
  transform: scale(0);
  transition: transform 120ms ease;
}

.schedule-radio input:checked {
  border-color: var(--accent);
  background: var(--accent);
}

.schedule-radio input:checked::after {
  transform: scale(1);
}

.schedule-datetime-field {
  position: relative;
}

.schedule-datetime-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}

.schedule-datetime-control:focus-within {
  border-color: rgba(109, 158, 255, 0.82);
  box-shadow: 0 0 0 3px rgba(109, 158, 255, 0.14);
}

.schedule-datetime-control input {
  min-height: 44px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 15px;
}

.schedule-datetime-control input:focus {
  border: 0;
  box-shadow: none;
}

.schedule-datetime-control button {
  display: grid;
  place-items: center;
  border: 0;
  border-left: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  font-size: 18px;
}

.schedule-datetime-control button:hover {
  color: var(--text);
  background: rgba(109, 158, 255, 0.12);
}

.schedule-picker {
  position: relative;
  z-index: 45;
  width: min(304px, 100%);
  padding: 8px;
  border: 1px solid rgba(226, 232, 240, 0.2);
  border-radius: 14px;
  background: #101724;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.3);
}

.schedule-picker-head {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  margin-bottom: 6px;
}

.schedule-picker-head strong {
  text-align: center;
  font-size: 16px;
}

.schedule-picker-head button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 10px;
  background: rgba(109, 158, 255, 0.14);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
}

.schedule-picker-head button:hover {
  background: rgba(109, 158, 255, 0.24);
}

.schedule-weekdays,
.schedule-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.schedule-weekdays {
  gap: 2px;
  margin-bottom: 2px;
}

.schedule-weekdays span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.schedule-days {
  gap: 2px;
}

.schedule-day {
  min-width: 0;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.schedule-day:hover:not(:disabled) {
  border-color: rgba(109, 158, 255, 0.55);
  background: rgba(109, 158, 255, 0.12);
}

.schedule-day.is-outside {
  color: rgba(169, 181, 198, 0.45);
}

.schedule-day.is-today {
  border-color: rgba(109, 158, 255, 0.72);
}

.schedule-day:disabled {
  cursor: not-allowed;
  color: rgba(169, 181, 198, 0.28);
}

.schedule-picker .schedule-days .schedule-day.is-selected:not(:disabled) {
  border-color: var(--accent);
  background: rgba(109, 158, 255, 0.26);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(109, 158, 255, 0.28);
}

.schedule-picker .schedule-days .schedule-day.is-selected:hover:not(:disabled),
.schedule-picker .schedule-days .schedule-day.is-selected:focus-visible {
  border-color: var(--accent);
  background: rgba(109, 158, 255, 0.34);
  color: var(--text);
}

.schedule-time {
  display: grid;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.schedule-time label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.schedule-time label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.schedule-time input {
  width: 86px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  padding: 0 10px;
  font-size: 14px;
  font-weight: 750;
  text-align: center;
  outline: none;
}

.schedule-time input:focus {
  border-color: rgba(109, 158, 255, 0.82);
  box-shadow: 0 0 0 3px rgba(109, 158, 255, 0.14);
}

.confirm-modal {
  width: min(560px, calc(100vw - 28px));
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
}

.confirm-modal::backdrop {
  background: rgba(3, 7, 14, 0.72);
  backdrop-filter: blur(8px);
}

.confirm-card {
  display: grid;
  gap: 16px;
  padding: 22px;
  border: 1px solid rgba(226, 232, 240, 0.16);
  border-radius: 24px;
  background: #121a28;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.48);
}

.confirm-card h2 {
  margin: 0;
  font-size: 24px;
}

.confirm-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-weight: 800;
}

.confirm-facts {
  display: grid;
  gap: 8px;
}

.confirm-facts:empty {
  display: none;
}

.confirm-facts div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}

.confirm-facts span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.select-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
}

.select-option {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 42px;
  border-radius: 14px;
  padding: 0 14px;
  line-height: 1.2;
}

.select-list .select-option:hover,
.select-list .select-option:focus-visible {
  background: rgba(109, 158, 255, 0.18);
  color: var(--text);
}

.select-list .select-option.is-selected {
  background: #6d9eff;
  color: #07101d;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

@media (max-width: 760px) {
  .broadcast-media-head,
  .media-add-row {
    grid-template-columns: 1fr;
  }

  .broadcast-media-head {
    display: grid;
  }

  .media-position-toggle {
    width: 100%;
    min-width: 0;
  }

  .media-add-row {
    display: grid;
  }

  .media-list-item {
    grid-template-columns: 44px minmax(0, 1fr) 34px;
  }

  .broadcast-preview-buttons > div,
  .broadcast-preview-actions,
  .confirm-actions,
  .funnel-message-card-head,
  .funnel-message-media-row {
    grid-template-columns: 1fr;
  }

  .broadcast-preview-buttons > div {
    flex-direction: column;
  }
}

@media (max-width: 1180px) {
  .funnel-message-editor {
    height: auto;
    min-height: calc(100vh - 76px);
    grid-template-columns: 1fr;
    grid-template-rows: minmax(520px, 62vh) auto;
    overflow: visible;
  }

  .funnel-message-inspector {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .funnel-message-form {
    grid-template-rows: auto minmax(320px, auto) auto auto;
  }
}

@media (max-width: 760px) {
  .funnel-board-head {
    align-items: stretch;
    flex-direction: column;
  }

  .funnel-message-list {
    grid-template-columns: repeat(2, 242px);
    grid-auto-rows: 180px;
    gap: 36px;
    padding: 30px 24px 44px;
  }

  .funnel-message-node {
    width: 242px;
  }

  .funnel-message-node:nth-child(4n)::after {
    display: block;
  }

  .funnel-message-node:nth-child(2n)::after,
  .funnel-message-node:last-child::after {
    display: none;
  }

  .funnel-message-inspector .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .funnel-message-header-actions,
  .funnel-message-media-row {
    grid-template-columns: 1fr;
  }
}

/* Final admin shell cleanup after the MAX VPN port.
   Keep this block last: it is the single source of truth for dialogs/mobile. */
.dialog-list {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
}

.dialog-list-item {
  flex: 0 0 auto;
  min-width: 0;
}

.dialog-list-item .avatar {
  flex: 0 0 auto;
}

.dialog-list-item small {
  white-space: nowrap;
}

.dialog-list-toggle,
.client-card-toggle,
.client-card-close {
  display: none;
}

.dialog-list-backdrop,
.client-card-backdrop {
  display: none;
}

.dialog-header .icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.client-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.client-card-head > div {
  min-width: 0;
}

.client-card-head h2,
.client-card-head p {
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 900px) {
  html,
  body {
    width: 100%;
    overflow-x: hidden;
  }

  body.sidebar-open,
  body.dialog-list-open,
  body.client-card-open {
    overflow: hidden;
  }

  .app {
    width: 100%;
    margin-left: 0;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 70;
    width: min(300px, calc(100vw - 48px));
    max-width: calc(100vw - 48px);
    transform: translateX(-100%);
    box-shadow: 28px 0 70px rgba(0, 0, 0, 0.42);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    z-index: 65;
  }

  .menu-button {
    display: grid;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    min-width: 0;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    align-items: center;
    justify-content: initial;
    gap: 12px;
    min-height: 72px;
    height: auto;
    padding: 10px 14px;
  }

  .topbar > div:first-of-type {
    min-width: 0;
    justify-self: start;
    text-align: left;
  }

  .topbar-actions {
    justify-self: end;
    width: 48px;
    min-width: 48px;
    flex-direction: row;
    justify-content: flex-end;
    gap: 0;
  }

  .menu-button,
  .topbar-actions .icon-button {
    display: grid;
    width: 48px;
    min-width: 48px;
    height: 48px;
    min-height: 48px;
    padding: 0;
    place-items: center;
    border-radius: 50%;
  }

  .topbar .eyebrow {
    margin-bottom: 2px;
    font-size: 11px;
    line-height: 1.1;
  }

  .topbar h1 {
    max-width: 100%;
    font-size: 24px;
    line-height: 1.08;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .client-card-toggle {
    display: grid;
    flex: 0 0 auto;
  }

  .client-card-backdrop {
    position: fixed;
    inset: 0;
    z-index: 85;
    display: block;
    border: 0;
    background: rgba(5, 9, 15, 0.58);
  }

  .client-card-backdrop[hidden] {
    display: none !important;
  }

  .client-card {
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 90;
    width: min(380px, calc(100vw - 44px));
    max-width: calc(100vw - 44px);
    height: 100dvh;
    max-height: none;
    padding: 16px;
    overflow: auto;
    transform: translateX(100%);
    border-top: 0;
    border-right: 0;
    border-bottom: 0;
    border-left: 1px solid var(--line);
    border-radius: 0;
    background: var(--surface);
    box-shadow: -28px 0 70px rgba(0, 0, 0, 0.42);
    transition: transform 0.2s ease;
  }

  body.client-card-open .client-card {
    transform: translateX(0);
  }

  .client-card-close {
    display: grid;
    flex: 0 0 auto;
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    place-items: center;
    border-radius: 50%;
  }
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: 48px minmax(0, 1fr) 48px;
  }

  .topbar h1,
  .topbar .eyebrow {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #view-dialogs.is-visible {
    height: calc(100dvh - 72px);
    min-height: 0;
    padding: 0;
    overflow: hidden;
  }

  .dialog-layout {
    position: relative;
    display: block;
    gap: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    border-radius: 0;
  }

  .dialog-list-toggle {
    display: grid;
    flex: 0 0 auto;
  }

  .dialog-list-backdrop {
    position: fixed;
    inset: 0;
    z-index: 75;
    display: block;
    border: 0;
    background: rgba(5, 9, 15, 0.58);
  }

  .dialog-list-backdrop[hidden] {
    display: none !important;
  }

  .dialog-list-panel {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 80;
    width: min(360px, calc(100vw - 44px));
    max-width: calc(100vw - 44px);
    height: 100dvh;
    overflow: hidden;
    transform: translateX(-100%);
    border-right: 1px solid var(--line);
    border-bottom: 0;
    background: var(--surface);
    box-shadow: 28px 0 70px rgba(0, 0, 0, 0.42);
    transition: transform 0.2s ease;
  }

  body.dialog-list-open .dialog-list-panel {
    transform: translateX(0);
  }

  .dialog-list-panel .panel-header.compact {
    min-height: 62px;
    align-items: center;
    flex-direction: row;
    padding: 14px 16px;
  }

  .dialog-list-panel .search,
  .dialog-list-panel select,
  .dialog-list-panel .select-ui {
    margin: 10px 16px 0;
  }

  .dialog-list {
    flex: 1 1 auto;
    max-height: none;
    min-height: 0;
    margin: 12px 0 0;
    overflow-y: auto;
  }

  .dialog-list-item {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    min-height: 68px;
    padding: 10px 16px;
  }

  .dialog-title-block strong,
  .dialog-title-block em {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dialog-thread-panel {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    border-radius: 0;
  }

  .dialog-header .icon-button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    place-items: center;
    border-radius: 50%;
  }

  .dialog-header-copy {
    flex: 1 1 auto;
    width: 100%;
  }

  .dialog-header {
    min-height: 64px;
    padding: 10px 12px;
  }

  .dialog-header .secondary-button {
    display: none;
  }

  .dialog-thread {
    height: auto;
    min-height: 0;
    overflow: auto;
    padding: 12px;
  }

  .client-card {
    width: min(360px, calc(100vw - 44px));
    max-height: none;
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .reply-compose-row {
    align-items: flex-end;
    gap: 7px;
    padding: 8px;
  }

  .compose-attach,
  .compose-send,
  .compose-record-cancel,
  .compose-record-stop {
    width: 44px;
    height: 44px;
  }

  .compose-field {
    min-height: 44px;
    border-radius: 16px;
  }

  .compose-field textarea {
    min-height: 42px;
    padding: 11px 12px 6px;
  }
}
