@import url("https://fonts.cdnfonts.com/css/garet");

:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-3: #eef3f8;
  --border: #e2e6ea;
  --border-strong: #d5dce3;
  --text: #111827;
  --muted: #667085;
  --muted-2: #98a2b3;
  --accent: #2aabee;
  --accent-strong: #168acd;
  --accent-soft: #e7f3fb;
  --success: #168a5b;
  --success-soft: #e7f4ee;
  --warning: #d98a00;
  --warning-soft: #fff4df;
  --danger: #c43d3d;
  --danger-soft: #fdecec;
  --sidebar: #17212b;
  --sidebar-hover: #202b36;
  --sidebar-border: #243244;
  --sidebar-text: #f3f4f6;
  --sidebar-muted: #9ca3af;
  --shadow-soft: 0 12px 30px rgba(15, 23, 42, .08);
  --ring: 0 0 0 3px rgba(34, 158, 217, .16);
  --sidebar-width: 240px;
  --topbar-height: 64px;
}

.scan-results-panel {
  margin: 14px 0 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.scan-results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, var(--accent) 8%);
}

.scan-results-head h3 {
  margin: 2px 0 0;
  font-size: 18px;
}

.scan-results-list {
  display: grid;
  max-height: 520px;
  overflow: auto;
}

.scan-result-card {
  display: grid;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 160ms ease, transform 160ms ease;
}

.scan-result-card:last-child {
  border-bottom: 0;
}

.scan-result-card:hover {
  background: var(--row-hover);
}

.scan-result-card:active {
  transform: scale(0.995);
}

.scan-result-meta,
.scan-result-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.scan-result-meta strong {
  color: var(--text);
}

.scan-result-meta span:not(.keyword-chip),
.scan-result-actions span:not(.score-badge) {
  color: var(--muted);
  font-size: 12px;
}

.scan-result-text {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0f14;
  --surface: #111821;
  --surface-2: #151e29;
  --surface-3: #1a2532;
  --border: #243244;
  --border-strong: #314257;
  --text: #f3f4f6;
  --muted: #9ca3af;
  --muted-2: #738095;
  --accent: #2aabee;
  --accent-strong: #6bc8ff;
  --accent-soft: #142b3a;
  --success: #45b986;
  --success-soft: #10261f;
  --warning: #e0a341;
  --warning-soft: #2c210d;
  --danger: #ee7373;
  --danger-soft: #301817;
  --sidebar: #17212b;
  --sidebar-hover: #202b36;
  --sidebar-border: #1f2d3d;
  --shadow-soft: 0 16px 34px rgba(0, 0, 0, .26);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  transition: background-color 180ms ease, color 180ms ease;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Garet", Inter, Manrope, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: 0;
  transition: background-color 180ms ease, color 180ms ease;
}

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

.login-flow-card {
  margin-bottom: 20px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.success-card {
  border-color: rgba(22, 138, 91, .28);
  background: var(--success-soft);
}

.account-live-overview {
  display: grid;
  grid-template-columns: 1.25fr repeat(4, minmax(132px, 1fr));
  gap: 8px;
  margin: 12px 0 12px;
}

.account-live-card {
  position: relative;
  display: grid;
  gap: 3px;
  min-width: 0;
  min-height: 74px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 12px;
  overflow: hidden;
  background: var(--surface-2);
  color: var(--text);
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    transform 140ms ease;
}

.account-live-card:hover {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
  transform: translateY(-1px);
}

.account-live-card small,
.account-live-card em {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-live-card small {
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.account-live-card strong {
  color: var(--text);
  font-size: 22px;
  font-weight: 900;
  line-height: 1.05;
}

.account-live-card em {
  font-size: 11px;
  font-weight: 700;
}

.account-live-card.main {
  padding-left: 34px;
}

.account-live-dot {
  position: absolute;
  left: 13px;
  top: 17px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--muted-2);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--muted-2) 18%, transparent);
}

.account-live-card.main.online .account-live-dot,
.account-live-card.success .account-live-dot {
  background: var(--success);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 16%, transparent);
}

.account-live-card.success {
  border-color: color-mix(in srgb, var(--success) 24%, var(--border));
  background: color-mix(in srgb, var(--success-soft) 58%, var(--surface));
}

.account-live-card.warning {
  border-color: color-mix(in srgb, var(--warning) 25%, var(--border));
  background: color-mix(in srgb, var(--warning-soft) 55%, var(--surface));
}

.account-live-card.danger {
  border-color: color-mix(in srgb, var(--danger) 25%, var(--border));
  background: color-mix(in srgb, var(--danger-soft) 55%, var(--surface));
}

.account-live-card.accent {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
  background: color-mix(in srgb, var(--accent-soft) 62%, var(--surface));
}

.account-admin-details {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-2);
}

.account-admin-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  transition:
    background-color 160ms ease,
    border-color 160ms ease;
}

.account-admin-details > summary::-webkit-details-marker {
  display: none;
}

.account-admin-details > summary:hover {
  background: var(--accent-soft);
}

.account-admin-details > summary span:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.account-admin-details > summary strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
}

.account-admin-details > summary small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.account-admin-toggle {
  flex: 0 0 auto;
  min-width: 84px;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--border));
  border-radius: 999px;
  padding: 7px 12px;
  background: var(--surface);
  color: var(--accent);
  font-size: 0;
  font-weight: 900;
  text-align: center;
  transition:
    background-color 160ms ease,
    transform 140ms ease;
}

.account-admin-toggle::before {
  content: "Открыть";
  font-size: 12px;
}

.account-admin-details[open] .account-admin-toggle::before {
  content: "Скрыть";
}

.account-admin-details[open] > summary {
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 86%, var(--accent-soft));
}

.account-admin-details[open] .accounts-table {
  border: 0;
  border-radius: 0;
  margin: 0;
}

.account-admin-lazy {
  display: grid;
  gap: 9px;
  min-height: 86px;
  padding: 16px;
  color: var(--muted);
  font-size: 12px;
}

.account-admin-lazy:has(.accounts-table) {
  display: block;
  min-height: 0;
  padding: 0;
}

.account-admin-lazy.is-error {
  grid-template-columns: 1fr auto;
  align-items: center;
  color: var(--danger);
}

.account-admin-lazy .skeleton-line {
  width: min(100%, 680px);
  height: 12px;
  border-radius: 6px;
  background: var(--border);
  animation: account-skeleton 1.2s ease-in-out infinite alternate;
}

.account-admin-lazy .skeleton-line.short {
  width: min(62%, 420px);
}

@keyframes account-skeleton {
  to { opacity: 0.45; }
}

.source-rank-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 8px;
}

.source-rank-grid span {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}

.source-rank-grid strong {
  color: var(--text);
  font-size: 16px;
  line-height: 1;
}

.rank-note {
  display: block;
  margin: 2px 0 10px;
  color: var(--muted);
  line-height: 1.35;
}

.account-topology-panel {
  margin: 14px 0 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  border-radius: 12px;
  overflow: hidden;
  background: color-mix(in srgb, var(--surface-2) 92%, var(--accent-soft));
}

.account-topology-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.account-topology-head h3 {
  margin: 2px 0 3px;
  color: var(--text);
  font-size: 17px;
  font-weight: 900;
}

.account-topology-head p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.account-topology-updated {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.account-topology-scroll {
  overflow: auto;
  max-height: min(680px, calc(100vh - 270px));
  min-height: 420px;
  padding: 12px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  overscroll-behavior: contain;
  cursor: grab;
  touch-action: none;
}

.account-topology-scroll::-webkit-scrollbar {
  display: none;
}

.account-topology-scroll.is-panning,
.account-topology-scroll.is-panning * {
  cursor: grabbing !important;
  user-select: none;
}

.account-topology {
  position: relative;
  min-width: 1500px;
  min-height: 620px;
  border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  border-radius: 10px;
  overflow: hidden;
  background-color: var(--surface);
  background-image:
    linear-gradient(color-mix(in srgb, var(--border) 36%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--border) 36%, transparent) 1px, transparent 1px);
  background-size: 28px 28px;
  transition: min-height 180ms ease;
}

.account-topology-lines {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.account-topology-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 6px;
  padding: 24px;
  text-align: center;
}

.account-topology-empty strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
}

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

.account-topology-line {
  fill: none;
  stroke: color-mix(in srgb, var(--muted-2) 38%, transparent);
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
  transition: stroke 160ms ease, opacity 160ms ease;
}

.account-topology-line.working {
  stroke: color-mix(in srgb, var(--success) 72%, var(--accent));
  stroke-width: 1.8;
  stroke-dasharray: 6 5;
  animation: accountTopologyFlow 1.8s linear infinite;
}

.account-topology-line.paused,
.account-topology-line.floodwait {
  stroke: color-mix(in srgb, var(--warning) 64%, var(--border));
  opacity: .3;
}

.account-topology-line.error {
  stroke: color-mix(in srgb, var(--danger) 72%, var(--border));
  opacity: .42;
}

@keyframes accountTopologyFlow {
  to { stroke-dashoffset: -22; }
}

.account-task-node,
.account-network-node {
  position: absolute;
  z-index: 2;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  box-shadow: 0 8px 22px rgba(15, 23, 42, .08);
  transition: border-color 150ms ease, background-color 150ms ease, transform 140ms ease, box-shadow 150ms ease;
}

.account-task-node {
  display: grid;
  place-items: center;
  width: 188px;
  min-height: 58px;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  border-radius: 10px;
  padding: 8px 12px;
  text-align: center;
}

.account-task-node strong,
.account-task-node small {
  display: block;
}

.account-task-node strong {
  font-size: 13px;
  font-weight: 900;
}

.account-task-node small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.account-network-node {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  width: 136px;
  min-height: 48px;
  border-radius: 9px;
  padding: 6px 7px;
  cursor: pointer;
  text-align: left;
}

.account-network-node:hover,
.account-network-node.is-selected {
  z-index: 4;
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 10px 28px rgba(42, 171, 238, .16);
  transform: translateY(-2px);
}

.account-network-node:active {
  transform: scale(.98);
}

.account-network-avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  overflow: hidden;
  border: 2px solid var(--muted-2);
  border-radius: 50%;
  background: #2aabee;
  color: #fff;
  font-size: 9px;
  font-weight: 900;
  object-fit: cover;
}

.account-network-node.working .account-network-avatar { border-color: var(--success); }
.account-network-node.paused .account-network-avatar,
.account-network-node.floodwait .account-network-avatar { border-color: var(--warning); }
.account-network-node.error .account-network-avatar { border-color: var(--danger); }

.account-network-copy {
  min-width: 0;
}

.account-network-copy strong,
.account-network-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-network-copy strong {
  font-size: 10px;
  font-weight: 900;
}

.account-network-copy small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.account-network-state {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 7px;
  height: 7px;
  border: 1px solid var(--surface);
  border-radius: 50%;
  background: var(--muted-2);
}

.account-network-node.working .account-network-state { background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 18%, transparent); }
.account-network-node.paused .account-network-state,
.account-network-node.floodwait .account-network-state { background: var(--warning); }
.account-network-node.error .account-network-state { background: var(--danger); }

.account-topology-loading {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  transform: translate(-50%, -50%);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 14px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.account-topology-detail {
  display: grid;
  grid-template-columns: minmax(150px, 1.4fr) repeat(4, minmax(100px, 1fr));
  gap: 8px;
  margin: 0 12px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  border-radius: 10px;
  padding: 10px;
  background: var(--surface);
  animation: inspectorIn 160ms ease-out;
}

.account-topology-detail[hidden] { display: none; }

.account-topology-detail span {
  display: grid;
  gap: 2px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  background: var(--surface-2);
}

.account-topology-detail small { color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.account-topology-detail strong { overflow: hidden; color: var(--text); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.account-topology-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 0 14px 12px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.account-topology-legend span { display: inline-flex; align-items: center; gap: 5px; }
.account-topology-legend i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted-2); }
.account-topology-legend i.working { background: var(--success); }
.account-topology-legend i.paused,
.account-topology-legend i.floodwait { background: var(--warning); }
.account-topology-legend i.error { background: var(--danger); }

.telegram-account-list {
  display: flex;
  gap: 8px;
  margin: 12px 0 16px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 8px;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--muted) 30%, transparent) transparent;
}

.telegram-account-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  flex: 0 0 258px;
  min-height: 86px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 10px;
  background: var(--surface-2);
  transition: background-color 160ms ease, border-color 160ms ease, transform 120ms ease;
}

.telegram-account-card:hover {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
  background: var(--accent-soft);
}

.telegram-account-card:active {
  transform: scale(.995);
}

.telegram-account-avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border-radius: 50%;
  background: #2aabee;
  color: #fff;
  font-size: 12px;
  font-weight: 850;
  object-fit: cover;
  text-transform: uppercase;
}

.telegram-account-card strong,
.telegram-account-card span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.telegram-account-card strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 780;
}

.telegram-account-card div > span {
  margin-top: 1px;
  color: var(--muted);
  font-size: 12px;
}

.telegram-account-card > .status {
  grid-column: 2;
  justify-self: start;
  margin-top: -3px;
}

.account-source-metrics {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
}

.account-source-metrics span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 4px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 780;
  letter-spacing: 0;
}

.account-login-modal {
  width: min(440px, calc(100vw - 28px));
  max-width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 0;
  background: transparent;
  color: var(--text);
}

.account-login-modal::backdrop {
  background: rgba(11, 15, 20, .48);
  backdrop-filter: blur(2px);
}

.account-login-dialog {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  background: var(--surface);
  box-shadow: 0 20px 60px rgba(15, 23, 42, .22);
}

.source-add-modal {
  width: min(660px, calc(100vw - 28px));
}

.source-add-dialog {
  animation: inspectorIn 160ms ease-out;
}

.source-add-dialog .section-head {
  margin-bottom: 12px;
}

.source-add-dialog label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
}

.source-add-dialog input,
.source-add-dialog select,
.source-add-dialog textarea {
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
}

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

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

.confirm-modal::backdrop {
  background: rgba(11, 15, 20, .52);
  backdrop-filter: blur(2px);
}

.confirm-dialog {
  display: grid;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  background: var(--surface);
  box-shadow: 0 20px 60px rgba(15, 23, 42, .22);
  animation: inspectorIn 160ms ease-out;
}

.confirm-dialog h2 {
  margin: 0;
  color: var(--text);
  font-size: 20px;
  line-height: 1.2;
}

.confirm-dialog p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

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

a {
  color: inherit;
  text-decoration: none;
}

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

button,
.button,
input,
select,
textarea,
.panel,
.drawer,
.filter-panel,
.summary-card,
.tg-signal-row,
.status-badge,
.score-badge,
.keyword-chip,
.contact-chip,
.match-chip {
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease,
    transform 120ms ease;
}

.keyword-highlight {
  border-radius: 5px;
  padding: 1px 3px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent-strong);
  font-weight: 800;
}

.workstation-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  height: 100vh;
  padding: 18px 12px 14px;
  border-right: 1px solid var(--sidebar-border);
  background: var(--sidebar);
  color: var(--sidebar-text);
}

.brand,
.brand-code {
  display: none;
}

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

.nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
  border-radius: 8px;
  padding: 9px 12px;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.2;
}

.nav a > span:first-child {
  min-width: 0;
}

.nav-counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 26px;
  min-height: 20px;
  border: 1px solid rgba(100, 200, 255, .24);
  border-radius: 999px;
  padding: 2px 7px;
  background: rgba(42, 171, 238, .14);
  color: #dff4ff;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0;
}

.nav a.active .nav-counter {
  border-color: rgba(100, 200, 255, .42);
  background: rgba(42, 171, 238, .22);
  color: #ffffff;
}

.nav a:hover {
  background: var(--sidebar-hover);
  color: #ffffff;
}

.nav a.active {
  background: #1b2d40;
  color: #ffffff;
  box-shadow: inset 3px 0 0 var(--accent);
}

.monitor-card {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: auto;
  padding: 12px;
  border: 1px solid var(--sidebar-border);
  border-radius: 8px;
  background: #111821;
}

.monitor-card strong,
.monitor-card small {
  display: block;
}

.monitor-card strong {
  color: #f3f4f6;
  font-size: 13px;
}

.monitor-card small {
  margin-top: 2px;
  color: var(--sidebar-muted);
  font-size: 12px;
}

.pulse {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(22, 138, 91, .16);
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  min-height: var(--topbar-height);
  padding: 15px 24px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
}

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

.topbar-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  min-width: 0;
  max-width: 100%;
}

.search {
  width: min(360px, 32vw);
}

.search input {
  width: 100%;
}

