:root {
  --bg-0: #eeeeee;
  --bg-1: #ffffff;
  --bg-2: #eeeeee;
  --bg-3: #e5e7eb;
  --bg-4: #e5e7eb;
  --border-1: rgb(17 24 39 / 0.08);
  --border-2: rgb(17 24 39 / 0.12);
  --border-3: rgb(17 24 39 / 0.18);
  --fg-0: #111827;
  --fg-1: #1f2937;
  --fg-2: #6b7280;
  --fg-3: #9ca3af;
  --accent: #023667;
  --accent-soft: rgb(2 54 103 / 0.1);
  --accent-strong: #023667;
  --accent-bright: #023667;
  --ok: #16a34a;
  --warn: #ca8a04;
  --err: #dc2626;
  --ok-soft: rgb(22 163 74 / 0.12);
  --warn-soft: rgb(202 138 4 / 0.12);
  --err-soft: rgb(220 38 38 / 0.12);
  --shadow-sm: 0 4px 12px rgb(17 24 39 / 0.06);
  --shadow-md: 0 12px 32px rgb(17 24 39 / 0.12);
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --r-xl: 10px;
  --r-full: 999px;
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 20px;
  --composer-control-size: 40px;
  --composer-textarea-min-height: 40px;
  --text-xs: 11px;
  --text-sm: 12px;
  --text-md: 14px;
  --text-lg: 16px;
  --font-ui: "Geist", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg-0);
  color: var(--fg-1);
  font-family: var(--font-ui);
  overflow: hidden;
}

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

button {
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease,
    opacity 160ms ease;
}

input,
textarea {
  border: 0;
  background: none;
  color: inherit;
  outline: none;
}

.app {
  --app-rail-width: 64px;
  display: grid;
  grid-template-columns: var(--app-rail-width) minmax(0, 1fr);
  grid-template-rows: var(--app-rail-width) minmax(0, 1fr);
  grid-template-areas:
    "rail header"
    "rail main";
  height: 100dvh;
  padding: 0;
  gap: 0;
  background: #eef1f5;
}

.app[data-rail-collapsed="true"] {
  --app-rail-width: 64px;
}

.app-main {
  grid-area: main;
  min-width: 0;
  min-height: 0;
  display: grid;
  border-radius: 0;
  overflow: hidden;
  background: var(--bg-1);
}

.app-main > .shell {
  min-height: 0;
  height: 100%;
}

.app-header {
  grid-area: header;
  min-width: 0;
  min-height: var(--app-rail-width);
  padding: 0;
  border-bottom: 1px solid #e2e6ec;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0;
  position: relative;
  z-index: 20;
}

.app-header-space {
  flex: 1 1 auto;
  min-width: 0;
}

.app-header-user {
  min-height: calc(var(--app-rail-width) - 1px);
  padding: 0 20px;
  border: 0;
  background: #ffffff;
  color: #182235;
  display: grid;
  grid-template-columns: 32px minmax(0, auto);
  align-items: center;
  gap: 10px;
}

.app-header-user .avatar.sm {
  width: 32px;
  height: 32px;
  font-size: 11px;
}

.app-header-actions {
  height: 100%;
  display: flex;
  align-items: stretch;
  gap: 0;
}

.app-header-appointment-btn {
  min-width: 116px;
  min-height: calc(var(--app-rail-width) - 1px);
  padding: 0 18px;
  border: 0;
  border-left: 1px solid #e2e6ec;
  background: #ffffff;
  color: #182235;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}

.app-header-appointment-btn svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.app-header-notifications {
  position: relative;
  min-width: 64px;
  border-left: 1px solid #e2e6ec;
}

.app-header-notification-btn {
  width: 64px;
  height: calc(var(--app-rail-width) - 1px);
  padding: 0;
  border: 0;
  background: #ffffff;
  color: #182235;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.app-header-notification-btn svg {
  width: 22px;
  height: 22px;
}

.app-header-notification-count {
  position: absolute;
  top: 11px;
  right: 10px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 2px solid #ffffff;
  border-radius: 9px;
  background: #ff5a36;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.app-header-notification-popover {
  top: calc(100% + 1px);
  right: -1px;
  width: min(380px, calc(100vw - 16px));
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
}

.notification-toolbar {
  min-height: 56px;
  padding: 0;
  border-bottom: 1px solid #e8ebef;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0;
}

.notification-toolbar-main {
  min-width: 0;
  align-self: stretch;
  display: flex;
  align-items: center;
}

.notification-toolbar-icon {
  width: 56px;
  min-width: 56px;
  height: 100%;
  border-right: 1px solid #e8ebef;
  color: #182235;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.notification-toolbar-icon svg {
  width: 20px;
  height: 20px;
}

.notification-summary {
  padding: 0 14px;
  color: #5c6677;
  font-size: 13px;
  font-weight: 600;
  line-height: 18px;
  white-space: nowrap;
}

.notification-toolbar-actions {
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: 0;
}

.notification-toolbar-btn {
  width: 48px;
  min-width: 48px;
  height: 100%;
  padding: 0;
  border: 0;
  border-left: 1px solid #e8ebef;
  border-radius: 0;
  background: transparent;
  color: #687385;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.notification-toolbar-btn:hover {
  background: #f7f8fa;
  color: #182235;
}

.notification-toolbar-btn svg {
  width: 18px;
  height: 18px;
}

.notification-list {
  max-height: min(440px, calc(100vh - 96px));
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #c9cfd8 transparent;
}

.notification-item {
  padding: 12px 8px;
  border-bottom: 1px solid #edf0f3;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}

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

.notification-marker {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: #2374d8;
  box-shadow: 0 0 0 3px #e9f2fc;
}

.notification-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.notification-content strong {
  color: #182235;
  font-size: 13px;
  font-weight: 600;
  line-height: 18px;
}

.notification-text {
  color: #596477;
  font-size: 13px;
  line-height: 18px;
  overflow-wrap: anywhere;
}

.notification-time {
  color: #8a94a3;
  font-size: 11px;
  line-height: 16px;
}

.notification-empty {
  min-height: 150px;
  padding: 28px 20px;
  color: #707b8d;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 13px;
  text-align: center;
}

.notification-empty svg {
  width: 30px;
  height: 30px;
  color: #2f8a62;
}

.app-header-profile {
  height: 100%;
  border-left: 1px solid #e2e6ec;
  display: flex;
  align-items: stretch;
}

.app-header-user-copy {
  min-width: 0;
  max-width: 280px;
  display: block;
}

.app-header-user-copy .me-name {
  overflow: hidden;
  color: #182235;
  font-size: 14px;
  font-weight: 400;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-header-logout {
  width: 52px;
  min-width: 52px;
  min-height: calc(var(--app-rail-width) - 1px);
  padding: 0;
  border: 0;
  border-left: 1px solid #e2e6ec;
  background: #ffffff;
  color: #182235;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.app-header-logout svg {
  width: 20px;
  height: 20px;
}

.app-header-appointment-btn:hover,
.app-header-notification-btn:hover,
.app-header-logout:hover {
  background: #f5f5f5;
}

.app-body {
  display: contents;
}

.app-rail {
  grid-area: rail;
  min-width: 0;
  min-height: 0;
  padding: 0 0 12px;
  border-radius: 0;
  background: #1c2534;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  z-index: 24;
  overflow: visible;
}

.app-rail-brand {
  height: 64px;
  margin: 0 0 12px;
  border-bottom: 1px solid rgb(255 255 255 / 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.app-rail-brand img {
  width: 40px;
  height: 28px;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: 0.94;
  display: block;
}

.app-rail-nav {
  display: grid;
  gap: 0;
  margin: 0;
}

.app-rail-btn {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 0;
  border-radius: 0;
  border: 0;
  background: transparent;
  color: #8590a1;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  justify-items: center;
  position: relative;
}

.app-rail-btn:hover {
  background: rgb(255 255 255 / 0.07);
  color: #ffffff;
}

.app-rail-btn[data-active="true"] {
  background: rgb(255 255 255 / 0.1);
  color: #ffffff;
  border-radius: 0;
}

.app-rail-btn[data-active="true"]::before {
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 0;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: #ffffff;
  content: "";
}

.app-rail-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
}

.app-rail-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}

.app-rail-label {
  display: none;
}

.app-rail-count {
  position: absolute;
  top: 4px;
  right: 3px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 999px;
  background: #ff5a36;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
}

.app-rail-btn[data-active="true"] .app-rail-count {
  background: #ff5a36;
  color: #ffffff;
}

.app-rail-spacer {
  flex: 1 1 auto;
}

.app-rail-secondary {
  color: #8590a1;
}

.app-rail[data-collapsed="true"] {
  padding-left: 0;
  padding-right: 0;
  align-items: stretch;
}

.app-rail[data-collapsed="true"] .app-rail-nav {
  width: 100%;
}

.app-rail[data-collapsed="true"] .app-rail-btn {
  width: 100%;
  min-height: 46px;
  padding: 0;
  grid-template-columns: 1fr;
  justify-items: center;
}

.app-rail[data-collapsed="true"] .app-rail-label {
  display: none;
}

.app-rail[data-collapsed="true"] .app-rail-count {
  position: absolute;
  top: 4px;
  right: 3px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  font-size: 9px;
}

.app-rail[data-collapsed="true"] .app-rail-btn {
  position: relative;
}

.app-rail .popover {
  top: auto;
  right: auto;
  left: calc(100% + 10px);
  bottom: 12px;
}

.status-chip,
.me-chip,
.filter-chip,
.crm-card-btn,
.tags-chip,
.quick-act-btn,
.composer-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 6px;
  border: 1px solid var(--border-1);
  background: #ffffff;
  color: var(--fg-1);
}

.btn-primary,
.btn-secondary,
.btn-subtle,
.btn-danger {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, opacity 140ms ease;
}

.btn-primary {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #ffffff;
}

.btn-secondary {
  background: #ffffff;
  border: 1px solid var(--border-1);
  color: var(--fg-1);
}

.btn-subtle {
  background: var(--bg-2);
  border: 1px solid transparent;
  color: var(--fg-1);
}

.btn-danger {
  background: #ffffff;
  border: 1px solid rgb(220 38 38 / 0.18);
  color: var(--err);
}

.btn-primary.wide,
.btn-secondary.wide,
.btn-subtle.wide,
.btn-danger.wide {
  width: 100%;
  min-width: 0;
}

.status-chip {
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-sm);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ok);
}

.me-chip {
  padding: 4px 10px 4px 4px;
  min-height: 36px;
  border: 0;
}

.me-name {
  font-size: var(--text-sm);
  font-weight: 600;
}

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-width, 340px) 1px minmax(0, 1fr);
  min-height: 0;
  gap: 0;
  position: relative;
}

.shell:not(.admin-shell) {
  overflow: hidden;
}

.admin-shell {
  grid-template-columns: 280px 1fr;
  background: var(--bg-0);
}

.sidebar,
.right-panel,
.admin-content,
.chat-area {
  min-height: 0;
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: var(--bg-1);
  box-shadow: none;
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.sidebar-resizer {
  position: relative;
  width: 1px;
  min-width: 1px;
  max-width: 1px;
  cursor: col-resize;
  background: var(--border-2);
  touch-action: none;
  z-index: 4;
}

.sidebar-resizer::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -5px;
  right: -5px;
  background: transparent;
}

.sidebar-resizer:hover,
.app[data-sidebar-resizing="true"] .sidebar-resizer {
  background: var(--border-2);
}

.app[data-sidebar-resizing="true"] {
  cursor: col-resize;
  user-select: none;
}

.admin-sidebar {
  min-height: 0;
  border-right: 1px solid #e2e6ec;
  background: #ffffff;
}

.sidebar-top {
  padding: 10px 10px 0 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  z-index: 20;
}

.sidebar-top-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
}

.search-field {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-filter-anchor {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 auto;
}

.sidebar-settings-popover {
  position: relative;
  z-index: 24;
  width: 100%;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  display: grid;
  gap: 8px;
}

.sidebar-settings-popover .wappi-list-tools {
  padding: 0;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
  align-items: center;
}

.sidebar-settings-popover .wappi-list-tools button {
  white-space: nowrap;
}

.sidebar-settings-popover .chat-filter-panel {
  padding: 0;
}

.sidebar-switch .filter-chip {
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  color: #1c2534;
  position: relative;
  z-index: 1;
  flex: 0 1 auto;
  justify-content: center;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: 0;
  text-align: center;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.sidebar-switch .filter-chip:hover {
  background: transparent !important;
  color: #1c2534;
  box-shadow: none;
}

.sidebar-switch .filter-chip[data-active="true"] {
  background: transparent !important;
  color: #1c2534;
  box-shadow: none;
}

.sidebar-switch .filter-chip[data-active="true"]::after {
  position: absolute;
  right: 8px;
  bottom: 0;
  left: 8px;
  height: 3px;
  border-radius: 8px 8px 0 0;
  background: #1c2534;
  content: "";
}

.sidebar-switch {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: flex-start;
  gap: 8px;
  padding: 0;
  margin-top: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--border-1);
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}

.sidebar-switch-indicator {
  display: none;
}

.sidebar-switch .count {
  color: inherit;
  opacity: 0.9;
}

.sidebar-filter-toggle {
  position: relative;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  border: 0 !important;
  background: var(--bg-2) !important;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-1);
}

.sidebar-filter-toggle:hover {
  background: var(--bg-2) !important;
  color: var(--fg-1);
}

.sidebar-filter-toggle[data-active="true"] {
  background: var(--bg-2) !important;
  color: var(--fg-1);
}

.sidebar-filter-toggle svg {
  width: 16px;
  height: 16px;
  display: block;
  flex: 0 0 16px;
}

.sidebar-filter-toggle:hover svg,
.sidebar-filter-toggle[data-active="true"] svg {
  transform: translateY(0);
}

.chat-filter-toggle-count {
  position: absolute;
  right: -2px;
  top: -2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.chat-filter-panel {
  display: grid;
  gap: 10px;
  padding: 2px 0 0;
  border-radius: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

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

.chat-filter-panel-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-0);
}

.chat-filter-panel-title span:last-child {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgb(38 135 245 / 0.1);
  color: #2687f5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-family: var(--font-mono);
}

