:root {
  color-scheme: dark;
  --bg: #0f1724;
  --sidebar: #111e2d;
  --surface: #152235;
  --surface-raised: #192941;
  --surface-soft: #1b2d44;
  --surface-quiet: #121f30;
  --line: #2b4360;
  --line-strong: #355478;
  --ink: #e6f0ff;
  --muted: #9bb3d0;
  --muted-strong: #bfd0e5;
  --brand: #3f96ff;
  --brand-strong: #247ee6;
  --brand-soft: #173b61;
  --green: #49d28b;
  --green-soft: #163b2b;
  --amber: #f0bf5b;
  --amber-soft: #3b2f17;
  --coral: #ff7e8b;
  --coral-soft: #41242b;
  --violet: #b28cff;
  --violet-soft: #30264b;
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.22);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: "Manrope", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1000;
  transform: translateY(-150%);
  padding: 9px 12px;
  color: #fff;
  background: var(--brand-strong);
  border-radius: 6px;
}

.skip-link:focus {
  transform: translateY(0);
}

.auth-body {
  min-height: 100vh;
  background: #0d1622;
}

.auth-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-card {
  position: relative;
  width: min(410px, 100%);
  padding: 24px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.32);
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--brand);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.auth-brand > span:last-child {
  display: grid;
  gap: 2px;
}

.auth-brand strong {
  font-size: 14px;
}

.auth-brand small {
  color: var(--muted);
  font-size: 10px;
}

.auth-heading {
  margin-top: 30px;
}

.auth-heading h1 {
  margin: 4px 0 0;
  font-size: 23px;
}

.auth-heading > p:last-child {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.auth-error {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  margin-top: 18px;
  padding: 10px 11px;
  color: #ffc4ca;
  background: var(--coral-soft);
  border: 1px solid #75414c;
  border-radius: 7px;
  font-size: 10px;
  line-height: 1.4;
}

.auth-error svg {
  width: 15px;
  height: 15px;
}

.auth-form {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.auth-form > label {
  margin-bottom: -5px;
  color: var(--muted-strong);
  font-size: 10px;
  font-weight: 700;
}

.auth-password-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 11px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
}

.auth-password-field:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(63, 150, 255, 0.12);
}

.auth-password-field svg {
  width: 15px;
  height: 15px;
}

.auth-password-field input {
  width: 100%;
  height: 100%;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
}

.auth-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  padding-top: 14px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 9px;
  text-transform: uppercase;
}

.app-shell {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 640px;
  padding: 20px 14px 14px;
  overflow-y: auto;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  padding: 0 6px;
}

.brand-logo {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  color: #fff;
  background: var(--brand);
  border: 1px solid #6db0ff;
  border-radius: 8px;
  box-shadow: 0 7px 18px rgba(63, 150, 255, 0.22);
}

.brand-logo svg {
  width: 19px;
  height: 19px;
}

.brand-copy,
.operator-row > span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.brand-copy strong {
  font-size: 15px;
}

.brand-copy span,
.operator-row small {
  color: var(--muted);
  font-size: 11px;
}

.sidebar-close {
  display: none;
  margin-left: auto;
}

.workspace-picker {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  margin-top: 22px;
  padding: 10px;
  color: var(--ink);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.workspace-picker:hover {
  border-color: var(--line-strong);
  background: var(--surface-raised);
}

.workspace-picker > span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.workspace-picker strong,
.workspace-picker small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-picker strong {
  font-size: 12px;
}

.workspace-picker small {
  color: var(--muted);
  font-size: 10px;
}

.workspace-picker > svg {
  width: 14px;
  color: var(--muted);
}

.bot-avatar,
.operator-avatar {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: #e9f4ff;
  background: #276aa8;
  border: 1px solid #4a8bc8;
  border-radius: 50%;
  font-weight: 800;
}

.bot-avatar.small,
.operator-avatar {
  width: 30px;
  height: 30px;
  font-size: 10px;
}

.bot-avatar.large {
  width: 64px;
  height: 64px;
  font-size: 18px;
}

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

.operator-avatar {
  color: #ffeec7;
  background: #715521;
  border-color: #9a7935;
}

.nav-list {
  display: grid;
  gap: 4px;
  margin-top: 24px;
}

.nav-label {
  padding: 0 10px 5px;
  color: #6f8baa;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.nav-label-spaced {
  margin-top: 16px;
}

.nav-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 39px;
  width: 100%;
  padding: 8px 10px;
  color: var(--muted-strong);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  color: #819bb8;
}

.nav-item:hover {
  color: var(--ink);
  background: #16263a;
}

.nav-item.active {
  color: #fff;
  background: var(--brand-soft);
  border-color: #285884;
}

.nav-item.active svg {
  color: #77b7ff;
}