.content {
  min-width: 0;
  overflow: hidden;
  padding: 18px 24px 28px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  overflow: hidden;
  color: var(--text);
  font-size: 23px;
  font-weight: 760;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

h2 {
  font-size: 19px;
  font-weight: 750;
}

h3 {
  font-size: 14px;
  font-weight: 760;
}

.panel,
.filter-panel,
.drawer,
.metrics article {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.panel {
  padding: 16px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--surface);
  color: var(--text);
  outline: 0;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-2);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--ring);
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 680;
}

button,
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 36px;
  border: 1px solid var(--accent-strong);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--accent-strong);
  color: #ffffff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 720;
  line-height: 1.15;
  white-space: nowrap;
}

button:hover,
.button:hover {
  border-color: var(--accent);
  background: var(--accent);
}

button:active,
.button:active,
.nav a:active,
.tg-signal-row:active {
  transform: scale(.98);
}

.ghost,
.button.ghost,
button.ghost,
.theme-toggle {
  border-color: var(--border);
  background: var(--surface);
  color: var(--accent-strong);
}

.ghost:hover,
.button.ghost:hover,
button.ghost:hover,
.theme-toggle:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
  color: var(--accent);
}

.danger {
  border-color: var(--danger-soft);
  background: var(--danger-soft);
  color: var(--danger);
}

.danger:hover {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.small {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
}

.wide {
  width: 100%;
  margin-top: 8px;
}

.api-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  white-space: nowrap;
}

.api-status span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
}

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

.summary-card,
.metrics article {
  min-height: 76px;
  padding: 13px 14px;
}

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

.summary-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-soft);
}

.summary-card span,
.metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.summary-card strong,
.metrics strong {
  display: block;
  margin-top: 7px;
  color: var(--text);
  font-size: 25px;
  font-weight: 800;
  line-height: 1;
}

.filter-panel {
  margin-bottom: 12px;
  padding: 12px;
}

.signal-filter-panel {
  position: sticky;
  top: var(--topbar-height);
  z-index: 15;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
}

.filters,
.signal-filters {
  display: grid;
  grid-template-columns: 92px minmax(150px, 1fr) minmax(170px, 1fr) 132px 112px 124px auto;
  gap: 9px;
  align-items: end;
}

.signal-filters label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  min-width: 0;
  min-height: 36px;
  gap: 7px;
}

.signal-filters label > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 780;
  white-space: nowrap;
}

.signal-filters input,
.signal-filters select {
  min-width: 0;
}

.phone-base-filters {
  grid-template-columns: minmax(190px, .9fr) minmax(230px, 1.1fr);
  gap: 12px;
  align-items: end;
  margin: 16px 0 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.phone-base-filters label {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  min-height: 0;
}

.phone-base-filters label > span {
  padding-left: 2px;
}

.phone-base-filters select,
.phone-base-filters input {
  min-height: 40px;
  background: var(--surface);
}

.phone-base-filters button,
.phone-base-filters .button {
  min-height: 40px;
  padding-inline: 18px;
  width: 100%;
}

.phone-empty-row span {
  grid-column: 1 / -1;
}

.inbox-grid,
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(380px, 29vw, 420px);
  gap: 12px;
  align-items: start;
}

/* Accounts are an operational board.  Do not squeeze its live topology next
   to technical import forms; the latter belongs below the working surface. */
.accounts-workspace {
  grid-template-columns: minmax(0, 1fr);
}

.telegram-inbox {
  min-height: calc(100vh - 250px);
}

.signals-stream {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.stream-head {
  position: sticky;
  top: calc(var(--topbar-height) + 86px);
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.stream-head strong,
.stream-head span {
  display: block;
}

.stream-head strong {
  font-size: 13px;
}

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

.tg-signal-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  min-height: 92px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.tg-signal-row:last-child {
  border-bottom: 0;
}

.tg-signal-row:hover {
  background: var(--surface-2);
}

.tg-signal-row.selected {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.signal-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.signal-main {
  min-width: 0;
}

.signal-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.signal-identity {
  min-width: 0;
}

.signal-identity strong,
.signal-identity span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signal-identity strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 780;
}

.signal-identity span {
  margin-top: 1px;
  color: var(--muted);
  font-size: 12px;
}

.signal-badges {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
}

.signal-text {
  display: -webkit-box;
  margin: 7px 0 8px;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  line-height: 1.42;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.signal-meta,
.chip-list,
.line,
.contacts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.score-badge,
.status-badge,
.keyword-chip,
.contact-chip,
.match-chip,
.muted-chip,
.score,
.tag,
.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  max-width: 100%;
  border-radius: 999px;
  padding: 3px 8px;
  overflow: hidden;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-badge,
.score {
  min-width: 40px;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.keyword-chip,
.tag {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
}

.contact-chip {
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border));
  background: var(--surface);
  color: var(--accent-strong);
}

.match-chip,
.tag.success {
  border: 1px solid color-mix(in srgb, var(--success) 22%, transparent);
  background: var(--success-soft);
  color: var(--success);
}

.muted-chip {
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--muted-2);
}

.status-badge,
.status {
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--muted);
}