.chat-filter-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.chat-filter-text-btn {
  min-height: 24px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #2687f5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  transition: color 140ms ease;
}

.chat-filter-head-actions .chat-filter-text-btn:first-child {
  color: var(--fg-3);
}

.chat-filter-head-actions .chat-filter-text-btn:first-child:hover {
  color: var(--fg-1);
}

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

.chat-filter-field {
  display: grid;
  gap: 5px;
}

.chat-filter-field span {
  font-size: 10px;
  font-weight: 600;
  color: var(--fg-2);
  text-transform: none;
  letter-spacing: 0;
}

.chat-filter-field input,
.chat-filter-field select {
  width: 100%;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 0;
  background: var(--bg-2);
  color: var(--fg-0);
  outline: none;
  font-size: 12px;
  box-shadow: inset 0 0 0 1px transparent;
  transition: background-color 140ms ease, box-shadow 140ms ease;
}

.chat-filter-field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%2364758B' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 12px;
}

.chat-filter-field input:focus,
.chat-filter-field select:focus {
  background-color: #ffffff;
  box-shadow: inset 0 0 0 1px rgb(38 135 245 / 0.18);
}

.chat-filter-field input::placeholder {
  color: var(--fg-3);
}

@media (max-width: 860px) {
  .chat-filter-grid {
    grid-template-columns: 1fr;
  }
}

.search-input {
  flex: 1;
  min-width: 0;
  background: var(--bg-2);
  border: 0;
  border-radius: var(--r-full);
  padding: 0 34px 0 14px;
  color: var(--fg-0);
  height: 32px;
  font-size: var(--text-sm);
}

.search-input:focus {
  border-color: transparent;
  background: var(--bg-2);
  box-shadow: none;
}

.field input:focus,
.composer-textarea:focus {
  border-color: rgb(2 54 103 / 0.28);
  box-shadow: none;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-2);
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.search-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

.search-clear-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  min-width: 24px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--fg-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.search-clear-btn:hover {
  background: var(--bg-1);
  color: var(--fg-0);
}

.search-clear-btn svg {
  width: 14px;
  height: 14px;
  display: block;
}

.search-kbd {
  position: absolute;
  right: 88px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--fg-3);
  pointer-events: none;
}

.plus-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  box-shadow: none;
  flex: 0 0 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.sidebar-top-row > .plus-btn {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
}

.sidebar-top-row > .plus-btn svg {
  width: 16px;
  height: 16px;
}

.search-field .search-input {
  height: 32px;
  padding: 0 34px 0 34px;
  font-size: 12px;
}

.search-field .search-icon {
  left: 50px;
}

.settings-btn {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  border: 0;
  background: transparent;
}

.plus-btn svg {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
}

.settings-btn svg {
  width: 16px;
  height: 16px;
  display: block;
  flex-shrink: 0;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.filter-chip {
  padding: 7px 11px;
  font-size: var(--text-xs);
  font-weight: 600;
}

.filter-chip[data-active="true"] {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgb(2 54 103 / 0.18);
}

.filter-chip:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgb(2 54 103 / 0.18);
}

.count {
  font-family: var(--font-mono);
  color: var(--fg-3);
}

.right-panel,
.admin-content {
  overflow: auto;
  scrollbar-width: thin;
}

.chat-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.chat-list-more {
  min-height: 48px;
  margin: 8px 2px 6px;
  border: 1px solid var(--border-2);
  border-radius: 6px;
  background: var(--bg-1);
  color: var(--fg-1);
}

.chat-list-more:hover {
  background: var(--bg-2);
}

.chat-list-more span {
  display: block;
  margin-top: 3px;
  color: var(--fg-2);
  font-size: var(--text-sm);
}

.chat-list-wrap {
  position: relative;
  min-height: 0;
  flex: 1 1 auto;
  overflow: auto;
  scrollbar-width: thin;
}

.chat-list-loader {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--fg-2);
}

.chat-list-loader-centered {
  min-height: 180px;
  flex-direction: column;
}

.chat-list-loader-inline {
  margin-top: 16px;
}

.chat-list-loader-overlay {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 2;
  padding: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-0) 86%, transparent);
  box-shadow: 0 8px 20px rgb(15 23 42 / 0.08);
  backdrop-filter: blur(6px);
}

.chat-list-loader-ring {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 2px solid rgb(2 54 103 / 0.16);
  border-top-color: var(--accent);
  border-right-color: color-mix(in srgb, var(--accent) 72%, white);
  animation: chat-loader-spin 0.72s linear infinite;
}

.chat-list-loader-text {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--fg-2);
}

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

.section-label {
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-3);
  padding: var(--space-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
}

.section-label-tight {
  padding: 0;
}

.chat-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 64px;
  padding: 8px 18px;
  border-radius: 0;
  text-align: left;
  border: 0;
  position: relative;
  content-visibility: auto;
  contain-intrinsic-size: auto 64px;
}

.chat-item[data-active="true"] {
  background: var(--bg-2);
}

.chat-item:hover {
  background: var(--bg-2);
}

.chat-context-menu {
  position: fixed;
  z-index: 1200;
  min-width: 156px;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid var(--border-1);
  background: rgb(255 255 255 / 0.98);
  box-shadow: var(--shadow-md);
  display: grid;
  gap: 2px;
}

.chat-context-menu-item {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  text-align: left;
  font-size: 13px;
  color: var(--fg-1);
}

.chat-context-menu-item:hover,
.chat-context-menu-item:focus-visible {
  background: var(--bg-2);
  outline: none;
}

.chat-context-menu-item svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  color: var(--accent);
}

.meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dialog-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.name {
  color: var(--fg-0);
  font-size: var(--text-md);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.time,
.micro,
.subtle,
.composer-hint,
.micro-note,
.a-time {
  color: var(--fg-3);
  font-size: var(--text-xs);
  font-family: var(--font-ui);
  text-transform: none;
  letter-spacing: 0;
}

.chat-item .time {
  flex: 0 0 auto;
  white-space: nowrap;
  text-align: right;
  line-height: 1.2;
}

.chat-time-group {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.chat-channel-strip {
  display: inline-flex;
  align-items: center;
  flex-direction: row;
  max-width: 76px;
  overflow: hidden;
  pointer-events: none;
}

.chat-channel-strip .messenger-dot,
.chat-channel-extra {
  width: 17px;
  height: 17px;
  min-width: 17px;
  margin-left: -5px;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px var(--border-1);
  font-size: 9px;
}

.chat-channel-strip .messenger-dot:first-child {
  margin-left: 0;
}

.chat-channel-extra {
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-0);
  color: var(--fg-2);
  font-weight: 700;
  line-height: 1;
}

.preview {
  display: inline-block;
  color: var(--fg-2);
  font-size: var(--text-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wappi-list-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
  color: var(--fg-1);
  font-size: 12px;
}

.wappi-list-tools strong {
  color: #2563eb;
  font-weight: 500;
}

.wappi-list-tools button {
  min-height: 24px;
  padding: 0;
  border: 0;
  color: #2563eb;
  font-size: 12px;
  font-weight: 500;
}

.show-profile-chats-link {
  min-height: 24px;
  padding: 0;
  border: 0;
  color: #2563eb;
  font: inherit;
  font-weight: 500;
  line-height: inherit;
  vertical-align: baseline;
}

.all-profiles-dot {
  background: #eef6ff;
  color: #2563eb;
}

.all-profiles-dot svg {
  width: 12px;
  height: 12px;
  display: block;
}

.profile-channel-picker {
  overflow: auto;
  padding: 10px 10px 14px;
  scrollbar-width: thin;
}

.profile-channel-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px 10px;
}

.profile-channel-picker-head span {
  color: var(--fg-0);
  font-size: 13px;
  font-weight: 650;
}

.profile-channel-picker-head button {
  min-height: 24px;
  padding: 0;
  border: 0;
  color: var(--fg-2);
  font-size: 12px;
  font-weight: 500;
}

.profile-channel-picker-head button:hover {
  color: var(--fg-0);
}

.profile-channel-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-channel-row {
  min-height: 42px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--fg-1);
  text-align: left;
}

.profile-channel-row span:nth-child(2) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 550;
}

.profile-channel-row strong {
  color: var(--fg-3);
  font-size: 12px;
  font-weight: 550;
}

.profile-channel-row:hover {
  background: var(--bg-2);
}

.profile-channel-row[data-active="true"] {
  background: #eef6ff;
  color: #2563eb;
}

.profile-channel-apply {
  width: 100%;
  min-height: 38px;
  margin-top: 12px;
  border: 0;
  border-radius: 10px;
  background: #2563eb;
  color: #fff;
  font-size: 13px;
  font-weight: 650;
}

.profile-channel-apply:hover {
  background: #1d4ed8;
}

.wappi-list-tools button:disabled {
  color: var(--fg-3);
  opacity: 0.65;
}

.dialog-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.dialog-chevron {
  color: var(--fg-3);
  font-size: 14px;
  line-height: 1;
}

.dialog-right {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 22px;
  flex-shrink: 0;
  margin-left: auto;
}

.chat-item-menu-trigger {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: var(--fg-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 24px;
  cursor: pointer;
}

.chat-item-menu-trigger:hover,
.chat-item-menu-trigger:focus-visible {
  color: var(--fg-2);
  outline: none;
}

.chat-item-menu-trigger svg {
  width: 18px;
  height: 18px;
}

.chat-restore-trigger {
  min-height: 24px;
  padding: 0 8px;
  border-radius: 8px;
  color: var(--fg-1);
  font-size: 12px;
  line-height: 24px;
  white-space: nowrap;
  cursor: pointer;
}

.chat-restore-trigger:hover,
.chat-restore-trigger:focus-visible {
  background: var(--bg-2);
  outline: none;
}

.preview-wrap {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.preview-line {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.preview-checks {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 1px;
  flex-shrink: 0;
}

.template-group-btn::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  border-radius: 999px 999px 0 0;
  background: var(--accent);
  opacity: 0;
  transform: scaleX(0.72);
  transform-origin: center;
  transition:
    opacity 140ms ease,
    transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.template-group-btn[data-active="true"]::after {
  opacity: 1;
  transform: scaleX(1);
}

.messenger-dot {
  width: 20px;
  height: 20px;
  min-width: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

.messenger-dot.no-channel-dot {
  background: var(--bg-2);
  color: var(--fg-2);
  font-size: 13px;
  font-weight: 600;
}

.channel-empty-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--bg-2);
  color: var(--fg-1);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-pill {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: var(--text-xs);
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.badge-pill[data-tone="success"] {
  background: var(--ok);
}

.badge-pill[data-tone="danger"] {
  background: var(--err);
}

.badge-pill[data-tone="warning"] {
  background: var(--warn);
}

.badge-pill[data-tone="default"] {
  background: var(--accent);
}

.avatar-wrap {
  position: relative;
  width: fit-content;
  display: inline-flex;
  flex-shrink: 0;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: none;
  overflow: hidden;
  position: relative;
}

.avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  z-index: 1;
}

.avatar-img[src=""],
.avatar-img:not([src]) {
  display: none;
}

.avatar-fallback {
  position: relative;
  z-index: 0;
}

.avatar.sm {
  width: 24px;
  height: 24px;
  font-size: var(--text-xs);
}

.avatar.lg {
  width: 52px;
  height: 52px;
  font-size: 16px;
}

.avatar.xl {
  width: 72px;
  height: 72px;
  font-size: 22px;
}

.avatar-channel {
  position: absolute;
  right: -2px;
  bottom: -2px;
  z-index: 3;
  width: 18px;
  height: 18px;
  min-width: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.14), 0 2px 5px rgba(15, 23, 42, 0.16);
  font-size: 10px;
  line-height: 1;
  pointer-events: none;
}

.avatar-wrap.lg .avatar-channel {
  width: 20px;
  height: 20px;
  min-width: 20px;
  font-size: 11px;
}

.avatar-wrap.xl .avatar-channel {
  width: 24px;
  height: 24px;
  min-width: 24px;
  font-size: 12px;
}

.chat-area {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  background: var(--bg-2);
}

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

.who {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.who .meta,
.chat-header .meta {
  min-width: 0;
  overflow: hidden;
}

.who .name {
  font-size: 15px;
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.who .sub {
  display: flex;
  flex-wrap: wrap;
  min-width: 0;
  overflow: hidden;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--fg-3);
}

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

.crm-card-btn,
.tags-chip,
.quick-act-btn {
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-sm);
  min-height: 36px;
  font-weight: 600;
}

.action-pill {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 0;
  background: #ffffff;
  color: var(--fg-1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}

.action-pill-ghost {
  width: 32px;
  min-width: 32px;
  padding: 0;
}

.manual-phone-bind {
  height: 32px;
  min-width: 180px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 4px 0 10px;
  border-radius: 8px;
  border: 1px solid rgb(15 23 42 / 0.08);
  background: rgb(255 255 255 / 0.62);
  color: var(--fg-1);
}

.manual-phone-bind:focus-within {
  border-color: rgb(10 57 101 / 0.26);
  background: rgb(255 255 255 / 0.88);
}

.manual-phone-bind input {
  width: 138px;
  min-width: 0;
  height: 30px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--fg-1);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
}

.manual-phone-bind input::placeholder {
  color: rgb(100 116 139 / 0.72);
  font-weight: 500;
}

.manual-phone-bind button {
  width: 24px;
  height: 24px;
  min-width: 24px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: rgb(10 57 101 / 0.08);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.manual-phone-bind button:hover {
  background: rgb(10 57 101 / 0.14);
}

.manual-phone-bind-panel {
  width: 100%;
  max-width: 210px;
  justify-content: space-between;
}

.manual-phone-bind-panel input {
  flex: 1;
}

.manual-phone-bind-suggested {
  border-color: rgb(2 54 103 / 0.38);
  background: rgb(255 255 255 / 0.92);
  box-shadow: 0 0 0 2px rgb(2 54 103 / 0.08);
}

.manual-phone-bind-suggested .manual-phone-input {
  width: 146px;
}

.manual-phone-bind-dismiss,
.manual-phone-bind-accept {
  flex: 0 0 auto;
}

.manual-phone-bind .manual-phone-bind-dismiss {
  background: rgb(100 116 139 / 0.08);
  color: #64748b;
}

.manual-phone-bind .manual-phone-bind-dismiss:hover {
  background: rgb(100 116 139 / 0.14);
}

.channel-switch {
  position: relative;
}

.channel-switch[open] .channel-summary {
  background: var(--accent-soft);
}

.channel-summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 32px;
  padding: 4px 8px;
  border-radius: 8px;
  border: 0;
  background: #ffffff;
  color: var(--fg-1);
  cursor: pointer;
  user-select: none;
}

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

.channel-summary-label,
.channel-option-label {
  font-size: var(--text-sm);
  font-weight: 600;
}

.channel-arrows {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  color: var(--fg-3);
  font-size: 8px;
  line-height: 0.85;
}

.channel-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid var(--border-2);
  background: rgb(255 255 255 / 0.98);
  box-shadow: var(--shadow-md);
  display: grid;
  gap: 6px;
  z-index: 15;
}

.channel-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 36px;
  padding: var(--space-1) var(--space-2);
  border-radius: 10px;
  border: 1px solid transparent;
  background: #ffffff;
  text-align: left;
}