.nav-count {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.nav-dot {
  width: 6px;
  height: 6px;
  background: var(--brand);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(63, 150, 255, 0.12);
}

.sidebar-bottom {
  display: grid;
  gap: 12px;
  margin-top: auto;
  padding-top: 24px;
}

.connection-card {
  padding: 11px;
  background: #101b2a;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.connection-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.connection-card p {
  margin: 7px 0;
  color: var(--muted);
  font-size: 10px;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-indicator.online {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(73, 210, 139, 0.12);
}

.status-indicator.offline {
  background: var(--coral);
  box-shadow: 0 0 0 4px rgba(255, 126, 139, 0.12);
}

.text-button {
  padding: 0;
  color: #8ec5ff;
  background: transparent;
  border: 0;
  font-size: 11px;
  font-weight: 700;
}

.text-button:hover {
  color: #bddcff;
}

.text-button.with-icon {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.text-button.with-icon svg {
  width: 13px;
  height: 13px;
}

.operator-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 8px 5px 0;
  border-top: 1px solid var(--line);
}

.operator-row form {
  margin: 0;
}

.operator-row strong {
  font-size: 11px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--muted-strong);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
}

.icon-button:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

.icon-button.bordered {
  background: var(--surface);
  border-color: var(--line);
}

.main-area {
  min-width: 0;
  background: var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 66px;
  padding: 0 26px;
  background: rgba(15, 23, 36, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.menu-button {
  display: none;
}

.global-search-wrap,
.local-search {
  display: flex;
  align-items: center;
  min-width: 0;
  color: var(--muted);
  background: var(--surface-quiet);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.global-search-wrap {
  width: min(440px, 44vw);
  height: 38px;
  padding: 0 10px;
}

.global-search-wrap svg,
.local-search svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.global-search-wrap input,
.local-search input {
  min-width: 0;
  flex: 1;
  height: 100%;
  padding: 0 9px;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
}

.global-search-wrap input::placeholder,
.local-search input::placeholder,
textarea::placeholder {
  color: #6f87a3;
}

.global-search-wrap:focus-within,
.local-search:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(63, 150, 255, 0.12);
}

kbd {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 20px;
  color: #7891ae;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: inherit;
  font-size: 10px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.environment-badge {
  padding: 5px 8px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.notification-button {
  position: relative;
}

.notification-button span {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  background: var(--coral);
  border: 2px solid var(--bg);
  border-radius: 50%;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 13px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  font-weight: 700;
  white-space: nowrap;
}

.button svg {
  width: 16px;
  height: 16px;
}

.button:hover {
  background: #223852;
  border-color: #45698f;
}

.button.primary {
  color: #fff;
  background: var(--brand-strong);
  border-color: #3e92ec;
  box-shadow: 0 7px 16px rgba(36, 126, 230, 0.17);
}

.button.primary:hover {
  background: #328ae9;
}

.button.secondary {
  background: var(--surface);
  border-color: var(--line);
}

.button.danger {
  color: #ffc2c9;
  background: var(--coral-soft);
  border-color: #73404a;
}

.button.danger:hover {
  background: #523039;
  border-color: #8d4b58;
}

.button.compact {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12px;
}

.button.full {
  width: 100%;
}

.page-container {
  width: min(100%, 1540px);
  margin: 0 auto;
  padding: 26px;
}

.page[hidden] {
  display: none;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.page-heading h1 {
  margin: 2px 0 0;
  font-size: 25px;
  line-height: 1.25;
}

.page-heading p:not(.eyebrow) {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.eyebrow {
  margin: 0;
  color: #79b7ff;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.heading-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.segmented-control {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  background: var(--surface-quiet);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.segmented-control button {
  min-height: 28px;
  padding: 5px 10px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
}

.segmented-control button:hover {
  color: var(--ink);
}

.segmented-control button.active {
  color: var(--ink);
  background: var(--surface-soft);
  box-shadow: 0 0 0 1px var(--line);
}

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

.metric-card {
  position: relative;
  min-width: 0;
  padding: 15px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric-card::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: var(--metric-color, var(--brand));
  opacity: 0.8;
}

.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.metric-head span:first-child {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.metric-icon {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  color: var(--metric-color, var(--brand));
  background: color-mix(in srgb, var(--metric-color, var(--brand)) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--metric-color, var(--brand)) 28%, transparent);
  border-radius: 6px;
}

.metric-icon svg {
  width: 14px;
  height: 14px;
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  font-size: 24px;
  line-height: 1.1;
}

.metric-card > span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
}

.metric-card > span.positive {
  color: #7fe3ae;
}

.metric-card > span.warning {
  color: #f4cf83;
}

.metric-card > span.info {
  color: #90c8ff;
}

.panel {
  min-width: 0;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading h2,
.settings-section h2 {
  margin: 0;
  font-size: 14px;
}

.panel-heading p,
.settings-section p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(260px, 0.65fr);
  gap: 12px;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 10px;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.legend-dot.incoming {
  background: var(--brand);
}

.legend-dot.outgoing {
  background: var(--green);
}

.chart-shell {
  width: 100%;
  height: 264px;
  margin-top: 14px;
  overflow: hidden;
}

#traffic-chart {
  display: block;
  width: 100%;
  height: 100%;
}

.chart-grid-line {
  stroke: #243b55;
  stroke-width: 1;
}

.chart-axis-label {
  fill: #708aa7;
  font-size: 9px;
}

.chart-line-incoming,
.chart-line-outgoing {
  fill: none;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-line-incoming {
  stroke: var(--brand);
}

.chart-line-outgoing {
  stroke: var(--green);
}

.chart-area-incoming {
  fill: url(#incoming-fill);
}

.chart-point {
  stroke: var(--surface);
  stroke-width: 2;
}

.traffic-footer {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.traffic-footer span {
  display: grid;
  gap: 3px;
  padding: 0 12px;
  border-right: 1px solid var(--line);
}

.traffic-footer span:first-child {
  padding-left: 0;
}

.traffic-footer span:last-child {
  border-right: 0;
}

.traffic-footer strong {
  font-size: 14px;
}

.traffic-footer small {
  color: var(--muted);
  font-size: 9px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.success {
  color: #a7efc9;
  background: var(--green-soft);
  border-color: #2c6b4b;
}

.badge.warning {
  color: #ffe2a6;
  background: var(--amber-soft);
  border-color: #6b572b;
}

.badge.info {
  color: #add6ff;
  background: var(--brand-soft);
  border-color: #315d87;
}

.badge.neutral {
  color: #c7d5e7;
  background: #202e40;
  border-color: #40536b;
}

.badge.danger {
  color: #ffbdc4;
  background: var(--coral-soft);
  border-color: #70404a;
}

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

.health-gauge-wrap {
  display: grid;
  place-items: center;
  min-height: 184px;
}

.health-gauge {
  display: grid;
  place-items: center;
  width: 142px;
  height: 142px;
  border-radius: 50%;
  background: radial-gradient(circle at center, var(--surface) 0 59%, transparent 60%), conic-gradient(var(--green) 0 100%, #263b53 100% 100%);
  box-shadow: inset 0 0 0 1px rgba(73, 210, 139, 0.08), 0 10px 28px rgba(0, 0, 0, 0.18);
}

.health-gauge.offline {
  background: radial-gradient(circle at center, var(--surface) 0 59%, transparent 60%), conic-gradient(var(--coral) 0 12%, #263b53 12% 100%);
}

.health-gauge > div {
  display: grid;
  justify-items: center;
  gap: 4px;
}

.health-gauge strong {
  font-size: 19px;
}

.health-gauge span {
  color: var(--muted);
  font-size: 9px;
}

.health-stats,
.connection-details {
  margin: 0;
}

.health-stats > div,
.connection-details > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.health-stats dt,
.connection-details dt {
  color: var(--muted);
  font-size: 10px;
}

.health-stats dd,
.connection-details dd {
  margin: 0;
  font-size: 10px;
  font-weight: 700;
}

.status-inline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.status-inline::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-inline.success {
  color: #8ce5b6;
}

.status-inline.success::before {
  background: var(--green);
}

.status-inline.info {
  color: var(--brand);
}

.status-inline.info::before {
  background: var(--brand);
}

.status-inline.neutral {
  color: var(--muted);
}

.status-inline.neutral::before {
  background: var(--muted);
}

.lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 12px;
  margin-top: 12px;
}

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

.whitelist-form,
.policy-form {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.whitelist-form label,
.policy-form label,
.access-check-form label {
  display: grid;
  gap: 6px;
}

.whitelist-form label > span,
.policy-form label > span,
.access-check-form label > span {
  color: var(--muted-strong);
  font-size: 10px;
  font-weight: 700;
}

.whitelist-form label b {
  color: var(--coral);
}

.whitelist-form input,
.whitelist-form select,
.access-check-form input {
  height: 39px;
  padding: 0 10px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  outline: 0;
}

.whitelist-form input:focus,
.whitelist-form select:focus,
.access-check-form input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(63, 150, 255, 0.12);
}

.whitelist-form .button {
  justify-self: start;
  margin-top: 4px;
}

.policy-form textarea {
  min-height: 132px;
  border-radius: 7px;
}

.policy-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.policy-footer > span {
  color: var(--muted);
  font-size: 9px;
}

.start-message-panel {
  margin-top: 12px;
}

.start-message-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  gap: 18px;
  align-items: start;
}

.start-keyboard-panel {
  display: grid;
  gap: 8px;
}

.start-keyboard-panel > small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.reply-keyboard-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.reply-keyboard-preview button {
  min-height: 34px;
  padding: 7px 8px;
  color: var(--muted-strong);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  font-size: 10px;
  line-height: 1.2;
  white-space: normal;
}

.reply-keyboard-preview button:last-child {
  grid-column: 1 / -1;
}

.access-check-panel,
.whitelist-table-panel {
  margin-top: 12px;
}

.access-check-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-top: 16px;
}

.access-check-form label {
  width: min(360px, 100%);
}

.access-check-result {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 10px;
  line-height: 1.45;
}

.access-check-result span {
  display: grid;
  gap: 3px;
}

.access-check-result strong {
  font-size: 11px;
}

.access-check-result.allowed {
  color: #baf3d3;
  background: var(--green-soft);
  border-color: #347454;
}

.access-check-result.blocked {
  color: #ffd4d9;
  background: var(--coral-soft);
  border-color: #75414c;
}

.whitelist-table-heading {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.whitelist-table-panel .table-wrap {
  margin-top: 0;
}

.whitelist-avatar {
  color: #bcf2d2;
  background: #1e583d;
  border-color: #37815a;
}

.permission-fieldset {
	display: grid;
	gap: 9px;
	min-width: 0;
	margin: 0;
	padding: 12px;
	background: var(--surface-quiet);
	border: 1px solid var(--line);
	border-radius: 7px;
}

.permission-fieldset legend {
	padding: 0 5px;
	color: var(--muted-strong);
	font-size: 10px;
	font-weight: 700;
}

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

.permission-option {
	display: flex !important;
	align-items: flex-start;
	gap: 8px !important;
	min-width: 0;
	padding: 9px;
	background: var(--surface-soft);
	border: 1px solid var(--line);
	border-radius: 6px;
	cursor: pointer;
}

.permission-option input {
	width: 15px;
	height: 15px !important;
	margin: 1px 0 0;
	accent-color: var(--brand);
}

.permission-option > span {
	display: grid;
	gap: 2px;
	min-width: 0;
}

.permission-option strong {
	color: var(--ink);
	font-size: 10px;
}

.permission-option small,
.permission-help {
	color: var(--muted);
	font-size: 9px;
	line-height: 1.4;
}

.permission-option:has(input:disabled) {
	cursor: default;
	opacity: 0.72;
}

.permission-summary {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	min-width: 150px;
	max-width: 310px;
}

.permission-chip,
.permission-all,
.permission-none {
	padding: 3px 6px;
	color: #b9d8fb;
	background: var(--brand-soft);
	border: 1px solid #2e5d89;
	border-radius: 999px;
	font-size: 8px;
	font-weight: 700;
	white-space: nowrap;
}

.permission-all {
	color: #baf3d3;
	background: var(--green-soft);
	border-color: #347454;
}

.permission-none {
	color: #f4cf83;
	background: rgba(185, 133, 38, 0.12);
	border-color: #715b32;
}

.table-actions {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 5px;
}

.access-dialog {
	width: min(660px, calc(100vw - 32px));
	padding: 0;
	color: var(--ink);
	background: var(--surface);
	border: 1px solid var(--line-strong);
	border-radius: 10px;
	box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.access-dialog::backdrop {
	background: rgba(5, 11, 20, 0.78);
	backdrop-filter: blur(3px);
}

.access-dialog-form {
	display: grid;
	gap: 16px;
	padding: 20px;
}

.dialog-heading {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
}

.dialog-heading h2 {
	margin: 3px 0 0;
	font-size: 19px;
}

.dialog-heading p:not(.eyebrow) {
	margin: 5px 0 0;
	color: var(--muted);
	font-size: 10px;
}

.access-dialog .compact-select {
	width: 100%;
}

.dialog-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
}

.event-list,
.broadcast-list {
  display: grid;
  margin-top: 9px;
}

.event-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.event-item:last-child,
.broadcast-row:last-child {
  border-bottom: 0;
}

.event-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: #bddcff;
  background: var(--brand-soft);
  border: 1px solid #2d5e8d;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 800;
}

.event-mark.success {
  color: #a9f1cb;
  background: var(--green-soft);
  border-color: #2d684c;
}

.event-mark.warning {
  color: #ffe0a0;
  background: var(--amber-soft);
  border-color: #6d5829;
}

.event-mark.neutral {
  color: #d0d9e5;
  background: #242f3e;
  border-color: #415269;
}

.event-copy,
.broadcast-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.event-copy strong,
.broadcast-copy strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-copy span,
.broadcast-copy span,
.event-item time {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.broadcast-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.broadcast-meta {
  display: grid;
  justify-items: end;
  gap: 5px;
}

.broadcast-meta small {
  color: var(--muted);
  font-size: 9px;
}

.table-panel,
.activity-panel,
.broadcast-history-panel {
  padding: 0;
  overflow: hidden;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.local-search {
  width: min(380px, 100%);
  height: 36px;
  padding: 0 9px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

th,
td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  color: #7892af;
  background: #132033;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

td {
  color: var(--muted-strong);
  font-size: 11px;
}

tbody tr:hover {
  background: #182940;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 9px;
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  color: #dcecff;
  background: #27486a;
  border: 1px solid #3e648a;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 800;
}

.user-cell > span:last-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.user-cell strong {
  color: var(--ink);
  font-size: 11px;
}

.user-cell small {
  color: var(--muted);
  font-size: 9px;
}

.table-action {
  width: 28px;
  height: 28px;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 11px 16px;
  color: var(--muted);
  background: #132033;
  border-top: 1px solid var(--line);
  font-size: 9px;
}

.composer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.55fr);
  gap: 12px;
  align-items: stretch;
}

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

.field-label,
.form-grid label > span,
.settings-section > label > span {
  display: block;
  margin: 15px 0 6px;
  color: var(--muted-strong);
  font-size: 10px;
  font-weight: 700;
}

.select-wrap {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 11px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
}

.select-wrap > svg {
  width: 15px;
  height: 15px;
}

.select-wrap select {
  width: 100%;
  height: 100%;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  appearance: none;
}

.message-label-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.message-label-row span {
  margin-top: 15px;
  color: var(--muted);
  font-size: 9px;
}

.format-toolbar {
  display: flex;
  align-items: center;
  gap: 3px;
  min-height: 37px;
  padding: 4px 6px;
  background: #132033;
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
}

.format-toolbar button {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  padding: 0;
  color: var(--muted-strong);
  background: transparent;
  border: 0;
  border-radius: 5px;
}

.format-toolbar button:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

.format-toolbar button svg {
  width: 14px;
  height: 14px;
}

.format-toolbar span {
  width: 1px;
  height: 18px;
  margin: 0 3px;
  background: var(--line);
}

textarea,
input[type="text"],
input[type="url"],
input[type="password"],
input[type="datetime-local"],
.compact-select {
  width: 100%;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  outline: 0;
}

textarea {
  min-height: 190px;
  padding: 12px;
  resize: vertical;
  border-radius: 0 0 7px 7px;
  line-height: 1.55;
}

textarea:focus,
input[type="text"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
input[type="datetime-local"]:focus,
.compact-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(63, 150, 255, 0.12);
}

.composer-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}

.toggle-row > span {
  display: grid;
  gap: 3px;
}

.toggle-row strong {
  font-size: 10px;
}

.toggle-row small {
  color: var(--muted);
  font-size: 9px;
}

.toggle-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.toggle-row > i {
  position: relative;
  width: 33px;
  height: 18px;
  flex: 0 0 auto;
  background: #2b3d54;
  border: 1px solid #405772;
  border-radius: 999px;
  transition: background 0.15s ease;
}

.toggle-row > i::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: #dbe8f6;
  border-radius: 50%;
  transition: transform 0.15s ease;
}

.toggle-row input:checked + i {
  background: var(--brand-strong);
  border-color: var(--brand);
}

.toggle-row input:checked + i::after {
  transform: translateX(15px);
}

.schedule-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 14px;
}

.schedule-row label {
  flex: 1;
}

.schedule-row .field-label {
  margin-top: 0;
}

input[type="datetime-local"] {
  height: 38px;
  padding: 0 10px;
  color-scheme: dark;
}

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

.telegram-preview {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 482px;
  margin-top: 14px;
  overflow: hidden;
  background: #0e1926;
  border: 1px solid #34516f;
  border-radius: 8px;
}

.telegram-header {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 56px;
  padding: 8px 11px;
  background: #172a3f;
  border-bottom: 1px solid #28425f;
}

.telegram-header > svg {
  width: 16px;
  color: #a9c2dc;
}

.telegram-header > span:nth-child(3) {
  display: grid;
  gap: 2px;
}

.telegram-header strong {
  font-size: 11px;
}

.telegram-header small {
  color: var(--muted);
  font-size: 9px;
}

.chat-area {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 44px 12px 14px;
  background-color: #111d2b;
  background-image: linear-gradient(rgba(43, 67, 96, 0.09) 1px, transparent 1px), linear-gradient(90deg, rgba(43, 67, 96, 0.09) 1px, transparent 1px);
  background-size: 24px 24px;
}

.date-chip {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px;
  color: #a5bdd6;
  background: rgba(23, 42, 63, 0.92);
  border-radius: 999px;
  font-size: 8px;
}

.chat-bubble {
  max-width: 88%;
  min-width: 148px;
  padding: 9px 10px 6px;
  color: #edf6ff;
  background: #215689;
  border: 1px solid #3373aa;
  border-radius: 8px 8px 2px 8px;
}

.chat-bubble p {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  font-size: 10px;
  line-height: 1.5;
}

.chat-bubble > span {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  margin-top: 4px;
  color: #a9d3fb;
  font-size: 8px;
}

.chat-bubble > span svg {
  width: 11px;
  height: 11px;
}

.telegram-input {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 8px 11px;
  color: var(--muted);
  background: #172a3f;
  border-top: 1px solid #28425f;
  font-size: 10px;
}

.telegram-input svg {
  width: 16px;
}

.broadcast-history-panel {
  margin-top: 12px;
}

.broadcast-history-panel > .panel-heading {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.compact-select {
  width: auto;
  min-width: 160px;
  height: 36px;
  padding: 0 10px;
}

.activity-timeline {
  display: grid;
  padding: 2px 16px 14px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.timeline-item:last-child {
  border-bottom: 0;
}

.timeline-item .event-mark {
  width: 34px;
  height: 34px;
}

.timeline-copy {
  min-width: 0;
}

.timeline-copy strong {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
}

.timeline-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.timeline-meta {
  display: grid;
  justify-items: end;
  align-content: start;
  gap: 6px;
}

.timeline-meta time {
  color: var(--muted);
  font-size: 9px;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 12px;
  align-items: start;
}

.settings-main {
  padding: 0 18px;
}

.settings-section {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.settings-section:last-child {
  border-bottom: 0;
}

.settings-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.settings-section code,
.inline-notice code {
  color: #d7e9ff;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.95em;
}

.profile-editor {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
}

.profile-editor > div {
  display: grid;
  justify-items: start;
  gap: 7px;
}

.profile-editor small {
  color: var(--muted);
  font-size: 9px;
}

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

.form-grid input,
.settings-section > label input {
  height: 39px;
  padding: 0 11px;
}

.sorting-settings-fields {
  margin-top: 16px;
}

.typing-speed-field {
  margin-top: 16px;
  padding: 14px 15px 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
}

.typing-speed-heading,
.typing-speed-scale {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.typing-speed-heading {
  gap: 16px;
  color: var(--muted-strong);
  font-size: 10px;
  font-weight: 700;
}

.typing-speed-heading output {
  min-width: 48px;
  color: var(--ink);
  text-align: right;
  font-size: 12px;
}

.typing-speed-field input[type="range"] {
  width: 100%;
  height: 24px;
  margin: 8px 0 2px;
  accent-color: var(--brand);
  cursor: pointer;
}

.typing-speed-scale {
  color: var(--muted);
  font-size: 9px;
}

.hm-automation-delay-fields {
  margin-top: 12px;
}

.hm-profile-photo-upload {
  margin-top: 14px;
}

.hm-profile-photo-upload input[type="file"] {
  width: 100%;
}

.hm-story-upload-help {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.hm-profile-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.hm-profile-photo-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.hm-profile-photo-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--surface);
}

.hm-profile-photo-card > div {
  display: grid;
  gap: 3px;
  padding: 10px;
}

.hm-profile-photo-card strong,
.hm-profile-photo-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hm-profile-photo-card small {
  color: var(--muted);
}

.hm-profile-photo-card .hm-profile-photo-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(30, 25, 29, 0.9);
}

.hm-profile-photo-empty {
  display: grid;
  place-items: center;
  min-height: 90px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
}

.hm-story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.hm-story-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.hm-story-meta {
  display: grid;
  gap: 3px;
  padding: 10px;
}

.hm-story-descriptions {
  border-top: 1px solid var(--line);
}

.hm-story-descriptions summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 8px 10px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.hm-story-descriptions summary::before {
  content: "▸";
  color: var(--muted);
  font-size: 14px;
  transition: transform 120ms ease;
}

.hm-story-descriptions[open] summary::before {
  content: "▾";
}

.hm-story-descriptions summary::-webkit-details-marker {
  display: none;
}

.hm-story-description-count {
  display: grid;
  min-width: 22px;
  min-height: 22px;
  place-items: center;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted-strong);
  font-size: 10px;
}

.hm-story-description-content {
  display: grid;
  gap: 10px;
  padding: 0 10px 10px;
}

.hm-story-description-form {
  display: grid;
  gap: 8px;
}

.hm-story-description-form label {
  display: grid;
  gap: 7px;
}

.hm-story-description-form label > span {
  color: var(--muted-strong);
  font-size: 10px;
  font-weight: 700;
}

.hm-story-description-form textarea {
  width: 100%;
  min-height: 88px;
}

.hm-story-description-form .button {
  justify-self: end;
}

.hm-story-description-list {
  display: grid;
  gap: 8px;
}

.hm-story-description {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.hm-story-description p {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere;
}

.hm-story-media {
  display: grid;
  place-items: center;
  aspect-ratio: 9 / 16;
  background: var(--surface);
}

.hm-story-media img,
.hm-story-media video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hm-story-collage-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 2px;
  width: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  background: var(--surface);
}

.hm-story-collage-preview img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
}

.hm-story-card strong,
.hm-story-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hm-story-card small {
  color: var(--muted);
}

.hm-story-card .hm-story-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(30, 25, 29, 0.9);
}

.settings-form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

input:disabled {
  color: #7890ab;
  cursor: not-allowed;
  background: #172438;
}

.password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
}

.password-field input {
  border: 0;
  background: transparent;
}

.inline-notice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  margin-top: 14px;
  padding: 10px 11px;
  color: #b7d9ff;
  background: var(--brand-soft);
  border: 1px solid #315e8b;
  border-radius: 7px;
}

.inline-notice svg {
  width: 15px;
  height: 15px;
  margin-top: 1px;
}

.inline-notice p {
  margin: 0;
  color: #acc7e4;
  line-height: 1.5;
}

.danger-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.connection-panel {
  position: sticky;
  top: 88px;
}

.lead-owner-panel {
  display: grid;
  gap: 18px;
}

.lead-owner-picker {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.lead-owner-picker label {
  width: min(520px, 100%);
}

.lead-owner-picker .field-label {
  margin-top: 0;
}

.lead-owner-picker .compact-select {
  width: 100%;
}

.lead-owner-picker p {
  max-width: 460px;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.lead-owner-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.lead-owner-heading > div {
  display: grid;
  gap: 4px;
}

.lead-owner-heading h2,
.lead-owner-heading p {
  margin: 0;
}

.lead-owner-heading p {
  color: var(--muted);
  font-size: 10px;
}

.lead-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
}

.lead-summary-card {
  display: grid;
  gap: 5px;
  padding: 12px 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.lead-summary-card span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.lead-summary-card strong {
  font-size: 19px;
}

.lead-summary-card.available strong {
  color: var(--green);
}

.lead-summary-card.taken strong {
  color: var(--amber);
}

.lead-summary-card.sorted strong {
  color: var(--brand);
}

.lead-list-panel {
  margin-top: 12px;
}

.lead-filter-group {
  display: flex;
  gap: 8px;
}

.lead-username {
  color: var(--ink);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 11px;
}

.accounts-layout {
  display: grid;
  grid-template-columns: minmax(340px, 0.72fr) minmax(0, 1.28fr);
  gap: 12px;
  align-items: start;
}

.account-onboarding-panel {
  display: grid;
  gap: 16px;
}

.account-onboarding-panel > .panel-heading > svg {
  color: var(--brand);
}

.account-mode-tabs {
  width: 100%;
}

.account-mode-tabs button {
  flex: 1;
}

.account-mode[hidden],
.account-step-form[hidden] {
  display: none;
}

.account-step-form {
  display: grid;
  gap: 13px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.account-step-form label {
  display: grid;
  gap: 6px;
}

.account-step-form label > span {
  color: var(--muted-strong);
  font-size: 10px;
  font-weight: 700;
}

.account-step-form input,
.account-step-form select {
  height: 40px;
  padding: 0 11px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  outline: 0;
}

.account-step-form input[type="file"] {
  height: auto;
  padding: 8px 10px;
  color: var(--muted-strong);
  font-size: 10px;
}

.account-step-form input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 6px 9px;
  color: var(--ink);
  background: var(--surface-raised);
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  cursor: pointer;
}

.account-step-form .account-proxy-toggle {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(63, 150, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
}

.account-step-form .account-proxy-toggle input {
  width: 16px;
  height: 16px;
  padding: 0;
  accent-color: var(--brand);
}

.account-proxy-toggle span,
.account-proxy-toggle small {
  display: block;
}

.account-proxy-toggle small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
  line-height: 1.4;
}

.account-proxy-fields {
  display: grid;
  gap: 11px;
  padding: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.account-proxy-fields[hidden] {
  display: none;
}

.account-proxy-fields > p {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.account-new-proxy-fields {
  display: grid;
  gap: 11px;
}

.account-new-proxy-fields[hidden],
.account-proxy-source-fields label[hidden],
.account-existing-proxy-note[hidden] {
  display: none;
}

.account-new-proxy-fields > p {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.account-step-form textarea {
  min-height: 148px;
  border-radius: 7px;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 10px;
}

.account-step-form input:focus,
.account-step-form select:focus,
.account-step-form textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(63, 150, 255, 0.12);
}

.account-step-form > p {
  margin: -3px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.account-step-form > .button {
  justify-self: start;
}

.account-step-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-step-heading > div {
  display: grid;
  gap: 3px;
}

.account-step-heading small {
  color: var(--muted);
  font-size: 9px;
}

.account-form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-security-notice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  padding: 10px 11px;
  color: #f5d18b;
  background: var(--amber-soft);
  border: 1px solid #6d5829;
  border-radius: 7px;
}

.account-security-notice svg {
  width: 15px;
  height: 15px;
}

.account-security-notice p {
  margin: 0;
  color: #d9be88;
  font-size: 9px;
  line-height: 1.5;
}

.account-list-panel {
  padding: 0;
  overflow: hidden;
}

.account-list-heading {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.account-avatar {
  color: #d7c9ff;
  background: var(--violet-soft);
  border-color: #66538e;
}

.account-owner-picker {
  width: 230px;
}

.account-owner-saved {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.account-owner-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 5px 5px 8px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}

.account-owner-chip > span {
  display: grid;
  font-size: 10px;
  line-height: 1.25;
}

.account-owner-chip small,
.account-owner-empty,
.account-owner-add-option small {
  color: var(--muted);
  font-size: 9px;
}

.account-owner-remove,
.account-owner-add-toggle {
  display: inline-grid;
  place-items: center;
  border-radius: 7px;
  cursor: pointer;
}

.account-owner-remove {
  width: 20px;
  height: 20px;
  color: var(--muted);
  background: transparent;
  border: 0;
  font-size: 16px;
  line-height: 1;
}

.account-owner-add-toggle {
  width: 30px;
  height: 30px;
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid rgba(63, 150, 255, 0.45);
  font-size: 19px;
}

.account-owner-remove:hover,
.account-owner-add-toggle:hover {
  color: var(--ink);
  border-color: var(--brand);
}

.account-owner-menu {
  display: grid;
  gap: 4px;
  max-height: 150px;
  margin-top: 7px;
  padding: 6px;
  overflow-y: auto;
  background: var(--surface-soft);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}

.account-owner-menu[hidden] {
  display: none;
}

.account-owner-add-option {
  display: grid;
  gap: 1px;
  width: 100%;
  padding: 7px 8px;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.account-owner-add-option:hover {
  background: var(--brand-soft);
}

.account-health {
  display: grid;
  gap: 5px;
  min-width: 180px;
  max-width: 250px;
}

.account-health .status-inline {
  justify-self: start;
}

.account-health small {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
  white-space: normal;
}

.connection-identity {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 22px 0;
}

.connection-identity strong {
  margin-top: 5px;
  font-size: 13px;
}

.connection-identity > span:last-child {
  color: var(--muted);
  font-size: 10px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(380px, calc(100vw - 40px));
  padding: 11px 14px;
  color: #dffbed;
  background: #183c2c;
  border: 1px solid #337153;
  border-radius: 7px;
  box-shadow: var(--shadow);
  font-size: 11px;
  font-weight: 700;
}

.toast[hidden] {
  display: none;
}

.toast svg {
  width: 16px;
  height: 16px;
  color: var(--green);
}

.toast.error {
  color: #ffd8dc;
  background: #42242b;
  border-color: #7d4551;
}

.toast.error svg {
  color: var(--coral);
}

.spin {
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 7px;
  padding: 38px 20px;
  color: var(--muted);
  text-align: center;
}

.empty-state svg {
  width: 24px;
  height: 24px;
  color: #6783a1;
}

.empty-state strong {
  color: var(--muted-strong);
  font-size: 11px;
}

.empty-state span {
  font-size: 9px;
}

.loading-line {
  height: 4px;
  margin: -26px -26px 22px;
  overflow: hidden;
  background: transparent;
}

.loading-line::after {
  content: "";
  display: block;
  width: 30%;
  height: 100%;
  background: var(--brand);
  animation: loading 0.8s ease-in-out infinite alternate;
}

@keyframes loading {
  from { transform: translateX(-100%); }
  to { transform: translateX(430%); }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1120px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .overview-grid,
  .composer-grid {
    grid-template-columns: minmax(0, 1fr) 300px;
  }

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

@media (max-width: 900px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-102%);
    width: 252px;
    transition: transform 0.18s ease;
    box-shadow: var(--shadow);
  }

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

  .sidebar-close,
  .menu-button {
    display: inline-grid;
  }

  .mobile-overlay {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(3, 8, 14, 0.72);
  }

  .topbar {
    padding: 0 18px;
  }

  .global-search-wrap {
    width: min(460px, 100%);
  }

  .page-container {
    padding: 22px 18px;
  }

  .overview-grid,
  .composer-grid,
  .settings-grid,
  .accounts-layout {
    grid-template-columns: 1fr;
  }

  .whitelist-layout {
    grid-template-columns: 1fr;
  }

  .start-message-layout {
    grid-template-columns: 1fr;
  }

  .health-panel {
    min-height: 0;
  }

  .connection-panel {
    position: static;
  }

  .lead-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .preview-panel {
    min-height: 560px;
  }
}

@media (max-width: 640px) {
  .topbar {
    gap: 8px;
    height: 60px;
    padding: 0 12px;
  }

  .global-search-wrap {
    height: 34px;
  }

  .global-search-wrap input::placeholder {
    color: transparent;
  }

  .global-search-wrap kbd,
  .environment-badge,
  .notification-button {
    display: none;
  }

  .topbar-actions .button span {
    display: none;
  }

  .topbar-actions .button {
    width: 34px;
    padding: 0;
  }

  .page-container {
    padding: 18px 12px;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 18px;
  }

  .page-heading h1 {
    font-size: 22px;
  }

  .heading-actions {
    width: 100%;
    justify-content: space-between;
  }

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

  .chart-shell {
    height: 230px;
  }

  .panel-heading {
    gap: 10px;
  }

  .chart-legend {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .traffic-footer span {
    padding: 0 8px;
  }

  .table-toolbar,
  .schedule-row,
  .danger-section,
  .access-check-form {
    align-items: stretch;
    flex-direction: column;
  }

  .access-check-form label {
    width: 100%;
  }

  .access-check-form .button {
    width: 100%;
  }

  .local-search,
  .compact-select {
    width: 100%;
  }

  .lead-owner-picker,
  .lead-owner-heading,
  .lead-filter-group,
  .account-form-actions {
    align-items: stretch;
    flex-direction: column;
  }

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

  .table-toolbar .segmented-control {
    width: 100%;
  }

  .table-toolbar .segmented-control button {
    flex: 1;
  }

  .composer-options,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .schedule-row .button {
    width: 100%;
  }

  .telegram-preview {
    min-height: 440px;
  }

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

  .timeline-meta {
    grid-column: 2;
    justify-items: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