.status-badge.new,
.status.new,
.status.suggested {
  border-color: color-mix(in srgb, var(--accent) 20%, transparent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.status-badge.checked,
.status.checked {
  border-color: var(--border);
  background: var(--surface-2);
  color: var(--muted);
}

.status-badge.contacted,
.status.contacted,
.status.monitoring,
.status.accepted,
.status.active {
  border-color: color-mix(in srgb, var(--success) 22%, transparent);
  background: var(--success-soft);
  color: var(--success);
}

.status-badge.not_relevant,
.status.not_relevant,
.status.paused {
  border-color: color-mix(in srgb, var(--warning) 22%, transparent);
  background: var(--warning-soft);
  color: var(--warning);
}

.status-badge.do_not_contact,
.status.do_not_contact,
.status.rejected,
.status.needs_attention {
  border-color: color-mix(in srgb, var(--danger) 24%, transparent);
  background: var(--danger-soft);
  color: var(--danger);
}

.drawer,
.inspector-panel {
  position: sticky;
  top: calc(var(--topbar-height) + 12px);
  max-height: calc(100vh - var(--topbar-height) - 28px);
  overflow: auto;
  padding: 0;
  animation: inspectorIn 170ms ease-out;
}

.inspector-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.inspector-hero strong {
  display: block;
  color: var(--text);
  font-size: 36px;
  font-weight: 850;
  line-height: .95;
}

.inspector-hero span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 680;
}

.inspector-section,
.drawer-section {
  padding: 15px 16px;
  border-bottom: 1px solid var(--border);
}

.inspector-section:last-child,
.drawer-section:last-child {
  border-bottom: 0;
}

.inspector-section h3 {
  margin-bottom: 10px;
}

.message {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.relevance-text {
  margin: 0;
  line-height: 1.55;
}

.source-link {
  display: grid;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-2);
}

.source-link:hover {
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.source-link strong,
.source-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.action-grid button {
  width: 100%;
}

.empty-state,
.empty {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 160px;
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

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

.empty-state span {
  max-width: 280px;
  font-size: 13px;
}

.signals-table {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  overflow: clip;
}

.signals-head,
.signals-table > .signal-row {
  display: grid;
  grid-template-columns: minmax(340px, 1.35fr) minmax(170px, .55fr) minmax(170px, .55fr) 128px;
  gap: 14px;
  align-items: center;
}

.signals-head {
  position: sticky;
  top: var(--topbar-height);
  z-index: 5;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.signals-table > .signal-row {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
}

.signals-table > .signal-row:hover,
.signals-table > .signal-row.selected {
  background: var(--surface-2);
}

dl {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 8px 12px;
}

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

dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.data-table {
  display: grid;
}

.tr {
  display: grid;
  grid-template-columns: 76px minmax(180px, 1fr) minmax(130px, .5fr) minmax(180px, .8fr) 128px 110px;
  gap: 12px;
  align-items: center;
  min-height: 48px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.tr:last-child {
  border-bottom: 0;
}

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

.dashboard-table .tr {
  grid-template-columns: 76px 180px 220px minmax(280px, 1fr) 128px;
}

.phone-table .tr,
.accounts-table .tr {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.phone-table .tr {
  grid-template-columns:
    minmax(118px, .85fr)
    minmax(132px, .85fr)
    minmax(96px, .62fr)
    minmax(160px, 1.1fr)
    minmax(170px, 1.05fr)
    minmax(150px, .95fr);
}

.phone-table .tr > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.phone-table .tr small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.profile-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  margin-top: 6px;
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  padding: 5px 11px;
  background: var(--surface);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.1;
  text-decoration: none;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 120ms ease, box-shadow 150ms ease;
}

.inline-profile-form {
  display: inline-flex;
  margin: 0;
}

.profile-link-button:hover {
  border-color: var(--accent-strong);
  background: var(--accent-soft);
  box-shadow: var(--ring);
}

.profile-link-button:active {
  transform: scale(.98);
}

.profile-copy-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  margin-top: 6px;
  border: 1.5px solid var(--border-strong);
  border-radius: 999px;
  padding: 5px 11px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.1;
}

.profile-copy-button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.profile-copy-button:active {
  transform: scale(.98);
}

.profile-unavailable {
  max-width: 260px;
  color: var(--muted);
  font-weight: 650;
}

.accounts-table .tr {
  grid-template-columns: minmax(140px, 1fr) 110px 130px 80px minmax(220px, 1.2fr) 160px;
}

.account-edit-row input,
.account-edit-row select {
  min-height: 34px;
  padding: 7px 9px;
  font-size: 13px;
}

.account-session-cell {
  display: grid;
  gap: 6px;
}

.account-actions {
  display: grid;
  gap: 6px;
}

.task-table .tr {
  grid-template-columns: minmax(140px, .9fr) 100px minmax(110px, .7fr) minmax(160px, 1fr) minmax(220px, 1.35fr);
}

.ledger-table .tr {
  grid-template-columns: 90px minmax(130px, 1fr) 110px 90px minmax(160px, 1.2fr);
}

.enrichment-table .tr {
  grid-template-columns: 110px 95px minmax(110px, .7fr) 110px 80px minmax(210px, 1.2fr) minmax(240px, 1.4fr);
}

.operations-panel {
  min-height: calc(100vh - 112px);
}

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

.operations-task-table,
.operations-ledger-table,
.operations-enrichment-table {
  max-height: calc(100vh - 305px);
  overflow: auto;
}

.operations-task-table .tr,
.operations-ledger-table .tr,
.operations-enrichment-table .tr {
  align-items: center;
}

.operations-tabs {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.operations-tabs > input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tab-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.tab-labels label {
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 11px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 780;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 120ms ease;
}

.tab-labels label:hover {
  background: var(--surface);
  color: var(--text);
}

.tab-labels label:active {
  transform: scale(.98);
}

#tab-tasks:checked ~ .tab-labels label[for="tab-tasks"],
#tab-enrichment:checked ~ .tab-labels label[for="tab-enrichment"],
#tab-ledger:checked ~ .tab-labels label[for="tab-ledger"],
#tab-notifications:checked ~ .tab-labels label[for="tab-notifications"] {
  border-color: color-mix(in srgb, var(--accent) 24%, var(--border));
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.tab-panels {
  min-width: 0;
}

.tab-panel {
  display: none;
  animation: panelFade 160ms ease both;
}

#tab-tasks:checked ~ .tab-panels .tab-panel-tasks,
#tab-enrichment:checked ~ .tab-panels .tab-panel-enrichment,
#tab-ledger:checked ~ .tab-panels .tab-panel-ledger,
#tab-notifications:checked ~ .tab-panels .tab-panel-notifications {
  display: block;
}

@keyframes panelFade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.operation-result {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-list {
  display: grid;
  gap: 10px;
}

.timeline-item {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.timeline-item span,
.timeline-item small {
  color: var(--muted);
  font-size: 12px;
}

.timeline-item p {
  margin: 0;
  color: var(--text);
  line-height: 1.45;
}

.faq-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
}

.faq-hero h2 {
  margin-bottom: 8px;
}

.faq-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.faq-steps article,
.faq-card,
.faq-status-list > div {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  transition: background-color 140ms ease, border-color 140ms ease, transform 120ms ease;
}

.faq-steps article {
  display: grid;
  gap: 7px;
  padding: 12px;
}

.faq-steps article:hover,
.faq-card:hover,
.faq-status-list > div:hover {
  border-color: color-mix(in srgb, var(--accent) 24%, var(--border));
  background: var(--surface);
}

.faq-steps article:active,
.faq-card:active,
.faq-status-list > div:active {
  transform: scale(.995);
}

.faq-steps strong,
.faq-card strong,
.faq-status-list strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.25;
}

.faq-steps span,
.faq-card span,
.faq-card p,
.faq-status-list p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

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

.faq-card {
  display: grid;
  gap: 8px;
  align-content: start;
}

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

.faq-status-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.faq-status-list > div {
  display: grid;
  gap: 7px;
  padding: 12px;
}

.reports-table .tr {
  grid-template-columns: minmax(220px, 1fr) 120px 120px;
}

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

.keyword-list {
  display: grid;
  gap: 8px;
}

.keyword-row {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) 70px 90px auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.stack {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox input {
  width: auto;
  min-height: auto;
}

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

.suggestion {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.suggestion p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

code {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  overflow-wrap: anywhere;
}

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

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

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 260px 260px;
  gap: 14px;
}

.settings-card {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.settings-card strong,
.settings-card span {
  display: block;
}

.settings-card span {
  margin-top: 6px;
  color: var(--muted);
}

.operation-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 0;
}

.operation-strip span {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.phone-status-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  animation: inspectorIn 170ms ease-out;
}

.phone-status-card.running {
  border-left-color: var(--warning);
}

.phone-status-card.done {
  border-left-color: var(--success);
}

.phone-status-card.error {
  border-left-color: var(--danger);
}

.phone-status-card h3,
.phone-status-card p {
  margin: 0;
}

.phone-status-card h3 {
  margin-top: 2px;
  font-size: 18px;
}

.phone-status-card p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.phone-alert {
  margin-bottom: 12px;
}

.phone-progress-strip {
  margin-bottom: 2px;
}

.phone-stats-note {
  margin: 8px 0 12px;
  font-size: 12px;
  line-height: 1.45;
}

.phone-base-panel {
  padding: 18px;
}

.phone-base-head {
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.phone-base-head .line {
  flex-wrap: wrap;
  gap: 10px;
}

.phone-base-head .line form {
  margin: 0;
}

.phone-base-head .line button {
  min-height: 40px;
  padding-inline: 16px;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}

.pagination-bar form {
  margin: 0;
}

.pagination-bar button {
  min-height: 34px;
}

.discovery-search,
.ai-topic-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 220px auto;
  gap: 9px;
  align-items: center;
}

.ai-topic-form {
  grid-template-columns: minmax(280px, 1fr) auto;
  margin-bottom: 14px;
}

.source-bulk-panel {
  margin-top: 14px;
}

.latest-source-results {
  border-color: color-mix(in srgb, var(--accent) 54%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 16%, transparent), var(--panel-shadow);
}

.latest-source-results .section-head {
  align-items: flex-start;
}

.source-card-fresh::before {
  background: var(--success);
  opacity: .95;
}

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

.source-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

.source-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.source-select {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.source-select input {
  width: auto;
  min-height: auto;
}

.source-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.source-card-head h3 {
  margin: 0 0 3px;
}

.source-card-head span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.source-card p {
  margin: 0;
  color: var(--text);
  font-size: 13px;
}

.sample-message {
  min-height: 72px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.source-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.source-actions button {
  width: 100%;
}

.skeleton-loader {
  position: fixed;
  inset: var(--topbar-height) 0 auto var(--sidebar-width);
  z-index: 80;
  display: none;
  gap: 8px;
  padding: 14px 24px;
  pointer-events: none;
}

.skeleton-loader.is-visible {
  display: grid;
}

.skeleton-loader span {
  height: 12px;
  max-width: 680px;
  border-radius: 999px;
  background: var(--surface-3);
  animation: skeletonPulse 850ms ease-in-out infinite alternate;
}

.skeleton-loader span:nth-child(2) {
  width: 72%;
}

.skeleton-loader span:nth-child(3) {
  width: 46%;
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 36px));
}

.toast {
  display: grid;
  gap: 3px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 11px 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-soft);
  animation: toastIn 160ms ease-out;
}

.toast strong {
  font-size: 13px;
}

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

.toast.success {
  border-left-color: var(--success);
}

.toast.error {
  border-left-color: var(--danger);
}

@keyframes inspectorIn {
  from {
    opacity: 0;
    transform: translateX(8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes skeletonPulse {
  from {
    background-position: 180% 0;
  }
  to {
    background-position: -180% 0;
  }
}

@media (max-width: 1260px) {
  .inbox-grid,
  .split {
    grid-template-columns: minmax(0, 1fr) 380px;
  }

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

  .filters,
  .signal-filters {
    grid-template-columns: 90px minmax(150px, 1fr) minmax(160px, 1fr) 128px 104px auto;
  }

  .signal-filters label:nth-of-type(6) {
    display: none;
  }
}

@media (max-width: 1040px) {
  .topbar {
    align-items: center;
    flex-direction: row;
    min-height: var(--topbar-height);
    gap: 14px;
  }

  .topbar-tools {
    width: auto;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 7px;
  }

  .search {
    width: 220px;
    flex: 0 1 220px;
  }

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

  .filters,
  .signal-filters {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .signal-filters label:nth-of-type(6) {
    display: grid;
  }

  .signal-filters button {
    width: 100%;
  }

  .drawer,
  .inspector-panel {
    top: 12px;
    max-height: calc(100vh - 24px);
  }
}

@media (max-width: 880px) {
  .inbox-grid,
  .split {
    grid-template-columns: 1fr;
  }

  .drawer,
  .inspector-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 720px) {
  :root {
    --topbar-height: 64px;
  }

  .workstation-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
  }

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

  .nav a {
    justify-content: flex-start;
    font-size: 12px;
  }

  .monitor-card {
    margin-top: 12px;
  }

  .monitor-card div {
    display: block;
  }

  .content {
    padding: 14px;
  }

  .summary-grid,
  .metrics,
  .filters,
  .signal-filters,
  .action-grid,
  .suggestion-grid,
  .settings-grid,
  .tr,
  .dashboard-table .tr,
  .phone-table .tr,
  .accounts-table .tr,
  .keyword-row {
    grid-template-columns: 1fr;
  }

  .signal-filter-panel,
  .stream-head {
    position: static;
  }

  .signal-topline {
    align-items: stretch;
    flex-direction: column;
  }

  .signal-badges {
    justify-content: flex-start;
  }

  .skeleton-loader {
    inset: 0 0 auto 0;
  }

  .discovery-search,
  .ai-topic-form,
  .source-card-grid,
  .source-actions {
    grid-template-columns: 1fr;
  }
}

/* Managers live client: final layout overrides */
.manager-workspace {
  display: grid;
  grid-template-columns: minmax(210px, 230px) minmax(300px, .85fr) minmax(360px, 1.15fr);
  height: calc(100dvh - var(--topbar-height) - 36px);
  min-height: 620px;
  max-height: 900px;
  overflow: hidden;
}

.manager-roster,
.manager-dialog-list,
.manager-detail-pane {
  min-height: 0;
}

.manager-account-list,
.manager-dialog-scroll {
  min-height: 0;
}

.manager-detail-pane {
  padding: 0;
  overflow: hidden;
}

.manager-detail-head {
  min-height: 74px;
  padding: 13px 16px;
}

.manager-detail-head > div {
  flex: 1;
  min-width: 0;
}

.manager-detail-head .manager-live-label {
  flex: 0 0 auto;
}

.manager-message-list {
  flex: 1;
  min-height: 0;
}

.manager-detail-note {
  margin: 0;
  padding: 8px 14px;
}

.manager-error-state strong {
  color: var(--danger);
}

.manager-error-state .button {
  margin-top: 5px;
}

.manager-current-user [hidden],
.manager-detail-head [hidden] {
  display: none;
}

@media (max-width: 1180px) {
  .manager-workspace {
    grid-template-columns: 220px 320px minmax(360px, 1fr);
  }

  .manager-detail-pane {
    grid-column: auto;
    min-height: 0;
    border-top: 0;
  }
}

@media (max-width: 900px) {
  .manager-workspace {
    grid-template-columns: 210px minmax(300px, 1fr);
    height: auto;
    max-height: none;
  }

  .manager-detail-pane {
    grid-column: 1 / -1;
    min-height: 520px;
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 700px) {
  .manager-workspace {
    display: block;
    min-height: 0;
    overflow: hidden;
  }

  .manager-roster {
    display: block;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .manager-roster-head {
    padding: 14px 14px 7px;
  }

  .manager-account-list {
    display: flex;
    grid-template-columns: none;
    gap: 8px;
    padding: 8px 12px 12px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .manager-account-list::-webkit-scrollbar {
    display: none;
  }

  .manager-account {
    flex: 0 0 210px;
  }

  .manager-roster-foot {
    display: none;
  }

  .manager-dialog-list {
    min-height: 520px;
    border: 0;
  }

  .manager-detail-pane {
    display: none;
    min-height: 620px;
    padding: 0;
  }

  .manager-workspace.is-chat-open .manager-dialog-list {
    display: none;
  }

  .manager-workspace.is-chat-open .manager-detail-pane {
    display: flex;
  }

  .manager-mobile-back {
    display: inline-grid;
  }

  .manager-message {
    max-width: 88%;
  }

  .manager-detail-note {
    display: none;
  }
}

@media (max-width: 460px) {
  .manager-pane-head,
  .manager-detail-head {
    padding: 12px;
  }

  .manager-message-list {
    padding: 14px 10px;
  }

  .manager-composer {
    grid-template-columns: 1fr;
  }

  .manager-send-button {
    width: 100%;
  }
}

.manager-stream-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  margin-left: auto;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  transition: border-color 160ms ease, color 160ms ease, background-color 160ms ease;
}

.manager-stream-state > span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.manager-stream-state.is-online {
  border-color: color-mix(in srgb, #24b47e 48%, var(--border));
  background: color-mix(in srgb, #24b47e 9%, transparent);
  color: #24b47e;
}

.manager-stream-state.is-connecting,
.manager-stream-state.is-reconnecting {
  border-color: color-mix(in srgb, var(--accent) 46%, var(--border));
  color: var(--accent);
}

.manager-stream-state.is-connecting > span,
.manager-stream-state.is-reconnecting > span {
  animation: manager-stream-pulse 1.4s ease-in-out infinite;
}

.manager-stream-state.is-paused,
.manager-stream-state.is-offline {
  border-color: color-mix(in srgb, var(--warning) 42%, var(--border));
  color: var(--warning);
}

@keyframes manager-stream-pulse {
  0%, 100% { opacity: .35; }
  50% { opacity: 1; }
}

@media (max-width: 460px) {
  .manager-stream-state {
    max-width: 116px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Managers: isolated manual Telegram workspace */
.manager-workspace {
  grid-template-columns: 250px 350px minmax(420px, 1fr);
  height: calc(100dvh - var(--topbar-height) - 36px);
  min-height: 620px;
  max-height: 900px;
}

.manager-mode-label,
.manager-live-label {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid color-mix(in srgb, var(--success) 42%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--success) 9%, var(--surface));
  color: var(--success);
  font-size: 10px;
  font-weight: 850;
}

.manager-roster-head .manager-mode-label {
  margin-bottom: 10px;
}

.manager-roster-head p strong {
  color: var(--text);
}

.manager-account-list {
  min-height: 0;
}

.manager-icon-button,
.manager-mobile-back {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--accent);
  font-size: 19px;
  font-weight: 800;
  transition: border-color 150ms ease, background-color 150ms ease, transform 120ms ease;
}

.manager-icon-button:hover,
.manager-mobile-back:hover {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--border));
  background: var(--accent-soft);
}

.manager-icon-button:active,
.manager-mobile-back:active {
  transform: scale(.96);
}

.manager-icon-button.is-loading {
  color: var(--muted);
  animation: manager-spin 900ms linear infinite;
}

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

.manager-dialog-search {
  display: block;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.manager-dialog-search input {
  width: 100%;
  height: 40px;
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.manager-dialog-scroll {
  flex: 1;
  min-height: 0;
}

.manager-dialog {
  grid-template-columns: 42px minmax(0, 1fr) auto;
  min-height: 68px;
  padding: 11px 12px;
}

.manager-dialog .manager-avatar {
  width: 42px;
  height: 42px;
}

.manager-dialog-copy span {
  max-width: 100%;
}

.manager-dialog-meta {
  display: grid;
  justify-items: end;
  gap: 7px;
}

.manager-unread-count {
  display: inline-grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
}

.manager-user-online {
  color: var(--success);
}

.manager-loading-state,
.manager-chat-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 9px;
  min-height: 240px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.manager-loading-state strong,
.manager-chat-empty strong {
  color: var(--text);
  font-size: 14px;
}

.manager-loading-dot {
  width: 18px;
  height: 18px;
  border: 2px solid color-mix(in srgb, var(--accent) 24%, var(--border));
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: manager-spin 800ms linear infinite;
}

.manager-detail-pane {
  padding: 0;
  overflow: hidden;
}

.manager-detail-head {
  min-height: 74px;
  padding: 13px 16px;
  background: var(--surface);
}

.manager-detail-head > div {
  min-width: 0;
}

.manager-detail-head h2,
.manager-detail-head span:not(.manager-live-label) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manager-detail-head .manager-live-label {
  margin: 0 0 0 auto;
}

.manager-mobile-back {
  display: none;
}

.manager-message-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 22px;
  background: color-mix(in srgb, var(--surface-2) 72%, var(--surface));
  scrollbar-gutter: stable;
}

.manager-message-row {
  display: flex;
  margin: 5px 0;
}

.manager-message-row.is-outgoing {
  justify-content: flex-end;
}

.manager-message {
  max-width: min(76%, 620px);
  padding: 9px 11px 6px;
  border: 1px solid var(--border);
  border-radius: 8px 8px 8px 3px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 1px color-mix(in srgb, #000 8%, transparent);
}

.manager-message-row.is-outgoing .manager-message {
  border-color: color-mix(in srgb, var(--accent) 32%, var(--border));
  border-radius: 8px 8px 3px 8px;
  background: color-mix(in srgb, var(--accent) 13%, var(--surface));
}

.manager-message p {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.45;
}

.manager-message time {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  text-align: right;
}

.manager-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 9px;
  padding: 11px 13px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.manager-composer textarea {
  width: 100%;
  min-height: 42px;
  max-height: 126px;
  padding: 10px 12px;
  resize: none;
  border-color: var(--border-strong);
  background: var(--surface-2);
  line-height: 1.45;
}

.manager-send-button {
  min-height: 42px;
  min-width: 112px;
}

.manager-detail-note {
  margin: 0;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  text-align: center;
}

.manager-avatar[hidden],
.manager-detail-avatar[hidden],
.manager-composer[hidden],
.manager-message-list[hidden] {
  display: none;
}

@media (max-width: 1180px) {
  .manager-workspace {
    grid-template-columns: 220px 320px minmax(360px, 1fr);
  }
}

@media (max-width: 900px) {
  .manager-workspace {
    grid-template-columns: 210px minmax(300px, 1fr);
    height: auto;
    max-height: none;
  }

  .manager-detail-pane {
    grid-column: 1 / -1;
    min-height: 520px;
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 700px) {
  .manager-workspace {
    display: block;
    min-height: 0;
    overflow: hidden;
  }

  .manager-roster {
    display: block;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .manager-roster-head {
    padding: 14px 14px 7px;
  }

  .manager-account-list {
    display: flex;
    gap: 8px;
    padding: 8px 12px 12px;
    overflow-x: auto;
  }

  .manager-account {
    flex: 0 0 210px;
  }

  .manager-dialog-list {
    min-height: 520px;
    border: 0;
  }

  .manager-detail-pane {
    display: none;
    min-height: 620px;
  }

  .manager-workspace.is-chat-open .manager-dialog-list {
    display: none;
  }

  .manager-workspace.is-chat-open .manager-detail-pane {
    display: flex;
  }

  .manager-mobile-back {
    display: inline-grid;
  }

  .manager-message {
    max-width: 88%;
  }

  .manager-detail-note {
    display: none;
  }
}

@media (max-width: 460px) {
  .manager-pane-head,
  .manager-detail-head {
    padding: 12px;
  }

  .manager-message-list {
    padding: 14px 10px;
  }

  .manager-composer {
    grid-template-columns: 1fr;
  }

  .manager-send-button {
    width: 100%;
  }
}

/* Telegram-style Signals Inbox */
.topbar {
  min-height: var(--topbar-height);
  padding: 10px 18px;
  background: var(--surface);
  backdrop-filter: none;
}

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

.topbar .eyebrow {
  margin-bottom: 2px;
}

.topbar-tools {
  gap: 8px;
}

.search {
  width: clamp(220px, 24vw, 360px);
}

.sidebar {
  width: var(--sidebar-width);
  padding: 14px 10px;
}

.nav a {
  min-height: 36px;
  border-radius: 7px;
  color: #b7c4d1;
}

.nav a:hover {
  background: var(--sidebar-hover);
}

.nav a.active {
  background: #2b5278;
  box-shadow: inset 3px 0 0 #64c8ff;
}

.monitor-card {
  border-color: #263544;
  background: #111b24;
}

.content:has(.signals-workstation) {
  height: calc(100vh - var(--topbar-height));
  padding: 0;
  overflow: hidden;
}

.signals-workstation {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-height));
  margin: -18px -24px -28px;
  min-height: 0;
  background: var(--bg);
}

.content:has(.signals-workstation) .signals-workstation {
  margin: 0;
}

.signals-commandbar {
  flex: 0 0 auto;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 8px 10px;
}

.signals-commandbar .signal-filters {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
}

.signals-commandbar .signal-filters label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 32px;
}

.signals-commandbar .signal-filters label > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.signals-commandbar .signal-filters input,
.signals-commandbar .signal-filters select {
  min-height: 32px;
  border-radius: 7px;
  padding: 6px 8px;
  font-size: 12px;
}

.signals-commandbar .signal-filters label:nth-child(1) {
  flex: 0 0 86px;
}

.signals-commandbar .signal-filters label:nth-child(2) {
  flex: 1 1 190px;
}

.signals-commandbar .signal-filters label:nth-child(3) {
  flex: 1 1 170px;
}

.signals-commandbar .signal-filters label:nth-child(4),
.signals-commandbar .signal-filters label:nth-child(5),
.signals-commandbar .signal-filters label:nth-child(6) {
  flex: 0 1 132px;
}

.signals-commandbar .signal-filters button {
  min-height: 32px;
  flex: 0 0 auto;
  padding: 6px 10px;
  font-size: 12px;
}

.telegram-layout {
  display: grid;
  grid-template-columns: clamp(430px, 37vw, 520px) minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.signal-list-panel {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.signal-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 52px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.signal-list-header strong,
.signal-list-header span {
  display: block;
}

.signal-list-header strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
}

.signal-list-header span {
  color: var(--muted);
  font-size: 12px;
}

.list-counters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.list-counters span {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 7px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.signal-list-scroll {
  min-height: 0;
  overflow: auto;
}

.signal-list-item {
  display: grid;
  gap: 7px;
  min-height: 104px;
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
  transition: background-color 140ms ease, box-shadow 140ms ease, transform 120ms ease;
}

.signal-list-item:hover {
  background: var(--surface-2);
}

.signal-list-item.unread {
  background: color-mix(in srgb, #18b16d 5%, var(--surface));
}

.signal-list-item.unread::before {
  position: absolute;
  inset: 12px auto 12px 0;
  width: 3px;
  border-radius: 999px;
  background: #18b16d;
  content: "";
}

.signal-list-item.selected {
  background: color-mix(in srgb, var(--accent) 13%, var(--surface));
  box-shadow: inset 3px 0 0 var(--accent);
}

.signal-list-item:active {
  transform: scale(.98);
}

.signal-row-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.signal-unread-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #18b16d;
  box-shadow: 0 0 0 4px rgba(24, 177, 109, .13);
}

.signal-status-time {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  min-width: 0;
  white-space: nowrap;
}

.signal-row-time {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  line-height: 1;
}

.signal-row-source {
  min-width: 0;
}

.signal-row-source strong,
.signal-row-source span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signal-row-source strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.signal-row-source span {
  margin-top: 1px;
  color: var(--muted);
  font-size: 12px;
}

.signal-row-text {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  line-height: 1.38;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.signal-row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 7px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 820;
  line-height: 1;
  white-space: nowrap;
}

.status-pill.new {
  border-color: color-mix(in srgb, var(--accent) 24%, transparent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.status-pill.contacted {
  border-color: color-mix(in srgb, var(--success) 26%, transparent);
  background: var(--success-soft);
  color: var(--success);
}

.status-pill.not_relevant {
  border-color: color-mix(in srgb, var(--warning) 25%, transparent);
  background: var(--warning-soft);
  color: var(--warning);
}

.status-pill.do_not_contact {
  border-color: color-mix(in srgb, var(--danger) 28%, transparent);
  background: var(--danger-soft);
  color: var(--danger);
}

.signal-details {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  background: var(--surface-2);
  animation: inspectorIn 160ms ease-out;
}

:root[data-theme="dark"] .signal-details {
  background: #0f151c;
}

.details-chat-header {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  border-bottom: 1px solid var(--border);
  padding: 9px 14px;
  background: var(--surface);
}

.details-source-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #d7f0ff;
  color: #147db5;
  font-weight: 850;
  text-transform: uppercase;
}

:root[data-theme="dark"] .details-source-avatar {
  background: #18374a;
  color: #8fd7ff;
}

.details-source-title {
  min-width: 0;
}

.details-source-title strong,
.details-source-title span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.details-source-title strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 820;
}

.details-source-title span {
  margin-top: 1px;
  color: var(--muted);
  font-size: 12px;
}

.details-score {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.details-scroll {
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.message-bubble {
  width: min(760px, 92%);
  border: 1px solid color-mix(in srgb, var(--accent) 16%, var(--border));
  border-radius: 10px 10px 10px 3px;
  padding: 12px 13px;
  background: var(--surface);
  box-shadow: 0 1px 1px rgba(15, 23, 42, .04);
}

.bubble-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.bubble-meta span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  text-transform: uppercase;
}

.message-bubble p {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 14px;
  line-height: 1.58;
  white-space: pre-wrap;
}

.details-block {
  width: min(760px, 92%);
  margin-top: 14px;
}

.details-block h3 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
  text-transform: uppercase;
}

.reason-panel,
.crm-match {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 11px 12px;
  background: var(--surface);
}

.reason-panel p,
.crm-match span {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.crm-match strong {
  color: var(--text);
  font-size: 13px;
}

.message-source-link {
  display: grid;
  gap: 2px;
  margin-top: 10px;
  padding: 10px 11px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  border-radius: 9px;
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
  transition: background-color 140ms ease, border-color 140ms ease, transform 120ms ease;
}

.message-source-link:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.message-source-link:active {
  transform: scale(.99);
}

.message-source-link strong {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 820;
}

.message-source-link span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.muted-match {
  background: transparent;
}

.details-actions {
  flex: 0 0 auto;
  border-top: 1px solid var(--border);
  padding: 10px 14px;
  background: var(--surface);
}

.details-actions .action-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
}

.details-actions .secondary-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 7px;
  margin-top: 7px;
}

.details-actions .secondary-actions form,
.details-actions .secondary-actions button,
.details-actions .secondary-actions .button {
  width: 100%;
}

.score-badge {
  border-color: color-mix(in srgb, var(--accent) 34%, transparent);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--accent-strong);
}

.keyword-chip,
.contact-chip,
.match-chip,
.muted-chip {
  min-height: 21px;
  padding: 3px 7px;
  font-size: 11px;
}

.keyword-chip {
  background: var(--surface-2);
}

.contact-chip {
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}

.match-chip {
  background: var(--success-soft);
}

.skeleton-loader span {
  background: var(--surface-3);
  animation: skeletonPulse 850ms ease-in-out infinite alternate;
}

@keyframes skeletonPulse {
  from {
    opacity: .45;
  }
  to {
    opacity: 1;
  }
}

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

  .topbar-tools {
    gap: 6px;
  }

  .search {
    width: 210px;
  }

  .signals-commandbar .signal-filters {
    flex-wrap: wrap;
  }

  .signals-commandbar .signal-filters label:nth-child(n) {
    flex: 1 1 138px;
  }

  .signals-commandbar .signal-filters button {
    flex: 0 0 96px;
  }

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

@media (max-width: 920px) {
  .telegram-layout {
    grid-template-columns: minmax(390px, 46vw) minmax(0, 1fr);
  }

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

@media (max-width: 760px) {
  .content:has(.signals-workstation) {
    height: auto;
    overflow: visible;
  }

  .signals-workstation {
    height: auto;
    min-height: calc(100vh - var(--topbar-height));
  }

  .telegram-layout {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .signal-list-panel {
    border-right: 0;
  }

  .signal-details {
    min-height: 620px;
  }
}

/* Simple trigger workflow */
.keyword-simple-layout {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  align-items: start;
}

.keyword-create-panel {
  position: sticky;
  top: 0;
}

.keyword-create-form textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.45;
}

.morphology-choice {
  padding: 12px 0;
  line-height: 1.35;
}

.trigger-list-head {
  margin: 24px 0 12px;
}

.trigger-list-head h3,
.trigger-list-head p {
  margin: 0;
}

.trigger-simple-list {
  display: grid;
  gap: 8px;
}

.trigger-simple-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(68px, auto) auto;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 11px 12px 11px 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  transition: border-color 160ms ease, background-color 160ms ease;
}

.trigger-simple-row > .status {
  min-width: 68px;
  white-space: nowrap;
}

.trigger-simple-row:hover {
  border-color: var(--border-strong);
  background: var(--panel-hover);
}

.trigger-simple-main {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-width: 0;
}

.trigger-simple-main strong,
.trigger-simple-main span {
  display: inline;
  overflow-wrap: anywhere;
}

.trigger-simple-main strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
}

.trigger-simple-main span {
  margin-top: 0;
  color: var(--muted);
  font-size: 12px;
}

.trigger-simple-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.trigger-simple-actions form {
  margin: 0;
}

.trigger-simple-actions .button,
.trigger-simple-actions button {
  min-height: 34px;
  padding: 7px 9px;
  font-size: 12px;
  white-space: nowrap;
}

.keyword-filter-bar {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.keyword-filter-bar > label {
  display: grid;
  grid-column: 1 / -1;
  gap: 6px;
  min-width: 0;
}

.keyword-filter-bar > button,
.keyword-filter-bar > .button {
  min-height: 40px;
  padding-inline: 13px;
  white-space: nowrap;
}

.keyword-filter-bar > button {
  width: 100%;
}

.trigger-editor > summary {
  list-style: none;
  cursor: pointer;
}

.trigger-editor > summary::-webkit-details-marker {
  display: none;
}

.trigger-editor[open] > summary {
  border-color: var(--accent);
  color: var(--accent);
}

.trigger-editor > form {
  position: absolute;
  z-index: 20;
  top: calc(100% + 7px);
  right: 12px;
  display: grid;
  gap: 12px;
  width: min(440px, calc(100vw - 48px));
  padding: 16px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  animation: keywordEditorIn 180ms ease both;
}

.trigger-editor > form label:not(.checkbox) {
  display: grid;
  gap: 6px;
}

.trigger-editor > form label > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

@media (max-width: 980px) {
  .keyword-simple-layout {
    grid-template-columns: 1fr;
  }

  .keyword-create-panel {
    position: static;
    grid-row: 1;
  }
}

@media (max-width: 720px) {
  .keyword-filter-bar {
    grid-template-columns: 1fr;
  }

  .trigger-simple-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .trigger-simple-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .trigger-editor > form {
    position: fixed;
    inset: 12px;
    top: auto;
    right: 12px;
    bottom: 12px;
    width: auto;
    max-height: calc(100dvh - 24px);
    overflow: auto;
  }
}

/* Final Telegram-like workstation polish */
:root {
  --font-main: "Garet", "Gariet", Inter, Manrope, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 10px;
  --row-hover: color-mix(in srgb, var(--accent) 7%, var(--surface));
  --selected: color-mix(in srgb, var(--accent) 14%, var(--surface));
}

body {
  font-family: var(--font-main);
  font-feature-settings: "cv02", "cv03", "cv04", "kern";
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

.workspace,
:root[data-theme="dark"] .workspace {
  background: var(--bg);
}

.sidebar {
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, .02);
}

.nav a {
  position: relative;
  gap: 10px;
}

.nav a::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
  opacity: .34;
}

.nav a.active::before,
.nav a:hover::before {
  opacity: .92;
}

.topbar {
  box-shadow: 0 1px 0 rgba(15, 23, 42, .02);
}

:root[data-theme="dark"] .topbar {
  box-shadow: 0 1px 0 rgba(255, 255, 255, .02);
}

.topbar-tools .button,
.topbar-tools button,
.api-status {
  min-height: 34px;
}

.panel,
.summary-card,
.metrics article,
.source-card,
.suggestion,
.signals-stream,
.signal-list-panel,
.signal-details {
  box-shadow: 0 1px 2px rgba(15, 23, 42, .035);
}

:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .summary-card,
:root[data-theme="dark"] .metrics article,
:root[data-theme="dark"] .source-card,
:root[data-theme="dark"] .suggestion,
:root[data-theme="dark"] .signals-stream,
:root[data-theme="dark"] .signal-list-panel,
:root[data-theme="dark"] .signal-details {
  box-shadow: none;
}

button,
.button {
  border-radius: var(--radius-sm);
  user-select: none;
}

button:focus-visible,
.button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 0;
  box-shadow: var(--ring);
}

button:disabled,
.button[aria-disabled="true"] {
  cursor: default;
  opacity: .62;
  transform: none;
}

button.is-loading,
.button.is-loading {
  position: relative;
  padding-left: 34px;
  pointer-events: none;
}

button.is-loading::before,
.button.is-loading::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 50%;
  width: 13px;
  height: 13px;
  margin-top: -6.5px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
  opacity: .85;
  animation: buttonSpin 700ms linear infinite;
}

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

.button.secondary,
button.secondary {
  border-color: var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
}

.button.secondary:hover,
button.secondary:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

input,
select,
textarea {
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 0 rgba(15, 23, 42, .02);
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--border-strong);
}

input[type="file"] {
  padding: 7px 10px;
  cursor: pointer;
}

.panel + .panel,
.panel + .split,
.split + .panel,
.source-bulk-panel,
.settings-card + .settings-card {
  margin-top: 12px;
}

.section-head {
  min-height: 40px;
}

.section-head .line {
  justify-content: flex-end;
}

.data-table {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.data-table .tr {
  padding-inline: 12px;
  transition: background-color 140ms ease, box-shadow 140ms ease, transform 120ms ease;
}

.data-table .tr:not(.th):hover,
.keyword-row:hover,
.source-card:hover,
.suggestion:hover,
.summary-card:hover,
.metrics article:hover {
  background: var(--row-hover);
}

.data-table a.tr:active,
.keyword-row:active,
.source-card:active {
  transform: scale(.995);
}

.data-table .th {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 38px;
  background: var(--surface-2);
}

.score,
.score-badge {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.score-badge,
.score {
  min-width: 42px;
  background: color-mix(in srgb, var(--accent) 11%, var(--surface));
}

.status,
.status-badge,
.status-pill,
.tag,
.keyword-chip,
.contact-chip,
.match-chip,
.muted-chip {
  border-radius: 999px;
  letter-spacing: 0;
}

.tag,
.keyword-chip {
  color: color-mix(in srgb, var(--text) 72%, var(--muted));
}

.contact-chip {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}

.match-chip {
  border-color: color-mix(in srgb, var(--success) 30%, var(--border));
}

.operation-strip span,
.list-counters span {
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.operation-strip span:hover,
.list-counters span:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.chat-contact-filters {
  grid-template-columns: 180px minmax(260px, 1fr) 150px 130px;
  margin: 14px 0 12px;
  align-items: end;
}

.chat-contact-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 12px;
}

.chat-contact-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  transition: transform 140ms ease, border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.chat-contact-tabs a:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: var(--accent-soft);
  color: var(--accent-strong);
  transform: translateY(-1px);
}

.chat-contact-tabs a.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--accent-strong);
}

.chat-contact-tabs strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
  color: var(--text);
  font-size: 12px;
}

.chat-archive-note {
  display: grid;
  gap: 5px;
  margin: 12px 0 14px;
  padding: 13px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border));
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 4%, var(--surface));
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.chat-archive-note strong {
  color: var(--text);
  font-size: 14px;
}

.chat-contacts-table .tr {
  display: grid;
  grid-template-columns: minmax(170px, 1.2fr) minmax(160px, 1fr) minmax(170px, 1fr) 90px minmax(260px, 1.5fr);
  gap: 12px;
  align-items: start;
}

.chat-contacts-table .tr:not(.th) {
  min-height: 58px;
}

.chat-contacts-table span {
  min-width: 0;
}

.chat-contacts-table small,
.notification-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.chat-source-links {
  display: flex !important;
  flex-wrap: wrap;
  gap: 6px;
}

.chat-source-links a {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 780;
  transition: background-color 140ms ease, border-color 140ms ease, transform 120ms ease;
}

.chat-source-links a:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.chat-source-links a:active {
  transform: scale(.98);
}

.chat-folder-board {
  margin: 18px 0 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 94%, var(--accent-soft));
}

.section-head.compact {
  margin-bottom: 12px;
}

.section-head.compact h3 {
  margin: 2px 0 0;
  font-size: 18px;
}

.chat-folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.chat-folder {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color 160ms ease, background-color 160ms ease, transform 140ms ease;
}

.chat-folder:hover {
  border-color: color-mix(in srgb, var(--folder-color, var(--accent)) 58%, var(--border));
  transform: translateY(-1px);
}

.chat-folder summary {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 62px;
  padding: 12px;
  cursor: pointer;
  list-style: none;
}

.chat-folder summary::-webkit-details-marker {
  display: none;
}

.chat-folder summary strong,
.chat-folder summary small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-folder summary small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.folder-glyph {
  position: relative;
  width: 30px;
  height: 24px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--folder-color, var(--accent)) 82%, white);
  box-shadow: inset 0 -9px 0 color-mix(in srgb, var(--folder-color, var(--accent)) 72%, black 5%);
}