.channel-option[data-active="true"] {
  background: var(--accent-soft);
  border-color: rgb(2 54 103 / 0.12);
}

.channel-option:hover {
  background: var(--accent-soft);
  border-color: rgb(2 54 103 / 0.12);
}

.channel-value {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.messages {
  flex: 1;
  min-height: 0;
  min-width: 0;
  margin: 0;
  padding: 14px 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-radius: 10px 10px 0 0;
  background-color: #eeeeee;
  background-image: url("../assets/chat-wallpaper.jpg");
  background-blend-mode: multiply;
  background-position: center top;
  background-repeat: repeat;
  background-size: 420px 420px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  overscroll-behavior: contain;
  overflow-anchor: none;
}

.messages.messages-empty-channel-choice {
  background: #eeeeee;
}

.chat-history-loader {
  position: sticky;
  top: 8px;
  z-index: 4;
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgb(226 230 236 / 0.9);
  background: rgb(255 255 255 / 0.96);
  color: var(--fg-2);
  font-size: 12px;
  box-shadow: 0 8px 18px rgb(15 23 42 / 0.08);
  backdrop-filter: blur(8px);
}

.chat-history-loader .chat-list-loader-ring {
  width: 14px;
  height: 14px;
}

.day-divider {
  position: sticky;
  top: 8px;
  z-index: 3;
  align-self: center;
  min-width: 90px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  border: 1px solid var(--border-1);
  background: rgb(255 255 255 / 0.94);
  box-shadow: none;
  backdrop-filter: blur(8px);
  display: inline-flex;
  justify-content: center;
  font-size: var(--text-xs);
  text-align: center;
  text-transform: none;
  letter-spacing: 0;
  color: var(--fg-3);
  margin: var(--space-1) 0;
}

.channel-zone-divider {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 6px 0 4px;
  padding: 4px 10px 4px 6px;
  border-radius: 999px;
  background: var(--channel-zone-bg);
  color: var(--channel-zone-color);
  font-size: 12px;
  font-weight: 600;
}

.channel-zone-divider[data-active="true"] {
  box-shadow: none;
}

.channel-zone-divider .messenger-dot {
  width: 20px;
  height: 20px;
  background: #ffffff !important;
}

.channel-zone-count {
  color: var(--fg-3);
  font-size: 11px;
  font-weight: 500;
}

.channel-zone-empty {
  align-self: center;
  max-width: min(520px, 92%);
  margin: 0 0 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--channel-zone-bg);
  color: var(--fg-2);
  font-size: var(--text-xs);
  line-height: 1.35;
}

.channel-zone-empty-stack {
  display: contents;
}

.new-messages-divider {
  position: relative;
  align-self: stretch;
  margin: 4px 0 6px;
  text-align: center;
}

.new-messages-divider::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: rgb(2 54 103 / 0.24);
}

.new-messages-divider span {
  position: relative;
  display: inline-block;
  padding: 0 12px;
  background: rgb(238 238 238 / 0.94);
  color: #2563eb;
  font-size: 12px;
  font-weight: 500;
}

.msg-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: start;
  max-width: min(72%, 760px);
  min-width: 0;
  width: auto;
}

.msg-row[data-channel-zone="true"] {
  padding: 0;
  border-radius: 0;
  background: transparent;
}

.msg-row[data-mine="true"] {
  grid-template-columns: 1fr;
  align-self: end;
  justify-items: end;
}

.msg-bubble-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  max-width: 100%;
  position: relative;
  width: auto;
}

.msg-row[data-mine="true"] .msg-bubble-wrap {
  align-items: flex-end;
}

.msg-bubble {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  width: auto;
  min-width: 72px;
  max-width: min(100%, 720px);
  padding: 8px 10px;
  border-radius: 2px 8px 8px 8px;
  background: #ffffff;
  border: 0;
  color: var(--fg-0);
  line-height: 1.5;
  box-shadow: none;
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.msg-row[data-mine="true"] .msg-bubble {
  background: var(--accent);
  color: #ffffff;
  border-color: transparent;
  border-radius: 8px 2px 8px 8px;
}

.msg-row[data-mine="false"] > .avatar.sm {
  display: none;
}

.msg-bubble-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin: 0 0 3px;
  font-size: var(--text-xs);
  line-height: 1.2;
  color: var(--fg-2);
}

.msg-bubble-author {
  font-weight: 400;
  color: inherit;
}

.msg-reply {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-left: 3px solid rgb(2 54 103 / 0.6);
  border-radius: 8px;
  background: var(--bg-2);
  min-width: 0;
  text-align: left;
  cursor: pointer;
  appearance: none;
}

.msg-row[data-mine="false"] .msg-reply {
  background: var(--bg-2);
}

.msg-row[data-mine="true"] .msg-reply {
  background: rgb(255 255 255 / 0.16);
  border-left-color: rgb(255 255 255 / 0.72);
}

.msg-reply:hover {
  background: rgb(255 255 255 / 0.72);
}

.msg-row[data-mine="false"] .msg-reply:hover {
  background: #e7e7e7;
}

.msg-reply-author {
  font-size: 12px;
  font-weight: 600;
  color: rgb(2 54 103 / 0.84);
}

.msg-row[data-mine="true"] .msg-reply-author {
  color: rgb(255 255 255 / 0.88);
}

.msg-reply-text {
  font-size: 12px;
  color: var(--fg-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-row[data-mine="true"] .msg-reply-text {
  color: rgb(255 255 255 / 0.76);
}

.msg-text {
  min-width: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.unsupported-message-card {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-2);
  color: var(--fg-1);
}

.unsupported-message-title {
  font-weight: 650;
}

.unsupported-message-copy {
  color: var(--fg-2);
  font-size: 13px;
  line-height: 1.35;
}

.unsupported-message-link {
  width: fit-content;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

.unsupported-message-link:hover {
  text-decoration: underline;
}

.msg-row-highlight .msg-bubble {
  box-shadow: 0 0 0 2px rgb(2 54 103 / 0.16);
}

.msg-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
  max-width: 100%;
}

.msg-row[data-mine="true"] .msg-reactions {
  justify-content: flex-end;
}

.msg-reaction {
  min-height: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--border-1);
  background: rgb(255 255 255 / 0.96);
  color: var(--fg-1);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  line-height: 1;
  box-shadow: none;
}

.msg-reaction-count {
  color: var(--fg-2);
  font-size: 11px;
  font-weight: 600;
}

.msg-meta {
  display: flex;
  align-items: center;
  align-self: flex-end;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 2px;
  font-size: var(--text-xs);
  color: var(--fg-3);
  line-height: 1;
  white-space: nowrap;
}

.msg-row[data-mine="true"] .msg-meta {
  width: 100%;
  justify-content: flex-end;
  color: rgb(255 255 255 / 0.8);
}

.msg-row[data-mine="false"] .msg-meta {
  margin-left: auto;
}

.msg-send-error {
  max-width: min(100%, 420px);
  margin-top: 6px;
  color: var(--err);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.msg-row[data-mine="true"] .msg-send-error {
  text-align: right;
}

.msg-meta-time {
  font-family: var(--font-ui);
  font-size: 11px;
  line-height: 1;
}

.msg-meta-author {
  flex: 0 0 auto;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-ui);
  font-size: 11px;
  line-height: 1;
  color: inherit;
}

.msg-meta-status {
  font-size: 11px;
  line-height: 1;
}

.msg-meta-status-failed {
  color: var(--err);
}

.msg-meta-clock {
  width: 14px;
  height: 14px;
  color: currentColor;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.82;
  flex: 0 0 auto;
}

.msg-meta-clock svg {
  width: 14px;
  height: 14px;
  display: block;
}

.msg-meta-clock path {
  transform-origin: 8px 8px;
  animation: msg-clock-tick 1.1s steps(12, end) infinite;
}

@keyframes msg-clock-tick {
  to {
    transform: rotate(360deg);
  }
}

.msg-meta-checks {
  position: relative;
  display: inline-flex;
  width: 14px;
  height: 10px;
  color: var(--fg-3);
  flex-shrink: 0;
}

.msg-meta-checks[data-tone="accent"] {
  color: currentColor;
}

.msg-meta-check {
  position: absolute;
  width: 5px;
  height: 9px;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: rotate(38deg);
  top: -1px;
}

.msg-meta-check-first {
  left: 1px;
}

.msg-meta-check-second {
  left: 6px;
}

.msg-meta-checks[data-count="1"] .msg-meta-check-first {
  left: 5px;
}

.system-msg {
  align-self: center;
  padding: var(--space-1) var(--space-2);
  border-radius: 10px;
  background: var(--bg-3);
  color: var(--fg-1);
  border: 1px solid var(--border-1);
  font-size: var(--text-sm);
}

.msg-actions {
  position: absolute;
  top: 0;
  right: -28px;
  z-index: 5;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
  padding: 0 0 0 6px;
}

.msg-row[data-mine="true"] .msg-actions {
  top: 2px;
  right: auto;
  left: -28px;
  padding: 0 14px 0 0;
}

.msg-bubble-wrap:hover .msg-actions,
.msg-bubble:hover .msg-actions,
.msg-actions:hover,
.msg-actions[open] {
  opacity: 1;
  pointer-events: auto;
}

.msg-actions-toggle {
  list-style: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  color: rgb(89 100 119 / 0.58);
}

.msg-row[data-mine="true"] .msg-actions-toggle {
  background: var(--accent);
  color: rgb(255 255 255 / 0.58);
}

.msg-actions-toggle:hover {
  background: #ffffff;
  color: rgb(89 100 119 / 0.72);
}

.msg-row[data-mine="true"] .msg-actions-toggle:hover {
  background: var(--accent);
  color: rgb(255 255 255 / 0.78);
}

.msg-actions-toggle::-webkit-details-marker {
  display: none;
}

.msg-actions-toggle-icon {
  width: 12px;
  height: 12px;
  display: block;
  flex-shrink: 0;
}

.msg-actions-menu {
  position: absolute;
  top: 26px;
  right: 0;
  left: auto;
  min-width: 156px;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid var(--border-1);
  background: rgb(255 255 255 / 0.98);
  box-shadow: var(--shadow-md);
  display: grid;
  gap: 2px;
}

.msg-row[data-mine="true"] .msg-actions-menu {
  left: 0;
  right: auto;
}

.msg-actions-item {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  text-align: left;
  font-size: 13px;
  color: var(--fg-1);
}

.msg-actions-item:hover {
  background: var(--bg-2);
}

.msg-actions-item-danger {
  color: #b42318;
}

.msg-actions-item-danger:hover {
  background: #fee4e2;
}

.message-attachments {
  display: grid;
  gap: 8px;
  width: 100%;
}

.message-media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(118px, 1fr));
  gap: 4px;
  width: min(330px, 60vw);
}

.message-media-grid[data-count="1"] {
  display: block;
  width: fit-content;
}

.message-media-tile {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  aspect-ratio: 4 / 3;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  background: rgb(2 54 103 / 0.08);
  contain: content;
}

.message-media-grid[data-count="1"] .message-media-tile {
  width: min(320px, 58vw);
  min-width: min(220px, 58vw);
  aspect-ratio: 4 / 3;
}

.message-media-tile[data-kind="video"] {
  background: #000000;
}

.message-file-card,
.message-audio-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 10px;
  width: min(360px, 62vw);
  min-height: 58px;
  padding: 8px 10px;
  border-radius: 10px;
  overflow: clip;
  background: rgb(255 255 255 / 0.56);
  border: 1px solid rgb(17 24 39 / 0.06);
  text-align: left;
}

.message-audio-card {
  grid-template-columns: 42px minmax(0, 1fr);
}

.msg-row[data-mine="false"] .message-file-card,
.msg-row[data-mine="false"] .message-audio-card {
  background: var(--bg-2);
}

.message-attachment-preview,
.message-attachment-video {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 10px;
  object-fit: cover;
  background: rgb(2 54 103 / 0.08);
  content-visibility: auto;
  contain-intrinsic-size: 260px 180px;
}

.message-attachment-video {
  background: #000000;
}

.message-audio-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.message-audio-copy audio {
  width: 100%;
  max-width: 250px;
  height: 34px;
}