.folder-glyph::before {
  content: "";
  position: absolute;
  left: 3px;
  top: -5px;
  width: 14px;
  height: 8px;
  border-radius: 5px 5px 0 0;
  background: color-mix(in srgb, var(--folder-color, var(--accent)) 72%, white);
}

.chat-folder-users {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 176px;
  overflow: auto;
  padding: 0 12px 12px 56px;
}

.chat-folder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 12px 12px 56px;
  border-top: 1px solid var(--border);
}

.chat-folder-actions a,
.chat-folder-actions button {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.chat-folder-actions .button.compact {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.chat-folder.color-1 { --folder-color: #2AABEE; }
.chat-folder.color-2 { --folder-color: #168A5B; }
.chat-folder.color-3 { --folder-color: #D98A00; }
.chat-folder.color-4 { --folder-color: #7C5CFC; }
.chat-folder.color-5 { --folder-color: #C43D3D; }
.chat-folder.color-6 { --folder-color: #0F766E; }
.chat-folder.color-7 { --folder-color: #4F46E5; }
.chat-folder.color-8 { --folder-color: #64748B; }

.source-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 12px;
}

.source-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 780;
  text-decoration: none;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.source-tabs a strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  padding: 0 7px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 11px;
  font-weight: 850;
}

.source-tabs a:hover,
.source-tabs a.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.source-tabs a:active {
  transform: scale(.98);
}

.source-hero-panel {
  display: grid;
  gap: 12px;
}

.source-page-head {
  align-items: start;
}

.source-header-actions {
  display: grid;
  justify-items: end;
  gap: 10px;
  min-width: min(620px, 100%);
}

.source-header-actions > button {
  min-height: 40px;
  padding-inline: 16px;
}

.source-counters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.source-counters span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.source-counters span:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.source-counters strong {
  color: var(--text);
  font-size: 13px;
}

.source-tool-panel {
  display: grid;
  gap: 12px;
}

.discovery-status-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  border-left: 3px solid var(--accent);
  animation: inspectorIn 170ms ease-out;
}

.discovery-status-panel.success {
  border-left-color: var(--success);
}

.discovery-status-panel.warning {
  border-left-color: var(--warning);
}

.discovery-status-panel.danger {
  border-left-color: var(--danger);
}

.discovery-status-panel h2,
.discovery-status-panel p {
  margin: 0;
}

.discovery-status-panel h2 {
  font-size: 18px;
}

.discovery-status-panel p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.5;
}

.discovery-status-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.source-tool-head {
  display: grid;
  gap: 2px;
}

.source-tool-head h2 {
  margin: 0;
  font-size: 18px;
}

.source-list-filter-form,
.source-auto-form,
.source-import-form {
  display: grid;
  gap: 10px;
  align-items: end;
}

.source-list-filter-form {
  grid-template-columns: minmax(280px, 1fr) 110px repeat(3, minmax(140px, .42fr)) 124px 104px;
}

.source-auto-form {
  grid-template-columns: minmax(320px, 1fr) minmax(180px, .34fr) 148px;
}

.source-list-filter-form label,
.source-auto-form label,
.source-import-form label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.source-list-filter-form label > span,
.source-auto-form label > span,
.source-import-form label > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
}

.source-list-filter-form input,
.source-list-filter-form select,
.source-list-filter-form button,
.source-list-filter-form .button,
.source-auto-form input,
.source-auto-form select,
.source-auto-form button,
.source-import-form textarea,
.source-import-form select,
.source-import-form button {
  min-height: 42px;
}

.source-list-filter-form input,
.source-list-filter-form select,
.source-auto-form input,
.source-auto-form select,
.source-import-form textarea,
.source-import-form select {
  width: 100%;
  background: var(--surface);
}

.source-search-field,
.source-topic-field,
.source-import-text {
  min-width: 0;
}

.source-reset-link {
  color: var(--muted);
}

.source-hint {
  margin: -2px 0 0;
  font-size: 13px;
}

.source-import-accordion {
  padding: 0;
  overflow: hidden;
}

.source-import-accordion summary {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 16px;
  cursor: pointer;
  color: var(--text);
  font-size: 14px;
  font-weight: 820;
  transition: background-color 140ms ease, color 140ms ease;
}

.source-import-accordion summary:hover {
  background: var(--surface-2);
  color: var(--accent-strong);
}

.source-import-form {
  grid-template-columns: minmax(280px, 1fr) minmax(190px, .3fr) 140px;
  padding: 0 16px 16px;
  animation: inspectorIn 160ms ease-out;
}

.source-import-form textarea {
  resize: vertical;
}

@media (max-width: 1180px) {
  .source-page-head {
    grid-template-columns: 1fr;
  }

  .source-header-actions {
    justify-items: start;
    min-width: 0;
  }

  .source-counters {
    justify-content: flex-start;
  }

  .source-list-filter-form {
    grid-template-columns: minmax(260px, 1fr) 110px repeat(3, minmax(130px, 1fr));
  }

  .source-list-filter-form .source-reset-link {
    grid-column: auto;
  }

  .source-auto-form,
  .source-import-form {
    grid-template-columns: minmax(260px, 1fr) minmax(160px, .45fr) 140px;
  }
}

@media (max-width: 760px) {
  .source-list-filter-form,
  .source-auto-form,
  .source-import-form {
    grid-template-columns: 1fr;
  }

  .source-list-filter-form button,
  .source-list-filter-form .button,
  .source-auto-form button,
  .source-import-form button {
    width: 100%;
  }

  .source-tabs {
    gap: 6px;
  }

  .source-tabs a,
  .source-counters span {
    flex: 1 1 auto;
    justify-content: center;
  }
}

.source-filter-bar {
  grid-template-columns: minmax(160px, .8fr) minmax(190px, .9fr) minmax(260px, 1.4fr) 138px 120px;
  margin: 12px 0 14px;
}

.keyword-filter-bar {
  grid-template-columns: minmax(260px, 1fr) 120px 110px;
  margin: 12px 0 14px;
}

.keyword-row-compact {
  grid-template-columns: 120px minmax(0, 1fr) 112px auto auto;
}

.keyword-row-compact strong {
  overflow-wrap: anywhere;
}

.operation-strip.danger span {
  border-color: color-mix(in srgb, var(--danger) 42%, var(--border));
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  color: var(--danger);
}

.operation-strip.warning span {
  border-color: color-mix(in srgb, var(--warning) 40%, var(--border));
  background: color-mix(in srgb, var(--warning) 10%, var(--surface));
  color: color-mix(in srgb, var(--warning) 78%, var(--text));
}

.chat-contacts-table .tag {
  display: inline-flex;
  width: fit-content;
  margin: 0 0 4px;
}

.notification-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.notification-list.compact {
  gap: 8px;
}

.notification-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: background-color 160ms ease, border-color 160ms ease, transform 120ms ease;
}

.notification-card:hover {
  background: var(--row-hover);
}

.notification-card:active {
  transform: scale(.998);
}

.notification-card strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.25;
}

.notification-card p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.notification-card.warning {
  border-left-color: var(--warning);
}

.notification-card.danger,
.notification-card.error {
  border-left-color: var(--danger);
}

.notification-card.success {
  border-left-color: var(--success);
}

.notification-card.info {
  border-left-color: var(--accent);
}

.status.warning {
  border-color: color-mix(in srgb, var(--warning) 32%, var(--border));
  background: var(--warning-soft);
  color: var(--warning);
}

.status.danger,
.status.error {
  border-color: color-mix(in srgb, var(--danger) 32%, var(--border));
  background: var(--danger-soft);
  color: var(--danger);
}

.status.info {
  border-color: color-mix(in srgb, var(--accent) 32%, var(--border));
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.signals-workstation {
  border-top: 1px solid var(--border);
}

.signals-commandbar {
  box-shadow: 0 1px 0 rgba(15, 23, 42, .02);
}

.signal-list-header {
  background: color-mix(in srgb, var(--surface) 88%, var(--surface-2));
}

.signal-list-scroll {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--muted) 30%, transparent) transparent;
}

.signal-list-item {
  position: relative;
}

.signal-list-item::after {
  position: absolute;
  inset: 0;
  border: 1px solid transparent;
  border-radius: 0;
  content: "";
  pointer-events: none;
  transition: border-color 140ms ease;
}

.signal-list-item:hover::after {
  border-color: color-mix(in srgb, var(--accent) 16%, transparent);
}

.signal-list-item.selected {
  background: var(--selected);
}

.signal-list-item.selected::after {
  border-color: color-mix(in srgb, var(--accent) 24%, transparent);
}

.signal-row-text {
  color: color-mix(in srgb, var(--text) 88%, var(--muted));
}

.signal-details {
  border-left: 0;
}

.details-scroll {
  scrollbar-width: thin;
}

.message-bubble {
  box-shadow: 0 1px 1px rgba(15, 23, 42, .05);
}

.reason-panel,
.crm-match,
.source-link,
.settings-card,
.sample-message {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .26);
}

:root[data-theme="dark"] .reason-panel,
:root[data-theme="dark"] .crm-match,
:root[data-theme="dark"] .source-link,
:root[data-theme="dark"] .settings-card,
:root[data-theme="dark"] .sample-message {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .025);
}

.details-actions button,
.details-actions .button {
  min-width: 0;
  white-space: normal;
}

.source-card {
  min-height: 230px;
}

.source-card-head {
  align-items: flex-start;
}

.source-select {
  width: fit-content;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--surface-2);
}

.source-select:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.keyword-row {
  border-radius: var(--radius-sm);
  transition: background-color 140ms ease, border-color 140ms ease, transform 120ms ease;
}

.keyword-row:hover {
  border-color: var(--border-strong);
}

.suggestion {
  transition: background-color 140ms ease, border-color 140ms ease, transform 120ms ease, box-shadow 140ms ease;
}

.suggestion:hover {
  border-color: var(--border-strong);
}

.empty-state,
.empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.toast {
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.info {
  border-left-color: var(--accent);
}

.toast.warning {
  border-left-color: var(--warning);
}

.toast.error {
  border-left-color: var(--danger);
}

.toast.success {
  border-left-color: var(--success);
}

.toast.info strong {
  color: var(--accent-strong);
}

.toast.warning strong {
  color: var(--warning);
}

.toast.error strong {
  color: var(--danger);
}

.toast.success strong {
  color: var(--success);
}

.skeleton-loader span {
  background: var(--surface-3);
  animation: skeletonPulse 850ms ease-in-out infinite alternate;
}

@media (max-width: 1120px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    height: auto;
  }

  .topbar-tools {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

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

@media (max-width: 760px) {
  .topbar-tools .button,
  .topbar-tools button,
  .api-status,
  .search {
    width: 100%;
  }

  .source-card {
    min-height: auto;
  }
}

.auth-body {
  min-height: 100vh;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent-soft) 56%, transparent), transparent 46%),
    var(--bg);
}

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

.auth-panel {
  width: min(100%, 440px);
  display: grid;
  gap: 14px;
}

.auth-panel h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
  color: var(--text);
}

.auth-panel p {
  margin: 0;
  color: var(--muted);
}

.auth-kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.auth-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.auth-card h2 {
  margin: 0;
  font-size: 16px;
}

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

.auth-form label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.auth-form input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  outline: none;
}

.auth-form input:focus {
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.auth-alert,
.auth-note {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--warning);
  background: var(--warning-soft);
  color: var(--text);
  font-size: 13px;
}

.telegram-login-slot {
  min-height: 42px;
}

.inline-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-actions select {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.status-approved {
  color: var(--success);
  background: var(--success-soft);
}

.status-pending {
  color: var(--warning);
  background: var(--warning-soft);
}

.status-rejected {
  color: var(--danger);
  background: var(--danger-soft);
}

/* Mobile Telegram WebApp layout guard */
@media (max-width: 760px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .workstation-shell {
    display: block;
    min-height: 100vh;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    width: 100%;
    height: auto;
    max-height: none;
    padding: 8px 8px 7px;
    border-right: 0;
    border-bottom: 1px solid var(--sidebar-border);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .sidebar::-webkit-scrollbar {
    display: none;
  }

  .nav {
    display: flex;
    width: max-content;
    min-width: 100%;
    gap: 6px;
  }

  .nav a {
    flex: 0 0 auto;
    min-height: 34px;
    max-width: 178px;
    border-radius: 999px;
    padding: 8px 11px;
    font-size: 12px;
    line-height: 1.12;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: none;
  }

  .nav a::before {
    width: 5px;
    height: 5px;
    flex: 0 0 auto;
  }

  .nav a.active {
    background: #2b5278;
    box-shadow: inset 0 -2px 0 #64c8ff;
  }

  .monitor-card {
    display: none;
  }

  .workspace {
    width: 100%;
    min-width: 0;
    overflow: visible;
  }

  .topbar {
    position: sticky;
    top: 49px;
    z-index: 35;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    min-height: 0;
    padding: 12px 12px 10px;
    border-bottom: 1px solid var(--border);
  }

  .topbar h1 {
    max-width: 100%;
    font-size: 22px;
    white-space: normal;
  }

  .topbar .eyebrow {
    font-size: 10px;
    line-height: 1.2;
  }

  .topbar-tools {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }

  .topbar-tools .search,
  .topbar-tools .api-status,
  .topbar-tools > span.api-status {
    grid-column: 1 / -1;
  }

  .topbar-tools .search,
  .topbar-tools .button,
  .topbar-tools button,
  .topbar-tools .api-status {
    width: 100%;
    min-width: 0;
  }

  .topbar-tools .button,
  .topbar-tools button,
  .topbar-tools .api-status {
    min-height: 36px;
    padding-inline: 10px;
    font-size: 12px;
  }

  .content {
    width: 100%;
    padding: 12px;
    overflow: visible;
  }

  .content:has(.signals-workstation) {
    height: auto;
    overflow: visible;
  }

  .signals-workstation {
    height: auto;
    min-height: 0;
    margin: 0;
  }

  .signals-commandbar {
    position: static;
    padding: 10px 0 12px;
    border-bottom: 0;
    background: transparent;
  }

  .signals-commandbar .signal-filters,
  .signal-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .signal-filters label {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    min-height: 0;
  }

  .signal-filters label > span {
    font-size: 11px;
  }

  .signal-filters input,
  .signal-filters select {
    min-height: 38px;
    font-size: 13px;
  }

  .signal-filters button {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 42px;
  }

  .telegram-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    height: auto;
    overflow: visible;
  }

  .signal-list-panel,
  .signal-details {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
  }

  .signal-list-panel {
    max-height: none;
    overflow: visible;
  }

  .signal-list-scroll {
    max-height: none;
    overflow: visible;
  }

  .signal-list-item {
    padding: 11px 12px;
  }

  .signal-row-top {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 9px;
  }

  .signal-status-time {
    grid-column: 2;
    justify-self: start;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px;
  }

  .signal-row-meta,
  .chip-list {
    gap: 6px;
  }

  .signal-details {
    min-height: 0;
    max-height: none;
  }

  .details-chat-header {
    align-items: flex-start;
    gap: 10px;
  }

  .details-score {
    align-items: flex-end;
  }

  .details-scroll {
    max-height: none;
    overflow: visible;
  }

  .details-actions {
    position: static;
  }

  .details-actions .action-grid,
  .secondary-actions {
    grid-template-columns: 1fr;
  }

  .split,
  .settings-grid,
  .faq-grid,
  .faq-steps,
  .faq-status-list,
  .source-card-grid,
  .suggestion-grid,
  .dashboard-grid {
    grid-template-columns: 1fr !important;
  }

  .faq-hero {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .panel,
  .source-card,
  .settings-card {
    min-width: 0;
  }

  .two-col,
  .source-rank-grid,
  .discovery-search,
  .source-card-head,
  .section-head {
    grid-template-columns: 1fr !important;
  }

  .section-head {
    display: grid;
    align-items: stretch;
    gap: 10px;
  }

  .section-head .line,
  .source-actions,
  .source-bulk-panel .line,
  .operation-strip {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .data-table {
    display: grid;
    gap: 10px;
  }

  .data-table .tr.th {
    display: none;
  }

  .data-table .tr {
    display: grid;
    grid-template-columns: 1fr !important;
    gap: 8px;
    align-items: start;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
  }

  .account-edit-row input,
  .account-edit-row select,
  .account-edit-row textarea,
  .account-actions,
  .account-session-cell {
    width: 100%;
  }

  .account-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .login-flow-card {
    padding: 12px;
  }

  .telegram-account-card {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .telegram-account-card > .status {
    grid-column: 2;
    justify-self: start;
  }
}

@media (max-width: 420px) {
  .topbar-tools,
  .signals-commandbar .signal-filters,
  .signal-filters {
    grid-template-columns: 1fr;
  }

  .topbar {
    top: 48px;
  }

  .nav a {
    max-width: 150px;
  }

  .score-badge {
    min-width: 36px;
  }
}

/* FAQ documentation page */
.faq-doc {
  display: grid;
  gap: 14px;
  max-width: 1280px;
  margin: 0 auto;
}

.faq-doc .panel {
  min-width: 0;
}

.faq-animate {
  animation: faqRise 180ms ease-out both;
}

.faq-animate:nth-child(2) {
  animation-delay: 35ms;
}

.faq-animate:nth-child(3) {
  animation-delay: 70ms;
}

.faq-animate:nth-child(4) {
  animation-delay: 105ms;
}

.faq-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  min-height: 168px;
  padding: 24px;
  border-color: color-mix(in srgb, var(--accent) 18%, var(--border));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 4%, transparent), transparent),
    var(--surface);
}

.faq-hero-copy {
  max-width: 840px;
  min-width: 0;
}

.faq-hero h2 {
  max-width: 760px;
  margin: 0;
  color: var(--text);
  font-size: clamp(22px, 2.2vw, 30px);
  line-height: 1.12;
}

.faq-hero p {
  max-width: 820px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.faq-hero-actions {
  display: grid;
  gap: 8px;
  min-width: 180px;
}

.faq-anchor-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.faq-anchor-grid a {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 70px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .035);
  transition: background-color 150ms ease, border-color 150ms ease, transform 120ms ease;
}

.faq-anchor-grid a:hover {
  border-color: color-mix(in srgb, var(--accent) 32%, var(--border));
  background: var(--row-hover);
}

.faq-anchor-grid a:active {
  transform: scale(.99);
}

.faq-anchor-grid span,
.faq-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
}

.faq-anchor-grid strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 780;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.faq-section {
  scroll-margin-top: calc(var(--topbar-height) + 20px);
}

.faq-step-grid,
.faq-module-grid,
.faq-status-grid,
.faq-rule-grid {
  display: grid;
  gap: 10px;
}

.faq-step-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.faq-step-grid article,
.faq-status-grid article,
.faq-rule-grid article,
.faq-module-card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: background-color 150ms ease, border-color 150ms ease, transform 120ms ease, box-shadow 150ms ease;
}

.faq-step-grid article {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 190px;
  padding: 15px;
}

.faq-step-grid article:hover,
.faq-status-grid article:hover,
.faq-rule-grid article:hover,
.faq-module-card:hover {
  border-color: color-mix(in srgb, var(--accent) 26%, var(--border));
  background: var(--row-hover);
}

.faq-step-grid article:active,
.faq-status-grid article:active,
.faq-rule-grid article:active,
.faq-module-card:active {
  transform: scale(.995);
}

.faq-step-grid article > span {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 850;
}

.faq-step-grid strong,
.faq-module-card h3,
.faq-status-grid strong,
.faq-rule-grid strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.22;
}

.faq-step-grid p,
.faq-module-card p,
.faq-module-card small,
.faq-status-grid p,
.faq-rule-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.48;
  overflow-wrap: anywhere;
}

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

.faq-module-card {
  display: grid;
  grid-template-rows: minmax(190px, 1fr) auto;
  gap: 12px;
  min-height: 258px;
  padding: 16px;
}

.faq-module-card > div {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
}

.faq-module-card h3 {
  margin: 0;
  font-size: 17px;
}