.message-attachment-icon {
  width: 38px;
  min-width: 38px;
  height: 38px;
  margin: 0;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid var(--border-1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.message-attachment-icon .message-attachment-kind,
.message-attachment-icon svg {
  width: 20px;
  height: 20px;
}

.message-attachment-kind {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.message-attachment-kind[data-tone="red"] {
  color: #dc2626;
}

.message-attachment-kind[data-tone="green"] {
  color: #16a34a;
}

.message-attachment-kind[data-tone="violet"] {
  color: #7c3aed;
}

.message-attachment-kind[data-tone="yellow"] {
  color: #b45309;
}

.message-attachment-kind[data-tone="gray"] {
  color: #4b5563;
}

.message-attachment-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  padding: 0;
}

.message-attachment-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-attachment-meta {
  font-size: 11px;
  color: var(--fg-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-attachment-open {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.78);
  color: var(--fg-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.message-attachment-open svg {
  width: 15px;
  height: 15px;
}

.msg-row[data-mine="true"] .message-file-card,
.msg-row[data-mine="true"] .message-audio-card {
  background: rgb(255 255 255 / 0.16);
  border-color: rgb(255 255 255 / 0.18);
}

.msg-row[data-mine="true"] .message-attachment-title {
  color: #ffffff;
}

.msg-row[data-mine="true"] .message-attachment-meta {
  color: rgb(255 255 255 / 0.72);
}

.msg-row[data-mine="true"] .message-attachment-icon {
  border-color: transparent;
}

.msg-row[data-mine="true"] .message-attachment-open {
  background: rgb(255 255 255 / 0.18);
  color: #ffffff;
}

.read-action-wrap {
  display: flex;
  justify-content: flex-start;
  margin-top: 2px;
}

.read-action {
  min-height: 32px;
  padding: 0 8px 0 10px;
  border-radius: 999px;
  border: 2px solid #2563eb;
  background: transparent;
  color: #2563eb;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.read-action-count {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 50%;
  background: #2563eb;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.composer-wrap {
  border-top: 1px solid var(--border-1);
  background: #eeeeee;
  padding: 4px 10px 10px 10px;
}

.template-picker {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.composer-tabs,
.template-strip {
  display: flex;
  gap: var(--space-1);
  margin-top: 0;
  overflow: auto;
}

.template-strip {
  width: 100%;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.template-strip::-webkit-scrollbar {
  display: none;
}

.template-group-switch {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: flex-start;
  gap: 22px;
  min-height: 36px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-1);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.template-group-switch::-webkit-scrollbar {
  display: none;
}

.template-group-switch-indicator {
  display: none;
}

.template-strip .filter-chip {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 6px 13px;
  border-radius: 999px;
  white-space: nowrap;
}

.template-strip .filter-chip:hover,
.template-strip .filter-chip[data-active="true"] {
  background: var(--bg-2);
  border-color: transparent;
  box-shadow: none;
  color: var(--accent);
}

.template-strip .filter-chip[data-active="true"] {
  background: var(--accent-soft);
}

.composer-tab {
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-sm);
  min-height: 36px;
  font-weight: 600;
}

.template-group-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 2px 7px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--fg-2);
  box-shadow: none;
  position: relative;
  z-index: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.1;
  transition:
    color 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.template-group-btn[data-active="true"],
.template-group-btn:hover {
  box-shadow: none;
  transform: none;
  background: transparent;
  border-color: transparent;
  color: var(--accent);
}

.template-group-count {
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgb(15 23 42 / 0.06);
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
}

.composer-reply {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border-1);
  border-radius: 10px;
  background: var(--bg-2);
}

.composer-reply-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.composer-reply-author {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.composer-reply-text {
  font-size: 12px;
  color: var(--fg-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer-reply-close {
  width: 22px;
  min-width: 22px;
  height: 22px;
  border-radius: 50%;
  color: var(--fg-2);
}

.composer-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.composer-attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid var(--border-1);
  background: var(--bg-2);
  max-width: 280px;
}

.composer-attachment-icon {
  width: 28px;
  min-width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid var(--border-1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.composer-attachment-icon svg {
  width: 16px;
  height: 16px;
}

.composer-attachment-kind {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.composer-attachment-kind svg {
  width: 16px;
  height: 16px;
}

.composer-attachment-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.composer-attachment-copy span:first-child {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer-attachment-copy span:last-child {
  font-size: 11px;
  color: var(--fg-3);
}

.composer-attachment-remove {
  width: 22px;
  min-width: 22px;
  height: 22px;
  border-radius: 50%;
  color: var(--fg-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

.composer-textarea {
  flex: 1;
  min-height: var(--composer-textarea-min-height);
  height: var(--composer-textarea-min-height);
  max-height: calc((16px * 20) + 24px);
  resize: none;
  background: #ffffff;
  color: var(--fg-0);
  line-height: 20px;
  padding: 10px 16px;
  border: 0 !important;
  border-radius: 20px !important;
  font-size: var(--text-sm);
  overflow: hidden;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--border-3) transparent;
}

.composer-textarea::-webkit-scrollbar {
  width: 4px;
}

.composer-textarea::-webkit-scrollbar-track {
  background: transparent;
}

.composer-textarea::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--border-3);
}

.composer-textarea::-webkit-scrollbar-thumb:hover {
  background: var(--border-2);
}

.composer-btn,
.composer-send,
.composer-channel-btn {
  border-radius: 50%;
}

.attachment-menu {
  position: relative;
  flex: 0 0 auto;
}

.composer-channel-menu {
  position: relative;
  flex: 0 0 auto;
}

.attachment-menu summary {
  list-style: none;
}

.attachment-menu summary::-webkit-details-marker {
  display: none;
}

.attachment-menu-trigger {
  user-select: none;
}

.attachment-menu-popover {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 25;
  display: grid;
  gap: 2px;
  min-width: 180px;
  padding: 6px;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 14px 36px rgb(17 24 39 / 0.14);
}

.composer-channel-popover {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 26;
  display: grid;
  gap: 2px;
  min-width: 220px;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 14px 36px rgb(17 24 39 / 0.14);
}

.composer-channel-menu[data-open="true"] .composer-channel-btn {
  background: var(--bg-2);
  color: var(--fg-0);
}

.attachment-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 10px;
  color: var(--fg-1);
  font-size: var(--text-sm);
  text-align: left;
  white-space: nowrap;
}

.attachment-menu-item:hover,
.attachment-menu-item:focus-visible {
  background: var(--bg-2);
  color: var(--fg-0);
}

.composer-channel-option {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 42px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--fg-1);
  font-size: var(--text-sm);
  text-align: left;
}

.composer-channel-option-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.composer-channel-option-copy span:first-child {
  font-weight: 600;
}

.composer-channel-option-copy span:last-child {
  color: var(--fg-3);
  font-size: var(--text-xs);
}

.composer-channel-option span:last-child,
.composer-channel-btn span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-channel-option:hover,
.composer-channel-option:focus-visible,
.composer-channel-option[data-active="true"] {
  background: var(--bg-2);
  color: var(--fg-0);
}

.composer-channel-option[data-active="true"] {
  font-weight: 650;
}

.attachment-menu-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-2);
}

.attachment-menu-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.composer-btn,
.composer-channel-btn {
  width: var(--composer-control-size);
  height: var(--composer-control-size);
  background: #ffffff;
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}

.composer-channel-btn {
  width: auto;
  min-width: 98px;
  max-width: 150px;
  padding: 0 10px;
  gap: 7px;
  border-radius: 20px;
  color: var(--fg-1);
  font-size: var(--text-sm);
  font-weight: 650;
  justify-content: flex-start;
}

.composer .composer-send {
  width: var(--composer-control-size);
  min-width: var(--composer-control-size);
  height: var(--composer-control-size);
  padding: 0;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.composer-btn:disabled,
.composer .composer-send:disabled,
.composer-textarea:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.composer .composer-send svg {
  width: 18px;
  height: 18px;
}

.composer-send.wide {
  width: 100%;
  min-width: 0;
  height: var(--composer-control-size);
  padding: 0 18px;
  border-radius: 6px;
  background: var(--accent);
  font-size: var(--text-sm);
  position: static;
  justify-content: center;
}

.composer-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-2);
  flex-wrap: wrap;
}

.composer-channel {
  display: inline-flex;
  gap: var(--space-1);
  align-items: center;
  font-size: var(--text-xs);
  color: var(--fg-2);
}

.right-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: min(360px, 100%);
  border-left: 1px solid var(--border-2);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 180ms ease;
  will-change: transform;
}

.right-panel[data-open="true"] {
  transform: translateX(0);
  box-shadow: -18px 0 40px rgb(15 23 42 / 0.12);
}

.right-panel-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: var(--bg-2);
  color: var(--fg-1);
  font-size: 18px;
  line-height: 1;
}

.right-panel-close:hover {
  background: var(--bg-3);
  color: var(--fg-0);
}

.empty-state {
  height: 100%;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
}

.empty-state h2 {
  margin: 0;
  color: var(--fg-0);
  font-size: 20px;
}

.empty-state p {
  margin: 0;
  color: var(--fg-2);
  font-size: 14px;
}

.empty-chat-state {
  place-content: center;
  width: 100%;
  min-height: 100%;
  padding: 0;
}

.patient-channel-start {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(560px, 100%);
  margin: 18px auto 0;
}

.patient-channel-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.patient-channel-choice {
  display: grid;
  justify-items: center;
  gap: 7px;
  width: 72px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--fg-1);
  cursor: pointer;
}

.patient-channel-choice-icon {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.08);
}

.patient-channel-choice-icon .messenger-dot {
  width: 34px;
  height: 34px;
  min-width: 34px;
}

.patient-channel-choice-label {
  max-width: 72px;
  overflow: hidden;
  color: var(--fg-2);
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.patient-channel-choice:hover .patient-channel-choice-icon {
  background: var(--bg-2);
}

.patient-channel-choice:hover .patient-channel-choice-label {
  color: var(--fg-0);
}

.wappi-modal h2 {
  margin: 0 0 14px;
  color: var(--fg-0);
}

.auth-card.wappi-modal {
  width: min(1000px, calc(100vw - 32px));
  position: relative;
}

.auth-card.conversation-modal {
  width: min(500px, calc(100vw - 32px));
}

.auth-card.appointment-modal {
  width: min(1120px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border-radius: 0;
  background: #ffffff;
  overflow: hidden;
}

.appointment-modal-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: var(--app-rail-width);
  margin: 0;
  padding: 0 56px 0 20px;
  border-bottom: 1px solid #e2e6ec;
  background: #ffffff;
}

.appointment-modal-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
}

.appointment-form {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(520px, 1.45fr);
  gap: 0;
  align-items: stretch;
  max-height: calc(100dvh - 32px - var(--app-rail-width));
  overflow-y: auto;
}

.appointment-patient-card {
  grid-column: 1;
  grid-row: 1 / span 5;
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 100%;
  padding: 18px 20px;
  border-right: 1px solid #e2e6ec;
  border-radius: 0;
  background: #ffffff;
}

.appointment-patient-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.appointment-patient-main span:last-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.appointment-patient-main strong {
  color: var(--fg-0);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.appointment-patient-main small,
.appointment-patient-meta {
  color: var(--fg-2);
  font-size: 12px;
  font-weight: 400;
}

.appointment-patient-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.appointment-patient-meta strong {
  color: var(--fg-1);
  font-weight: 500;
}

.appointment-patient-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 12px;
  padding-top: 4px;
}

.appointment-patient-fields .field {
  margin-bottom: 0;
}

.appointment-warning {
  grid-column: 2;
  margin: 14px 20px 0;
  padding: 10px 12px;
  border-radius: 0;
  background: #fff7ed;
  color: #9a3412;
  font-size: 12px;
  line-height: 1.35;
}

.appointment-grid {
  grid-column: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 12px;
  padding: 14px 20px 0;
}

.appointment-comment-field {
  grid-column: 2;
  margin: 0;
  padding: 0 20px;
}

.appointment-comment-field textarea {
  min-height: 92px;
}

.appointment-required-link {
  display: grid;
  gap: 6px;
}

.appointment-required-link span {
  color: var(--fg-2);
}

.appointment-required-link input[readonly] {
  background: var(--bg-2);
  color: var(--fg-1);
  cursor: default;
}

.appointment-modal .field span,
.appointment-required-link span {
  color: var(--fg-2);
  font-size: 12px;
  font-weight: 500;
}

.appointment-modal .field input,
.appointment-modal .field textarea,
.appointment-modal .field select {
  font-size: 13px;
  font-weight: 400;
}

.appointment-actions {
  grid-column: 2;
  padding: 2px 20px 20px;
}

.appointment-modal .field input,
.appointment-modal .field textarea,
.appointment-modal .field select {
  border-radius: 0;
}

.appointment-modal .btn-primary,
.appointment-modal .btn-secondary {
  border-radius: 0;
}

.wappi-modal-form {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.95fr);
  gap: 18px;
  align-items: start;
}

.wappi-modal-main {
  display: grid;
  gap: 0;
  min-width: 0;
}

.wappi-modal-side {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding-left: 6px;
}

.conversation-channel-switch {
  position: relative;
}

.conversation-channel-summary {
  list-style: none;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border-1);
  background: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.conversation-channel-summary::-webkit-details-marker {
  display: none;
}

.conversation-channel-label,
.conversation-channel-option-label {
  font-size: 13px;
  font-weight: 500;
}

.conversation-channel-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border-1);
  background: rgb(255 255 255 / 0.98);
  box-shadow: var(--shadow-md);
  z-index: 20;
}

.conversation-channel-option {
  min-height: 72px;
  padding: 8px 6px;
  border-radius: 8px;
  border: 1px solid var(--border-1);
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
}

.conversation-channel-option[data-active="true"] {
  background: var(--bg-2);
  border-color: rgb(2 54 103 / 0.18);
}

.conversation-channel-option:hover {
  background: var(--bg-2);
  border-color: rgb(2 54 103 / 0.18);
}

.conversation-channel-compact {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.channel-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 36px;
  padding: 0 5px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    border-color 160ms ease;
  opacity: 0.6;
}

.channel-tab:hover {
  opacity: 0.85;
  background: rgb(17 24 39 / 0.05);
}

.channel-tab.active {
  opacity: 1;
  background: rgb(2 54 103 / 0.1);
  border-color: var(--accent);
}

.channel-switch-minimal {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  height: 100%;
}

.channel-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  transition:
    background-color 120ms ease,
    border-color 120ms ease;
  opacity: 0.65;
}

.channel-btn:hover:not(:disabled) {
  opacity: 0.85;
  background: rgb(17 24 39 / 0.08);
  border-color: rgb(17 24 39 / 0.12);
}

.channel-btn.active {
  opacity: 1;
  background: rgb(2 54 103 / 0.15);
  border-color: var(--accent);
}

.channel-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 10px;
}

.modal-actions > * {
  width: auto;
  flex: 0 0 auto;
}

.health-grid {
  display: grid;
  gap: 8px;
}

.health-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid #e2e6ec;
  border-radius: 0;
  background: #ffffff;
}

.health-row > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.health-row strong {
  font-size: var(--text-sm);
  color: var(--fg-0);
}

.health-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-xs);
  color: var(--fg-2);
}

.health-pill {
  min-width: 64px;
  height: 26px;
  padding: 0 10px;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #166534;
  background: rgb(22 101 52 / 0.1);
}

.health-pill[data-ok="false"] {
  color: #92400e;
  background: rgb(146 64 14 / 0.12);
}

.modal-actions .btn-primary.wide,
.modal-actions .btn-secondary.wide,
.modal-actions .btn-subtle.wide,
.modal-actions .btn-danger.wide {
  width: auto;
  min-width: 160px;
}

.admin-sidebar .sidebar-top {
  padding: 0px;
  gap: 5px;
}

.admin-sidebar-divider {
  display: none;
}

.admin-nav {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 0;
  justify-content: flex-start;
  font-size: 13px;
  font-weight: 500;
  border: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
}

.admin-nav[data-active="true"],
.admin-nav:hover {
  background: #f5f5f5;
  border: 0;
  border-radius: 0;
  color: #182235;
  box-shadow: none;
  outline: none;
}

.admin-nav-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-2);
  flex-shrink: 0;
}

.admin-nav-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

.channel-card {
  width: 100%;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  background: transparent;
  border: 0;
}

.channel-card[data-active="true"],
.channel-card:hover {
  background: #f5f5f5;
  border: 0;
}

.channel-card-name {
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.add-channel-btn {
  width: 100%;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
  background: transparent;
  border: 0;
  color: var(--fg-1);
  font-size: 13px;
  font-weight: 500;
}

.add-channel-btn:hover {
  background: #f5f5f5;
  border: 0;
}

.add-channel-plus {
  width: 18px;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 16px;
  line-height: 1;
}

.settings-card {
  padding: 15px;
  border: 0;
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
}

.settings-card-title {
  margin: 0 0 5px;
  color: #182235;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
}

.admin-content {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 5px;
  background: var(--bg-0);
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 5px;
  min-height: var(--app-rail-width);
  margin: 0;
  padding: 0 15px;
  border-bottom: 0;
  background: #ffffff;
}

.admin-content > .admin-header {
  margin: -5px -5px 0;
}

.admin-header-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.admin-header h2 {
  margin: 0;
  color: #182235;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
}

.admin-header-description {
  margin: 0;
  color: var(--fg-3);
  font-size: 12px;
  line-height: 1.25;
}

.admin-collection {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 5px;
}

.admin-content > .settings-card,
.admin-content > .admin-grid,
.admin-content > .admin-collection {
  margin: 0;
}

.admin-content > .settings-card + .settings-card {
  margin-top: 0;
}

.admin-plus-btn {
  flex: 0 0 36px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 5px;
}

.admin-content .field input,
.admin-content .field textarea,
.admin-content .field select,
.admin-create-modal .field input,
.admin-create-modal .field textarea,
.admin-create-modal .field select {
  min-height: 36px;
  border-color: #e2e6ec;
  border-radius: 0;
  font-size: 13px;
}

.admin-content .btn-primary,
.admin-content .btn-secondary,
.admin-content .btn-subtle,
.admin-content .btn-danger,
.admin-create-modal .btn-primary,
.admin-create-modal .btn-secondary,
.admin-create-modal .btn-subtle,
.admin-create-modal .btn-danger {
  min-height: 36px;
  border-radius: 0;
  font-size: 13px;
  font-weight: 500;
}

.admin-content .btn-secondary:hover,
.admin-create-modal .btn-secondary:hover {
  background: #f5f5f5;
  color: #182235;
}

.admin-content table th,
.admin-content table td {
  padding: 10px 8px;
  border-bottom-color: #e2e6ec;
  font-size: 13px;
}

.admin-content table th {
  background: #f5f5f5;
  color: #6b7280;
  font-weight: 500;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.field span {
  font-size: 12px;
  color: var(--fg-3);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--border-1);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--fg-0);
  min-height: 40px;
}

.field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%2364758B' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 12px;
}

.appointment-service-custom {
  margin-top: 2px;
}

.field textarea {
  min-height: 100px;
  padding: 10px 12px;
  resize: vertical;
}

.template-placeholder-tools {
  display: grid;
  gap: 8px;
  margin: -2px 0 12px;
}

.template-placeholder-title {
  color: #1f2937;
  font-size: 12px;
  font-weight: 400;
}

.template-placeholder-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.template-placeholder-chip {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid #d8dee8;
  border-radius: 5px;
  background: #ffffff;
  color: #1f2937;
  font: 500 12px/1 var(--font);
  cursor: pointer;
}

.template-placeholder-chip:hover {
  border-color: #9aa8bb;
  background: #f8fafc;
}

.broadcast-grid {
  align-items: start;
}

.broadcast-form {
  display: grid;
  gap: 0;
}

.broadcast-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 12px;
}

.broadcast-meta span,
.broadcast-vars span {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--fg-1);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

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

.broadcast-preview h3 {
  margin: 0;
  color: var(--fg-0);
  font-size: 14px;
  font-weight: 600;
}

.broadcast-rules {
  display: grid;
  gap: 8px;
  color: var(--fg-2);
  font-size: 13px;
  line-height: 1.35;
}

.broadcast-vars {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.broadcast-summary div {
  padding: 10px;
  border-radius: 8px;
  background: var(--bg-2);
  display: grid;
  gap: 4px;
}

.broadcast-summary span {
  color: var(--fg-3);
  font-size: 12px;
}

.broadcast-summary strong {
  color: var(--fg-0);
  font-size: 13px;
  font-weight: 600;
}

.admin-sync-meta {
  display: grid;
  gap: 8px;
}

.settings-card-runtime {
  display: grid;
  gap: 14px;
}

.admin-runtime-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.admin-runtime-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-runtime-btn {
  min-height: 32px;
  min-width: 0;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 0;
}

.admin-runtime-channel {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-radius: 0;
  background: transparent;
}

.admin-runtime-table {
  border: 1px solid #e2e6ec;
  border-radius: 0;
  overflow: hidden;
  background: #ffffff;
}

.admin-runtime-row {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 12px 14px;
  border-bottom: 1px solid #e2e6ec;
}

.admin-runtime-row:last-child {
  border-bottom: 0;
}

.admin-runtime-key {
  color: var(--fg-3);
  font-size: 12px;
}

.admin-runtime-value {
  color: var(--fg-1);
  font-size: 13px;
  line-height: 1.45;
  text-align: left;
  word-break: break-word;
}

.admin-runtime-value[data-tone="danger"] {
  color: #c62828;
}

.admin-sync-actions {
  margin-top: 4px;
  justify-content: flex-start;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-profile-card {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e2e6ec;
}

.admin-profile-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-profile-icon {
  width: 36px;
  min-width: 36px;
  height: 36px;
  border-radius: 0;
  background: #f5f5f5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.admin-profile-copy {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-profile-copy strong {
  font-size: 14px;
  color: var(--fg-0);
}

.admin-channel-remove {
  min-height: 32px;
  border-radius: 0;
}

.channel-type-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.channel-type-chip {
  min-height: 76px;
  padding: 8px 6px;
  border-radius: 0;
  border: 1px solid #e2e6ec;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
}

.channel-type-chip[data-active="true"],
.channel-type-chip:hover {
  background: #f5f5f5;
  border-color: #e2e6ec;
}

.channel-type-icon {
  width: 28px;
  height: 28px;
  border-radius: 0;
  background: #ffffff;
  border: 1px solid #e2e6ec;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.wappi-modal-actions {
  grid-column: 1 / -1;
  margin-top: 2px;
  justify-content: center;
}

.template-card {
  display: grid;
  gap: 10px;
}

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

.template-group-section {
  display: grid;
  gap: 10px;
}

.template-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.template-group-header h3 {
  margin: 0;
  color: var(--fg-0);
  font-size: 14px;
}

.template-group-header span {
  min-height: 24px;
  padding: 0 9px;
  border-radius: 0;
  background: #f5f5f5;
  color: var(--fg-3);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
}

.admin-item-card {
  align-content: start;
}

.admin-item-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.admin-card-tools {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.admin-icon-btn {
  width: 28px;
  min-width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 0;
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-3);
}

.admin-icon-btn:hover {
  background: #f5f5f5;
  color: #111111;
}

.admin-icon-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

.admin-icon-btn-edit svg {
  width: 11px;
  height: 11px;
}

.admin-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-card-meta span {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 0;
  background: #f5f5f5;
  color: var(--fg-1);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.admin-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-table {
  table-layout: fixed;
}

.admin-table-actions-col {
  width: 72px;
}

.admin-table-tools {
  justify-content: flex-end;
}

.manager-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.manager-avatar {
  width: 32px;
  min-width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-2);
  color: var(--fg-0);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.manager-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.manager-copy strong {
  color: var(--fg-0);
  font-size: 13px;
}

.manager-copy span {
  color: var(--fg-3);
  font-size: 12px;
}

.admin-inline-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-inline-chips span,
.admin-table-status {
  min-height: 26px;
  padding: 0 9px;
  border-radius: 0;
  background: #f5f5f5;
  color: var(--fg-1);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
}

.admin-table-status[data-tone="success"] {
  background: #edf7f0;
  color: #23643b;
}

.admin-table-status[data-tone="muted"] {
  color: var(--fg-3);
}

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

.manager-channel-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.manager-channel-option {
  min-height: 40px;
  padding: 0 12px;
  border-radius: 0;
  border: 1px solid #e2e6ec;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--fg-1);
  font-size: 13px;
}

.manager-channel-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.auth-card.admin-create-modal {
  width: min(560px, calc(100vw - 32px));
  position: relative;
  border-radius: 0;
}

.admin-shell .auth-card.wappi-modal {
  border-radius: 0;
  background: #ffffff;
}

.admin-shell .modal-close {
  border-radius: 0;
}

.admin-shell :where(
  .add-channel-plus,
  .admin-plus-btn,
  .plus-btn,
  .messenger-dot,
  .avatar,
  .manager-avatar,
  .health-pill,
  .admin-table-status,
  .admin-inline-chips span,
  .admin-card-meta span,
  .template-group-header span,
  .admin-profile-icon,
  .channel-type-icon,
  .channel-type-chip,
  .manager-channel-option,
  .auto-reply-rule-card,
  .settings-card,
  .health-row,
  .btn-primary,
  .btn-secondary,
  .btn-subtle,
  .btn-danger,
  input,
  textarea,
  select
) {
  border-radius: 0;
}

.auto-reply-rule-list {
  display: grid;
  gap: 12px;
}

.auto-reply-rule-card {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid #e2e6ec;
  background: #ffffff;
}

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

.auto-reply-rule-head strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
  color: var(--fg-0);
}

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

.auto-reply-rule-wide {
  grid-column: 1 / -1;
}

.auth-role {
  justify-content: center;
  min-height: 40px;
  border-radius: 6px;
}

.admin-shell .auth-role {
  border-radius: 0;
}

.admin-content > :where(.admin-header, .settings-card, .admin-grid, .admin-collection, .stats-grid) {
  margin: 0;
}

.admin-content > .settings-card + .settings-card {
  margin-top: 0;
}

.admin-content :where(
  .admin-grid,
  .admin-collection,
  .stats-grid,
  .broadcast-grid,
  .broadcast-meta,
  .broadcast-preview,
  .broadcast-rules,
  .broadcast-vars,
  .broadcast-summary,
  .admin-sync-meta,
  .settings-card-runtime,
  .admin-runtime-head,
  .admin-runtime-actions,
  .admin-runtime-channel,
  .admin-runtime-row,
  .admin-sync-actions,
  .admin-profile-head,
  .channel-type-picker,
  .template-card,
  .template-group-stack,
  .template-group-section,
  .template-group-header,
  .admin-item-row,
  .admin-card-meta,
  .admin-card-actions,
  .manager-cell,
  .admin-inline-chips,
  .manager-modal-grid,
  .manager-channel-list,
  .auto-reply-rule-list,
  .auto-reply-rule-card,
  .auto-reply-rule-head,
  .auto-reply-rule-grid,
  .field
) {
  gap: 5px;
}

.admin-content :where(.settings-card, .stat-card, .deal-card, .auto-reply-rule-card, .broadcast-summary div, .health-row) {
  padding: 15px;
}

.admin-content :where(
  .settings-card,
  .stat-card,
  .deal-card,
  .health-row,
  .admin-runtime-table,
  .auto-reply-rule-card,
  .channel-type-chip,
  .channel-type-icon,
  .manager-channel-option,
  .admin-profile-card,
  .admin-table-status,
  .admin-inline-chips span,
  .admin-card-meta span,
  .template-group-header span,
  .broadcast-meta span,
  .broadcast-vars span,
  .broadcast-summary div,
  button,
  input,
  textarea,
  select
) {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  outline: none;
}

.admin-content :where(.stats-grid, .broadcast-meta) {
  margin: 0;
}

.admin-content :where(.settings-card h3, .settings-card-title) {
  margin: 0 0 5px;
}

.admin-content :where(table th, table td) {
  padding: 5px;
  border-bottom: 0;
}

.admin-content :where(
  .admin-card-meta span,
  .admin-inline-chips span,
  .admin-table-status,
  .template-group-header span,
  .broadcast-meta span,
  .broadcast-vars span
) {
  padding: 0 5px;
}

.admin-content .admin-profile-card {
  margin-top: 5px;
  padding-top: 15px;
}

.template-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg-0);
}

.template-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--fg-2);
}

.panel-hero {
  padding: var(--space-4) var(--space-3) var(--space-3);
  border-bottom: 1px solid var(--border-1);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--bg-1);
}

.h-name {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--fg-0);
  margin-top: 14px;
  letter-spacing: -0.02em;
}

.h-sub {
  color: var(--fg-3);
  font-size: var(--text-sm);
  margin-top: 4px;
}

.quick-actions {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
  justify-content: center;
  margin-top: var(--space-2);
}

.panel-section {
  padding: var(--space-3);
  border-bottom: 1px solid var(--border-1);
}