.faq-module-card small {
  display: block;
  min-height: 44px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.faq-status-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.faq-status-grid article {
  display: grid;
  align-content: start;
  gap: 9px;
  min-height: 154px;
  padding: 14px;
}

.faq-status-grid .status {
  justify-self: start;
}

.faq-rule-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.faq-rule-grid article {
  display: grid;
  align-content: start;
  gap: 9px;
  min-height: 150px;
  padding: 16px;
}

@keyframes faqRise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1180px) {
  .faq-step-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

@media (max-width: 940px) {
  .faq-hero,
  .faq-anchor-grid,
  .faq-module-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 680px) {
  .faq-doc {
    gap: 12px;
  }

  .faq-hero {
    min-height: 0;
    padding: 18px;
  }

  .faq-hero h2 {
    font-size: 23px;
  }

  .faq-hero-actions,
  .faq-step-grid,
  .faq-status-grid,
  .faq-rule-grid {
    grid-template-columns: 1fr;
  }

  .faq-step-grid article,
  .faq-module-card,
  .faq-status-grid article,
  .faq-rule-grid article {
    min-height: auto;
  }

  .faq-module-card {
    grid-template-rows: auto auto;
  }

  .faq-module-card small {
    min-height: 0;
  }
}

/* FAQ v2: polished manager documentation */
.faq-v2 {
  display: grid;
  gap: 18px;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding-bottom: 24px;
}

.faq-v2 .panel {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .045);
}

.faq-v2 .faq-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 24px;
  align-items: center;
  min-height: 190px;
  padding: 28px;
  border-color: color-mix(in srgb, var(--accent) 20%, var(--border));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 5%, transparent), transparent 70%),
    var(--surface);
}

.faq-v2 .faq-hero-copy {
  display: grid;
  gap: 12px;
  min-width: 0;
  max-width: 860px;
}

.faq-v2 .faq-hero .eyebrow,
.faq-v2 .section-head .eyebrow {
  margin: 0;
}

.faq-v2 .faq-hero h2,
.faq-v2 .section-head h2 {
  margin: 0;
  color: var(--text);
  letter-spacing: 0;
}

.faq-v2 .faq-hero h2 {
  max-width: 780px;
  font-size: 28px;
  line-height: 1.18;
}

.faq-v2 .faq-hero p {
  max-width: 900px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.58;
}

.faq-v2 .faq-hero-actions {
  display: grid;
  gap: 10px;
  align-self: stretch;
  align-content: center;
  min-width: 0;
}

.faq-v2 .faq-hero-actions .button {
  width: 100%;
  justify-content: center;
}

.faq-quick-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.faq-quick-nav a {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 3px;
  align-items: center;
  min-height: 84px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 6px 18px rgba(15, 23, 42, .035);
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 120ms ease;
}

.faq-quick-nav a:hover {
  border-color: color-mix(in srgb, var(--accent) 32%, var(--border));
  background: var(--row-hover);
  box-shadow: 0 10px 26px rgba(15, 23, 42, .07);
}

.faq-quick-nav a:active {
  transform: scale(.99);
}

.faq-quick-nav span,
.faq-index {
  display: inline-grid;
  place-items: center;
  width: 42px;
  min-width: 42px;
  height: 32px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border));
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
}

.faq-quick-nav strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  font-weight: 820;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.faq-quick-nav small {
  grid-column: 2;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.faq-section-card {
  display: grid;
  gap: 18px;
  padding: 22px;
  scroll-margin-top: calc(var(--topbar-height) + 24px);
}

.faq-v2 .section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  margin: 0;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--border);
}

.faq-v2 .section-head h2 {
  margin-top: 4px;
  font-size: 22px;
  line-height: 1.22;
}

.faq-v2 .faq-step-grid,
.faq-v2 .faq-module-grid,
.faq-v2 .faq-status-grid,
.faq-v2 .faq-rule-grid {
  display: grid;
  gap: 12px;
  margin: 0;
}

.faq-v2 .faq-step-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.faq-v2 .faq-module-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.faq-v2 .faq-status-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.faq-v2 .faq-rule-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.faq-v2 .faq-step-card,
.faq-v2 .faq-module-card,
.faq-v2 .faq-status-grid article,
.faq-v2 .faq-rule-grid article {
  display: grid;
  align-content: start;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  box-shadow: none;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 120ms ease;
}

.faq-v2 .faq-step-card {
  grid-template-rows: 36px auto 1fr;
  gap: 11px;
  min-height: 218px;
  padding: 16px;
}

.faq-v2 .faq-step-card > span {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 850;
}

.faq-v2 .faq-module-card {
  grid-template-rows: auto auto minmax(92px, 1fr) auto;
  gap: 10px;
  min-height: 246px;
  padding: 16px;
}

.faq-v2 .faq-status-grid article,
.faq-v2 .faq-rule-grid article {
  gap: 10px;
  min-height: 164px;
  padding: 16px;
}

.faq-v2 .faq-rule-grid article {
  min-height: 178px;
}

.faq-v2 .faq-step-card:hover,
.faq-v2 .faq-module-card:hover,
.faq-v2 .faq-status-grid article:hover,
.faq-v2 .faq-rule-grid article:hover {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(15, 23, 42, .06);
  transform: translateY(-1px);
}

.faq-v2 .faq-step-card:active,
.faq-v2 .faq-module-card:active,
.faq-v2 .faq-status-grid article:active,
.faq-v2 .faq-rule-grid article:active {
  transform: scale(.995);
}

.faq-v2 .faq-step-card strong,
.faq-v2 .faq-module-card h3,
.faq-v2 .faq-status-grid strong,
.faq-v2 .faq-rule-grid strong {
  min-width: 0;
  margin: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 820;
  line-height: 1.28;
}

.faq-v2 .faq-module-card h3 {
  font-size: 17px;
}

.faq-v2 .faq-step-card p,
.faq-v2 .faq-module-card p,
.faq-v2 .faq-module-card small,
.faq-v2 .faq-status-grid p,
.faq-v2 .faq-rule-grid p {
  min-width: 0;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.52;
  overflow-wrap: anywhere;
}

.faq-v2 .faq-module-card small {
  align-self: end;
  min-height: 42px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.faq-v2 .faq-status-grid .status {
  justify-self: start;
  max-width: 100%;
}

.faq-v2 .faq-animate {
  animation: faqCardIn 190ms ease-out both;
}

.faq-v2 .faq-animate:nth-child(2) {
  animation-delay: 35ms;
}

.faq-v2 .faq-animate:nth-child(3) {
  animation-delay: 70ms;
}

.faq-v2 .faq-animate:nth-child(4) {
  animation-delay: 105ms;
}

.faq-v2 .faq-animate:nth-child(5) {
  animation-delay: 140ms;
}

@keyframes faqCardIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1220px) {
  .faq-v2 .faq-step-grid,
  .faq-v2 .faq-status-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 980px) {
  .faq-v2 .faq-hero {
    grid-template-columns: 1fr;
  }

  .faq-v2 .faq-hero-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .faq-quick-nav,
  .faq-v2 .faq-module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .faq-v2 {
    gap: 12px;
  }

  .faq-v2 .faq-hero,
  .faq-section-card {
    padding: 16px;
    border-radius: 12px;
  }

  .faq-v2 .faq-hero h2 {
    font-size: 24px;
  }

  .faq-v2 .faq-hero-actions,
  .faq-quick-nav,
  .faq-v2 .faq-step-grid,
  .faq-v2 .faq-module-grid,
  .faq-v2 .faq-status-grid,
  .faq-v2 .faq-rule-grid {
    grid-template-columns: 1fr;
  }

  .faq-v2 .faq-step-card,
  .faq-v2 .faq-module-card,
  .faq-v2 .faq-status-grid article,
  .faq-v2 .faq-rule-grid article {
    min-height: auto;
  }

  .faq-v2 .faq-module-card {
    grid-template-rows: auto auto auto auto;
  }

  .faq-v2 .faq-module-card small {
    min-height: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .faq-v2 .faq-animate {
    animation: none;
  }
}

/* Workstation polish: discovery, dashboard, keyword monitor */
:root {
  --field-border: color-mix(in srgb, var(--border-strong) 82%, var(--accent) 18%);
  --field-bg: color-mix(in srgb, var(--surface) 92%, var(--bg) 8%);
  --panel-shadow: 0 10px 26px rgba(15, 23, 42, .055);
  --panel-shadow-hover: 0 16px 34px rgba(15, 23, 42, .085);
}

:root[data-theme="dark"] {
  --field-border: color-mix(in srgb, var(--border-strong) 74%, var(--accent) 26%);
  --field-bg: color-mix(in srgb, var(--surface) 86%, #0f1722 14%);
  --panel-shadow: 0 14px 30px rgba(0, 0, 0, .24);
  --panel-shadow-hover: 0 18px 38px rgba(0, 0, 0, .32);
}

.source-hero-panel,
.source-tool-panel,
.source-bulk-panel,
.source-import-accordion,
.metrics article,
.dashboard-table,
.split > .panel,
.scan-results-panel {
  border-color: color-mix(in srgb, var(--border) 78%, var(--accent) 22%);
  box-shadow: var(--panel-shadow);
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 140ms ease;
}

.source-tool-panel:hover,
.source-import-accordion:hover,
.metrics article:hover,
.split > .panel:hover,
.source-bulk-panel:hover {
  border-color: color-mix(in srgb, var(--border-strong) 62%, var(--accent) 38%);
  box-shadow: var(--panel-shadow-hover);
}

.source-hero-panel {
  padding: 22px;
  gap: 18px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, var(--accent) 4%), var(--surface));
}

:root[data-theme="dark"] .source-hero-panel {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 92%, var(--accent) 8%), var(--surface));
}

.source-page-head h2,
.source-tool-head h2,
.split > .panel .section-head h2,
.dashboard-table + h2 {
  letter-spacing: 0;
}

.source-header-actions {
  gap: 12px;
}

.source-counters span,
.source-tabs a {
  border-width: 1.5px;
  box-shadow: 0 1px 0 rgba(15, 23, 42, .03);
}

.source-counters span {
  min-height: 34px;
  padding: 6px 11px;
  background: color-mix(in srgb, var(--surface) 88%, var(--accent-soft) 12%);
}

.source-tabs {
  gap: 10px;
  margin-top: 8px;
  margin-bottom: 0;
}

.source-tabs a {
  min-height: 38px;
  padding-inline: 15px;
  background: var(--field-bg);
}

.source-tabs a:hover,
.source-tabs a.active {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(42, 171, 238, .12);
}

.source-tabs a:active {
  transform: scale(.98);
}

.source-tool-panel {
  padding: 18px;
  gap: 15px;
}

.source-tool-head {
  padding-bottom: 2px;
}

.source-list-filter-form,
.source-auto-form,
.keyword-filter-bar {
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--border) 74%, var(--accent) 26%);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-2) 80%, var(--surface) 20%);
}

.source-list-filter-form label > span,
.source-auto-form label > span,
.source-import-form label > span,
.keyword-filter-bar label > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
}

.source-list-filter-form input,
.source-list-filter-form select,
.source-auto-form input,
.source-auto-form select,
.source-import-form textarea,
.source-import-form select,
.keyword-filter-bar input,
.keyword-filter-bar select,
.split aside .stack input,
.split aside .stack select,
.split aside .stack textarea {
  min-height: 46px;
  border-width: 2px;
  border-color: var(--field-border);
  background: var(--field-bg);
  font-weight: 760;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 140ms ease;
}

.source-list-filter-form input:hover,
.source-list-filter-form select:hover,
.source-auto-form input:hover,
.source-auto-form select:hover,
.source-import-form textarea:hover,
.source-import-form select:hover,
.keyword-filter-bar input:hover,
.keyword-filter-bar select:hover,
.split aside .stack input:hover,
.split aside .stack select:hover,
.split aside .stack textarea:hover {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border-strong));
  background: var(--surface);
}

.source-list-filter-form input:focus,
.source-list-filter-form select:focus,
.source-auto-form input:focus,
.source-auto-form select:focus,
.source-import-form textarea:focus,
.source-import-form select:focus,
.keyword-filter-bar input:focus,
.keyword-filter-bar select:focus,
.split aside .stack input:focus,
.split aside .stack select:focus,
.split aside .stack textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
  transform: translateY(-1px);
}

.source-list-filter-form button,
.source-list-filter-form .button,
.source-auto-form button,
.source-import-form button,
.keyword-filter-bar button,
.keyword-filter-bar .button,
.split aside .stack button {
  min-height: 46px;
  padding-inline: 17px;
  font-weight: 850;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease,
    transform 120ms ease;
}

.source-list-filter-form button:hover,
.source-auto-form button:hover,
.source-import-form button:hover,
.keyword-filter-bar button:hover,
.split aside .stack button:hover {
  box-shadow: 0 9px 20px rgba(42, 171, 238, .18);
  transform: translateY(-1px);
}

.source-list-filter-form button:active,
.source-list-filter-form .button:active,
.source-auto-form button:active,
.source-import-form button:active,
.keyword-filter-bar button:active,
.keyword-filter-bar .button:active,
.split aside .stack button:active {
  transform: scale(.98);
}

.discovery-status-panel {
  border-left-width: 5px;
  border-radius: 12px;
  padding: 17px 18px;
  box-shadow: var(--panel-shadow);
  animation: workstationPanelIn 190ms ease-out both;
}

.discovery-status-panel h2 {
  font-size: 19px;
  font-weight: 860;
}

.discovery-status-panel p {
  max-width: 1100px;
}

.source-import-accordion {
  border-radius: 12px;
}

.source-import-accordion summary {
  min-height: 56px;
  padding-inline: 18px;
}

.source-import-accordion[open] summary {
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 84%, var(--accent-soft) 16%);
}

.source-import-form {
  padding: 16px 18px 18px;
}

.source-bulk-panel {
  padding: 18px;
}

.source-card-grid {
  gap: 14px;
}

.source-card {
  position: relative;
  border-width: 1.5px;
  border-radius: 12px;
  padding: 16px;
  overflow: hidden;
  background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface) 88%, var(--surface-2) 12%));
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 140ms ease;
}

.source-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: color-mix(in srgb, var(--accent) 70%, var(--border));
  content: "";
  opacity: .78;
}

.source-card:hover {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--border-strong));
  box-shadow: var(--panel-shadow-hover);
  transform: translateY(-1px);
}

.source-card:active {
  transform: scale(.995);
}

.source-card-head h3 {
  font-size: 16px;
  font-weight: 880;
  line-height: 1.25;
}

.source-card-head > span.score,
.source-card .score {
  min-width: 48px;
  height: 34px;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent-strong);
}

.source-rank-grid {
  gap: 8px;
}

.source-rank-grid span {
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface-2) 82%, var(--accent-soft) 18%);
}

.sample-message {
  border-radius: 10px;
  border-color: color-mix(in srgb, var(--border) 80%, var(--accent) 20%);
  background: color-mix(in srgb, var(--surface-2) 88%, var(--surface) 12%);
}

.metrics {
  gap: 14px;
  margin-bottom: 16px;
}

.metrics article {
  position: relative;
  min-height: 94px;
  padding: 16px;
  overflow: hidden;
}

.metrics article::before {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 20%, transparent));
  content: "";
}

.metrics article:hover {
  transform: translateY(-1px);
}

.metrics span {
  font-size: 12px;
  font-weight: 850;
}

.metrics strong {
  margin-top: 10px;
  font-size: 30px;
  font-weight: 900;
}

.dashboard-table {
  border-radius: 12px;
}

.dashboard-table .tr {
  min-height: 50px;
  padding: 12px 14px;
}

.dashboard-table .tr:not(.th):hover {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.split {
  gap: 16px;
}

.split > .panel {
  border-radius: 12px;
  padding: 18px;
}

.keyword-filter-bar {
  grid-template-columns: minmax(320px, 1fr) 170px 118px;
  gap: 12px;
  margin: 16px 0;
}

.keyword-list {
  gap: 10px;
}

.keyword-source-bridge {
  display: grid;
  gap: 14px;
  margin: 16px 0;
  border: 1.5px solid color-mix(in srgb, var(--accent) 24%, var(--border));
  border-radius: 16px;
  padding: 16px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent-soft) 22%, transparent), transparent 70%),
    var(--surface);
  box-shadow: var(--panel-shadow);
  animation: workstationPanelIn 170ms ease-out both;
}

.keyword-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.keyword-flow span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--border));
  border-radius: 999px;
  padding: 0 12px;
  background: color-mix(in srgb, var(--surface-2) 72%, var(--surface) 28%);
  color: var(--muted);
  font-size: 12px;
  font-weight: 880;
  white-space: nowrap;
}

.keyword-source-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: end;
}

.keyword-source-head h3,
.keyword-source-head p {
  margin: 0;
}

.keyword-source-head h3 {
  margin-top: 4px;
  font-size: 20px;
  line-height: 1.2;
}