.panel-section h4,
.settings-card h3 {
  margin: 0 0 12px;
  color: var(--fg-0);
}

.panel-label {
  color: var(--fg-3);
  text-transform: none;
  letter-spacing: 0;
  font-size: var(--text-xs);
  margin-bottom: 6px;
}

.info-row,
.activity-item {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-1) 0;
  border-bottom: 1px solid var(--border-1);
}

.info-row:last-child,
.activity-item:last-child {
  border-bottom: 0;
}

.k {
  color: var(--fg-3);
  font-size: var(--text-sm);
}

.v {
  color: var(--fg-1);
  font-size: var(--text-sm);
  text-align: right;
}

.mono {
  font-family: var(--font-mono);
}

.phone-display {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: 6px 12px;
  background: rgb(17 24 39 / 0.03);
  border-radius: var(--r-sm);
  letter-spacing: 0.5px;
}

.copy-phone-btn {
  flex-shrink: 0;
  padding: 4px 8px;
  opacity: 0.6;
  transition: opacity 160ms ease;
  cursor: pointer;
}

.copy-phone-btn:hover {
  opacity: 1;
  background: rgb(17 24 39 / 0.1);
  border-radius: 6px;
}

.a-text {
  font-size: var(--text-sm);
  line-height: 1.5;
}

.deal-card,
.stat-card {
  padding: var(--space-3);
  border-radius: 10px;
  border: 1px solid var(--border-1);
  background: #ffffff;
  box-shadow: none;
}

.deal-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.deal-name {
  color: var(--fg-0);
  font-weight: 600;
}

.deal-amount {
  color: var(--fg-2);
  font-family: var(--font-mono);
}

.metric-list {
  display: grid;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.stat-card strong {
  display: block;
  margin-top: var(--space-1);
  font-size: 28px;
  color: var(--fg-0);
}

.admin-content .stats-grid {
  gap: 5px;
  margin: 0;
}

.admin-content .stat-card {
  padding: 15px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.analytics-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.admin-empty-cell {
  display: block;
  padding: 10px 0;
  color: var(--fg-3);
  font-size: 12px;
}

.admin-content .admin-header .admin-plus-btn {
  width: 36px;
  min-width: 36px;
  height: 36px;
  flex: 0 0 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #1c2534;
  color: #ffffff;
  box-shadow: none;
}

.admin-content .admin-header .admin-plus-btn:hover {
  background: #1c2534;
  color: #ffffff;
  opacity: 0.92;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: var(--space-2) 6px;
  border-bottom: 1px solid var(--border-1);
  font-size: var(--text-sm);
}

th {
  color: var(--fg-3);
  font-weight: 500;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgb(17 24 39 / 0.18);
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  z-index: 40;
}

.auth-card {
  width: min(520px, calc(100vw - 32px));
  padding: 28px;
  border-radius: 10px;
  border: 1px solid var(--border-2);
  background: rgb(255 255 255 / 0.98);
  box-shadow: var(--shadow-md);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  min-width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--fg-2);
  font-size: 20px;
  line-height: 1;
}

.modal-close:hover {
  background: transparent;
  color: var(--fg-0);
}

.auth-card,
.auth-card.wappi-modal,
.auth-card.conversation-modal,
.auth-card.appointment-modal,
.auth-card.admin-create-modal,
.admin-shell .auth-card.wappi-modal {
  border: 0;
  border-radius: 5px;
}

.auth-card :where(.btn-primary, .btn-secondary, .btn-subtle, .btn-danger, .auth-role),
.appointment-modal :where(.btn-primary, .btn-secondary),
.admin-create-modal :where(.btn-primary, .btn-secondary, .btn-subtle, .btn-danger) {
  border-radius: 3px;
}

.auth-card.wappi-modal.conversation-modal :where(.btn-primary, .btn-secondary, .btn-subtle, .btn-danger, .auth-role),
.auth-card.wappi-modal.appointment-modal :where(.btn-primary, .btn-secondary, .btn-subtle, .btn-danger, .auth-role),
.auth-card.wappi-modal.admin-create-modal :where(.btn-primary, .btn-secondary, .btn-subtle, .btn-danger, .auth-role) {
  border-radius: 3px;
}

.auth-card.wappi-modal.conversation-modal .btn-primary,
.auth-card.wappi-modal.conversation-modal .btn-secondary,
.auth-card.wappi-modal.conversation-modal .btn-subtle,
.auth-card.wappi-modal.conversation-modal .btn-danger,
.auth-card.wappi-modal.conversation-modal .auth-role,
.auth-card.wappi-modal.appointment-modal .btn-primary,
.auth-card.wappi-modal.appointment-modal .btn-secondary,
.auth-card.wappi-modal.appointment-modal .btn-subtle,
.auth-card.wappi-modal.appointment-modal .btn-danger,
.auth-card.wappi-modal.appointment-modal .auth-role,
.auth-card.wappi-modal.admin-create-modal .btn-primary,
.auth-card.wappi-modal.admin-create-modal .btn-secondary,
.auth-card.wappi-modal.admin-create-modal .btn-subtle,
.auth-card.wappi-modal.admin-create-modal .btn-danger,
.auth-card.wappi-modal.admin-create-modal .auth-role {
  border-radius: 3px;
}

.auth-card .modal-close,
.modal-close {
  border: 0;
  border-radius: 5px;
  background: transparent;
}

.auth-card .modal-close:hover,
.modal-close:hover {
  background: transparent;
}

@media (max-width: 900px) {
  .auth-card.wappi-modal {
    width: min(640px, calc(100vw - 24px));
  }

  .auth-card.conversation-modal {
    width: min(500px, calc(100vw - 24px));
  }

  .auth-card.appointment-modal {
    width: min(640px, calc(100vw - 24px));
  }

  .appointment-form {
    grid-template-columns: 1fr;
  }

  .appointment-patient-card,
  .appointment-warning,
  .appointment-grid,
  .appointment-comment-field,
  .appointment-actions {
    grid-column: 1;
    grid-row: auto;
  }

  .appointment-patient-card {
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid #e2e6ec;
  }

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

  .wappi-modal-form {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .wappi-modal-side {
    padding-left: 0;
  }

  .admin-runtime-head {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .admin-runtime-channel {
    order: 1;
  }

  .admin-runtime-actions {
    order: 2;
    justify-content: flex-start;
  }

  .admin-runtime-btn {
    flex: 0 0 auto;
  }

  .admin-runtime-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .auto-reply-rule-head,
  .auto-reply-rule-grid,
  .manager-modal-grid,
  .manager-channel-list {
    grid-template-columns: 1fr;
  }
}

.auth-card h1 {
  margin: 0 0 10px;
  color: var(--fg-0);
  font-size: 26px;
}

.auth-help {
  margin-top: 18px;
  color: var(--fg-3);
  font-size: 12px;
}

.auth-users {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.auth-user-row {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--bg-2);
  color: var(--fg-1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.auth-card p {
  color: var(--fg-2);
  line-height: 1.6;
}

.auth-actions {
  display: grid;
  gap: var(--space-2);
  margin-top: 22px;
}

.toast-stack {
  position: fixed;
  right: 18px;
  top: 18px;
  display: grid;
  gap: 10px;
  z-index: 50;
}

.toast {
  position: relative;
  width: min(360px, calc(100vw - 24px));
  padding: 14px 42px 14px 16px;
  border-radius: 10px;
  background: rgb(255 255 255 / 0.98);
  border: 0;
  box-shadow: 0 18px 40px rgb(15 23 42 / 0.16);
  overflow: hidden;
}

.toast::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: #16a34a;
}

.toast[data-tone="warn"]::before {
  background: #d97706;
}

.toast[data-tone="err"]::before {
  background: #dc2626;
}

.toast strong {
  display: block;
  color: var(--fg-0);
  margin-bottom: 4px;
  padding-right: 8px;
}

.toast span {
  color: var(--fg-2);
  font-size: 12px;
  line-height: 1.45;
  display: block;
}

.toast-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  min-width: 24px;
  height: 24px;
  border-radius: 50%;
  background: transparent;
  color: var(--fg-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}

.toast-close:hover {
  background: var(--bg-2);
  color: var(--fg-0);
}

.media-viewer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 28px;
}

.media-viewer-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: 0;
  background: rgb(15 23 42 / 0.76);
}

.media-viewer-card {
  position: relative;
  z-index: 1;
  width: fit-content;
  max-width: min(92vw, 980px);
  max-height: 92vh;
  display: grid;
  gap: 10px;
}

.media-viewer-head {
  height: 36px;
  padding: 0 4px 0 12px;
  border-radius: 10px;
  background: rgb(255 255 255 / 0.96);
  color: var(--fg-0);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 13px;
  font-weight: 600;
}

.media-viewer-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--fg-2);
  font-size: 20px;
  line-height: 1;
}

.media-viewer-image,
.media-viewer-video {
  display: block;
  max-width: min(92vw, 980px);
  max-height: calc(92vh - 46px);
  border-radius: 10px;
  background: #0f172a;
  object-fit: contain;
}

.popover {
  position: absolute;
  top: 46px;
  right: 0;
  width: 340px;
  background: rgb(255 255 255 / 0.98);
  border: 0;
  border-radius: 10px;
  box-shadow: 0 22px 48px rgb(15 23 42 / 0.16);
  padding: 0;
}

.popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.popover-close {
  width: 28px;
  min-width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  color: var(--fg-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}

.popover-close:hover {
  background: var(--bg-2);
  color: var(--fg-0);
}

.popover .activity-item {
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid rgb(15 23 42 / 0.06);
}

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

.popover .a-text strong {
  color: var(--fg-0);
}

.popover .a-time {
  color: var(--fg-3);
  white-space: nowrap;
}

.icon-btn:hover,
.settings-btn:hover,
.filter-chip:hover,
.crm-card-btn:hover,
.tags-chip:hover,
.quick-act-btn:hover,
.composer-tab:hover,
.me-chip:hover,
.status-chip:hover,
.btn-secondary:hover,
.btn-subtle:hover {
  background: var(--bg-2);
  border-color: var(--border-2);
  color: var(--fg-0);
}

.template-group-btn:hover,
.template-group-btn[data-active="true"] {
  box-shadow: none;
}

.template-group-btn:hover {
  background: transparent;
  border-color: transparent;
  color: var(--accent);
}

.template-group-btn:hover .template-group-count {
  background: rgb(15 23 42 / 0.06);
  color: inherit;
}

.template-group-btn[data-active="true"] {
  background: transparent;
  color: var(--accent);
}

.template-group-btn[data-active="true"] .template-group-count {
  background: var(--accent-soft);
  color: inherit;
}

.plus-btn:hover,
.composer-send:hover,
.btn-primary:hover {
  transform: none;
  opacity: 0.92;
}

.btn-danger:hover {
  background: rgb(254 242 242);
  border-color: rgb(220 38 38 / 0.24);
  color: var(--err);
}

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

.mode-count {
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.lead-dot {
  background: #0f766e;
}

.leads-main {
  --lead-control-height: 32px;
  --lead-control-radius: 999px;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  background: var(--bg-1);
  overflow: hidden;
  position: relative;
  isolation: isolate;
}

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

.lead-workspace-head h1,
.lead-detail-head h2 {
  margin: 2px 0 0;
  color: var(--fg-0);
  font-size: 18px;
  line-height: 1.15;
}

.lead-muted {
  color: var(--fg-2);
  font-size: 12px;
}

.lead-filter-panel {
  display: grid;
  gap: 6px;
}

.lead-funnel-controls {
  padding: 12px 10px 8px;
  border-bottom: 1px solid var(--border-1);
  background: #ffffff;
  display: grid;
  gap: 6px;
}

.lead-funnel-search-row {
  display: grid;
  grid-template-columns: auto var(--lead-control-height) minmax(220px, 1fr) auto;
  align-items: center;
  gap: 6px;
}

.lead-funnel-search {
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
}

.lead-create-btn {
  width: var(--lead-control-height);
  height: var(--lead-control-height);
  flex: 0 0 var(--lead-control-height);
  min-height: var(--lead-control-height);
  margin-right: 2px;
  padding: 0;
  border-radius: 50%;
}

.lead-create-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

.lead-funnel-search .search-input {
  height: var(--lead-control-height);
  padding: 0 34px 0 34px;
  font-size: 12px;
  background: var(--bg-2);
}

.lead-funnel-search .search-icon {
  left: 12px;
}

.lead-filter-dropdown {
  position: relative;
}

.lead-filter-dropdown summary {
  list-style: none;
}

.lead-filter-dropdown summary::-webkit-details-marker {
  display: none;
}

.lead-filter-trigger {
  width: var(--lead-control-height);
  min-width: var(--lead-control-height);
  height: var(--lead-control-height);
  min-height: var(--lead-control-height);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}

.lead-filter-trigger svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.lead-filter-trigger:hover,
.lead-filter-dropdown[open] .lead-filter-trigger {
  background: var(--bg-2) !important;
}

.lead-filter-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 9;
  width: min(720px, calc(100vw - 360px));
  min-width: 560px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border-1);
  background: #ffffff;
  box-shadow: 0 18px 44px rgb(15 23 42 / 0.16);
}

.lead-funnel-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
}