.keyword-source-head p:not(.eyebrow) {
  margin-top: 8px;
  max-width: 780px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.keyword-source-head form {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.keyword-source-head button {
  min-height: 42px;
  white-space: nowrap;
}

.source-topic-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.source-topic-chip {
  display: grid;
  gap: 3px;
  max-width: 280px;
  border: 1px solid color-mix(in srgb, var(--border) 72%, var(--accent) 28%);
  border-radius: 14px;
  padding: 9px 12px;
  background: color-mix(in srgb, var(--surface-2) 78%, var(--surface) 22%);
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    transform 120ms ease,
    box-shadow 160ms ease;
}

.source-topic-chip:hover {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
  background: color-mix(in srgb, var(--accent-soft) 20%, var(--surface));
  box-shadow: 0 8px 18px rgba(15, 23, 42, .05);
  transform: translateY(-1px);
}

.source-topic-chip strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.source-topic-chip small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-topic-chip.active {
  border-color: color-mix(in srgb, var(--accent) 46%, var(--border));
}

.keyword-source-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

@media (min-width: 761px) {
  .keyword-filter-bar {
    grid-template-columns: minmax(360px, 1fr) 240px 128px;
    align-items: end;
  }

  .keyword-filter-bar button,
  .keyword-filter-bar .button {
    justify-content: center;
    min-width: 0;
    padding-inline: 14px;
    white-space: nowrap;
  }
}

.keyword-row {
  min-height: 54px;
  border-width: 1.5px;
  border-radius: 12px;
  padding: 11px 12px;
  background: var(--surface);
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 120ms ease;
}

.keyword-row:hover {
  border-color: color-mix(in srgb, var(--accent) 32%, var(--border-strong));
  box-shadow: 0 8px 18px rgba(15, 23, 42, .05);
}

.keyword-row .tag,
.keyword-row .status {
  font-weight: 850;
}

.operation-strip {
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--border) 74%, var(--accent) 26%);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-2) 82%, var(--surface) 18%);
  animation: workstationPanelIn 170ms ease-out both;
}

.operation-strip span,
.operation-strip a {
  min-height: 30px;
  border-radius: 999px;
  font-weight: 820;
}

.scan-results-panel {
  border-radius: 12px;
  overflow: hidden;
}

.scan-results-head {
  padding: 16px 18px;
}

.scan-result-card {
  padding: 14px 18px;
}

.scan-result-card:hover {
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}

.scan-result-text {
  font-size: 14px;
  line-height: 1.55;
}

.settings-card {
  border-radius: 12px;
  border-color: color-mix(in srgb, var(--border) 76%, var(--accent) 24%);
}

@keyframes workstationPanelIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1180px) {
  .keyword-filter-bar {
    grid-template-columns: 1fr 170px 118px;
  }
}

@media (max-width: 760px) {
  .source-hero-panel,
  .source-tool-panel,
  .source-bulk-panel,
  .split > .panel {
    padding: 15px;
  }

  .source-list-filter-form,
  .source-auto-form,
  .keyword-source-head,
  .keyword-filter-bar {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .keyword-flow {
    grid-template-columns: 1fr;
  }

  .keyword-source-head {
    padding: 0;
  }

  .keyword-source-head form,
  .keyword-source-head button,
  .keyword-source-actions .button {
    width: 100%;
  }

  .source-topic-chip {
    max-width: none;
    width: 100%;
  }

  .keyword-filter-bar button,
  .keyword-filter-bar .button {
    width: 100%;
  }

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

@media (prefers-reduced-motion: reduce) {
  .source-hero-panel,
  .source-tool-panel,
  .source-bulk-panel,
  .source-import-accordion,
  .source-card,
  .keyword-row,
  .metrics article,
  .discovery-status-panel,
  .operation-strip {
    animation: none;
    transition: none;
  }
}

/* Telegram Desktop sidebar navigation */
:root {
  --sidebar-width: 250px;
  --sidebar-collapsed-width: 76px;
  --sidebar-item-hover: rgba(255, 255, 255, .06);
  --sidebar-item-active: rgba(42, 171, 238, .18);
  --sidebar-item-active-border: #2aabee;
}

body.sidebar-collapsed {
  --sidebar-width: var(--sidebar-collapsed-width);
}

.workstation-shell {
  transition: grid-template-columns 190ms ease-out;
}

.sidebar {
  gap: 12px;
  padding: 14px 10px;
  overflow: hidden;
  transition:
    width 190ms ease-out,
    padding 190ms ease-out,
    background-color 180ms ease,
    border-color 180ms ease;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 42px;
  padding: 2px 4px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, .055);
}

.sidebar-title {
  display: grid;
  min-width: 0;
  transition: opacity 150ms ease, transform 160ms ease;
}

.sidebar-title strong {
  color: #f4f7fb;
  font-size: 14px;
  line-height: 1.15;
}

.sidebar-title span {
  margin-top: 2px;
  color: #8fa2b6;
  font-size: 11px;
  line-height: 1.15;
}

.sidebar-collapse {
  display: inline-grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 10px;
  padding: 0;
  background: rgba(255, 255, 255, .035);
  color: #a9bdd0;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 120ms ease;
}

.sidebar-collapse:hover {
  border-color: rgba(42, 171, 238, .32);
  background: rgba(42, 171, 238, .12);
  color: #ffffff;
}

.sidebar-collapse:active {
  transform: scale(.96);
}

.sidebar-collapse svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 190ms ease-out;
}

.nav {
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 2px 0 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .16) transparent;
}

.nav::-webkit-scrollbar {
  width: 6px;
}

.nav::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, .14);
}

.nav-group {
  display: grid;
  gap: 3px;
  margin-top: 12px;
}

.nav-group:first-child {
  margin-top: 2px;
}

.nav-group-title {
  padding: 0 12px 5px;
  color: #71849a;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .055em;
  line-height: 1;
  text-transform: uppercase;
  transition: opacity 140ms ease, height 160ms ease, padding 160ms ease;
}

.nav a {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  justify-content: initial;
  gap: 12px;
  min-height: 44px;
  border-radius: 10px;
  padding: 0 11px 0 12px;
  color: #91a3b5;
  font-size: 13px;
  font-weight: 760;
  line-height: 1.15;
  outline: none;
  overflow: visible;
  transform: translateX(0);
  transition:
    background-color 160ms ease,
    color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.nav a::before {
  position: absolute;
  inset: 9px auto 9px 0;
  width: 3px;
  height: auto;
  border-radius: 999px;
  background: var(--sidebar-item-active-border);
  content: "";
  opacity: 0;
  transform: scaleY(.55);
  transition:
    opacity 160ms ease,
    transform 180ms ease;
}

.nav a:hover {
  background: var(--sidebar-item-hover);
  color: #e7eef5;
  transform: translateX(2px);
}

.nav a:focus-visible {
  box-shadow: 0 0 0 3px rgba(42, 171, 238, .18);
}

.nav a.active {
  background: var(--sidebar-item-active);
  color: #ffffff;
  box-shadow: none;
}

.nav a.active::before {
  opacity: 1;
  transform: scaleY(1);
}

.nav a:active {
  transform: translateX(2px) scale(.99);
}

.nav-icon {
  width: 21px;
  height: 21px;
  color: currentColor;
  opacity: .9;
  transition:
    opacity 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.nav-icon * {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav a:hover .nav-icon,
.nav a.active .nav-icon {
  opacity: 1;
}

.nav a:hover .nav-icon {
  transform: translateX(1px);
}

.nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-counter {
  min-width: 28px;
  min-height: 20px;
  padding: 2px 8px;
  border-color: rgba(42, 171, 238, .2);
  background: rgba(255, 255, 255, .055);
  color: #dce9f5;
  font-size: 11px;
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    opacity 150ms ease;
}

.nav a:hover .nav-counter {
  transform: scale(1.04);
}

.nav a.active .nav-counter {
  border-color: rgba(42, 171, 238, .52);
  background: rgba(42, 171, 238, .2);
}

.nav-signal-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  border: 1px solid rgba(24, 177, 109, .38);
  border-radius: 999px;
  padding: 0 6px;
  background: #18b16d;
  color: #ffffff;
  box-shadow: 0 0 0 3px rgba(24, 177, 109, .12);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  transform-origin: center;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    background-color 150ms ease;
}

.nav a:hover .nav-signal-badge,
.nav a.active .nav-signal-badge {
  transform: scale(1.05);
  box-shadow: 0 0 0 4px rgba(24, 177, 109, .15);
}

.monitor-card {
  flex: 0 0 auto;
  min-height: 58px;
  border-radius: 12px;
  padding: 10px 11px;
  background: rgba(8, 15, 22, .42);
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    padding 190ms ease;
}

.monitor-card:hover {
  border-color: rgba(42, 171, 238, .24);
  background: rgba(18, 32, 44, .78);
}

.monitor-card strong {
  font-size: 12px;
  line-height: 1.2;
}

.monitor-card small {
  color: #8fa2b6;
  font-size: 11px;
}

body.sidebar-collapsed .sidebar {
  padding-inline: 10px;
}

body.sidebar-collapsed .sidebar-title,
body.sidebar-collapsed .nav-group-title,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .nav-counter {
  pointer-events: none;
  opacity: 0;
}

body.sidebar-collapsed .sidebar-title {
  width: 0;
  transform: translateX(-6px);
}

body.sidebar-collapsed .sidebar-head {
  justify-content: center;
  padding-inline: 0;
}

body.sidebar-collapsed .sidebar-collapse svg {
  transform: rotate(180deg);
}

body.sidebar-collapsed .nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  overflow: visible;
  padding-top: 2px;
}

body.sidebar-collapsed .nav-group {
  display: contents;
}

body.sidebar-collapsed .nav-group-title {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

body.sidebar-collapsed .nav a {
  display: grid;
  grid-template-columns: 22px;
  place-items: center;
  justify-content: center;
  justify-items: center;
  gap: 0;
  width: 54px;
  height: 44px;
  min-height: 44px;
  padding: 0;
}

body.sidebar-collapsed .nav-signal-badge {
  position: absolute;
  top: 6px;
  right: 7px;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  font-size: 9px;
}

body.sidebar-collapsed .nav-future-mark {
  display: none;
}

body.sidebar-collapsed .nav-icon {
  justify-self: center;
  align-self: center;
}

body.sidebar-collapsed .nav a:hover {
  transform: translateX(0);
}

body.sidebar-collapsed .nav a:hover::after {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  z-index: 80;
  width: max-content;
  max-width: 220px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 9px;
  padding: 8px 10px;
  background: #111821;
  color: #f3f4f6;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .24);
  content: attr(data-nav-label);
  font-size: 12px;
  font-weight: 750;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(-4px);
  animation: sidebarTooltip 150ms ease-out forwards;
}

@keyframes sidebarTooltip {
  to {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }
}

@media (max-width: 760px) {
  .account-topology-head {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
  }

  .account-topology-updated {
    align-self: flex-start;
  }

  .account-topology-scroll {
    max-height: 520px;
    min-height: 360px;
    padding: 8px;
  }

  .account-topology {
    min-width: 980px;
  }

  .account-topology-detail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0 8px 10px;
  }

  .account-topology-detail span:first-child {
    grid-column: 1 / -1;
  }

  .account-live-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .account-live-card {
    min-height: 68px;
    padding: 10px;
  }

  .account-live-card.main {
    grid-column: 1 / -1;
    min-height: 62px;
    padding-left: 32px;
  }

  .account-live-card strong {
    font-size: 20px;
  }

  .account-admin-details > summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .account-admin-toggle {
    width: 100%;
  }

  body.sidebar-collapsed {
    --sidebar-width: 100%;
  }

  .sidebar {
    gap: 8px;
  }

  .sidebar-head,
  .nav-group-title,
  .sidebar-collapse {
    display: none;
  }

  .nav {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    width: max-content;
    min-width: 100%;
    gap: 6px;
    padding: 0;
  }

  .nav-group {
    display: contents;
  }

  .nav a {
    display: flex;
    grid-template-columns: none;
    flex: 0 0 auto;
    gap: 8px;
    min-height: 36px;
    max-width: 190px;
    border-radius: 999px;
    padding: 8px 12px;
  }

  .nav a::before {
    display: none;
  }

  .nav-icon {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
  }

  .nav-label {
    opacity: 1 !important;
  }

  .nav-counter {
    opacity: 1 !important;
    min-width: 22px;
    padding-inline: 6px;
  }
}

/* Source discovery live search and Telegram WebApp mobile hardening */
.source-live-search-panel {
  display: grid;
  gap: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--border));
  border-radius: 14px;
  padding: 16px;
  background: color-mix(in srgb, var(--surface) 92%, var(--accent-soft) 8%);
  box-shadow: var(--panel-shadow);
  animation: workstationPanelIn 180ms ease-out both;
}

.source-live-search-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.source-live-search-head h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.source-live-search-progress {
  height: 7px;
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--border) 64%, transparent);
}

.source-live-search-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 220ms ease;
}

.source-live-search-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

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

  body {
    font-size: 14px;
  }

  .workstation-shell {
    display: block !important;
    width: 100%;
    min-width: 0;
  }

  .workspace,
  .content,
  .panel,
  .source-hero-panel,
  .source-tool-panel,
  .source-bulk-panel,
  .split,
  .split > .panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .workspace {
    overflow: visible;
  }

  .content {
    padding: 12px;
    overflow-x: hidden;
  }

  .sidebar {
    position: sticky;
    top: 0;
    width: 100% !important;
    min-width: 0;
    height: auto;
    max-height: 58px;
    padding: 8px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .sidebar-head,
  .monitor-card,
  .nav-group-title {
    display: none !important;
  }

  .nav {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    width: max-content;
    min-width: 100%;
    gap: 7px;
    padding: 0;
    overflow: visible;
  }

  .nav-group {
    display: contents !important;
  }

  .nav a {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: auto;
    max-width: 180px;
    min-height: 38px;
    height: 38px;
    gap: 8px;
    border-radius: 999px;
    padding: 0 12px;
    white-space: nowrap;
  }

  .nav a::before,
  body.sidebar-collapsed .nav a:hover::after {
    display: none !important;
  }

  .nav-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
  }

  .nav-label,
  .nav-counter {
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .topbar {
    position: sticky;
    top: 54px;
    z-index: 35;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
  }

  .topbar-tools {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .topbar-tools .search,
  .topbar-tools .button,
  .topbar-tools button,
  .topbar-tools .api-status {
    width: 100%;
    min-width: 0;
  }

  .split {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .source-page-head,
  .section-head,
  .source-header-actions,
  .source-counters,
  .source-tabs,
  .source-live-search-head {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: stretch;
    gap: 10px;
  }

  .source-counters,
  .source-tabs {
    display: flex;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .source-counters span,
  .source-tabs a {
    flex: 0 0 auto;
  }

  .source-list-filter-form,
  .source-auto-form,
  .source-import-form,
  .keyword-filter-bar {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px;
    padding: 12px;
  }

  .source-list-filter-form input,
  .source-list-filter-form select,
  .source-list-filter-form button,
  .source-list-filter-form .button,
  .source-auto-form input,
  .source-auto-form select,
  .source-auto-form button,
  .keyword-filter-bar input,
  .keyword-filter-bar select,
  .keyword-filter-bar button,
  .keyword-filter-bar .button {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    box-sizing: border-box;
  }

  .keyword-list {
    display: grid;
    gap: 12px;
  }

  .keyword-row,
  .keyword-row-compact {
    display: grid !important;
    grid-template-columns: 1fr !important;
    align-items: stretch;
    gap: 10px;
    min-height: 0;
    padding: 14px;
  }

  .keyword-row-compact strong {
    order: -1;
    display: block;
    width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: normal;
    white-space: normal;
    font-size: 17px;
    line-height: 1.25;
  }

  .keyword-row .tag,
  .keyword-row .status,
  .keyword-row form,
  .keyword-row button {
    width: 100%;
    min-width: 0;
    justify-content: center;
  }

  .source-card-grid {
    display: grid;
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .source-card {
    padding: 14px;
  }

  .source-card-head,
  .source-rank-grid,
  .source-actions,
  .scan-result-meta,
  .scan-result-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .source-actions button,
  .scan-result-actions .button {
    width: 100%;
  }
}

/* Fresh manual-search results are intentionally distinct from the backlog. */
.monitoring-coverage {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.monitoring-coverage span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-elevated);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.2;
}

.monitoring-coverage strong {
  margin-right: 4px;
  color: var(--text-primary);
}

.latest-source-results .source-card-fresh::before {
  background: var(--success);
  opacity: .95;
}

/* Compact phone enrichment controls and live dashboard summary. */
.button-count { display: inline-grid; min-width: 20px; height: 20px; place-items: center; margin-left: 6px; padding: 0 7px; border-radius: 999px; background: color-mix(in srgb, currentColor 14%, transparent); font-size: 11px; font-weight: 900; line-height: 1; vertical-align: middle; }
.phone-enrichment-actions { display: block; min-width: min(100%, 510px); }
.phone-enrichment-control-group { display: grid; gap: 8px; }
.phone-enrichment-primary-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.phone-enrichment-primary-row form,
.phone-enrichment-primary-row button { width: 100%; }
.phone-enrichment-options { display: flex; align-items: center; gap: 8px; }
.phone-enrichment-launch { display: block; }
.enrichment-repeat-control,
.enrichment-wave-select select { min-height: 38px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 12px; font-weight: 800; }
.enrichment-repeat-control { display: inline-flex; align-items: center; gap: 7px; padding: 0 10px; cursor: pointer; transition: border-color 150ms ease, background-color 150ms ease; }
.enrichment-repeat-control:hover { border-color: var(--accent); background: var(--accent-soft); }
.enrichment-repeat-control input { width: 15px; height: 15px; accent-color: var(--accent); }
.enrichment-wave-select select { padding: 0 30px 0 10px; }
.enrichment-wave-select.is-disabled { opacity: .48; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; clip-path: inset(50%); }
.dashboard-live { margin-bottom: 14px; }
.dashboard-live-head { margin-bottom: 12px; }
.dashboard-live-status { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 750; }
.dashboard-live-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 15%, transparent); }
.dashboard-live-status time { color: var(--muted-2); }
.dashboard-live-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.dashboard-live-metrics article { min-width: 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); transition: border-color 150ms ease, background-color 150ms ease, transform 150ms ease; }
.dashboard-live-metrics article:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); background: var(--accent-soft); transform: translateY(-1px); }
.dashboard-live-metrics span,
.dashboard-live-metrics strong { display: block; }
.dashboard-live-metrics span { overflow: hidden; color: var(--muted); font-size: 11px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-live-metrics strong { margin-top: 4px; color: var(--text); font-size: 25px; line-height: 1; }
@media (max-width: 880px) {
  .phone-enrichment-actions { width: 100%; }
  .phone-enrichment-primary-row,
  .phone-enrichment-options { grid-template-columns: 1fr; flex-direction: column; align-items: stretch; }
  .enrichment-repeat-control,
  .enrichment-wave-select select { width: 100%; }
  .dashboard-live-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Managers: future Telegram-like workspace. */
.nav-future {
  overflow: visible;
}

.nav-future-mark,
.future-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #9eea73;
  border-radius: 999px;
  color: #b9f58f;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .02em;
  line-height: 1;
  text-transform: uppercase;
}

.nav-future-mark {
  position: absolute;
  top: -7px;
  left: 38px;
  z-index: 2;
  min-height: 16px;
  padding: 0 5px;
  background: var(--sidebar);
}

.future-label {
  min-height: 22px;
  padding: 0 8px;
  background: color-mix(in srgb, #9eea73 8%, var(--surface));
}

.manager-workspace {
  display: grid;
  grid-template-columns: minmax(220px, 270px) minmax(310px, .9fr) minmax(360px, 1.15fr);
  min-height: calc(100vh - var(--topbar-height) - 36px);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--panel-shadow);
}

.manager-roster,
.manager-dialog-list,
.manager-detail-pane {
  min-width: 0;
}

.manager-roster {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 80%, var(--sidebar));
}

.manager-roster-head,
.manager-pane-head,
.manager-detail-head {
  padding: 18px;
}

.manager-roster-head .future-label {
  margin-bottom: 9px;
}

.manager-roster h2,
.manager-dialog-list h2,
.manager-detail-pane h2 {
  margin: 0;
  color: var(--text);
  font-size: 19px;
  line-height: 1.15;
}

.manager-roster-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.manager-account-list {
  display: grid;
  gap: 4px;
  padding: 4px 9px 12px;
  overflow-y: auto;
}

.manager-account {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 10px;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 58px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  transition: background-color 150ms ease, border-color 150ms ease, transform 120ms ease;
}

.manager-account:hover {
  border-color: color-mix(in srgb, var(--accent) 26%, var(--border));
  background: var(--accent-soft);
}

.manager-account.is-active {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--border));
  background: color-mix(in srgb, var(--accent) 15%, var(--surface));
}

.manager-account:active,
.manager-dialog:active {
  transform: scale(.98);
}

.manager-avatar,
.manager-detail-avatar {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #2aabee;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.manager-avatar.compact {
  width: 30px;
  height: 30px;
  font-size: 11px;
}

.manager-avatar-image {
  display: block;
  object-fit: cover;
  background: var(--surface-2);
}

.manager-account-copy,
.manager-current-user span:last-child,
.manager-dialog-copy {
  min-width: 0;
}

.manager-account-copy strong,
.manager-account-copy small,
.manager-current-user strong,
.manager-current-user small,
.manager-dialog-copy strong,
.manager-dialog-copy span,
.manager-dialog-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manager-account-copy strong,
.manager-current-user strong,
.manager-dialog-copy strong {
  font-size: 13px;
  font-weight: 850;
}

.manager-account-copy small,
.manager-current-user small,
.manager-dialog-copy span,
.manager-dialog-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.manager-presence,
.manager-roster-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted-2);
}

.manager-presence.is-online,
.manager-roster-dot {
  background: var(--success);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 16%, transparent);
}

.manager-roster-foot {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: auto;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

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

.manager-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.manager-pane-head .eyebrow,
.manager-detail-head .eyebrow {
  margin-bottom: 4px;
}

.manager-counter {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.manager-current-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 68%, transparent);
}

.manager-dialog-scroll {
  overflow-y: auto;
}

.manager-private-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 9px;
  min-height: 330px;
  padding: 32px;
  text-align: center;
  color: var(--muted);
}

.manager-private-empty strong {
  color: var(--text);
  font-size: 15px;
}

.manager-private-empty span:last-child {
  max-width: 330px;
  font-size: 13px;
  line-height: 1.5;
}

.manager-private-icon {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  border-radius: 50%;
  color: var(--accent);
  font-size: 22px;
  font-weight: 500;
}

.manager-dialog {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: start;
  gap: 9px;
  width: 100%;
  padding: 12px 13px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  text-align: left;
  transition: background-color 150ms ease, box-shadow 150ms ease, transform 120ms ease;
}

.manager-dialog:hover {
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}

.manager-dialog.is-active {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  box-shadow: inset 3px 0 0 var(--accent);
}

.manager-dialog-score {
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  height: 26px;
  border: 1px solid color-mix(in srgb, var(--accent) 52%, var(--border));
  border-radius: 999px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
}

.manager-dialog time {
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}

.manager-detail-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 22px;
  background: color-mix(in srgb, var(--surface-2) 46%, var(--surface));
}

.manager-detail-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--border);
}

.manager-detail-avatar {
  width: 46px;
  height: 46px;
  font-size: 16px;
}

.manager-detail-head > .future-label {
  margin-left: auto;
}

.manager-detail-head span:not(.future-label) {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.manager-lead-context {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.manager-score-large {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid color-mix(in srgb, var(--accent) 52%, var(--border));
  border-radius: 50%;
  color: var(--accent);
  font-size: 16px;
  font-weight: 900;
}

.manager-lead-context strong,
.manager-lead-context small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manager-lead-context strong { font-size: 14px; }
.manager-lead-context small { margin-top: 3px; color: var(--muted); font-size: 12px; }

.manager-message-bubble {
  margin: 18px 0;
  padding: 15px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  border-radius: 9px 9px 9px 3px;
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.manager-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.manager-detail-note {
  margin-top: auto;
  padding-top: 18px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.manager-private-preview {
  display: grid;
  gap: 12px;
  margin: auto 0;
  padding: 20px;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--border));
  border-radius: 9px;
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}

.manager-private-preview h3,
.manager-private-preview p { margin: 0; }
.manager-private-preview h3 { color: var(--text); font-size: 17px; }
.manager-private-preview > p:not(.eyebrow) { color: var(--muted); font-size: 13px; line-height: 1.55; }

.manager-capability-list {
  display: grid;
  gap: 7px;
  margin-top: 4px;
}

.manager-capability-list span {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
}

.manager-empty {
  display: grid;
  gap: 6px;
  padding: 22px;
  color: var(--muted);
}

.manager-empty strong { color: var(--text); }
.manager-empty span { font-size: 13px; line-height: 1.45; }
.manager-empty.detail { margin: auto 0; }

@media (max-width: 1200px) {
  .manager-workspace { grid-template-columns: 230px minmax(300px, 1fr); }
  .manager-detail-pane { grid-column: 1 / -1; min-height: 320px; border-top: 1px solid var(--border); }
  .manager-detail-note { margin-top: 22px; }
}

@media (max-width: 780px) {
  .manager-workspace { display: block; min-height: 0; overflow: visible; }
  .manager-roster,
  .manager-dialog-list { border-right: 0; border-bottom: 1px solid var(--border); }
  .manager-account-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .manager-roster-foot { display: none; }
  .manager-detail-pane { min-height: 280px; }
  .nav-future-mark { left: 36px; }
}

@media (max-width: 480px) {
  .manager-account-list { grid-template-columns: 1fr; }
  .manager-lead-context { grid-template-columns: 48px minmax(0, 1fr); }
  .manager-lead-context .status { grid-column: 2; justify-self: start; }
  .manager-detail-pane { padding: 16px; }
}

/* Keyword groups and local morphology */
.keyword-groups-head,
.keyword-group-summary,
.keyword-variants-head,
.keyword-editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.keyword-groups-head { margin: 24px 0 12px; }
.keyword-groups-head h3,
.keyword-groups-head p { margin: 0; }

.keyword-group-list { display: grid; gap: 10px; }

.keyword-group-card {
  position: relative;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.keyword-group-card:hover {
  border-color: color-mix(in srgb, var(--accent) 52%, var(--border));
  background: color-mix(in srgb, var(--accent) 3%, var(--surface));
}

.keyword-group-summary { align-items: flex-start; }
.keyword-group-title { display: flex; min-width: 250px; align-items: center; gap: 11px; }
.keyword-group-title > div { min-width: 0; }
.keyword-group-title strong,
.keyword-group-title span { display: block; }
.keyword-group-title strong { color: var(--text); font-size: 14px; }
.keyword-group-title div > span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.keyword-group-badges,
.keyword-group-actions,
.keyword-switch-row,
.keyword-variant-preview { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.keyword-group-badges { margin-left: auto; }
.keyword-group-actions { justify-content: flex-end; }
.keyword-group-actions form { margin: 0; }
.keyword-variant-preview { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }

.keyword-editor > summary { list-style: none; cursor: pointer; }
.keyword-editor > summary::-webkit-details-marker { display: none; }
.keyword-editor[open] > summary { border-color: var(--accent); color: var(--accent); }
.keyword-editor[open] .keyword-group-form { animation: keywordEditorIn 180ms ease both; }

.keyword-group-form {
  position: absolute;
  z-index: 25;
  top: calc(100% + 8px);
  right: 0;
  width: min(760px, calc(100vw - 330px));
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 16px 36px rgba(0, 0, 0, .18);
}

@keyframes keywordEditorIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.keyword-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.keyword-form-grid label,
.keyword-create-form > label:not(.checkbox) { display: grid; gap: 6px; }
.keyword-form-grid label > span,
.keyword-create-form > label > span { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.keyword-switch-row { margin: 14px 0; }

.keyword-variants-block {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-2) 65%, var(--surface));
}
.keyword-variants-block.compact { padding: 10px; }
.keyword-variants-head > div { display: grid; gap: 3px; }
.keyword-variants-head span { color: var(--muted); font-size: 11px; }
.keyword-variant-list { display: grid; gap: 8px; margin-top: 10px; }
.keyword-variant-list:empty { display: none; }
.keyword-variant-row { display: grid; grid-template-columns: minmax(180px, 1fr) auto 34px; align-items: center; gap: 8px; }
.keyword-variant-row .checkbox { white-space: nowrap; }
.keyword-editor-actions { margin-top: 14px; }

.keyword-test-panel { display: grid; gap: 10px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.keyword-test-panel h3,
.keyword-test-panel p { margin: 0; }
.keyword-test-results { display: grid; gap: 8px; }
.keyword-test-results article {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-left: 3px solid var(--accent);
  border-radius: 5px;
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}
.keyword-test-results article span,
.keyword-test-results article small { color: var(--muted); font-size: 11px; }

@media (max-width: 1100px) {
  .keyword-group-summary { flex-wrap: wrap; }
  .keyword-group-badges { margin-left: 0; }
  .keyword-group-form { width: min(720px, calc(100vw - 90px)); }
}

@media (max-width: 680px) {
  .keyword-group-title,
  .keyword-group-badges,
  .keyword-group-actions { width: 100%; }
  .keyword-group-actions { justify-content: flex-start; }
  .keyword-group-form { position: fixed; inset: 12px; width: auto; max-height: calc(100dvh - 24px); overflow: auto; }
  .keyword-form-grid { grid-template-columns: 1fr; }
  .keyword-variant-row { grid-template-columns: minmax(0, 1fr) 34px; }
  .keyword-variant-row .checkbox { grid-column: 1; grid-row: 2; }
  .keyword-variant-row .icon-button { grid-column: 2; grid-row: 1 / span 2; }
}

/* Keyword monitor final layout overrides */
.signal-filters.keyword-filter-bar {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
}

.keyword-simple-layout > .keyword-create-panel {
  margin-top: 0;
}

.signal-filters.keyword-filter-bar > label {
  display: grid;
  grid-column: auto;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-flow: row;
  gap: 6px;
  width: auto;
}

.signal-filters.keyword-filter-bar > label > input {
  width: 100%;
  min-width: 0;
}

.signal-filters.keyword-filter-bar > button,
.signal-filters.keyword-filter-bar > .button {
  width: auto;
  min-width: 0;
}

.signal-filters.keyword-filter-bar > button {
  min-width: 168px;
}

@media (max-width: 720px) {
  .signal-filters.keyword-filter-bar {
    grid-template-columns: 1fr;
  }

  .signal-filters.keyword-filter-bar > * {
    grid-column: 1;
  }

  .signal-filters.keyword-filter-bar > button,
  .signal-filters.keyword-filter-bar > .button {
    width: 100%;
  }
}

/* Managers live client: keep these rules last in the cascade. */
.manager-new-chat {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  padding: 10px 12px 0;
  background: var(--surface);
}

.manager-new-chat label {
  min-width: 0;
}

.manager-new-chat input {
  width: 100%;
  height: 40px;
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.manager-new-chat .button {
  min-height: 40px;
}

.manager-workspace {
  display: grid;
  grid-template-columns: minmax(210px, 230px) minmax(300px, .85fr) minmax(360px, 1.15fr);
  height: calc(100dvh - var(--topbar-height) - 36px);
  min-height: 620px;
  max-height: 900px;
  overflow: hidden;
}

.manager-roster,
.manager-dialog-list,
.manager-detail-pane,
.manager-account-list,
.manager-dialog-scroll,
.manager-message-list {
  min-height: 0;
}

.manager-detail-pane {
  grid-column: auto;
  padding: 0;
  overflow: hidden;
  border-top: 0;
}

.manager-detail-head {
  min-height: 74px;
  padding: 13px 16px;
}

.manager-detail-note {
  margin: 0;
  padding: 8px 14px;
}

@media (max-width: 1180px) {
  .manager-workspace {
    grid-template-columns: 220px 320px minmax(360px, 1fr);
  }
}

@media (max-width: 900px) {
  .manager-workspace {
    grid-template-columns: 210px minmax(300px, 1fr);
    height: auto;
    max-height: none;
  }

  .manager-detail-pane {
    grid-column: 1 / -1;
    min-height: 520px;
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 700px) {
  .manager-workspace {
    display: block;
    min-height: 0;
    overflow: hidden;
  }

  .manager-roster {
    display: block;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .manager-roster-head {
    padding: 14px 14px 7px;
  }

  .manager-account-list {
    display: flex;
    grid-template-columns: none;
    gap: 8px;
    padding: 8px 12px 12px;
    overflow-x: auto;
  }

  .manager-account {
    flex: 0 0 210px;
  }

  .manager-roster-foot {
    display: none;
  }

  .manager-dialog-list {
    min-height: 520px;
    border: 0;
  }

  .manager-detail-pane {
    display: none;
    min-height: 620px;
    padding: 0;
  }

  .manager-workspace.is-chat-open .manager-dialog-list {
    display: none;
  }

  .manager-workspace.is-chat-open .manager-detail-pane {
    display: flex;
  }

  .manager-mobile-back {
    display: inline-grid;
  }

  .manager-message {
    max-width: 88%;
  }

  .manager-detail-note {
    display: none;
  }
}

@media (max-width: 460px) {
  .manager-pane-head,
  .manager-detail-head {
    padding: 12px;
  }

  .manager-message-list {
    padding: 14px 10px;
  }

  .manager-composer {
    grid-template-columns: 1fr;
  }

  .manager-new-chat {
    grid-template-columns: 1fr;
  }

  .manager-new-chat .button {
    width: 100%;
  }

  .manager-send-button {
    width: 100%;
  }
}