.lead-found-count {
  height: var(--lead-control-height);
  min-height: var(--lead-control-height);
  padding: 0 9px;
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--fg-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.lead-quick-filters,
.lead-tags,
.lead-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lead-chip,
.lead-view-btn,
.lead-tag {
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--border-1);
  background: #ffffff;
  color: var(--fg-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
}

.lead-view-switch .lead-view-btn {
  border-color: transparent;
  background: transparent;
  width: 28px;
  min-height: 28px;
  padding: 0;
  font-size: 12px;
}

.lead-view-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

.lead-chip[data-active="true"],
.lead-view-btn[data-active="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

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

.lead-funnel-controls .lead-filter-grid {
  grid-template-columns: repeat(3, minmax(130px, 1fr));
}

.lead-funnel-controls .chat-filter-field {
  gap: 3px;
}

.lead-funnel-controls .chat-filter-field span {
  font-size: 9px;
}

.lead-funnel-controls .chat-filter-field input,
.lead-funnel-controls .chat-filter-field select {
  min-height: 30px;
  padding-left: 12px;
  padding-right: 12px;
  font-size: 11px;
  border-radius: 999px;
}

.lead-empty-state {
  align-self: center;
  justify-self: center;
  width: min(360px, calc(100% - 28px));
  min-height: 240px;
  padding: 26px 24px;
  border: 1px solid var(--border-1);
  border-radius: 10px;
  background:
    radial-gradient(circle at 20% 10%, rgb(2 54 103 / 0.1), transparent 34%),
    #ffffff;
  color: var(--fg-1);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.lead-empty-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.lead-empty-icon svg {
  width: 24px;
  height: 24px;
}

.lead-empty-state strong {
  color: var(--fg-0);
  font-size: 16px;
  line-height: 1.2;
}

.lead-empty-state span {
  max-width: 260px;
  color: var(--fg-2);
  font-size: 12px;
  line-height: 1.45;
}

.lead-empty-action {
  min-height: 32px;
  margin-top: 4px;
  padding: 0 14px;
  border-radius: 999px;
}

.lead-card-head,
.lead-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.lead-card-head strong {
  min-width: 0;
  color: var(--fg-0);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-card-subject,
.lead-card-text,
.lead-card-footer {
  color: var(--fg-2);
  font-size: 12px;
}

.lead-type {
  min-height: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
}

.lead-type[data-type="повторная"] {
  background: transparent;
  color: #0f766e;
}

.lead-workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.lead-workspace-head,
.lead-detail-head {
  min-height: 58px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lead-workspace-head {
  min-height: 46px;
  padding: 6px 10px;
  justify-content: flex-end;
}

.lead-detail-head {
  min-height: var(--app-rail-width);
  padding: 0 0 0 20px;
  border-bottom: 1px solid #e2e6ec;
  background: #ffffff;
  flex: 0 0 auto;
}

.lead-detail-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
}

.lead-view-switch {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: var(--bg-2);
  align-items: center;
  height: var(--lead-control-height);
}

.lead-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lead-export-icon {
  width: var(--lead-control-height);
  height: var(--lead-control-height);
  flex: 0 0 var(--lead-control-height);
  border-radius: 999px;
  border: 1px solid var(--border-1);
  background: #ffffff;
  color: var(--fg-1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.lead-export-icon svg {
  width: 16px;
  height: 16px;
}

.lead-export-icon:hover {
  background: var(--bg-2);
  border-color: var(--border-2);
}

.lead-kanban {
  min-height: 0;
  padding: 10px;
  display: grid;
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: auto;
  justify-content: start;
  gap: 8px;
  overflow: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: rgb(107 114 128 / 0.42) transparent;
}

.lead-column {
  width: 220px;
  min-width: 0;
  min-height: 0;
  border-radius: 7px;
  background: var(--bg-2);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.lead-column-head {
  padding: 8px;
  border-bottom: 1px solid var(--border-1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.lead-column-title-row {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 1 1 auto;
}

.lead-column-head strong {
  min-width: 0;
  color: var(--fg-0);
  font-size: 11px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-column-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.lead-column-head span {
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--fg-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
}

.lead-column-icon-btn {
  width: 20px;
  min-width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 5px;
  color: var(--fg-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.lead-column-icon-btn svg {
  width: 14px;
  height: 14px;
  display: block;
}

.lead-column-edit-btn {
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, background-color 140ms ease, color 140ms ease;
}

.lead-column-title-row:hover .lead-column-edit-btn,
.lead-column-title-row:focus-within .lead-column-edit-btn {
  opacity: 1;
  pointer-events: auto;
}

.lead-column-icon-btn:hover {
  background: #ffffff;
  color: var(--fg-0);
}

.lead-column-delete-btn {
  color: var(--err);
}

.lead-column-save-btn {
  color: var(--ok);
}

.lead-column-title-input {
  width: 100%;
  min-width: 0;
  height: 28px;
  padding: 0 8px;
  color: var(--fg-0);
  font-size: 11px;
  font-weight: 500;
}

.lead-column-list {
  min-height: 0;
  padding: 7px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 7px;
  scrollbar-width: thin;
  scrollbar-color: rgb(107 114 128 / 0.38) transparent;
}

.lead-kanban-card {
  min-width: 0;
  width: 100%;
  padding: 7px;
  border-radius: 7px;
  border: 1px solid var(--border-1);
  background: #ffffff;
  display: grid;
  gap: 4px;
  text-align: left;
}

.lead-column-create {
  width: 80px;
  grid-template-rows: 1fr;
  border: 0;
  background: transparent;
  display: grid;
  place-items: center;
}

.lead-column-create-btn {
  width: 100%;
  min-width: 0;
  height: 100%;
  border-radius: 7px;
  border: 0;
  background: transparent;
  color: var(--fg-1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.lead-column-create-btn svg {
  width: 22px;
  height: 22px;
}

.lead-column-create-btn:hover {
  background: rgb(17 24 39 / 0.04);
}

.lead-kanban-card .lead-card-head,
.lead-kanban-card .lead-card-footer {
  gap: 6px;
}

.lead-kanban-card .lead-card-head {
  min-height: 14px;
  margin-bottom: 2px;
}

.lead-kanban-card .lead-card-name,
.lead-kanban-card .lead-card-footer span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-kanban-card .lead-card-name {
  display: block;
  color: var(--fg-0);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.lead-kanban-card .lead-card-head span {
  flex: 0 0 auto;
  font-size: 9.5px;
}

.lead-kanban-card .lead-type {
  min-height: 0;
  padding: 0;
  color: var(--fg-0);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.1;
}

.lead-kanban-card .lead-type[data-type="повторная"] {
  color: var(--fg-0);
}

.lead-tags-preview {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  overflow: hidden;
}

.lead-tag-mini {
  max-width: 100%;
  min-height: 18px;
  padding: 0 6px;
  border-radius: 5px;
  background: rgb(17 24 39 / 0.06);
  color: var(--fg-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.lead-tag-more {
  color: var(--accent);
  background: rgb(2 54 103 / 0.08);
}

.lead-assignee {
  min-width: 0;
  max-width: 190px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--fg-0);
  vertical-align: middle;
}

.lead-assignee-avatar {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 50%;
  background: #1c2534;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
}

.lead-assignee[data-empty="true"] .lead-assignee-avatar {
  background: rgb(17 24 39 / 0.08);
  color: var(--fg-3);
}

.lead-assignee-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.lead-assignee-compact {
  max-width: 100%;
  gap: 5px;
}

.lead-assignee-compact .lead-assignee-avatar {
  width: 18px;
  height: 18px;
  flex-basis: 18px;
  font-size: 8px;
}

.lead-assignee-compact .lead-assignee-name {
  color: var(--fg-2);
  font-size: 10px;
  font-weight: 600;
}

.lead-kanban-card:hover,
.lead-kanban-card[data-active="true"] {
  border-color: rgb(2 54 103 / 0.24);
  box-shadow: var(--shadow-sm);
}

.lead-card-subject {
  color: var(--fg-0);
  font-weight: 700;
  font-size: 11px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-card-text {
  max-height: 28px;
  color: var(--fg-2);
  font-size: 10px;
  line-height: 1.35;
  overflow: hidden;
}

.lead-kanban-card .lead-card-footer {
  font-size: 10px;
}

.lead-column-empty,
.lead-empty-small {
  padding: 14px;
  border-radius: 10px;
  color: var(--fg-3);
  background: rgb(255 255 255 / 0.72);
  font-size: 12px;
  text-align: center;
}

.lead-table-wrap {
  min-height: 0;
  overflow: auto;
  padding: 0 10px 10px;
  background: #ffffff;
  scrollbar-width: thin;
  scrollbar-color: rgb(107 114 128 / 0.42) transparent;
}

.lead-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: 12px;
}

.lead-table th {
  padding: 8px 9px;
  color: var(--fg-2);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-1);
  background: #ffffff;
}

.lead-table td {
  padding: 9px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-1);
  vertical-align: middle;
}

.lead-table td:first-child {
  border-left: 0;
  border-radius: 0;
}

.lead-table td:last-child {
  border-right: 0;
  border-radius: 0;
}

.lead-table tr {
  cursor: pointer;
}

.lead-table tr:hover td,
.lead-table tr[data-active="true"] td {
  background: var(--bg-2);
}

.lead-table td span {
  display: block;
  margin-top: 4px;
  color: var(--fg-2);
  font-size: 12px;
}

.lead-table td .lead-tags-preview {
  display: flex;
  margin-top: 5px;
}

.lead-table td .lead-tag-mini {
  font-size: 10px;
}

.lead-table td .lead-assignee,
.lead-table td .lead-assignee-avatar {
  display: inline-flex;
  margin-top: 0;
}

.lead-table td .lead-type {
  display: inline-flex;
  margin-top: 0;
  min-height: 0;
  line-height: 1;
  vertical-align: middle;
}

.lead-kanban::-webkit-scrollbar,
.lead-column-list::-webkit-scrollbar,
.lead-table-wrap::-webkit-scrollbar,
.lead-detail-panel::-webkit-scrollbar,
.lead-email-body::-webkit-scrollbar,
.lead-email-textarea::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.lead-kanban::-webkit-scrollbar-track,
.lead-column-list::-webkit-scrollbar-track,
.lead-table-wrap::-webkit-scrollbar-track,
.lead-detail-panel::-webkit-scrollbar-track,
.lead-email-body::-webkit-scrollbar-track,
.lead-email-textarea::-webkit-scrollbar-track {
  background: transparent;
}

.lead-kanban::-webkit-scrollbar-thumb,
.lead-column-list::-webkit-scrollbar-thumb,
.lead-table-wrap::-webkit-scrollbar-thumb,
.lead-detail-panel::-webkit-scrollbar-thumb,
.lead-email-body::-webkit-scrollbar-thumb,
.lead-email-textarea::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgb(107 114 128 / 0.38);
}

.lead-kanban::-webkit-scrollbar-thumb:hover,
.lead-column-list::-webkit-scrollbar-thumb:hover,
.lead-table-wrap::-webkit-scrollbar-thumb:hover,
.lead-detail-panel::-webkit-scrollbar-thumb:hover,
.lead-email-body::-webkit-scrollbar-thumb:hover,
.lead-email-textarea::-webkit-scrollbar-thumb:hover {
  background: rgb(107 114 128 / 0.56);
}

.lead-detail-layer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 16px;
  pointer-events: none;
  overflow: hidden;
}

.lead-detail-layer[data-open="true"] {
  pointer-events: auto;
}

.lead-detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(15 23 42 / 0.16);
  opacity: 0;
  animation: leadBackdropIn 160ms ease forwards;
}

.lead-detail-panel {
  position: relative;
  z-index: 1;
  width: min(1080px, calc(100vw - 32px));
  min-width: 0;
  height: auto;
  max-height: min(640px, calc(100dvh - 40px));
  min-height: 0;
  border-radius: 5px;
  background: #ffffff;
  box-shadow: 0 18px 44px rgb(15 23 42 / 0.18);
  display: flex;
  flex-direction: column;
  overflow: auto;
  transform: translateY(10px) scale(0.98);
  animation: leadPanelIn 180ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  scrollbar-width: thin;
  scrollbar-color: rgb(107 114 128 / 0.42) transparent;
}

.lead-detail-body {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(240px, 0.78fr) minmax(360px, 1fr) minmax(220px, 0.68fr);
  gap: 0;
  overflow: auto;
}

.lead-detail-contact,
.lead-detail-workflow,
.lead-appointments-column {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px 16px 16px;
}

.lead-detail-contact {
  border-right: 1px solid #e2e6ec;
  background: #ffffff;
}

.lead-detail-workflow {
  background: #ffffff;
}

.lead-appointments-column {
  border-left: 1px solid #e2e6ec;
  background: #ffffff;
}

.lead-detail-panel .field {
  gap: 5px;
  margin-bottom: 0;
}

.lead-detail-panel .field input,
.lead-detail-panel .field textarea,
.lead-detail-panel .field select,
.lead-detail-panel .lead-inline-input,
.lead-detail-panel .lead-add-tag input {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

html[data-performance-mode="low"] button,
html[data-performance-mode="low"] input,
html[data-performance-mode="low"] textarea,
html[data-performance-mode="low"] select {
  transition: none;
}

html[data-performance-mode="low"] .overlay,
html[data-performance-mode="low"] .chat-list-loader-overlay {
  backdrop-filter: none;
}

html[data-performance-mode="low"] .lead-detail-backdrop,
html[data-performance-mode="low"] .lead-detail-panel {
  animation: none;
  opacity: 1;
  transform: none;
}

.lead-detail-head-actions {
  align-self: stretch;
  display: inline-flex;
  align-items: stretch;
  gap: 0;
}

.lead-detail-title {
  min-width: 0;
  display: grid;
  align-items: center;
}

.lead-detail-title-line {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  line-height: 1.2;
}

.lead-detail-title-line h2,
.lead-detail-title-line span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-detail-title-line span {
  color: var(--fg-2);
  font-size: 12px;
  font-weight: 500;
}

.lead-copy-id-btn {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  background: var(--bg-2);
  color: var(--fg-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.lead-copy-id-btn svg {
  width: 14px;
  height: 14px;
}

.lead-copy-id-btn:hover {
  color: var(--fg-0);
  background: #eef2f7;
}

.lead-top-actions {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
}

.lead-top-action {
  min-height: calc(var(--app-rail-width) - 1px);
  padding: 0 16px;
  border: 0;
  border-left: 1px solid #e2e6ec;
  border-radius: 0;
  background: #ffffff;
  color: #182235;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}

.lead-top-action:hover {
  background: #f5f5f5;
  color: #182235;
}

.lead-top-icon-action {
  width: 52px;
  min-width: 52px;
  padding: 0;
}

.lead-top-icon-action svg {
  width: 22px;
  height: 22px;
}

.lead-edit-text-action {
  min-height: calc(var(--app-rail-width) - 1px);
  padding: 0 14px;
  border-left: 1px solid #e2e6ec;
  background: #ffffff;
  color: #182235;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.lead-edit-text-action svg {
  width: 22px;
  height: 22px;
}

.lead-edit-text-action:hover {
  background: #f5f5f5;
  color: #182235;
}

.lead-edit-text-action.lead-top-icon-action {
  width: 52px;
  min-width: 52px;
  padding: 0;
}

.lead-detail-close {
  width: 52px;
  min-width: 52px;
  min-height: calc(var(--app-rail-width) - 1px);
  border-radius: 0;
  border: 0;
  border-left: 1px solid #e2e6ec;
  background: #ffffff;
  color: #182235;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
}

.lead-detail-close:hover {
  background: #f5f5f5;
  color: #182235;
}

@keyframes leadPanelIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes leadBackdropIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.lead-detail-grid,
.lead-edit-grid,
.lead-control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0;
}

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

.lead-detail-grid div,
.lead-date-card {
  min-height: 52px;
  padding: 9px 10px;
  border-radius: 5px;
  background: var(--bg-2);
  display: grid;
  align-content: center;
  gap: 4px;
}

.lead-detail-grid span,
.lead-date-card span {
  color: var(--fg-2);
  font-size: 11px;
  font-weight: 700;
}

.lead-detail-grid strong,
.lead-date-card strong {
  min-width: 0;
  color: var(--fg-0);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-inline-input {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 5px;
  background: var(--bg-2);
  color: var(--fg-0);
  font-weight: 600;
}

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

.lead-detail-section {
  padding: 0;
  display: grid;
  gap: 6px;
}

.lead-email-body {
  max-height: 130px;
  padding: 9px 10px;
  border-radius: 5px;
  background: var(--bg-2);
  color: var(--fg-1);
  overflow: auto;
  font-size: 13px;
  line-height: 1.5;
  scrollbar-width: thin;
  scrollbar-color: rgb(107 114 128 / 0.42) transparent;
}

.lead-email-textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border: 0;
  outline: none;
  font: inherit;
}

.lead-source-box {
  padding: 9px 10px;
  border-radius: 5px;
  background: var(--bg-2);
  display: grid;
  gap: 6px;
  color: var(--fg-2);
  font-size: 12px;
}

.lead-source-box strong {
  color: var(--fg-0);
}

.lead-tag-removable {
  cursor: pointer;
}

.lead-add-tag {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.lead-add-tag input {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 5px;
  background: var(--bg-2);
}

.lead-actions {
  margin-top: 2px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.lead-actions :where(.btn-primary, .btn-secondary, .btn-subtle) {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

.lead-processed {
  margin: 0;
  padding: 8px 10px;
  border-radius: 5px;
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 12px;
  font-weight: 700;
}

.lead-appointments-head {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.lead-appointments-head strong {
  min-width: 0;
  color: var(--fg-2);
  font-size: 11px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-appointments-list {
  min-height: 0;
  display: grid;
  gap: 7px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgb(107 114 128 / 0.42) transparent;
}

.lead-appointment-item {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--border-1);
  border-radius: 5px;
  background: #ffffff;
  display: grid;
  gap: 3px;
}

.lead-appointment-item strong,
.lead-appointment-item span,
.lead-appointment-item small,
.lead-appointment-item em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-appointment-item strong {
  color: var(--fg-0);
  font-size: 12px;
  font-weight: 600;
}

.lead-appointment-item span,
.lead-appointment-item small {
  color: var(--fg-2);
  font-size: 12px;
  font-style: normal;
}

.lead-appointment-item em {
  color: #0f766e;
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
}

.lead-appointment-empty {
  min-height: 72px;
  border: 1px dashed var(--border-1);
  border-radius: 5px;
  color: var(--fg-2);
  display: grid;
  place-items: center;
  font-size: 12px;
}

.lead-empty {
  margin: auto;
}

@media (max-width: 1120px) {
  .app,
  .app[data-rail-collapsed="true"] {
    --app-rail-width: 56px;
  }

  .app-rail {
    padding-left: 0;
    padding-right: 0;
    align-items: stretch;
  }

  .app-rail-brand {
    margin-right: 0;
    margin-left: 0;
  }

  .app-rail-nav {
    width: 100%;
  }

  .app-rail-btn,
  .app-rail[data-collapsed="true"] .app-rail-btn {
    width: 100%;
    min-height: 44px;
    padding: 0;
    grid-template-columns: 1fr;
    justify-items: center;
    position: relative;
  }

  .app-rail-btn[data-active="true"]::before {
    left: 0;
  }

  .app-rail-label,
  .app-rail-count {
    position: absolute;
    top: 3px;
    right: 2px;
    min-width: 14px;
    height: 14px;
    padding: 0 3px;
    font-size: 9px;
  }

  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(280px, 38vh) 1fr;
  }

  .sidebar-resizer {
    display: none;
  }

  .admin-shell,
  .admin-grid,
  .admin-collection,
  .analytics-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: flex;
    border-right: 0;
    border-bottom: 1px solid var(--border-2);
  }

  .chat-header,
  .admin-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .composer-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .right-panel {
    width: min(360px, 92vw);
  }

  .search-kbd {
    display: none;
  }

  .messages {
    padding: var(--space-3);
  }

  .msg-row {
    max-width: 88%;
  }

  .leads-main {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
  }

  .lead-workspace {
    border-right: 0;
  }

  .lead-detail-panel {
    width: min(1080px, calc(100vw - 16px));
  }

  .lead-detail-body {
    grid-template-columns: 1fr;
  }

  .lead-detail-contact {
    border-right: 0;
    border-bottom: 1px solid #e2e6ec;
  }

  .lead-appointments-column {
    border-left: 0;
    border-top: 1px solid #e2e6ec;
  }

  .lead-detail-head {
    min-height: auto;
    padding: 10px 48px 10px 14px;
    align-items: flex-start;
  }

  .lead-detail-title {
    padding: 0;
  }

  .lead-detail-head-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .lead-top-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .lead-funnel-search-row {
    grid-template-columns: 1fr;
  }

  .lead-filter-popover {
    position: fixed;
    left: 12px;
    right: 12px;
    top: 128px;
    width: auto;
    min-width: 0;
    max-height: calc(100vh - 150px);
    overflow: auto;
  }

  .lead-funnel-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

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

  .lead-kanban {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: auto;
  }

  .lead-column {
    width: 220px;
  }

  .lead-column-create {
    width: 80px;
  }
}

@media (max-width: 700px) {
  .app-rail-brand {
    height: 56px;
  }

  .app-header-notifications,
  .app-header-notification-btn {
    width: 54px;
    min-width: 54px;
  }

  .app-header-notification-count {
    top: 9px;
    right: 7px;
  }

  .app-header-appointment-btn {
    min-width: 54px;
    width: 54px;
    min-height: 55px;
    padding: 0;
  }

  .app-header-appointment-btn span {
    display: none;
  }

  .app-header-user {
    padding: 0 10px;
    grid-template-columns: 30px minmax(0, auto);
    gap: 8px;
  }

  .app-header-logout {
    width: 44px;
    min-width: 44px;
    min-height: 55px;
  }

  .app-header-user .avatar.sm {
    width: 30px;
    height: 30px;
  }

  .app-header-user-copy {
    max-width: 112px;
  }

  .app-header-user-copy .me-name {
    font-size: 12px;
  }
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="hidden"]):not([type="search"]):not(.search-input):not(.manual-phone-input),
textarea:not(.search-input):not(.composer-textarea),
select:not(.search-input) {
  border: 1px solid var(--border-2) !important;
  border-radius: 3px !important;
  background-color: #ffffff !important;
}

.field > span,
.field > label,
.chat-filter-field > span,
.chat-filter-field > label,
.appointment-required-link > span,
.lead-detail-grid > span,
.lead-date-card > span {
  color: #1f2937 !important;
  font-weight: 400 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

.lead-filter-popover {
  border-radius: 5px !important;
}

.lead-funnel-controls .lead-filter-popover .lead-filter-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

.lead-funnel-controls .lead-filter-popover .chat-filter-field input,
.lead-funnel-controls .lead-filter-popover .chat-filter-field select {
  border-radius: 5px !important;
}


.scripts-page {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 5px;
  height: 100%;
  min-height: 0;
  padding: 5px;
  background: var(--bg-0);
}

.scripts-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 5px;
  min-height: 0;
}

.scripts-panel {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #ffffff;
}

.scripts-list-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.scripts-panel-head,
.script-stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 0 15px;
  border-bottom: 1px solid #e2e6ec;
  color: #182235;
  font-size: 13px;
  font-weight: 600;
}

.script-panel-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--fg-3);
  font-weight: 400;
}

.script-panel-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: #1c2534;
  color: #ffffff;
  cursor: pointer;
}

.script-panel-plus svg {
  width: 18px;
  height: 18px;
}

.script-small-btn,
.script-reset-btn {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 0;
  font-size: 12px;
}

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

.script-list-row {
  width: 100%;
  min-height: 58px;
  padding: 10px 15px;
  border: 0;
  border-bottom: 1px solid #eef1f5;
  border-radius: 0;
  background: #ffffff;
  color: #182235;
  text-align: left;
  cursor: pointer;
}

.script-list-row[data-active="true"] {
  background: #f3f6fa;
  box-shadow: inset 3px 0 0 var(--accent);
}

.script-list-title,
.script-list-meta {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.script-list-title {
  font-size: 13px;
  font-weight: 700;
}

.script-list-meta {
  margin-top: 4px;
  color: var(--fg-3);
  font-size: 12px;
  font-weight: 400;
}

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

.script-stage-head {
  align-items: center;
  min-height: 64px;
}

.script-stage-head h3 {
  margin: 3px 0 2px;
  color: #182235;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.script-stage-head p {
  margin: 0;
  color: var(--fg-3);
  font-size: 12px;
  font-weight: 400;
}

 .script-flow {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 15px;
  min-height: 0;
  padding: 20px;
}

.script-flow-text {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  max-width: 960px;
  overflow: auto;
  padding-right: 6px;
}

.script-text-block {
  display: grid;
  gap: 6px;
  padding: 0 0 12px;
  border-bottom: 1px solid #eef1f5;
}

.script-text-block[data-current="true"] {
  border-bottom-color: #d7e2ef;
}

.script-flow-kicker {
  display: block;
  color: var(--fg-3);
  font-size: 12px;
  font-weight: 500;
}

.script-flow-text p {
  margin: 0;
  color: #111827;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.45;
  white-space: pre-line;
}

.script-saved-answer {
  align-self: flex-start;
  max-width: min(720px, 100%);
  padding: 8px 12px;
  border-radius: 3px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
}

.script-saved-answer[data-color="blue"] { background: #0a4f95; }
.script-saved-answer[data-color="green"] { background: #0f766e; }
.script-saved-answer[data-color="amber"] { background: #b45309; }
.script-saved-answer[data-color="red"] { background: #be123c; }
.script-saved-answer[data-color="violet"] { background: #6d28d9; }
.script-saved-answer[data-color="gray"] { background: #4b5563; }

.script-answer-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
}

.script-answer {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 3px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.script-answer[data-color="blue"] { background: #0a4f95; }
.script-answer[data-color="green"] { background: #0f766e; }
.script-answer[data-color="amber"] { background: #b45309; }
.script-answer[data-color="red"] { background: #be123c; }
.script-answer[data-color="violet"] { background: #6d28d9; }
.script-answer[data-color="gray"] { background: #4b5563; }

.script-answer-yesno,
.script-answer-input-card {
  display: inline-flex;
  align-items: flex-end;
  gap: 6px;
  min-height: 38px;
  padding: 4px;
  border-radius: 3px;
  background: #f3f6fa;
}

.script-answer-yesno > span,
.script-answer-input-card label span {
  color: var(--fg-2);
  font-size: 12px;
  font-weight: 500;
}

.script-answer-yesno > span {
  align-self: center;
  padding: 0 4px;
}

.script-answer-input-card label {
  display: grid;
  gap: 3px;
}

.script-answer-input-card input {
  width: 190px;
  min-height: 30px;
  border: 1px solid #d7dde7 !important;
  border-radius: 3px !important;
  background: #ffffff !important;
  color: #182235;
  font-size: 13px;
}

.script-answer-input-submit {
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 3px;
  background: #1c2534;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.script-answer-input-card[data-color="blue"] { box-shadow: inset 3px 0 0 #0a4f95; }
.script-answer-input-card[data-color="green"] { box-shadow: inset 3px 0 0 #0f766e; }
.script-answer-input-card[data-color="amber"] { box-shadow: inset 3px 0 0 #b45309; }
.script-answer-input-card[data-color="red"] { box-shadow: inset 3px 0 0 #be123c; }
.script-answer-input-card[data-color="violet"] { box-shadow: inset 3px 0 0 #6d28d9; }
.script-answer-input-card[data-color="gray"] { box-shadow: inset 3px 0 0 #4b5563; }

.script-finish {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  color: var(--fg-3);
  font-size: 13px;
}

 .script-editor-wrap {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(17 24 39 / 0.35);
}

.script-editor {
  display: grid;
  gap: 12px;
  width: min(860px, calc(100vw - 48px));
  max-height: calc(100dvh - 48px);
  overflow: auto;
  padding: 0 15px 15px;
  border-radius: 5px;
  background: #ffffff;
}

.script-editor-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--app-rail-width);
  margin: 0 -15px;
  padding: 0 0 0 15px;
  border-bottom: 1px solid #e2e6ec;
  background: #ffffff;
}

.script-editor-head h3 {
  margin: 0;
  color: #182235;
  font-size: 15px;
}

.script-editor-head p {
  margin: 3px 0 0;
  color: var(--fg-3);
  font-size: 12px;
}

.script-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.script-flow-field textarea {
  min-height: 300px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  line-height: 1.45;
  resize: vertical;
}

.script-editor-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.script-color-help {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 3px;
  background: #f3f6fa;
  color: var(--fg-2);
  font-size: 12px;
}

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

@media (max-width: 1120px) {
  .scripts-layout {
    grid-template-columns: 260px minmax(0, 1fr);
  }
}

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

  .scripts-list-panel {
    max-height: 220px;
  }

  .script-flow {
    padding: 15px;
  }

  .script-flow-text p {
    font-size: 16px;
  }

  .script-editor-grid {
    grid-template-columns: 1fr;
  }
}
