:root {
  --ui-scale: 1;

  /* Shared semantic color system */
  --color-canvas: #f7f8fa;
  --color-panel: #f3f6f9;
  --color-surface: #ffffff;
  --color-surface-raised: #ffffff;
  --color-surface-soft: #f8fafc;
  --color-surface-muted: #eef3f8;
  --color-input: #ffffff;
  --color-hover: rgba(15, 63, 134, 0.06);
  --color-selected: rgba(15, 63, 134, 0.1);
  --color-selected-strong: rgba(15, 63, 134, 0.14);
  --color-text-primary: #14233b;
  --color-text-secondary: #596579;
  --color-text-muted: #7a8798;
  --color-text-inverse: #ffffff;
  --color-border-subtle: rgba(20, 35, 59, 0.08);
  --color-border: rgba(20, 35, 59, 0.12);
  --color-border-strong: rgba(20, 35, 59, 0.18);
  --color-border-emphasis: rgba(20, 35, 59, 0.28);
  --color-accent: #0f3f86;
  --color-accent-hover: #0a4d9d;
  --color-accent-pressed: #07356e;
  --color-accent-soft: rgba(15, 63, 134, 0.1);
  --color-accent-border: rgba(15, 63, 134, 0.22);
  --color-focus-ring: rgba(47, 111, 175, 0.18);
  --color-success: #16875a;
  --color-success-soft: rgba(22, 135, 90, 0.12);
  --color-warning: #b7791f;
  --color-warning-soft: rgba(183, 121, 31, 0.12);
  --color-danger: #c43d47;
  --color-danger-soft: rgba(196, 61, 71, 0.12);
  --color-info: #2f6faf;
  --color-info-soft: rgba(47, 111, 175, 0.12);
  --color-overlay: rgba(7, 12, 20, 0.62);
  --color-shadow: rgba(7, 30, 67, 0.14);
  --color-shadow-tight: rgba(7, 30, 67, 0.1);
  --color-message-inbound: #e9edf2;
  --color-message-outbound: #0f3f86;
  --color-media-background: #0f233e;
  --color-scrollbar-track: transparent;
  --color-scrollbar-thumb: rgba(89, 101, 121, 0.42);
  --color-navigation: #2d3043;
  --color-navigation-text: #ffffff;
  --color-navigation-border: color-mix(in srgb, var(--color-navigation-text) 10%, transparent);
  --color-navigation-border-strong: color-mix(in srgb, var(--color-navigation-text) 14%, transparent);
  --color-navigation-hover: color-mix(in srgb, var(--color-navigation-text) 8%, transparent);
  --color-navigation-selected: color-mix(in srgb, var(--color-navigation-text) 10%, transparent);
  --color-navigation-highlight: color-mix(in srgb, var(--color-navigation-text) 7.5%, transparent);
  --color-on-accent: var(--color-text-inverse);
  --color-on-accent-hover: var(--color-on-accent);
  --color-on-accent-pressed: var(--color-on-accent);
  --color-text-disabled: color-mix(in srgb, var(--color-text-primary) 42%, transparent);
  --color-surface-translucent: color-mix(in srgb, var(--color-surface) 92%, transparent);
  --color-surface-translucent-strong: color-mix(in srgb, var(--color-surface) 98%, transparent);
  --color-focus-border: color-mix(in srgb, var(--color-accent) 52%, transparent);
  --color-selection: color-mix(in srgb, var(--color-accent) 38%, transparent);
  --color-shadow-popover: color-mix(in srgb, var(--color-shadow) 86%, transparent);
  --color-shadow-side: color-mix(in srgb, var(--color-shadow) 58%, transparent);
  --color-avatar: var(--color-surface-muted);
  --color-avatar-text: var(--color-text-secondary);
  --color-note: var(--color-warning);
  --color-note-soft: var(--color-warning-soft);
  --color-note-border: color-mix(in srgb, var(--color-warning) 22%, transparent);
  --color-danger-border: color-mix(in srgb, var(--color-danger) 22%, transparent);
  --color-success-border: color-mix(in srgb, var(--color-success) 24%, transparent);
  --color-success-hover: color-mix(in srgb, var(--color-success) 86%, white);
  --color-pattern: var(--color-text-primary);
  --portal-pattern-image: none;
  --portal-pattern-native-size: 96px 96px;
  --portal-pattern-opacity: 0.07;
  --portal-pattern-intensity-percent: 100%;
  --portal-pattern-conversation-intensity-percent: 55%;

  /* Legacy aliases: existing components inherit the shared palette. */
  --app-bg: var(--color-canvas);
  --bg: var(--app-bg);
  --bg-panel: var(--color-panel);
  --bg-soft: var(--color-surface-soft);
  --ink: var(--color-text-primary);
  --ink-soft: var(--color-text-secondary);
  --navy: var(--color-accent);
  --navy-deep: var(--color-accent-pressed);
  --amber: var(--color-warning);
  --border: var(--color-border);
  --shadow: 0 24px 60px var(--color-shadow);
  --shadow-tight: 0 12px 28px var(--color-shadow-tight);
  --surface: var(--color-surface);
  --surface-soft: var(--color-surface-soft);
  --surface-muted: var(--color-surface-muted);
  --border-strong: var(--color-border-strong);
  --chart-line: var(--color-accent);
  --chart-line-fill: var(--color-accent-soft);
  --chart-axis: var(--color-text-secondary);
  --chart-grid: var(--color-border);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --font-body: "Manrope", "Segoe UI", sans-serif;
  --font-display: "Fraunces", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--app-bg);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

.hidden {
  display: none !important;
}

.contacts-page {
  display: grid;
  grid-template-columns: minmax(480px, 58%) minmax(360px, 42%);
  gap: 18px;
  min-height: calc(100dvh - 32px);
}

.contacts-list-panel,
.contacts-detail-panel {
  min-height: 0;
  background: var(--color-surface);
  border: 1px solid var(--border);
}

.contacts-list-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.contacts-detail-panel {
  overflow: hidden;
}

.contacts-toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.94);
}

.contacts-toolbar .tickets-filter-field,
.contacts-toolbar .contacts-filter-checkbox {
  min-width: 0;
}

.contacts-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  grid-column: 1 / -1;
}

.contacts-filter-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding-top: 24px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.contacts-bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--color-hover);
}

.contacts-bulk-bar input {
  min-width: 220px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 12px;
}

.contacts-table-shell {
  min-height: 0;
  overflow: auto;
}

.contacts-table th,
.contacts-table td {
  white-space: nowrap;
}

.contacts-table-check-cell {
  width: 42px;
}

.contacts-table-row {
  cursor: pointer;
  content-visibility: auto;
  contain: layout paint style;
  contain-intrinsic-size: 58px;
}

.contacts-table-row.is-selected {
  background: var(--color-hover);
}

.contacts-stage-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--stage-color, var(--color-accent)) 12%, white);
  color: var(--stage-color, var(--color-accent));
  font-size: 12px;
  font-weight: 800;
}

.contacts-stage-badge.is-empty {
  background: var(--color-hover);
  color: var(--ink-soft);
}

.contacts-duplicate-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(199, 34, 34, 0.1);
  color: #b42318;
  font-size: 12px;
  font-weight: 800;
}

.contacts-detail-empty {
  height: 100%;
  min-height: 520px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: var(--ink-soft);
  text-align: center;
  padding: 24px;
}

.contacts-detail-empty i {
  width: 40px;
  height: 40px;
}

.contacts-detail-card {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

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

.contacts-detail-head h3 {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
}

.contacts-detail-head p {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.contacts-detail-head-actions {
  min-width: 190px;
}

.contacts-detail-tabs {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
}

.contacts-detail-tab {
  height: 48px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 800;
  border-bottom: 2px solid transparent;
}

.contacts-detail-tab.is-active {
  color: var(--navy);
  border-bottom-color: var(--navy);
}

.contacts-detail-body {
  min-height: 0;
  overflow: auto;
  padding: 18px;
}

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

.contacts-detail-field {
  display: grid;
  gap: 8px;
}

.contacts-detail-field span {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.contacts-detail-field input,
.contacts-detail-field textarea,
.contacts-admin-row input,
.contacts-import-toolbar input[type="file"] {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--color-surface);
  color: var(--ink);
  padding: 11px 13px;
  outline: none;
}

.contacts-detail-field input:focus,
.contacts-detail-field textarea:focus,
.contacts-admin-row input:focus {
  border-color: rgba(0, 0, 0, 0.25);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.contacts-detail-field-span-2 {
  grid-column: 1 / -1;
}

.contacts-custom-fields,
.contacts-duplicates-list,
.contacts-notes-list,
.contacts-activity-list {
  display: grid;
  gap: 12px;
}

.contacts-mini-empty {
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  color: var(--ink-soft);
  font-size: 14px;
}

.contacts-duplicate-item {
  display: grid;
  gap: 4px;
  justify-items: start;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--color-hover);
  color: var(--ink);
  text-align: left;
}

.contacts-notes-panel {
  display: grid;
  gap: 16px;
}

.contacts-notes-compose textarea {
  min-height: 120px;
  resize: vertical;
}

.contacts-notes-actions {
  display: flex;
  justify-content: end;
  margin-top: 10px;
}

.contacts-activity-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.contacts-activity-item time {
  color: var(--ink-soft);
  font-size: 13px;
  white-space: nowrap;
}

.contacts-conversations-shell {
  display: grid;
  grid-template-columns: minmax(220px, 36%) minmax(0, 1fr);
  gap: 14px;
  min-height: 520px;
}

.contacts-conversations-list {
  display: grid;
  align-content: start;
  gap: 10px;
}

.contacts-conversation-item {
  width: 100%;
  display: grid;
  gap: 6px;
  justify-items: start;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--color-surface);
  color: var(--ink);
  text-align: left;
}

.contacts-conversation-item.is-active {
  background: var(--color-hover);
  border-color: rgba(7, 53, 110, 0.18);
}

.contacts-conversation-item span {
  color: var(--ink-soft);
  font-size: 13px;
}

.contacts-conversation-preview {
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  background: rgba(248, 244, 238, 0.7);
  overflow: auto;
}

.contacts-conversation-notes {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.contacts-conversation-notes h4 {
  margin: 0;
  font-size: 15px;
  color: var(--ink-soft);
}

.crm-page {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 0;
  position: relative;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.crm-sidebar,
.crm-main {
  min-height: 0;
  height: 100%;
}

.crm-sidebar {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 22px 18px;
  background: linear-gradient(180deg, #ffffff 0%, rgba(255, 255, 255, 0.95) 100%);
  border: 1px solid var(--border);
  border-right: none;
  overflow-y: auto;
  overflow-x: hidden;
}

.crm-sidebar-head {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--color-selected);
}

.crm-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
}

.crm-sidebar-brand-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--navy);
}

.crm-sidebar-brand-icon svg {
  width: 18px;
  height: 18px;
}

.crm-sidebar-head strong {
  display: block;
  font-size: 25px;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.crm-sidebar-head p {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.6;
}

.crm-sidebar-nav {
  display: grid;
  gap: 8px;
}

.crm-sidebar-group {
  display: grid;
  gap: 8px;
}

.crm-sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 800;
  text-align: left;
}

.crm-sidebar-link.is-active {
  background: rgba(7, 53, 110, 0.07);
  border-color: var(--color-selected-strong);
  color: var(--navy);
}

.crm-sidebar-link svg {
  width: 18px;
  height: 18px;
}

.crm-sidebar-link-parent {
  padding-right: 10px;
}

.crm-sidebar-link-parent span {
  flex: 1;
}

.crm-sidebar-caret {
  margin-left: auto;
  opacity: 0.7;
}

.crm-sidebar-children {
  display: grid;
  gap: 4px;
  margin-left: 18px;
  padding-left: 14px;
  border-left: 1px solid var(--color-selected-strong);
}

.crm-sidebar-child {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 800;
  text-align: left;
}

.crm-sidebar-child:hover,
.crm-sidebar-child.is-active {
  background: var(--color-hover);
  border-color: var(--color-selected);
  color: var(--navy);
}

.crm-sidebar-child-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 999px;
  background: var(--pipeline-color, var(--navy));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pipeline-color, var(--navy)) 14%, transparent);
}

.crm-sidebar-child-skeleton {
  pointer-events: none;
  opacity: 0.78;
  animation: crmSidebarSkeletonPulse 1.25s ease-in-out infinite;
}

.crm-sidebar-child-skeleton:nth-child(2n) {
  animation-delay: 0.12s;
}

.crm-sidebar-child-skeleton:nth-child(3n) {
  animation-delay: 0.24s;
}

.crm-sidebar-skeleton-dot,
.crm-sidebar-skeleton-line {
  display: block;
  border-radius: 999px;
  background: var(--color-selected-strong);
}

.crm-sidebar-skeleton-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
}

.crm-sidebar-skeleton-line {
  width: min(112px, 72%);
  height: 12px;
}

.crm-sidebar-child-create {
  color: var(--navy);
}

.crm-sidebar-child-create svg {
  width: 16px;
  height: 16px;
}

.crm-sidebar-child-lock {
  width: 14px;
  height: 14px;
  margin-left: auto;
  color: var(--ink-soft);
}

.crm-sidebar-child-note {
  padding: 8px 10px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

@keyframes crmSidebarSkeletonPulse {
  0%,
  100% {
    opacity: 0.64;
  }

  50% {
    opacity: 0.92;
  }
}

.crm-main {
  border: 1px solid var(--border);
  border-left: 1px solid var(--color-border-subtle);
  background: var(--color-surface);
  overflow: hidden;
}

.crm-view-shell,
.crm-contact-shell {
  height: 100%;
  min-height: 0;
  overflow: auto;
}

.crm-view-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100%;
}

.crm-view-shell-pipeline {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.crm-view-shell.crm-view-shell-has-footer {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.crm-view-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  padding: 24px 26px 18px;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(circle at top right, rgba(241, 169, 59, 0.14), transparent 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 244, 238, 0.76));
}

.crm-view-kicker {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.crm-view-header h2 {
  margin: 0;
  font-size: 34px;
  letter-spacing: -0.04em;
  line-height: 0.98;
}

.crm-view-header p {
  max-width: 720px;
  margin: 10px 0 0;
  color: var(--ink-soft);
  line-height: 1.7;
}

.crm-view-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 10px;
}

.crm-contacts-filter-panel {
  position: relative;
  z-index: 30;
  display: grid;
  gap: 14px;
  padding: 20px 26px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--color-surface);
}

.crm-contacts-filter-primary {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.crm-contacts-filter-compact {
  align-items: end;
  justify-content: start;
}

.crm-contacts-list-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 420px) auto minmax(180px, 210px) minmax(88px, 1fr);
  align-items: end;
  column-gap: 18px;
}

.crm-contacts-search {
  flex: 0 1 420px;
  display: grid;
  gap: 7px;
  max-width: 460px;
}

.crm-contacts-sort {
  flex: 0 0 210px;
  display: grid;
  gap: 7px;
}

.crm-contacts-search > span,
.crm-contacts-sort > span,
.crm-contacts-filter-grid .crm-toolbar-field > span {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.crm-search-field-large input {
  height: 48px;
  border-radius: 16px;
  font-size: 15px;
  background: var(--color-surface);
  box-shadow: 0 10px 24px rgba(7, 30, 67, 0.04);
}

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

.crm-contacts-list-toolbar .crm-contacts-actions {
  justify-self: end;
  align-self: end;
}

.crm-contacts-actions .tickets-filter-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  white-space: nowrap;
}

.crm-contacts-actions .tickets-filter-button i {
  width: 16px;
  height: 16px;
}

.crm-contacts-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
  align-items: start;
}

.crm-contacts-filter-popover {
  position: absolute;
  z-index: 80;
  top: calc(100% - 8px);
  left: 26px;
  width: min(900px, calc(100vw - 340px));
  max-height: min(680px, calc(100vh - 180px));
  overflow: auto;
  padding: 16px;
  border: 1px solid rgba(15, 63, 134, 0.14);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.98)),
    #fff;
  box-shadow:
    0 28px 70px rgba(7, 30, 67, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.72) inset;
}

.crm-contacts-filter-popover-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border-subtle);
}

.crm-contacts-filter-popover-head div {
  display: grid;
  gap: 3px;
}

.crm-contacts-filter-popover-head strong {
  color: var(--ink);
  font-size: 16px;
  letter-spacing: -0.02em;
}

.crm-contacts-filter-popover-head span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.crm-popover-close {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  color: var(--ink-soft);
}

.crm-popover-close:hover {
  border-color: rgba(15, 63, 134, 0.2);
  color: var(--navy);
  background: rgba(15, 63, 134, 0.05);
}

.crm-popover-close i {
  width: 16px;
  height: 16px;
}

.crm-contact-filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  align-self: end;
  white-space: nowrap;
}

.crm-contact-filter-toggle i {
  width: 17px;
  height: 17px;
}

.crm-contact-filter-toggle span {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--navy);
  color: var(--color-text-inverse);
  font-size: 11px;
  font-weight: 850;
}

.crm-contact-filter-toggle.is-active {
  border-color: rgba(15, 63, 134, 0.24);
  background: rgba(15, 63, 134, 0.07);
  color: var(--navy);
}

.crm-filter-checkbox-stack {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  min-height: 42px;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--color-surface);
}

.crm-toolbar-field-wide {
  grid-column: 1 / -1;
}

.crm-contacts-filter-grid .crm-toolbar-field input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 0 13px;
  color: var(--ink);
  background: var(--color-surface);
}

.crm-contact-duplicate-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--color-surface);
  color: var(--ink);
  cursor: pointer;
}

.crm-contact-duplicate-toggle input {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  accent-color: var(--navy);
}

.crm-contact-duplicate-toggle span {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.crm-contact-duplicate-toggle strong {
  font-size: 13px;
  line-height: 1.1;
}

.crm-contact-duplicate-toggle small {
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.2;
}

.crm-active-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 30px;
}

.crm-active-filters-empty {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 750;
}

.crm-active-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 9px 0 11px;
  border: 1px solid rgba(15, 63, 134, 0.16);
  border-radius: 999px;
  background: rgba(15, 63, 134, 0.07);
  color: var(--navy);
  font-size: 12px;
  font-weight: 800;
}

.crm-active-filter-chip span {
  color: var(--ink-soft);
  font-weight: 800;
}

.crm-active-filter-chip i {
  width: 13px;
  height: 13px;
}

.crm-active-filter-chip:hover {
  border-color: rgba(15, 63, 134, 0.26);
  background: rgba(15, 63, 134, 0.11);
}

.crm-active-filters-clear {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 850;
}

.crm-active-filters-clear:not(:disabled):hover {
  background: rgba(15, 63, 134, 0.06);
  color: var(--navy);
}

.crm-active-filters-clear:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.crm-organizations-toolbar {
  display: grid;
  grid-template-columns: minmax(250px, 360px) minmax(150px, 190px) minmax(150px, 190px) auto minmax(0, 1fr) auto;
  align-items: end;
}

.crm-organizations-toolbar > .crm-active-filters-clear {
  justify-self: start;
}

.crm-organizations-toolbar .crm-contacts-actions {
  grid-column: 6;
  justify-self: end;
}

.crm-organizations-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.crm-organizations-layout.has-detail {
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.65fr);
}

.crm-organization-detail {
  min-height: 0;
  overflow: auto;
  padding: 22px;
  border-left: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(15, 63, 134, 0.035), transparent 210px),
    #fff;
}

.crm-organization-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.crm-organizations-toolbar .crm-toolbar-field input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 0 13px;
  color: var(--ink);
  background: var(--color-surface);
}

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

.crm-organization-detail-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 28px;
  letter-spacing: -0.04em;
}

.crm-organization-detail-head p {
  margin: 0;
  color: var(--ink-soft);
  font-weight: 700;
}

.crm-organization-contact-list {
  display: grid;
  gap: 10px;
}

.crm-organization-contact-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--color-surface);
}

.crm-organization-contact-table-head > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.crm-organization-contact-table-head strong {
  color: var(--ink);
  font-size: 17px;
  font-weight: 900;
}

.crm-organization-contact-table-head span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
}

.crm-organization-contact-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.crm-org-add-contact-panel {
  display: grid;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 63, 134, 0.035);
}

.crm-org-add-contact-list {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
}

.crm-org-add-contact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--color-surface);
}

.crm-org-add-contact-row > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.crm-org-add-contact-row strong {
  color: var(--ink);
}

.crm-org-add-contact-row span {
  color: var(--ink-soft);
  font-weight: 700;
}

.crm-organization-contact {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--color-surface);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 8px 20px rgba(7, 30, 67, 0.04);
  content-visibility: auto;
  contain: layout paint style;
  contain-intrinsic-size: 72px;
}

.crm-organization-contact:hover {
  border-color: rgba(15, 63, 134, 0.22);
  background: rgba(15, 63, 134, 0.04);
}

.crm-organization-contact span,
.crm-organization-contact small {
  color: var(--ink-soft);
  font-weight: 700;
}

.crm-organization-pill,
.agents-right-org-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(15, 63, 134, 0.14);
  border-radius: 999px;
  background: rgba(15, 63, 134, 0.06);
  color: var(--navy);
  font-size: 12px;
  font-weight: 850;
}

.crm-organization-pill i {
  width: 14px;
  height: 14px;
}

.crm-organization-pill small,
.agents-right-org-pill small {
  color: var(--ink-soft);
  font-weight: 800;
}

.crm-organization-membership-list {
  display: grid;
  gap: 10px;
}

.crm-organization-membership-card {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid rgba(15, 63, 134, 0.12);
  border-radius: 14px;
  background: rgba(15, 63, 134, 0.035);
}

.crm-organization-membership-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.crm-organization-remove {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(176, 46, 46, 0.16);
  border-radius: 10px;
  background: rgba(176, 46, 46, 0.06);
  color: rgba(176, 46, 46, 0.8);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.crm-organization-remove:hover {
  border-color: rgba(176, 46, 46, 0.28);
  background: rgba(176, 46, 46, 0.11);
}

.crm-organization-remove i,
.crm-organization-remove svg {
  width: 14px;
  height: 14px;
}

.crm-organization-role-edit {
  display: grid;
  gap: 5px;
}

.crm-organization-role-edit span {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.crm-organization-role-edit input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 0 11px;
  color: var(--ink);
  background: var(--color-surface);
}

.crm-contact-organization-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(140px, 0.65fr) auto;
  gap: 10px;
  margin-top: 12px;
  align-items: center;
}

.crm-contact-organization-add input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 12px;
}

.agents-right-org-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.agents-right-org-list > small {
  color: var(--ink-soft);
  font-weight: 750;
}

.agents-right-pipeline-list {
  align-items: center;
}

.agents-right-pipeline-list-wrap {
  position: relative;
}

.agents-right-pipeline-list-wrap.is-collapsible {
  margin-bottom: 2px;
}

.agents-right-pipeline-list-wrap.is-collapsed {
  max-height: 100px;
  overflow: hidden;
}

.agents-right-pipeline-list-wrap.is-collapsed::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 36px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), #fff 88%);
}

.agents-right-pipeline-list > small {
  color: var(--ink-soft);
  font-weight: 750;
}

.agents-right-pipeline-more {
  justify-self: end;
  margin-right: 12px;
  border: 0;
  background: transparent;
  color: var(--navy);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.2;
  padding: 2px 0;
  cursor: pointer;
}

.agents-right-pipeline-more:hover {
  text-decoration: underline;
}

.agents-right-organization-field {
  position: relative;
}

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

.agents-right-organization-head > span {
  min-width: 0;
}

.agents-right-add-mini {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(15, 63, 134, 0.16);
  border-radius: 9px;
  background: rgba(15, 63, 134, 0.05);
  color: var(--navy);
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.agents-right-add-mini:hover,
.agents-right-add-mini.is-active {
  border-color: rgba(15, 63, 134, 0.28);
  background: rgba(15, 63, 134, 0.1);
}

.agents-right-add-mini:active {
  transform: scale(0.96);
}

.agents-right-add-mini i,
.agents-right-add-mini svg {
  width: 15px;
  height: 15px;
}

.agents-right-organization-add {
  position: relative;
  z-index: 5;
  display: grid;
  gap: 10px;
}

.agents-right-organization-add > .agents-right-field {
  gap: 6px;
}

.crm-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1.4fr) repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
  flex: 0 0 auto;
  position: relative;
  z-index: 8;
  padding: 18px 26px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.crm-toolbar-grid {
  grid-template-columns: minmax(280px, 1.4fr) repeat(7, minmax(0, 1fr));
}

.crm-toolbar-with-actions {
  grid-template-columns: 340px 220px 190px auto auto;
  align-items: end;
}

.crm-search-field {
  position: relative;
  display: flex;
  align-items: center;
}

.crm-toolbar-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.crm-toolbar-field > span {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.crm-search-field svg {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--ink-soft);
}

.crm-search-field input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0 14px 0 42px;
}

.crm-check-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding-top: 20px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.crm-toolbar-actions {
  display: flex;
  align-items: end;
  justify-content: end;
  gap: 10px;
  flex-wrap: wrap;
  justify-self: end;
}

.crm-toolbar-filter-actions {
  display: flex;
  align-items: end;
  justify-content: flex-start;
}

.crm-toolbar-clear-button {
  height: 42px;
  white-space: nowrap;
}

.crm-filter-menu {
  position: relative;
}

.crm-filter-menu-trigger {
  width: 100%;
}

.crm-filter-menu-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  width: 220px;
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--color-surface);
  box-shadow: 0 16px 32px rgba(7, 30, 67, 0.14);
}

.crm-filter-check {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--color-border-subtle);
  border-radius: 11px;
  background: rgba(248, 251, 255, 0.78);
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.crm-filter-check:hover {
  background: var(--color-hover);
}

.crm-filter-check input {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  box-sizing: border-box;
  width: 18px;
  height: 18px;
  min-width: 18px;
  max-width: 18px;
  min-height: 18px;
  max-height: 18px;
  display: inline-grid;
  place-items: center;
  border: 1.5px solid rgba(15, 63, 134, 0.3);
  border-radius: 6px;
  background: var(--color-surface);
  margin: 0;
}

.crm-filter-check input:checked {
  border-color: var(--navy);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 13px 13px no-repeat,
    var(--navy);
}

.crm-filter-check span {
  min-width: 0;
  line-height: 1.2;
}

.crm-toolbar-icon-button {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--color-surface);
  color: var(--navy);
  box-shadow: 0 6px 16px rgba(7, 30, 67, 0.05);
  transition:
    background 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.crm-toolbar-icon-button:hover {
  border-color: rgba(15, 63, 134, 0.18);
  background: rgba(15, 63, 134, 0.06);
  box-shadow: 0 10px 20px rgba(7, 30, 67, 0.08);
  transform: translateY(-1px);
}

.crm-toolbar-icon-button:disabled {
  cursor: wait;
  opacity: 0.82;
}

.crm-toolbar-icon-button.is-refreshing {
  border-color: rgba(15, 63, 134, 0.24);
  background: rgba(15, 63, 134, 0.07);
  color: var(--navy);
  transform: none;
}

.crm-toolbar-icon-button i {
  width: 18px;
  height: 18px;
}

.crm-toolbar-icon-button.is-refreshing i,
.crm-toolbar-icon-button.is-refreshing svg {
  animation: crmRefreshSpin 0.8s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .crm-sidebar-child-skeleton,
  .crm-toolbar-icon-button.is-refreshing i,
  .crm-toolbar-icon-button.is-refreshing svg {
    animation: none;
  }
}

.crm-toolbar-icon-button-primary {
  background: var(--navy);
  border-color: rgba(7, 53, 110, 0.28);
  color: var(--color-on-accent);
}

.crm-toolbar-icon-button-primary:hover {
  background: #0a4e9f;
  color: var(--color-text-inverse);
  border-color: rgba(10, 78, 159, 0.34);
}

.crm-pipeline-board-wrap {
  display: block;
  width: 100%;
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0;
  background: var(--color-surface-soft);
}

.crm-pipeline-builder {
  height: 100%;
  overflow: auto;
  padding: 28px;
  background:
    radial-gradient(circle at top right, rgba(15, 63, 134, 0.1), transparent 28%),
    linear-gradient(180deg, #ffffff 0%, #f6f8fb 100%);
}

.crm-pipeline-builder-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto 18px;
}

.crm-pipeline-builder-hero h2 {
  margin: 0;
  color: var(--ink);
  font-size: 32px;
  letter-spacing: -0.04em;
}

.crm-pipeline-builder-hero p {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--ink-soft);
  line-height: 1.65;
}

.crm-pipeline-builder-card {
  max-width: 1180px;
  margin: 0 auto 18px;
  padding: 18px;
  border: 1px solid rgba(20, 35, 59, 0.09);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 20px 44px rgba(7, 30, 67, 0.07);
}

.crm-pipeline-identity-card {
  display: block;
}

.crm-pipeline-identity-inline {
  display: grid;
  gap: 8px;
  align-self: end;
}

.crm-pipeline-sidebar-preview {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--color-selected);
  border-radius: 12px;
  background: rgba(7, 53, 110, 0.05);
  color: var(--navy);
}

.crm-pipeline-identity-card h3,
.crm-pipeline-studio-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 24px;
  letter-spacing: -0.03em;
}

.crm-pipeline-identity-form {
  display: grid;
  grid-template-columns: minmax(150px, auto) minmax(220px, 1fr) 132px minmax(190px, auto) auto;
  gap: 12px;
  align-items: end;
}

.crm-pipeline-admin-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 8px 12px;
  border: 1px solid var(--color-selected);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.86);
  color: var(--ink);
  cursor: pointer;
}

.crm-pipeline-admin-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--navy);
}

.crm-pipeline-admin-toggle span {
  display: grid;
  gap: 2px;
}

.crm-pipeline-admin-toggle strong {
  font-size: 13px;
  line-height: 1.1;
}

.crm-pipeline-admin-toggle small {
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.2;
}

.crm-pipeline-color-field input[type="color"],
.crm-pipeline-stage-fields input[type="color"] {
  height: 46px;
  width: 118px;
  min-width: 118px;
  padding: 5px;
  border-radius: 999px;
  cursor: pointer;
}

.crm-pipeline-color-field {
  width: 132px;
}

.crm-pipeline-color-field input[type="color"]::-webkit-color-swatch,
.crm-pipeline-stage-fields input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 999px;
}

.crm-pipeline-color-field input[type="color"]::-moz-color-swatch,
.crm-pipeline-stage-fields input[type="color"]::-moz-color-swatch {
  border: none;
  border-radius: 999px;
}

.crm-pipeline-active-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  color: var(--ink-soft);
  font-weight: 800;
}

.crm-pipeline-active-toggle input {
  accent-color: var(--navy);
}

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

.crm-pipeline-stage-tools {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 10px;
}

.crm-pipeline-preset-field {
  min-width: 220px;
}

.crm-pipeline-stage-studio {
  display: grid;
  gap: 12px;
}

.crm-pipeline-stage-editor {
  display: grid;
  grid-template-columns: 8px 34px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: stretch;
  padding: 12px;
  border: 1px solid var(--color-border-subtle);
  border-radius: 18px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--stage-color, var(--color-accent)) 8%, white), #fff 42%);
}

.crm-pipeline-stage-editor.is-dragging {
  opacity: 0.55;
}

.crm-pipeline-stage-editor.is-drag-over {
  border-color: color-mix(in srgb, var(--stage-color, var(--color-accent)) 42%, var(--color-border-subtle));
  box-shadow: 0 12px 28px var(--color-border-subtle);
}

.crm-pipeline-stage-editor.is-busy {
  border-color: color-mix(in srgb, var(--stage-color, var(--color-accent)) 24%, var(--color-border-subtle));
  opacity: 0.78;
}

.crm-pipeline-stage-strip {
  border-radius: 999px;
  background: var(--stage-color, var(--color-accent));
}

.crm-pipeline-stage-drag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  width: 34px;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.72);
  cursor: grab;
}

.crm-pipeline-stage-drag:active {
  cursor: grabbing;
}

.crm-pipeline-stage-drag svg {
  width: 18px;
  height: 18px;
}

.crm-pipeline-stage-fields {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 140px;
  gap: 10px;
}

.crm-pipeline-info-field-editor {
  grid-template-columns: 8px minmax(0, 1fr) auto;
}

.crm-pipeline-info-field-fields {
  grid-template-columns: minmax(220px, 1fr) minmax(120px, auto);
  align-items: end;
}

.crm-pipeline-info-field-editor .crm-pipeline-stage-actions {
  align-self: end;
  white-space: nowrap;
}

.crm-pipeline-required-toggle {
  align-content: end;
  grid-template-columns: auto 1fr;
  align-items: center;
}

.crm-pipeline-required-toggle input {
  width: 16px;
  height: 16px;
  min-width: 16px;
}

.crm-pipeline-stage-fields label {
  display: grid;
  gap: 6px;
}

.crm-pipeline-stage-fields span {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.crm-pipeline-stage-fields input {
  width: 100%;
  min-width: 0;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 12px;
  background: var(--color-surface);
}

.crm-pipeline-stage-fields .crm-pipeline-required-toggle input {
  width: 16px;
  min-width: 16px;
  height: 16px;
}

.crm-pipeline-stage-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.crm-loading-button {
  min-width: max-content;
  white-space: nowrap;
}

.crm-button-spinner {
  width: 15px;
  height: 15px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.38);
  border-top-color: var(--color-text-inverse);
  animation: dashboard-spin 0.72s linear infinite;
}

.crm-button-spinner.is-dark {
  border-color: rgba(7, 53, 110, 0.2);
  border-top-color: var(--navy);
}

.crm-pipeline-board {
  --pipeline-column-min-width: 310px;
  display: grid;
  grid-template-columns: repeat(var(--pipeline-column-count, 4), minmax(var(--pipeline-column-min-width), 1fr));
  align-items: stretch;
  gap: 0;
  width: 100%;
  min-width: max(100%, var(--pipeline-board-min-width, 1240px));
  min-height: 100%;
  height: 100%;
  overflow: visible;
  padding: 0;
}

.crm-pipeline-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  align-self: stretch;
  border: 1px solid var(--color-border-subtle);
  border-width: 0 1px 0 0;
  border-radius: 0;
  background: var(--color-surface);
  backdrop-filter: none;
  overflow: hidden;
  box-shadow: none;
}

.crm-pipeline-column:first-child {
  border-left-width: 1px;
}

.crm-pipeline-column.is-unassigned {
  border-color: rgba(102, 119, 145, 0.16);
  background: var(--color-surface);
}

.crm-pipeline-column.is-unassigned .crm-pipeline-column-head {
  background: rgba(102, 119, 145, 0.12);
}

.crm-pipeline-board.is-revealing .crm-pipeline-column {
  opacity: 0;
  transform: translateY(18px) scale(0.985);
  animation: crm-pipeline-column-in 0.42s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  animation-delay: calc(var(--pipeline-index, 0) * 38ms);
}

@keyframes crm-pipeline-column-in {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.crm-pipeline-loading-board {
  position: relative;
  --pipeline-column-min-width: 310px;
  display: grid;
  grid-template-columns: repeat(4, minmax(var(--pipeline-column-min-width), 1fr));
  align-items: stretch;
  gap: 0;
  width: 100%;
  min-width: max(100%, 1240px);
  height: 100%;
  padding: 0;
  pointer-events: none;
}

.crm-pipeline-loading-column {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  border: 1px solid var(--color-hover);
  border-width: 0 1px 0 0;
  border-radius: 0;
  background: var(--color-surface-soft);
  box-shadow: none;
  opacity: 1;
  overflow: hidden;
  transform: none;
}

.crm-pipeline-loading-column:first-child {
  border-left-width: 1px;
}

.crm-pipeline-loading-board.is-leaving .crm-pipeline-loading-column {
  opacity: 0.5;
  transform: translateX(0);
  animation: crm-pipeline-skeleton-out 0.16s cubic-bezier(0.4, 0, 1, 1) forwards;
}

.crm-pipeline-loading-column header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid rgba(20, 35, 59, 0.05);
  background: rgba(255, 255, 255, 0.28);
}

.crm-pipeline-loading-column header span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--color-accent-border);
}

.crm-pipeline-loading-column header strong {
  display: block;
  width: 112px;
  height: 13px;
  border-radius: 999px;
  background: rgba(7, 53, 110, 0.11);
}

.crm-pipeline-loading-column > div {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.crm-pipeline-loading-column > div span {
  display: block;
  height: 92px;
  border: 1px solid rgba(20, 35, 59, 0.05);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.28);
}

.crm-pipeline-loading-column > div span:nth-child(2) {
  height: 74px;
  opacity: 0.74;
}

.crm-pipeline-loading-column > div span:nth-child(3) {
  height: 112px;
  opacity: 0.54;
}

@keyframes crm-pipeline-skeleton-out {
  0% {
    opacity: 0.5;
    transform: translateX(0);
  }
  100% {
    opacity: 0;
    transform: translateX(34px);
  }
}

.crm-pipeline-column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 0 0 16px;
  border-bottom: 1px solid var(--color-border-subtle);
  background: color-mix(in srgb, var(--stage-color, var(--color-accent)) 10%, white);
  border-radius: 0;
  min-height: 58px;
}

.crm-pipeline-column-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.crm-pipeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--stage-color, var(--color-accent));
}

.crm-pipeline-column-add {
  display: inline-grid;
  place-items: center;
  align-self: stretch;
  width: 58px;
  height: auto;
  flex: 0 0 58px;
  border: 0;
  border-left: 1px solid color-mix(in srgb, var(--stage-color, var(--color-accent)) 16%, var(--color-selected));
  border-right: 1px solid color-mix(in srgb, var(--stage-color, var(--color-accent)) 16%, var(--color-selected));
  border-radius: 0;
  background: transparent;
  color: var(--navy);
  box-shadow: none;
  transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.crm-pipeline-column-add:hover,
.crm-pipeline-column-add:focus-visible {
  background: rgba(255, 255, 255, 0.34);
  color: var(--color-accent-pressed);
  outline: none;
}

.crm-pipeline-column-add:active {
  transform: none;
  background: rgba(255, 255, 255, 0.46);
}

.crm-pipeline-column-add svg {
  width: 18px;
  height: 18px;
}

.crm-pipeline-column-body {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 8px 8px 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--color-surface);
}

.crm-pipeline-board-wrap,
.crm-pipeline-column-body {
  scrollbar-width: thin;
  scrollbar-color: rgba(7, 53, 110, 0.34) transparent;
}

.crm-pipeline-board-wrap::-webkit-scrollbar,
.crm-pipeline-column-body::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

.crm-pipeline-board-wrap::-webkit-scrollbar-track,
.crm-pipeline-column-body::-webkit-scrollbar-track {
  background: transparent;
}

.crm-pipeline-board-wrap::-webkit-scrollbar-thumb,
.crm-pipeline-column-body::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(7, 53, 110, 0.28);
}

.crm-pipeline-board-wrap::-webkit-scrollbar-thumb:hover,
.crm-pipeline-column-body::-webkit-scrollbar-thumb:hover {
  background: rgba(7, 53, 110, 0.44);
}

.crm-pipeline-column-body.is-drag-over {
  background: color-mix(in srgb, var(--navy) 6%, white);
}

.crm-pipeline-card {
  position: relative;
  display: grid;
  gap: 0;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--color-surface-soft);
  color: var(--ink);
  text-align: left;
  box-shadow: none;
  cursor: grab;
  transform-origin: center center;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
  content-visibility: auto;
  contain: layout paint style;
  contain-intrinsic-size: 128px;
}

.crm-pipeline-card:hover {
  background: var(--color-surface-muted);
  box-shadow: none;
}

.crm-pipeline-note-card {
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
  padding: 14px 42px 14px 15px;
  background: var(--color-surface-soft);
  cursor: grab;
}

.crm-pipeline-note-delete {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  opacity: 0.35;
  cursor: pointer;
  transition: opacity 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.crm-pipeline-note-delete:hover,
.crm-pipeline-note-delete:focus-visible {
  background: rgba(163, 32, 32, 0.1);
  color: #a32020;
  opacity: 1;
  outline: none;
}

.crm-pipeline-note-delete svg,
.crm-pipeline-note-delete i {
  width: 15px;
  height: 15px;
}

.crm-pipeline-note-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  align-self: center;
  color: color-mix(in srgb, var(--stage-color, var(--color-accent)) 82%, var(--navy));
}

.crm-pipeline-note-icon svg,
.crm-pipeline-note-icon i {
  width: 18px;
  height: 18px;
}

.crm-pipeline-note-card p {
  display: -webkit-box;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-line;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
}

.crm-pipeline-note-card.is-landing {
  animation: crmPipelineNoteLanding 520ms ease-out;
}

@keyframes crmPipelineNoteLanding {
  0% {
    opacity: 0.5;
    background: color-mix(in srgb, var(--stage-color, var(--color-accent)) 10%, var(--color-surface-soft));
  }
  100% {
    opacity: 1;
    background: var(--color-surface-soft);
  }
}

.crm-pipeline-view-more {
  min-height: 38px;
  border: 1px dashed var(--color-accent-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--navy);
  font-size: 13px;
  font-weight: 850;
}

.crm-pipeline-view-more:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(7, 53, 110, 0.36);
}

.crm-pipeline-view-more:disabled {
  cursor: wait;
  opacity: 0.65;
}

.crm-pipeline-card:active {
  cursor: grabbing;
  transform: scale(1.01);
  box-shadow: none;
}

.crm-pipeline-card.is-dragging {
  opacity: 0.42;
  cursor: grabbing;
  transform: scale(0.99);
  box-shadow: none;
  content-visibility: visible;
  contain: none;
}

.crm-pipeline-card.is-landing:not(.crm-pipeline-note-card) {
  animation: crmPipelineCardLanding 520ms ease-out;
}

.crm-pipeline-card.is-landing:not(.crm-pipeline-note-card) .crm-pipeline-card-top {
  animation: crmPipelineCardTopLanding 520ms ease-out;
}

@keyframes crmPipelineCardLanding {
  0% {
    opacity: 0.5;
    background-color: color-mix(in srgb, var(--stage-color, var(--color-accent)) 10%, var(--color-surface-soft));
  }
  68% {
    background-color: color-mix(in srgb, var(--stage-color, var(--color-accent)) 6%, var(--color-surface-soft));
  }
  100% {
    opacity: 1;
    background-color: var(--color-surface-soft);
  }
}

@keyframes crmPipelineCardTopLanding {
  0% {
    background: color-mix(in srgb, var(--stage-color, var(--color-accent)) 9%, #edf3fa);
  }
  100% {
    background: #edf3fa;
  }
}

.crm-pipeline-card.drag-before::before,
.crm-pipeline-card.drag-after::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  z-index: 4;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(15, 63, 134, 0.12) 0%, rgba(15, 63, 134, 0.96) 16%, rgba(15, 63, 134, 0.96) 84%, rgba(15, 63, 134, 0.12) 100%);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.96),
    0 5px 16px rgba(15, 63, 134, 0.28);
  pointer-events: none;
}

.crm-pipeline-card.drag-before,
.crm-pipeline-card.drag-after {
  z-index: 2;
  content-visibility: visible;
  contain: layout style;
}

.crm-pipeline-card.drag-before::before {
  top: -9px;
}

.crm-pipeline-card.drag-after::after {
  bottom: -9px;
}

.crm-drag-preview {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  margin: 0;
  box-sizing: border-box;
  overflow: hidden;
  width: auto;
  max-width: min(320px, calc(100vw - 24px));
  transform: translate(-50%, -50%) scale(1.02);
  opacity: 0.98;
  box-shadow: 0 12px 24px rgba(7, 30, 67, 0.14);
  filter: saturate(1.02);
  will-change: transform, left, top;
}

.crm-pipeline-card-top,
.crm-duplicate-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.crm-pipeline-card-top {
  min-height: 48px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-hover);
  border-radius: 0;
  background: #edf3fa;
}

.crm-pipeline-card-top strong {
  flex: 1;
  min-width: 0;
}

.crm-pipeline-gender-icon {
  display: inline-grid;
  place-items: center;
  position: relative;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 999px;
  border: 1px solid rgba(83, 98, 122, 0.16);
  background: rgba(255, 255, 255, 0.86);
  color: var(--navy);
}

.crm-pipeline-gender-icon svg {
  width: 17px;
  height: 17px;
}

.crm-pipeline-person-icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.crm-pipeline-gender-icon.is-male,
.crm-pipeline-gender-icon.is-female {
  color: var(--navy);
}

.crm-pipeline-gender-icon.is-unknown {
  opacity: 0.58;
  color: var(--ink-soft);
}

.crm-pipeline-card p,
.crm-duplicate-card p,
.crm-contact-conversation-item p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.55;
}

.crm-pipeline-card p {
  padding: 12px 14px 0;
}

.crm-pipeline-card-info {
  display: grid;
  gap: 4px;
  padding: 0 14px 10px;
}

.crm-pipeline-card-info span {
  display: grid;
  gap: 2px;
  min-width: 0;
  color: var(--ink-muted);
  font-size: 11px;
  line-height: 1.25;
}

.crm-pipeline-card-info b {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.crm-pipeline-card.crm-pipeline-note-card p {
  color: var(--ink);
}

.crm-pipeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 14px 14px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.crm-pipeline-added-by {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px 14px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.crm-pipeline-added-by i,
.crm-pipeline-added-by svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  color: var(--navy);
}

.crm-pipeline-added-by span {
  align-self: flex-end;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: translateY(1px);
  white-space: nowrap;
}

.crm-pipeline-note-card .crm-pipeline-added-by {
  grid-column: 2;
  padding: 2px 0 0;
}

.crm-pipeline-alert {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #d92d20;
}

.crm-column-empty,
.crm-empty-state,
.crm-empty-box {
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  color: var(--ink-soft);
}

.crm-column-empty,
.crm-empty-box {
  min-height: 120px;
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: 16px;
}

.crm-empty-state {
  min-height: 400px;
  padding: 30px;
}

.crm-bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 26px;
  border-bottom: 1px solid var(--border);
  background: var(--color-hover);
}

.crm-bulk-bar input {
  min-width: 220px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 12px;
}

.crm-table-shell {
  min-height: 0;
  overflow: auto;
}

.crm-table-row {
  cursor: pointer;
}

.crm-table-row:hover {
  background: var(--color-hover);
}

.crm-table-skeleton-row {
  opacity: 0.74;
  pointer-events: none;
}

.crm-table-skeleton-row-2 {
  opacity: 0.5;
}

.crm-table-skeleton-row-3 {
  opacity: 0.32;
}

.crm-table-skeleton-row td {
  height: 52px;
}

.crm-table-skeleton-cell {
  display: block;
  width: min(78%, 180px);
  height: 13px;
  border-radius: 999px;
  background: rgba(20, 35, 59, 0.13);
}

.crm-table-skeleton-cell.is-short {
  width: 18px;
}

.crm-table-skeleton-cell.is-strong {
  width: min(64%, 150px);
  height: 15px;
}

.crm-table-skeleton-cell.is-muted {
  width: min(54%, 120px);
}

.crm-table-check-cell {
  width: 44px;
}

.portal-filter-field > span {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.portal-filter-field {
  flex: 0 0 150px;
  display: grid;
  gap: 6px;
}

.portal-filter-field:first-of-type {
  flex-basis: 180px;
}

.portal-filter-field .tickets-custom-select {
  width: 100%;
}

.portal-filter-field .tickets-custom-select-trigger {
  height: 38px;
  min-height: 38px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
  box-shadow: none;
}

.portal-filter-field .tickets-custom-select-menu {
  z-index: 60;
  max-height: 240px;
  overflow-y: auto;
}

.portal-error {
  margin: 14px 26px 0;
  border: 1px solid rgba(185, 28, 28, 0.16);
  border-radius: 12px;
  background: rgba(254, 242, 242, 0.94);
  color: #991b1b;
  font-size: 13px;
  font-weight: 750;
  padding: 10px 12px;
}

.analytics-shell {
  height: 100%;
  min-height: 0;
  grid-template-columns: 320px minmax(0, 1fr);
}

.analytics-view {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
  background: var(--color-surface-soft);
}

.analytics-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--color-surface);
}

.analytics-filter-field {
  flex: 0 0 180px;
}

.analytics-date-field {
  flex-basis: 150px;
}

.analytics-date-input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--color-selected);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  padding: 0 10px;
  box-shadow: none;
}

.analytics-date-input:focus {
  outline: 2px solid rgba(15, 63, 134, 0.16);
  outline-offset: 1px;
  border-color: rgba(15, 63, 134, 0.36);
}

.analytics-timezone-field {
  flex-basis: 260px;
}

.analytics-timezone-field .tickets-custom-select-menu {
  max-height: 300px;
}

.ops-shell {
  height: 100%;
  min-height: 0;
  grid-template-columns: 320px minmax(0, 1fr);
}

.ops-view {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  background: var(--color-surface-soft);
}

.ops-toolbar {
  gap: 12px;
}

.ops-toolbar .is-muted {
  opacity: 0.52;
}

.ops-load-button {
  height: 38px;
  min-height: 38px;
  align-self: end;
}

.ops-load-button svg,
.ops-load-button svg {
  width: 16px;
  height: 16px;
}

.ops-load-button:disabled svg,
.ops-empty-state.is-loading svg {
  animation: analyticsSpin 0.9s linear infinite;
}

.ops-scroll-area.has-report {
  padding: 0;
}

.ops-sidebar-nav {
  padding-bottom: 4px;
}

.ops-sidebar-divider {
  margin: 2px 14px 8px;
  padding-top: 10px;
  border-top: 1px solid var(--color-selected);
}

.ops-sidebar-divider span {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ops-main {
  min-width: 0;
  min-height: 0;
  background: var(--color-surface-soft);
}

.ops-embedded-live {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.ops-embedded-live .live-dashboard-page {
  height: 100%;
}

.ops-agent-search {
  margin: 0 14px 6px;
  position: relative;
}

.ops-agent-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 15px;
  height: 15px;
  transform: translateY(-50%);
  color: #6d7b91;
}

.ops-agent-search input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--color-selected);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  padding: 0 12px 0 34px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.ops-agent-search input:focus {
  outline: 2px solid rgba(15, 63, 134, 0.16);
  outline-offset: 1px;
  border-color: rgba(15, 63, 134, 0.34);
}

.ops-agent-nav {
  min-height: 0;
  overflow: auto;
  padding: 0 14px 16px;
  display: grid;
  gap: 0;
}

.ops-agent-table-row {
  border: 1px solid var(--color-border-subtle);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.ops-agent-nav-row {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-bottom: 1px solid var(--color-border-subtle);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  padding: 9px 0;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  transition: background 0.16s ease, color 0.16s ease;
}

.ops-agent-table-row:hover {
  border-color: rgba(15, 63, 134, 0.22);
  background: var(--color-surface);
  box-shadow: 0 10px 22px var(--color-border-subtle);
  transform: translateY(-1px);
}

.ops-agent-nav-row:hover {
  background: rgba(247, 250, 253, 0.78);
}

.ops-agent-nav-row.is-active {
  background: var(--color-hover);
  box-shadow: inset 3px 0 0 rgba(7, 53, 110, 0.68);
  padding-left: 10px;
  padding-right: 8px;
}

.ops-agent-initial {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(7, 53, 110, 0.09);
  color: var(--navy);
  font-size: 12px;
  font-weight: 950;
}

.ops-agent-nav-row > span:not(.ops-agent-initial),
.ops-agent-table-row span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.ops-agent-nav-row strong,
.ops-agent-table-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 900;
}

.ops-agent-nav-row em,
.ops-agent-table-row em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-soft);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.ops-agent-nav-row b {
  color: var(--navy);
  font-size: 12px;
  font-weight: 900;
}

.ops-empty-agent-list {
  min-height: 48px;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 850;
  text-align: center;
}

.ops-empty-panel {
  min-height: 92px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 850;
}

.ops-agent-nav-skeleton {
  min-height: 52px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--color-border-subtle);
}

.ops-agent-nav-skeleton-avatar,
.ops-agent-nav-skeleton-line {
  display: block;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(100, 116, 139, 0.12), rgba(100, 116, 139, 0.2), rgba(100, 116, 139, 0.12));
  background-size: 220% 100%;
  animation: skeletonPulse 1.15s ease-in-out infinite;
}

.ops-agent-nav-skeleton-avatar {
  width: 30px;
  height: 30px;
}

.ops-agent-nav-skeleton-copy {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.ops-agent-nav-skeleton-line {
  width: min(145px, 74%);
  height: 11px;
}

.ops-agent-nav-skeleton-line-short {
  width: min(92px, 48%);
  height: 9px;
  opacity: 0.72;
}

.ops-agent-nav-skeleton-2 .ops-agent-nav-skeleton-line {
  width: min(118px, 62%);
}

.ops-agent-nav-skeleton-3 .ops-agent-nav-skeleton-line {
  width: min(156px, 82%);
}

.ops-agent-nav-skeleton-4 .ops-agent-nav-skeleton-line {
  width: min(104px, 56%);
}

@keyframes skeletonPulse {
  0% {
    background-position: 120% 0;
  }
  100% {
    background-position: -120% 0;
  }
}

.ops-empty-state {
  height: 100%;
  min-height: calc(100dvh - 74px);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: var(--ink-soft);
  text-align: center;
}

.ops-empty-state > span {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(232, 240, 250, 0.92), rgba(255, 255, 255, 0.98));
  color: var(--navy);
  box-shadow: 0 14px 34px var(--color-selected);
}

.ops-empty-state svg {
  width: 22px;
  height: 22px;
}

.ops-empty-state strong {
  color: var(--ink);
  font-size: 21px;
  font-weight: 950;
}

.ops-empty-state p {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
}

.ops-report {
  width: 100%;
  max-width: none;
  min-width: 0;
  min-height: 100%;
  margin: 0;
  display: grid;
  align-content: start;
  border: 0;
  border-radius: 0;
  background: var(--color-surface-soft);
  box-shadow: none;
  overflow: auto;
  padding: 16px;
  gap: 16px;
}

.ops-report.is-loading {
  pointer-events: none;
}

.ops-report.is-loading .ops-metric-card,
.ops-report.is-loading .ops-kpi-card,
.ops-report.is-loading .ops-sla-summary-card,
.ops-report.is-loading .ops-board-panel,
.ops-report.is-loading .ops-monitor-kpi,
.ops-report.is-loading .ops-monitor-panel {
  background: linear-gradient(180deg, #ffffff, #fbfcfe);
}

.ops-report.is-loading .ops-metric-card,
.ops-report.is-loading .ops-kpi-card,
.ops-report.is-loading .ops-sla-summary-card,
.ops-report.is-loading .ops-board-panel,
.ops-report.is-loading .ops-monitor-kpi,
.ops-report.is-loading .ops-monitor-panel,
.ops-report.is-loading .ops-window-presets {
  opacity: 0.74;
}

.ops-report.is-loading .ops-metric-icon,
.ops-report.is-loading .ops-kpi-icon,
.ops-report.is-loading .ops-metric-delta,
.ops-report.is-loading .ops-kpi-delta,
.ops-report.is-loading .ops-health-row em,
.ops-report.is-loading .ops-health-row b i,
.ops-report.is-loading .ops-channel-donut,
.ops-report.is-loading .ops-sla-ring,
.ops-report.is-loading .ops-sla-summary-ring,
.ops-report.is-loading .ops-chartjs-volume,
.ops-report.is-loading .ops-monitor-stack-bar span,
.ops-report.is-loading .ops-monitor-bar-row i {
  filter: grayscale(1);
}

.ops-report.is-loading .ops-volume-line,
.ops-report.is-loading .ops-metric-line-stroke,
.ops-report.is-loading .ops-monitor-line {
  stroke: rgba(100, 116, 139, 0.42);
}

.ops-report.is-loading .ops-volume-dot {
  stroke: rgba(100, 116, 139, 0.42);
}

.ops-report.is-loading .ops-metric-line-area {
  fill: rgba(100, 116, 139, 0.08);
}

.ops-report.is-animating-in .ops-monitor-kpi,
.ops-report.is-animating-in .ops-monitor-panel {
  animation: opsDashboardPanelIn 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.ops-report.is-animating-in .ops-monitor-kpi:nth-child(2),
.ops-report.is-animating-in .ops-monitor-panel:nth-child(2) {
  animation-delay: 40ms;
}

.ops-report.is-animating-in .ops-monitor-kpi:nth-child(3),
.ops-report.is-animating-in .ops-monitor-panel:nth-child(3) {
  animation-delay: 80ms;
}

.ops-report.is-animating-in .ops-monitor-kpi:nth-child(4),
.ops-report.is-animating-in .ops-monitor-panel:nth-child(4) {
  animation-delay: 120ms;
}

.ops-report-head {
  min-height: 52px;
  padding: 0 2px;
  border-bottom: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.ops-report-title-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.ops-report-head h2 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.05;
  font-weight: 950;
  letter-spacing: 0;
}

.ops-mobile-agent-picker {
  display: none;
}

.ops-mobile-agent-trigger {
  min-width: 0;
  max-width: 210px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
  box-shadow: 0 8px 18px var(--color-hover);
}

.ops-mobile-agent-trigger span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ops-mobile-agent-trigger i {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.ops-mobile-agent-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 180;
  width: min(320px, calc(100vw - 32px));
  max-height: min(420px, calc(100dvh - 150px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  box-shadow: 0 24px 60px rgba(7, 30, 67, 0.18);
}

.ops-mobile-agent-search {
  position: relative;
  display: block;
}

.ops-mobile-agent-search i {
  position: absolute;
  left: 11px;
  top: 50%;
  width: 15px;
  height: 15px;
  color: var(--ink-soft);
  transform: translateY(-50%);
}

.ops-mobile-agent-search input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 0 12px 0 34px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.ops-mobile-agent-list {
  min-height: 0;
  overflow: auto;
  display: grid;
}

.ops-mobile-agent-option {
  min-width: 0;
  min-height: 48px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 0;
  border-bottom: 1px solid var(--color-border-subtle);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.ops-mobile-agent-option:hover,
.ops-mobile-agent-option.is-active {
  background: rgba(7, 53, 110, 0.07);
}

.ops-mobile-agent-option strong {
  min-width: 0;
  overflow: hidden;
  display: block;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 900;
}

.ops-mobile-agent-option .ops-agent-initial i {
  width: 15px;
  height: 15px;
}

.ops-report-head p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
}

.ops-window-presets {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--color-hover);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.86);
  flex: 0 0 auto;
}

.ops-window-preset {
  min-width: 42px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.ops-window-preset:hover:not(:disabled) {
  color: var(--navy);
  background: rgba(255, 255, 255, 0.72);
}

.ops-window-preset.is-active {
  border-color: var(--color-selected-strong);
  background: var(--color-surface);
  color: var(--ink);
  box-shadow: 0 1px 3px var(--color-border-subtle);
}

.ops-window-preset:disabled {
  cursor: wait;
  opacity: 0.7;
}

.ops-section-head {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.ops-section-head div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.ops-section-head span {
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.1;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ops-section-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.15;
  font-weight: 950;
  letter-spacing: 0;
}

.ops-command-center {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(270px, 24vw, 340px);
  gap: 16px;
  align-items: stretch;
}

.ops-command-main {
  min-width: 0;
  display: grid;
  gap: 16px;
}

.ops-kpi-section {
  min-width: 0;
  display: grid;
  gap: 12px;
}

.ops-kpi-grid,
.ops-support-card-grid {
  min-width: 0;
  width: 100%;
  display: grid;
  gap: 12px;
}

.ops-priority-grid,
.ops-performance-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.ops-kpi-card {
  min-width: 0;
  position: relative;
  display: grid;
  align-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--color-selected);
  border-radius: 8px;
  background: var(--color-surface);
  box-shadow: 0 1px 2px var(--color-hover);
  overflow: hidden;
}

.ops-kpi-card--priority {
  min-height: 132px;
  padding: 16px;
}

.ops-kpi-card--compact {
  min-height: 108px;
}

.ops-kpi-card.is-warn {
  border-color: rgba(197, 123, 44, 0.22);
}

.ops-kpi-card.is-bad {
  border-color: rgba(201, 63, 74, 0.24);
}

.ops-kpi-card-head {
  min-width: 0;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
}

.ops-kpi-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--color-accent-soft);
  color: var(--navy);
}

.ops-kpi-icon svg {
  width: 17px;
  height: 17px;
}

.ops-kpi-card.is-warn .ops-kpi-icon {
  background: rgba(197, 123, 44, 0.11);
  color: #9c5d1a;
}

.ops-kpi-card.is-bad .ops-kpi-icon {
  background: rgba(201, 63, 74, 0.1);
  color: #b72d36;
}

.ops-kpi-card-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.ops-kpi-card-copy > span {
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.15;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ops-kpi-card strong {
  min-width: 0;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  font-weight: 950;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.ops-kpi-card--priority strong {
  font-size: 30px;
}

.ops-kpi-card em {
  min-width: 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.25;
  font-style: normal;
  font-weight: 800;
}

.ops-kpi-delta {
  grid-column: 3;
  justify-self: end;
  min-height: 23px;
  max-width: 92px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 8px;
  background: rgba(100, 116, 139, 0.1);
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 950;
  white-space: nowrap;
}

.ops-kpi-delta.is-good {
  background: rgba(28, 132, 91, 0.1);
  color: #0b6a43;
}

.ops-kpi-delta.is-bad {
  background: rgba(208, 73, 73, 0.1);
  color: #b72d36;
}

.ops-sla-summary-card {
  min-width: 0;
  min-height: 280px;
  display: grid;
  grid-template-rows: auto minmax(130px, 1fr) auto;
  gap: 14px;
  padding: 0 0 0 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.ops-sla-summary-card.is-warn {
  border-color: transparent;
}

.ops-sla-summary-card.is-bad {
  border-color: transparent;
}

.ops-sla-summary-head {
  min-width: 0;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}

.ops-sla-summary-head > span {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(33, 184, 154, 0.11);
  color: #0b7d67;
}

.ops-sla-summary-head svg {
  width: 18px;
  height: 18px;
}

.ops-sla-summary-head div {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.ops-sla-summary-head small {
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.1;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ops-sla-summary-head strong {
  color: var(--ink);
  font-size: 17px;
  line-height: 1.15;
  font-weight: 950;
}

.ops-sla-summary-head em {
  min-height: 23px;
  align-self: start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 8px;
  background: rgba(100, 116, 139, 0.1);
  color: var(--ink-soft);
  font-size: 10px;
  font-style: normal;
  font-weight: 950;
  white-space: nowrap;
}

.ops-sla-summary-head em.is-good {
  background: rgba(28, 132, 91, 0.1);
  color: #0b6a43;
}

.ops-sla-summary-head em.is-bad {
  background: rgba(208, 73, 73, 0.1);
  color: #b72d36;
}

.ops-sla-summary-ring {
  width: min(176px, 80%);
  aspect-ratio: 1;
  justify-self: center;
  align-self: center;
  border-radius: 999px;
  display: grid;
  place-items: center;
  align-content: center;
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(circle, #ffffff 0 57%, transparent 58%),
    conic-gradient(#159f85 var(--ops-sla), rgba(20, 35, 59, 0.09) 0);
  box-shadow: inset 0 0 0 1px var(--color-hover);
  animation: panelPopIn 0.5s ease both;
}

.ops-sla-summary-ring::after {
  content: none;
}

.ops-sla-summary-ring span,
.ops-sla-summary-ring em {
  position: relative;
  z-index: 2;
}

.ops-sla-summary-ring span {
  color: var(--ink);
  font-size: 32px;
  line-height: 1;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.ops-sla-summary-ring em {
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: 10px;
  font-style: normal;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ops-sla-summary-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.ops-sla-summary-stats div {
  min-height: 62px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--color-border-subtle);
  border-radius: 8px;
  background: var(--color-surface-soft);
}

.ops-sla-summary-stats span {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ops-sla-summary-stats strong {
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.ops-volume-row,
.ops-agent-performance-row {
  min-width: 0;
  display: grid;
}

.ops-volume-row .ops-volume-panel {
  min-height: 350px;
  grid-template-rows: auto minmax(270px, 1fr);
}

.ops-volume-row .ops-volume-chart {
  min-height: 270px;
}

.ops-support-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

.ops-metric-section {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
}

.ops-agent-performance-row .ops-board-panel {
  min-height: 0;
}

.ops-monitor-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.ops-monitor-kpi {
  min-width: 0;
  min-height: 70px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
  align-content: start;
  padding: 11px 12px;
  border: 1px solid rgba(20, 35, 59, 0.09);
  border-radius: 4px;
  background: var(--color-surface);
  box-shadow: 0 1px 2px rgba(20, 35, 59, 0.04);
}

.ops-monitor-kpi > span {
  grid-column: 1 / -1;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.15;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ops-monitor-kpi div {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 3px;
}

.ops-monitor-kpi strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.ops-monitor-kpi em {
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.1;
  font-style: normal;
  font-weight: 750;
}

.ops-monitor-kpi.is-warn {
  border-color: rgba(20, 35, 59, 0.09);
  background: var(--color-surface);
}

.ops-monitor-kpi.is-bad {
  border-color: rgba(20, 35, 59, 0.09);
  background: var(--color-surface);
}

.ops-monitor-layout {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.85fr);
  gap: 8px;
  align-items: start;
}

.ops-monitor-main-column,
.ops-monitor-side-column {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.ops-monitor-full-row {
  min-width: 0;
  display: grid;
}

.ops-monitor-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--color-selected);
  border-radius: 4px;
  background: var(--color-surface);
  box-shadow: 0 1px 2px rgba(20, 35, 59, 0.04);
  overflow: hidden;
}

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

.ops-monitor-panel-head div {
  min-width: 0;
}

.ops-monitor-panel-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.2;
  font-weight: 950;
  letter-spacing: 0;
}

.ops-monitor-panel-head span {
  display: block;
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.1;
  font-weight: 750;
}

.ops-monitor-key {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 800;
}

.ops-monitor-key span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  white-space: nowrap;
}

.ops-monitor-key i,
.ops-monitor-legend i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
}

.ops-monitor-key .is-opened,
.ops-monitor-line.is-opened {
  color: #d34d72;
  stroke: #d34d72;
  background: #d34d72;
}

.ops-monitor-key .is-closed,
.ops-monitor-line.is-closed {
  color: #18a999;
  stroke: #18a999;
  background: #18a999;
}

.ops-monitor-key .is-queue,
.ops-monitor-line.is-queue {
  color: #6a5ce7;
  stroke: #6a5ce7;
  background: #6a5ce7;
}

.ops-monitor-key .is-volume,
.ops-monitor-line.is-volume {
  color: #1887b8;
  stroke: #1887b8;
  background: #1887b8;
}

.ops-monitor-key .is-rate,
.ops-monitor-line.is-rate {
  color: #d49a30;
  stroke: #d49a30;
  background: #d49a30;
}

.ops-monitor-line-chart,
.ops-monitor-combo-chart {
  position: relative;
  min-height: 248px;
}

.ops-monitor-line-chart svg,
.ops-monitor-combo-chart svg {
  width: 100%;
  height: 248px;
  display: block;
  overflow: visible;
}

.ops-monitor-grid-line {
  stroke: rgba(100, 116, 139, 0.18);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.ops-monitor-line {
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.ops-monitor-line.is-drawing {
  stroke-dasharray: var(--chart-line-length);
  stroke-dashoffset: var(--chart-line-length);
  animation: chartLineDraw 850ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.ops-monitor-line.is-queue {
  stroke-width: 1.8;
  stroke-dasharray: 5 6;
}

.ops-monitor-chart-axis {
  position: absolute;
  left: 44px;
  right: 36px;
  bottom: 0;
  height: 18px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 750;
}

.ops-monitor-chart-axis span {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
}

.ops-monitor-stack {
  min-height: 104px;
  display: grid;
  align-content: center;
  gap: 14px;
}

.ops-monitor-stack-bar {
  position: relative;
  height: 32px;
  overflow: hidden;
  border-radius: 2px;
  background: #f1f4f8;
}

.ops-monitor-stack-bar span {
  position: absolute;
  top: 0;
  bottom: 0;
  display: grid;
  place-items: center;
  color: var(--color-text-inverse);
  font-size: 10px;
  font-weight: 900;
  transform-origin: left center;
  animation: barGrowIn 720ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.ops-monitor-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 800;
}

.ops-monitor-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.ops-monitor-legend b {
  color: var(--ink);
  font-weight: 950;
}

.ops-monitor-bars {
  display: grid;
  gap: 11px;
  align-content: center;
  min-height: 150px;
}

.ops-monitor-bar-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(100px, 1fr) auto;
  gap: 6px 10px;
  align-items: center;
}

.ops-monitor-bar-row span {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ops-monitor-bar-row b {
  color: var(--ink);
  font-size: 11px;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.ops-monitor-bar-row i {
  grid-column: 1 / -1;
  height: 10px;
  border-radius: 2px;
  --bar-color: #6f7b88;
  background:
    linear-gradient(90deg, var(--bar-color) var(--bar-width), rgba(20, 35, 59, 0.07) 0);
  transform-origin: left center;
  animation: barGrowIn 720ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.ops-monitor-bar-row.is-attention i {
  --bar-color: #8f7b63;
}

.ops-monitor-bar-row.is-risk i {
  --bar-color: #b45d5d;
}

.ops-monitor-panel .ops-volume-chart {
  min-height: 190px;
  padding-bottom: 22px;
}

.ops-monitor-panel .ops-volume-chart svg {
  min-height: 170px;
}

.ops-monitor-chat-volume-panel {
  min-height: 238px;
}

.ops-monitor-chat-volume-panel .ops-volume-chart {
  min-height: 160px;
}

.ops-monitor-chat-volume-panel .ops-volume-chart svg {
  min-height: 138px;
}

@media (max-width: 680px) {
  .ops-monitor-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ops-monitor-panel-head {
    display: grid;
  }

  .ops-monitor-key {
    justify-content: flex-start;
  }

  .ops-monitor-line-chart,
  .ops-monitor-combo-chart {
    min-height: 210px;
  }

  .ops-monitor-line-chart svg,
  .ops-monitor-combo-chart svg {
    height: 210px;
  }

  .ops-priority-grid,
  .ops-performance-grid,
  .ops-support-card-grid {
    grid-template-columns: 1fr;
  }

  .ops-kpi-card--priority,
  .ops-kpi-card--compact {
    min-height: 104px;
  }

  .ops-kpi-card--priority strong {
    font-size: 28px;
  }
}

.ops-kpi-board {
  display: grid;
  gap: 12px;
  padding: 0;
  border-bottom: 0;
  background: transparent;
}

.ops-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  background: transparent;
}

.ops-metric-card {
  min-height: 116px;
  position: relative;
  display: grid;
  grid-template-rows: auto 38px;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--color-selected);
  border-radius: 8px;
  background: var(--color-surface);
  box-shadow: 0 1px 2px var(--color-hover);
}

.ops-metric-card::before,
.ops-metric-card::after {
  content: none;
}

.ops-metric-head {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}

.ops-metric-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  align-self: start;
  background: var(--color-accent-soft);
  color: var(--navy);
}

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

.ops-metric-copy {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto auto;
  align-items: start;
  gap: 6px;
}

.ops-metric-copy > span {
  align-self: start;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.15;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ops-metric-card strong {
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
  font-weight: 950;
  letter-spacing: 0;
}

.ops-metric-card em {
  align-self: end;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-soft);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.ops-metric-delta {
  min-height: 23px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 8px;
  background: rgba(100, 116, 139, 0.1);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 950;
}

.ops-metric-delta.is-good {
  background: rgba(28, 132, 91, 0.1);
  color: #0b6a43;
}

.ops-metric-delta.is-bad {
  background: rgba(208, 73, 73, 0.1);
  color: #b72d36;
}

.ops-metric-line {
  min-height: 38px;
  display: block;
}

.ops-metric-line svg {
  width: 100%;
  height: 38px;
  min-height: 38px;
  shape-rendering: geometricPrecision;
}

.ops-metric-line-grid {
  stroke: rgba(100, 116, 139, 0.12);
  stroke-width: 0.6;
  vector-effect: non-scaling-stroke;
}

.ops-metric-line-grid.is-base {
  stroke: rgba(20, 35, 59, 0.22);
}

.ops-metric-line-area {
  fill: rgba(7, 53, 110, 0.055);
}

.ops-metric-line-stroke {
  fill: none;
  stroke: var(--navy);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.ops-metric-line-foot {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 850;
}

.ops-metric-line-foot strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 950;
}

.ops-metric-line-empty {
  min-height: 38px;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 850;
}

.ops-report-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  align-items: stretch;
  grid-auto-rows: minmax(0, auto);
  gap: 16px;
  background: transparent;
}

.ops-board-panel {
  min-height: 0;
  padding: 16px;
  border: 1px solid var(--color-selected);
  border-radius: 8px;
  background: var(--color-surface);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  overflow: hidden;
  box-shadow: 0 1px 2px var(--color-hover);
}

.ops-channel-panel {
  min-height: 0;
}

.ops-panel-wide,
.ops-panel-span {
  grid-column: 1 / -1;
}

.ops-volume-panel {
  min-height: 0;
  grid-template-rows: auto minmax(210px, 1fr);
}

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

.ops-sla-panel {
  min-height: 0;
}

.ops-health-list {
  display: grid;
  align-content: start;
  gap: 12px;
}

.ops-health-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 14px;
  align-items: center;
}

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

.ops-health-row span {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 850;
}

.ops-health-row strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
  font-weight: 950;
}

.ops-health-row em {
  justify-self: end;
  border-radius: 999px;
  padding: 3px 7px;
  background: rgba(100, 116, 139, 0.1);
  color: var(--ink-soft);
  font-size: 11px;
  font-style: normal;
  font-weight: 950;
}

.ops-health-row em.is-good {
  background: rgba(28, 132, 91, 0.1);
  color: #0b6a43;
}

.ops-health-row em.is-bad {
  background: rgba(208, 73, 73, 0.1);
  color: #b72d36;
}

.ops-health-row b {
  grid-column: 1 / -1;
  height: 5px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--color-hover);
}

.ops-health-row b i {
  display: block;
  width: var(--ops-health-width);
  height: 100%;
  border-radius: inherit;
  background: var(--ops-health-accent);
  transform-origin: left center;
  animation: barGrowIn 1s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.ops-sla-card {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 22px;
}

.ops-sla-ring {
  width: min(178px, 72%);
  aspect-ratio: 1;
  border-radius: 999px;
  display: grid;
  place-items: center;
  align-content: center;
  position: relative;
  background: conic-gradient(#21b89a var(--ops-sla), var(--color-border-subtle) 0);
  animation: panelPopIn 0.5s ease both;
}

.ops-sla-ring::after {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: inherit;
  background: var(--color-surface);
  box-shadow: inset 0 0 0 1px var(--color-hover);
}

.ops-sla-ring span,
.ops-sla-ring em {
  position: relative;
  z-index: 1;
}

.ops-sla-ring span {
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
  font-weight: 950;
}

.ops-sla-ring em {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 11px;
  font-style: normal;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ops-sla-copy {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.ops-sla-copy div {
  min-height: 62px;
  border: 1px solid var(--color-border-subtle);
  border-radius: 8px;
  background: var(--color-surface-soft);
  padding: 10px;
  display: grid;
  align-content: center;
  gap: 4px;
}

.ops-sla-copy span {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ops-sla-copy strong {
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
  font-weight: 950;
}

.ops-volume-chart {
  position: relative;
  min-height: 210px;
  height: 100%;
  padding: 4px 0 28px;
}

.ops-volume-chart svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 170px;
  overflow: visible;
  shape-rendering: geometricPrecision;
}

.ops-volume-grid {
  stroke: rgba(100, 116, 139, 0.18);
  stroke-width: 1;
  stroke-dasharray: 5 7;
  vector-effect: non-scaling-stroke;
}

.ops-volume-line {
  fill: none;
  stroke: var(--color-accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 8px 14px rgba(15, 63, 134, 0.16));
}

.ops-volume-line.is-drawing {
  stroke-dasharray: var(--chart-line-length);
  stroke-dashoffset: var(--chart-line-length);
  animation: chartLineDraw 1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.ops-volume-dot {
  fill: #ffffff;
  stroke: var(--color-accent);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.ops-volume-tick {
  fill: var(--ink-soft);
  font-size: 12px;
  font-weight: 850;
  text-anchor: end;
}

.ops-volume-x-axis {
  position: absolute;
  left: 54px;
  right: 56px;
  bottom: 0;
  height: 18px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 850;
}

.ops-volume-x-axis span {
  position: absolute;
  top: 0;
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform: translateX(-50%);
}

.ops-volume-x-axis span.is-start {
  transform: translateX(0);
}

.ops-volume-x-axis span.is-end {
  transform: translateX(-100%);
}

.ops-monitor-chat-volume-panel {
  min-height: 220px;
  grid-template-rows: auto 150px;
}

.ops-monitor-chat-volume-panel .ops-volume-chart {
  height: 150px;
  min-height: 0;
  padding: 0 0 20px;
}

.ops-monitor-chat-volume-panel .ops-volume-chart svg {
  height: 130px;
  min-height: 0;
}

.ops-chartjs-volume {
  position: relative;
  width: 100%;
  height: 150px;
  min-height: 0;
}

.ops-chartjs-volume canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.ops-channel-mix {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(150px, 1fr) auto;
  align-items: center;
  gap: 22px;
}

.ops-channel-donut {
  width: min(184px, 72%);
  aspect-ratio: 1;
  margin: 4px auto 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  align-content: center;
  position: relative;
  background: conic-gradient(var(--ops-channel-gradient));
  box-shadow: inset 0 0 0 1px rgba(20, 35, 59, 0.05), 0 18px 34px var(--color-selected);
}

.ops-channel-donut::after {
  content: "";
  position: absolute;
  inset: 26%;
  border-radius: inherit;
  background: var(--color-surface);
  box-shadow: inset 0 0 0 1px var(--color-hover);
}

.ops-channel-donut span,
.ops-channel-donut em {
  position: relative;
  z-index: 1;
}

.ops-channel-donut span {
  color: var(--ink);
  font-size: 26px;
  line-height: 1;
  font-weight: 950;
}

.ops-channel-donut em {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ops-channel-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.ops-channel-legend div {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
}

.ops-channel-legend span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(20, 35, 59, 0.04);
}

.ops-channel-legend strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
}

.ops-channel-legend em {
  color: var(--ink-soft);
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
}

.ops-agent-table {
  min-width: 900px;
  display: grid;
  gap: 6px;
}

.ops-agent-table-head,
.ops-agent-table-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.2fr) repeat(7, minmax(82px, 0.55fr));
  gap: 10px;
  align-items: center;
}

.ops-agent-table-head {
  padding: 0 12px 6px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ops-agent-table-row {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--color-border-subtle);
  border-radius: 8px;
  padding: 9px 12px;
  background: var(--color-surface);
  color: var(--ink);
  text-align: left;
}

.ops-agent-table-row b {
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.ops-agent-table-row:hover {
  background: var(--color-surface-soft);
  border-color: var(--color-selected-strong);
}

.ops-agent-focus {
  display: grid;
  gap: 16px;
}

.ops-agent-focus > div:first-child {
  display: grid;
  gap: 3px;
}

.ops-agent-focus strong {
  color: var(--ink);
  font-size: 18px;
  font-weight: 950;
}

.ops-agent-focus span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
}

.ops-agent-focus dl {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.ops-agent-focus dl div {
  min-height: 70px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(246, 250, 254, 0.92);
  border: 1px solid rgba(20, 35, 59, 0.07);
}

.ops-agent-focus dt {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ops-agent-focus dd {
  margin: 7px 0 0;
  color: var(--ink);
  font-size: 20px;
  font-weight: 950;
}

.analytics-empty-generate,
.analytics-report-actions .modal-button {
  height: 38px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.analytics-empty-generate svg,
.analytics-report-actions svg {
  width: 16px;
  height: 16px;
}

.analytics-empty-generate.is-loading svg {
  animation: analyticsSpin 0.9s linear infinite;
}

.analytics-report-actions {
  max-width: 1480px;
  margin: 0 auto 12px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
}

.analytics-report-actions .modal-button {
  border: 1px solid rgba(47, 111, 175, 0.58);
  background: var(--color-surface);
  color: var(--ink);
  box-shadow: 0 8px 18px var(--color-hover);
}

.analytics-report-actions .modal-button:hover {
  border-color: rgba(15, 63, 134, 0.28);
  background: var(--color-surface-soft);
  color: var(--navy);
}

.analytics-report-actions .analytics-report-excel-button {
  border-color: rgba(28, 132, 91, 0.36);
  background:
    linear-gradient(135deg, rgba(232, 248, 241, 0.94), rgba(255, 255, 255, 0.98));
  color: #105d3e;
}

.analytics-report-actions .analytics-report-excel-button:hover {
  border-color: rgba(28, 132, 91, 0.5);
  background: #ecfbf4;
  color: #0b6a43;
}

.analytics-report-actions .analytics-report-new-button {
  margin-right: auto;
}

.analytics-report-actions .modal-button svg {
  color: currentColor;
}

.analytics-error {
  margin: 12px 18px 0;
}

.analytics-scroll-area {
  min-height: 0;
  overflow: auto;
}

.analytics-scroll-area.is-empty {
  height: 100%;
  min-height: 0;
  padding: 0;
  display: grid;
}

.analytics-scroll-area.has-report {
  height: 100%;
  padding: 18px;
  display: block;
}

.analytics-scroll-area.ops-scroll-area.has-report {
  padding: 0;
}

.analytics-empty-state {
  position: relative;
  height: 100%;
  min-height: 0;
  padding: 16px;
  display: grid;
  place-items: center;
  overflow: auto;
  background: transparent;
  color: var(--ink-soft);
}

.analytics-empty-state::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at center, rgba(248, 250, 252, 0) 0 26%, rgba(248, 250, 252, 0.54) 50%, var(--color-surface-soft) 76%),
    linear-gradient(rgba(20, 35, 59, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 35, 59, 0.055) 1px, transparent 1px);
  background-size: 100% 100%, 44px 44px, 44px 44px;
  mask-image: radial-gradient(circle at center, black 0 42%, transparent 74%);
  opacity: 0.86;
}

.analytics-empty-state::after {
  content: none;
}

.analytics-empty-cta {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
  transform: translateY(-4vh);
}

.analytics-empty-cta strong {
  color: var(--ink);
  font-size: 24px;
  line-height: 1.12;
  font-weight: 900;
  letter-spacing: 0;
}

.analytics-empty-cta p {
  max-width: 420px;
  margin: 0 0 4px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.45;
  font-weight: 750;
}

.analytics-empty-orbit {
  position: absolute;
  inset: 8%;
  display: grid;
  place-items: center;
  opacity: 0.62;
  filter: grayscale(1);
  mask-image: radial-gradient(circle at center, black 0 42%, transparent 75%);
}

.analytics-empty-grid {
  position: absolute;
  width: min(820px, 88%);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.analytics-empty-grid span,
.analytics-empty-side-preview,
.analytics-empty-chart-preview {
  border: 1px solid var(--color-border-subtle);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 10px 30px rgba(20, 35, 59, 0.05);
}

.analytics-empty-grid span {
  min-height: 74px;
}

.analytics-empty-chart-preview {
  position: absolute;
  width: min(520px, 62%);
  height: 220px;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 13px;
  padding: 28px;
}

.analytics-empty-chart-preview i {
  width: 34px;
  border-radius: 999px 999px 4px 4px;
  background: linear-gradient(180deg, rgba(20, 35, 59, 0.24), rgba(20, 35, 59, 0.07));
}

.analytics-empty-side-preview {
  position: absolute;
  right: 10%;
  bottom: 13%;
  width: 240px;
  padding: 16px;
  display: grid;
  gap: 10px;
}

.analytics-empty-side-preview span {
  height: 12px;
  border-radius: 999px;
  background: var(--color-selected);
}

.analytics-empty-side-preview span:nth-child(2) {
  width: 78%;
}

.analytics-empty-side-preview span:nth-child(3) {
  width: 88%;
}

.analytics-empty-side-preview span:nth-child(4) {
  width: 58%;
}

.analytics-empty-generate {
  height: 44px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 12px;
  box-shadow: 0 18px 38px rgba(15, 63, 134, 0.22);
}

.analytics-users-placeholder {
  height: 100%;
}

.ops-report-toolbar,
.ops-user-report-toolbar {
  position: relative;
  z-index: 120;
  align-items: end;
  justify-content: space-between;
  overflow: visible;
}

.ops-report-toolbar .analytics-report-mode-tabs {
  justify-content: flex-start;
}

.analytics-report-mode-tabs {
  position: relative;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 34px;
  padding-bottom: 8px;
}

.analytics-report-mode-tabs::after {
  content: "";
  position: absolute;
  left: 50%;
  right: auto;
  bottom: 0;
  width: min(320px, 78vw);
  height: 1px;
  background: rgba(95, 111, 133, 0.22);
  transform: translateX(-50%);
}

.analytics-report-mode-tabs button {
  position: relative;
  min-height: 46px;
  padding: 0 2px 6px;
  border: 0;
  border-bottom: 3px solid rgba(95, 111, 133, 0.34);
  background: transparent;
  color: var(--ink);
  font-size: 18px;
  font-weight: 950;
  cursor: pointer;
}

.analytics-report-mode-tabs button::after {
  content: none;
}

.analytics-report-mode-tabs button:hover {
  border-bottom-color: rgba(15, 63, 134, 0.55);
  color: var(--brand);
}

.analytics-report-mode-tabs button.is-active {
  border-bottom-color: var(--brand);
  color: var(--brand);
}

.analytics-report-mode-tabs button.is-active::after {
  content: none;
}

.ops-report-builder-form,
.ops-user-report-picker {
  width: min(360px, 100%);
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  overflow: visible;
}

.ops-report-toolbar-form {
  position: relative;
  z-index: 120;
  display: grid;
  grid-template-columns: minmax(220px, 360px) auto;
  align-items: end;
  gap: 10px;
  overflow: visible;
}

.ops-report-toolbar .ops-report-builder-form,
.ops-user-report-toolbar .ops-user-report-picker {
  justify-content: flex-start;
}

.ops-report-builder-form .analytics-filter-field,
.ops-user-report-picker .analytics-filter-field {
  width: 100%;
  flex: none;
  text-align: left;
}

.ops-report-builder-form .analytics-date-field {
  flex-basis: auto;
}

.ops-report-builder-form .analytics-timezone-field {
  flex-basis: auto;
}

.ops-report-builder-form .tickets-custom-select.is-open {
  z-index: 140;
}

.ops-report-builder-form .tickets-custom-select-menu {
  z-index: 150;
}

.ops-report-builder-panel,
.ops-report-toolbar-form {
  animation: reportBuilderSwap 190ms ease both;
}

.analytics-empty-cta .ops-user-report-picker {
  margin: 6px 0 2px;
}

.analytics-empty-cta .ops-user-report-picker .tickets-custom-select {
  min-width: min(250px, 78vw);
}

.ops-report-builder {
  width: min(560px, calc(100% - 32px));
  height: 540px;
  max-height: 100%;
  padding: 22px 28px 26px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.075);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(4px);
  grid-template-rows: 56px 48px minmax(0, 1fr) 44px;
  align-content: stretch;
  transform: none;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ops-report-builder .analytics-report-mode-tabs {
  align-self: start;
  margin-bottom: 8px;
}

.ops-report-builder .ops-report-builder-panel {
  align-self: stretch;
  display: grid;
  justify-items: center;
  width: 100%;
  min-height: 0;
  margin: 8px 0 0;
  align-items: start;
}

.ops-report-builder > strong {
  align-self: start;
}

.ops-report-builder > .analytics-empty-generate {
  align-self: end;
  justify-self: center;
}

.ops-user-report-card .ops-volume-chart {
  min-height: 280px;
}

.ops-user-report-card .ops-agent-focus {
  min-height: 100%;
}

.ops-user-workload-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.analytics-report-card {
  max-width: 1480px;
  margin: 0 auto;
  border: 1px solid var(--color-selected);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #fdfbf7 100%);
  box-shadow: 0 18px 44px var(--color-border-subtle);
  overflow: hidden;
}

.analytics-report-head {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--color-border-subtle);
  background:
    linear-gradient(90deg, var(--color-accent-soft), transparent 42%),
    linear-gradient(180deg, #ffffff, #fbfcff);
}

.analytics-report-head span,
.analytics-panel-head span {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.analytics-report-head h2 {
  margin: 5px 0 6px;
  color: var(--ink);
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: 0;
}

.analytics-report-head p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.analytics-metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 1px;
  background: var(--color-border-subtle);
}

.analytics-metric-card {
  min-height: 132px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 18px;
  background: var(--color-surface);
}

.analytics-metric-icon {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #116149;
  background: rgba(17, 97, 73, 0.1);
}

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

.analytics-metric-card div {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.analytics-metric-card span:not(.analytics-metric-icon) {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.analytics-metric-card strong {
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0;
}

.analytics-metric-card em {
  color: var(--ink-soft);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  line-height: 1.25;
}

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

.analytics-panel {
  min-height: 300px;
  border: 1px solid rgba(20, 35, 59, 0.09);
  border-radius: 12px;
  background: var(--color-surface);
  padding: 16px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  overflow: hidden;
}

.analytics-panel-wide {
  grid-column: 1 / -1;
}

.analytics-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.analytics-panel-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0;
}

.analytics-line-chart,
.analytics-axis-bar-chart {
  height: 220px;
  min-height: 0;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 10px;
}

.analytics-chart-y-axis {
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  align-items: start;
  padding: 10px 0 28px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 850;
  text-align: right;
}

.analytics-chart-y-axis span:nth-child(2) {
  align-self: center;
}

.analytics-chart-y-axis span:last-child {
  align-self: end;
}

.analytics-line-plot {
  min-width: 0;
  height: 220px;
  position: relative;
  overflow: hidden;
}

.analytics-axis-bar-plot {
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 24px;
  gap: 6px;
}

.analytics-line-plot svg {
  position: absolute;
  inset: 0 0 28px;
  width: 100%;
  height: calc(100% - 28px);
  min-height: 0;
  max-height: 192px;
  overflow: hidden;
}

.analytics-chart-grid-line {
  stroke: rgba(100, 116, 139, 0.18);
  stroke-width: 0.6;
  vector-effect: non-scaling-stroke;
}

.analytics-chart-grid-line-vertical {
  stroke: rgba(100, 116, 139, 0.1);
  stroke-width: 0.45;
}

.analytics-chart-grid-line.is-base {
  stroke: rgba(20, 35, 59, 0.24);
}

.analytics-line-area {
  fill: rgba(15, 63, 134, 0.08);
}

.analytics-line-stroke {
  fill: none;
  stroke: var(--color-accent);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.analytics-line-area,
.ops-metric-line-area {
  opacity: 0;
  animation: chartAreaFadeIn 1s ease forwards;
}

.analytics-line-stroke.is-drawing,
.ops-metric-line-stroke.is-drawing {
  stroke-dasharray: var(--chart-line-length);
  stroke-dashoffset: var(--chart-line-length);
  animation: chartLineDraw 1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.analytics-line-x-axis,
.analytics-axis-x-labels {
  display: grid;
  align-items: start;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.analytics-line-x-axis {
  position: absolute;
  inset: auto 0 0;
  height: 22px;
  grid-template-columns: repeat(var(--analytics-trend-count), minmax(0, 1fr));
}

.analytics-axis-x-labels {
  grid-template-columns: repeat(var(--analytics-axis-bar-count), minmax(0, 1fr));
}

.analytics-line-x-axis span,
.analytics-axis-x-labels span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-axis-bar-plot {
  position: relative;
}

.analytics-axis-bar-grid {
  position: absolute;
  inset: 0 0 30px;
  pointer-events: none;
  background:
    linear-gradient(rgba(100, 116, 139, 0.18), rgba(100, 116, 139, 0.18)) 0 0 / 100% 1px no-repeat,
    linear-gradient(rgba(100, 116, 139, 0.18), rgba(100, 116, 139, 0.18)) 0 50% / 100% 1px no-repeat,
    linear-gradient(rgba(20, 35, 59, 0.24), rgba(20, 35, 59, 0.24)) 0 100% / 100% 1px no-repeat;
}

.analytics-axis-bars {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(var(--analytics-axis-bar-count), minmax(16px, 1fr));
  gap: 10px;
  align-items: end;
  min-height: 0;
}

.analytics-axis-bar-column {
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 18px;
  align-items: end;
  justify-items: center;
  gap: 5px;
}

.analytics-axis-bar-column b {
  width: min(34px, 72%);
  min-height: 4px;
  border-radius: 7px 7px 2px 2px;
  background: linear-gradient(180deg, var(--color-accent), #d6902f);
}

.analytics-axis-bar-column strong {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 850;
}

.analytics-bar-list {
  display: grid;
  gap: 10px;
  align-content: start;
}

.analytics-bar-row {
  display: grid;
  grid-template-columns: minmax(96px, 0.7fr) minmax(120px, 1fr) 54px;
  align-items: center;
  gap: 10px;
}

.analytics-bar-row span,
.analytics-channel-row strong {
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-bar-row div,
.analytics-channel-row b {
  height: 10px;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.14);
  overflow: hidden;
}

.analytics-bar-row b,
.analytics-channel-row em {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--color-accent), #d6902f);
}

.analytics-bar-row strong {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 850;
  text-align: right;
}

.analytics-hour-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.analytics-hour-cell {
  min-height: 62px;
  border-radius: 10px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 9px;
  background: rgba(15, 63, 134, var(--hour-alpha, 0.08));
  color: var(--color-text-primary);
}

.analytics-hour-cell.is-strong {
  color: var(--color-text-inverse);
}

.analytics-hour-cell span {
  font-size: 11px;
  font-weight: 850;
}

.analytics-hour-cell strong {
  font-size: 17px;
  font-weight: 900;
}

.analytics-channel-list {
  display: grid;
  gap: 12px;
  align-content: start;
}

.analytics-channel-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.analytics-channel-row > span {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--color-accent-soft);
  color: var(--navy);
}

.analytics-channel-row svg {
  width: 17px;
  height: 17px;
}

.analytics-channel-row div {
  display: grid;
  gap: 7px;
}

.analytics-channel-row mark {
  border-radius: 999px;
  background: rgba(17, 97, 73, 0.1);
  color: #116149;
  font-size: 12px;
  font-weight: 900;
  padding: 5px 8px;
}

.analytics-highlight-days {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 18px;
  row-gap: 9px;
  align-content: start;
}

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

.analytics-highlight-day div {
  display: grid;
  min-width: 0;
}

.analytics-highlight-day strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-highlight-day b {
  color: var(--ink);
  font-weight: 900;
}

.analytics-highlight-day span {
  min-width: 0;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-highlight-day > span {
  justify-self: end;
}

.analytics-retention-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.analytics-retention-grid div {
  border-radius: 12px;
  background: var(--color-surface-soft);
  padding: 14px;
  display: grid;
  gap: 8px;
}

.analytics-retention-grid strong {
  color: var(--ink);
  font-size: 26px;
  font-weight: 900;
}

.analytics-retention-grid span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
}

.analytics-empty-chart {
  min-height: 140px;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.live-dashboard-page {
  container-type: inline-size;
  position: relative;
  height: 100%;
  min-height: 0;
  padding: 0;
  display: grid;
  grid-template-rows: 100px minmax(0, 1fr);
  row-gap: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(247, 251, 255, 0.98), rgba(240, 246, 252, 0.96)),
    linear-gradient(90deg, var(--color-hover), transparent 28%, rgba(28, 132, 91, 0.04));
}

.live-dashboard-error {
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  z-index: 70;
  min-height: 34px;
  padding: 9px 12px;
  border: 1px solid rgba(208, 73, 73, 0.24);
  border-radius: 8px;
  background: rgba(255, 242, 242, 0.96);
  color: #a41f1f;
  font-size: 13px;
  font-weight: 850;
  box-shadow: 0 12px 28px rgba(120, 35, 35, 0.08);
}

[data-live-alert-menu-host] {
  display: contents;
}

.live-dashboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 40px;
  padding-bottom: 14px;
}

.live-dashboard-kicker {
  display: inline-flex;
  margin-bottom: 0;
  color: #0b6a43;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.live-dashboard-head-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.live-dashboard-head-actions .modal-button {
  height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.live-dashboard-head-actions .modal-button svg {
  width: 16px;
  height: 16px;
}

.live-dashboard-head-actions .modal-button:disabled svg {
  animation: analyticsSpin 0.9s linear infinite;
}

.live-connection {
  height: 40px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 850;
}

.live-connection.is-live {
  border-color: rgba(28, 132, 91, 0.28);
  background: rgba(236, 251, 244, 0.9);
  color: #0b6a43;
}

.live-connection svg {
  width: 16px;
  height: 16px;
}

.live-metric-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.92fr 0.92fr 0.86fr 0.98fr 1.05fr 90px;
  gap: 0;
  overflow: hidden;
  border: 0;
  border-bottom: 1px solid var(--color-border);
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 251, 255, 0.96));
  box-shadow: 0 10px 28px rgba(7, 30, 67, 0.05);
}

.live-metric {
  position: relative;
  min-height: 100px;
  padding: 17px 17px 15px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--color-selected);
  box-shadow: none;
}

.live-metric::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  background: transparent;
}

.live-metric:last-child {
  border-right: 0;
}

.live-metric > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--color-accent-soft);
  color: var(--navy);
  flex: 0 0 auto;
}

.live-metric svg {
  width: 19px;
  height: 19px;
}

.live-metric small,
.live-metric em {
  display: block;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
  font-style: normal;
  line-height: 1.15;
}

.live-metric strong {
  display: block;
  margin: 3px 0;
  color: var(--ink);
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0;
}

.live-metric.is-good > span {
  background: rgba(28, 132, 91, 0.12);
  color: #0b6a43;
}

.live-metric.is-good::before {
  background: #1f9d55;
}

.live-metric.is-warn > span {
  background: rgba(197, 91, 25, 0.12);
  color: #a34d13;
}

.live-metric.is-warn::before {
  background: #d97706;
}

.live-refresh-timer {
  min-height: 100px;
  padding: 13px 12px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  border-right: 0;
  border-left: 1px solid var(--color-selected);
  background: rgba(255, 255, 255, 0.72);
  border-top: 0;
  border-bottom: 0;
  border-right: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  appearance: none;
}

.live-refresh-timer:hover {
  background: rgba(247, 251, 255, 0.96);
}

.live-refresh-timer:disabled {
  cursor: default;
}

.live-refresh-timer.is-refreshing {
  background: rgba(247, 251, 255, 0.92);
}

.live-refresh-timer:focus-visible {
  outline: 2px solid rgba(7, 53, 110, 0.28);
  outline-offset: -2px;
}

.live-refresh-timer small {
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.live-refresh-ring {
  --refresh-progress: 0deg;
  --refresh-duration: 15000ms;
  position: relative;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background:
    conic-gradient(rgba(15, 63, 134, 0.42) var(--refresh-progress), rgba(15, 63, 134, 0.055) 0);
  box-shadow:
    inset 0 0 0 1px rgba(15, 63, 134, 0.08),
    0 8px 18px rgba(7, 30, 67, 0.08);
}

.live-refresh-ring.is-running {
  animation: liveRefreshSweep var(--refresh-duration) linear forwards;
}

.live-refresh-timer.is-refreshing .live-refresh-ring {
  animation: analyticsSpin 0.9s linear infinite;
  background: conic-gradient(rgba(15, 63, 134, 0.28), rgba(15, 63, 134, 0.08));
}

.live-refresh-ring::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: inherit;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 251, 255, 0.78));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.72),
    0 1px 2px rgba(7, 30, 67, 0.06);
}

.live-refresh-ring::after {
  content: "";
  position: absolute;
  inset: 13px;
  border-radius: inherit;
  background: rgba(15, 63, 134, 0.22);
  box-shadow: 0 0 0 4px rgba(15, 63, 134, 0.045);
}

@property --refresh-progress {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@keyframes liveRefreshSweep {
  from {
    --refresh-progress: 0deg;
  }
  to {
    --refresh-progress: 360deg;
  }
}

.live-dashboard-grid {
  min-height: 0;
  height: 100%;
  max-height: 100%;
  display: grid;
  grid-template-columns: clamp(210px, 20%, 276px) minmax(300px, 1fr) clamp(280px, 32%, 438px);
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  padding-top: 0;
  overflow: hidden;
  border-radius: 0;
  box-shadow: none;
}

.live-dashboard-grid.is-preview-open {
  grid-template-columns: clamp(210px, 20%, 276px) minmax(300px, 1fr) clamp(280px, 32%, 438px);
}

.live-dashboard-grid.is-preview-open .live-panel-chats {
  grid-column: 2;
}

.live-panel {
  min-width: 0;
  min-height: 0;
  padding: 18px 16px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  background: rgba(255, 255, 255, 0.78);
  border: 0;
  border-right: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
}

.live-panel:first-child {
  border-radius: 0;
}

.live-panel:last-child {
  border-radius: 0;
}

.live-panel-agents {
  grid-template-rows: auto auto minmax(0, 1fr);
  background:
    linear-gradient(180deg, rgba(247, 251, 255, 0.94), rgba(244, 249, 253, 0.92));
  border-right: 1px solid var(--color-border);
}

.live-panel-chats {
  background: rgba(255, 255, 255, 0.86);
  border-right: 1px solid var(--color-border);
}

.live-dashboard-grid.is-preview-open .live-panel-chats {
  padding: 0;
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.9);
}

.live-right-rail {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 252, 248, 0.74), rgba(247, 251, 255, 0.84));
}

.live-right-rail.has-no-alerts {
  grid-template-rows: minmax(0, 1fr);
}

.live-right-rail .live-panel {
  background: transparent;
}

.live-panel-alerts {
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(20, 35, 59, 0.11);
}

.live-panel-alerts .live-empty {
  min-height: 76px;
}

.live-panel-feed {
  padding-top: 16px;
}

.live-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.live-panel-head h3 {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: 0;
}

.live-panel-head span {
  min-width: 0;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: right;
  white-space: nowrap;
}

.live-refresh-button {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink-soft);
  cursor: pointer;
  appearance: none;
}

.live-refresh-button:hover {
  border-color: var(--color-accent-border);
  color: var(--navy);
  background: rgba(247, 251, 255, 0.96);
}

.live-refresh-button:focus-visible {
  outline: 2px solid rgba(7, 53, 110, 0.32);
  outline-offset: 2px;
}

.live-refresh-button:disabled {
  cursor: default;
  opacity: 0.72;
}

.live-refresh-button svg {
  width: 16px;
  height: 16px;
}

.live-refresh-button.is-refreshing svg {
  animation: analyticsSpin 0.9s linear infinite;
}

.live-chat-list,
.live-agent-list,
.live-alert-list,
.live-event-feed {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 9px;
  overflow: auto;
}

.live-agent-search {
  min-height: 38px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--color-selected);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink-soft);
}

.live-agent-search i,
.live-agent-search svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.live-agent-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 750;
}

.live-agent-search input::placeholder {
  color: rgba(91, 105, 126, 0.72);
}

.live-chat-list {
  gap: 0;
  border-top: 1px solid var(--color-border-subtle);
}

.live-event-feed {
  gap: 0;
  padding-left: 2px;
}

.live-chat-row,
.live-agent-row,
.live-alert-row,
.live-event-row {
  display: grid;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(247, 251, 255, 0.78);
  border: 1px solid var(--color-border-subtle);
}

.live-chat-row {
  position: relative;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: stretch;
  column-gap: 11px;
  min-height: 92px;
  padding: 14px 15px 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--color-border-subtle);
  border-radius: 0;
  background: var(--color-surface);
  color: var(--ink-soft);
  content-visibility: auto;
  contain: layout paint style;
  contain-intrinsic-size: 86px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  appearance: none;
}

.live-chat-row.is-unassigned {
  background:
    linear-gradient(90deg, rgba(197, 91, 25, 0.12), transparent 5px),
    rgba(255, 247, 237, 0.72);
}

.live-chat-row:hover {
  background: rgba(247, 251, 255, 0.72);
}

.live-chat-row:focus-visible {
  outline: 2px solid rgba(7, 53, 110, 0.32);
  outline-offset: -2px;
}

.live-chat-row:last-child {
  border-bottom: 0;
}

.live-chat-icon {
  display: flex;
  align-self: start;
  justify-content: center;
  align-items: center;
  width: 38px;
  height: 38px;
  min-width: 0;
  min-height: 0;
  margin-top: 1px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--color-border-subtle);
}

.live-chat-icon .agents-work-source-icon,
.live-chat-icon .agents-work-source-lucide {
  width: 22px;
  height: 22px;
}

.live-chat-icon .agents-work-source-icon.is-instagram,
.live-chat-icon .agents-work-source-icon.is-telegram {
  width: 24px;
  height: 24px;
}

.live-chat-icon .agents-work-source-icon.is-whatsapp {
  width: 27px;
  height: 27px;
}

.live-chat-body {
  min-width: 0;
}

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

.live-chat-title {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: nowrap;
}

.live-chat-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.live-chat-info {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.live-chat-row strong {
  display: block;
  min-width: 0;
  color: #243047;
  font-size: 16px;
  line-height: 1.25;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-agent-row strong,
.live-event-row strong {
  display: block;
  min-width: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-chat-row p {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.35;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-chat-row small,
.live-agent-row small,
.live-event-row small {
  display: block;
  min-width: 0;
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-agent-row b,
.live-event-row time {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 850;
  text-align: right;
}

.live-chat-age {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  color: var(--color-text-secondary);
  font-size: 15px;
  font-weight: 750;
  white-space: nowrap;
}

.live-chat-age i,
.live-chat-age svg {
  width: 14px;
  height: 14px;
}

.live-chat-assignee {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  color: #7b879a;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-agent-row {
  grid-template-columns: 12px minmax(0, 1fr) 34px;
  width: 100%;
  min-height: 64px;
  cursor: pointer;
  text-align: left;
  background: rgba(255, 255, 255, 0.68);
  transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.live-agent-row strong {
  font-size: 15px;
  font-weight: 900;
}

.live-agent-row small {
  font-size: 13px;
  font-weight: 750;
}

.live-agent-row b {
  font-size: 13px;
}

.live-agent-row:hover {
  background: rgba(255, 255, 255, 0.96);
  border-color: var(--color-selected-strong);
}

.live-agent-row.is-active {
  border-color: var(--color-accent-border);
  background: rgba(7, 53, 110, 0.09);
  box-shadow: inset 3px 0 0 var(--navy);
}

.live-chat-preview {
  min-height: 0;
  max-height: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  background: var(--color-surface);
  overflow: hidden;
}

.live-chat-preview-head {
  min-height: 58px;
  padding: 9px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--color-border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 251, 255, 0.92));
}

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

.live-chat-preview-head strong {
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
}

.live-chat-preview-head small {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
}

.live-chat-back {
  height: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--navy);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.live-chat-back:hover {
  background: var(--color-accent-soft);
}

.live-chat-back i,
.live-chat-back svg {
  width: 16px;
  height: 16px;
}

.live-chat-preview-tabs {
  min-height: 48px;
  display: flex;
  align-items: end;
  gap: 22px;
  padding: 0 14px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}

.live-chat-preview-tabs button {
  position: relative;
  height: 48px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 16px;
  font-weight: 850;
  cursor: pointer;
}

.live-chat-preview-tabs button::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: 999px;
  background: transparent;
}

.live-chat-preview-tabs button.is-active {
  color: var(--navy);
}

.live-chat-preview-tabs button.is-active::after {
  background: var(--navy);
}

.live-chat-preview-tabs button:focus-visible {
  outline: 2px solid rgba(7, 53, 110, 0.26);
  outline-offset: 4px;
}

.live-chat-preview-grid {
  min-height: 0;
  height: 100%;
  max-height: 100%;
  align-self: stretch;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
}

.live-chat-preview-messages {
  min-width: 0;
  min-height: 0;
  max-height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  height: 100%;
  overflow: hidden;
  border-right: 0;
}

.live-chat-preview-messages .agents-messages-header {
  display: none;
}

.live-chat-preview-messages .agents-messages-area {
  min-height: 0;
  height: auto;
  max-height: 100%;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding-bottom: 42px;
  border-bottom: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(247, 251, 255, 0.58));
}

.live-chat-preview .agents-message-item {
  content-visibility: visible;
  contain: none;
  contain-intrinsic-size: auto;
}

.live-chat-preview-details {
  min-width: 0;
  height: 100%;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: var(--color-surface);
}

.live-chat-preview-details .agents-right-tabs {
  grid-template-columns: 1fr;
}

.live-chat-preview-details .agents-right-content {
  min-height: 0;
}

.live-alert-row {
  grid-template-columns: 34px minmax(0, 1fr);
  padding: 11px 12px;
  width: 100%;
  text-align: left;
  font: inherit;
  cursor: pointer;
  background:
    linear-gradient(90deg, rgba(197, 91, 25, 0.42), rgba(197, 91, 25, 0.42) 4px, transparent 4px),
    rgba(255, 247, 237, 0.72);
  border-color: rgba(197, 91, 25, 0.24);
}

.live-alert-row.is-critical {
  background:
    linear-gradient(90deg, rgba(208, 73, 73, 0.5), rgba(208, 73, 73, 0.5) 4px, transparent 4px),
    rgba(255, 242, 242, 0.82);
  border-color: rgba(208, 73, 73, 0.26);
}

.live-alert-row > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(197, 91, 25, 0.12);
  color: #a34d13;
}

.live-alert-row.is-critical > span {
  background: rgba(208, 73, 73, 0.12);
  color: #bc3535;
}

.live-alert-row strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
}

.live-alert-row small {
  display: block;
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 750;
}

.live-alert-row svg {
  width: 16px;
  height: 16px;
}

.live-alert-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(7, 18, 36, 0.18);
}

.live-alert-menu {
  position: fixed;
  top: 80px;
  right: 28px;
  z-index: 81;
  width: min(420px, calc(100vw - 32px));
  max-height: min(620px, calc(100vh - 112px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--color-selected-strong);
  border-radius: 10px;
  background: var(--color-surface);
  box-shadow: 0 24px 70px rgba(7, 30, 67, 0.22);
  overflow: hidden;
}

.live-alert-menu header {
  padding: 15px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--color-selected);
}

.live-alert-menu header strong,
.live-alert-chat strong {
  display: block;
  color: var(--ink);
  font-weight: 900;
}

.live-alert-menu header small,
.live-alert-chat small {
  display: block;
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 750;
}

.live-alert-menu header button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: rgba(247, 251, 255, 0.9);
  color: var(--ink-soft);
  cursor: pointer;
}

.live-alert-menu header svg {
  width: 16px;
  height: 16px;
}

.live-alert-menu-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
}

.live-alert-chat {
  min-height: 68px;
  padding: 13px 15px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 0;
  border-bottom: 1px solid var(--color-border-subtle);
  background: var(--color-surface);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.live-alert-chat:hover {
  background: rgba(247, 251, 255, 0.86);
}

.live-alert-chat span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.live-agent-status {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #a9b4c3;
  box-shadow: 0 0 0 4px rgba(169, 180, 195, 0.12);
}

.live-agent-status.is-online {
  background: #1fca67;
  box-shadow: 0 0 0 4px rgba(31, 202, 103, 0.14);
}

.live-agent-status.is-break,
.live-agent-status.is-wrap_up {
  background: #f3b54a;
  box-shadow: 0 0 0 4px rgba(243, 181, 74, 0.16);
}

.live-event-row {
  position: relative;
  grid-template-columns: 34px minmax(0, 1fr) minmax(44px, max-content);
  align-items: start;
  column-gap: 10px;
  padding: 10px 0 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.live-event-row::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 43px;
  bottom: -10px;
  width: 1px;
  background: var(--color-selected);
}

.live-event-row:last-child::before {
  display: none;
}

.live-event-row > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--color-surface-muted);
  color: var(--navy);
  box-shadow: 0 0 0 5px rgba(247, 251, 255, 0.95);
  z-index: 1;
}

.live-event-row.is-warning > span {
  background: rgba(197, 91, 25, 0.12);
  color: #a34d13;
}

.live-event-row.is-success > span {
  background: rgba(28, 132, 91, 0.12);
  color: #0b6a43;
}

.live-event-row.is-critical > span {
  background: rgba(208, 73, 73, 0.12);
  color: #bc3535;
}

.live-event-row svg {
  width: 16px;
  height: 16px;
}

.live-event-row time {
  justify-self: end;
  max-width: 100%;
  padding-top: 2px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

@container (max-width: 820px) {
  .live-dashboard-grid,
  .live-dashboard-grid.is-preview-open {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    overflow: auto;
  }

  .live-dashboard-grid.is-preview-open .live-panel-chats {
    grid-column: 1;
  }
}

.live-empty {
  min-height: 150px;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  font-weight: 800;
  border-radius: 8px;
  background: rgba(20, 35, 59, 0.04);
}

.live-skeleton-row {
  min-height: 64px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--color-border-subtle);
  border-radius: 8px;
  background: rgba(247, 251, 255, 0.72);
}

.live-chat-list .live-skeleton-row {
  min-height: 92px;
  grid-template-columns: 44px minmax(0, 1fr);
  border: 0;
  border-bottom: 1px solid var(--color-border-subtle);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.72);
}

.live-skeleton-row.is-event {
  min-height: 48px;
  grid-template-columns: 36px minmax(0, 1fr) 54px;
  padding: 8px 0 10px;
  border: 0;
  background: transparent;
}

.live-skeleton-copy {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.live-skeleton-icon,
.live-skeleton-line {
  display: block;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(20, 35, 59, 0.07), var(--color-selected-strong), rgba(20, 35, 59, 0.07));
  background-size: 220% 100%;
  animation: skeletonPulse 1.15s ease-in-out infinite;
}

.live-skeleton-icon {
  width: 34px;
  height: 34px;
}

.live-skeleton-title {
  width: min(190px, 64%);
  height: 12px;
}

.live-skeleton-subtitle {
  width: min(270px, 82%);
  height: 10px;
}

.live-skeleton-time {
  width: 42px;
  height: 10px;
  justify-self: end;
}

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

@keyframes chartLineDraw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes chartAreaFadeIn {
  to {
    opacity: 1;
  }
}

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

@keyframes barGrowIn {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

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

@keyframes panelPopIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ops-report.is-animating-in .ops-monitor-kpi,
  .ops-report.is-animating-in .ops-monitor-panel,
  .ops-monitor-line.is-drawing,
  .ops-monitor-stack-bar span,
  .ops-monitor-bar-row i {
    animation: none;
    transform: none;
  }
}

@media (max-width: 1040px) {
  .analytics-toolbar.ops-report-toolbar {
    align-items: center;
    gap: 8px 12px;
    padding: 8px 12px;
  }

  .ops-report-toolbar .analytics-report-mode-tabs {
    min-height: 36px;
    gap: 18px;
    padding-bottom: 4px;
  }

  .ops-report-toolbar .analytics-report-mode-tabs button {
    min-height: 34px;
    padding-bottom: 4px;
    font-size: 15px;
  }

  .ops-report-toolbar-form {
    flex: 1 1 520px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .ops-report-toolbar-form .ops-report-builder-form,
  .ops-report-toolbar-form .ops-user-report-picker {
    width: 100%;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    gap: 8px;
  }

  .ops-report-toolbar-form .portal-filter-field > span {
    margin-bottom: 4px;
    font-size: 10px;
  }

  .ops-report-toolbar-form .analytics-date-input,
  .ops-report-toolbar-form .tickets-custom-select-trigger,
  .ops-report-toolbar-form .analytics-empty-generate {
    height: 34px;
    min-height: 34px;
    border-radius: 9px;
  }

  .ops-report-toolbar-form .analytics-empty-generate {
    align-self: end;
    padding: 0 12px;
    white-space: nowrap;
  }

  .portal-filter-field,
  .portal-filter-field:first-of-type {
    flex: 1 1 180px;
  }

  .analytics-report-actions {
    justify-content: flex-start;
  }

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

  .analytics-report-grid {
    grid-template-columns: 1fr;
  }

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

  .ops-command-center {
    grid-template-columns: 1fr;
  }

  .ops-monitor-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .ops-sla-summary-card {
    min-height: 240px;
    grid-template-columns: minmax(0, 1fr) minmax(160px, 220px);
    grid-template-rows: auto auto;
    align-items: center;
  }

  .ops-sla-summary-head,
  .ops-sla-summary-stats {
    grid-column: 1;
  }

  .ops-sla-summary-ring {
    grid-column: 2;
    grid-row: 1 / 3;
  }

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

  .ops-support-grid {
    grid-template-columns: 1fr;
  }

  .ops-report-grid {
    grid-template-columns: 1fr;
  }

  .ops-agent-focus dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .live-dashboard-page {
    grid-template-rows: auto auto;
    overflow: auto;
  }

  .live-dashboard-head {
    flex-direction: row;
    align-items: center;
  }

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

  .live-metric {
    border-right: 1px solid var(--color-selected);
    border-bottom: 1px solid var(--color-selected);
  }

  .live-refresh-timer {
    min-height: 86px;
    border-left: 0;
    border-bottom: 1px solid var(--color-selected);
  }

  .live-metric:nth-child(2n),
  .live-refresh-timer:nth-child(2n) {
    border-right: 0;
  }

  .live-metric:nth-last-child(-n + 2),
  .live-refresh-timer:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .live-dashboard-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .live-dashboard-grid.is-preview-open {
    grid-template-columns: 1fr;
  }

  .live-dashboard-grid.is-preview-open .live-panel-chats {
    grid-column: 1;
  }

  .live-chat-preview-grid {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .live-chat-preview-details {
    min-height: 360px;
  }

  .live-panel,
  .live-panel:first-child,
  .live-panel:last-child {
    border-right: 1px solid var(--color-selected);
    border-bottom: 0;
    border-radius: 0;
  }

  .live-panel:first-child {
    border-radius: 0;
  }

  .live-panel:last-child {
    border-bottom: 1px solid var(--color-selected);
    border-radius: 0;
  }

  .live-chat-row {
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: stretch;
  }
}

.crm-stage-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--stage-color, var(--color-accent)) 12%, white);
  color: var(--stage-color, var(--color-accent));
  font-size: 12px;
  font-weight: 800;
}

.crm-stage-badge.is-empty {
  background: var(--color-hover);
  color: var(--ink-soft);
}

.crm-duplicates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  padding: 24px 26px 30px;
}

.crm-duplicate-card,
.crm-duplicate-item {
  width: 100%;
  display: grid;
  gap: 8px;
  justify-items: start;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--color-surface);
  color: var(--ink);
  text-align: left;
}

.crm-duplicate-card small,
.crm-duplicate-item span {
  color: var(--ink-soft);
}

.crm-contact-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
}

.crm-contact-main {
  min-width: 0;
  border-right: 1px solid var(--border);
}

.crm-contact-head {
  display: flex;
  gap: 10px;
  padding: 18px 22px 0;
}

.crm-contact-card,
.crm-conversation-view {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: calc(100dvh - 34px);
}

.crm-contact-card-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
}

.crm-contact-card-head h2,
.crm-conversation-view h2 {
  margin: 0;
  font-size: 32px;
  letter-spacing: -0.04em;
}

.crm-contact-card-head p,
.crm-conversation-view p {
  margin: 10px 0 0;
  color: var(--ink-soft);
  line-height: 1.65;
}

.crm-contact-stage {
  min-width: 190px;
}

.crm-contact-tabs {
  display: flex;
  gap: 18px;
  padding: 0 22px;
  border-bottom: 1px solid var(--border);
}

.crm-contact-tab {
  height: 46px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 800;
  border-bottom: 2px solid transparent;
}

.crm-contact-tab.is-active {
  color: var(--navy);
  border-bottom-color: var(--navy);
}

.crm-create-tabs {
  padding: 0 24px;
}

.crm-create-tabs .crm-contact-tab {
  position: relative;
  border-bottom-color: transparent;
  transition: color 140ms ease;
}

.crm-create-tabs .crm-contact-tab::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  border-radius: 999px;
  background: var(--navy);
  opacity: 0;
  transform: scaleX(0.55);
  transform-origin: center;
}

.crm-create-tabs .crm-contact-tab.is-active::after {
  opacity: 1;
  transform: scaleX(1);
  animation: crmCreateTabUnderlineIn 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.crm-add-card-tab-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.crm-add-card-tab-panel.is-switching-forward,
.crm-add-card-tab-panel.is-switching-backward {
  animation: crmCreateTabPanelIn 170ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.crm-add-card-tab-panel.is-switching-forward {
  --crm-create-tab-offset: 10px;
}

.crm-add-card-tab-panel.is-switching-backward {
  --crm-create-tab-offset: -10px;
}

@keyframes crmCreateTabPanelIn {
  from {
    opacity: 0.72;
    transform: translate3d(var(--crm-create-tab-offset, 10px), 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes crmCreateTabUnderlineIn {
  from {
    opacity: 0.7;
    transform: scaleX(0.55);
  }
  to {
    opacity: 1;
    transform: scaleX(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .crm-create-tabs .crm-contact-tab,
  .crm-create-tabs .crm-contact-tab.is-active::after,
  .crm-add-card-tab-panel.is-switching-forward,
  .crm-add-card-tab-panel.is-switching-backward {
    animation: none;
    transition: none;
  }
}

.agents-middle-composer:focus-within {
  border-color: rgba(47, 111, 175, 0.82);
  box-shadow: 0 0 0 1px rgba(47, 111, 175, 0.1);
}

.crm-add-card-tab-panel > .contacts-form-grid {
  padding: 18px 24px 0;
  align-content: start;
  overflow: auto;
}

.crm-create-custom-fields {
  margin-top: 2px;
}

.crm-add-existing-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  height: 100%;
  padding: 18px 24px 0;
  min-height: 0;
}

.crm-add-existing-search {
  min-width: 0;
}

.crm-add-existing-actions {
  display: none;
}

.crm-add-existing-list,
.crm-add-existing-pagination {
  grid-column: 1 / -1;
  flex: 0 0 auto;
  margin: 0;
  padding: 10px 0 0;
}

.crm-add-existing-list {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  height: 100%;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.crm-add-existing-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--color-selected);
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.82);
}

.crm-add-existing-item strong {
  display: block;
  color: var(--ink);
}

.crm-add-existing-item p {
  margin: 5px 0 0;
  color: var(--ink-soft);
}

.crm-add-existing-item small {
  display: block;
  margin-top: 6px;
  color: var(--ink-soft);
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.crm-contact-body,
.crm-conversation-view {
  min-height: 0;
  overflow: auto;
}

.crm-conversation-view {
  padding: 22px;
}

.crm-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px 22px 24px;
}

.crm-detail-field {
  display: grid;
  gap: 8px;
}

.crm-detail-field span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.crm-detail-field input,
.crm-detail-field textarea,
.crm-settings-row input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 11px 13px;
  background: var(--color-surface);
}

.crm-detail-field-span-2 {
  grid-column: 1 / -1;
}

.crm-card-info-fields {
  display: grid;
  grid-column: 1 / -1;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--color-selected);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.86);
}

.crm-card-info-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.crm-card-info-head strong {
  font-size: 13px;
}

.crm-card-info-head span {
  color: var(--ink-soft);
  font-size: 12px;
}

.crm-card-info-grid {
  padding: 0;
}

.crm-custom-fields,
.crm-duplicates-list,
.crm-notes-list,
.crm-activity-list,
.crm-conversation-notes {
  display: grid;
  gap: 12px;
}

.crm-notes-panel,
.crm-note-compose {
  display: grid;
  gap: 12px;
  padding: 18px 22px 24px;
}

.crm-note-actions {
  display: flex;
  justify-content: end;
}

.crm-activity-list {
  padding: 18px 22px 24px;
}

.crm-activity-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
}

.crm-activity-item time {
  color: var(--ink-soft);
  white-space: nowrap;
}

.crm-chat-preview {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  background: rgba(248, 244, 238, 0.7);
}

.crm-contact-side {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: calc(100dvh - 34px);
  background: rgba(248, 244, 238, 0.55);
}

.crm-contact-side-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 18px;
  border-bottom: 1px solid var(--border);
}

.crm-contact-side-list {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
  overflow: auto;
}

.crm-contact-conversation-item {
  width: 100%;
  display: grid;
  gap: 6px;
  justify-items: start;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--color-surface);
  color: var(--ink);
  text-align: left;
  content-visibility: auto;
  contain: layout paint style;
  contain-intrinsic-size: 76px;
}

.crm-contact-conversation-item.is-active {
  background: rgba(7, 53, 110, 0.07);
  border-color: rgba(7, 53, 110, 0.18);
}

.crm-contact-drawer {
  position: absolute;
  inset: 0;
  z-index: 40;
  pointer-events: auto;
}

.crm-contact-drawer-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: transparent;
  cursor: default;
}

.crm-contact-drawer-panel {
  position: absolute;
  inset: 0 0 0 auto;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(680px, calc(100% - 24px));
  height: 100%;
  min-height: 0;
  overflow: hidden;
  pointer-events: auto;
  border-left: 1px solid var(--color-border);
  background: var(--color-surface);
  box-shadow: -34px 0 70px rgba(7, 30, 67, 0.18);
  transition: width 180ms ease;
}

.crm-contact-drawer.is-wide .crm-contact-drawer-panel {
  width: min(920px, calc(100% - 24px));
}

.crm-contact-drawer.is-opening .crm-contact-drawer-panel {
  animation: crmContactDrawerOpen 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.crm-contact-drawer.is-expanding.is-wide .crm-contact-drawer-panel {
  animation: crmContactDrawerExpand 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.crm-contact-drawer.is-collapsing .crm-contact-drawer-panel {
  animation: crmContactDrawerCollapse 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.crm-contact-drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border);
}

.crm-contact-drawer-head h2 {
  margin: 4px 0 0;
  font-size: 30px;
  letter-spacing: -0.04em;
}

.crm-contact-drawer-head p {
  margin: 8px 0 0;
  color: var(--ink-soft);
}

.crm-drawer-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.crm-drawer-close,
.crm-drawer-delete {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--color-border);
  border-radius: 13px;
  background: var(--color-surface);
  color: var(--ink-soft);
}

.crm-drawer-close:hover {
  background: var(--color-hover);
  color: var(--navy);
}

.crm-drawer-delete {
  color: rgba(163, 32, 32, 0.62);
}

.crm-drawer-delete:hover:not(:disabled) {
  border-color: rgba(163, 32, 32, 0.22);
  background: rgba(163, 32, 32, 0.08);
  color: #a32020;
}

.crm-drawer-delete:disabled {
  cursor: wait;
  opacity: 0.7;
}

.crm-drawer-close svg,
.crm-drawer-delete svg {
  width: 18px;
  height: 18px;
}

.crm-drawer-tabs {
  padding: 0 24px;
}

.crm-drawer-body,
.crm-drawer-conversation-body {
  min-height: 0;
  overflow: auto;
}

.crm-drawer-details {
  display: grid;
  gap: 18px;
  padding: 20px 24px 28px;
}

.crm-drawer-edit-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 2px;
}

.crm-drawer-edit-head strong {
  font-size: 16px;
}

.crm-drawer-edit-head span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.crm-drawer-edit-grid {
  padding: 0;
}

.crm-drawer-detail-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.crm-drawer-detail-list div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--color-border-subtle);
  border-radius: 15px;
  background: rgba(248, 250, 252, 0.82);
}

.crm-drawer-detail-list div.is-wide {
  grid-column: 1 / -1;
}

.crm-drawer-detail-list dt {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.crm-drawer-detail-list dd {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-weight: 750;
  overflow-wrap: anywhere;
}

.crm-drawer-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--color-accent-soft);
  color: var(--navy);
  font-size: 12px;
  font-weight: 850;
}

.crm-muted-text {
  color: var(--ink-soft);
  font-weight: 750;
}

.crm-pipeline-membership-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.crm-pipeline-membership-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  max-width: 100%;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--pipeline-color, var(--navy)) 34%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--pipeline-color, var(--navy)) 10%, white);
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
}

.crm-pipeline-membership-pill.is-compact {
  gap: 6px;
  min-height: 24px;
  padding: 0 8px;
  border-color: var(--color-selected);
  background: transparent;
  box-shadow: none;
}

.crm-pipeline-membership-pill.is-compact .crm-sidebar-child-dot {
  width: 9px;
  height: 9px;
  flex-basis: 9px;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pipeline-color, var(--navy)) 14%, transparent);
}

.crm-pipeline-membership-pill small {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
}

.crm-pipeline-membership-pill.is-compact small {
  font-size: 11px;
}

.crm-pipeline-membership-more {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--color-selected);
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.08);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.crm-pipeline-membership-more.is-compact {
  min-height: 24px;
  padding: 0 8px;
  font-size: 12px;
}

.crm-pipeline-membership-pill i {
  width: 13px;
  height: 13px;
  color: var(--ink-soft);
}

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

.crm-drawer-section {
  display: grid;
  gap: 10px;
}

.crm-drawer-section h3,
.crm-conversation-notes h4 {
  margin: 0;
  font-size: 15px;
}

.crm-drawer-conversation-list {
  padding: 20px 24px 28px;
}

.crm-drawer-conversation-head {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
}

.crm-drawer-conversation-body {
  display: grid;
  gap: 16px;
  padding: 18px 22px 28px;
}

.crm-drawer-empty {
  display: grid;
  place-items: center;
  min-height: 260px;
  color: var(--ink-soft);
}

@keyframes crmContactDrawerOpen {
  from {
    transform: translateX(28px);
    opacity: 0.72;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes crmContactDrawerExpand {
  from {
    width: min(680px, calc(100% - 24px));
  }
  to {
    width: min(920px, calc(100% - 24px));
  }
}

@keyframes crmContactDrawerCollapse {
  from {
    width: min(920px, calc(100% - 24px));
  }
  to {
    width: min(680px, calc(100% - 24px));
  }
}

.crm-settings-grid {
  display: grid;
  gap: 18px;
  padding: 24px 26px 30px;
}

.crm-settings-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.86);
}

.crm-settings-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.crm-settings-list {
  display: grid;
  gap: 12px;
}

.crm-settings-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 120px 110px auto auto;
  gap: 10px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--color-border-subtle);
  border-radius: 16px;
}

.crm-settings-row-fields {
  grid-template-columns: 1fr 1fr 170px 110px 1.2fr auto auto auto;
}

@media (max-width: 1320px) {
  .crm-contact-shell {
    grid-template-columns: 1fr;
  }

  .crm-contact-main {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

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

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

  .crm-contacts-filter-popover {
    width: min(820px, calc(100vw - 280px));
  }

  .crm-filter-checkbox-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .crm-organizations-layout {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .crm-organization-detail {
    border-left: none;
    border-top: 1px solid var(--border);
  }

  .crm-pipeline-identity-card,
  .crm-pipeline-identity-form,
  .crm-pipeline-stage-editor,
  .crm-pipeline-stage-fields {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .crm-page,
  .crm-toolbar,
  .crm-toolbar-grid,
  .crm-contacts-filter-grid,
  .crm-detail-grid,
  .crm-settings-row,
  .crm-settings-row-fields {
    grid-template-columns: 1fr;
  }

  .crm-contacts-filter-primary {
    align-items: stretch;
    flex-direction: column;
  }

  .crm-contacts-list-toolbar {
    display: flex;
  }

  .crm-contacts-filter-popover {
    left: 14px;
    right: 14px;
    width: auto;
    max-height: min(680px, calc(100vh - 150px));
  }

  .crm-filter-checkbox-stack {
    grid-template-columns: 1fr;
  }

  .crm-contacts-search {
    max-width: none;
  }

  .crm-contacts-sort {
    flex: 1 1 auto;
  }

  .crm-contacts-actions {
    justify-content: flex-start;
  }

  .crm-contacts-list-toolbar .crm-contacts-actions {
    justify-self: auto;
  }

  .crm-contact-organization-add {
    grid-template-columns: 1fr;
  }

  .crm-view-header,
  .crm-contact-card-head {
    flex-direction: column;
  }

  .ops-shell {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .ops-view {
    overflow: visible;
  }

  .ops-report-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .ops-window-presets {
    width: 100%;
    justify-content: space-between;
    overflow-x: auto;
  }

  .ops-sidebar {
    min-height: 260px;
  }

  .ops-metric-grid,
  .ops-agent-focus dl {
    grid-template-columns: 1fr;
  }

  .ops-sla-summary-card {
    min-height: 0;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }

  .ops-sla-summary-head,
  .ops-sla-summary-stats,
  .ops-sla-summary-ring {
    grid-column: auto;
    grid-row: auto;
  }

  .ops-volume-row .ops-volume-panel {
    min-height: 310px;
    grid-template-rows: auto minmax(230px, 1fr);
  }

  .ops-volume-row .ops-volume-chart {
    min-height: 230px;
  }

  .ops-metric-card:not(:nth-child(3n))::before {
    content: none;
  }

  .ops-agent-table {
    min-width: 680px;
  }
}

@media (max-width: 680px) {
  .ops-monitor-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ops-monitor-panel-head {
    display: grid;
  }

  .ops-monitor-key {
    justify-content: flex-start;
  }

  .ops-monitor-line-chart,
  .ops-monitor-combo-chart {
    min-height: 210px;
  }

  .ops-monitor-line-chart svg,
  .ops-monitor-combo-chart svg {
    height: 210px;
  }

  .ops-priority-grid,
  .ops-performance-grid,
  .ops-support-card-grid {
    grid-template-columns: 1fr;
  }

  .ops-kpi-card--priority,
  .ops-kpi-card--compact {
    min-height: 104px;
  }

  .ops-kpi-card--priority strong {
    font-size: 28px;
  }
}

.portal-view.is-mobile-portrait-admin .ops-shell {
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
}

.portal-view.is-mobile-portrait-admin .ops-sidebar {
  display: none;
}

.portal-view.is-mobile-portrait-admin .ops-view {
  overflow: hidden;
}

.portal-view.is-mobile-portrait-admin .ops-report {
  padding: 20px 22px;
}

.portal-view.is-mobile-portrait-admin .ops-report-head {
  position: relative;
  z-index: 20;
  align-items: stretch;
  flex-direction: column;
  gap: 8px;
}

.portal-view.is-mobile-portrait-admin .ops-report-title-row {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.portal-view.is-mobile-portrait-admin .ops-report-head h2 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-view.is-mobile-portrait-admin .ops-mobile-agent-picker {
  position: relative;
  display: block;
  flex: 0 1 210px;
  justify-self: end;
}

.portal-view.is-mobile-portrait-admin .ops-window-presets {
  width: 100%;
  justify-content: space-between;
  overflow-x: auto;
}

.portal-view.is-mobile-portrait-admin .ops-agent-performance-panel {
  display: none;
}

.portal-view.is-mobile-portrait-admin .ops-metric-card {
  grid-template-rows: auto 52px;
  gap: 14px;
}

.portal-view.is-mobile-portrait-admin .ops-metric-line {
  min-height: 52px;
}

.portal-view.is-mobile-portrait-admin .ops-metric-line svg {
  height: 52px;
  min-height: 52px;
}

.portal-view.is-mobile-portrait-admin .ops-metric-line-grid {
  stroke-width: 0.9;
}

.portal-view.is-mobile-portrait-admin .ops-metric-line-stroke {
  stroke-width: 2.35;
}

.portal-view.is-mobile-portrait-admin .ops-metric-line-area {
  fill: var(--color-hover);
}

.contacts-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
}

.contacts-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 15, 29, 0.42);
  backdrop-filter: blur(4px);
}

.contacts-modal-dialog {
  position: relative;
  width: min(700px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  overflow: auto;
  padding: 20px;
  border-radius: 24px;
  background: var(--color-surface);
  box-shadow: var(--shadow);
}

.contacts-modal-stacked {
  z-index: 130;
}

.contacts-card-info-dialog {
  width: min(620px, calc(100vw - 36px));
  max-height: min(620px, calc(100vh - 64px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
}

.contacts-modal-head p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 750;
}

.contacts-card-info-body {
  min-height: 0;
  overflow: auto;
  padding: 16px 24px;
}

.contacts-card-info-body .crm-card-info-fields {
  min-width: 0;
}

.contacts-card-info-error {
  margin: 0 24px 12px;
}

.contacts-stage-delete-dialog {
  width: min(560px, calc(100vw - 36px));
}

.contacts-stage-delete-copy {
  padding: 16px 24px 0;
}

.contacts-stage-delete-copy p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.55;
  font-weight: 700;
}

.contacts-stage-delete-options {
  display: grid;
  gap: 12px;
  padding: 16px 24px 24px;
}

.contacts-stage-delete-option {
  width: 100%;
  min-height: 72px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--color-selected);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.contacts-stage-delete-option:hover {
  border-color: var(--color-accent-border);
  background: rgba(247, 251, 255, 0.88);
}

.contacts-stage-delete-option.is-danger:hover {
  border-color: rgba(208, 73, 73, 0.28);
  background: rgba(255, 242, 242, 0.82);
}

.contacts-stage-delete-option > i,
.contacts-stage-delete-option > svg {
  width: 18px;
  height: 18px;
}

.contacts-stage-delete-option > i {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--color-accent-soft);
  color: var(--navy);
}

.contacts-stage-delete-option.is-danger > i {
  background: rgba(208, 73, 73, 0.1);
  color: #c83b3b;
}

.contacts-stage-delete-option strong,
.contacts-stage-delete-option small {
  display: block;
}

.contacts-stage-delete-option strong {
  font-weight: 900;
}

.contacts-stage-delete-option small {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}

.contacts-modal-dialog-wide {
  width: min(1040px, calc(100vw - 32px));
}

.contacts-modal-dialog-wide:has(.crm-create-tabs) {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  height: min(760px, calc(100dvh - 48px));
  overflow: hidden;
  border-radius: 14px;
}

.contacts-export-dialog {
  width: min(720px, calc(100vw - 32px));
}

.contacts-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.contacts-modal-head h3 {
  margin: 0;
  font-size: 24px;
}

.contacts-modal-actions {
  display: flex;
  justify-content: end;
  margin-top: 18px;
  flex: 0 0 auto;
}

.contacts-modal-dialog-wide:has(.crm-create-tabs) .contacts-modal-actions {
  position: relative;
  z-index: 4;
  margin-top: 0;
  padding: 12px 24px 16px;
  border-top: 1px solid var(--color-border-subtle);
  background: var(--color-surface);
}

.contacts-import-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.contacts-import-toolbar span {
  color: var(--ink-soft);
}

.contacts-export-copy {
  margin: -4px 0 16px;
  color: var(--ink-soft);
}

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

.contacts-export-option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 82px;
  padding: 14px;
  border: 1px solid var(--color-accent-border);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f7f9fc 100%);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 8px 18px rgba(7, 30, 67, 0.07);
}

.contacts-export-option:hover:not(:disabled) {
  border-color: rgba(7, 53, 110, 0.34);
  background: color-mix(in srgb, var(--navy) 7%, white);
}

.contacts-export-option:disabled {
  cursor: wait;
  opacity: 0.64;
}

.contacts-export-option > svg,
.contacts-export-option > i {
  width: 26px;
  height: 26px;
  color: var(--navy);
}

.contacts-export-option span {
  display: grid;
  gap: 4px;
}

.contacts-export-option strong {
  font-size: 15px;
}

.contacts-export-option small {
  color: var(--ink-soft);
  font-weight: 700;
}

@media (max-width: 680px) {
  .contacts-export-dialog {
    width: min(520px, calc(100vw - 32px));
  }

  .contacts-export-options {
    grid-template-columns: 1fr;
  }
}

.contacts-import-mapping,
.contacts-admin-list {
  display: grid;
  gap: 14px;
}

.contacts-admin-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 120px 110px auto auto;
  gap: 10px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
}

.contacts-admin-row-fields {
  grid-template-columns: 1fr 1fr 170px 110px 1.2fr auto auto auto;
}

@media (max-width: 1260px) {
  .contacts-page {
    grid-template-columns: 1fr;
  }

  .contacts-detail-panel {
    min-height: 620px;
  }
}

@media (max-width: 880px) {
  .contacts-toolbar,
  .contacts-detail-grid,
  .contacts-form-grid,
  .contacts-conversations-shell {
    grid-template-columns: 1fr;
  }

  .contacts-admin-row,
  .contacts-admin-row-fields {
    grid-template-columns: 1fr;
  }
}

.app-shell {
  min-height: 100dvh;
}

.global-boot-loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--color-canvas);
}

.global-boot-spinner,
.workspace-list-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--color-border-strong);
  border-top-color: var(--color-accent);
  border-radius: 999px;
  animation: dashboard-spin 0.72s linear infinite;
}

.login-view {
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(320px, 540px) minmax(360px, 1fr);
  overflow: hidden;
}

.login-card,
.login-panel {
  position: relative;
}

.login-card {
  display: grid;
  grid-template-rows: auto auto;
  align-items: start;
  justify-items: center;
  align-content: center;
  gap: clamp(14px, 1.8vh, 22px);
  min-height: 100%;
  padding: clamp(24px, 4.5vh, 48px) min(6vw, 78px);
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  grid-row: 1;
  width: min(100%, 420px);
  margin-top: -8px;
  color: inherit;
  text-decoration: none;
}

.login-brand img {
  width: clamp(44px, 5vw, 68px);
  height: clamp(44px, 5vw, 68px);
  object-fit: contain;
}

.login-brand-copy {
  display: grid;
  gap: 4px;
}

.login-brand-name {
  font-family: var(--font-body);
  font-size: clamp(22px, 1.85vw, 32px);
  line-height: 1;
  letter-spacing: -0.05em;
  font-weight: 800;
  color: var(--navy);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 800;
  color: var(--navy);
}

.login-brand:hover .login-brand-name,
.login-brand:hover .eyebrow {
  opacity: 0.82;
}

.login-copy h1,
.portal-header h2 {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: -0.04em;
  line-height: 0.98;
}

.login-copy h1 {
  max-width: none;
  font-size: clamp(16px, 1.55vw, 26px);
  margin-inline: auto;
}

.login-copy h1 span {
  display: block;
  white-space: nowrap;
}

.login-copy {
  display: grid;
  gap: 6px;
  justify-items: center;
  text-align: center;
  width: 100%;
}

.login-form {
  grid-row: 2;
  width: min(100%, 420px);
  justify-self: center;
  display: grid;
  gap: clamp(12px, 1.8vh, 18px);
  padding: clamp(22px, 2.8vh, 30px);
  background: var(--bg-panel);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  align-self: center;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.field input {
  height: clamp(46px, 5vh, 54px);
  border-radius: 14px;
  border: 1px solid var(--color-selected-strong);
  background: rgba(255, 255, 255, 0.76);
  padding: 0 16px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.field input:focus {
  border-color: rgba(7, 53, 110, 0.44);
  box-shadow: 0 0 0 4px rgba(7, 53, 110, 0.09);
  transform: translateY(-1px);
}

.primary-button {
  height: clamp(48px, 5.2vh, 56px);
  border: none;
  border-radius: 16px;
  background: var(--navy);
  color: var(--color-on-accent);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: var(--shadow-tight);
}

.primary-button:disabled {
  opacity: 0.7;
  cursor: wait;
}

.status-text {
  min-height: 20px;
  margin: 0;
  font-size: 13px;
  color: var(--ink-soft);
}

.status-text.is-error {
  color: #ae2b2b;
}

.status-text.is-success {
  color: #117548;
}

.helper-text {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.65;
}

.login-legal-links {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12.5px;
}

.login-legal-links a {
  color: var(--ink-soft);
  text-decoration: none;
}

.login-legal-links a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.login-legal-links span {
  color: var(--ink-soft);
  opacity: 0.6;
}

.login-panel {
  padding: clamp(20px, 3vh, 34px);
  overflow: hidden;
}

.signal-ribbon-bg {
  position: absolute;
  inset: 18px 18px 18px 0;
  border-radius: 40px;
  overflow: hidden;
  background:
    radial-gradient(circle at 84% 50%, rgba(114, 196, 255, 0.18), transparent 20%),
    radial-gradient(circle at 29% 64%, rgba(45, 143, 226, 0.12), transparent 25%),
    linear-gradient(145deg, #092e63 0%, var(--navy) 48%, #0b4584 100%);
}

.signal-ribbon-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.2;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(110deg, transparent 3%, #000 42%, transparent 94%);
}

.signal-ribbon-bg::after {
  content: "";
  position: absolute;
  width: min(50vw, 680px);
  aspect-ratio: 1;
  right: -15%;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  box-shadow:
    0 0 0 78px rgba(255, 255, 255, 0.018),
    0 0 0 156px rgba(255, 255, 255, 0.01);
}

.signal-ribbon {
  position: absolute;
  inset: 18px 18px 18px 0;
  z-index: 1;
  display: grid;
  place-items: center;
  border-radius: 40px;
  overflow: hidden;
}

.signal-ribbon-stage {
  position: relative;
  width: min(91%, 1080px);
  aspect-ratio: 1000 / 720;
}

.signal-ribbon-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.signal-ribbon-halo,
.signal-ribbon-track,
.signal-ribbon-flow {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.signal-ribbon-halo {
  stroke: rgba(92, 180, 255, 0.22);
  stroke-width: 18;
  filter: url(#signal-ribbon-glow);
}

.signal-ribbon-track {
  stroke: url(#signal-ribbon-gradient);
  stroke-width: 2.5;
}

.signal-ribbon-flow {
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 3.5;
  stroke-dasharray: 5 15;
  animation: signal-ribbon-travel 3.6s linear infinite;
}

@keyframes signal-ribbon-travel {
  to {
    stroke-dashoffset: -40;
  }
}

.signal-node,
.signal-destination {
  position: absolute;
  left: var(--signal-x);
  top: var(--signal-y);
  z-index: 2;
  transform: translate(-50%, -50%);
}

.signal-node {
  width: clamp(74px, 7.2vw, 96px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--color-text-inverse);
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.055));
  box-shadow:
    0 18px 38px rgba(2, 17, 39, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.11);
  backdrop-filter: blur(16px);
  opacity: 0;
  animation: signal-node-arrive 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.signal-node-1 {
  animation-delay: 0.12s;
}

.signal-node-2 {
  animation-delay: 0.22s;
}

.signal-node-3 {
  animation-delay: 0.32s;
}

.signal-node-4 {
  animation-delay: 0.42s;
}

.signal-node svg {
  width: clamp(23px, 2.2vw, 29px);
  height: clamp(23px, 2.2vw, 29px);
  stroke-width: 1.8;
}

.signal-node span {
  color: rgba(255, 255, 255, 0.68);
  font-size: clamp(8px, 0.7vw, 10px);
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
}

@keyframes signal-node-arrive {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 14px)) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.signal-destination {
  width: clamp(122px, 12vw, 166px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.signal-destination-ring {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.19);
  border-radius: inherit;
  box-shadow:
    0 0 0 22px rgba(255, 255, 255, 0.026),
    0 0 0 48px rgba(255, 255, 255, 0.014);
  animation: signal-destination-breathe 4.8s ease-in-out infinite;
}

.signal-destination-core {
  position: relative;
  width: 68%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 32%;
  background: rgba(5, 24, 52, 0.82);
  box-shadow:
    0 24px 54px rgba(2, 14, 32, 0.34),
    0 0 38px rgba(111, 196, 255, 0.12);
  backdrop-filter: blur(18px);
}

.signal-destination-core img {
  width: 46%;
  height: 46%;
  object-fit: contain;
}

@keyframes signal-destination-breathe {
  0%,
  100% {
    opacity: 0.64;
    transform: scale(0.98);
  }
  50% {
    opacity: 1;
    transform: scale(1.035);
  }
}

@media (prefers-reduced-motion: reduce) {
  .signal-ribbon-flow,
  .signal-node,
  .signal-destination-ring {
    animation: none;
  }

  .signal-node {
    opacity: 1;
  }
}


.portal-view {
  position: fixed;
  inset: 0;
  height: calc(100dvh / var(--ui-scale));
  width: calc(100vw / var(--ui-scale));
  transform: scale(var(--ui-scale));
  transform-origin: top left;
  display: grid;
  grid-template-columns: 88px 1fr;
  overflow: hidden;
}

.portal-view.is-mobile-portrait {
  height: 100dvh;
  width: 100vw;
  grid-template-columns: minmax(0, 1fr);
  transform: none;
}

.portal-view.is-mobile-portrait-loading {
  height: 100dvh;
  width: 100vw;
  grid-template-columns: minmax(0, 1fr);
  transform: none;
}

.portal-view.is-mobile-portrait .portal-sidebar {
  display: none;
}

.portal-view.is-mobile-portrait-loading .portal-sidebar {
  display: none;
}

.portal-view.is-mobile-portrait .portal-main,
.portal-view.is-mobile-portrait .portal-content,
.portal-view.is-mobile-portrait-loading .portal-main,
.portal-view.is-mobile-portrait-loading .portal-content {
  min-height: 100dvh;
}

.portal-view.is-mobile-portrait .portal-content {
  overflow: auto;
}

.portal-mobile-orientation-message {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 18%, rgba(15, 63, 134, 0.08), transparent 34%),
    var(--app-bg);
}

.portal-mobile-orientation-message-inner {
  display: grid;
  justify-items: center;
  gap: 16px;
  color: var(--ink-soft);
  text-align: center;
}

.portal-mobile-orientation-logo {
  width: 92px;
  height: auto;
  margin-bottom: 4px;
}

.portal-mobile-orientation-message-inner p {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 850;
}

.portal-mobile-landscape-illustration {
  width: min(260px, 72vw);
  display: grid;
  justify-items: center;
  gap: 7px;
  margin-top: 8px;
}

.portal-mobile-landscape-screen {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: grid;
  grid-template-columns: 1.1fr 0.8fr;
  grid-template-rows: 1fr 1fr;
  gap: 8px;
  padding: 14px;
  border: 2px solid rgba(15, 63, 134, 0.22);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 250, 253, 0.94)),
    #ffffff;
  box-shadow:
    0 20px 46px rgba(7, 30, 67, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.8);
}

.portal-mobile-landscape-screen span {
  display: block;
  border-radius: 8px;
  background: rgba(15, 63, 134, 0.08);
}

.portal-mobile-landscape-screen span:first-child {
  grid-row: 1 / -1;
  background: rgba(15, 63, 134, 0.12);
}

.portal-mobile-landscape-base {
  width: 58%;
  height: 9px;
  border-radius: 0 0 999px 999px;
  background: rgba(15, 63, 134, 0.18);
}

.portal-sidebar {
  position: relative;
  z-index: 220;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 0;
  background: rgba(247, 251, 255, 0.94);
  border-right: 1px solid var(--color-selected-strong);
  box-shadow:
    inset -1px 0 0 rgba(255, 255, 255, 0.72),
    10px 0 32px rgba(7, 30, 67, 0.06);
  backdrop-filter: blur(18px) saturate(1.18);
  -webkit-backdrop-filter: blur(18px) saturate(1.18);
}

.portal-sidebar.is-bootstrap-hidden {
  visibility: hidden;
  pointer-events: none;
}

.portal-sidebar-top,
.portal-nav {
  display: grid;
  justify-items: center;
  gap: 16px;
}

.portal-utility-menu {
  position: relative;
  width: 100%;
  display: grid;
  justify-items: center;
}

.portal-utility-toggle[aria-expanded="true"] {
  background: var(--color-selected);
  color: var(--navy);
  box-shadow: none;
}

.portal-utility-strip {
  position: absolute;
  left: calc(100% + 12px);
  bottom: 0;
  z-index: 260;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 12px;
  border: 1px solid var(--color-selected-strong);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow:
    0 18px 46px rgba(7, 30, 67, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(18px) saturate(1.16);
  -webkit-backdrop-filter: blur(18px) saturate(1.16);
  transform-origin: left center;
  animation: portal-utility-reveal 180ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.portal-utility-strip::before {
  content: "";
  position: absolute;
  left: -7px;
  bottom: 21px;
  width: 12px;
  height: 12px;
  border-left: 1px solid var(--color-selected-strong);
  border-bottom: 1px solid var(--color-selected-strong);
  background: rgba(255, 255, 255, 0.96);
  transform: rotate(45deg);
}

@keyframes portal-utility-reveal {
  from {
    opacity: 0;
    transform: translateX(-8px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .portal-utility-strip {
    animation: none;
  }
}

.portal-user-menu {
  position: relative;
  width: 100%;
  display: grid;
}

.portal-user-menu > .portal-nav-item {
  width: 100%;
  border-radius: 0;
}

.portal-utility-strip .portal-utility-item {
  width: 54px;
  min-height: 54px;
  border: 1px solid var(--color-selected-strong);
  border-radius: 14px;
  background: rgba(242, 247, 252, 0.96);
  box-shadow:
    0 5px 12px rgba(7, 30, 67, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.portal-utility-strip .portal-utility-item:hover,
.portal-utility-strip .portal-utility-item:focus-visible {
  background: var(--color-surface);
  border-color: rgba(7, 53, 110, 0.26);
  box-shadow:
    0 8px 18px rgba(7, 30, 67, 0.14),
    inset 0 1px 0 #ffffff;
}

.portal-utility-strip .portal-utility-item[aria-expanded="true"],
.portal-utility-strip .portal-theme-toggle[aria-pressed="true"] {
  background: var(--color-selected);
  border-color: var(--color-accent-border);
  color: var(--navy);
  box-shadow: inset 0 0 0 1px var(--color-accent-soft);
}

.portal-utility-strip .portal-utility-item:focus-visible {
  outline: 3px solid rgba(7, 53, 110, 0.15);
  outline-offset: 2px;
}

.portal-utility-strip .portal-utility-item svg {
  width: 24px;
  height: 24px;
}

.portal-utility-item .portal-user-online-dot {
  top: 8px;
  right: 8px;
  width: 9px;
  height: 9px;
}

.portal-user-dropdown {
  position: absolute;
  left: 0;
  top: 0;
  width: 280px;
  padding: 14px;
  border-radius: 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  box-shadow: 0 18px 46px rgba(9, 18, 32, 0.2);
  z-index: 260;
}

.portal-user-dropdown-identity {
  color: var(--color-text-primary);
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-border);
}

.portal-user-dropdown-name {
  font-size: 17px;
  font-weight: 850;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.portal-user-dropdown-category {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 750;
}

.portal-user-shift {
  display: grid;
  gap: 10px;
}

.portal-user-shift-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}

.portal-user-logout {
  width: 100%;
  margin-top: 12px;
  border: 0;
  border-radius: 10px;
  padding: 12px 14px;
  background: #d04949;
  color: var(--color-text-inverse);
  font-size: 15px;
  font-weight: 850;
  cursor: pointer;
}

.portal-user-logout:hover {
  background: #bc3535;
}

.portal-sidebar-top {
  gap: 30px;
}

.portal-logo {
  width: auto;
  height: auto;
  display: grid;
  place-items: center;
}

.portal-logo img {
  width: auto;
  height: 28px;
  max-width: 100%;
  object-fit: contain;
}

.portal-nav-item {
  position: relative;
  width: 56px;
  min-height: 56px;
  padding: 0;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 0;
  border: none;
  border-radius: 16px;
  background: transparent;
  color: var(--color-text-primary);
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.portal-user-online-dot {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #1fca67;
  box-shadow: 0 0 0 2px rgba(247, 251, 255, 0.94);
}

.portal-user-online-dot.is-break {
  background: #f3b54a;
}

.portal-nav.is-loading .portal-nav-item {
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
}

.portal-nav-item.is-revealed {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 240ms ease,
    transform 260ms ease,
    background 0.18s ease,
    color 0.18s ease;
  transition-delay: calc(var(--nav-index, 0) * 55ms);
}

.portal-nav-item:hover {
  transform: translateY(-1px);
  background: var(--color-accent-soft);
  color: var(--color-text-primary);
}

.portal-nav-item.is-active {
  background: var(--color-selected);
  color: var(--color-text-primary);
  box-shadow: none;
}

.portal-nav-item svg {
  width: 26px;
  height: 26px;
  stroke-width: 1.65px;
  stroke-linecap: round;
  stroke-linejoin: round;
  shape-rendering: geometricPrecision;
  vector-effect: non-scaling-stroke;
}

.portal-nav-item-secondary {
  width: 56px;
  min-height: 56px;
  padding: 0;
  place-items: center;
  gap: 0;
}

.portal-nav-item[data-sign-out] {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.portal-nav-item[data-sign-out]::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(208, 48, 55, 0.9), rgba(180, 31, 39, 0.9));
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.28s ease;
  z-index: 0;
}

.portal-nav-item[data-sign-out] > * {
  position: relative;
  z-index: 1;
}

.portal-nav-item[data-sign-out]:hover::before,
.portal-nav-item[data-sign-out]:focus-visible::before {
  transform: scaleX(1);
}

.portal-nav-item[data-sign-out]:hover,
.portal-nav-item[data-sign-out]:focus-visible {
  color: var(--color-text-inverse);
}

.scale-popover {
  position: fixed;
  left: 0;
  right: auto;
  top: 0;
  bottom: auto;
  z-index: 2;
  width: 232px;
  border-radius: 12px;
  border: 1px solid var(--color-accent-border);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 36px rgba(7, 30, 67, 0.22);
  padding: 12px;
  transform: scale(1);
  transform-origin: top left;
  pointer-events: auto;
}

.scale-floating-dock {
  position: fixed;
  inset: 0;
  z-index: 360;
  pointer-events: none;
}

.scale-popover-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.scale-slider {
  width: 100%;
  margin: 0;
  accent-color: var(--navy);
}

.scale-popover-range {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 11px;
  color: var(--ink-soft);
}

[data-knowledge-base-root],
[data-action-tools-root] {
  position: fixed;
  inset: 0;
  z-index: 300;
  pointer-events: none;
}

.kb-floating-shell {
  position: fixed;
  inset: 0;
  z-index: 300;
  pointer-events: none;
}

.kb-floating-shell.at-editor-backdrop {
  background: transparent;
}

.kb-floating-shell.kb-drawer-backdrop {
  background: transparent;
}

.kb-floating-shell.at-editor-backdrop,
.kb-floating-shell.kb-drawer-backdrop {
  clip-path: inset(0 0 0 var(--drawer-left, calc(88px * var(--ui-scale, 1))));
}

.kb-floating-shell.at-editor-backdrop::before {
  content: "";
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: var(--drawer-left, calc(88px * var(--ui-scale, 1)));
  pointer-events: none;
  background: rgba(7, 18, 34, 0.5);
}

.kb-floating-shell.kb-drawer-backdrop::before {
  content: "";
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: var(--drawer-left, calc(88px * var(--ui-scale, 1)));
  pointer-events: none;
  background: rgba(7, 18, 34, 0.5);
}

.kb-floating-shell.at-editor-backdrop.is-drawer-entering::before,
.kb-floating-shell.kb-drawer-backdrop.is-drawer-entering::before {
  animation: drawerBackdropFadeIn 180ms ease-out both;
}

.kb-floating-shell.at-editor-backdrop.is-drawer-exiting::before,
.kb-floating-shell.kb-drawer-backdrop.is-drawer-exiting::before {
  animation: drawerBackdropFadeOut 160ms ease-in both;
}

@keyframes drawerBackdropFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes drawerBackdropFadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@media (max-width: 720px) {
  .kb-floating-shell.at-editor-backdrop::before,
  .kb-floating-shell.kb-drawer-backdrop::before {
    left: 0;
  }
}

/* Account settings is a workspace-picker page, not an overlay. */
.login-account-settings-view {
  width: min(100%, 470px);
  height: 100%;
  max-height: 100dvh;
  overflow: hidden;
}

.login-account-settings-view .account-settings-heading {
  margin-bottom: 12px;
}

.login-account-settings-view .account-settings-body {
  min-height: 0;
  flex: 1 1 auto;
  padding-right: 10px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: color-mix(in srgb, var(--color-text-muted) 45%, transparent) transparent;
  scrollbar-width: thin;
}

.login-view.is-workspace-mode {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.login-view.is-workspace-mode .login-card {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.login-view.is-workspace-mode .login-panel {
  height: calc(100dvh - (var(--login-shell-gap) * 2));
}

.login-account-settings-view .account-settings-body::-webkit-scrollbar {
  width: 5px;
}

.login-account-settings-view .account-settings-body::-webkit-scrollbar-track {
  background: transparent;
}

.login-account-settings-view .account-settings-body::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-text-muted) 45%, transparent);
}

.login-account-settings-view .account-settings-section {
  display: block;
  padding: 24px 0 26px;
  border-bottom: 1px solid var(--color-border-subtle);
}

.login-account-settings-view .account-settings-section:first-child {
  padding-top: 18px;
}

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

.login-account-settings-view .account-settings-section-copy {
  margin-bottom: 17px;
}

.login-account-settings-view .account-settings-section-copy h2 {
  margin: 0 0 5px;
  color: var(--color-text-primary);
  font-size: 15px;
  font-weight: 760;
  letter-spacing: -.02em;
}

.login-account-settings-view .account-settings-section-copy p {
  max-width: 420px;
  font-size: 12px;
  line-height: 1.55;
}

.login-account-settings-view .account-settings-fields {
  gap: 13px;
}

.login-account-settings-view .account-settings-field input {
  height: 42px;
  border-radius: 8px;
}

.login-account-settings-view .account-settings-actions {
  min-height: 38px;
  gap: 12px;
}

.login-account-settings-view .account-settings-button {
  min-height: 38px;
  color: var(--color-on-accent);
}

.login-account-settings-view .account-settings-button-secondary {
  color: var(--color-text-primary);
}

.login-account-settings-view .account-email-confirmation {
  grid-template-columns: auto minmax(0, 1fr);
  align-content: start;
  padding: 24px 0;
}

.login-account-settings-view .account-email-confirmation h2 {
  font-size: 20px;
}

.login-account-settings-view .account-email-confirmation-actions {
  width: 100%;
}

@media (max-width: 680px) {
  .login-account-settings-view {
    width: 100%;
  }

  .login-account-settings-view .account-settings-body {
    padding-right: 3px;
  }

  .login-account-settings-view .account-settings-section {
    padding-right: 0;
    padding-left: 0;
  }

  .login-account-settings-view .account-settings-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .login-account-settings-view .account-settings-button {
    width: 100%;
  }

  .login-account-settings-view .account-email-confirmation {
    grid-template-columns: 1fr;
  }

  .login-account-settings-view .account-email-confirmation-actions {
    grid-column: 1;
    flex-direction: column-reverse;
  }
}

.kb-dialog {
  position: fixed;
  left: var(--kb-left, 82px);
  top: var(--kb-top, 120px);
  width: var(--kb-width, min(860px, calc(100vw - 112px)));
  height: var(--kb-height, calc(100dvh - 32px));
  max-height: calc(100dvh - var(--kb-top, 0px));
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  overflow: hidden;
  border-radius: 18px;
  background: var(--color-surface-soft);
  border: 1px solid var(--color-accent-border);
  box-shadow: 0 24px 70px rgba(8, 22, 48, 0.22);
  pointer-events: auto;
}

.kb-dialog::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 34px;
  width: 18px;
  height: 18px;
  transform: rotate(45deg);
  background: var(--color-surface-soft);
  border-left: 1px solid var(--color-accent-border);
  border-bottom: 1px solid var(--color-accent-border);
}

.kb-drawer-dialog.kb-dialog {
  top: 0;
  height: 100dvh;
  max-height: 100dvh;
  border-radius: 0;
  border-top: 0;
  border-bottom: 0;
  box-shadow: 18px 0 46px rgba(8, 22, 48, 0.16);
  contain: layout paint;
}

.kb-drawer-dialog.kb-dialog::before {
  content: none;
}

.kb-head,
.kb-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
}

.kb-head {
  border-bottom: 1px solid var(--color-accent-soft);
}

.kb-head h2 {
  margin: 2px 0 0;
  color: var(--color-text-primary);
  font-size: 26px;
  line-height: 1.1;
  font-weight: 900;
}

.kb-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kb-action-button,
.kb-icon-button {
  border: 0;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.kb-action-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  padding: 0 14px;
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-size: 14px;
  font-weight: 850;
}

.kb-action-button-secondary {
  background: #e8f0fa;
  color: #153b68;
}

.kb-action-button:hover,
.kb-icon-button:hover {
  transform: translateY(-1px);
}

.kb-action-button:disabled,
.kb-icon-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.kb-action-button svg {
  width: 17px;
  height: 17px;
}

.kb-icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--color-accent-soft);
  color: #173a63;
}

.kb-icon-button svg {
  width: 18px;
  height: 18px;
}

.kb-icon-button-danger {
  background: rgba(208, 73, 73, 0.1);
  color: #b73838;
}

.kb-toolbar {
  padding-top: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--color-accent-soft);
}

.kb-search {
  min-width: 0;
  flex: 1;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 12px;
  padding: 0 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-selected-strong);
  color: #5a6f8a;
}

.kb-search svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.kb-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #13243d;
  font: inherit;
  font-weight: 750;
}

.kb-error {
  margin: 0 20px 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(208, 73, 73, 0.1);
  color: #9c2f2f;
  font-size: 13px;
  font-weight: 800;
}

.kb-body {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}

.kb-body.has-editor {
  grid-template-rows: minmax(0, 1fr);
}

.kb-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 0;
  padding: 0;
  background: var(--color-surface);
}

.kb-card {
  position: relative;
  display: grid;
  gap: 12px;
  width: 100%;
  padding: 20px 20px 18px 24px;
  border-radius: 0;
  background: var(--color-surface);
  border: 0;
  border-bottom: 1px solid rgba(15, 35, 62, 0.12);
  box-shadow: none;
  transition: background-color 0.18s ease;
}

.kb-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 3px;
  border-radius: 0 999px 999px 0;
  background: rgba(47, 111, 175, 0.32);
}

.kb-card:hover,
.kb-card:focus-within {
  background: #fbfdff;
}

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

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

.kb-card h3 {
  margin: 0;
  color: var(--color-text-primary);
  font-size: 17px;
  line-height: 1.25;
  font-weight: 900;
}

.kb-card p {
  margin: 0;
  color: #30455f;
  font-size: 14px;
  line-height: 1.58;
  overflow-wrap: anywhere;
}

.kb-card time {
  color: #7b8ba1;
  font-size: 12px;
  font-weight: 800;
}

.kb-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.kb-card-actions .kb-icon-button {
  width: 34px;
  height: 34px;
}

.kb-editor {
  min-height: 0;
  height: 100%;
  overflow: auto;
  display: grid;
  grid-template-rows: auto auto minmax(220px, 1fr) auto auto;
  align-content: stretch;
  gap: 14px;
  padding: 18px 20px;
  background: transparent;
}

.kb-editor-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.kb-editor-head span {
  color: #61738b;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.kb-editor-head strong {
  display: block;
  margin-top: 2px;
  color: var(--color-text-primary);
  font-size: 18px;
  line-height: 1.25;
  font-weight: 900;
}

.kb-field {
  display: grid;
  gap: 7px;
  color: #263d5c;
  font-size: 13px;
  font-weight: 850;
}

.kb-field input,
.kb-field textarea,
.kb-field select {
  width: 100%;
  border: 1px solid var(--color-accent-border);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--color-text-primary);
  padding: 11px 12px;
  font: inherit;
  font-weight: 650;
  outline: 0;
}

.kb-field textarea {
  resize: vertical;
  min-height: 180px;
  line-height: 1.5;
}

.kb-field input:focus,
.kb-field textarea:focus,
.kb-field select:focus {
  border-color: rgba(15, 63, 134, 0.5);
  box-shadow: 0 0 0 3px rgba(15, 63, 134, 0.1);
}

.kb-editor-actions {
  display: flex;
  justify-content: end;
  gap: 10px;
}

.kb-editor-actions .modal-button-secondary {
  background: #dfeaf5;
  color: #173a63;
  border: 1px solid rgba(15, 63, 134, 0.18);
}

.kb-editor-actions .modal-button-secondary:hover {
  background: #d1dfed;
}

.kb-editor-actions .modal-button-primary {
  min-width: 124px;
  padding-inline: 16px;
  font-size: 14px;
  white-space: nowrap;
  background: var(--color-accent);
  filter: none;
}

.kb-editor-actions .modal-button-primary:hover {
  background: #0c3470;
  filter: none;
}

.kb-editor .kb-field textarea {
  min-height: 100%;
}

.kb-confirm {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(248, 251, 255, 0.72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.kb-confirm-panel {
  width: min(420px, calc(100% - 32px));
  display: grid;
  gap: 18px;
  padding: 20px;
  border-radius: 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-selected-strong);
  box-shadow: 0 22px 58px rgba(8, 22, 48, 0.2);
}

.kb-confirm-panel span {
  display: block;
  color: #b73838;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.kb-confirm-panel strong {
  display: block;
  margin-top: 4px;
  color: var(--color-text-primary);
  font-size: 18px;
  line-height: 1.25;
  font-weight: 900;
}

.kb-confirm-panel p {
  margin: 8px 0 0;
  color: #50667f;
  font-size: 14px;
  line-height: 1.45;
}

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

.kb-empty {
  min-height: 300px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: #50667f;
  text-align: center;
}

.kb-empty svg {
  width: 34px;
  height: 34px;
  color: var(--color-accent);
}

.kb-empty strong {
  color: #122640;
  font-size: 17px;
  font-weight: 900;
}

.kb-empty p {
  max-width: 360px;
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
}

.kb-empty .kb-action-button {
  margin-top: 8px;
  width: auto;
  min-width: 88px;
  min-height: 36px;
  padding: 0 14px;
  justify-self: center;
}

.kb-empty-action span[aria-hidden="true"] {
  font-size: 18px;
  line-height: 1;
  font-weight: 900;
}

.at-empty {
  background: transparent;
}

.at-empty > svg,
.at-empty > i svg {
  color: #4f657d;
}

.at-empty .kb-empty-action {
  gap: 8px;
  background: var(--color-accent);
  color: var(--color-text-inverse);
}

.at-empty .kb-empty-action svg,
.at-empty .kb-empty-action i svg {
  width: 17px;
  height: 17px;
  color: currentColor;
  stroke-width: 2.4;
}

.at-dialog .kb-body {
  background: var(--color-surface-soft);
}

.at-dialog {
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
}

.at-dialog.kb-dialog {
  top: 0;
  height: 100dvh;
  max-height: 100dvh;
  border-radius: 0;
  border-top: 0;
  border-bottom: 0;
  box-shadow: 18px 0 46px rgba(8, 22, 48, 0.16);
  contain: layout paint;
}

.at-dialog.kb-dialog::before {
  content: none;
}

.at-dialog.is-drawer-entering,
.kb-drawer-dialog.is-drawer-entering {
  backface-visibility: hidden;
  transform: translate3d(-100%, 0, 0);
  will-change: transform;
  animation: atDrawerSlideIn 180ms cubic-bezier(0.2, 0.86, 0.22, 1) both;
}

.at-dialog.is-drawer-exiting,
.kb-drawer-dialog.is-drawer-exiting {
  backface-visibility: hidden;
  will-change: transform, opacity;
  animation: atDrawerSlideOut 160ms cubic-bezier(0.4, 0, 0.7, 0.2) both;
}

@keyframes atDrawerSlideIn {
  from {
    transform: translate3d(-100%, 0, 0);
  }
  to {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes atDrawerSlideOut {
  from {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
  to {
    opacity: 0;
    transform: translate3d(-100%, 0, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .kb-floating-shell.at-editor-backdrop.is-drawer-entering::before,
  .kb-floating-shell.at-editor-backdrop.is-drawer-exiting::before,
  .kb-floating-shell.kb-drawer-backdrop.is-drawer-entering::before,
  .kb-floating-shell.kb-drawer-backdrop.is-drawer-exiting::before,
  .at-dialog.is-drawer-entering,
  .at-dialog.is-drawer-exiting,
  .kb-drawer-dialog.is-drawer-entering,
  .kb-drawer-dialog.is-drawer-exiting {
    animation: none;
  }
}

.at-tabs {
  display: flex;
  align-items: flex-end;
  gap: 22px;
  padding: 0 20px;
  background: var(--color-surface-soft);
  border-bottom: 1px solid var(--color-accent-soft);
}

.at-tab {
  position: relative;
  min-height: 44px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #60758d;
  padding: 0 0 10px;
  font: inherit;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
}

.at-tab::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: 999px;
  background: transparent;
}

.at-tab.is-active {
  color: var(--color-text-primary);
}

.at-tab.is-active::after {
  background: var(--color-accent);
}

.at-toolbar-title {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.at-toolbar-title strong {
  color: var(--color-text-primary);
  font-size: 14px;
  font-weight: 900;
}

.at-toolbar-title span {
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 750;
}

.at-list {
  gap: 14px;
}

.at-card .kb-card-head {
  align-items: center;
}

.at-card-title {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.at-card-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #e8f0fa;
  color: var(--color-accent);
}

.at-card-icon svg {
  width: 20px;
  height: 20px;
}

.at-card-title p {
  margin-top: 4px;
  color: #526981;
}

.at-card-delete-confirm {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  background: rgba(208, 73, 73, 0.06);
  border-color: rgba(208, 73, 73, 0.18);
}

.at-card-delete-confirm strong {
  display: block;
  color: #8d2525;
  font-size: 15px;
  font-weight: 900;
}

.at-card-delete-confirm p {
  margin: 4px 0 0;
  color: #7a4d4d;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 750;
}

.at-card-delete-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.at-status,
.at-run-status {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 0 10px;
  background: #edf3f9;
  color: #45627f;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.at-status span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
}

.at-status.is-enabled,
.at-run-status.is-success,
.at-success-text {
  color: #16714f;
}

.at-status.is-disabled,
.at-run-status.is-failed,
.at-error-text {
  color: #b73838;
}

.at-editor,
.at-runner,
.at-result {
  grid-template-rows: none;
  align-content: start;
}

.at-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-accent-soft);
}

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

.at-section-head strong {
  display: block;
  color: #11243d;
  font-size: 15px;
  font-weight: 900;
}

.at-section-head > div > span,
.at-muted {
  color: var(--color-text-secondary);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 750;
}

.at-section-head .kb-action-button-secondary,
.at-section-head .kb-action-button-secondary span,
.at-section-head .kb-action-button-secondary svg {
  color: #173a63;
}

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

.at-row-grid-fields {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.at-details-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.at-name-field {
  min-width: 0;
}

.at-method-field {
  justify-self: end;
}

.at-wide-field {
  grid-column: span 2;
}

.at-variable-pills {
  min-height: 34px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.at-variable-pill {
  border: 1px solid rgba(15, 63, 134, 0.18);
  border-radius: 999px;
  background: #eef5fd;
  color: #153b68;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 900;
  cursor: copy;
}

.at-variable-pill small {
  color: var(--color-text-secondary);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.at-method-switch {
  width: max-content;
  min-height: 43px;
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(68px, 1fr));
  gap: 3px;
  padding: 3px;
  border-radius: 12px;
  background: #e8f0fa;
  border: 1px solid var(--color-selected);
}

.at-method-option {
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #50667f;
  padding: 0 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.at-method-option.is-active {
  background: var(--color-surface);
  color: var(--color-accent);
  box-shadow: 0 3px 10px rgba(7, 30, 67, 0.08);
}

.at-method-option:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.at-permission-mode {
  width: max-content;
  max-width: 100%;
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(130px, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: #e8f0fa;
  border: 1px solid var(--color-selected);
}

.at-permission-option {
  min-height: 36px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #50667f;
  padding: 0 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.at-permission-option.is-active {
  background: var(--color-surface);
  color: var(--color-accent);
  box-shadow: 0 3px 10px rgba(7, 30, 67, 0.08);
}

.at-category-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.at-category-chip {
  min-height: 34px;
  border: 1px solid var(--color-selected-strong);
  border-radius: 999px;
  background: var(--color-surface);
  color: #263d5c;
  padding: 0 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.at-category-chip.is-selected {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-text-inverse);
}

.at-permission-option:disabled,
.at-category-chip:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

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

.at-variable-editor {
  display: grid;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--color-accent-soft);
}

.at-variable-list {
  gap: 12px;
}

.at-variable-card {
  display: grid;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--color-surface-soft);
  border: 1px solid var(--color-accent-soft);
}

.at-variable-card-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.at-variable-collapse {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: var(--color-accent-soft);
  color: #173a63;
  cursor: pointer;
}

.at-variable-collapse svg {
  width: 17px;
  height: 17px;
}

.at-variable-summary {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.at-variable-summary strong {
  color: var(--color-text-primary);
  font-size: 14px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.at-variable-summary span {
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.at-variable-edit {
  display: grid;
  gap: 12px;
}

.at-variable-primary-row {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(260px, 0.75fr);
}

.at-type-required-cell {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  align-items: start;
  gap: 12px;
}

.at-required-field {
  min-width: 96px;
}

.at-required-switch-wrap {
  min-height: 43px;
  display: flex;
  align-items: center;
}

.at-variable-link-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}

.at-switch-field {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #263d5c;
  font-size: 13px;
  font-weight: 900;
}

.at-switch-field input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.at-switch-field span {
  width: 38px;
  height: 22px;
  position: relative;
  border-radius: 999px;
  background: #d7e3ef;
  border: 1px solid var(--color-selected);
}

.at-switch-field span::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 2px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--color-surface);
  box-shadow: 0 2px 5px rgba(7, 30, 67, 0.15);
  transition: transform 0.18s ease;
}

.at-switch-field input:checked + span {
  background: var(--color-accent);
}

.at-switch-field input:checked + span::after {
  transform: translateX(16px);
}

.at-required-toggle {
  width: 62px;
  height: 36px;
  position: relative;
  border: 1px solid var(--color-selected);
  border-radius: 999px;
  background: #d7e3ef;
  padding: 0;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.at-required-toggle > span {
  position: absolute;
  left: 3px;
  top: 3px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--color-surface);
  box-shadow: 0 2px 5px rgba(7, 30, 67, 0.15);
  transition: transform 0.18s ease;
}

.at-required-toggle.is-on {
  background: var(--color-accent);
  border-color: rgba(15, 63, 134, 0.25);
}

.at-required-toggle.is-on > span {
  transform: translateX(26px);
}

.at-required-toggle:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.at-linked-value-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}

.at-hidden-field {
  min-width: 92px;
}

.at-linked-value-field {
  min-width: 0;
}

.at-config-row {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  background: var(--color-surface-soft);
  border: 1px solid var(--color-accent-soft);
}

.at-config-row-simple {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto;
  align-items: end;
}

.at-mapping-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) auto auto auto;
}

.at-mapping-order {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.at-mapping-order .kb-icon-button {
  width: 36px;
  height: 36px;
}

.at-row-remove {
  position: absolute;
  right: 12px;
  top: 12px;
}

.at-check-field {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #263d5c;
  font-size: 13px;
  font-weight: 850;
}

.at-check-field input {
  width: 16px;
  height: 16px;
  accent-color: var(--color-accent);
}

.at-json-editor textarea {
  min-height: 210px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.55;
}

.at-response-test-panel {
  display: grid;
  gap: 14px;
  padding: 14px;
  border-radius: 14px;
  background: var(--color-surface-soft);
  border: 1px solid var(--color-accent-soft);
}

.at-response-test-head,
.at-response-path-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.at-response-test-head > div,
.at-response-path-list-head {
  min-width: 0;
}

.at-response-test-head strong,
.at-response-path-list-head strong {
  display: block;
  color: var(--color-text-primary);
  font-size: 14px;
  font-weight: 900;
}

.at-response-test-head > div span,
.at-response-path-list-head span {
  display: block;
  margin-top: 2px;
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 800;
}

.at-response-test-head .kb-action-button span,
.at-response-path-row .kb-action-button span {
  display: inline;
  margin-top: 0;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.at-response-test-head .kb-action-button svg,
.at-response-path-row .kb-action-button svg {
  color: currentColor;
}

.at-response-test-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.at-response-test-field {
  min-width: 0;
}

.at-response-path-list {
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--color-accent-soft);
}

.at-response-path-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 11px;
  background: var(--color-surface);
  border: 1px solid var(--color-accent-soft);
}

.at-response-path-row strong {
  display: block;
  color: var(--color-text-primary);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.at-response-path-row span {
  display: block;
  margin-top: 3px;
  color: var(--color-text-secondary);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.at-mapping-list {
  margin-top: 2px;
}

.at-run-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 0 4px;
  background: transparent;
  border: 0;
}

.at-run-summary > svg,
.at-run-summary > i svg {
  width: 22px;
  height: 22px;
  color: var(--color-accent);
  flex: 0 0 auto;
}

.at-run-summary p {
  margin: 0;
  color: #243a59;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.at-run-fields {
  display: grid;
  gap: 12px;
}

.at-contact-picker {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  background: var(--color-surface-soft);
  border: 1px solid var(--color-accent-soft);
}

.at-selected-contact,
.at-contact-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--color-accent-soft);
  border-radius: 12px;
  background: var(--color-surface);
  color: #122640;
  padding: 10px 12px;
  text-align: left;
}

.at-contact-option {
  grid-template-columns: auto minmax(0, 1fr);
  cursor: pointer;
}

.at-contact-option:hover,
.at-contact-option.is-selected {
  border-color: rgba(15, 63, 134, 0.28);
  background: #eef5fd;
}

.at-contact-source-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(15, 35, 61, 0.06);
  color: #6a7d93;
  flex: 0 0 auto;
}

.at-contact-source-icon svg,
.at-contact-source-icon i svg {
  width: 17px;
  height: 17px;
  stroke-width: 2;
}

.at-contact-source-logo {
  width: 19px;
  height: 19px;
  object-fit: contain;
  filter: grayscale(1) saturate(0.2);
  opacity: 0.76;
}

.at-selected-contact strong,
.at-contact-option strong {
  display: block;
  color: #122640;
  font-size: 14px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.at-selected-contact span:not(.at-contact-source-icon),
.at-contact-option small {
  display: block;
  margin-top: 2px;
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.at-contact-results {
  display: grid;
  gap: 8px;
}

.at-contact-skeleton {
  height: 56px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(15, 63, 134, 0.06), rgba(15, 63, 134, 0.11), rgba(15, 63, 134, 0.06));
  background-size: 220% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
  0% { background-position: 120% 0; }
  100% { background-position: -120% 0; }
}

.kb-field input:disabled,
.kb-field select:disabled,
.kb-field textarea:disabled {
  cursor: not-allowed;
  opacity: 0.78;
}

.at-run-field small {
  color: #7a8ca3;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.at-history {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-accent-soft);
}

.at-history-list {
  gap: 12px;
}

.at-history-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-accent-soft);
  box-shadow: 0 8px 24px rgba(7, 30, 67, 0.05);
}

.at-history-row,
.at-mapped-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--color-accent-soft);
}

.at-history-error {
  margin: 0;
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(208, 73, 73, 0.1);
  color: #9c2f2f;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 800;
}

.at-history-mapped {
  display: grid;
  gap: 2px;
  border-top: 1px solid var(--color-accent-soft);
  padding-top: 8px;
}

.at-history-row:first-of-type,
.at-mapped-row:first-of-type {
  border-top: 0;
}

.at-history-row strong,
.at-mapped-row strong {
  color: #13243d;
  font-size: 13px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.at-history-row span,
.at-mapped-row span {
  color: #71849a;
  font-size: 12px;
  font-weight: 750;
}

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

.at-result-panel > div {
  display: grid;
  gap: 3px;
  padding: 14px;
  border-radius: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-accent-soft);
}

.at-result-panel span {
  color: #708298;
  font-size: 12px;
  font-weight: 850;
}

.at-result-panel strong {
  color: #11243d;
  font-size: 18px;
  font-weight: 900;
}

.at-mapped-results {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-radius: 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-accent-soft);
}

@media (min-width: 681px) and (max-width: 980px) {
  .kb-dialog {
    left: 16px;
    top: 16px;
    width: calc(100vw - 32px);
    height: calc(100dvh - 32px);
  }

  .kb-dialog::before {
    display: none;
  }

  .kb-head,
  .kb-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .kb-head-actions {
    justify-content: space-between;
  }

  .at-dialog.kb-dialog {
    left: var(--kb-left, 0px);
    top: 0;
    width: var(--kb-width, 100vw);
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .kb-drawer-dialog.kb-dialog {
    left: var(--kb-left, 0px);
    top: 0;
    width: var(--kb-width, 100vw);
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .at-card .kb-card-head,
  .at-card-delete-confirm,
  .at-config-row-simple,
  .at-mapping-row,
  .at-history-row,
  .at-mapped-row,
  .at-response-path-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .at-row-grid,
  .at-row-grid-fields,
  .at-variable-primary-row,
  .at-result-panel {
    grid-template-columns: minmax(0, 1fr);
  }

  .at-variable-link-row {
    align-items: stretch;
    flex-direction: column;
  }

  .at-response-test-head,
  .at-response-path-list-head {
    align-items: stretch;
    flex-direction: column;
  }

  .at-response-test-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .at-linked-value-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .at-wide-field {
    grid-column: auto;
  }

  .at-card .kb-card-actions {
    flex-wrap: wrap;
    justify-content: start;
  }

  .at-card-delete-actions {
    justify-content: start;
    flex-wrap: wrap;
  }

}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
}

.confirm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 14, 30, 0.55);
  backdrop-filter: blur(4px);
}

.confirm-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(92vw, 420px);
  padding: 22px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: linear-gradient(180deg, rgba(16, 36, 69, 0.98), rgba(10, 25, 50, 0.98));
  color: var(--color-text-inverse);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.35);
}

.confirm-modal-dialog h3 {
  margin: 0;
  font-size: 22px;
}

.confirm-modal-dialog p {
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.76);
  line-height: 1.6;
}

.confirm-modal-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-button {
  min-width: 96px;
  height: 40px;
  border-radius: 12px;
  border: none;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.modal-button-secondary {
  background: rgba(255, 255, 255, 0.12);
  color: var(--color-text-inverse);
}

.modal-button-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.modal-button-primary {
  background: linear-gradient(135deg, var(--navy), var(--color-accent-hover));
  color: var(--color-on-accent);
}

.modal-button-primary:hover {
  filter: brightness(1.08);
}

.modal-button-danger {
  background: linear-gradient(135deg, #bf2f35, #9f1e25);
  color: var(--color-text-inverse);
}

.modal-button-danger:hover {
  filter: brightness(1.08);
}

.agents-confirm-modal {
  z-index: 320;
}

.agents-confirm-modal .confirm-modal-backdrop {
  background: rgba(20, 28, 40, 0.34);
  backdrop-filter: blur(4px);
}

.agents-confirm-modal .confirm-modal-dialog {
  width: min(94vw, 560px);
  padding: 30px;
  border-radius: 20px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--ink);
  box-shadow: 0 26px 56px rgba(7, 30, 67, 0.2);
}

.agents-confirm-modal .confirm-modal-dialog h3 {
  font-size: 28px;
  line-height: 1.2;
  color: var(--ink);
}

.agents-confirm-modal .confirm-modal-dialog p {
  margin-top: 14px;
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.agents-confirm-modal .confirm-modal-actions {
  margin-top: 24px;
}

.agents-confirm-modal .modal-button {
  min-width: 122px;
  height: 46px;
  font-size: 14px;
  padding: 0 18px;
  white-space: nowrap;
}

.agents-confirm-modal .modal-button-secondary {
  background: var(--color-selected);
  color: var(--ink);
}

.agents-confirm-modal .modal-button-secondary:hover {
  background: var(--color-border-strong);
}

.agents-resolve-modal {
  position: fixed;
  inset: 0;
  z-index: 340;
  display: grid;
  place-items: center;
  padding: calc(5dvh / var(--ui-scale)) 24px;
}

.agents-resolve-modal.hidden {
  display: none;
}

.agents-resolve-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 12%, rgba(15, 63, 134, 0.16), transparent 34%),
    rgba(15, 23, 42, 0.36);
  backdrop-filter: blur(5px);
}

.agents-resolve-dialog {
  position: relative;
  z-index: 1;
  width: min(720px, calc(100vw - 36px));
  height: calc(90dvh / var(--ui-scale));
  max-height: calc(90dvh / var(--ui-scale));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 24px;
  background: var(--color-surface);
  color: var(--ink);
  box-shadow:
    0 34px 80px rgba(7, 30, 67, 0.26),
    0 2px 0 rgba(255, 255, 255, 0.86) inset;
}

.agents-resolve-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 26px 18px;
  border-bottom: 1px solid var(--color-border-subtle);
  background:
    linear-gradient(135deg, rgba(15, 63, 134, 0.08), transparent 55%),
    #ffffff;
}

.agents-resolve-head span {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.agents-resolve-head h3 {
  margin: 6px 0 0;
  color: var(--ink);
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.agents-resolve-close {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--color-selected);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink-soft);
}

.agents-resolve-close:hover {
  background: rgba(15, 63, 134, 0.06);
  color: var(--navy);
}

.agents-resolve-content {
  display: grid;
  gap: 16px;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 20px 26px 24px;
}

.agents-resolve-list {
  display: grid;
  align-content: start;
  gap: 10px;
}

.agents-resolve-skip-option {
  height: 58px;
  min-height: 58px;
  display: inline-grid;
  place-items: center;
  border: 1.5px dashed rgba(15, 63, 134, 0.34);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(15, 63, 134, 0.035), rgba(15, 63, 134, 0.015));
  color: var(--navy);
  font-weight: 900;
  letter-spacing: -0.01em;
}

.agents-resolve-skip-option:hover:not(:disabled) {
  border-color: rgba(15, 63, 134, 0.58);
  background: rgba(15, 63, 134, 0.07);
}

.agents-resolve-skip-option:disabled {
  cursor: wait;
  opacity: 0.68;
}

.agents-resolve-pipeline {
  min-height: 0;
  border: 1px solid var(--color-selected);
  border-radius: 18px;
  background: var(--color-surface);
  overflow: hidden;
}

.agents-resolve-pipeline.is-expanded {
  border-color: color-mix(in srgb, var(--pipeline-color, var(--color-accent)) 28%, var(--color-selected));
  box-shadow: 0 14px 30px rgba(7, 30, 67, 0.08);
}

.agents-resolve-pipeline-button {
  width: 100%;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 12px 16px;
  border: 0;
  background: color-mix(in srgb, var(--pipeline-color, var(--color-accent)) 8%, white);
  color: var(--ink);
  text-align: left;
}

.agents-resolve-pipeline-button:disabled,
.agents-resolve-stage:disabled {
  cursor: wait;
  opacity: 0.7;
}

.agents-resolve-pipeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--pipeline-color, var(--color-accent));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--pipeline-color, var(--color-accent)) 14%, transparent);
}

.agents-resolve-pipeline-button strong,
.agents-resolve-pipeline-button small {
  display: block;
}

.agents-resolve-pipeline-button strong {
  font-size: 15px;
  font-weight: 900;
}

.agents-resolve-pipeline-button small {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.agents-resolve-stages {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  padding: 14px;
}

.agents-resolve-stage {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--stage-color, var(--color-accent)) 24%, var(--color-selected));
  border-radius: 13px;
  background: color-mix(in srgb, var(--stage-color, var(--color-accent)) 7%, white);
  color: var(--ink);
  text-align: left;
}

.agents-resolve-stage:hover {
  background: color-mix(in srgb, var(--stage-color, var(--color-accent)) 14%, white);
  border-color: color-mix(in srgb, var(--stage-color, var(--color-accent)) 42%, var(--color-selected));
}

.agents-resolve-stage span {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 999px;
  background: var(--stage-color, var(--color-accent));
}

.agents-resolve-stage strong {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agents-resolve-loading,
.agents-resolve-empty,
.agents-resolve-error {
  padding: 18px;
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.9);
  color: var(--ink-soft);
  font-weight: 700;
  text-align: center;
}

.agents-resolve-loading {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.agents-resolve-loading-tall {
  min-height: 260px;
  align-content: center;
}

.agents-resolve-loading p,
.agents-resolve-empty,
.agents-resolve-error {
  margin: 0;
}

.agents-resolve-error {
  border: 1px solid rgba(163, 32, 32, 0.16);
  background: rgba(163, 32, 32, 0.06);
  color: #9f1e25;
  text-align: left;
}

@media (min-width: 721px) {
  .portal-nav {
    --portal-nav-item-height: 82px;
    --portal-nav-highlight-height: 58px;
    --portal-nav-highlight-inset: 10px;
    --portal-nav-active-index: 0;
    position: relative;
    width: 100%;
    gap: 0;
    justify-items: stretch;
    padding: 0;
  }

  .portal-nav::before {
    content: "";
    position: absolute;
    z-index: 0;
    left: var(--portal-nav-highlight-inset);
    right: var(--portal-nav-highlight-inset);
    top: calc((var(--portal-nav-item-height) - var(--portal-nav-highlight-height)) / 2);
    height: var(--portal-nav-highlight-height);
    border: 1px solid rgba(15, 63, 134, 0.16);
    border-radius: 17px;
    background: rgba(255, 255, 255, 0.62);
    box-shadow: 0 1px 2px rgba(7, 30, 67, 0.035);
    box-sizing: border-box;
    opacity: 0;
    transform: translateY(calc(var(--portal-nav-active-index) * var(--portal-nav-item-height))) scaleY(0.88);
    transition:
      transform 220ms cubic-bezier(0.22, 0.72, 0.28, 1),
      opacity 140ms ease;
    pointer-events: none;
  }

  .portal-nav::after {
    content: none;
  }

  .portal-nav.has-active-indicator::before {
    opacity: 1;
    transform: translateY(calc(var(--portal-nav-active-index) * var(--portal-nav-item-height))) scaleY(1);
  }

  .portal-nav .portal-nav-item {
    min-height: var(--portal-nav-item-height);
    color: #243144;
  }

  .portal-nav .portal-nav-item::before {
    content: "";
    position: absolute;
    z-index: 0;
    left: 50%;
    top: 50%;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: var(--color-hover);
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.88);
    transition:
      opacity 150ms ease,
      transform 180ms ease;
    pointer-events: none;
  }

  .portal-nav .portal-nav-item:hover::before,
  .portal-nav .portal-nav-item:focus-visible::before {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }

  .portal-nav .portal-nav-item.is-active::before {
    opacity: 0;
  }

  .portal-nav .portal-nav-item svg {
    position: relative;
    z-index: 1;
    transition:
      transform 180ms ease,
      color 180ms ease,
      stroke-width 180ms ease;
  }

  .portal-nav-item {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 66px;
    border-radius: 0;
  }

  .portal-nav-item:hover {
    transform: none;
    background: var(--color-accent-soft);
  }

  .portal-nav .portal-nav-item:hover,
  .portal-nav .portal-nav-item:focus-visible {
    background: transparent;
    color: var(--color-accent);
  }

  .portal-nav-item[data-sign-out]:hover,
  .portal-nav-item[data-sign-out]:focus-visible {
    background: transparent;
  }

  .portal-nav-item.is-active {
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .portal-nav .portal-nav-item.is-active {
    color: var(--color-accent);
  }

  .portal-nav .portal-nav-item.is-active svg {
    transform: none;
    stroke-width: 1.8px;
  }

  .portal-nav-item.is-active:hover {
    background: transparent;
  }
}

html[data-pattern-intensity="1"] {
  --portal-pattern-intensity-percent: 20%;
  --portal-pattern-conversation-intensity-percent: 11%;
}

html[data-pattern-intensity="2"] {
  --portal-pattern-intensity-percent: 40%;
  --portal-pattern-conversation-intensity-percent: 22%;
}

html[data-pattern-intensity="3"] {
  --portal-pattern-intensity-percent: 60%;
  --portal-pattern-conversation-intensity-percent: 33%;
}

html[data-pattern-intensity="4"] {
  --portal-pattern-intensity-percent: 80%;
  --portal-pattern-conversation-intensity-percent: 44%;
}

html[data-pattern-intensity="5"] {
  --portal-pattern-intensity-percent: 100%;
  --portal-pattern-conversation-intensity-percent: 55%;
}

/* Pattern placement -------------------------------------------------------
   Pattern SVGs are used as masks, so every palette supplies the pattern
   color. Each region is independently enabled from the Appearance menu. */
:where(
  .login-view.is-workspace-mode,
  .portal-global-header,
  .agents-inbox-rail,
  .crm-sidebar,
  .tickets-sidebar-panel,
  .email-queue-rail,
  .email-list-head,
  .agents-messages-section,
  .portal-user-dropdown,
  .scale-popover,
  .kb-head,
  .kb-toolbar,
  .tasks-board
) {
  position: relative;
  isolation: isolate;
}

:where(
  .login-view.is-workspace-mode,
  .portal-global-header,
  .agents-inbox-rail,
  .crm-sidebar,
  .tickets-sidebar-panel,
  .email-queue-rail,
  .email-list-head,
  .agents-messages-section,
  .portal-user-dropdown,
  .scale-popover,
  .kb-head,
  .kb-toolbar,
  .tasks-board
) > * {
  position: relative;
  z-index: 1;
}

.portal-user-dropdown,
.scale-popover {
  overflow: hidden;
}

html:not([data-pattern="none"])[data-pattern-surface-workspace-background="on"] .login-view.is-workspace-mode::after,
html:not([data-pattern="none"])[data-pattern-surface-header="on"] .portal-global-header::after,
html:not([data-pattern="none"])[data-pattern-surface-section-nav="on"] :is(.agents-inbox-rail, .crm-sidebar, .tickets-sidebar-panel, .email-queue-rail, .email-list-head)::after,
html:not([data-pattern="none"])[data-pattern-surface-inbox-conversation="on"] .agents-page .agents-messages-section::after,
html:not([data-pattern="none"])[data-pattern-surface-user-menu="on"] .portal-user-dropdown::after,
html:not([data-pattern="none"])[data-pattern-surface-zoom-menu="on"] .scale-popover::after,
html:not([data-pattern="none"])[data-pattern-surface-knowledge-header="on"] .kb-dialog:not(.at-dialog) :is(.kb-head, .kb-toolbar)::after,
html:not([data-pattern="none"])[data-pattern-surface-action-tools-header="on"] .at-dialog .kb-head::after,
html:not([data-pattern="none"])[data-pattern-surface-task-columns="on"] .tasks-board::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: color-mix(
    in srgb,
    var(--color-pattern) var(--portal-pattern-intensity-percent),
    transparent
  );
  opacity: var(--portal-pattern-opacity);
  -webkit-mask-image: var(--portal-pattern-image);
  mask-image: var(--portal-pattern-image);
  -webkit-mask-position: 0 0;
  mask-position: 0 0;
  -webkit-mask-repeat: repeat;
  mask-repeat: repeat;
  -webkit-mask-size: var(--portal-pattern-native-size);
  mask-size: var(--portal-pattern-native-size);
}

/* The Emails navigation rail and its search/filter row form one visual
   surface. Offset the row by the rail width so the pattern does not restart
   at the column boundary. */
html:not([data-pattern="none"])[data-pattern-surface-section-nav="on"] .email-list-head::after {
  -webkit-mask-position: -320px 0;
  mask-position: -320px 0;
}

@media (max-width: 920px) {
  html:not([data-pattern="none"])[data-pattern-surface-section-nav="on"] .email-list-head::after {
    -webkit-mask-position: 0 0;
    mask-position: 0 0;
  }
}

/* Keep the Inbox pattern fixed to the conversation viewport instead of
   letting it scroll away with the message history. The solid header and
   composer remain above this plane; only the message viewport reveals it. */
html:not([data-pattern="none"])[data-pattern-surface-inbox-conversation="on"] .agents-page .agents-messages-section {
  background: var(--color-surface-soft);
}

html:not([data-pattern="none"])[data-pattern-surface-inbox-conversation="on"] .agents-page .agents-messages-section::after {
  top: var(--agents-header-height);
  background: color-mix(
    in srgb,
    var(--color-pattern) var(--portal-pattern-conversation-intensity-percent),
    transparent
  );
}

html:not([data-pattern="none"])[data-pattern-surface-inbox-conversation="on"] .agents-page .agents-messages-area {
  background: transparent;
}

/* Continue the Knowledge Base pattern through its second header row. */
html:not([data-pattern="none"])[data-pattern-surface-knowledge-header="on"] .kb-dialog:not(.at-dialog) .kb-toolbar::after {
  -webkit-mask-position: 0 -75px;
  mask-position: 0 -75px;
}

/* The task board owns one pattern plane; transparent column bodies keep the
   texture aligned instead of restarting it in each status column. */
html:not([data-pattern="none"])[data-pattern-surface-task-columns="on"] .tasks-board::after {
  z-index: 0;
}

html:not([data-pattern="none"])[data-pattern-surface-task-columns="on"] .tasks-board > .tasks-column {
  z-index: 1;
  background-color: transparent;
}

html:not([data-pattern="none"])[data-pattern-surface-task-columns="on"] .tasks-column-body {
  background-color: transparent;
}

@media (min-width: 721px) and (prefers-reduced-motion: reduce) {
  .portal-nav::before,
  .portal-nav .portal-nav-item::before,
  .portal-nav .portal-nav-item svg {
    transition: none;
  }
}

.portal-main {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.portal-global-header {
  position: relative;
  z-index: 210;
  flex: 0 0 58px;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 0 18px 0 22px;
  background: var(--color-panel);
  border-bottom: 1px solid var(--color-border-subtle);
  color: var(--color-text-primary);
}

.portal-global-context {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 13px;
  overflow: hidden;
  white-space: nowrap;
}

.portal-global-workspace {
  overflow: hidden;
  color: var(--color-text-primary);
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
}

.portal-global-context-divider {
  width: 1px;
  height: 18px;
  flex: 0 0 1px;
  background: var(--color-border-strong);
}

.portal-global-page {
  overflow: hidden;
  color: var(--color-text-secondary);
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
}

.portal-global-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.portal-global-action {
  position: relative;
  width: 40px;
  height: 40px;
  min-width: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--color-text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.portal-global-action:hover,
.portal-global-action:focus-visible,
.portal-global-action[aria-expanded="true"] {
  border-color: var(--color-accent-border);
  background: var(--color-accent-soft);
  color: var(--color-accent);
}

.portal-global-action:focus-visible {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 1px;
}

.portal-global-action:active {
  transform: translateY(1px);
}

.portal-global-action svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.8;
}

.portal-global-user {
  width: auto;
  max-width: min(320px, 34vw);
  margin-left: 5px;
  display: inline-flex;
  justify-content: flex-start;
  gap: 9px;
  border-color: var(--color-border-subtle);
  background: var(--color-surface-soft);
  color: var(--color-text-primary);
  padding: 0 12px 0 6px;
}

.portal-global-user:hover,
.portal-global-user:focus-visible,
.portal-global-user[aria-expanded="true"] {
  border-color: var(--color-border);
  background: var(--color-surface-muted);
  color: var(--color-text-primary);
}

.portal-global-user-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--color-hover);
  color: var(--color-text-secondary);
}

.portal-global-user-icon svg {
  width: 17px;
  height: 17px;
}

.portal-global-user-name {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-global-user-status {
  flex: 0 0 auto;
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.portal-global-user-status::before {
  content: "";
  width: 5px;
  height: 5px;
  display: inline-block;
  margin: 0 6px 1px 0;
  border-radius: 999px;
  background: var(--color-text-muted);
}

.portal-global-user-status.is-online {
  color: var(--color-success);
}

.portal-global-user-status.is-online::before {
  background: var(--color-success);
}

.portal-global-user-status.is-break {
  color: var(--color-warning);
}

.portal-global-user-status.is-break::before {
  background: var(--color-warning);
}

.portal-main > .portal-global-header + .portal-content {
  height: auto;
}

.portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 70px;
  padding: 16px 24px;
  color: var(--color-text-inverse);
  background: var(--color-info);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.portal-header-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.72);
}

.portal-header-prefix {
  color: inherit;
  font-weight: inherit;
}

.portal-header-separator-muted {
  color: inherit;
  font-weight: inherit;
}

.portal-header-user {
  font-size: 16px;
  font-weight: 500;
  opacity: 0.92;
}

.portal-content {
  flex: 1;
  min-height: 0;
  height: 100%;
  display: grid;
  gap: 0;
  padding: 0;
}

.portal-content.portal-content-loading {
}

.portal-view.is-mobile-portrait .portal-global-header,
.portal-view.is-mobile-portrait-loading .portal-global-header {
  display: none;
}

.dashboard-loading-indicator {
  position: fixed;
  inset: 0;
  z-index: 240;
  display: grid;
  place-items: center;
  background: var(--app-bg);
  pointer-events: none;
}

.dashboard-loading-logo {
  width: min(76px, 18vw);
  height: auto;
  display: block;
}

.tickets-page {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  background: var(--app-bg);
}

.tickets-sidebar-panel {
  min-height: 0;
  padding: 24px 14px;
  border-right: 0;
  background: var(--app-bg);
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 18px;
}

.tickets-sidebar-head {
  padding: 0 8px;
}

.tickets-sidebar-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 25px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 0;
}

.tickets-sidebar-section h3 {
  margin: 0 8px 10px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: 0;
  text-transform: none;
}

.tickets-sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tickets-sidebar-count {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
}

.tickets-type-switch {
  display: grid;
  gap: 4px;
}

.tickets-type-button {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  font-weight: 800;
  text-align: left;
}

.tickets-type-button i,
.tickets-type-button svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.tickets-type-button:hover,
.tickets-type-button.is-active {
  background: var(--color-accent-soft);
  color: var(--color-text-primary);
}

.tickets-assigned-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  align-content: start;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--color-surface);
  border-radius: 0;
  border: 0;
  border-top: 1px solid var(--color-selected);
}

.tickets-list-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.tickets-list-spinner {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(20, 35, 59, 0.2);
  border-top-color: var(--navy);
  animation: dashboard-spin 0.8s linear infinite;
}

.tickets-list-empty {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  padding: 12px;
}

.tickets-assigned-item {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 86px;
  border: 0;
  border-bottom: 1px solid var(--color-border-subtle);
  border-radius: 0;
  background: var(--color-surface);
  padding: 12px 14px 12px 16px;
  text-align: left;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: start;
  gap: 11px;
}

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

.tickets-assigned-item strong {
  font-size: 15px;
  color: var(--color-text-primary);
  font-weight: 850;
  line-height: 1.25;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tickets-assigned-icon {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: var(--color-border-subtle);
  color: var(--color-text-primary);
  display: grid;
  place-items: center;
  margin-top: 1px;
}

.tickets-assigned-icon i,
.tickets-assigned-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.9px;
}

.tickets-assigned-body {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.tickets-assigned-head {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tickets-assigned-country {
  font-size: 14px;
  color: var(--ink-soft);
  font-weight: 750;
}

.tickets-assigned-item span {
  font-size: 14px;
  color: var(--ink-soft);
  font-weight: 750;
}

.tickets-assigned-date {
  flex: 0 0 auto;
  white-space: nowrap;
}

.tickets-assigned-meta {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tickets-assigned-meta > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tickets-assigned-item.is-selected {
  background: #eaf4ff;
}

.tickets-assigned-item.is-high-priority::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #cc2424;
}

.tickets-main-panel {
  min-height: 0;
  padding: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 0;
}

.tickets-main-panel.is-detail {
  grid-template-rows: minmax(0, 1fr);
}

.tickets-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  padding: 0;
  border-top: 1px solid var(--color-selected);
  border-bottom: 1px solid var(--color-selected);
  background: rgba(255, 255, 255, 0.64);
}

.tickets-kpi-card {
  border-right: 1px solid var(--color-selected);
  border-radius: 0;
  background: transparent;
  padding: 8px 14px;
  min-height: 72px;
  display: grid;
  align-content: start;
}

.tickets-kpi-card:last-child {
  border-right: none;
}

.tickets-kpi-card span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.tickets-kpi-card strong {
  display: block;
  margin-top: 3px;
  font-size: 22px;
  color: var(--ink);
  letter-spacing: -0.03em;
}

.kpi-stars {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 3px;
  font-size: 22px;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
  margin-top: 0;
}

.tickets-kpi-card .kpi-stars > span {
  display: inline-block;
}

.tickets-kpi-card strong.kpi-stars {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.01em;
  margin-top: 3px;
  transform: none;
}

.kpi-stars .star-on {
  color: var(--navy);
}

.kpi-stars .star-muted-tone {
  color: rgba(7, 53, 110, 0.58);
}

.kpi-stars .star-half-text {
  margin-left: 3px;
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
}

.kpi-stars .star-on {
  color: var(--navy);
}

.kpi-stars .star-muted-tone {
  color: rgba(7, 53, 110, 0.78);
}

.kpi-stars .star-half {
  background: linear-gradient(90deg, var(--navy) 50%, rgba(7, 53, 110, 0.78) 50%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
}

.tickets-table-shell {
  min-height: 0;
  border: 1px solid var(--color-selected);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.72);
  overflow: auto;
}

.tickets-table-controls {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 170px 170px 190px 170px auto auto;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-selected);
  background: rgba(255, 255, 255, 0.64);
}

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

.tickets-filter-field span {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.tickets-filter-field input,
.tickets-filter-field select {
  height: 38px;
  border-radius: 9px;
  border: 1px solid var(--color-selected-strong);
  background: var(--color-surface);
  color: var(--ink);
  font-size: 14px;
  padding: 0 10px;
}

.tickets-filter-field select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6.5L8 10.5L12 6.5' stroke='%2329394f' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px 14px;
}

.tickets-filter-field select option {
  background: var(--color-surface);
  color: #1f2d44;
}

.tickets-custom-select {
  position: relative;
}

.tickets-custom-select-trigger {
  width: 100%;
  height: 38px;
  border-radius: 9px;
  border: 1px solid var(--color-selected-strong);
  background: var(--color-surface);
  color: var(--ink);
  font-size: 14px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tickets-custom-select-trigger svg {
  width: 14px;
  height: 14px;
  color: #29394f;
}

.tickets-custom-select-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  width: 100%;
  z-index: 90;
  border-radius: 10px;
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  box-shadow: 0 10px 24px var(--color-selected-strong);
  overflow: auto;
  max-height: 220px;
  padding: 4px;
}

.contacts-modal [data-custom-select-id="contacts-create-stage"].is-open .tickets-custom-select-menu {
  top: auto;
  bottom: calc(100% + 4px);
  max-height: min(260px, 42vh);
}

.tickets-custom-select-option {
  width: 100%;
  border: none;
  background: transparent;
  color: #1f2d44;
  text-align: left;
  font-size: 14px;
  border-radius: 7px;
  padding: 7px 8px;
}

.tickets-custom-select-option:hover,
.tickets-custom-select-option.is-selected {
  background: var(--color-accent-soft);
  color: #163560;
}

.tickets-filter-field input[type="search"]::-webkit-search-cancel-button {
  cursor: pointer;
}

.tickets-filter-actions {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  align-self: end;
  gap: 10px;
}

.tickets-filter-create {
  justify-self: end;
  align-self: end;
}

.tickets-filter-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  border-radius: 9px;
  border: 1px solid var(--color-selected-strong);
  background: var(--color-surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  padding: 0 12px;
}

.tickets-filter-button svg,
.tickets-filter-button i {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.tickets-filter-button-primary {
  border-color: rgba(7, 53, 110, 0.18);
  background: var(--color-accent);
  color: var(--color-on-accent);
}

.tickets-filter-button-icon {
  width: 38px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.tickets-filter-button-icon svg {
  width: 15px;
  height: 15px;
}

.tickets-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1180px;
}

.tickets-table th,
.tickets-table td {
  padding: 15px 16px;
  border-bottom: 1px solid var(--color-border-subtle);
  text-align: center;
  font-size: 16px;
  white-space: nowrap;
}

.tickets-table th {
  padding-top: 9px;
  padding-bottom: 9px;
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef2f8;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 14px;
}

.tickets-table tbody tr:hover {
  background: var(--color-hover);
}

.tickets-table-row {
  cursor: pointer;
  transition: background-color 120ms ease;
}

.tickets-table-row.is-selected {
  background: var(--color-accent-soft);
}

.tickets-table-id-cell {
  position: relative;
}

.tickets-priority-dot {
  position: absolute;
  left: 10px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #cc2424;
  transform: translateY(-50%);
}

.tickets-empty-row {
  text-align: center !important;
  color: var(--ink-soft);
  font-weight: 700;
  padding: 26px 16px !important;
}

.tickets-table-pagination {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 10px 12px;
  border-top: 1px solid var(--color-selected);
  background: rgba(255, 255, 255, 0.94);
}

.tickets-pagination-inner {
  display: inline-flex;
  align-items: center;
  gap: 18px;
}

.crm-contacts-pagination {
  place-items: stretch;
}

.crm-contacts-pagination-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  width: 100%;
}

.crm-contacts-pagination-inner .tickets-pagination-size {
  justify-self: start;
}

.crm-contacts-pagination-inner .tickets-pagination-nav {
  justify-self: center;
}

.crm-contacts-total {
  justify-self: end;
  white-space: nowrap;
}

.tickets-pagination-size {
  display: inline-flex;
  align-items: center;
  gap: 0;
}

.tickets-pagination-size-field {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.tickets-pagination-size input {
  width: 106px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--color-selected-strong);
  background: var(--color-surface);
  padding: 0 42px 0 10px;
  font-size: 14px;
  color: var(--ink);
  text-align: center;
}

.tickets-pagination-size-suffix {
  position: absolute;
  right: 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  pointer-events: none;
}

.tickets-pagination-size-field:focus-within .tickets-pagination-size-suffix {
  opacity: 0;
}

.tickets-pagination-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tickets-pagination-button {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--color-selected-strong);
  background: var(--color-surface);
  color: var(--ink);
  display: inline-grid;
  place-items: center;
  padding: 0;
}

.tickets-pagination-button:disabled {
  opacity: 0.45;
}

.tickets-pagination-button svg {
  width: 16px;
  height: 16px;
}

.tickets-pagination-status {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
}

.tickets-detail-shell {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border-subtle);
}

.tickets-main-panel.is-detail .tickets-detail-shell {
  min-height: 0;
  height: 100%;
}

.tickets-detail-top {
  padding: 12px 0 12px 16px;
  border-bottom: 1px solid var(--color-selected);
  background: var(--color-surface);
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(340px, 780px);
  align-items: stretch;
  gap: 0;
}

.tickets-detail-top-controls {
  grid-column: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-right: 0;
}

.tickets-back-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
  font-weight: 700;
}

.tickets-back-button svg {
  width: 17px;
  height: 17px;
}

.tickets-priority-button {
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(176, 32, 32, 0.22);
  background: rgba(255, 255, 255, 0.9);
  color: #9b2020;
  font-weight: 700;
}

.tickets-priority-button.is-active {
  border-color: rgba(176, 32, 32, 0.32);
  background: rgba(176, 32, 32, 0.12);
}

.tickets-detail-grid {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(340px, 780px);
}

@media (max-width: 1560px) {
  .tickets-detail-top {
    grid-template-columns: minmax(340px, 1fr) minmax(340px, 41vw);
  }

  .tickets-detail-grid {
    grid-template-columns: minmax(340px, 1fr) minmax(340px, 41vw);
  }
}

.tickets-detail-info {
  min-height: 0;
  padding: 16px;
  border-right: 1px solid var(--color-selected);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  background: #f9fafb;
}

.tickets-detail-info h3,
.tickets-detail-chat h3 {
  margin: 0;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.tickets-detail-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.tickets-detail-id {
  font-size: 20px;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.tickets-detail-body {
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-auto-rows: min-content;
  gap: 6px;
  align-content: start;
  border-top: 1px solid var(--color-selected);
}

.tickets-detail-row {
  display: grid;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--color-selected);
}

.tickets-detail-row-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tickets-detail-row-contact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
}

.tickets-detail-row-single,
.tickets-detail-row-summary {
  grid-template-columns: 1fr;
}

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

.tickets-detail-item span {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 800;
  color: var(--ink-soft);
}

.tickets-detail-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tickets-detail-label em {
  font-style: normal;
}

.tickets-detail-label svg {
  width: 14px;
  height: 14px;
  color: #5f6b80;
}

.tickets-detail-item strong {
  font-size: 17px;
  color: var(--ink);
}

.tickets-detail-item p {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--ink);
  white-space: pre-line;
}

.tickets-detail-row-notes .tickets-detail-item {
  gap: 8px;
}

.tickets-note-add {
  border: none;
  background: transparent;
  color: var(--color-accent);
  font-size: 14px;
  font-weight: 700;
  padding: 0;
  width: fit-content;
}

.tickets-note-add:disabled {
  opacity: 0.5;
}

.tickets-note-compose {
  display: grid;
  gap: 8px;
}

.tickets-note-compose textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--color-selected-strong);
  background: var(--color-surface);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  padding: 10px 11px;
  resize: vertical;
}

.tickets-note-compose-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.tickets-note-action {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  padding: 0;
}

.tickets-note-action-primary {
  color: var(--color-accent);
}

.tickets-note-error {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #a32a2a;
}

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

.tickets-note-item {
  border: 1px solid var(--color-selected);
  border-radius: 10px;
  background: var(--color-surface);
  padding: 10px 11px;
  display: grid;
  gap: 6px;
}

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

.tickets-note-item-head strong {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}

.tickets-note-item-head time {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
}

.tickets-note-item p {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--ink);
}

.tickets-email-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tickets-email-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: none;
  background: transparent;
  color: #6a7486;
  text-decoration: none;
  padding: 0;
}

.tickets-email-button svg {
  width: 14px;
  height: 14px;
}

.tickets-email-button.is-copied svg {
  display: none;
}

.tickets-email-button.is-copied::before {
  content: "✓";
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}

.tickets-detail-footer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
  background: linear-gradient(to top, #f9fafb 78%, rgba(249, 250, 251, 0));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.tickets-assign-control {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  color: var(--ink-soft);
}

.tickets-assign-label {
  margin-right: 2px;
}

.tickets-assign-current {
  min-height: 44px;
  min-width: 270px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--color-selected-strong);
  background: var(--color-surface);
  color: var(--ink);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tickets-assign-current svg {
  width: 17px;
  height: 17px;
  margin-left: auto;
}

.tickets-assign-dropdown {
  position: absolute;
  left: 64px;
  bottom: calc(100% + 8px);
  min-width: 180px;
  max-height: 220px;
  overflow: auto;
  border-radius: 10px;
  border: 1px solid var(--color-selected-strong);
  background: var(--color-surface);
  box-shadow: 0 10px 24px var(--color-border);
  display: grid;
  padding: 6px;
  gap: 4px;
}

.tickets-assign-option {
  border: none;
  background: transparent;
  color: var(--ink);
  text-align: left;
  border-radius: 8px;
  padding: 10px 10px;
  font-size: 15px;
  font-weight: 700;
}

.tickets-assign-option:hover,
.tickets-assign-option.is-selected {
  background: var(--color-accent-soft);
}

.tickets-ticket-actions {
  display: inline-flex;
  align-items: center;
  gap: 16px;
}

.tickets-action-solved {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid #117548;
  background: #117548;
  color: var(--color-text-inverse);
  font-size: 15px;
  font-weight: 700;
}

.tickets-action-close {
  border: none;
  background: transparent;
  color: #6a7486;
  font-size: 15px;
  font-weight: 700;
  padding: 0;
}

.tickets-detail-chat {
  min-height: 0;
  padding: 16px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
  background: var(--color-surface);
}

.tickets-chat-thread {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 12px;
  align-content: start;
  padding-right: 2px;
}

.tickets-chat-row {
  width: 100%;
  display: grid;
  gap: 5px;
}

.tickets-chat-row.is-agent {
  justify-items: end;
}

.tickets-chat-row.is-customer {
  justify-items: start;
}

.tickets-chat-message {
  width: fit-content;
  max-width: min(76%, 620px);
  border-radius: 14px;
  padding: 10px 14px 9px;
  border: none;
  background: #eef2f7;
  display: inline-grid;
  gap: 8px;
  justify-self: start;
}

.tickets-chat-message.is-agent {
  justify-self: end;
  background: #26469a;
  color: var(--color-text-inverse);
}

.tickets-chat-message.is-customer {
  justify-self: start;
  background: #edf1f6;
  color: #12213a;
}

.tickets-chat-time {
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  color: #6a7486;
  justify-self: end;
}

.tickets-chat-row.is-agent .tickets-chat-time {
  justify-self: end;
  color: #3f5c9e;
}

.tickets-chat-row.is-customer .tickets-chat-time {
  justify-self: start;
}

.tickets-chat-text p {
  margin: 0;
  color: #12213a;
  line-height: 1.5;
  font-size: 16px;
  font-weight: 600;
}

.tickets-chat-text strong {
  font-weight: 800;
}

.tickets-chat-text ul,
.tickets-chat-text ol {
  margin: 0;
  padding-left: 20px;
  color: #12213a;
  line-height: 1.5;
  font-size: 16px;
  font-weight: 600;
  display: grid;
  gap: 2px;
}

.tickets-chat-message.is-agent .tickets-chat-text,
.tickets-chat-message.is-agent .tickets-chat-text p,
.tickets-chat-message.is-agent .tickets-chat-text ul,
.tickets-chat-message.is-agent .tickets-chat-text ol,
.tickets-chat-message.is-agent .tickets-chat-text li,
.tickets-chat-message.is-agent .tickets-chat-text strong {
  color: var(--color-text-inverse);
}

.tickets-chat-placeholder {
  padding: 10px 0;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
}

.tickets-form-modal {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: grid;
  place-items: center;
}

.tickets-form-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 14, 30, 0.5);
  backdrop-filter: blur(3px);
}

.tickets-form-dialog {
  position: relative;
  z-index: 1;
  width: min(92vw, 760px);
  max-height: 88vh;
  overflow: auto;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  box-shadow: 0 18px 42px rgba(20, 35, 59, 0.2);
}

.tickets-form-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.tickets-form-dialog-head h3 {
  margin: 0;
  color: var(--ink);
}

.tickets-form-close {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--color-selected-strong);
  background: var(--color-surface);
  display: inline-grid;
  place-items: center;
  padding: 0;
  color: var(--ink);
}

.tickets-form-close svg {
  width: 16px;
  height: 16px;
}

.tickets-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.tickets-form-grid label,
.tickets-form-note {
  display: grid;
  gap: 5px;
}

.tickets-form-note {
  margin-bottom: 12px;
}

.tickets-form-grid span,
.tickets-form-note span {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.tickets-form-grid input,
.tickets-form-grid select,
.tickets-form-grid textarea,
.tickets-form-note textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--color-selected-strong);
  background: var(--color-surface);
  color: var(--ink);
  font-size: 15px;
  padding: 10px 11px;
  resize: vertical;
}

.tickets-form-grid select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6.5L8 10.5L12 6.5' stroke='%2329394f' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px 14px;
}

.tickets-form-grid select option {
  background: var(--color-surface);
  color: #1f2d44;
}

.tickets-page select {
  border-color: var(--color-border-strong);
}

.tickets-page select:focus {
  outline: none;
  border-color: rgba(7, 53, 110, 0.38);
  box-shadow: 0 0 0 2px var(--color-selected);
}

.tickets-form-grid label.tickets-form-checkbox {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  align-self: end;
  justify-self: start;
  gap: 8px;
  white-space: nowrap;
  min-height: 42px;
}

.tickets-form-checkbox input {
  display: block;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 0;
}

.tickets-form-checkbox span {
  font-size: 14px;
  text-transform: none;
  letter-spacing: normal;
  color: var(--ink);
}

.tickets-form-span-2 {
  grid-column: span 2;
}

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

.tickets-form-error {
  margin: 0 auto 0 0;
  color: #a32a2a;
  font-size: 13px;
  font-weight: 700;
}

.dashboard-loading-indicator {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 14px;
  text-align: center;
}

.dashboard-loading-indicator p {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}

.dashboard-loading-spinner {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 3px solid var(--color-accent-border);
  border-top-color: var(--navy);
  animation: dashboard-spin 0.8s linear infinite;
}

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

.dashboard-lock-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 15, 32, 0.62);
  backdrop-filter: blur(6px);
}

.dashboard-lock-overlay-card {
  width: min(92vw, 560px);
  padding: clamp(22px, 3.6vw, 34px);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(16, 36, 69, 0.98), rgba(10, 25, 50, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--color-text-inverse);
  box-shadow: 0 24px 54px rgba(0, 0, 0, 0.38);
}

.dashboard-lock-overlay-card h3 {
  margin: 0;
  font-size: clamp(24px, 3.2vw, 34px);
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

.dashboard-lock-overlay-card p {
  margin: 14px 0 0;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.84);
}

.apps-page-shell {
  display: grid;
  gap: 22px;
  align-content: start;
}

.apps-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.apps-segmented {
  display: inline-flex;
  padding: 6px;
  border-radius: 999px;
  background: var(--color-hover);
  border: 1px solid var(--color-border-subtle);
}

.apps-segmented-button {
  min-width: 88px;
  height: 42px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 700;
}

.apps-segmented-button.is-active {
  background: var(--color-surface);
  color: var(--navy);
  box-shadow: 0 6px 18px var(--color-selected);
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.app-card {
  display: grid;
  gap: 18px;
  padding: 22px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--color-border-subtle);
}

.app-card-top,
.app-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.app-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--color-accent-soft);
  color: var(--navy);
}

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

.app-state {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--color-hover);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-state.is-enabled {
  background: rgba(17, 117, 72, 0.12);
  color: #117548;
}

.app-card-copy h3 {
  margin: 0;
}

.app-card-copy p {
  margin: 10px 0 0;
  line-height: 1.7;
}

.app-docs-link {
  color: var(--navy);
  font-weight: 700;
  text-decoration: none;
}

.app-docs-link:hover {
  text-decoration: underline;
}

.app-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.app-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.app-switch-track {
  position: relative;
  width: 54px;
  height: 32px;
  border-radius: 999px;
  background: var(--color-border);
}

.app-switch-track::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--color-surface);
  box-shadow: 0 3px 10px var(--color-border-strong);
  transition: transform 0.2s ease;
}

.app-switch input:checked + .app-switch-track {
  background: rgba(17, 117, 72, 0.24);
}

.app-switch input:checked + .app-switch-track::after {
  transform: translateX(22px);
}

.users-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.surface-subcard {
  padding: 22px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid var(--color-border-subtle);
}

.hero-card,
.surface-card {
  background: var(--bg-panel);
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-tight);
  backdrop-filter: blur(18px);
}

.hero-card {
  padding: 28px;
  display: grid;
  grid-template-columns: minmax(240px, 1.2fr) minmax(280px, 0.8fr);
  gap: 18px;
}

.hero-card h3,
.surface-card h3 {
  margin: 0;
  font-size: 24px;
}

.hero-card p,
.surface-card p,
.metric-card span,
.list-row small,
.empty-note {
  color: var(--ink-soft);
}

.hero-card p {
  margin: 10px 0 0;
  max-width: 54ch;
  line-height: 1.7;
}

.hero-stat-grid,
.metric-grid {
  display: grid;
  gap: 14px;
}

.hero-stat-grid {
  grid-template-columns: repeat(2, minmax(120px, 1fr));
}

.metric-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.metric-card {
  padding: 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--color-border-subtle);
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 34px;
  letter-spacing: -0.04em;
}

.content-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
}

.surface-card {
  padding: 24px;
}

.surface-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--color-accent-soft);
  color: var(--navy);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.list-block {
  display: grid;
  gap: 12px;
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 0;
  border-top: 1px solid var(--color-border-subtle);
}

.list-row:first-child {
  border-top: none;
  padding-top: 0;
}

.list-row strong,
.list-row small,
.module-card strong,
.module-card small {
  display: block;
}

.queue-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.queue-pill {
  background: rgba(241, 169, 59, 0.18);
  color: #9a6309;
}

.status-pill {
  background: var(--color-accent-soft);
  color: var(--navy);
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.module-card {
  padding: 20px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--color-border-subtle);
}

.module-card svg {
  width: 24px;
  height: 24px;
  color: var(--navy);
}

.module-card strong {
  margin-top: 18px;
  margin-bottom: 8px;
  font-size: 20px;
}

.module-card small {
  line-height: 1.65;
}

.empty-note {
  margin: 8px 0 0;
  line-height: 1.65;
}

@media (max-width: 1080px) {
  .hero-card,
  .content-grid {
    grid-template-columns: 1fr;
  }

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

  .login-card {
    width: min(100%, 620px);
    margin: 0 auto;
  }

  .login-panel {
    display: none;
  }

  .tickets-page {
    grid-template-columns: 1fr;
  }

  .tickets-sidebar-panel {
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }

  .tickets-detail-grid {
    grid-template-columns: 1fr;
  }

  .tickets-detail-info {
    border-right: none;
    border-bottom: 1px solid var(--color-selected);
  }

  .tickets-detail-row-three {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .tickets-detail-row-contact {
    grid-template-columns: 1fr;
  }

  .tickets-email-button {
    width: fit-content;
  }

  .tickets-detail-footer {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

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

  .tickets-filter-actions {
    justify-self: start;
  }

  .tickets-filter-create {
    justify-self: start;
  }

  .tickets-table-pagination {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .tickets-main-panel {
    padding: 16px;
  }

  .tickets-sidebar-panel {
    padding: 16px;
  }

  .tickets-kpi-grid {
    grid-template-columns: 1fr;
  }

  .tickets-table-controls {
    grid-template-columns: 1fr;
  }

  .tickets-filter-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .tickets-filter-button {
    min-width: 90px;
  }

  .tickets-filter-create {
    width: 100%;
  }

  .tickets-pagination-inner {
    width: 100%;
    justify-content: space-between;
  }

  .crm-contacts-pagination-inner {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 10px;
  }

  .crm-contacts-pagination-inner .tickets-pagination-size,
  .crm-contacts-pagination-inner .tickets-pagination-nav,
  .crm-contacts-total {
    justify-self: center;
  }

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

  .tickets-form-span-2 {
    grid-column: span 1;
  }

  .tickets-detail-shell {
    border: 1px solid var(--color-selected);
  }

  .tickets-detail-top,
  .tickets-detail-info,
  .tickets-detail-chat {
    padding: 12px;
  }

  .tickets-chat-message {
    width: fit-content;
    max-width: 88%;
  }

  .tickets-detail-row-three {
    grid-template-columns: 1fr;
  }

  .tickets-assign-control,
  .tickets-ticket-actions {
    width: 100%;
  }

  .tickets-assign-current {
    min-width: 0;
    width: 100%;
  }

  .tickets-ticket-actions {
    justify-content: space-between;
  }

  .portal-view {
    grid-template-columns: 1fr;
  }

  .portal-sidebar {
    position: sticky;
    top: 0;
    z-index: 220;
    grid-template-columns: 1fr;
    padding: 14px 18px;
  }

  .portal-sidebar-top,
  .portal-sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .portal-nav {
    display: flex;
    flex-wrap: wrap;
  }

  .portal-main {
    min-height: auto;
  }

  .portal-header {
    flex-direction: column;
    align-items: flex-start;
    min-height: auto;
    padding: 14px 18px;
  }

  .apps-page-head {
    flex-direction: column;
    align-items: stretch;
  }

  .login-card,
  .login-panel {
    padding: 28px 20px;
  }

  .login-view {
    height: 100dvh;
  }

  .login-card {
    grid-template-rows: auto auto;
    align-content: center;
    gap: 12px;
    padding: 16px 18px 20px;
  }

  .login-brand {
    margin-top: 0;
  }

  .login-copy h1 {
    font-size: clamp(20px, 5.6vw, 32px);
  }

  .login-form {
    max-width: 100%;
  }

}

/* ============================================================================
   AGENTS PAGE STYLES
   ============================================================================ */

.agents-page {
  --agents-inbox-rail-width: 320px;
  --agents-inbox-bg: var(--color-canvas);
  --agents-header-height: 58px;
  background: var(--app-bg);
  display: grid;
  grid-template-columns:
    var(--agents-inbox-rail-width)
    minmax(0, 1fr);
  height: 100%;
  gap: 0;
  overflow: hidden;
  position: relative;
  font-size: 15px;
}

.agents-chat-grid {
  display: grid;
  grid-template-columns:
    var(--agents-left-width, 25%)
    minmax(0, calc(100% - var(--agents-left-width, 25%) - var(--agents-right-width, 25%)))
    var(--agents-right-width, 25%);
  min-width: 0;
  min-height: 0;
  overflow: visible;
  position: relative;
  background: var(--agents-inbox-bg);
}

.agents-chat-grid.has-no-details {
  grid-template-columns:
    var(--agents-left-width, 25%)
    minmax(0, calc(100% - var(--agents-left-width, 25%)));
}

.agents-chat-grid.has-no-details .agents-details-column,
.agents-chat-grid.has-no-details .agents-column-resizer-right {
  display: none;
}

.agents-chat-grid.is-opening-chat .agents-messages-header {
  animation: agentsHeaderIn 260ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.agents-chat-grid.is-opening-chat .agents-messages-area {
  animation: agentsMessagesIn 340ms cubic-bezier(0.2, 0.8, 0.2, 1) 44ms both;
}

.agents-chat-grid.is-opening-chat .agents-messages-footer {
  animation: agentsComposerIn 300ms cubic-bezier(0.2, 0.8, 0.2, 1) 72ms both;
}

.agents-chat-grid.is-opening-chat .agents-details-column {
  animation: agentsDetailsIn 320ms cubic-bezier(0.2, 0.8, 0.2, 1) 64ms both;
}

.agents-chat-grid.is-switching-chat .agents-messages-header,
.agents-chat-grid.is-switching-chat .agents-messages-area,
.agents-chat-grid.is-switching-chat .agents-details-column {
  animation: agentsSurfaceRefresh 140ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.agents-chat-grid.is-emptying-chat .agents-empty-right {
  animation: agentsEmptyIn 240ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.agents-chat-grid.is-closing-chat .agents-messages-header {
  animation: agentsHeaderOut 220ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

.agents-chat-grid.is-closing-chat .agents-messages-area {
  animation: agentsMessagesOut 260ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

.agents-chat-grid.is-closing-chat .agents-messages-footer {
  animation: agentsComposerOut 220ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

.agents-chat-grid.is-closing-chat .agents-details-column {
  animation: agentsDetailsOut 250ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

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

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

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

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

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

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

@keyframes agentsHeaderOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-5px);
  }
}

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

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

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

@media (prefers-reduced-motion: reduce) {
  .agents-chat-grid.is-opening-chat .agents-messages-header,
  .agents-chat-grid.is-opening-chat .agents-messages-area,
  .agents-chat-grid.is-opening-chat .agents-messages-footer,
  .agents-chat-grid.is-opening-chat .agents-details-column,
  .agents-chat-grid.is-switching-chat .agents-messages-header,
  .agents-chat-grid.is-switching-chat .agents-messages-area,
  .agents-chat-grid.is-switching-chat .agents-details-column,
  .agents-chat-grid.is-emptying-chat .agents-empty-right,
  .agents-chat-grid.is-closing-chat .agents-messages-header,
  .agents-chat-grid.is-closing-chat .agents-messages-area,
  .agents-chat-grid.is-closing-chat .agents-messages-footer,
  .agents-chat-grid.is-closing-chat .agents-details-column {
    animation: none;
  }
}

.agents-column-resizer {
  position: absolute;
  z-index: 25;
  top: 0;
  bottom: 0;
  width: 13px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: col-resize;
  transform: translateX(-50%);
  touch-action: none;
}

.agents-column-resizer::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: transparent;
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

.agents-column-resizer:hover::before,
.agents-column-resizing .agents-column-resizer::before {
  background: var(--color-focus-border);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

.agents-column-resizer-left {
  left: var(--agents-left-width, 25%);
}

.agents-column-resizer-right {
  left: calc(100% - var(--agents-right-width, 25%));
}

.agents-column-resizing {
  cursor: col-resize;
  user-select: none;
}

.agents-column-resizing * {
  cursor: col-resize !important;
}

.agents-inbox-rail {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 24px 14px;
  background: var(--agents-inbox-bg);
  border-right: 0;
  overflow: hidden;
}

.agents-inbox-rail-head {
  padding: 0 8px 18px;
}

.agents-inbox-rail-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 25px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 0;
}

.agents-inbox-nav {
  display: grid;
  gap: 4px;
}

.agents-inbox-nav-item {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.agents-inbox-nav-item:hover,
.agents-inbox-nav-item.is-active {
  background: var(--color-accent-soft);
  color: var(--color-text-primary);
}

.agents-inbox-nav-item i,
.agents-inbox-nav-item svg,
.agents-inbox-new-chat i,
.agents-inbox-new-chat svg,
.agents-internal-head svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.agents-inbox-rail-actions {
  margin-top: 18px;
}

.agents-inbox-new-chat {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid var(--color-accent-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  font-weight: 850;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 8px 18px var(--color-hover);
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.agents-inbox-new-chat:hover {
  border-color: var(--color-focus-border);
  background: var(--color-surface);
  box-shadow: 0 12px 24px var(--color-shadow-tight);
}

.agents-internal-section {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--color-border);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

.agents-internal-head {
  min-height: 32px;
  padding: 0 4px 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.agents-internal-head button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}

.agents-internal-head button:hover {
  background: var(--color-accent-soft);
  color: var(--navy);
}

.agents-internal-head button:disabled {
  cursor: progress;
  opacity: 0.8;
}

.agents-internal-head button.is-loading svg {
  animation: analyticsSpin 0.9s linear infinite;
}

.agents-internal-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 6px;
  overflow: auto;
  padding-right: 2px;
}

.agents-internal-item {
  width: 100%;
  min-height: 58px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  text-align: left;
  cursor: pointer;
}

.agents-internal-item:hover,
.agents-internal-item.is-active {
  background: var(--color-accent-soft);
  border-color: var(--color-accent-soft);
}

.agents-internal-avatar,
.agents-internal-profile-avatar {
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--color-selected-strong), var(--color-success-soft));
  color: var(--navy);
  font-weight: 900;
}

.agents-internal-avatar {
  width: 34px;
  height: 34px;
  font-size: 13px;
}

.agents-internal-body {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.agents-internal-body strong,
.agents-internal-body small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agents-internal-body strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

.agents-internal-body small {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.agents-internal-item b {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--navy);
  color: var(--color-text-inverse);
  font-size: 11px;
  font-weight: 900;
}

.agents-internal-authority-badge {
  flex: 0 0 auto;
  max-width: 100%;
  min-height: 18px;
  padding: 2px 6px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--color-warning-soft);
  color: var(--color-warning);
  border: 1px solid var(--color-note-border);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.agents-internal-authority-badge-large {
  min-height: 24px;
  margin: 4px 0 2px;
  padding: 4px 9px;
  font-size: 11px;
}

.agents-internal-empty {
  padding: 14px 8px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 750;
  text-align: center;
}

.agents-internal-more,
.agents-internal-load-older {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--color-selected-strong);
  border-radius: 8px;
  background: var(--color-surface-translucent);
  color: var(--navy);
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.agents-internal-load-older {
  margin: 0 auto 10px;
  width: fit-content;
  padding: 0 12px;
  display: block;
}

.agents-internal-load-older:disabled {
  cursor: wait;
  opacity: 0.7;
}

.agents-internal-profile {
  display: grid;
  gap: 10px;
  align-content: start;
  justify-items: center;
  padding: 22px 14px;
  text-align: center;
}

.agents-internal-profile-avatar {
  width: 64px;
  height: 64px;
  margin-bottom: 10px;
  font-size: 24px;
}

/* 3-Column Chat Layout */
.agents-column {
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-right: 1px solid var(--color-border);
  overflow: hidden;
}

.agents-work-column {
  background: var(--color-surface);
  position: relative;
  z-index: 1;
  border-top-left-radius: 16px;
  border-bottom-left-radius: 16px;
  box-shadow: -4px 0 10px var(--color-selected);
}

.agents-messages-column {
  background: var(--color-surface);
}

.agents-details-column {
  background: var(--color-surface);
  border-right: none;
}

/* Shift Section */
.agents-shift-section {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.agents-shift-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  background: var(--color-hover);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.agents-shift-status-display {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agents-shift-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.agents-shift-dot.offline {
  background-color: var(--color-text-muted);
}

.agents-shift-dot.online {
  background-color: var(--color-success);
  box-shadow: 0 0 8px var(--color-success-soft);
}

.agents-shift-dot.ending {
  background-color: var(--color-warning);
  box-shadow: 0 0 8px var(--color-warning-soft);
}

.agents-shift-dot.break {
  background-color: var(--color-warning);
  box-shadow: 0 0 8px var(--color-warning-soft);
}

.agents-shift-label {
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  display: block;
}

.agents-shift-state {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  display: block;
}

.agents-shift-button {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--color-accent-hover) 100%);
  color: var(--color-on-accent);
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.18s ease;
}

.agents-shift-button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-tight);
}

.agents-shift-button:disabled {
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 0.62;
}

.agents-shift-button.is-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: wait;
  opacity: 0.82;
}

.agents-shift-button.is-loading::after {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  content: "";
  animation: agents-shift-button-spin 0.7s linear infinite;
}

@keyframes agents-shift-button-spin {
  to {
    transform: rotate(360deg);
  }
}

.agents-shift-button-secondary {
  background: var(--color-accent-soft);
  color: var(--navy);
  border: 1px solid var(--color-accent-border);
}

.agents-shift-button-secondary:hover {
  background: var(--color-accent-border);
  box-shadow: none;
}

.agents-shift-button-break {
  background: var(--color-warning-soft);
  color: var(--color-warning);
  border: 1px solid var(--color-note-border);
}

.agents-shift-button-break:hover {
  background: var(--color-warning-soft);
  box-shadow: none;
}

.agents-shift-button-danger {
  background: var(--color-danger-soft);
  color: var(--color-danger);
  border: 1px solid var(--color-danger-border);
}

.agents-shift-button-danger:hover {
  background: var(--color-danger-soft);
  box-shadow: none;
}

.agents-shift-actions-menu {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--color-surface-translucent);
}

.agents-shift-action-button {
  width: 100%;
  min-height: 34px;
  padding: 8px 12px;
  border: 1px solid var(--color-selected-strong);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.agents-shift-action-button:hover {
  background: var(--color-hover);
  border-color: var(--color-accent-border);
}

.agents-shift-note {
  margin: 2px 0 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--color-warning);
}

.agents-shift-error {
  margin: 2px 0 0;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--color-danger);
}

/* Work Section */
.agents-work-section {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  flex: 1;
  min-height: 0;
}

.agents-work-header-action:empty {
  display: none;
}

.agents-work-tabs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--color-selected-strong);
  padding-bottom: 2px;
}

.agents-work-tabs {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.agents-work-tab {
  position: relative;
  min-height: 30px;
  padding: 4px 2px 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
  text-transform: none;
  cursor: pointer;
}

.agents-work-tab.is-active {
  color: var(--navy);
}

.agents-work-tab::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 2px;
  background: transparent;
  border-radius: 999px;
}

.agents-work-tab.is-active::after {
  background: var(--color-accent-pressed);
}

.agents-new-chat-button {
  flex: 0 0 auto;
  min-height: 30px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--navy);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0 8px;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.agents-new-chat-button:hover {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.agents-new-chat-button i,
.agents-new-chat-button svg {
  width: 14px;
  height: 14px;
}

.agents-work-search-input {
  flex: 1;
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px 8px 36px;
  font-size: 15px;
  color: var(--ink);
  background: var(--color-surface);
}

.agents-work-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--agents-header-height);
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}

.agents-work-search-field {
  position: relative;
  flex: 1;
}

.agents-work-search-icon {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 18px;
  height: 18px;
  color: var(--ink-soft);
  transform: translateY(-50%);
  pointer-events: none;
}

.agents-work-filter-wrap {
  position: relative;
  flex: 0 0 auto;
}

.agents-work-filter-button {
  display: grid;
  place-items: center;
  width: 50px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.agents-work-filter-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
}

.agents-work-filter-icon > i {
  width: 26px;
  height: 26px;
}

.agents-work-filter-button:hover,
.agents-work-filter-button.is-active {
  border-color: var(--color-accent-border);
  color: var(--navy);
  background: var(--color-hover);
}

.agents-work-filter-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  min-width: 220px;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  box-shadow: 0 18px 40px var(--color-border);
}

.agents-work-filter-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.agents-user-category-group {
  display: grid;
  gap: 4px;
}

.agents-user-category-group + .agents-user-category-group {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--color-border-subtle);
}

.agents-user-category-heading {
  padding: 4px 8px 2px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.agents-work-filter-item {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.agents-work-filter-item:hover,
.agents-work-filter-item.is-active {
  background: var(--color-accent-soft);
  color: var(--navy);
}

.agents-unassign-option {
  color: var(--color-danger);
}

.agents-unassign-option:hover {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.agents-user-option {
  display: grid;
  gap: 2px;
}

.agents-user-option-name {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: 1.2;
}

.agents-user-option-category {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.2;
}

.agents-work-filter-empty {
  padding: 10px 8px;
  color: var(--ink-soft);
  font-size: 13px;
}

.agents-work-list-head {
  min-height: 40px;
  padding: 0 14px;
  border-bottom: 1px solid var(--color-selected);
  background: var(--color-surface);
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  font-weight: 850;
}

.agents-work-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  flex: 1;
  background: var(--color-surface);
}

.agents-work-skeleton-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  column-gap: 11px;
  min-height: 86px;
  padding: 12px 14px 12px 16px;
  border-bottom: 1px solid var(--color-border-subtle);
  background: var(--color-surface);
  opacity: 0.7;
  pointer-events: none;
}

.agents-work-skeleton-row-2 {
  opacity: 0.45;
}

.agents-work-skeleton-row-3 {
  opacity: 0.26;
}

.agents-work-skeleton-icon,
.agents-work-skeleton-line {
  display: block;
  background: var(--color-selected-strong);
}

.agents-work-skeleton-icon {
  width: 38px;
  height: 38px;
  margin-top: 1px;
  border-radius: 999px;
}

.agents-work-skeleton-body {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 8px;
}

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

.agents-work-skeleton-line {
  height: 12px;
  border-radius: 999px;
}

.agents-work-skeleton-title {
  width: min(58%, 150px);
  height: 15px;
}

.agents-work-skeleton-time {
  width: 48px;
}

.agents-work-skeleton-subject {
  width: min(82%, 210px);
}

.agents-work-skeleton-assignee {
  width: min(44%, 120px);
}

.agents-bulk-assign-head {
  display: flex;
  justify-content: flex-end;
}

.agents-bulk-assign-toggle {
  border: 0;
  background: transparent;
  color: var(--navy);
  font-size: 14px;
  font-weight: 850;
  padding: 2px 0;
  cursor: pointer;
}

.agents-bulk-assign-toggle:hover,
.agents-bulk-assign-toggle.is-active {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.agents-bulk-assign-toolbar {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  display: grid;
  gap: 10px;
  padding: 10px;
}

.agents-bulk-assign-toolbar.is-assign {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.agents-bulk-assign-error {
  border: 1px solid var(--color-danger-border);
  border-radius: 8px;
  background: var(--color-danger-soft);
  color: var(--color-danger);
  font-size: 12px;
  font-weight: 750;
  padding: 8px 10px;
}

.agents-bulk-assign-select-strip {
  padding: 10px 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: 0;
  border-bottom: 0;
  border-radius: 0;
}

.agents-bulk-assign-select-all {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.agents-bulk-assign-select-all small {
  margin-left: auto;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 750;
}

.agents-bulk-assign-methods {
  display: grid;
  gap: 7px;
}

.agents-bulk-assign-methods label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.agents-bulk-agent-picker {
  position: relative;
  display: grid;
  gap: 6px;
}

.agents-bulk-agent-label {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.agents-bulk-agent-trigger {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--color-selected-strong);
  border-radius: 9px;
  background: var(--color-surface);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
}

.agents-bulk-agent-trigger i,
.agents-bulk-agent-trigger svg {
  width: 15px;
  height: 15px;
  color: var(--ink-soft);
}

.agents-bulk-agent-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 35;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  box-shadow: 0 18px 40px var(--color-selected-strong);
  padding: 8px;
}

.agents-bulk-agent-search {
  margin-bottom: 8px;
}

.agents-bulk-agent-list {
  display: grid;
  gap: 4px;
}

.agents-bulk-assign-apply {
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  background: var(--navy);
  color: var(--color-text-inverse);
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.agents-bulk-assign-apply:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.agents-work-bulk-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.agents-work-quick-actions {
  position: absolute;
  top: 37px;
  right: 10px;
  z-index: 12;
}

.agents-work-quick-trigger {
  width: 28px;
  height: 24px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--color-text-secondary);
  opacity: 0;
  pointer-events: none;
  cursor: pointer;
  transform: translateY(-2px);
  transition: opacity 0.16s ease, transform 0.16s ease, background-color 0.16s ease, border-color 0.16s ease;
}

.agents-work-bulk-row:hover .agents-work-quick-trigger,
.agents-work-bulk-row:focus-within .agents-work-quick-trigger,
.agents-work-bulk-row.is-quick-open .agents-work-quick-trigger {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.agents-work-quick-trigger:hover,
.agents-work-quick-trigger:focus-visible,
.agents-work-bulk-row.is-quick-open .agents-work-quick-trigger {
  background: var(--color-hover);
  border-color: var(--color-border);
}

.agents-work-quick-trigger svg {
  width: 16px;
  height: 16px;
}

.agents-work-quick-menu {
  position: absolute;
  top: 29px;
  right: 0;
  width: 146px;
  padding: 5px;
  display: grid;
  gap: 2px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 8px 22px rgba(4, 12, 24, 0.24), 0 2px 7px rgba(4, 12, 24, 0.14);
}

.agents-work-quick-menu.hidden { display: none; }

.agents-work-quick-menu button {
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--color-text-primary);
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}

.agents-work-quick-menu button:hover,
.agents-work-quick-menu button:focus-visible {
  background: var(--color-hover);
  outline: none;
}

.agents-work-quick-menu button:last-child:hover,
.agents-work-quick-menu button:last-child:focus-visible {
  color: var(--color-danger);
}

.agents-work-quick-menu svg {
  width: 15px;
  height: 15px;
}

.agents-work-bulk-row.is-bulk {
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
}

.agents-work-bulk-row.is-quick-resolving .agents-work-item {
  opacity: 0.48;
  filter: saturate(0.45);
  cursor: wait;
}

.agents-work-quick-resolving {
  position: absolute;
  inset: 0;
  z-index: 14;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--color-text-primary);
  font-size: 13px;
  font-weight: 800;
  background: color-mix(in srgb, var(--color-surface) 58%, transparent);
  cursor: wait;
}

.agents-work-quick-resolving .crm-button-spinner {
  width: 16px;
  height: 16px;
}

.agents-work-bulk-check {
  display: grid;
  place-items: center;
}

.agents-work-bulk-check input {
  width: 16px;
  height: 16px;
}

.agents-work-item {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  column-gap: 11px;
  align-items: stretch;
  width: 100%;
  min-height: 86px;
  text-align: left;
  padding: 12px 14px 12px 16px;
  background: var(--color-surface);
  border: 0;
  border-bottom: 1px solid var(--color-border-subtle);
  border-radius: 0;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease;
  font-size: 14px;
  color: var(--ink-soft);
  content-visibility: auto;
  contain: layout paint style;
  contain-intrinsic-size: 86px;
}

.agents-work-item-icon {
  display: flex;
  align-self: start;
  justify-content: center;
  align-items: center;
  width: 38px;
  height: 38px;
  min-width: 0;
  min-height: 0;
  margin-top: 1px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--color-border-subtle);
}

.agents-work-item-body {
  min-width: 0;
}

.agents-work-overdue-dot {
  position: absolute;
  top: 8px;
  left: 10px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--color-danger);
  box-shadow: 0 0 0 2px var(--color-surface-translucent-strong);
  z-index: 2;
  pointer-events: none;
}

.agents-work-item:hover {
  background: var(--color-hover);
}

.agents-work-item.is-active {
  background: var(--color-selected);
}

.agents-work-item.is-bulk-selected {
  background: var(--color-accent-soft);
}

.agents-work-item:disabled {
  cursor: default;
}

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

.agents-work-item-title {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: nowrap;
}

.agents-work-item strong {
  display: block;
  color: var(--color-text-primary);
  flex: 0 1 auto;
  font-size: 15px;
  line-height: 1.25;
  font-weight: 900;
  margin-bottom: 0;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agents-work-item p {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.35;
  min-width: 0;
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agents-work-item-info {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.agents-work-item-assignee {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.25;
}

.agents-work-item-assignee-sep {
  display: inline-flex;
  color: var(--color-text-muted);
  flex: 0 0 auto;
  margin: 0 6px;
}

.agents-work-item-channel {
  max-width: 58%;
  min-width: 0;
  overflow: hidden;
  color: var(--color-text-muted);
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agents-work-item-assignee-name {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agents-work-item-meta {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  flex: 0 0 auto;
}

.agents-work-item-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.agents-work-item-age {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 750;
  color: var(--color-text-secondary);
  font-size: 14px;
  white-space: nowrap;
}

.agents-work-item-age i,
.agents-work-item-age svg {
  width: 14px;
  height: 14px;
}

.agents-work-unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  align-self: center;
}

.agents-work-unread-count {
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--color-success);
  color: var(--color-text-inverse);
  border: 1px solid color-mix(in srgb, var(--color-on-accent) 88%, transparent);
  box-shadow: 0 4px 12px var(--color-success-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.agents-work-unread-spacer {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.agents-work-source-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  flex: 0 0 auto;
  opacity: 0.65;
}

.agents-work-source-icon.is-telegram {
  width: 82%;
  height: 82%;
}

.agents-work-source-icon.is-instagram {
  width: 82%;
  height: 82%;
}

.agents-work-source-lucide {
  width: 100%;
  height: 100%;
  flex: 0 0 auto;
  opacity: 0.65;
}

.agents-work-source-lucide.is-website {
  width: 82%;
  height: 82%;
}


.agents-work-more {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--color-accent-border);
  border-radius: 10px;
  background: var(--color-hover);
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.agents-work-more:hover {
  background: var(--color-accent-soft);
}

.agents-right-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  height: 100%;
  container-type: inline-size;
  container-name: agents-right-panel;
}

.agents-right-tabs {
  display: flex;
  gap: 14px;
  min-height: var(--agents-header-height);
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  padding: 0 14px;
  background: var(--color-surface);
}

.agents-right-tab {
  position: relative;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 17px;
  font-weight: 700;
  padding: 2px 2px 8px;
  cursor: pointer;
}

.agents-right-tab::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 2px;
  border-radius: 999px;
  background: transparent;
}

.agents-right-tab.is-active {
  color: var(--navy);
}

.agents-right-tab.is-active::after {
  background: var(--color-accent-pressed);
}

.agents-right-content {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  background: var(--color-surface);
}

.agents-right-conversations {
  display: grid;
  gap: 10px;
}

.agents-right-conversations-loading {
  min-height: 160px;
  display: grid;
  place-items: center;
}

.agents-right-notes-loading {
  min-height: 160px;
  display: grid;
  place-items: center;
}

.agents-right-notes {
  display: grid;
  gap: 10px;
}

.agents-right-note-composer,
.agents-right-note-item {
  display: grid;
  gap: 8px;
}

.agents-right-note-composer textarea {
  min-height: 88px;
  resize: vertical;
  padding: 10px 11px;
}

.agents-right-note-composer .button {
  justify-self: end;
}

.agents-right-note-item {
  padding: 10px 0;
  border-top: 1px solid var(--color-border);
}

.agents-right-note-item p,
.agents-right-note-item small {
  margin: 0;
}

.agents-right-note-item small,
.agents-right-panel-message {
  color: var(--ink-soft);
  font-size: 12px;
}

.agents-right-panel-message {
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
}

.agents-right-panel-actions {
  display: flex;
  justify-content: flex-end;
  padding: 12px 14px 18px;
}

.agents-right-notes-empty {
  color: var(--ink-soft);
  font-size: 13px;
  padding: 6px 0 2px;
}

.agents-note-compose {
  display: grid;
  gap: 8px;
}

.agents-note-compose textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--color-selected-strong);
  background: var(--color-surface);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  padding: 10px 11px;
  resize: vertical;
  min-height: 108px;
}

.agents-note-compose-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.agents-note-action {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  padding: 0;
}

.agents-note-action-primary {
  color: var(--color-accent);
}

.agents-note-error {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-danger);
}

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

.agents-note-item {
  border: 1px solid var(--color-selected);
  border-radius: 10px;
  background: var(--color-surface);
  padding: 10px 11px;
  display: grid;
  gap: 6px;
}

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

.agents-note-item-head strong {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}

.agents-note-item-head time {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
}

.agents-note-item p {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
}

.agents-right-conversation-item {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface-translucent);
  padding: 12px;
  display: grid;
  gap: 6px;
  text-align: left;
  cursor: pointer;
}

.agents-right-conversation-item.is-expanded {
  gap: 10px;
}

.agents-right-conversation-item:hover {
  border-color: var(--color-accent-border);
  background: var(--color-hover);
}

.agents-right-conversation-item.is-active {
  border-color: var(--color-accent-border);
  background: var(--color-accent-soft);
}

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

.agents-right-conversation-head strong {
  font-size: 14px;
  color: var(--ink);
}

.agents-right-conversation-head span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
}

.agents-right-conversation-item p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.35;
}

.agents-right-conversation-notes {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--color-border-subtle);
  display: grid;
  gap: 8px;
}

.agents-right-conversation-notes-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.agents-right-conversation-notes-loading {
  min-height: 56px;
  display: grid;
  place-items: center;
}

.agents-right-conversation-notes-empty {
  color: var(--ink-soft);
  font-size: 13px;
}

.agents-right-details {
  display: grid;
  gap: 0;
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
  border-top: 1px solid var(--color-selected);
  border-bottom: 1px solid var(--color-selected);
}

.agents-right-quick-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px 18px;
  background: transparent;
  border-bottom: 0;
}

.agents-right-flag-avatar {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border: 2px solid var(--color-surface);
  background: var(--color-surface);
  overflow: hidden;
  box-shadow: 0 8px 20px var(--color-shadow-tight);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 900;
}

.agents-right-flag-avatar img {
  width: auto;
  height: 100%;
  max-width: none;
  object-fit: contain;
  object-position: left center;
  flex: 0 0 auto;
}

.agents-right-flag-avatar.is-channel {
  justify-content: center;
}

.agents-right-flag-avatar.is-channel .agents-work-source-icon {
  width: 38px;
  height: 38px;
  object-fit: contain;
  object-position: center;
  opacity: 1;
}

.agents-right-flag-avatar.is-channel .agents-work-source-lucide {
  width: 26px;
  height: 26px;
  opacity: 1;
}

.agents-right-quick-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.agents-right-quick-copy strong {
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agents-right-quick-copy span {
  color: var(--navy);
  font-size: 14px;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agents-right-quick-copy small {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
}

.agents-right-section {
  border: 0;
  border-bottom: 1px solid var(--color-selected);
  border-radius: 0;
  background: var(--color-surface);
  overflow: hidden;
}

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

.agents-right-section:has(.agents-right-select-wrap.is-open) {
  position: relative;
  z-index: 20;
  overflow: visible;
}

.agents-right-section-toggle {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  border: 0;
  background: linear-gradient(180deg, var(--color-accent-soft), var(--color-hover));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 24px;
  cursor: pointer;
  color: var(--ink);
  border-bottom: 1px solid var(--color-accent-soft);
}

.agents-right-section-static {
  width: 100%;
  box-sizing: border-box;
  background: linear-gradient(180deg, var(--color-accent-soft), var(--color-hover));
  display: flex;
  align-items: center;
  padding: 12px 24px;
  color: var(--ink);
  border-bottom: 1px solid var(--color-accent-soft);
}

.agents-right-section-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: -0.01em;
}

.agents-right-section-title i,
.agents-right-section-title svg,
.agents-right-section-chevron {
  width: 16px;
  height: 16px;
}

.agents-right-section-chevron {
  color: var(--navy);
  transition: transform 160ms ease;
}

.agents-right-section.is-open .agents-right-section-chevron {
  transform: rotate(180deg);
}

.agents-right-section-body {
  display: grid;
  gap: 14px;
  padding: 16px 24px 20px;
}

.agents-right-section-body:has(.agents-right-select-wrap.is-open) {
  overflow: visible;
}

.agents-crm-pipeline-list,
.agents-crm-pipeline-picker {
  display: grid;
  gap: 10px;
}

.agents-crm-pipeline-option,
.agents-crm-stage-option,
.agents-crm-pipeline-back,
.agents-crm-add-button {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--ink);
  border-radius: 12px;
  min-height: 44px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 800;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.agents-crm-pipeline-option {
  justify-content: flex-start;
}

.agents-crm-pipeline-option i,
.agents-crm-pipeline-option svg {
  margin-left: auto;
  width: 16px;
  height: 16px;
  color: var(--ink-soft);
}

.agents-crm-pipeline-option:hover,
.agents-crm-stage-option:hover,
.agents-crm-pipeline-back:hover {
  border-color: var(--color-focus-border);
  background: var(--color-hover);
}

.agents-crm-stage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  transition: opacity 160ms ease;
}

.agents-crm-stage-grid.is-blocked {
  pointer-events: none;
}

.agents-crm-stage-wrap {
  position: relative;
  display: grid;
  gap: 10px;
}

.agents-crm-stage-wrap.has-success .agents-crm-stage-grid {
  opacity: 0.15;
}

.agents-crm-stage-option {
  justify-content: flex-start;
  border-color: color-mix(in srgb, var(--stage-color, var(--color-accent)) 45%, var(--color-border));
  background: color-mix(in srgb, var(--stage-color, var(--color-accent)) 10%, var(--color-surface));
}

.agents-crm-selected-stage {
  min-height: 40px;
  border: 1px solid color-mix(in srgb, var(--stage-color, var(--color-accent)) 42%, var(--color-border));
  background: color-mix(in srgb, var(--stage-color, var(--color-accent)) 9%, var(--color-surface));
  border-radius: 12px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 900;
}

.agents-crm-add-button {
  justify-content: center;
  border-color: var(--navy);
  background: var(--navy);
  color: var(--color-on-accent);
}

.agents-crm-add-button:hover:not(:disabled) {
  border-color: var(--navy);
  background: var(--color-accent-pressed);
}

.agents-crm-add-button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.agents-crm-pipeline-success {
  position: absolute;
  inset: 0;
  z-index: 2;
  margin: auto;
  width: min(260px, calc(100% - 28px));
  height: max-content;
  border: 1px solid var(--color-success-border);
  background: var(--color-success);
  color: var(--color-text-inverse);
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 900;
  text-align: center;
  box-shadow: 0 14px 32px var(--color-success-soft);
}

.agents-right-field {
  display: grid;
  gap: 4px;
}

.agents-right-field-editable {
  gap: 6px;
}

.agents-right-field span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  font-weight: 700;
}

.agents-right-field span i,
.agents-right-field span svg {
  width: 13px;
  height: 13px;
}

.agents-right-field strong {
  font-size: 14px;
  color: var(--ink);
  font-weight: 700;
  word-break: break-word;
}

.agents-right-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.agents-right-input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--color-selected-strong);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 10px;
}

.agents-right-input:focus {
  outline: none;
  border-color: var(--color-accent-border);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.agents-right-field.is-readonly .agents-right-input {
  background: var(--color-surface-translucent);
  color: var(--ink);
}

.agents-right-select-wrap {
  position: relative;
}

.agents-right-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  text-align: left;
}

.agents-right-select-chevron {
  width: 15px;
  height: 15px;
  color: var(--ink-soft);
  transition: transform 160ms ease;
}

.agents-right-select-wrap.is-open .agents-right-select-chevron {
  transform: rotate(180deg);
}

.agents-right-select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 60;
  display: grid;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  box-shadow: 0 16px 34px var(--color-border);
}

.agents-right-select-option {
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  padding: 8px 10px;
  cursor: pointer;
}

.agents-right-select-option:hover,
.agents-right-select-option.is-active {
  background: var(--color-accent-soft);
  color: var(--navy);
}

.agents-right-inline-edit {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid var(--color-border);
  border-radius: 9px;
  background: var(--color-surface);
  color: var(--ink-soft);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.agents-right-inline-edit:hover {
  color: var(--navy);
  border-color: var(--color-accent-border);
}

.agents-right-inline-edit i,
.agents-right-inline-edit svg {
  width: 15px;
  height: 15px;
}

.agents-right-tags-input {
  min-height: 42px;
  border: 1px solid var(--color-selected-strong);
  border-radius: 10px;
  background: var(--color-surface);
  padding: 8px 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.agents-right-tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}

.agents-right-tag {
  min-height: 26px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.agents-right-tag.is-active {
  border-color: var(--color-accent-border);
  background: var(--color-accent-soft);
  color: var(--navy);
}

.agents-right-tag-remove {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: currentColor;
  padding: 0;
  cursor: pointer;
}

.agents-right-tag-remove i,
.agents-right-tag-remove svg {
  width: 11px;
  height: 11px;
}

.agents-right-tags-entry {
  flex: 1;
  min-width: 140px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  padding: 2px 0;
}

@container agents-right-panel (max-width: 430px) {
  .agents-right-tab {
    font-size: 15px;
  }

  .agents-right-section-title {
    font-size: 15px;
  }

  .agents-right-field span {
    font-size: 12px;
  }

  .agents-right-field strong,
  .agents-right-input {
    font-size: 15px;
  }

  .agents-right-section-toggle {
    padding-inline: 18px;
  }

  .agents-right-section-body {
    padding-inline: 22px;
  }

  .agents-right-quick-copy strong {
    font-size: 18px;
  }

  .agents-right-quick-copy span {
    font-size: 14px;
  }

  .agents-right-quick-copy small {
    font-size: 12px;
  }
}

.agents-right-tags-entry:focus {
  outline: none;
}

.agents-right-contact-status {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
}

.agents-right-contact-status.is-error {
  color: var(--color-danger);
}

.agents-right-mock {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--color-surface-translucent);
}

.agents-right-mock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.agents-right-add-note {
  min-height: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
  padding: 0 10px;
  cursor: pointer;
}

/* Waiting Chats Section */
.agents-waiting-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  flex: 1;
  min-height: 0;
}

.agents-column-title {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.agents-waiting-count {
  padding: 2px 8px;
  background: var(--color-accent-soft);
  border-radius: 6px;
  font-size: 12px;
  color: var(--navy);
  font-weight: 800;
}

.agents-waiting-list {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  flex: 1;
  padding-left: 2px;
}

.agents-waiting-list::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 10px;
  bottom: 10px;
  width: 1px;
  background: linear-gradient(
    180deg,
    var(--color-accent-soft) 0%,
    var(--color-accent-border) 18%,
    var(--color-accent-border) 82%,
    var(--color-accent-soft) 100%
  );
  pointer-events: none;
  z-index: 0;
}

.agents-waiting-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}

.agents-waiting-item {
  width: 100%;
  padding: 12px;
  background: var(--color-surface-translucent);
  border: 1px solid var(--border);
  border-radius: 11px;
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: left;
}

.agents-waiting-item:hover {
  background: var(--color-surface-translucent);
  border-color: var(--color-accent-border);
}

.agents-waiting-item.is-selected {
  background: var(--color-hover);
  border-color: var(--color-focus-border);
  box-shadow: 0 0 0 2px var(--color-accent-soft);
}

.agents-waiting-item.is-expanded {
  background: var(--color-hover);
  border-color: var(--color-focus-border);
  padding: 14px;
}

.agents-waiting-item-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.agents-waiting-item-order {
  position: relative;
  z-index: 2;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--color-surface-soft);
  border: 2px solid var(--color-accent-border);
  color: var(--color-accent);
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 9px;
  box-shadow:
    0 0 0 3px var(--color-surface-soft),
    0 1px 2px var(--color-shadow-tight);
}

.agents-waiting-row:hover .agents-waiting-item-order {
  border-color: var(--color-focus-border);
}

.agents-waiting-row.is-active .agents-waiting-item-order {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--color-text-inverse);
  box-shadow: 0 0 0 3px var(--color-selected);
}

.agents-waiting-item-subject {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
  min-width: 0;
}

.agents-waiting-item-wait {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.agents-waiting-item-wait i,
.agents-waiting-item-wait svg {
  width: 16px !important;
  height: 16px !important;
  min-width: 16px;
  min-height: 16px;
}

.agents-waiting-item-summary {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Expanded Chat Item Details */
.agents-waiting-item-expanded {
  display: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.agents-waiting-item.is-expanded .agents-waiting-item-expanded {
  display: block;
}

.agents-expanded-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 8px;
}

.agents-expanded-row:last-child {
  margin-bottom: 0;
}

.agents-expanded-label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  font-size: 11px;
}

.agents-expanded-value {
  color: var(--ink);
  font-weight: 600;
}

.agents-expanded-source {
  display: inline-block;
  padding: 2px 8px;
  background: var(--color-selected);
  border-radius: 6px;
  font-size: 12px;
}

.agents-empty-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 20px;
  color: var(--ink-soft);
  text-align: center;
  flex: 1;
}

.agents-empty-message i {
  width: 40px;
  height: 40px;
  opacity: 0.3;
  color: var(--ink-soft);
}

.agents-empty-message p {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.agents-empty-message small {
  font-size: 12px;
  color: var(--ink-soft);
}

/* Right Column - Messages Only */
.agents-messages-section {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 0;
  gap: 0;
  overflow: visible;
}

.agents-messages-section.hidden {
  display: none;
}

.agents-messages-header {
  position: relative;
  z-index: 30;
  min-height: var(--agents-header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  overflow: visible;
}

.agents-messages-header.is-preview {
  padding-right: 8px;
}

.agents-messages-header strong {
  font-size: 18px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
}

.agents-messages-close {
  width: 36px;
  min-width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--color-selected-strong);
  background: var(--color-surface-muted);
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 10px;
  transition: all 0.18s ease;
  flex: 0 0 auto;
}

.agents-messages-close:hover {
  background: var(--color-accent-soft);
  color: var(--ink);
}

.agents-messages-close i,
.agents-messages-close svg {
  width: 18px;
  height: 18px;
  display: block;
  flex: 0 0 auto;
  margin: 0;
}

/* Messages Area */
.agents-messages-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: linear-gradient(180deg, var(--color-surface) 0%, var(--color-surface-soft) 100%);
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  border-bottom: 1px solid var(--color-border);
}

.agents-messages-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--ink-soft);
  text-align: center;
}

.agents-messages-placeholder p {
  margin: 0;
  font-size: 13px;
}

.agents-message-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0;
  margin-top: 4px;
  animation: slideIn 0.2s ease;
  content-visibility: auto;
  contain: layout paint style;
  /* "auto 58px" remembers each item's real size once rendered, so scrolling
     back up does not jump when estimated heights get corrected. */
  contain-intrinsic-size: auto 58px;
}

.agents-message-item.is-failed .agents-message-bubble {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.agents-message-item.ai + .agents-message-item.human,
.agents-message-item.human + .agents-message-item.ai {
  margin-top: 20px;
}

.agents-message-day-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 16px 0 10px;
}

.agents-message-day-divider::before,
.agents-message-day-divider::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--color-selected);
}

.agents-message-day-pill {
  align-items: center;
  background: var(--color-accent-soft);
  border: 1px solid var(--color-selected);
  border-radius: 999px;
  color: var(--color-text-secondary);
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  min-height: 28px;
  padding: 0 12px;
}

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

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

.agents-message-item.ai {
  justify-content: flex-start;
  align-items: flex-start;
}

.agents-message-item.human {
  justify-content: flex-end;
  align-items: flex-end;
}

.agents-message-sender-name {
  max-width: 70%;
  margin: 0 4px 5px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.01em;
}

.agents-message-sender-label {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agents-message-ai-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  color: inherit;
}

.agents-message-ai-icon svg {
  width: 15px;
  height: 15px;
  stroke-width: 2;
}

.agents-message-bubble {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 12px;
  word-wrap: break-word;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 2px 6px;
}

.agents-message-bubble p {
  margin: 0 0 8px;
}

.agents-message-bubble p:last-child {
  margin-bottom: 0;
}

.agents-message-bubble ul,
.agents-message-bubble ol {
  margin: 0 0 8px 20px;
  padding: 0;
}

.agents-message-bubble.is-rtl ul,
.agents-message-bubble.is-rtl ol {
  margin-right: 20px;
  margin-left: 0;
  padding-right: 0;
  padding-left: 0;
}

.agents-message-bubble ul:last-child,
.agents-message-bubble ol:last-child {
  margin-bottom: 0;
}

.agents-message-bubble li {
  margin: 0 0 4px;
}

.agents-message-bubble li:last-child {
  margin-bottom: 0;
}

.agents-message-bubble strong {
  font-weight: 800;
}

.agents-message-bubble-content {
  flex: 1 1 auto;
  min-width: 0;
}

.agents-message-bubble.is-ltr .agents-message-bubble-content {
  text-align: left;
}

.agents-message-bubble.is-rtl .agents-message-bubble-content {
  text-align: right;
  unicode-bidi: plaintext;
}

.agents-message-time-inline {
  color: inherit;
  display: inline-flex;
  flex: 0 0 auto;
  direction: ltr;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  opacity: 0.62;
  padding-bottom: 1px;
  white-space: nowrap;
  unicode-bidi: isolate;
}

.agents-message-status {
  color: inherit;
  flex: 0 0 100%;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  margin-top: 4px;
  opacity: 0.58;
  text-align: right;
}

.agents-message-bubble.is-ltr .agents-message-time-inline {
  margin-left: auto;
}

.agents-message-bubble.is-rtl .agents-message-time-inline {
  margin-right: auto;
}

.agents-message-item.ai .agents-message-bubble {
  background: var(--color-message-inbound);
  color: var(--color-text-primary);
  border-bottom-left-radius: 2px;
}

.agents-message-item.human .agents-message-bubble {
  background: var(--navy);
  color: var(--color-text-inverse);
  border-bottom-right-radius: 2px;
}

/* Messages Footer & Action Buttons */
.agents-messages-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 6px 8px 8px;
  border-top: 0;
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  background: var(--color-surface);
  z-index: 40;
  overflow: visible;
}

.agents-chat-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex: 1;
  justify-content: flex-end;
}

.agents-assign-dropdown-wrapper {
  position: relative;
  z-index: 40;
  flex: 0 0 auto;
}

.agents-action-button {
  height: 36px;
  padding: 0 12px;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
  white-space: nowrap;
}

.agents-assign-trigger {
  min-width: 132px;
}

.agents-assign-trigger.is-loading {
  background: var(--color-accent-soft);
  color: var(--navy);
  cursor: wait;
  opacity: 1;
}

.agents-sound-toggle {
  width: 36px;
  padding: 0;
  min-width: 36px;
  border: 1px solid var(--color-selected-strong);
  background: var(--color-hover);
  color: var(--navy);
}

.agents-sound-toggle:hover {
  background: var(--color-selected);
}

.agents-sound-toggle.is-muted {
  color: var(--ink-soft);
  background: var(--color-surface-muted);
}

.agents-action-primary {
  width: 100%;
  max-width: 220px;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--color-danger);
  color: var(--color-text-inverse);
}

.agents-action-button i {
  width: 14px;
  height: 14px;
}

.agents-action-button .crm-button-spinner {
  width: 14px;
  height: 14px;
  border-width: 2px;
}

.agents-middle-composer {
  position: relative;
  display: grid;
  grid-template-rows: minmax(64px, auto) auto;
  gap: 0;
  align-items: stretch;
  border: 1px solid var(--color-accent-border);
  border-radius: 8px;
  background: var(--color-surface);
  box-shadow: 0 0 0 1px var(--color-accent-soft);
  overflow: visible;
}

.agents-middle-composer:focus-within {
  border-color: var(--color-info);
  box-shadow: 0 0 0 2px var(--color-focus-ring);
}

.agents-middle-composer.is-draft-mode {
  border-color: var(--color-info);
  box-shadow: 0 0 0 2px var(--color-info-soft), 0 12px 32px var(--color-shadow-tight);
}

.agents-middle-composer.is-draft-loading {
  background: linear-gradient(180deg, var(--color-surface) 0%, var(--color-surface-soft) 100%);
}

.agents-middle-composer.is-draft-requesting .agents-middle-input:disabled {
  color: color-mix(in srgb, var(--color-text-muted) 78%, var(--color-info));
  -webkit-text-fill-color: color-mix(in srgb, var(--color-text-muted) 78%, var(--color-info));
  opacity: 1;
}

.agents-middle-composer.is-draft-revealing .agents-middle-input:disabled {
  color: var(--color-text-primary);
  -webkit-text-fill-color: var(--color-text-primary);
  opacity: 1;
}

.agents-shortcuts-wrapper {
  position: relative;
  z-index: 45;
}

.agents-emoji-wrapper {
  position: relative;
  z-index: 45;
}

.agents-attachment-wrapper {
  position: relative;
  z-index: 45;
}

.agents-emoji-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 160;
  width: 232px;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  box-shadow: 0 16px 36px var(--color-shadow);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}

.agents-emoji-menu.hidden {
  display: none;
}

.agents-attachment-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 160;
  width: 248px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  box-shadow: 0 16px 36px var(--color-shadow);
  overflow: hidden;
}

.agents-attachment-menu.hidden {
  display: none;
}

.agents-attachment-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.agents-attachment-dropzone {
  width: 100%;
  height: 124px;
  border: 0;
  border-bottom: 1.5px dashed var(--color-focus-border);
  border-radius: 0;
  background: var(--color-hover);
  color: var(--navy);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.agents-attachment-dropzone:hover,
.agents-attachment-dropzone:focus-visible,
.agents-attachment-dropzone.is-dragging {
  outline: none;
  background: var(--color-accent-soft);
  border-color: var(--color-accent);
}

.agents-attachment-dropzone:active {
  transform: scale(0.99);
}

.agents-attachment-dropzone i,
.agents-attachment-dropzone svg {
  width: 24px;
  height: 24px;
}

.agents-attachment-dropzone span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
}

.agents-attachment-dropzone small {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.agents-attachment-list {
  display: grid;
  gap: 6px;
  max-height: 128px;
  overflow-y: auto;
  margin: 8px 8px 0;
}

.agents-attachment-empty {
  color: var(--ink-soft);
  font-size: 12px;
  text-align: center;
  padding: 3px 0 1px;
}

.agents-attachment-chip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 5px 5px 5px 9px;
  border: 1px solid var(--color-selected);
  border-radius: 7px;
  background: var(--color-surface-translucent);
}

.agents-attachment-file {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.agents-attachment-file strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 12px;
  font-weight: 780;
}

.agents-attachment-file small {
  color: var(--ink-soft);
  font-size: 11px;
}

.agents-attachment-chip button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.agents-attachment-chip button:hover,
.agents-attachment-chip button:focus-visible {
  outline: none;
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.agents-attachment-chip button i,
.agents-attachment-chip button svg {
  width: 14px;
  height: 14px;
}

.agents-attachment-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin-top: 8px;
  border-top: 1px solid var(--color-border-subtle);
}

.agents-attachment-clear,
.agents-attachment-add {
  width: 100%;
  height: 38px;
  border-radius: 0;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.agents-attachment-clear {
  border: 0;
  border-right: 1px solid var(--color-border-subtle);
  background: var(--color-surface);
  color: var(--color-text-secondary);
}

.agents-attachment-add {
  border: 0;
  background: var(--navy);
  color: var(--color-on-accent);
}

.agents-attachment-clear:disabled,
.agents-attachment-add:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.agents-emoji-option {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  display: grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.agents-emoji-option:hover,
.agents-emoji-option:focus-visible {
  background: var(--color-accent-soft);
  outline: none;
}

.agents-composer-toolbar {
  min-height: 52px;
  padding: 7px 10px 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.agents-composer-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

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

.agents-composer-tool,
.agents-shortcuts-trigger {
  width: 36px;
  height: 36px;
  min-height: 36px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--color-text-secondary);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease;
  font-size: 11px;
  font-weight: 850;
  padding: 0;
}

.agents-composer-tool:hover:not(:disabled),
.agents-composer-tool:focus-visible:not(:disabled),
.agents-shortcuts-trigger:hover,
.agents-shortcuts-trigger:focus-visible,
.agents-shortcuts-trigger[aria-expanded="true"] {
  background: var(--color-accent-soft);
  color: var(--navy);
}

.agents-composer-tool:disabled {
  cursor: default;
  opacity: 0.62;
}

.agents-composer-tool i,
.agents-composer-tool svg,
.agents-shortcuts-trigger i,
.agents-shortcuts-trigger svg {
  width: 20px;
  height: 20px;
}

.agents-draft-toggle {
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border: 1px solid var(--color-accent-border);
  border-radius: 6px;
  background: var(--color-info-soft);
  color: var(--color-info);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}

.agents-draft-toggle:hover:not(:disabled),
.agents-draft-toggle:focus-visible:not(:disabled),
.agents-draft-toggle.is-active {
  outline: none;
  background: var(--color-selected);
  border-color: var(--color-focus-border);
  color: var(--color-accent);
}

.agents-draft-toggle.is-reject {
  background: var(--color-danger-soft);
  border-color: var(--color-danger-border);
  color: var(--color-danger);
}

.agents-draft-toggle:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.agents-draft-toggle i,
.agents-draft-toggle svg {
  width: 15px;
  height: 15px;
}

.agents-copilot-notice {
  position: fixed;
  z-index: 1200;
  max-width: min(320px, calc(100vw - 24px));
  padding: 9px 12px;
  border: 1px solid var(--color-border-strong);
  border-radius: 7px;
  background: var(--color-surface-strong, var(--color-surface));
  color: var(--color-text-primary, var(--ink));
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -100%) translateY(4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.agents-copilot-notice::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-right: 1px solid var(--color-border-strong);
  border-bottom: 1px solid var(--color-border-strong);
  background: inherit;
  transform: translate(-50%, -4px) rotate(45deg);
}

.agents-copilot-notice.is-visible {
  opacity: 1;
  transform: translate(-50%, -100%) translateY(0);
}

.agents-copilot-notice.is-leaving {
  opacity: 0;
  transform: translate(-50%, -100%) translateY(4px);
}

.agents-copilot-notice.is-floating {
  right: 18px;
  bottom: 18px;
  transform: translateY(4px);
}

.agents-copilot-notice.is-floating::after {
  display: none;
}

.agents-copilot-notice.is-floating.is-visible {
  transform: translateY(0);
}

.agents-copilot-notice.is-floating.is-leaving {
  transform: translateY(4px);
}

.agents-attachment-trigger {
  position: relative;
}

.agents-attachment-count {
  position: absolute;
  top: 4px;
  right: 3px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--color-info);
  color: var(--color-text-inverse);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
}

.agents-attachment-count.hidden {
  display: none;
}

.agents-message-attachments {
  display: grid;
  gap: 7px;
  width: min(320px, 72vw);
  max-width: 100%;
}

.agents-message-item.human .agents-message-attachments {
  justify-self: end;
}

.agents-message-item.ai .agents-message-attachments {
  justify-self: start;
}

.agents-message-media-stack {
  display: grid;
  gap: 6px;
  max-width: min(320px, 72vw);
}

.agents-message-item.human .agents-message-media-stack {
  justify-self: end;
}

.agents-message-item.ai .agents-message-media-stack {
  justify-self: start;
}

.agents-message-image-attachment {
  display: inline-block;
  overflow: hidden;
  border-radius: 8px;
  background: transparent;
  max-width: min(320px, 72vw);
}

.agents-message-image-attachment img {
  display: block;
  width: auto;
  max-width: min(320px, 72vw);
  max-height: 260px;
  object-fit: contain;
  border-radius: 8px;
}

.agents-message-image-loading {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  width: min(260px, 66vw);
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  border: 1px solid var(--color-border-strong);
  background:
    linear-gradient(90deg, var(--color-surface-soft), var(--color-surface-muted), var(--color-surface-soft));
  background-size: 220% 100%;
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 700;
  animation: agentsAttachmentLoading 1.2s ease-in-out infinite;
}

.agents-message-image-loading i,
.agents-message-image-loading svg {
  width: 26px;
  height: 26px;
}

@keyframes agentsAttachmentLoading {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 220% 50%;
  }
}

.agents-message-image-unavailable {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--color-surface-muted);
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 700;
}

.agents-message-image-unavailable i,
.agents-message-image-unavailable svg {
  width: 17px;
  height: 17px;
}

.agents-message-video-attachment {
  display: grid;
  gap: 7px;
  width: min(320px, 72vw);
  overflow: hidden;
  border-radius: 8px;
  background: var(--color-media-background);
  box-shadow: 0 10px 24px var(--color-shadow);
}

.agents-message-video-attachment video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 280px;
  background: var(--color-media-background);
}

.agents-message-video-attachment a {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 10px 10px;
  color: var(--color-text-inverse);
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
}

.agents-message-audio-attachment {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: min(320px, 72vw);
  padding: 12px;
  border: 1px solid var(--color-selected);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text-primary);
  box-shadow: 0 10px 24px var(--color-shadow-tight);
}

.agents-message-audio-attachment > div {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.agents-message-audio-attachment strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 800;
}

.agents-message-audio-attachment audio {
  width: 100%;
  height: 32px;
}

.agents-message-file-attachment {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  width: min(320px, 72vw);
  max-width: 100%;
  min-height: 64px;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid var(--color-selected);
  background: var(--color-surface);
  color: var(--color-text-primary);
  text-decoration: none;
  box-shadow: 0 10px 24px var(--color-shadow-tight);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.agents-message-file-attachment:hover,
.agents-message-file-attachment:focus-visible {
  outline: none;
  transform: translateY(-1px);
  border-color: var(--color-accent-border);
  box-shadow: 0 13px 28px var(--color-shadow);
}

.agents-message-file-attachment.is-unavailable {
  cursor: default;
  opacity: 0.72;
}

.agents-message-file-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--color-info-soft);
  color: var(--color-info);
}

.agents-message-file-icon i,
.agents-message-file-icon svg {
  width: 20px;
  height: 20px;
}

.agents-message-file-attachment > span:not(.agents-message-file-icon) {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.agents-message-file-attachment strong,
.agents-message-file-attachment small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agents-message-file-attachment strong {
  font-size: 13px;
  font-weight: 800;
}

.agents-message-file-attachment small {
  font-size: 11px;
  color: var(--color-text-secondary);
}

.agents-message-file-download {
  width: 16px;
  height: 16px;
  color: var(--color-text-muted);
}

.agents-shortcuts-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: 340px;
  max-width: min(380px, 60vw);
  background: var(--color-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-tight);
  padding: 10px;
  z-index: 160;
}

.agents-shortcuts-menu.hidden {
  display: none;
}

.agents-shortcuts-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.agents-shortcuts-menu-head strong {
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
}

.agents-shortcuts-new {
  border: 0;
  background: var(--color-accent-soft);
  color: var(--navy);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.agents-shortcuts-menu-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
}

.agents-shortcut-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: stretch;
}

.agents-shortcut-fill {
  border: 1px solid var(--border);
  background: var(--color-surface);
  color: var(--ink);
  border-radius: 9px;
  padding: 11px 12px;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agents-shortcut-fill:hover {
  background: var(--color-hover);
  border-color: var(--color-accent-border);
}

.agents-shortcut-delete {
  width: 34px;
  border: 1px solid var(--border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  border-radius: 9px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

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

.agents-shortcut-delete i,
.agents-shortcut-delete svg {
  width: 14px;
  height: 14px;
}

.agents-shortcuts-empty {
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--ink-soft);
  font-size: 14px;
  padding: 12px;
  text-align: center;
}

.agents-middle-input {
  min-height: 64px;
  max-height: none;
  width: 100%;
  border: 0;
  border-radius: 7px 7px 0 0;
  padding: 14px 14px 8px;
  font-size: 16px;
  line-height: 1.45;
  resize: none;
  font-family: inherit;
  background: transparent;
  overflow-y: hidden;
  transition: color 160ms ease;
}

.agents-middle-input:focus {
  outline: none;
}

.agents-middle-input:disabled {
  background: var(--color-surface-muted);
  color: var(--color-text-secondary);
  border-color: var(--color-border);
  cursor: not-allowed;
}

.agents-middle-send {
  min-width: 86px;
  height: 38px;
  min-height: 38px;
  padding: 0 20px;
  align-self: center;
  border: 0;
  border-radius: 6px;
  background: var(--navy);
  color: var(--color-text-inverse);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 850;
  cursor: pointer;
  transition: background-color 0.18s ease, opacity 0.18s ease, min-width 0.18s ease;
}

.agents-middle-send-guard {
  display: inline-flex;
  align-self: center;
  position: relative;
}

.agents-middle-send-guard.is-window-blocked::before,
.agents-middle-send-guard.is-window-blocked::after {
  position: absolute;
  z-index: 40;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 80ms ease, transform 80ms ease;
}

.agents-middle-send-guard.is-window-blocked::before {
  content: "";
  right: 18px;
  bottom: calc(100% + 5px);
  width: 10px;
  height: 10px;
  background: var(--color-media-background);
  transform: translateY(4px) rotate(45deg);
}

.agents-middle-send-guard.is-window-blocked::after {
  content: attr(data-tooltip);
  right: 0;
  bottom: calc(100% + 10px);
  width: max-content;
  max-width: min(260px, calc(100vw - 32px));
  padding: 9px 12px;
  border: 1px solid color-mix(in srgb, var(--color-on-accent) 12%, transparent);
  border-radius: 7px;
  background: var(--color-media-background);
  box-shadow: 0 8px 24px var(--color-shadow);
  color: var(--color-text-inverse);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
}

.agents-middle-send-guard.is-window-blocked:hover::before,
.agents-middle-send-guard.is-window-blocked:hover::after,
.agents-middle-send-guard.is-window-blocked:focus-visible::before,
.agents-middle-send-guard.is-window-blocked:focus-visible::after,
.agents-middle-send-guard.is-window-blocked:focus-within::before,
.agents-middle-send-guard.is-window-blocked:focus-within::after {
  opacity: 1;
}

.agents-middle-send-guard.is-window-blocked:hover::before,
.agents-middle-send-guard.is-window-blocked:focus-visible::before,
.agents-middle-send-guard.is-window-blocked:focus-within::before {
  transform: translateY(0) rotate(45deg);
}

.agents-middle-send-guard.is-window-blocked:hover::after,
.agents-middle-send-guard.is-window-blocked:focus-visible::after,
.agents-middle-send-guard.is-window-blocked:focus-within::after {
  transform: translateY(0);
}

.agents-middle-send:hover,
.agents-middle-send:focus-visible {
  background: var(--color-info);
  color: var(--color-text-inverse);
}

.agents-middle-send i,
.agents-middle-send svg {
  width: 16px;
  height: 16px;
}

.agents-middle-send:disabled {
  cursor: not-allowed;
  color: var(--color-text-inverse);
  background: var(--color-selection);
  opacity: 1;
}

.agents-middle-send.is-loading i,
.agents-middle-send.is-loading svg {
  display: none;
}

.agents-middle-send.is-loading {
  font-size: 0;
}

.agents-middle-send.is-generate {
  min-width: 108px;
  background: var(--color-info);
}

.agents-middle-send.is-generate:hover,
.agents-middle-send.is-generate:focus-visible {
  background: var(--color-accent-pressed);
}

.agents-middle-send.is-accept {
  min-width: 96px;
  background: var(--color-success);
}

.agents-middle-send.is-accept:hover,
.agents-middle-send.is-accept:focus-visible {
  background: var(--color-success);
}

.agents-middle-send span {
  display: inline-flex;
  align-items: center;
}

.agents-middle-send.is-loading::after {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.38);
  border-top-color: #ffffff;
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}

.agents-assign-trigger {
  background: var(--color-selected);
  color: var(--navy);
  border: 1px solid var(--border);
}

.agents-assign-trigger:hover {
  background: var(--color-selected-strong);
  border-color: var(--color-focus-border);
}

.agents-action-primary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--color-success) 0%, var(--color-success-hover) 100%);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.24s ease;
  z-index: -1;
}

.agents-action-primary:hover {
  box-shadow: var(--shadow-tight);
}

.agents-action-primary:hover::before,
.agents-action-primary:focus-visible::before {
  transform: scaleX(1);
}

.agents-action-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

.agents-action-button.agents-assign-trigger.is-loading:disabled {
  cursor: wait;
  opacity: 1;
}

.agents-shortcut-modal .confirm-modal-backdrop {
  background: var(--color-overlay);
}

.agents-shortcut-modal-dialog {
  width: min(560px, calc(100vw - 32px));
}

.agents-shortcut-modal-input {
  width: 100%;
  min-height: 168px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
  resize: vertical;
  background: var(--color-surface);
  color: var(--ink);
  margin-top: 12px;
}

.agents-shortcut-modal-input:focus {
  border-color: var(--color-border-emphasis);
  box-shadow: 0 0 0 1px var(--color-border-subtle);
  outline: none;
}

.agents-new-whatsapp-modal .confirm-modal-backdrop {
  background: var(--color-overlay);
}

.agents-new-whatsapp-modal {
  position: absolute;
  z-index: 340;
}

.agents-new-whatsapp-dialog {
  width: min(720px, calc(100vw - 32px));
  height: calc(100vh - 48px);
  max-height: none;
  overflow: hidden;
  background: var(--color-surface);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  padding: 28px;
}

.agents-new-whatsapp-dialog [data-new-whatsapp-content] {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding-right: 4px;
}

.agents-new-whatsapp-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.agents-new-whatsapp-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 22px;
  font-weight: 900;
}

.agents-new-whatsapp-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.agents-new-whatsapp-title img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.agents-new-whatsapp-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--ink-soft);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.agents-new-whatsapp-close i,
.agents-new-whatsapp-close svg {
  width: 16px;
  height: 16px;
}

.agents-new-whatsapp-error {
  border: 1px solid color-mix(in srgb, var(--color-danger) 32%, transparent);
  border-radius: 10px;
  background: var(--color-danger-soft);
  color: var(--color-danger);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.45;
  margin-bottom: 12px;
  padding: 10px 12px;
}

.agents-new-whatsapp-existing {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  margin-bottom: 12px;
  border: 1px solid var(--color-accent-border);
  border-radius: 11px;
  background: var(--color-accent-soft);
  padding: 11px 12px;
}

.agents-new-whatsapp-existing-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--color-surface-raised);
  color: var(--color-accent);
}

.agents-new-whatsapp-existing-icon svg {
  width: 17px;
  height: 17px;
}

.agents-new-whatsapp-existing strong {
  display: block;
  color: var(--color-text-primary);
  font-size: 13px;
  font-weight: 850;
}

.agents-new-whatsapp-existing p {
  margin: 2px 0 0;
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
}

.agents-new-whatsapp-existing button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--color-accent-border);
  border-radius: 9px;
  background: var(--color-surface-raised);
  color: var(--color-accent);
  font-size: 12px;
  font-weight: 850;
  padding: 0 11px;
}

.agents-new-whatsapp-existing button:hover {
  background: var(--color-hover);
}

.agents-new-whatsapp-existing button svg {
  width: 14px;
  height: 14px;
}

.agents-new-whatsapp-grid,
.agents-new-whatsapp-preview {
  display: grid;
  gap: 10px;
}

.agents-new-whatsapp-number-picker {
  display: grid;
  gap: 8px;
}

.agents-new-whatsapp-number-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.agents-new-whatsapp-number {
  min-height: 66px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--ink);
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}

.agents-new-whatsapp-number:hover,
.agents-new-whatsapp-number.is-active {
  border-color: var(--color-accent-border);
  background: var(--color-hover);
}

.agents-new-whatsapp-number strong {
  font-size: 14px;
  font-weight: 850;
}

.agents-new-whatsapp-number span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 750;
}

.agents-new-whatsapp-phone-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.45fr) minmax(0, 1fr);
  gap: 10px;
}

.agents-new-whatsapp-field {
  display: grid;
  gap: 6px;
}

.agents-new-whatsapp-field span,
.agents-new-whatsapp-section-title {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.agents-new-whatsapp-field input,
.agents-new-whatsapp-field select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--color-selected-strong);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  padding: 8px 10px;
}

.agents-new-whatsapp-country-picker {
  position: relative;
}

.agents-new-whatsapp-country-trigger {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--color-selected-strong);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}

.agents-new-whatsapp-country-trigger i,
.agents-new-whatsapp-country-trigger svg {
  width: 15px;
  height: 15px;
  color: var(--ink-soft);
  flex: 0 0 auto;
}

.agents-new-whatsapp-country-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  box-shadow: 0 18px 40px var(--color-shadow);
  padding: 6px;
}

.agents-new-whatsapp-country-search {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--ink-soft);
  margin-bottom: 6px;
  padding: 6px 8px;
}

.agents-new-whatsapp-country-search i,
.agents-new-whatsapp-country-search svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.agents-new-whatsapp-country-search input {
  width: 100%;
  min-height: 26px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  padding: 0;
}

.agents-new-whatsapp-country-search input:focus {
  outline: none;
}

.agents-new-whatsapp-country-options {
  display: grid;
  gap: 2px;
}

.agents-new-whatsapp-country-option {
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  text-align: left;
  cursor: pointer;
}

.agents-new-whatsapp-country-option:hover,
.agents-new-whatsapp-country-option.is-active {
  background: var(--color-accent-soft);
  color: var(--navy);
}

.agents-new-whatsapp-country-option span {
  color: currentColor;
  font-size: 13px;
  font-weight: 850;
}

.agents-new-whatsapp-country-option strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}

.agents-new-whatsapp-country-empty {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 750;
  padding: 12px 8px;
  text-align: center;
}

.agents-new-whatsapp-hint {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.agents-new-whatsapp-templates {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.agents-new-whatsapp-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.agents-new-whatsapp-section-title .dashboard-loading-spinner {
  width: 16px;
  height: 16px;
}

.agents-new-whatsapp-template-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.agents-new-whatsapp-template {
  min-height: 92px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--ink);
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  text-align: left;
  cursor: pointer;
}

.agents-new-whatsapp-template:hover,
.agents-new-whatsapp-template.is-active {
  border-color: var(--color-accent-border);
  background: var(--color-accent-soft);
}

.agents-new-whatsapp-template:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.agents-new-whatsapp-template strong {
  font-size: 14px;
  font-weight: 850;
}

.agents-new-whatsapp-template span,
.agents-new-whatsapp-template small {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.agents-new-whatsapp-empty {
  grid-column: 1 / -1;
  border: 1px dashed var(--color-border-strong);
  border-radius: 10px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 750;
  padding: 16px;
  text-align: center;
}

.agents-new-whatsapp-preview {
  margin-top: 16px;
  border: 1px solid var(--color-accent-border);
  border-radius: 10px;
  background: var(--color-accent-soft);
  padding: 12px;
}

.agents-new-whatsapp-preview > strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

.agents-new-whatsapp-preview p {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.agents-new-whatsapp-params {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.agents-new-whatsapp-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: auto;
  padding-top: 18px;
}

.agents-new-whatsapp-actions .modal-button-primary {
  min-width: 150px;
  padding-left: 18px;
  padding-right: 18px;
}

@media (max-width: 680px) {
  .agents-new-whatsapp-phone-row,
  .agents-new-whatsapp-number-list,
  .agents-new-whatsapp-template-list,
  .agents-new-whatsapp-params {
    grid-template-columns: 1fr;
  }
}

/* New WhatsApp message composer */
.agents-new-whatsapp-dialog {
  width: min(760px, calc(100vw - 32px));
  height: calc(100% - 32px);
  padding: 0;
  border-color: var(--color-border-strong);
  border-radius: 18px;
  background: var(--color-surface-raised);
  box-shadow: 0 24px 64px var(--color-shadow);
}

.agents-new-whatsapp-dialog [data-new-whatsapp-content] {
  overflow: hidden;
  padding-right: 0;
}

.agents-new-whatsapp-head {
  flex: 0 0 auto;
  align-items: center;
  margin: 0;
  padding: 24px 28px 18px;
}

.agents-new-whatsapp-title {
  align-items: center;
}

.agents-new-whatsapp-title img {
  width: 34px;
  height: 34px;
}

.agents-new-whatsapp-title h3 {
  font-size: 20px;
  letter-spacing: -0.02em;
}

.agents-new-whatsapp-close {
  border-radius: 999px;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.agents-new-whatsapp-close:hover {
  border-color: var(--color-border-strong);
  background: var(--color-hover);
  transform: rotate(4deg);
}

.agents-new-whatsapp-error {
  flex: 0 0 auto;
  margin: 0 28px 14px;
}

.agents-new-whatsapp-body {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  border-top: 1px solid var(--color-border-subtle);
  padding: 24px 28px 28px;
  scrollbar-gutter: stable;
}

.agents-new-whatsapp-screen {
  display: grid;
  gap: 18px;
  animation: agents-whatsapp-step-in 180ms ease-out both;
}

@keyframes agents-whatsapp-step-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.agents-new-whatsapp-screen-intro h4 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.025em;
}

.agents-new-whatsapp-screen-intro p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.5;
}

.agents-new-whatsapp-number-list {
  grid-template-columns: 1fr;
  gap: 9px;
}

.agents-new-whatsapp-number {
  min-height: 74px;
  grid-template-columns: 42px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 12px;
  border-radius: 13px;
  padding: 12px 14px;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.agents-new-whatsapp-number:hover {
  border-color: color-mix(in srgb, var(--color-success) 34%, var(--color-border));
  background: var(--color-surface-muted);
  transform: translateY(-1px);
}

.agents-new-whatsapp-number.is-active {
  border-color: color-mix(in srgb, var(--color-success) 42%, var(--color-border));
  background: var(--color-surface-raised);
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--color-success) 72%, transparent);
}

.agents-new-whatsapp-number .agents-new-whatsapp-number-icon,
.agents-new-whatsapp-review-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: var(--color-success-soft);
  color: var(--color-success);
  display: grid;
  place-items: center;
}

.agents-new-whatsapp-number-icon svg,
.agents-new-whatsapp-review-icon svg {
  width: 19px;
  height: 19px;
}

.agents-new-whatsapp-number .agents-new-whatsapp-number-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
  color: var(--ink);
  text-transform: none;
}

.agents-new-whatsapp-number-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 850;
}

.agents-new-whatsapp-number .agents-new-whatsapp-number-copy small {
  color: var(--color-text-primary);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  opacity: 0.86;
}

.agents-new-whatsapp-number .agents-new-whatsapp-select-icon {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  color: var(--color-success);
  display: grid;
  place-items: center;
}

.agents-new-whatsapp-select-icon svg {
  width: 16px;
  height: 16px;
}

.agents-new-whatsapp-template-search {
  min-height: 50px;
  border: 1px solid var(--color-selected-strong);
  border-radius: 12px;
  background: var(--color-surface);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  cursor: text;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.agents-new-whatsapp-template-search:focus-within {
  border-color: color-mix(in srgb, var(--color-success) 58%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-success) 12%, transparent);
}

.agents-new-whatsapp-template-search > svg {
  width: 17px;
  height: 17px;
  color: var(--color-text-muted);
  flex: 0 0 auto;
}

.agents-new-whatsapp-template-search input {
  align-self: stretch;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  padding: 0;
}

.agents-new-whatsapp-template-search button {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 999px;
  background: var(--color-surface-muted);
  color: var(--ink-soft);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.agents-new-whatsapp-template-search button svg {
  width: 13px;
  height: 13px;
}

.agents-new-whatsapp-template-count {
  min-height: 14px;
  margin-top: -9px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 750;
}

.agents-new-whatsapp-template-list {
  gap: 10px;
}

.agents-new-whatsapp-template {
  min-height: 132px;
  align-content: start;
  gap: 9px;
  border-radius: 13px;
  padding: 14px;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.agents-new-whatsapp-template:hover {
  border-color: color-mix(in srgb, var(--color-success) 40%, transparent);
  background: var(--color-success-soft);
  transform: translateY(-1px);
}

.agents-new-whatsapp-template.is-active {
  border-color: color-mix(in srgb, var(--color-success) 50%, transparent);
  background: var(--color-success-soft);
}

.agents-new-whatsapp-template .agents-new-whatsapp-template-head {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
}

.agents-new-whatsapp-template-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agents-new-whatsapp-template-head > span {
  border-radius: 999px;
  background: var(--color-success-soft);
  color: var(--color-success);
  flex: 0 0 auto;
  padding: 3px 7px;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.agents-new-whatsapp-template .agents-new-whatsapp-template-preview {
  min-height: 38px;
  overflow: hidden;
  color: var(--ink-soft);
  display: -webkit-box;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.5;
  text-transform: none;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.agents-new-whatsapp-template .agents-new-whatsapp-template-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  color: var(--ink-soft);
}

.agents-new-whatsapp-template-meta small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.agents-new-whatsapp-template-meta small.is-warning {
  color: var(--color-warning);
  text-transform: none;
}

.agents-new-whatsapp-skeleton {
  pointer-events: none;
}

.agents-new-whatsapp-skeleton > span {
  min-height: 12px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--color-surface-muted) 25%,
    var(--color-surface-raised) 45%,
    var(--color-surface-muted) 65%
  );
  background-size: 220% 100%;
  animation: agents-whatsapp-skeleton 1.1s linear infinite;
}

.agents-new-whatsapp-number.agents-new-whatsapp-skeleton > span:first-child {
  width: 42px;
  height: 42px;
  border-radius: 11px;
}

.agents-new-whatsapp-number.agents-new-whatsapp-skeleton > span:last-child {
  width: 24px;
  justify-self: end;
}

.agents-new-whatsapp-template.agents-new-whatsapp-skeleton > span:nth-child(2) {
  width: 88%;
}

.agents-new-whatsapp-template.agents-new-whatsapp-skeleton > span:last-child {
  width: 50%;
}

@keyframes agents-whatsapp-skeleton {
  to {
    background-position: -220% 0;
  }
}

.agents-new-whatsapp-review {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.agents-new-whatsapp-review-card {
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 0;
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}

.agents-new-whatsapp-review-card:hover {
  background: transparent;
}

.agents-new-whatsapp-review-card:hover strong,
.agents-new-whatsapp-review-card:focus-visible strong {
  color: var(--color-success);
}

.agents-new-whatsapp-review-card:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 5px;
}

.agents-new-whatsapp-review-card .agents-new-whatsapp-review-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
}

.agents-new-whatsapp-review-card > span:nth-child(2) {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.agents-new-whatsapp-review-card small,
.agents-new-whatsapp-review-card em {
  overflow: hidden;
  color: var(--ink-soft);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  font-style: normal;
  font-weight: 750;
}

.agents-new-whatsapp-review-card small {
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.agents-new-whatsapp-review-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 850;
}

.agents-new-whatsapp-review-card .agents-new-whatsapp-change {
  color: var(--color-success);
  font-size: 10px;
  font-weight: 850;
}

.agents-new-whatsapp-preview {
  gap: 8px;
  margin-top: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 2px 0;
}

.agents-new-whatsapp-preview-label {
  color: var(--color-accent);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.agents-new-whatsapp-preview-label svg {
  width: 14px;
  height: 14px;
}

.agents-new-whatsapp-preview p {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.6;
  white-space: pre-wrap;
}

.agents-new-whatsapp-personalize,
.agents-new-whatsapp-recipient {
  display: grid;
  gap: 11px;
}

.agents-new-whatsapp-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.agents-new-whatsapp-section-heading strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

.agents-new-whatsapp-section-heading span {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.agents-new-whatsapp-recipient {
  border-top: 1px solid var(--color-border-subtle);
  padding-top: 17px;
}

.agents-new-whatsapp-field > span {
  color: var(--ink-soft);
  font-size: 10px;
}

.agents-new-whatsapp-field input,
.agents-new-whatsapp-country-trigger {
  min-height: 44px;
  border-radius: 11px;
}

.agents-new-whatsapp-field input:focus {
  border-color: color-mix(in srgb, var(--color-success) 58%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-success) 12%, transparent);
  outline: none;
}

.agents-new-whatsapp-country-trigger > span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: normal;
  text-transform: none;
}

.agents-new-whatsapp-hint {
  margin-top: -4px;
  font-size: 11px;
}

.agents-new-whatsapp-actions {
  min-height: 76px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  margin-top: 0;
  border-top: 1px solid var(--color-border-subtle);
  background: var(--color-surface);
  padding: 14px 28px;
}

.agents-new-whatsapp-actions .modal-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
}

.agents-new-whatsapp-actions .modal-button svg,
.agents-new-whatsapp-auto-hint svg {
  width: 15px;
  height: 15px;
}

.agents-new-whatsapp-actions .modal-button-primary {
  min-width: 158px;
  background: var(--color-success);
  border-color: var(--color-success);
}

.agents-new-whatsapp-actions .modal-button-primary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--color-success) 84%, var(--color-canvas));
  border-color: color-mix(in srgb, var(--color-success) 84%, var(--color-canvas));
}

.agents-new-whatsapp-actions .modal-button-secondary {
  border: 1px solid var(--color-selected-strong);
  background: var(--color-surface);
  color: var(--ink);
}

.agents-new-whatsapp-actions .modal-button-secondary:hover:not(:disabled) {
  border-color: var(--color-border-strong);
  background: var(--color-hover);
}

.agents-new-whatsapp-actions .modal-button-primary .dashboard-loading-spinner {
  width: 14px;
  height: 14px;
  border-color: color-mix(in srgb, var(--color-on-accent) 38%, transparent);
  border-top-color: var(--color-text-inverse);
}

.agents-new-whatsapp-auto-hint {
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 750;
}

@media (max-width: 680px) {
  .agents-new-whatsapp-dialog {
    width: calc(100vw - 16px);
    height: calc(100% - 16px);
    border-radius: 14px;
  }

  .agents-new-whatsapp-head {
    padding: 18px 18px 14px;
  }

  .agents-new-whatsapp-body {
    padding: 20px 18px 24px;
  }

  .agents-new-whatsapp-screen-intro h4 {
    font-size: 20px;
  }

  .agents-new-whatsapp-template-list,
  .agents-new-whatsapp-review,
  .agents-new-whatsapp-phone-row,
  .agents-new-whatsapp-params {
    grid-template-columns: 1fr;
  }

  .agents-new-whatsapp-review-card {
    grid-template-columns: 38px minmax(0, 1fr) auto;
  }

  .agents-new-whatsapp-existing {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .agents-new-whatsapp-existing button {
    grid-column: 2;
    justify-self: start;
  }

  .agents-new-whatsapp-actions {
    min-height: 70px;
    padding: 12px 18px;
  }

  .agents-new-whatsapp-auto-hint {
    display: none;
  }

  .agents-new-whatsapp-actions .modal-button-primary {
    min-width: 148px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .agents-new-whatsapp-screen,
  .agents-new-whatsapp-skeleton > span {
    animation: none;
  }
}

/* Dropdown Menu */
.agents-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: auto;
  min-width: 240px;
  margin-top: 6px;
  background: var(--color-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-tight);
  z-index: 60;
  max-height: 360px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 1;
  backdrop-filter: none;
}

.agents-assign-dropdown-wrapper .agents-dropdown-menu { width: min(920px, calc(100vw - 48px)); max-width: none; }
.agents-dropdown-menu.is-floating {
  position: fixed;
  inset: auto;
  right: auto;
  margin: 0;
  max-width: none;
  max-height: none;
  z-index: 10000;
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(4, 12, 24, 0.28), 0 2px 7px rgba(4, 12, 24, 0.18);
}
.agents-dropdown-menu.is-floating:popover-open {
  display: flex;
}
.agents-dropdown-menu.is-floating .agents-dropdown-list { flex: 1; min-height: 0; }
.agents-assignment-columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); min-height: 320px; height: 100%; }
.agents-assignment-column { min-width: 0; border-right: 1px solid var(--agents-border, rgba(127,127,127,.22)); display: flex; flex-direction: column; }
.agents-assignment-column:last-child { border-right: 0; }
.agents-assignment-column > header { display: flex; gap: 8px; align-items: center; padding: 11px 13px; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; border-bottom: 1px solid var(--agents-border, rgba(127,127,127,.22)); }
.agents-assignment-column > header svg { width: 15px; height: 15px; }
.agents-assignment-scroll { padding: 8px; overflow: auto; max-height: 380px; flex: 1; min-height: 0; }
.agents-dropdown-menu.is-floating .agents-assignment-scroll { max-height: none; }
.agents-owner-card { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; }
.agents-owner-card > svg { width: 17px; height: 17px; flex: 0 0 auto; }
.agents-owner-card span { display: grid; gap: 2px; }
.agents-owner-card small { opacity: .7; }
@media (max-width: 760px) { .agents-assignment-columns { grid-template-columns: 1fr; } .agents-assignment-column { border-right: 0; border-bottom: 1px solid var(--agents-border, rgba(127,127,127,.22)); } }

.agents-dropdown-menu.hidden {
  display: none;
}

.agents-dropdown-search {
  padding: 8px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.agents-dropdown-search input {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--color-surface);
  font-size: 14px;
  outline: none;
  transition: border-color 0.18s ease;
}

.agents-dropdown-search input:focus {
  border-color: var(--color-focus-border);
  background: var(--color-surface-translucent);
}

.agents-dropdown-list {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex: 1;
  background: var(--color-surface);
}

.agents-dropdown-empty {
  padding: 14px 12px;
  font-size: 13px;
  color: var(--ink-soft);
}

.agents-dropdown-item {
  width: 100%;
  padding: 10px 12px;
  border: none;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  font-size: 16px;
  color: var(--ink);
  background: var(--color-surface);
  transition: background 0.12s ease;
  border-bottom: 1px solid var(--color-hover);
}

.agents-dropdown-list > .agents-user-category-group {
  padding: 4px 6px 6px;
}

.agents-dropdown-list > .agents-user-category-group + .agents-user-category-group {
  margin-top: 0;
}

.agents-dropdown-item.agents-user-option {
  padding: 9px 10px;
  border-radius: 9px;
  border-bottom: 0;
}

.agents-dropdown-item .agents-user-option-name {
  font-size: 15px;
  font-weight: 800;
}

.agents-dropdown-item:last-child {
  border-bottom: none;
}

.agents-dropdown-item:hover {
  background: var(--color-accent-soft);
}

.agents-dropdown-item.selected {
  background: var(--color-selected-strong);
  color: var(--navy);
  font-weight: 600;
}

.agents-assign-confirm {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.agents-assign-progress {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 14px 12px;
  color: var(--navy);
  font-size: 13px;
  font-weight: 800;
}

.agents-assign-confirm p {
  margin: 0;
  font-size: 14px;
  color: var(--ink);
  line-height: 1.4;
}

.agents-assign-confirm-actions {
  display: flex;
  gap: 8px;
}

.agents-assign-confirm-button {
  flex: 1;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
}

.agents-assign-confirm-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.agents-assign-confirm-button.is-secondary {
  background: var(--color-surface);
  color: var(--ink-soft);
}

.agents-assign-confirm-button.is-primary {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--color-on-accent);
}

/* Empty Right Column */
.agents-empty-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
  color: var(--ink-soft);
  text-align: center;
  flex: 1;
}

.agents-empty-right i {
  width: 50px;
  height: 50px;
  opacity: 0.2;
  color: var(--ink-soft);
}

.agents-empty-right p {
  margin: 0;
  font-size: 14px;
  color: var(--ink);
}

.agents-empty-cta {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--navy);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  font-size: 15px;
  font-weight: 850;
  cursor: pointer;
  box-shadow: none;
  opacity: 0.84;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, opacity 0.14s ease;
}

.agents-empty-cta:hover,
.agents-empty-cta:focus-visible {
  border-color: var(--color-accent-soft);
  background: var(--color-hover);
  opacity: 1;
}

.agents-empty-cta svg,
.agents-empty-cta i {
  width: 18px;
  height: 18px;
  opacity: 0.7;
}

.agents-empty-icon-only {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  color: var(--color-text-disabled);
  background: transparent;
}

.agents-empty-icon-only svg,
.agents-empty-icon-only i {
  width: 28px;
  height: 28px;
  opacity: 1;
}

/* Chat Widget - Phone Width */
.agents-modal-overlay {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--color-overlay) 68%, transparent);
  backdrop-filter: blur(6px);
  z-index: 250;
  animation: fadeIn 0.2s ease;
  cursor: ew-resize;
}

.agents-modal-overlay.hidden {
  display: none;
}

.agents-modal-overlay::before {
  content: "";
  position: absolute;
  top: 20px;
  bottom: 20px;
  left: 50%;
  width: 1px;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--color-on-accent) 8%, transparent) 0%,
    color-mix(in srgb, var(--color-on-accent) 35%, transparent) 50%,
    color-mix(in srgb, var(--color-on-accent) 8%, transparent) 100%
  );
  transform: translateX(-50%);
  opacity: 0.45;
  transition: opacity 0.18s ease, box-shadow 0.18s ease;
}

.agents-modal-overlay::after {
  content: "Drag left or right to position chat • release to save";
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: color-mix(in srgb, var(--color-on-accent) 82%, transparent);
  background: color-mix(in srgb, var(--color-overlay) 72%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-on-accent) 16%, transparent);
  border-radius: 999px;
  padding: 6px 10px;
  opacity: 0.75;
  transition: opacity 0.18s ease;
  pointer-events: none;
}

.agents-modal-overlay.is-dragging::after {
  opacity: 1;
}

.agents-modal-overlay.is-near-center::before {
  opacity: 0.95;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-on-accent) 12%, transparent);
}

.agents-chat-widget {
  position: fixed;
  top: 20px;
  bottom: 20px;
  left: calc(100vw - 580px);
  right: auto;
  width: min(560px, calc(100vw - 40px));
  max-width: calc(100vw - 40px);
  height: auto;
  max-height: calc(100vh - 40px);
  background: var(--color-surface);
  border-radius: 16px;
  box-shadow: 0 20px 60px var(--color-shadow-popover);
  z-index: 260;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease;
  will-change: left;
}

.agents-chat-widget.hidden {
  display: none;
}

.agents-chat-widget.is-near-center {
  box-shadow:
    0 22px 62px var(--color-shadow-popover),
    0 0 0 2px color-mix(in srgb, var(--color-on-accent) 48%, transparent);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

.agents-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--color-accent-hover) 100%);
  color: var(--color-text-inverse);
  border-radius: 16px 16px 0 0;
  flex-shrink: 0;
  cursor: grab;
  user-select: none;
}

.agents-widget-header:active {
  cursor: grabbing;
}

.agents-widget-header strong {
  font-size: 15px;
  font-weight: 700;
}

.agents-widget-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  overflow-y: auto;
  flex: 1;
  background: var(--color-surface-soft);
}

.agents-widget-footer {
  display: flex;
  padding: 8px 10px;
  border-top: 1px solid var(--border);
  background: var(--color-surface-soft);
  border-radius: 0 0 16px 16px;
  flex-shrink: 0;
}

.agents-widget-end-header {
  height: 32px;
  padding: 0 10px;
  background: var(--color-surface);
  color: var(--color-danger);
  border: none;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.18s ease;
}

.agents-widget-end-header:hover {
  background: var(--color-surface-muted);
}

.agents-widget-end-header i {
  width: 12px;
  height: 12px;
}

.agents-widget-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: 100%;
}

.agents-widget-input {
  flex: 1;
  min-height: 42px;
  max-height: 106px;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 15px;
  line-height: 1.35;
  outline: none;
  background: var(--color-surface);
  color: var(--ink);
  resize: none;
  overflow-y: hidden;
  font-family: inherit;
}

.agents-widget-input:focus {
  border-color: var(--color-focus-border);
}

.agents-widget-input:disabled {
  background: var(--color-surface-muted);
  color: var(--color-text-secondary);
  border-color: var(--color-border);
  cursor: not-allowed;
  opacity: 1;
}

.agents-widget-send {
  position: relative;
  height: 42px;
  width: 42px;
  min-width: 42px;
  padding: 0;
  border: none;
  border-radius: 9px;
  background: var(--navy);
  color: var(--color-text-inverse);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.agents-widget-send:hover {
  background: var(--color-accent-hover);
}

.agents-widget-send i {
  width: 16px;
  height: 16px;
}

.agents-widget-send:disabled {
  cursor: not-allowed;
  background: var(--color-focus-border);
}

.agents-widget-send.is-loading i {
  display: none;
}

.agents-widget-send.is-loading svg {
  display: none;
}

.agents-widget-send.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px;
  height: 16px;
  border: 2px solid color-mix(in srgb, var(--color-on-accent) 38%, transparent);
  border-top-color: var(--color-text-inverse);
  border-radius: 50%;
  animation: agentsSpin 0.7s linear infinite;
}

@keyframes agentsSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

body.agents-widget-dragging,
body.agents-widget-dragging * {
  cursor: ew-resize !important;
}

/* Blocked UI State */
.agents-page.is-blocked .agents-inbox-rail,
.agents-page.is-blocked .agents-column {
  pointer-events: none;
}

.agents-page.is-blocked .agents-inbox-rail,
.agents-page.is-blocked .agents-column {
  opacity: 0.6;
}

/* Scrollbar Styling */
.agents-waiting-list::-webkit-scrollbar,
.agents-closed-list::-webkit-scrollbar,
.agents-messages-area::-webkit-scrollbar,
.agents-modal-messages::-webkit-scrollbar,
.agents-dropdown-list::-webkit-scrollbar {
  width: 6px;
}

.agents-waiting-list::-webkit-scrollbar-track,
.agents-closed-list::-webkit-scrollbar-track,
.agents-messages-area::-webkit-scrollbar-track,
.agents-modal-messages::-webkit-scrollbar-track,
.agents-dropdown-list::-webkit-scrollbar-track {
  background: transparent;
}

.agents-waiting-list::-webkit-scrollbar-thumb,
.agents-closed-list::-webkit-scrollbar-thumb,
.agents-messages-area::-webkit-scrollbar-thumb,
.agents-modal-messages::-webkit-scrollbar-thumb,
.agents-dropdown-list::-webkit-scrollbar-thumb {
  background: var(--color-focus-border);
  border-radius: 3px;
}

.agents-waiting-list::-webkit-scrollbar-thumb:hover,
.agents-closed-list::-webkit-scrollbar-thumb:hover,
.agents-messages-area::-webkit-scrollbar-thumb:hover,
.agents-modal-messages::-webkit-scrollbar-thumb:hover,
.agents-dropdown-list::-webkit-scrollbar-thumb:hover {
  background: rgba(7, 53, 110, 0.5);
}

.agents-preview-header,
.agents-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.6);
  border-bottom: 1px solid var(--border);
}

.agents-preview-back {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 10px;
  background: var(--color-accent-soft);
  color: var(--navy);
  cursor: pointer;
  transition: background 0.18s ease;
}

.agents-preview-back:hover {
  background: rgba(7, 53, 110, 0.15);
}

.agents-preview-back i {
  width: 18px;
  height: 18px;
}

.agents-preview-title,
.agents-chat-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.agents-preview-title strong,
.agents-chat-info strong {
  font-size: 14px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agents-preview-subtitle,
.agents-chat-duration {
  font-size: 12px;
  color: var(--ink-soft);
}

.agents-chat-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.agents-chat-close:hover {
  background: var(--color-border-subtle);
  color: var(--ink);
}

.agents-chat-close i {
  width: 18px;
  height: 18px;
}

.agents-preview-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.agents-preview-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agents-preview-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.agents-preview-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 10px;
}

.agents-preview-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.agents-preview-row span {
  color: var(--ink-soft);
}

.agents-preview-row strong {
  color: var(--ink);
  word-break: break-word;
}

.agents-preview-summary {
  margin: 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
}

.agents-preview-context {
  padding: 12px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 10px;
  font-size: 13px;
  max-height: 120px;
  overflow-y: auto;
}

.agents-preview-empty-context {
  margin: 0;
  color: var(--ink-soft);
}

.agents-preview-actions {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.agents-button {
  flex: 1;
  height: 40px;
  padding: 0 16px;
  border: none;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.agents-button i {
  width: 16px;
  height: 16px;
}

.agents-button-primary {
  background: linear-gradient(135deg, var(--navy) 0%, var(--color-accent-hover) 100%);
  color: var(--color-on-accent);
}

.agents-button-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-tight);
}

.agents-button-secondary {
  background: rgba(255, 255, 255, 0.6);
  color: var(--navy);
  border: 1px solid var(--border);
}

.agents-button-secondary:hover {
  background: rgba(255, 255, 255, 0.8);
}

.agents-button-danger {
  background: rgba(174, 43, 43, 0.12);
  color: #ae2b2b;
}

.agents-button-danger:hover {
  background: rgba(174, 43, 43, 0.2);
}

.agents-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.agents-message-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agents-message {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 70%;
}

.agents-message.agent-message {
  align-self: flex-start;
}

.agents-message.customer-message {
  align-self: flex-end;
}

.agents-message-content {
  padding: 12px 14px;
  border-radius: 12px;
  word-wrap: break-word;
}

.agents-message.agent-message .agents-message-content {
  background: #e0e0e0;
  color: #333;
  border-bottom-left-radius: 4px;
}

.agents-message.customer-message .agents-message-content {
  background: linear-gradient(135deg, var(--navy) 0%, var(--color-accent-hover) 100%);
  color: var(--color-text-inverse);
  border-bottom-right-radius: 4px;
}

.agents-message-content p {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
}

.agents-message-time {
  font-size: 11px;
  color: var(--ink-soft);
  padding: 0 14px;
}

.agents-chat-composer {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.6);
}

.agents-composer-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  resize: none;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.agents-composer-input:focus {
  border-color: rgba(7, 53, 110, 0.3);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.tasks-page {
  min-height: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  color: var(--ink);
  background: var(--color-surface-soft);
  overflow: hidden;
}

.tasks-hero,
.tasks-hero-actions,
.tasks-header-controls,
.tasks-header-filters,
.tasks-header-actions,
.tasks-dialog-actions,
.tasks-inline-detail-actions,
.tasks-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tasks-hero {
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 12px 20px;
  gap: 12px;
  background: var(--color-surface);
  border-bottom: 1px solid rgba(15, 23, 42, 0.14);
  box-shadow: none;
}

.tasks-title-block {
  flex: 0 0 auto;
}

.tasks-header-controls {
  flex: 1;
  justify-content: space-between;
  align-items: end;
  min-width: 420px;
}

.tasks-header-filters {
  justify-content: flex-start;
  align-items: end;
  min-width: 0;
}

.tasks-header-actions {
  justify-content: flex-end;
  align-items: end;
  flex: 0 0 auto;
}

.tasks-dialog-head span,
.tasks-inline-detail-head span,
.tasks-field > span,
.tasks-search > span,
.tasks-filter > span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tasks-hero h1,
.tasks-dialog-head h2,
.tasks-inline-detail-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.48rem;
  line-height: 1.1;
}

.tasks-button,
.tasks-icon-button,
.tasks-icon-action,
.tasks-more {
  border: 1px solid rgba(15, 63, 134, 0.16);
  border-radius: 8px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.tasks-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
}

.tasks-button svg,
.tasks-button i {
  width: 17px;
  height: 17px;
}

.tasks-button-primary {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--color-on-accent);
}

.tasks-button-secondary {
  background: var(--color-surface);
  color: var(--navy);
}

.tasks-icon-action {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 42px;
  background: var(--color-surface);
  color: var(--navy);
}

.tasks-icon-action svg,
.tasks-icon-action i {
  width: 18px;
  height: 18px;
}

.tasks-button-danger {
  background: #fff5f5;
  border-color: rgba(199, 56, 56, 0.28);
  color: #b42318;
}

.tasks-button:hover:not(:disabled),
.tasks-more:hover:not(:disabled),
.tasks-icon-button:hover:not(:disabled),
.tasks-icon-action:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(15, 63, 134, 0.12);
}

.tasks-button:disabled,
.tasks-more:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.tasks-search {
  flex: 1;
  min-width: 260px;
  max-width: 440px;
  display: grid;
  gap: 5px;
}

.tasks-search > div {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 12px;
  background: var(--color-surface);
  border: 1px solid rgba(15, 63, 134, 0.16);
  border-radius: 8px;
}

.tasks-search svg,
.tasks-search i {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.tasks-search input,
.tasks-filter select,
.tasks-field input,
.tasks-field textarea,
.tasks-field select,
.tasks-contact-picker input {
  width: 100%;
  border: 1px solid rgba(15, 63, 134, 0.16);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--ink);
  font: inherit;
}

.tasks-search input {
  height: 100%;
  border: 0;
  outline: 0;
  padding: 0;
}

.tasks-filter {
  display: grid;
  gap: 5px;
  min-width: 150px;
}

.tasks-filter select,
.tasks-field input,
.tasks-field select {
  height: 42px;
  padding: 0 10px;
}

.tasks-board {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  background: var(--color-surface);
  border: 0;
  border-top: 1px solid rgba(15, 23, 42, 0.18);
  box-shadow: none;
  overflow: hidden;
}

.tasks-column {
  --tasks-column-accent: #9aa4b2;
  --tasks-column-head-bg: #ffffff;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 0;
  border-right: 1px solid rgba(15, 63, 134, 0.12);
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.tasks-column:last-child {
  border-right: 0;
}

.tasks-column[data-task-column="started"] {
  --tasks-column-accent: #4f86ad;
  --tasks-column-head-bg: #e9f2f9;
}

.tasks-column[data-task-column="finished"] {
  --tasks-column-accent: #65a77d;
  --tasks-column-head-bg: #eef7f1;
}

.tasks-column.is-drag-over {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tasks-column-accent) 48%, white);
  transform: none;
}

.tasks-column-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 15px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  background: var(--tasks-column-head-bg);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

.tasks-column-head::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: 0;
  background: var(--tasks-column-accent);
  opacity: 0.62;
}

.tasks-column-head > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tasks-column-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1;
}

.tasks-column-head b {
  color: rgba(15, 23, 42, 0.58);
  font-size: 0.8rem;
  font-weight: 800;
}

.tasks-column-icon {
  width: 19px;
  height: 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--tasks-column-accent);
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.8));
}

.tasks-column-body {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  overflow: auto;
  background: var(--color-surface);
}

.tasks-column.is-drag-over .tasks-column-body:not(.is-detail)::before {
  content: "";
  position: absolute;
  inset: 10px;
  z-index: 2;
  border: 2px dotted color-mix(in srgb, var(--tasks-column-accent) 62%, white);
  border-radius: 12px;
  background: color-mix(in srgb, var(--tasks-column-accent) 10%, transparent);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42);
  pointer-events: none;
}

.tasks-column-body.is-detail {
  padding: 0;
  overflow: hidden;
}

.tasks-card {
  position: relative;
}

.tasks-card-open {
  position: relative;
  width: 100%;
  display: grid;
  gap: 10px;
  padding: 14px 14px 13px;
  text-align: left;
  background: #f7faff;
  border: 1px solid rgba(42, 67, 101, 0.12);
  border-radius: 7px;
  box-shadow: 0 6px 14px rgba(15, 35, 62, 0.07);
  color: inherit;
  cursor: grab;
  touch-action: pan-y;
  overflow: hidden;
  transform: translateY(0);
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.tasks-card-open::before {
  content: none;
}

.tasks-card-open:hover,
.tasks-card-open:focus-visible {
  background: #f1f6fd;
  border-color: rgba(47, 111, 175, 0.22);
  box-shadow: 0 8px 18px rgba(15, 35, 62, 0.1);
  transform: translateY(-1px);
  outline: none;
}

.tasks-card-open:active {
  cursor: grabbing;
}

.tasks-card.is-priority .tasks-card-open {
  background: #fbf7ee;
  border-color: var(--color-warning-soft);
  box-shadow: 0 6px 14px rgba(76, 54, 20, 0.07);
}

.tasks-card.is-priority .tasks-card-icon {
  background: #f4e7ce;
  color: #a36616;
}

.tasks-card.is-priority .tasks-card-open::before {
  content: none;
}

.tasks-card.is-dragging {
  opacity: 0.28;
}

.tasks-card.is-drop-flash .tasks-card-open {
  animation: tasks-drop-flash 760ms ease-out;
}

.tasks-inline-detail {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
}

.tasks-finish-inline {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
}

.tasks-inline-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.tasks-inline-title-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tasks-inline-detail-head h2 {
  margin-top: 0;
  font-size: 1.15rem;
  line-height: 1.22;
}

.tasks-inline-priority {
  display: inline-flex;
  color: #b7791f;
}

.tasks-inline-priority svg,
.tasks-inline-priority i {
  width: 17px;
  height: 17px;
}

.tasks-inline-detail .tasks-detail-body {
  flex: 1;
  min-height: 0;
  padding: 14px;
  align-content: start;
  grid-auto-rows: max-content;
}

.tasks-finish-inline-body {
  flex: 1;
  min-height: 0;
  padding: 14px;
  overflow: auto;
}

.tasks-finish-inline-body textarea {
  min-height: 220px;
  resize: vertical;
}

.tasks-inline-detail-actions {
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px 14px 14px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  background: #fbfcfd;
}

.tasks-inline-detail-actions > div {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tasks-inline-detail-actions .tasks-button {
  min-height: 38px;
}

.tasks-inline-edit-fields {
  display: grid;
  gap: 14px;
}

.tasks-inline-editor .tasks-field textarea {
  min-height: 150px;
}

.tasks-card-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 28px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(42, 67, 101, 0.08);
}

.tasks-card-top strong {
  flex: 1;
  min-width: 0;
  color: var(--ink);
  line-height: 1.28;
  padding-top: 3px;
}

.tasks-card-icon {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 6px;
  background: #edf2f7;
  color: #64748b;
}

.tasks-card-icon svg,
.tasks-card-icon i {
  width: 15px;
  height: 15px;
}

.tasks-card-icon.is-started {
  background: #e6f1f8;
  color: #2f78a8;
}

.tasks-card-icon.is-finished {
  background: #e7f4ec;
  color: #3f9a62;
}

.tasks-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tasks-priority-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: var(--navy);
}

.tasks-priority-badge svg,
.tasks-priority-badge i {
  width: 17px;
  height: 17px;
}

.tasks-card-meta {
  flex-wrap: wrap;
  gap: 6px;
}

.tasks-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--color-surface-muted);
  color: #42526a;
  font-size: 0.72rem;
  font-weight: 800;
}

.tasks-card-meta .tasks-assignee-name {
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: #42526a;
}

.tasks-empty-column,
.tasks-skeleton,
.tasks-more {
  min-height: 72px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(15, 63, 134, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--muted);
  font-weight: 800;
}

.tasks-empty-create {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-style: dotted;
  background: rgba(255, 255, 255, 0.74);
  color: var(--navy);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.tasks-empty-create:hover,
.tasks-empty-create:focus-visible {
  border-color: rgba(15, 63, 134, 0.32);
  background: var(--color-surface);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
  outline: none;
}

.tasks-empty-create i,
.tasks-empty-create svg {
  width: 16px;
  height: 16px;
}

.tasks-skeleton {
  min-height: 112px;
  background: linear-gradient(90deg, var(--color-surface-muted), #f9fbfd, var(--color-surface-muted));
  background-size: 200% 100%;
  animation: tasks-shimmer 1.2s linear infinite;
}

@keyframes tasks-shimmer {
  to { background-position: -200% 0; }
}

@keyframes tasks-drop-flash {
  0% {
    background: color-mix(in srgb, var(--tasks-column-accent) 8%, #ffffff);
    border-color: color-mix(in srgb, var(--tasks-column-accent) 28%, rgba(42, 67, 101, 0.12));
  }
  42% {
    background: color-mix(in srgb, var(--tasks-column-accent) 5%, #ffffff);
    border-color: color-mix(in srgb, var(--tasks-column-accent) 22%, rgba(42, 67, 101, 0.12));
  }
  100% {
    background: #f7faff;
    border-color: rgba(42, 67, 101, 0.12);
  }
}

.tasks-more {
  min-height: 40px;
  background: var(--color-surface);
}

.tasks-modal {
  position: fixed;
  inset: 0;
  z-index: 420;
  display: grid;
  place-items: center;
  padding: 24px;
}

.tasks-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(9, 22, 40, 0.32);
  backdrop-filter: blur(5px);
}

.tasks-dialog {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--color-surface-soft);
  border: 1px solid rgba(15, 63, 134, 0.18);
  border-radius: 12px;
  box-shadow: 0 28px 80px rgba(9, 22, 40, 0.28);
}

.tasks-dialog.tasks-editor {
  height: min(690px, calc(100vh - 48px));
}

.tasks-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(15, 63, 134, 0.12);
}

.tasks-icon-button {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  background: #e8eff8;
  color: var(--navy);
}

.tasks-editor-grid,
.tasks-detail-body {
  padding: 18px 20px;
  overflow: auto;
}

.tasks-editor-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.tasks-editor-grid.is-contact-picker {
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
}

.tasks-field {
  display: grid;
  gap: 7px;
}

.tasks-field-wide {
  grid-column: 1 / -1;
}

.tasks-field textarea {
  min-height: 130px;
  padding: 10px;
  resize: vertical;
}

.tasks-assignee-picker {
  position: relative;
  z-index: 5;
}

.tasks-assignee-anchor {
  position: relative;
}

.tasks-assignee-trigger {
  width: 100%;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 10px 0 12px;
  border: 1px solid rgba(15, 63, 134, 0.16);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.tasks-assignee-trigger:disabled {
  cursor: default;
  opacity: 0.82;
}

.tasks-assignee-trigger strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.tasks-assignee-trigger i,
.tasks-assignee-trigger svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.tasks-assignee-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% - 1px);
  left: 0;
  right: 0;
  display: grid;
  gap: 8px;
  padding: 0 8px 8px;
  border: 1px solid rgba(15, 63, 134, 0.16);
  border-top: 0;
  border-radius: 0 0 10px 10px;
  background: var(--color-surface);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.16);
}

.tasks-assignee-anchor:has(.tasks-assignee-menu) .tasks-assignee-trigger {
  border-radius: 8px 8px 0 0;
}

.tasks-assignee-search {
  height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid rgba(15, 63, 134, 0.14);
  border-radius: 8px;
  background: var(--color-surface-soft);
}

.tasks-assignee-search i,
.tasks-assignee-search svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.tasks-assignee-search input {
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
}

.tasks-assignee-options {
  max-height: min(220px, 32vh);
  display: grid;
  gap: 5px;
  overflow: auto;
}

.tasks-assignee-options button {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.tasks-assignee-options button:hover,
.tasks-assignee-options button.is-selected {
  border-color: rgba(15, 63, 134, 0.14);
  background: var(--color-surface-muted);
}

.tasks-assignee-options button strong,
.tasks-assignee-options button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tasks-assignee-options button span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.tasks-assignee-empty {
  padding: 12px 8px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.tasks-priority-toggle {
  min-height: 42px;
  display: grid;
  align-content: start;
  justify-items: end;
  gap: 7px;
  padding: 0;
}

.tasks-priority-switch {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

.tasks-priority-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tasks-priority-toggle span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tasks-priority-switch em {
  position: relative;
  flex: 0 0 auto;
  width: 50px;
  height: 28px;
  border-radius: 999px;
  background: #dbe3ee;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

.tasks-priority-switch em::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--color-surface);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.22);
  transition: transform 0.18s ease;
}

.tasks-priority-switch input:checked + em {
  background: #b7791f;
  box-shadow: inset 0 0 0 1px rgba(113, 63, 18, 0.18);
}

.tasks-priority-switch input:checked + em::after {
  transform: translateX(22px);
}

.tasks-priority-switch:focus-within {
  outline: none;
}

.tasks-priority-switch:focus-within em {
  box-shadow:
    inset 0 0 0 1px rgba(15, 23, 42, 0.08),
    0 0 0 3px rgba(15, 63, 134, 0.1);
}

.tasks-contact-picker {
  display: grid;
  gap: 8px;
}

.tasks-contact-chips,
.tasks-detail-contacts div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tasks-contact-chips button,
.tasks-detail-contacts span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border: 1px solid rgba(15, 63, 134, 0.14);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--navy);
  font-weight: 800;
}

.tasks-contact-chips .tasks-contact-link-chip {
  border-style: dashed;
  color: var(--navy);
  background: var(--color-surface-soft);
}

.tasks-contact-link-chip i,
.tasks-contact-link-chip svg {
  width: 15px;
  height: 15px;
}

.tasks-contact-picker-view {
  display: grid;
  gap: 12px;
}

.tasks-editor-grid.is-contact-picker .tasks-contact-picker-view {
  min-height: 0;
  height: 100%;
  grid-template-rows: auto auto minmax(0, 1fr);
}

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

.tasks-contact-picker-head span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.tasks-contact-picker-selected {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.tasks-contact-chips small,
.tasks-detail-contacts small {
  color: var(--muted);
  font-weight: 800;
}

.tasks-contact-results {
  max-height: 170px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: 6px;
  overflow: auto;
}

.tasks-contact-picker-view .tasks-contact-results {
  max-height: none;
  overflow: visible;
}

.tasks-editor-grid.is-contact-picker .tasks-contact-results {
  min-height: 0;
  overflow: auto;
}

.tasks-contact-results button {
  flex: 0 0 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  justify-content: stretch;
  gap: 12px;
  min-height: 48px;
  height: 48px;
  padding: 9px 10px;
  border: 1px solid rgba(15, 63, 134, 0.12);
  border-radius: 8px;
  background: var(--color-surface);
  color: inherit;
  cursor: pointer;
  overflow: hidden;
  text-align: left;
}

.tasks-contact-results button strong,
.tasks-contact-results button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.tasks-contact-results button strong {
  justify-self: start;
}

.tasks-contact-results button span {
  justify-self: end;
  text-align: right;
}

.tasks-detail-body {
  display: grid;
  gap: 16px;
}

.tasks-detail-description {
  display: grid;
  gap: 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.tasks-detail-description b {
  color: var(--ink);
  font-size: 0.82rem;
}

.tasks-detail-description p {
  margin: 0;
  color: var(--ink);
  font-size: 1.12rem;
  line-height: 1.62;
}

.tasks-detail-finish-note {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(37, 99, 80, 0.16);
  border-radius: 10px;
  background: rgba(241, 248, 245, 0.82);
}

.tasks-detail-finish-note b {
  color: #256350;
  font-size: 0.82rem;
}

.tasks-detail-finish-note p {
  margin: 0;
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.55;
}

.tasks-detail-meta {
  display: grid;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.tasks-detail-meta div {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: baseline;
  gap: 12px;
}

.tasks-detail-meta span {
  color: #42526a;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tasks-detail-meta strong {
  min-width: 0;
  color: var(--ink);
  font-weight: 700;
}

.tasks-detail-contacts {
  display: grid;
  gap: 8px;
  color: #42526a;
}

.tasks-detail-contacts b {
  color: var(--ink);
}

.tasks-dialog-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  padding: 14px 20px;
  border-top: 1px solid rgba(15, 63, 134, 0.12);
  background: rgba(232, 239, 248, 0.56);
}

.tasks-dialog-actions-left {
  justify-content: flex-start;
}

.tasks-error {
  margin: 16px 22px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff5f5;
  color: #b42318;
  font-weight: 800;
}

.tasks-drag-preview {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  opacity: 0.96;
  filter: drop-shadow(0 14px 24px rgba(9, 22, 40, 0.18));
  transform-origin: center;
}

.tasks-drag-preview .tasks-card-open {
  background: #f1f6fd;
  border-color: rgba(47, 111, 175, 0.24);
}

.agents-page.is-internal-only .agents-work-column,
.agents-page.is-internal-only .agents-inbox-nav,
.agents-page.is-internal-only .agents-inbox-rail-actions {
  display: none;
}

.agents-page.is-internal-only .agents-chat-grid {
  grid-template-columns: minmax(360px, 1fr);
}

@media (max-width: 980px) {
  .tasks-board {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .tasks-column {
    border-right: 0;
    border-bottom: 1px solid rgba(15, 63, 134, 0.12);
  }

  .tasks-column:last-child {
    border-bottom: 0;
  }

  .tasks-page {
    overflow: auto;
  }

  .tasks-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .tasks-header-controls {
    align-items: stretch;
    flex-direction: column;
    min-width: 0;
  }

  .tasks-header-filters,
  .tasks-header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .tasks-search,
  .tasks-filter {
    min-width: 0;
    max-width: none;
  }

  .tasks-editor-grid {
    grid-template-columns: 1fr;
  }
}

html[data-theme="dark"] {
  color-scheme: dark;
  --app-bg: var(--color-canvas);
  --bg: var(--color-canvas);
  --bg-panel: rgba(47, 44, 39, 0.86);
  --bg-soft: rgba(61, 57, 50, 0.62);
  --ink: var(--color-text-primary);
  --ink-soft: var(--color-text-secondary);
  --navy: var(--color-accent);
  --navy-deep: #f0dfc8;
  --amber: #cf8f45;
  --border: var(--color-border);
  --border-strong: var(--color-border-strong);
  --surface: var(--color-surface);
  --surface-soft: #25231f;
  --surface-muted: #37332d;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  --shadow-tight: 0 12px 28px rgba(0, 0, 0, 0.26);
  --chart-line: var(--color-accent);
  --chart-line-fill: var(--color-accent-soft);
  --chart-axis: var(--color-text-secondary);
  --chart-grid: var(--color-border);
}

html[data-theme="dark"] body,
html[data-theme="dark"] .app-shell,
html[data-theme="dark"] .portal-view,
html[data-theme="dark"] .portal-main,
html[data-theme="dark"] .portal-content {
  background: var(--color-canvas);
  color: var(--ink);
}

html[data-theme="dark"] .portal-sidebar {
  background: var(--color-panel);
  border-right-color: var(--color-border);
  box-shadow:
    inset -1px 0 0 rgba(255, 255, 255, 0.04),
    14px 0 38px rgba(0, 0, 0, 0.22);
}

html[data-theme="dark"] .portal-logo img,
html[data-theme="dark"] .login-brand img,
html[data-theme="dark"] .dashboard-loading-logo {
  filter: brightness(0) invert(0.93) sepia(0.14) saturate(0.82);
}

html[data-theme="dark"] .portal-nav-item {
  color: var(--color-text-primary);
}

html[data-theme="dark"] .portal-nav-item:hover,
html[data-theme="dark"] .portal-nav-item.is-active,
html[data-theme="dark"] .portal-utility-toggle[aria-expanded="true"],
html[data-theme="dark"] .portal-theme-toggle[aria-pressed="true"] {
  background: var(--color-accent-soft);
  color: var(--color-text-primary);
  box-shadow: inset 0 0 0 1px var(--color-accent-border);
}

html[data-theme="dark"] .portal-user-online-dot {
  box-shadow: 0 0 0 2px var(--color-panel);
}

html[data-theme="dark"] .portal-user-dropdown,
html[data-theme="dark"] .portal-utility-strip,
html[data-theme="dark"] .scale-popover,
html[data-theme="dark"] .kb-dialog,
html[data-theme="dark"] .kb-confirm-panel,
html[data-theme="dark"] .confirm-modal-dialog {
  background: var(--color-surface-raised);
  border-color: var(--border-strong);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

html[data-theme="dark"] .portal-utility-strip::before {
  background: var(--color-surface-raised);
  border-color: var(--border-strong);
}

html[data-theme="dark"] .portal-utility-strip .portal-utility-item {
  background: var(--color-border-subtle);
  border-color: var(--color-border);
  box-shadow:
    0 5px 12px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

html[data-theme="dark"] .portal-utility-strip .portal-utility-item:hover,
html[data-theme="dark"] .portal-utility-strip .portal-utility-item:focus-visible,
html[data-theme="dark"] .portal-utility-strip .portal-utility-item[aria-expanded="true"],
html[data-theme="dark"] .portal-utility-strip .portal-theme-toggle[aria-pressed="true"] {
  background: var(--color-border);
  border-color: var(--color-border-emphasis);
  color: var(--color-text-primary);
}

html[data-theme="dark"] .portal-user-dropdown-identity {
  color: var(--ink);
  border-bottom-color: var(--color-border);
}

html[data-theme="dark"] .portal-user-dropdown-name,
html[data-theme="dark"] .portal-user-shift-status strong {
  color: var(--ink);
}

html[data-theme="dark"] .portal-user-dropdown-category,
html[data-theme="dark"] .portal-user-shift-status span,
html[data-theme="dark"] .portal-user-shift-label {
  color: var(--ink-soft);
}

html[data-theme="dark"] .kb-dialog::before {
  background: var(--color-surface-raised);
  border-color: var(--border-strong);
}

html[data-theme="dark"] .login-view {
  background: var(--color-canvas);
}

html[data-theme="dark"] .login-card,
html[data-theme="dark"] .login-panel,
html[data-theme="dark"] .dashboard-loading-indicator,
html[data-theme="dark"] .crm-sidebar,
html[data-theme="dark"] .crm-main,
html[data-theme="dark"] .crm-view-shell,
html[data-theme="dark"] .crm-contact-shell,
html[data-theme="dark"] .crm-contacts-filter-panel,
html[data-theme="dark"] .crm-contacts-filter-popover,
html[data-theme="dark"] .crm-organization-detail,
html[data-theme="dark"] .crm-org-add-contact-panel,
html[data-theme="dark"] .crm-pipeline-builder-card,
html[data-theme="dark"] .crm-pipeline-column,
html[data-theme="dark"] .analytics-view,
html[data-theme="dark"] .analytics-toolbar,
html[data-theme="dark"] .ops-view,
html[data-theme="dark"] .ops-toolbar,
html[data-theme="dark"] .ops-main,
html[data-theme="dark"] .ops-empty-panel,
html[data-theme="dark"] .ops-kpi-card,
html[data-theme="dark"] .ops-monitor-panel,
html[data-theme="dark"] .ops-board-panel,
html[data-theme="dark"] .ops-channel-panel,
html[data-theme="dark"] .ops-volume-panel,
html[data-theme="dark"] .ops-health-panel,
html[data-theme="dark"] .ops-sla-panel,
html[data-theme="dark"] .ops-metric-card,
html[data-theme="dark"] .live-panel,
html[data-theme="dark"] .live-right-rail,
html[data-theme="dark"] .agents-work-column,
html[data-theme="dark"] .agents-messages-column,
html[data-theme="dark"] .agents-details-column,
html[data-theme="dark"] .agents-work-search,
html[data-theme="dark"] .agents-work-filter-menu,
html[data-theme="dark"] .tickets-sidebar-panel,
html[data-theme="dark"] .tickets-main-panel,
html[data-theme="dark"] .tickets-detail-panel,
html[data-theme="dark"] .tasks-page,
html[data-theme="dark"] .tasks-column,
html[data-theme="dark"] .tasks-detail,
html[data-theme="dark"] .tasks-editor,
html[data-theme="dark"] .kb-editor,
html[data-theme="dark"] .at-section,
html[data-theme="dark"] .at-config-row,
html[data-theme="dark"] .at-variable-card,
html[data-theme="dark"] .at-result-panel {
  background: var(--surface);
  border-color: var(--border);
  color: var(--ink);
  box-shadow: var(--shadow-tight);
}

html[data-theme="dark"] .crm-sidebar,
html[data-theme="dark"] .ops-sidebar,
html[data-theme="dark"] .live-panel-agents,
html[data-theme="dark"] .tickets-sidebar-panel,
html[data-theme="dark"] .tasks-column {
  background: var(--color-surface-soft);
}

html[data-theme="dark"] .crm-main,
html[data-theme="dark"] .ops-main,
html[data-theme="dark"] .analytics-view,
html[data-theme="dark"] .agents-messages-column,
html[data-theme="dark"] .tickets-main-panel {
  background: var(--color-canvas);
}

html[data-theme="dark"] :is(
  h1, h2, h3, h4, strong, b,
  .crm-view-header h2,
  .crm-sidebar-head strong,
  .ops-report-head h2,
  .ops-section-head h3,
  .ops-kpi-card strong,
  .ops-monitor-panel-head h3,
  .ops-monitor-kpi strong,
  .ops-metric-card strong,
  .analytics-card strong,
  .agents-work-tab,
  .tickets-detail-title,
  .tasks-card-title,
  .kb-card strong,
  .kb-editor-head strong,
  .at-section-head strong
) {
  color: var(--ink);
}

html[data-theme="dark"] :is(
  p, small, time, em,
  .crm-view-header p,
  .crm-sidebar-head p,
  .crm-toolbar-field > span,
  .crm-contacts-sort > span,
  .crm-contacts-search > span,
  .ops-report-head p,
  .ops-section-head span,
  .ops-kpi-card-copy > span,
  .ops-kpi-card em,
  .ops-monitor-panel-head span,
  .ops-monitor-chart-axis span,
  .ops-monitor-legend span,
  .ops-health-row span,
  .portal-filter-field > span,
  .analytics-filter-field > span,
  .kb-card p,
  .kb-card time,
  .at-muted,
  .at-section-head > div > span,
  .agents-user-option-category
) {
  color: var(--ink-soft);
}

html[data-theme="dark"] :is(input, textarea, select),
html[data-theme="dark"] .tickets-custom-select-trigger,
html[data-theme="dark"] .crm-search-field,
html[data-theme="dark"] .crm-toolbar-field input,
html[data-theme="dark"] .analytics-date-input,
html[data-theme="dark"] .ops-agent-search,
html[data-theme="dark"] .ops-mobile-agent-search,
html[data-theme="dark"] .live-agent-search,
html[data-theme="dark"] .agents-work-search-input,
html[data-theme="dark"] .agents-work-filter-button,
html[data-theme="dark"] .kb-search,
html[data-theme="dark"] .kb-field input,
html[data-theme="dark"] .kb-field textarea,
html[data-theme="dark"] .kb-field select {
  background: #211f1c;
  border-color: rgba(239, 231, 218, 0.15);
  color: var(--ink);
}

html[data-theme="dark"] :is(input, textarea)::placeholder {
  color: rgba(185, 176, 163, 0.68);
}

html[data-theme="dark"] :is(input, textarea, select):focus,
html[data-theme="dark"] .tickets-custom-select-trigger:focus-visible,
html[data-theme="dark"] .kb-field input:focus,
html[data-theme="dark"] .kb-field textarea:focus,
html[data-theme="dark"] .kb-field select:focus {
  border-color: rgba(217, 169, 104, 0.56);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

html[data-theme="dark"] :is(
  .kb-action-button,
  .modal-button-primary,
  .ops-load-button,
  .crm-toolbar-icon-button-primary,
  .tickets-filter-button.is-active,
  .agents-shift-button,
  .tasks-primary-button
) {
  background: var(--color-accent);
  color: #211b13;
  border-color: rgba(217, 169, 104, 0.32);
}

html[data-theme="dark"] :is(
  .kb-action-button-secondary,
  .modal-button-secondary,
  .ops-window-preset,
  .crm-toolbar-icon-button,
  .tickets-filter-button,
  .live-refresh-button,
  .tasks-secondary-button
) {
  background: rgba(239, 231, 218, 0.06);
  border-color: var(--border);
  color: var(--ink);
}

html[data-theme="dark"] :is(
  .kb-action-button-secondary:hover,
  .modal-button-secondary:hover,
  .ops-window-preset:hover:not(:disabled),
  .crm-toolbar-icon-button:hover,
  .tickets-filter-button:hover,
  .live-refresh-button:hover
) {
  background: rgba(217, 169, 104, 0.12);
  border-color: var(--color-accent-border);
  color: var(--color-text-primary);
}

html[data-theme="dark"] :is(
  .crm-sidebar-link:hover,
  .crm-sidebar-link.is-active,
  .crm-sidebar-child:hover,
  .crm-sidebar-child.is-active,
  .ops-agent-nav-row:hover,
  .ops-agent-nav-row.is-active,
  .ops-window-preset.is-active,
  .agents-work-filter-item:hover,
  .agents-work-filter-item.is-active,
  .tickets-row:hover,
  .tasks-card-open:hover
) {
  background: rgba(217, 169, 104, 0.11);
  color: var(--color-text-primary);
}

html[data-theme="dark"] .ops-agent-table-head {
  color: var(--color-accent);
}

html[data-theme="dark"] .ops-agent-table-row {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text-primary);
}

html[data-theme="dark"] .ops-agent-table-row:hover {
  background: var(--color-surface-muted);
  border-color: var(--color-border-strong);
}

html[data-theme="dark"] .ops-agent-table-row strong,
html[data-theme="dark"] .ops-agent-table-row b {
  color: var(--color-text-primary);
}

html[data-theme="dark"] .ops-agent-table-row em {
  color: var(--color-accent);
}

html[data-theme="dark"] :is(
  .crm-toolbar,
  .crm-contacts-list-toolbar,
  .crm-organization-contact-table-head,
  .ops-report-head,
  .ops-window-presets,
  .ops-mobile-agent-menu,
  .tickets-table-head,
  .agents-messages-header,
  .agents-work-list-head,
  .tasks-hero,
  .tasks-dialog-actions,
  .kb-head,
  .kb-toolbar,
  .kb-editor-actions
) {
  background: rgba(37, 35, 31, 0.92);
  border-color: var(--border);
}

html[data-theme="dark"] :is(
  .ops-monitor-grid-line,
  .ops-metric-line-grid,
  .analytics-chart-grid-line,
  .live-chat-list,
  .agents-user-category-group + .agents-user-category-group,
  .tasks-detail-meta,
  .portal-user-dropdown-identity
) {
  border-color: var(--border);
  stroke: var(--color-border);
}

html[data-theme="dark"] :is(
  .ops-volume-grid,
  .ops-monitor-grid-line,
  .analytics-chart-grid-line
) {
  stroke: var(--color-border);
}

html[data-theme="dark"] :is(
  .ops-monitor-line.is-volume,
  .ops-metric-line-stroke,
  .analytics-chart-line
) {
  stroke: var(--chart-line);
}

html[data-theme="dark"] :is(
  .ops-metric-line-area,
  .analytics-chart-area
) {
  fill: var(--color-accent-soft);
}

html[data-theme="dark"] :is(
  .ops-kpi-icon,
  .ops-metric-icon,
  .crm-sidebar-brand-icon,
  .kb-card-icon,
  .at-run-summary i
) {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}

html[data-theme="dark"] :is(
  .ops-kpi-card.is-warn,
  .ops-monitor-kpi.is-warn
) {
  border-color: rgba(207, 143, 69, 0.34);
}

html[data-theme="dark"] :is(
  .ops-kpi-card.is-bad,
  .ops-monitor-kpi.is-bad,
  .portal-error,
  .tasks-error,
  .kb-error
) {
  border-color: rgba(219, 100, 92, 0.34);
  background: rgba(109, 45, 41, 0.2);
  color: var(--color-danger);
}

html[data-theme="dark"] :is(
  .ops-kpi-delta,
  .ops-health-row b,
  .crm-active-filter-chip,
  .crm-organization-pill,
  .agents-right-org-pill,
  .at-variable-pill,
  .at-category-chip
) {
  background: rgba(239, 231, 218, 0.07);
  border-color: var(--border);
  color: var(--ink);
}

html[data-theme="dark"] :is(
  .ops-kpi-delta.is-good,
  .ops-health-row em.is-good,
  .ops-sla-summary-head em.is-good
) {
  color: var(--color-success);
}

html[data-theme="dark"] :is(
  .ops-kpi-delta.is-bad,
  .ops-health-row em.is-bad,
  .ops-sla-summary-head em.is-bad
) {
  color: var(--color-danger);
}

html[data-theme="dark"] :is(
  .at-method-switch,
  .at-permission-mode,
  .at-switch-field span,
  .crm-pipeline-active-toggle span,
  .crm-pipeline-admin-toggle span
) {
  background: #1f1d1a;
  border-color: var(--color-border);
}

html[data-theme="dark"] :is(
  .at-method-option.is-active,
  .at-permission-option.is-active
) {
  background: rgba(217, 169, 104, 0.15);
  color: var(--color-text-primary);
}

html[data-theme="dark"] :is(
  .at-switch-field input:checked + span,
  .at-required-toggle.is-on,
  .crm-pipeline-active-toggle input:checked + span,
  .crm-pipeline-admin-toggle input:checked + span
) {
  background: var(--color-accent);
}

html[data-theme="dark"] :is(
  .at-switch-field span::after,
  .at-required-toggle > span,
  .crm-pipeline-active-toggle span::after,
  .crm-pipeline-admin-toggle span::after
) {
  background: var(--color-text-inverse);
}

html[data-theme="dark"] :is(
  .kb-empty,
  .ops-empty-state,
  .analytics-empty-chart,
  .live-empty,
  .crm-active-filters-empty
) {
  background: rgba(239, 231, 218, 0.045);
  border-color: var(--border);
  color: var(--ink-soft);
}

html[data-theme="dark"] ::selection {
  background: var(--color-accent-border);
  color: var(--color-text-inverse);
}

/* Dark mode refinements: flatter Claude-like charcoal surfaces, less amber saturation. */
html[data-theme="dark"] {
  --app-bg: var(--color-canvas);
  --bg: var(--color-canvas);
  --bg-panel: rgba(39, 37, 33, 0.92);
  --bg-soft: rgba(48, 45, 40, 0.72);
  --ink: var(--color-text-primary);
  --ink-soft: var(--color-text-secondary);
  --navy: var(--color-accent);
  --navy-deep: #e8dfd0;
  --amber: var(--color-accent);
  --surface: var(--color-surface);
  --surface-soft: var(--color-surface-soft);
  --surface-muted: var(--color-surface-muted);
  --border: var(--color-border);
  --border-strong: var(--color-border-strong);
  --chart-line: var(--color-accent);
  --chart-line-fill: rgba(185, 154, 109, 0.09);
  --chart-axis: var(--color-text-secondary);
  --chart-grid: var(--color-border);
}

html[data-theme="dark"] body,
html[data-theme="dark"] .app-shell,
html[data-theme="dark"] .portal-view,
html[data-theme="dark"] .portal-main,
html[data-theme="dark"] .portal-content {
  background: var(--color-canvas);
}

html[data-theme="dark"] .portal-sidebar {
  background: var(--color-panel);
  border-right-color: var(--color-border);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.035);
}

html[data-theme="dark"] .portal-nav-item:hover,
html[data-theme="dark"] .portal-nav-item.is-active,
html[data-theme="dark"] .portal-theme-toggle[aria-pressed="true"] {
  background: var(--color-border-subtle);
  color: var(--color-text-primary);
  box-shadow: inset 0 0 0 1px var(--color-border);
}

html[data-theme="dark"] .portal-nav-item.is-active::before {
  background: #8f8476;
}

html[data-theme="dark"] :is(
  .ops-report,
  .ops-report-grid,
  .ops-command-center,
  .ops-command-main,
  .ops-kpi-section,
  .ops-monitor-layout,
  .ops-support-grid,
  .analytics-shell,
  .crm-page,
  .crm-view-shell,
  .agents-page,
  .tickets-page,
  .tasks-page
) {
  background: transparent;
}

html[data-theme="dark"] .ops-report.is-loading :is(
  .ops-metric-card,
  .ops-kpi-card,
  .ops-sla-summary-card,
  .ops-board-panel,
  .ops-monitor-kpi,
  .ops-monitor-panel
) {
  background: var(--color-surface);
}

html[data-theme="dark"] :is(
  .ops-monitor-kpi,
  .ops-chartjs-volume,
  .ops-monitor-chat-volume-panel,
  .ops-monitor-panel,
  .ops-board-panel,
  .ops-channel-panel,
  .ops-kpi-card,
  .ops-metric-card,
  .ops-sla-card,
  .ops-health-row,
  .ops-sla-summary-stats div,
  .analytics-card,
  .analytics-chart-card,
  .tickets-table-shell,
  .tickets-detail-shell,
  .tickets-detail-top,
  .tickets-detail-info,
  .tickets-detail-chat,
  .tasks-card-open,
  .tasks-detail-card,
  .surface-card,
  .hero-card,
  .app-card,
  .module-card,
  .metric-card,
  .surface-subcard
) {
  background: var(--color-surface);
  border-color: var(--border);
  color: var(--ink);
  box-shadow: none;
}

html[data-theme="dark"] :is(
  .ops-monitor-kpi,
  .ops-board-panel,
  .ops-monitor-panel,
  .ops-kpi-card
) {
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.035), 0 14px 34px rgba(0, 0, 0, 0.18);
}

html[data-theme="dark"] .ops-monitor-bar-row i {
  --bar-color: var(--color-text-secondary);
  background: linear-gradient(90deg, var(--bar-color) var(--bar-width), var(--color-border-subtle) 0);
}

html[data-theme="dark"] .ops-monitor-bar-row.is-attention i {
  --bar-color: var(--color-warning);
}

html[data-theme="dark"] .ops-monitor-bar-row.is-risk i {
  --bar-color: var(--color-danger);
}

html[data-theme="dark"] .ops-monitor-line.is-rate,
html[data-theme="dark"] .ops-monitor-line.is-volume,
html[data-theme="dark"] .ops-metric-line-stroke {
  stroke: var(--color-accent);
}

html[data-theme="dark"] .ops-monitor-line.is-created,
html[data-theme="dark"] .ops-monitor-line.is-opened {
  stroke: #d56f8d;
}

html[data-theme="dark"] .ops-monitor-line.is-closed {
  stroke: #4cae9b;
}

html[data-theme="dark"] .ops-monitor-line.is-queue {
  stroke: #7d72d8;
}

html[data-theme="dark"] .ops-monitor-chart-axis span,
html[data-theme="dark"] .ops-monitor-legend span,
html[data-theme="dark"] .ops-monitor-bar-row span,
html[data-theme="dark"] .ops-monitor-bar-row b {
  color: var(--color-text-secondary);
}

html[data-theme="dark"] .agents-page {
  --agents-inbox-bg: var(--color-canvas);
  background: var(--color-canvas);
}

html[data-theme="dark"] :is(
  .agents-chat-grid,
  .agents-inbox-rail,
  .agents-work-column,
  .agents-work-section,
  .agents-work-list,
  .agents-messages-column,
  .agents-messages-section,
  .agents-messages-area,
  .agents-messages-footer,
  .agents-details-column,
  .agents-empty-right,
  .agents-right-panel,
  .agents-right-section,
  .agents-work-filter-menu
) {
  background: var(--color-canvas);
  color: var(--ink);
}

html[data-theme="dark"] :is(
  .agents-inbox-rail,
  .agents-work-column,
  .agents-messages-column,
  .agents-details-column,
  .agents-work-search,
  .agents-work-list-head,
  .agents-messages-header,
  .agents-messages-footer
) {
  border-color: var(--border);
}

html[data-theme="dark"] .agents-inbox-rail {
  background: var(--color-surface-soft);
  box-shadow: inset -1px 0 0 var(--color-border-subtle);
}

html[data-theme="dark"] .agents-inbox-nav-item,
html[data-theme="dark"] .agents-inbox-new-chat,
html[data-theme="dark"] .agents-internal-item,
html[data-theme="dark"] .agents-work-item {
  background: transparent;
  border-color: transparent;
  color: var(--color-text-secondary);
}

html[data-theme="dark"] :is(
  .agents-inbox-nav-item:hover,
  .agents-inbox-nav-item.is-active,
  .agents-inbox-new-chat:hover,
  .agents-internal-item:hover,
  .agents-internal-item.is-active,
  .agents-work-item:hover,
  .agents-work-item.is-active
) {
  background: var(--color-border-subtle);
  border-color: var(--color-border-subtle);
  color: var(--color-text-primary);
  box-shadow: none;
}

html[data-theme="dark"] :is(
  .agents-work-search,
  .agents-work-search-input,
  .agents-work-filter-button,
  .agents-work-filter-menu,
  .agents-messages-placeholder,
  .agents-empty-message
) {
  background: var(--color-surface-soft);
  color: var(--ink);
  border-color: var(--border);
}

html[data-theme="dark"] :is(
  .agents-inbox-rail-head h2,
  .agents-work-item-title,
  .agents-work-item-title strong,
  .agents-work-item-head,
  .agents-messages-header strong,
  .agents-empty-cta
) {
  color: var(--ink);
}

html[data-theme="dark"] :is(
  .agents-work-item-assignee,
  .agents-work-item-age,
  .agents-work-item-info,
  .agents-internal-item span,
  .agents-inbox-rail-head p,
  .agents-empty-message,
  .agents-messages-placeholder
) {
  color: var(--ink-soft);
}

html[data-theme="dark"] .agents-right-pipeline-list-wrap.is-collapsed::after {
  background: linear-gradient(180deg, rgba(31, 30, 28, 0), var(--color-canvas) 88%);
}

html[data-theme="dark"] :is(
  .kb-action-button,
  .modal-button-primary,
  .ops-load-button,
  .crm-toolbar-icon-button-primary,
  .tickets-filter-button.is-active,
  .agents-shift-button,
  .tasks-primary-button
) {
  background: #bda989;
  color: var(--color-text-inverse);
}

html[data-theme="dark"] :is(
  .kb-action-button-secondary:hover,
  .modal-button-secondary:hover,
  .ops-window-preset:hover:not(:disabled),
  .ops-window-preset.is-active,
  .crm-toolbar-icon-button:hover,
  .tickets-filter-button:hover,
  .live-refresh-button:hover
) {
  background: var(--color-border-subtle);
  border-color: var(--color-border-strong);
  color: var(--color-text-primary);
}

html[data-theme="dark"] :is(
  .ops-kpi-icon,
  .ops-metric-icon,
  .crm-sidebar-brand-icon,
  .kb-card-icon,
  .at-run-summary i
) {
  background: var(--color-border-subtle);
  color: var(--color-accent);
}

@media (min-width: 721px) {
  html[data-theme="dark"] .portal-nav::before {
    border-color: var(--color-border);
    background: var(--color-border-subtle);
    box-shadow: none;
  }

  html[data-theme="dark"] .portal-nav .portal-nav-item.is-active {
    color: var(--color-text-primary);
  }
}

html[data-theme="dark"] .portal-theme-toggle[aria-pressed="true"] {
  background: transparent;
  color: var(--color-text-primary);
  box-shadow: none;
}

html[data-theme="dark"] .portal-theme-toggle:hover,
html[data-theme="dark"] .portal-theme-toggle:focus-visible {
  background: var(--color-border-subtle);
  color: var(--color-text-primary);
  box-shadow: inset 0 0 0 1px var(--color-border);
}

/* Final dark-mode neutral pass: keep warmth, remove orange/brown cast. */
html[data-theme="dark"] {
  --app-bg: var(--color-canvas);
  --bg: var(--color-canvas);
  --bg-panel: rgba(42, 42, 40, 0.94);
  --bg-soft: rgba(50, 50, 47, 0.72);
  --ink: var(--color-text-primary);
  --ink-soft: var(--color-text-secondary);
  --navy: var(--color-accent);
  --navy-deep: var(--color-text-primary);
  --amber: var(--color-accent);
  --surface: var(--color-surface);
  --surface-soft: var(--color-surface-soft);
  --surface-muted: var(--color-surface-muted);
  --border: var(--color-border);
  --border-strong: var(--color-border-strong);
  --chart-line: var(--color-accent);
  --chart-line-fill: var(--color-accent-soft);
  --chart-axis: var(--color-text-secondary);
  --chart-grid: var(--color-border-subtle);
}

html[data-theme="dark"] body,
html[data-theme="dark"] .app-shell,
html[data-theme="dark"] .portal-view,
html[data-theme="dark"] .portal-main,
html[data-theme="dark"] .portal-content,
html[data-theme="dark"] .agents-page,
html[data-theme="dark"] .agents-chat-grid,
html[data-theme="dark"] .agents-work-column,
html[data-theme="dark"] .agents-work-section,
html[data-theme="dark"] .agents-work-list,
html[data-theme="dark"] .agents-messages-column,
html[data-theme="dark"] .agents-messages-section,
html[data-theme="dark"] .agents-messages-area,
html[data-theme="dark"] .agents-messages-footer,
html[data-theme="dark"] .agents-details-column,
html[data-theme="dark"] .agents-empty-right {
  background: var(--color-canvas);
}

html[data-theme="dark"] .portal-sidebar {
  background: var(--color-panel);
  border-right-color: var(--color-border);
}

html[data-theme="dark"] :is(
  .portal-nav-item,
  .portal-theme-toggle[aria-pressed="true"]
) {
  color: var(--color-text-primary);
}

html[data-theme="dark"] :is(
  .portal-nav-item:hover,
  .portal-nav-item.is-active,
  .portal-theme-toggle:hover,
  .portal-theme-toggle:focus-visible
) {
  background: var(--color-border-subtle);
  color: var(--color-text-primary);
  box-shadow: inset 0 0 0 1px var(--color-border);
}

html[data-theme="dark"] :is(
  .portal-user-dropdown,
  .scale-popover,
  .kb-dialog,
  .kb-confirm-panel,
  .confirm-modal-dialog,
  .login-card,
  .login-panel,
  .dashboard-loading-indicator,
  .crm-sidebar,
  .crm-main,
  .crm-view-shell,
  .crm-contact-shell,
  .crm-contacts-filter-panel,
  .crm-contacts-filter-popover,
  .crm-organization-detail,
  .crm-org-add-contact-panel,
  .crm-pipeline-builder-card,
  .crm-pipeline-column,
  .analytics-toolbar,
  .ops-toolbar,
  .ops-empty-panel,
  .ops-kpi-card,
  .ops-monitor-panel,
  .ops-board-panel,
  .ops-channel-panel,
  .ops-volume-panel,
  .ops-health-panel,
  .ops-sla-panel,
  .ops-metric-card,
  .live-panel,
  .live-right-rail,
  .agents-work-search,
  .agents-work-filter-menu,
  .tickets-sidebar-panel,
  .tickets-main-panel,
  .tickets-detail-panel,
  .tasks-column,
  .tasks-detail,
  .tasks-editor,
  .kb-card,
  .kb-editor,
  .at-section,
  .at-config-row,
  .at-variable-card,
  .at-result-panel,
  .ops-monitor-kpi,
  .ops-chartjs-volume,
  .ops-monitor-chat-volume-panel,
  .analytics-card,
  .analytics-chart-card,
  .tickets-table-shell,
  .tickets-detail-shell,
  .tickets-detail-top,
  .tickets-detail-info,
  .tickets-detail-chat,
  .tasks-card-open,
  .tasks-detail-card,
  .surface-card,
  .hero-card,
  .app-card,
  .module-card,
  .metric-card,
  .surface-subcard
) {
  background: var(--color-surface);
  border-color: var(--border);
}

html[data-theme="dark"] :is(
  input,
  textarea,
  select,
  .tickets-custom-select-trigger,
  .crm-search-field,
  .crm-toolbar-field input,
  .analytics-date-input,
  .ops-agent-search,
  .ops-mobile-agent-search,
  .live-agent-search,
  .agents-work-search-input,
  .agents-work-filter-button,
  .kb-search,
  .kb-field input,
  .kb-field textarea,
  .kb-field select,
  .agents-messages-placeholder,
  .agents-empty-message
) {
  background: var(--color-surface-soft);
  border-color: var(--color-border);
  color: var(--ink);
}

html[data-theme="dark"] :is(input, textarea, select):focus,
html[data-theme="dark"] .tickets-custom-select-trigger:focus-visible,
html[data-theme="dark"] .kb-field input:focus,
html[data-theme="dark"] .kb-field textarea:focus,
html[data-theme="dark"] .kb-field select:focus {
  border-color: rgba(170, 164, 154, 0.54);
  box-shadow: 0 0 0 3px rgba(170, 164, 154, 0.12);
}

html[data-theme="dark"] :is(
  .kb-action-button,
  .modal-button-primary,
  .ops-load-button,
  .crm-toolbar-icon-button-primary,
  .tickets-filter-button.is-active,
  .agents-shift-button,
  .tasks-primary-button
) {
  background: var(--color-accent);
  border-color: rgba(170, 164, 154, 0.32);
  color: var(--color-on-accent);
}

html[data-theme="dark"] :is(
  .kb-action-button-secondary:hover,
  .modal-button-secondary:hover,
  .ops-window-preset:hover:not(:disabled),
  .ops-window-preset.is-active,
  .crm-toolbar-icon-button:hover,
  .tickets-filter-button:hover,
  .live-refresh-button:hover,
  .crm-sidebar-link:hover,
  .crm-sidebar-link.is-active,
  .crm-sidebar-child:hover,
  .crm-sidebar-child.is-active,
  .ops-agent-nav-row:hover,
  .ops-agent-nav-row.is-active,
  .agents-work-filter-item:hover,
  .agents-work-filter-item.is-active,
  .agents-inbox-nav-item:hover,
  .agents-inbox-nav-item.is-active,
  .agents-inbox-new-chat:hover,
  .agents-internal-item:hover,
  .agents-internal-item.is-active,
  .agents-work-item:hover,
  .agents-work-item.is-active
) {
  background: var(--color-border-subtle);
  border-color: var(--color-border);
  color: var(--color-text-primary);
}

html[data-theme="dark"] :is(
  .ops-kpi-icon,
  .ops-metric-icon,
  .crm-sidebar-brand-icon,
  .kb-card-icon,
  .at-run-summary i,
  .at-method-option.is-active,
  .at-permission-option.is-active
) {
  background: var(--color-border-subtle);
  color: var(--color-text-secondary);
}

html[data-theme="dark"] :is(
  .at-switch-field input:checked + span,
  .at-required-toggle.is-on,
  .crm-pipeline-active-toggle input:checked + span,
  .crm-pipeline-admin-toggle input:checked + span
) {
  background: var(--color-accent);
}

html[data-theme="dark"] :is(
  .ops-monitor-line.is-rate,
  .ops-monitor-line.is-volume,
  .ops-metric-line-stroke,
  .analytics-chart-line
) {
  stroke: var(--color-accent);
}

html[data-theme="dark"] :is(
  .ops-metric-line-area,
  .analytics-chart-area
) {
  fill: var(--color-accent-soft);
}

html[data-theme="dark"] .ops-monitor-bar-row i {
  --bar-color: var(--color-text-secondary);
  background: linear-gradient(90deg, var(--bar-color) var(--bar-width), var(--color-border-subtle) 0);
}

html[data-theme="dark"] .ops-monitor-bar-row.is-attention i {
  --bar-color: var(--color-warning);
}

html[data-theme="dark"] .ops-monitor-bar-row.is-risk i {
  --bar-color: var(--color-danger);
}

html[data-theme="dark"] .agents-right-pipeline-list-wrap.is-collapsed::after {
  background: linear-gradient(180deg, rgba(32, 32, 31, 0), var(--color-canvas) 88%);
}

html[data-theme="dark"] ::selection {
  background: rgba(170, 164, 154, 0.3);
  color: #f5f2ec;
}

html[data-theme="dark"] :is(
  .crm-sidebar-child-skeleton,
  .crm-table-skeleton-row,
  .agents-work-skeleton-row,
  .crm-pipeline-loading-column,
  .tasks-skeleton,
  .tickets-list-loading,
  .analytics-users-placeholder,
  .agents-resolve-loading,
  .agents-right-conversations-loading,
  .agents-right-notes-loading,
  .agents-right-conversation-notes-loading,
  .dashboard-loading-indicator,
  .crm-empty-box,
  .crm-empty-state,
  .crm-drawer-empty
) {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--ink-soft);
  box-shadow: none;
}

html[data-theme="dark"] :is(
  .crm-sidebar-skeleton-dot,
  .crm-sidebar-skeleton-line,
  .crm-table-skeleton-cell,
  .agents-work-skeleton-icon,
  .agents-work-skeleton-line,
  .crm-pipeline-loading-column header span,
  .crm-pipeline-loading-column header strong,
  .crm-pipeline-loading-column > div span
) {
  background: var(--color-border);
  border-color: var(--color-border-subtle);
}

html[data-theme="dark"] .crm-pipeline-loading-column header {
  background: var(--color-surface-soft);
  border-bottom-color: var(--color-border-subtle);
}

html[data-theme="dark"] .crm-pipeline-loading-column > div span {
  background: var(--color-border-subtle);
}

html[data-theme="dark"] .agents-work-skeleton-row {
  background: var(--color-canvas);
  border-bottom-color: var(--color-border-subtle);
}

html[data-theme="dark"] .tasks-skeleton {
  background: linear-gradient(90deg, var(--color-surface-soft), #33322f, var(--color-surface-soft));
  background-size: 200% 100%;
}

html[data-theme="dark"] .ops-report.is-loading :is(
  .ops-metric-card,
  .ops-kpi-card,
  .ops-sla-summary-card,
  .ops-board-panel,
  .ops-monitor-kpi,
  .ops-monitor-panel,
  .ops-window-presets
) {
  background: var(--color-surface);
  border-color: var(--color-border);
}

html[data-theme="dark"] .ops-report.is-loading :is(
  .ops-metric-icon,
  .ops-kpi-icon,
  .ops-metric-delta,
  .ops-kpi-delta,
  .ops-health-row b,
  .ops-monitor-stack-bar span,
  .ops-monitor-bar-row i
) {
  background: var(--color-border-subtle);
}

html[data-theme="dark"] .ops-report.is-loading :is(
  .ops-volume-line,
  .ops-metric-line-stroke,
  .ops-monitor-line
) {
  stroke: var(--color-border-emphasis);
}

html[data-theme="dark"] .ops-report.is-loading .ops-metric-line-area {
  fill: var(--color-border-subtle);
}

html[data-theme="dark"] .dashboard-loading-spinner,
html[data-theme="dark"] .crm-button-spinner {
  border-color: var(--color-border-strong);
  border-top-color: var(--color-accent);
}

/* CRM dark-mode completion pass. */
html[data-theme="dark"] :is(
  .crm-pipeline-board-wrap,
  .crm-pipeline-builder,
  .crm-contact-main,
  .crm-contact-body,
  .crm-drawer-body,
  .crm-drawer-conversation-body,
  .crm-organizations-layout,
  .crm-table-shell,
  .tickets-table-shell
) {
  background: var(--color-canvas);
  color: var(--ink);
}

html[data-theme="dark"] .crm-pipeline-board-wrap {
  background: var(--color-canvas);
}

html[data-theme="dark"] :is(
  .crm-pipeline-column,
  .crm-pipeline-column.is-unassigned,
  .crm-pipeline-card,
  .crm-pipeline-note-card,
  .crm-duplicate-card,
  .crm-duplicate-item,
  .crm-contact-card,
  .crm-contact-side,
  .crm-contact-drawer-panel,
  .crm-drawer-section,
  .crm-drawer-detail-list div,
  .crm-contact-conversation-item,
  .crm-organization-detail,
  .crm-organization-contact-table-head,
  .crm-organization-contact,
  .crm-org-add-contact-panel,
  .crm-organization-membership-card,
  .crm-contact-organization-add,
  .crm-pipeline-membership-pill,
  .crm-pipeline-stage-editor,
  .crm-pipeline-stage-drag,
  .crm-pipeline-admin-toggle,
  .crm-pipeline-sidebar-preview,
  .crm-filter-menu-panel,
  .crm-contacts-filter-popover,
  .crm-active-filter-chip,
  .contacts-detail-card,
  .contacts-duplicate-item,
  .tickets-table-controls,
  .tickets-table-pagination,
  .tickets-detail-shell,
  .tickets-detail-top,
  .tickets-detail-info,
  .tickets-detail-chat,
  .tickets-note-item,
  .tickets-assign-current,
  .tickets-assign-dropdown
) {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--ink);
  box-shadow: none;
}

html[data-theme="dark"] :is(
  .crm-pipeline-column-head,
  .crm-pipeline-column.is-unassigned .crm-pipeline-column-head,
  .crm-pipeline-card-top,
  .crm-duplicate-card-top,
  .crm-contact-head,
  .crm-contact-card-head,
  .crm-contact-drawer-head,
  .crm-drawer-tabs,
  .crm-toolbar,
  .crm-contacts-list-toolbar,
  .crm-organizations-toolbar,
  .tickets-table th,
  .tickets-detail-footer
) {
  background: var(--color-surface-soft);
  border-color: var(--color-border);
  color: var(--ink);
  box-shadow: none;
}

html[data-theme="dark"] :is(
  .crm-pipeline-card:hover,
  .crm-contact-conversation-item:hover,
  .crm-contact-conversation-item.is-active,
  .crm-organization-contact:hover,
  .crm-table-row:hover,
  .tickets-table tbody tr:hover,
  .tickets-table-row.is-selected,
  .tickets-custom-select-option:hover,
  .tickets-custom-select-option.is-selected,
  .crm-filter-check:hover,
  .crm-active-filter-chip:hover
) {
  background: var(--color-border-subtle);
  border-color: var(--color-border);
  color: var(--ink);
}

html[data-theme="dark"] :is(
  .crm-pipeline-card strong,
  .crm-pipeline-card-top strong,
  .crm-pipeline-note-card p,
  .crm-contact-card-head h2,
  .crm-contact-drawer-head h2,
  .crm-organization-detail-head h2,
  .crm-organization-contact strong,
  .crm-organization-membership-title,
  .tickets-table td,
  .tickets-detail-item strong,
  .tickets-detail-item p
) {
  color: var(--ink);
}

html[data-theme="dark"] :is(
  .crm-pipeline-card p,
  .crm-pipeline-card-info span,
  .crm-pipeline-card-info b,
  .crm-pipeline-added-by,
  .crm-pipeline-meta,
  .crm-contact-card-head p,
  .crm-contact-drawer-head p,
  .crm-drawer-detail-list dt,
  .crm-drawer-detail-list dd,
  .crm-duplicate-card small,
  .crm-duplicate-item span,
  .crm-organization-detail-head p,
  .crm-organization-contact span,
  .crm-organization-contact small,
  .crm-organization-pill small,
  .crm-pipeline-membership-pill small,
  .crm-contacts-total,
  .tickets-table th,
  .tickets-pagination-status,
  .tickets-pagination-size-suffix,
  .tickets-empty-row
) {
  color: var(--ink-soft);
}

html[data-theme="dark"] .crm-pipeline-column,
html[data-theme="dark"] .crm-pipeline-column.is-unassigned,
html[data-theme="dark"] .crm-pipeline-column-body {
  background: var(--color-canvas);
}

html[data-theme="dark"] .crm-pipeline-card,
html[data-theme="dark"] .crm-pipeline-note-card {
  background: var(--color-surface-soft);
  box-shadow: none;
}

html[data-theme="dark"] .crm-pipeline-card:hover {
  background: #2a2d31;
}

html[data-theme="dark"] .crm-pipeline-card-top {
  background: var(--color-surface-muted);
  border-color: var(--color-border-subtle);
}

html[data-theme="dark"] :is(
  .ops-agent-nav-skeleton-avatar,
  .ops-agent-nav-skeleton-line
) {
  background: linear-gradient(90deg, var(--color-border-subtle), var(--color-border-strong), var(--color-border-subtle));
  background-size: 220% 100%;
}

html[data-theme="dark"] :is(
  .crm-pipeline-gender-icon,
  .crm-pipeline-person-icon,
  .crm-pipeline-note-icon,
  .crm-pipeline-column-add,
  .crm-toolbar-icon-button,
  .crm-popover-close,
  .tickets-pagination-button,
  .tickets-filter-button,
  .tickets-back-button,
  .tickets-note-add,
  .tickets-note-action,
  .tickets-custom-select-trigger
) {
  background: var(--color-surface-soft);
  border-color: var(--color-border);
  color: var(--ink);
  box-shadow: none;
}

html[data-theme="dark"] .crm-pipeline-column-add {
  border: 0;
  border-left: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  background: transparent;
  box-shadow: none;
}

html[data-theme="dark"] .crm-pipeline-column-add:hover {
  background: var(--color-border-subtle);
}

html[data-theme="dark"] :is(
  .crm-search-field input,
  .crm-toolbar-field input,
  .crm-contacts-filter-grid .crm-toolbar-field input,
  .crm-organizations-toolbar .crm-toolbar-field input,
  .crm-pipeline-stage-fields input,
  .crm-detail-field input,
  .crm-detail-field textarea,
  .contacts-detail-field input,
  .contacts-detail-field textarea,
  .tickets-filter-field input,
  .tickets-filter-field select,
  .tickets-pagination-size input,
  .tickets-note-compose textarea
) {
  background: var(--color-surface-soft);
  border-color: var(--color-border);
  color: var(--ink);
}

html[data-theme="dark"] :is(
  .tickets-custom-select-menu,
  .tickets-filter-field select option,
  .tickets-assign-option
) {
  background: var(--color-surface);
  color: var(--ink);
}

html[data-theme="dark"] .tickets-filter-field select {
  background-image: none;
}

html[data-theme="dark"] :is(
  .crm-pipeline-view-more,
  .crm-column-empty,
  .crm-empty-box,
  .crm-empty-state,
  .crm-drawer-empty,
  .contacts-detail-empty,
  .contacts-duplicates-list,
  .crm-duplicates-list
) {
  background: var(--color-border-subtle);
  border-color: var(--color-border);
  color: var(--ink-soft);
}

html[data-theme="dark"] .crm-pipeline-card.drag-before::before,
html[data-theme="dark"] .crm-pipeline-card.drag-after::after {
  background: var(--color-accent);
  box-shadow:
    0 0 0 2px var(--color-canvas),
    0 5px 16px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] :is(
  .crm-pipeline-card.is-landing:not(.crm-pipeline-note-card),
  .crm-pipeline-note-card.is-landing
) {
  animation-name: crmPipelineCardLandingDark;
}

html[data-theme="dark"] .crm-pipeline-card.is-landing:not(.crm-pipeline-note-card) .crm-pipeline-card-top {
  animation-name: crmPipelineCardTopLandingDark;
}

html[data-theme="dark"] .crm-pipeline-note-card.is-landing {
  animation-name: crmPipelineNoteLandingDark;
}

@keyframes crmPipelineCardLandingDark {
  0% {
    opacity: 0.62;
    background-color: color-mix(in srgb, var(--stage-color, var(--color-accent)) 12%, var(--color-surface-soft));
  }
  68% {
    background-color: color-mix(in srgb, var(--stage-color, var(--color-accent)) 7%, var(--color-surface-soft));
  }
  100% {
    opacity: 1;
    background-color: var(--color-surface-soft);
  }
}

@keyframes crmPipelineCardTopLandingDark {
  0% {
    background: color-mix(in srgb, var(--stage-color, var(--color-accent)) 9%, var(--color-surface-muted));
  }
  100% {
    background: var(--color-surface-muted);
  }
}

@keyframes crmPipelineNoteLandingDark {
  0% {
    opacity: 0.62;
    background: color-mix(in srgb, var(--stage-color, var(--color-accent)) 10%, var(--color-surface-soft));
  }
  100% {
    opacity: 1;
    background: var(--color-surface-soft);
  }
}

html[data-theme="dark"] .crm-contact-drawer-backdrop {
  background: rgba(0, 0, 0, 0.52);
}

html[data-theme="dark"] :is(
  .crm-pipeline-board-wrap,
  .crm-pipeline-column-body,
  .crm-table-shell,
  .tickets-table-shell,
  .crm-drawer-body
) {
  scrollbar-color: var(--color-border-emphasis) transparent;
}

html[data-theme="dark"] :is(
  .crm-pipeline-board-wrap::-webkit-scrollbar-thumb,
  .crm-pipeline-column-body::-webkit-scrollbar-thumb
) {
  background: var(--color-border-strong);
}

html[data-theme="dark"] .crm-pipeline-column-body.is-drag-over {
  background: var(--color-border-subtle);
  box-shadow: inset 0 0 0 1px var(--color-border-subtle);
}

html[data-theme="dark"] :is(
  .crm-drag-preview,
  .crm-drag-preview.crm-pipeline-card,
  .crm-drag-preview .crm-pipeline-card
) {
  background: var(--color-surface);
  border-color: var(--color-border-strong);
  color: var(--ink);
  box-shadow:
    0 22px 54px rgba(0, 0, 0, 0.42),
    0 0 0 1px var(--color-border-subtle);
}

html[data-theme="dark"] :is(
  .crm-drag-preview .crm-pipeline-card-top,
  .crm-drag-preview.crm-pipeline-card .crm-pipeline-card-top,
  .crm-drag-preview.crm-pipeline-note-card
) {
  background: var(--color-surface-soft);
  border-color: var(--color-border);
}

html[data-theme="dark"] :is(
  .crm-drag-preview p,
  .crm-drag-preview .crm-pipeline-card-info span,
  .crm-drag-preview .crm-pipeline-card-info b,
  .crm-drag-preview .crm-pipeline-added-by,
  .crm-drag-preview .crm-pipeline-meta
) {
  color: var(--ink-soft);
}

/* Dark header controls should read as embedded controls, not black blocks. */
html[data-theme="dark"] :is(
  .crm-contacts-filter-panel,
  .crm-contacts-list-toolbar,
  .crm-organizations-toolbar,
  .tickets-table-controls,
  .analytics-toolbar,
  .ops-toolbar,
  .agents-work-search,
  .agents-messages-header,
  .kb-head,
  .kb-toolbar
) {
  background: var(--color-surface);
  border-color: var(--color-border);
}

html[data-theme="dark"] :is(
  .crm-contacts-filter-panel,
  .crm-contacts-list-toolbar,
  .crm-organizations-toolbar,
  .tickets-table-controls,
  .analytics-toolbar,
  .ops-toolbar,
  .agents-work-search,
  .kb-toolbar
) :is(
  input,
  select,
  textarea,
  .crm-search-field,
  .tickets-custom-select-trigger,
  .tickets-filter-button:not(.tickets-filter-button-primary),
  .crm-toolbar-icon-button:not(.crm-toolbar-icon-button-primary),
  .analytics-date-input,
  .ops-agent-search,
  .kb-search
) {
  background: var(--color-surface-muted);
  border-color: var(--color-border-strong);
  color: var(--ink);
  box-shadow: none;
}

html[data-theme="dark"] :is(
  .crm-contacts-filter-panel,
  .crm-contacts-list-toolbar,
  .crm-organizations-toolbar,
  .tickets-table-controls,
  .analytics-toolbar,
  .ops-toolbar,
  .agents-work-search,
  .kb-toolbar
) :is(
  input,
  select,
  textarea,
  .crm-search-field,
  .tickets-custom-select-trigger,
  .tickets-filter-button:not(.tickets-filter-button-primary),
  .crm-toolbar-icon-button:not(.crm-toolbar-icon-button-primary),
  .analytics-date-input,
  .ops-agent-search,
  .kb-search
):hover {
  background: #343431;
  border-color: var(--color-border-strong);
}

html[data-theme="dark"] .tickets-table th {
  background: var(--color-surface);
  border-color: var(--color-border-subtle);
}

html[data-theme="dark"] .tickets-table-pagination {
  background: var(--color-surface);
  border-top-color: var(--color-border);
}

html[data-theme="dark"] :is(
  .contacts-modal-dialog,
  .contacts-modal-dialog-wide:has(.crm-create-tabs) .contacts-modal-actions,
  .crm-add-card-tab-panel,
  .crm-add-existing-panel,
  .contacts-export-dialog,
  .contacts-card-info-dialog,
  .contacts-stage-delete-dialog
) {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

html[data-theme="dark"] .contacts-modal-backdrop {
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(5px);
}

html[data-theme="dark"] :is(
  .contacts-modal-head,
  .crm-create-tabs,
  .contacts-modal-dialog-wide:has(.crm-create-tabs) .contacts-modal-actions
) {
  border-color: var(--color-border);
}

html[data-theme="dark"] .contacts-modal-head h3 {
  color: var(--ink);
}

html[data-theme="dark"] :is(
  .contacts-modal-head p,
  .contacts-modal .contacts-detail-field span,
  .contacts-modal .crm-contact-tab,
  .contacts-modal .crm-add-existing-empty,
  .contacts-modal .contacts-import-toolbar span
) {
  color: var(--ink-soft);
}

html[data-theme="dark"] .contacts-modal .crm-contact-tab.is-active {
  color: var(--color-text-primary);
}

html[data-theme="dark"] .contacts-modal .crm-create-tabs .crm-contact-tab::after {
  background: #d2c8b4;
}

html[data-theme="dark"] .contacts-modal :is(
  .contacts-detail-field input,
  .contacts-detail-field textarea,
  .tickets-custom-select-trigger,
  .crm-add-existing-search input
) {
  background: var(--color-surface-soft);
  border-color: var(--color-border-strong);
  color: var(--ink);
  box-shadow: none;
}

html[data-theme="dark"] .contacts-modal :is(
  .contacts-detail-field input,
  .contacts-detail-field textarea,
  .tickets-custom-select-trigger,
  .crm-add-existing-search input
):focus {
  border-color: var(--color-accent-border);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

html[data-theme="dark"] .contacts-modal :is(
  .contacts-detail-field input::placeholder,
  .contacts-detail-field textarea::placeholder,
  .crm-add-existing-search input::placeholder
) {
  color: var(--color-text-muted);
}

html[data-theme="dark"] .contacts-modal :is(
  .tickets-custom-select-menu,
  .crm-add-existing-list,
  .contacts-stage-delete-option
) {
  background: var(--color-surface-soft);
  border-color: var(--color-border);
  color: var(--ink);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
}

html[data-theme="dark"] .contacts-modal .contacts-stage-delete-option:hover {
  background: var(--color-border-subtle);
  border-color: var(--color-border-strong);
}

html[data-theme="dark"] [data-organization-create-modal] .contacts-modal-dialog {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--ink);
}

html[data-theme="dark"] [data-organization-create-modal] :is(
  .contacts-form-grid,
  .contacts-modal-actions
) {
  background: transparent;
  color: var(--ink);
}

html[data-theme="dark"] [data-organization-create-modal] .contacts-detail-field input {
  background: var(--color-surface-soft);
  border-color: var(--color-border-strong);
  color: var(--ink);
}

html[data-theme="dark"] [data-organization-create-modal] .contacts-detail-field input::placeholder {
  color: var(--color-text-muted);
}

html[data-theme="dark"] .tasks-page {
  background: var(--color-canvas);
  color: var(--ink);
}

html[data-theme="dark"] :is(
  .tasks-hero,
  .tasks-board,
  .tasks-column,
  .tasks-column-body,
  .tasks-dialog,
  .tasks-dialog-head,
  .tasks-dialog-actions,
  .tasks-inline-detail,
  .tasks-finish-inline,
  .tasks-inline-detail-head,
  .tasks-inline-detail-actions,
  .tasks-detail-body,
  .tasks-editor-grid,
  .tasks-contact-picker-view
) {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--ink);
  box-shadow: none;
}

html[data-theme="dark"] .tasks-board {
  background: var(--color-canvas);
  border-top-color: var(--color-border);
}

html[data-theme="dark"] .tasks-column {
  --tasks-column-head-bg: var(--color-surface-soft);
  background: var(--color-surface-soft);
  border-color: var(--color-border);
}

html[data-theme="dark"] .tasks-column[data-task-column="started"] {
  --tasks-column-head-bg: rgba(72, 124, 156, 0.16);
}

html[data-theme="dark"] .tasks-column[data-task-column="finished"] {
  --tasks-column-head-bg: rgba(88, 145, 107, 0.16);
}

html[data-theme="dark"] .tasks-column-head {
  background: var(--tasks-column-head-bg);
  border-color: var(--color-border);
  color: var(--ink);
}

html[data-theme="dark"] :is(
  .tasks-column-head h3,
  .tasks-column-head b,
  .tasks-card-top strong,
  .tasks-inline-detail-head h2,
  .tasks-dialog-head h2,
  .tasks-detail-description b,
  .tasks-detail-description p,
  .tasks-detail-meta strong,
  .tasks-detail-contacts b,
  .tasks-contact-results button strong
) {
  color: var(--ink);
}

html[data-theme="dark"] :is(
  .tasks-dialog-head span,
  .tasks-inline-detail-head span,
  .tasks-field > span,
  .tasks-search > span,
  .tasks-filter > span,
  .tasks-priority-toggle span,
  .tasks-card p,
  .tasks-card-meta span,
  .tasks-detail-meta span,
  .tasks-detail-contacts,
  .tasks-detail-contacts small,
  .tasks-contact-picker-head span,
  .tasks-contact-chips small,
  .tasks-contact-results button span,
  .tasks-assignee-options button span,
  .tasks-assignee-empty
) {
  color: var(--ink-soft);
}

html[data-theme="dark"] :is(
  .tasks-search > div,
  .tasks-search input,
  .tasks-filter select,
  .tasks-field input,
  .tasks-field textarea,
  .tasks-field select,
  .tasks-contact-picker input,
  .tasks-assignee-trigger,
  .tasks-assignee-search
) {
  background: var(--color-surface-soft);
  border-color: var(--color-border-strong);
  color: var(--ink);
  box-shadow: none;
}

html[data-theme="dark"] :is(
  .tasks-search input::placeholder,
  .tasks-field input::placeholder,
  .tasks-field textarea::placeholder,
  .tasks-contact-picker input::placeholder,
  .tasks-assignee-search input::placeholder
) {
  color: var(--color-text-muted);
}

html[data-theme="dark"] :is(
  .tasks-search > div:focus-within,
  .tasks-filter select:focus,
  .tasks-field input:focus,
  .tasks-field textarea:focus,
  .tasks-field select:focus,
  .tasks-contact-picker input:focus,
  .tasks-assignee-trigger:focus-visible,
  .tasks-assignee-search:focus-within
) {
  border-color: var(--color-accent-border);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

html[data-theme="dark"] :is(
  .tasks-card-open,
  .tasks-empty-create,
  .tasks-more,
  .tasks-contact-results button,
  .tasks-contact-chips button,
  .tasks-detail-contacts span,
  .tasks-assignee-menu,
  .tasks-assignee-options button,
  .tasks-icon-button,
  .tasks-icon-action,
  .tasks-button-secondary
) {
  background: var(--color-surface-soft);
  border-color: var(--color-border);
  color: var(--ink);
  box-shadow: none;
}

html[data-theme="dark"] :is(
  .tasks-empty-create:hover,
  .tasks-more:hover:not(:disabled),
  .tasks-contact-results button:hover,
  .tasks-assignee-options button:hover,
  .tasks-assignee-options button.is-selected,
  .tasks-icon-button:hover:not(:disabled),
  .tasks-icon-action:hover:not(:disabled),
  .tasks-button-secondary:hover:not(:disabled)
) {
  background: var(--color-border-subtle);
  border-color: var(--color-border-strong);
  color: var(--ink);
}

html[data-theme="dark"] .tasks-button-primary {
  background: var(--color-accent-pressed);
  border-color: var(--color-accent-pressed);
  color: var(--color-on-accent-pressed);
}

html[data-theme="dark"] .tasks-button-primary:hover:not(:disabled) {
  background: var(--color-text-secondary);
  border-color: var(--color-text-secondary);
  color: var(--color-on-accent-hover);
}

html[data-theme="dark"] .tasks-button-danger {
  background: rgba(206, 76, 76, 0.1);
  border-color: var(--color-danger-soft);
  color: #ffb5b5;
}

html[data-theme="dark"] .tasks-modal-backdrop {
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(5px);
}

html[data-theme="dark"] .tasks-dialog {
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

html[data-theme="dark"] .tasks-detail-description,
html[data-theme="dark"] .tasks-detail-meta,
html[data-theme="dark"] .tasks-contact-picker-selected {
  border-color: var(--color-border);
}

html[data-theme="dark"] .tasks-detail-finish-note {
  background: rgba(76, 156, 120, 0.1);
  border-color: rgba(76, 156, 120, 0.22);
}

html[data-theme="dark"] .tasks-detail-finish-note b {
  color: #9fd2b7;
}

html[data-theme="dark"] .tasks-priority-switch em {
  background: #3a3a36;
  box-shadow: inset 0 0 0 1px var(--color-border);
}

html[data-theme="dark"] .tasks-priority-switch em::after {
  background: var(--color-text-primary);
}

html[data-theme="dark"] .tasks-priority-switch input:checked + em {
  background: #9c7f53;
  box-shadow: inset 0 0 0 1px rgba(210, 200, 180, 0.18);
}

html[data-theme="dark"] :is(
  .kb-dialog,
  .kb-head,
  .kb-toolbar,
  .kb-body,
  .kb-editor,
  .kb-card,
  .kb-editor-actions
) {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--ink);
  box-shadow: none;
}

html[data-theme="dark"] .kb-dialog {
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

html[data-theme="dark"] :is(
  .kb-head h2,
  .kb-card h3,
  .kb-editor-head strong,
  .kb-empty strong
) {
  color: var(--ink);
}

html[data-theme="dark"] :is(
  .kb-card p,
  .kb-card time,
  .kb-editor-head span,
  .kb-field,
  .kb-empty p
) {
  color: var(--ink-soft);
}

html[data-theme="dark"] .kb-list,
html[data-theme="dark"] .kb-card {
  background: var(--color-surface);
  color: var(--color-text-primary);
  box-shadow: none;
}

html[data-theme="dark"] .kb-card {
  border-color: var(--color-border);
}

html[data-theme="dark"] .kb-card h3 {
  color: var(--color-text-primary);
}

html[data-theme="dark"] .kb-card p {
  color: var(--color-text-secondary);
}

html[data-theme="dark"] .kb-card time {
  color: var(--color-text-muted);
}

html[data-theme="dark"] .kb-card:hover,
html[data-theme="dark"] .kb-card:focus-within {
  background: var(--color-hover);
}

html[data-theme="dark"] :is(
  .kb-action-button,
  .kb-action-button-secondary,
  .kb-icon-button,
  .kb-editor-actions .modal-button-primary,
  .kb-editor-actions .modal-button-secondary
) {
  background: var(--color-accent-pressed);
  border: 1px solid var(--color-border-strong);
  color: var(--color-on-accent-pressed);
  box-shadow: none;
}

html[data-theme="dark"] :is(
  .kb-action-button:hover:not(:disabled),
  .kb-action-button-secondary:hover:not(:disabled),
  .kb-icon-button:hover:not(:disabled),
  .kb-editor-actions .modal-button-primary:hover:not(:disabled),
  .kb-editor-actions .modal-button-secondary:hover:not(:disabled)
) {
  background: var(--color-text-secondary);
  border-color: rgba(232, 229, 222, 0.24);
  color: var(--color-on-accent-hover);
}

html[data-theme="dark"] :is(
  .kb-close,
  .kb-card-actions .kb-icon-button,
  .kb-editor-head .kb-icon-button
) {
  background: var(--color-border-subtle);
  border-color: var(--color-border);
  color: var(--color-text-primary);
}

html[data-theme="dark"] :is(
  .kb-close:hover:not(:disabled),
  .kb-card-actions .kb-icon-button:hover:not(:disabled),
  .kb-editor-head .kb-icon-button:hover:not(:disabled)
) {
  background: var(--color-border);
  color: var(--ink);
}

html[data-theme="dark"] .kb-icon-button-danger {
  background: var(--color-danger-soft);
  border-color: var(--color-danger-soft);
  color: #ff9f9f;
}

html[data-theme="dark"] .kb-icon-button-danger:hover:not(:disabled) {
  background: rgba(206, 76, 76, 0.18);
  border-color: rgba(206, 76, 76, 0.36);
  color: var(--color-danger);
}

html[data-theme="dark"] :is(
  .kb-search,
  .kb-field input,
  .kb-field textarea,
  .kb-field select
) {
  background: var(--color-surface-soft);
  border-color: var(--color-border-strong);
  color: var(--ink);
}

html[data-theme="dark"] .kb-search input {
  color: var(--ink);
}

html[data-theme="dark"] :is(
  .kb-search svg,
  .kb-action-button svg,
  .kb-icon-button svg
) {
  color: currentColor;
}

html[data-theme="dark"] :is(
  .kb-field input,
  .kb-field textarea,
  .kb-field select,
  .kb-search
):focus-within {
  border-color: var(--color-accent-border);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

html[data-theme="dark"] :is(
  .agents-messages-header,
  .agents-messages-footer,
  .agents-right-tabs,
  .agents-right-content,
  .agents-right-details,
  .agents-right-quick-card,
  .agents-right-section,
  .agents-right-section-body,
  .agents-right-conversations,
  .agents-right-notes
) {
  background: var(--color-canvas);
  border-color: var(--color-border);
  color: var(--ink);
}

html[data-theme="dark"] .agents-messages-area {
  background: var(--color-canvas);
  border-color: var(--color-border-subtle);
}

html[data-theme="dark"] :is(
  .agents-right-tab,
  .agents-message-sender-name,
  .agents-right-conversation-head span,
  .agents-right-conversation-item p,
  .agents-right-conversation-notes-title,
  .agents-right-conversation-notes-empty,
  .agents-right-field span,
  .agents-right-quick-copy small,
  .agents-right-pipeline-list > small,
  .agents-right-org-list > small
) {
  color: var(--ink-soft);
}

html[data-theme="dark"] .agents-right-tab.is-active {
  color: var(--ink);
}

html[data-theme="dark"] .agents-right-tab.is-active::after {
  background: var(--color-text-secondary);
}

html[data-theme="dark"] :is(
  .agents-message-day-divider::before,
  .agents-message-day-divider::after
) {
  background: var(--color-border-subtle);
}

html[data-theme="dark"] .agents-message-day-pill {
  background: var(--color-surface-soft);
  border-color: var(--color-border-subtle);
  color: var(--color-text-secondary);
}

html[data-theme="dark"] .agents-message-item.ai .agents-message-bubble {
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border-subtle);
  color: var(--color-text-primary);
  box-shadow: none;
}

html[data-theme="dark"] .agents-message-item.human .agents-message-bubble {
  background: var(--color-accent-pressed);
  color: var(--color-surface-soft);
  box-shadow: none;
}

html[data-theme="dark"] .agents-message-item.is-failed .agents-message-bubble {
  background: var(--color-danger-soft);
  border-color: var(--color-danger-soft);
  color: var(--color-danger);
}

html[data-theme="dark"] .agents-message-time-inline,
html[data-theme="dark"] .agents-message-status {
  color: currentColor;
  opacity: 0.68;
}

html[data-theme="dark"] .agents-message-item.human .agents-message-time-inline,
html[data-theme="dark"] .agents-message-item.human .agents-message-status {
  opacity: 0.58;
}

html[data-theme="dark"] :is(
  .agents-middle-composer,
  .agents-emoji-menu,
  .agents-attachment-menu,
  .agents-attachment-chip,
  .agents-shortcuts-menu,
  .agents-shortcut-fill,
  .agents-shortcut-delete
) {
  background: var(--color-surface-soft);
  border-color: var(--color-border);
  color: var(--ink);
  box-shadow: none;
}

html[data-theme="dark"] .agents-middle-composer {
  box-shadow: 0 0 0 1px var(--color-border-subtle);
}

html[data-theme="dark"] .agents-middle-composer:focus-within {
  border-color: var(--color-accent-border);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

html[data-theme="dark"] .agents-middle-input {
  color: var(--ink);
  background: transparent;
}

html[data-theme="dark"] .agents-middle-input::placeholder {
  color: rgba(232, 229, 222, 0.46);
}

html[data-theme="dark"] .agents-attachment-dropzone {
  background: var(--color-border-subtle);
  border-color: var(--color-border-strong);
  color: var(--color-text-primary);
}

html[data-theme="dark"] .agents-attachment-dropzone:hover,
html[data-theme="dark"] .agents-attachment-dropzone:focus-visible,
html[data-theme="dark"] .agents-attachment-dropzone.is-dragging {
  background: var(--color-border-subtle);
  border-color: rgba(232, 229, 222, 0.36);
}

html[data-theme="dark"] .agents-attachment-clear {
  background: var(--color-border-subtle);
  border-color: var(--color-border-subtle);
  color: var(--color-text-primary);
}

html[data-theme="dark"] .agents-attachment-add {
  background: var(--color-accent-pressed);
  color: var(--color-on-accent-pressed);
}

html[data-theme="dark"] .agents-composer-toolbar {
  border-top: 1px solid var(--color-border-subtle);
  background: var(--color-surface);
}

html[data-theme="dark"] :is(
  .agents-composer-tool,
  .agents-shortcuts-trigger,
  .agents-sound-toggle,
  .agents-messages-close,
  .agents-right-inline-edit,
  .agents-right-add-mini
) {
  background: rgba(232, 229, 222, 0.065);
  border-color: var(--color-border);
  color: var(--color-text-primary);
}

html[data-theme="dark"] :is(
  .agents-composer-tool:hover:not(:disabled),
  .agents-composer-tool:focus-visible:not(:disabled),
  .agents-shortcuts-trigger:hover,
  .agents-shortcuts-trigger:focus-visible,
  .agents-shortcuts-trigger[aria-expanded="true"],
  .agents-sound-toggle:hover,
  .agents-messages-close:hover,
  .agents-right-inline-edit:hover,
  .agents-right-add-mini:hover,
  .agents-right-add-mini.is-active
) {
  background: var(--color-border);
  border-color: var(--color-border-strong);
  color: var(--ink);
}

html[data-theme="dark"] .agents-middle-send {
  background: var(--color-accent-pressed);
  color: var(--color-text-inverse);
}

html[data-theme="dark"] .agents-middle-send:hover,
html[data-theme="dark"] .agents-middle-send:focus-visible {
  background: var(--color-text-secondary);
  color: var(--color-text-inverse);
}

html[data-theme="dark"] .agents-middle-send:disabled {
  background: var(--color-border-strong);
  color: rgba(239, 237, 232, 0.58);
}

html[data-theme="dark"] .agents-draft-toggle {
  background: var(--color-border-subtle);
  border-color: var(--color-border);
  color: rgba(239, 237, 232, 0.72);
}

html[data-theme="dark"] .agents-draft-toggle:hover:not(:disabled),
html[data-theme="dark"] .agents-draft-toggle:focus-visible:not(:disabled),
html[data-theme="dark"] .agents-draft-toggle.is-active {
  background: rgba(139, 124, 246, 0.14);
  border-color: rgba(139, 124, 246, 0.26);
  color: #c8c1ff;
}

html[data-theme="dark"] .agents-draft-toggle.is-reject {
  background: var(--color-danger-soft);
  border-color: rgba(206, 76, 76, 0.22);
  color: #f3aaaa;
}

html[data-theme="dark"] .agents-middle-composer.is-draft-mode {
  border-color: rgba(139, 124, 246, 0.38);
  box-shadow: 0 0 0 2px rgba(139, 124, 246, 0.08);
}

html[data-theme="dark"] .agents-middle-composer.is-draft-loading {
  background: var(--color-surface-soft);
}

html[data-theme="dark"] .agents-middle-send.is-generate {
  background: #6d5df2;
  color: var(--color-text-inverse);
}

html[data-theme="dark"] .agents-middle-send.is-generate:hover,
html[data-theme="dark"] .agents-middle-send.is-generate:focus-visible {
  background: #7d70ff;
  color: var(--color-text-inverse);
}

html[data-theme="dark"] .agents-middle-send.is-accept {
  background: #1f8f5c;
  color: var(--color-text-inverse);
}

html[data-theme="dark"] .agents-middle-send.is-accept:hover,
html[data-theme="dark"] .agents-middle-send.is-accept:focus-visible {
  background: #26a66c;
  color: var(--color-text-inverse);
}

html[data-theme="dark"] :is(
  .agents-right-section-toggle,
  .agents-right-section-static
) {
  background: var(--color-surface-soft);
  border-color: var(--color-border);
  color: var(--ink);
}

html[data-theme="dark"] :is(
  .agents-right-input,
  .agents-right-select-trigger,
  .agents-right-select-menu,
  .agents-right-tags-input,
  .agents-note-compose textarea,
  .agents-note-item,
  .agents-crm-pipeline-option,
  .agents-crm-stage-option,
  .agents-crm-pipeline-back,
  .agents-crm-selected-stage,
  .agents-right-organization-add
) {
  background: var(--color-surface-soft);
  border-color: var(--color-border);
  color: var(--ink);
  box-shadow: none;
}

html[data-theme="dark"] .agents-right-field.is-readonly .agents-right-input {
  background: var(--color-border-subtle);
  color: var(--ink);
}

html[data-theme="dark"] :is(
  .agents-right-input:focus,
  .agents-note-compose textarea:focus,
  .agents-right-tags-input:focus-within
) {
  border-color: var(--color-accent-border);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

html[data-theme="dark"] :is(
  .agents-right-select-option:hover,
  .agents-right-select-option.is-active,
  .agents-crm-pipeline-option:hover,
  .agents-crm-stage-option:hover,
  .agents-crm-pipeline-back:hover,
  .agents-shortcut-fill:hover,
  .agents-emoji-option:hover,
  .agents-emoji-option:focus-visible
) {
  background: var(--color-border-subtle);
  border-color: var(--color-border-strong);
  color: var(--ink);
}

html[data-theme="dark"] :is(
  .agents-right-conversation-item,
  .contacts-conversation-item,
  .crm-contact-conversation-item
) {
  background: var(--color-surface-soft);
  border-color: var(--color-border);
  color: var(--ink);
}

html[data-theme="dark"] :is(
  .agents-right-conversation-item:hover,
  .agents-right-conversation-item.is-active,
  .contacts-conversation-item:hover,
  .contacts-conversation-item.is-active,
  .crm-contact-conversation-item:hover,
  .crm-contact-conversation-item.is-active
) {
  background: var(--color-border-subtle);
  border-color: var(--color-border-strong);
}

html[data-theme="dark"] .agents-right-conversation-notes {
  border-color: var(--color-border-subtle);
}

html[data-theme="dark"] :is(
  .agents-right-quick-copy span,
  .agents-right-section-chevron,
  .agents-note-action-primary,
  .agents-right-pipeline-more
) {
  color: var(--color-text-secondary);
}

html[data-theme="dark"] :is(
  .agents-right-tag,
  .agents-right-org-pill,
  .crm-pipeline-membership-pill,
  .agents-right-pipeline-more
) {
  background: var(--color-border-subtle);
  border-color: var(--color-border);
  color: var(--ink);
}

html[data-theme="dark"] .agents-right-tag.is-active {
  background: rgba(189, 181, 170, 0.16);
  border-color: rgba(189, 181, 170, 0.28);
  color: var(--ink);
}

html[data-theme="dark"] .agents-right-tags-entry {
  color: var(--ink);
}

html[data-theme="dark"] .agents-right-tags-entry::placeholder {
  color: var(--color-text-muted);
}

html[data-theme="dark"] .agents-right-pipeline-list-wrap.is-collapsed::after {
  background: linear-gradient(180deg, rgba(31, 31, 29, 0), var(--color-canvas) 88%);
}

html[data-theme="dark"] .at-dialog,
html[data-theme="dark"] .at-dialog .kb-body,
html[data-theme="dark"] .at-dialog .kb-toolbar,
html[data-theme="dark"] .at-tabs,
html[data-theme="dark"] .at-list,
html[data-theme="dark"] .at-editor,
html[data-theme="dark"] .at-runner,
html[data-theme="dark"] .at-result,
html[data-theme="dark"] .at-history {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--ink);
  box-shadow: none;
}

html[data-theme="dark"] .at-tabs {
  background: var(--color-surface-soft);
  border-bottom-color: var(--color-border);
}

html[data-theme="dark"] .at-tab {
  color: var(--ink-soft);
}

html[data-theme="dark"] .at-tab:hover,
html[data-theme="dark"] .at-tab.is-active {
  color: var(--ink);
}

html[data-theme="dark"] .at-tab.is-active::after {
  background: var(--color-text-secondary);
}

html[data-theme="dark"] :is(
  .at-toolbar-title strong,
  .at-card-title strong,
  .at-section-head strong,
  .at-variable-summary strong,
  .at-run-summary p,
  .at-history-row strong,
  .at-mapped-row strong,
  .at-result-panel strong,
  .at-check-field
) {
  color: var(--ink);
}

html[data-theme="dark"] :is(
  .at-toolbar-title span,
  .at-card-title p,
  .at-section-head > div > span,
  .at-muted,
  .at-variable-summary span,
  .at-variable-pill small,
  .at-run-field small,
  .at-history-row span,
  .at-mapped-row span,
  .at-result-panel span,
  .at-switch-field
) {
  color: var(--ink-soft);
}

html[data-theme="dark"] :is(
  .at-card,
  .at-section,
  .at-contact-picker,
  .at-config-row,
  .at-variable-card,
  .at-history-card,
  .at-mapped-results,
  .at-result-panel > div
) {
  background: var(--color-surface-soft);
  border-color: var(--color-border);
  color: var(--ink);
  box-shadow: none;
}

html[data-theme="dark"] :is(
  .at-card-icon,
  .at-contact-source-icon,
  .at-variable-collapse,
  .at-variable-pill,
  .at-category-chip,
  .at-status,
  .at-run-status
) {
  background: var(--color-border-subtle);
  border-color: var(--color-border);
  color: var(--color-text-primary);
}

html[data-theme="dark"] .at-empty {
  background: transparent;
  color: var(--ink-soft);
}

html[data-theme="dark"] .at-empty strong {
  color: var(--ink);
}

html[data-theme="dark"] .at-empty p {
  color: var(--ink-soft);
}

html[data-theme="dark"] .at-empty > svg,
html[data-theme="dark"] .at-empty > i svg {
  color: var(--color-text-secondary);
}

html[data-theme="dark"] .at-empty .kb-empty-action {
  background: var(--color-accent-pressed);
  color: var(--color-text-inverse);
}

html[data-theme="dark"] .at-card-delete-confirm {
  background: rgba(128, 52, 48, 0.22);
  border-color: rgba(219, 100, 92, 0.28);
}

html[data-theme="dark"] .at-card-delete-confirm strong {
  color: #f0b5ae;
}

html[data-theme="dark"] .at-card-delete-confirm p {
  color: #c8a49f;
}

html[data-theme="dark"] :is(
  .at-card-icon svg,
  .at-contact-source-icon svg,
  .at-run-summary > svg,
  .at-run-summary > i svg
) {
  color: currentColor;
}

html[data-theme="dark"] .at-selected-contact,
html[data-theme="dark"] .at-contact-option {
  background: var(--color-canvas);
  border-color: var(--color-border);
  color: var(--ink);
}

html[data-theme="dark"] .at-contact-option:hover,
html[data-theme="dark"] .at-contact-option.is-selected {
  background: var(--color-border-subtle);
  border-color: var(--color-border-emphasis);
}

html[data-theme="dark"] .at-selected-contact strong,
html[data-theme="dark"] .at-contact-option strong {
  color: var(--ink);
}

html[data-theme="dark"] .at-selected-contact span:not(.at-contact-source-icon),
html[data-theme="dark"] .at-contact-option small {
  color: var(--ink-soft);
}

html[data-theme="dark"] .at-contact-skeleton {
  background: linear-gradient(90deg, var(--color-border-subtle), var(--color-border), var(--color-border-subtle));
  background-size: 220% 100%;
}

html[data-theme="dark"] .at-run-summary {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

html[data-theme="dark"] .at-run-summary p {
  color: #d9d4cb;
}

html[data-theme="dark"] :is(
  .at-variable-pill:hover,
  .at-category-chip:hover,
  .at-variable-collapse:hover
) {
  background: var(--color-border);
  border-color: var(--color-border-strong);
  color: var(--ink);
}

html[data-theme="dark"] :is(
  .at-method-switch,
  .at-permission-mode
) {
  background: var(--color-canvas);
  border-color: var(--color-border);
}

html[data-theme="dark"] :is(
  .at-method-option,
  .at-permission-option
) {
  color: var(--ink-soft);
}

html[data-theme="dark"] :is(
  .at-method-option:hover:not(:disabled),
  .at-permission-option:hover:not(:disabled)
) {
  background: var(--color-border-subtle);
  color: var(--ink);
}

html[data-theme="dark"] .at-section-head .kb-action-button-secondary,
html[data-theme="dark"] .at-section-head .kb-action-button-secondary span,
html[data-theme="dark"] .at-section-head .kb-action-button-secondary svg {
  color: var(--color-text-primary);
}

html[data-theme="dark"] .at-section-head .kb-action-button-secondary {
  background: var(--color-border-subtle);
  border-color: var(--color-border);
  box-shadow: none;
}

html[data-theme="dark"] .at-section-head .kb-action-button-secondary:hover:not(:disabled) {
  background: var(--color-border);
  border-color: var(--color-border-strong);
  color: var(--color-text-primary);
}

html[data-theme="dark"] .at-section-head .kb-action-button-secondary:hover:not(:disabled) span,
html[data-theme="dark"] .at-section-head .kb-action-button-secondary:hover:not(:disabled) svg {
  color: var(--color-text-primary);
}

html[data-theme="dark"] :is(
  .at-method-option.is-active,
  .at-permission-option.is-active,
  .at-category-chip.is-selected
) {
  background: var(--color-accent-pressed);
  border-color: var(--color-border-emphasis);
  color: var(--color-text-inverse);
  box-shadow: none;
}

html[data-theme="dark"] .at-variable-editor,
html[data-theme="dark"] .at-history-row,
html[data-theme="dark"] .at-mapped-row,
html[data-theme="dark"] .at-history-mapped {
  border-color: var(--color-border-subtle);
}

html[data-theme="dark"] :is(
  .at-switch-field span,
  .at-required-toggle
) {
  background: var(--color-surface-muted);
  border-color: var(--color-border);
}

html[data-theme="dark"] :is(
  .at-switch-field span::after,
  .at-required-toggle > span
) {
  background: var(--color-text-primary);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.24);
}

html[data-theme="dark"] :is(
  .at-switch-field input:checked + span,
  .at-required-toggle.is-on
) {
  background: var(--color-accent-pressed);
  border-color: var(--color-border-emphasis);
}

html[data-theme="dark"] :is(
  .at-status.is-enabled,
  .at-run-status.is-success,
  .at-success-text
) {
  color: var(--color-success);
}

html[data-theme="dark"] :is(
  .at-status.is-disabled,
  .at-run-status.is-failed,
  .at-error-text
) {
  color: var(--color-danger);
}

html[data-theme="dark"] .at-history-error {
  background: rgba(206, 76, 76, 0.14);
  border: 1px solid var(--color-danger-soft);
  color: var(--color-danger);
}

html[data-theme="dark"] .at-json-editor textarea {
  background: var(--color-canvas);
  border-color: var(--color-border-strong);
  color: var(--color-text-primary);
}

/* Keep page headers flush with the dark page surface instead of boxed strips. */
html[data-theme="dark"] :is(
  .ops-report-head,
  .ops-toolbar,
  .ops-report-toolbar,
  .ops-user-report-toolbar,
  .analytics-toolbar,
  .crm-toolbar,
  .crm-contacts-filter-panel,
  .crm-contacts-list-toolbar,
  .crm-organizations-toolbar,
  .tickets-table-controls,
  .tasks-hero,
  .agents-messages-header,
  .agents-work-list-head,
  .agents-work-search,
  .kb-head,
  .kb-toolbar,
  .at-dialog .kb-toolbar,
  .at-tabs
) {
  background: transparent;
  box-shadow: none;
}

html[data-theme="dark"] :is(
  .ops-window-presets,
  .analytics-report-mode-tabs,
  .ops-report-builder-form,
  .ops-user-report-picker,
  .crm-contacts-actions,
  .tasks-header-controls,
  .tasks-header-filters,
  .tasks-header-actions,
  .kb-head-actions
) {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

html[data-theme="dark"] .ops-window-presets {
  background: var(--color-surface-soft);
  border: 1px solid var(--color-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

html[data-theme="dark"] .ops-window-preset {
  background: transparent;
  border-color: transparent;
  color: var(--color-accent);
}

html[data-theme="dark"] .ops-window-preset:hover:not(:disabled) {
  background: var(--color-border-subtle);
  border-color: var(--color-border);
  color: var(--color-text-primary);
}

html[data-theme="dark"] .ops-window-preset.is-active {
  background: var(--color-text-primary);
  border-color: rgba(232, 229, 222, 0.38);
  color: var(--color-text-inverse);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12), 0 8px 18px rgba(0, 0, 0, 0.24);
}

html[data-theme="dark"] :is(
  .ops-report-head,
  .ops-toolbar,
  .ops-report-toolbar,
  .ops-user-report-toolbar,
  .analytics-toolbar,
  .crm-contacts-filter-panel,
  .crm-contacts-list-toolbar,
  .crm-organizations-toolbar,
  .tickets-table-controls,
  .tasks-hero,
  .agents-messages-header,
  .kb-head,
  .kb-toolbar,
  .at-dialog .kb-toolbar,
  .at-tabs
) {
  border-color: var(--color-border-subtle);
}

html[data-theme="dark"] :is(
  .crm-contacts-filter-panel,
  .crm-organizations-filter-panel,
  .crm-contacts-filter-primary,
  .crm-contacts-list-toolbar,
  .crm-organizations-toolbar
) {
  background: transparent;
  box-shadow: none;
}

html[data-theme="dark"] .crm-view-shell:has(.crm-contacts-filter-panel) {
  background: var(--color-canvas);
}

html[data-theme="dark"] .crm-view-shell.crm-view-shell-has-footer {
  background: var(--color-canvas);
}

html[data-theme="dark"] .crm-view-shell:has(.crm-contacts-filter-panel) :is(
  .crm-contacts-filter-panel,
  .crm-organizations-filter-panel,
  .crm-contacts-filter-primary,
  .crm-contacts-list-toolbar,
  .crm-organizations-toolbar,
  .crm-active-filters,
  .crm-contacts-filter-summary
) {
  background: transparent !important;
  box-shadow: none !important;
}

html[data-theme="dark"] :is(
  .tickets-table-controls,
  .analytics-toolbar,
  .ops-toolbar,
  .kb-toolbar,
  .at-dialog .kb-toolbar
) :is(
  input,
  select,
  textarea,
  .crm-search-field,
  .tickets-custom-select-trigger,
  .tickets-filter-button:not(.tickets-filter-button-primary),
  .crm-toolbar-icon-button:not(.crm-toolbar-icon-button-primary),
  .analytics-date-input,
  .ops-agent-search,
  .kb-search
) {
  background: var(--color-surface);
}

html[data-theme="dark"] .live-dashboard-page {
  background: var(--color-canvas);
  color: var(--ink);
}

html[data-theme="dark"] .live-metric-grid {
  background: var(--color-surface-soft);
  border-bottom-color: var(--color-border);
  box-shadow: none;
}

html[data-theme="dark"] .live-metric,
html[data-theme="dark"] .live-refresh-timer {
  background: var(--color-surface-soft);
  border-color: var(--color-border);
  color: var(--ink);
}

html[data-theme="dark"] .live-metric:nth-child(even),
html[data-theme="dark"] .live-refresh-timer {
  background: var(--color-surface);
}

html[data-theme="dark"] .live-metric > span {
  background: var(--color-border-subtle);
  color: var(--color-text-secondary);
}

html[data-theme="dark"] .live-metric.is-good > span {
  background: var(--color-success-soft);
  color: var(--color-success);
}

html[data-theme="dark"] .live-metric.is-warn > span {
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

html[data-theme="dark"] .live-metric strong {
  color: var(--color-text-primary);
}

html[data-theme="dark"] .live-metric small,
html[data-theme="dark"] .live-metric em,
html[data-theme="dark"] .live-refresh-timer small {
  color: var(--color-text-secondary);
}

html[data-theme="dark"] .live-refresh-timer:hover,
html[data-theme="dark"] .live-refresh-timer.is-refreshing {
  background: var(--color-surface-muted);
}

html[data-theme="dark"] .live-refresh-ring {
  background: conic-gradient(rgba(194, 187, 176, 0.5) var(--refresh-progress), var(--color-border-subtle) 0);
  box-shadow: inset 0 0 0 1px var(--color-border-subtle);
}

html[data-theme="dark"] .live-refresh-ring::before {
  background: var(--color-surface-soft);
  box-shadow: inset 0 0 0 1px var(--color-border-subtle);
}

html[data-theme="dark"] .live-refresh-ring::after {
  background: rgba(194, 187, 176, 0.28);
  box-shadow: 0 0 0 4px var(--color-border-subtle);
}

html[data-theme="dark"] .live-dashboard-grid,
html[data-theme="dark"] .live-right-rail {
  background: var(--color-canvas);
}

html[data-theme="dark"] .live-panel,
html[data-theme="dark"] .live-panel-agents,
html[data-theme="dark"] .live-panel-chats,
html[data-theme="dark"] .live-panel-feed,
html[data-theme="dark"] .live-panel-alerts {
  background: var(--color-canvas);
  border-color: var(--color-border);
  box-shadow: none;
}

html[data-theme="dark"] .live-panel-agents,
html[data-theme="dark"] .live-panel-chats {
  border-right: 1px solid var(--color-border);
}

html[data-theme="dark"] .live-panel-alerts {
  border-bottom: 1px solid var(--color-border);
}

html[data-theme="dark"] .live-panel-head h3 {
  color: var(--color-text-primary);
}

html[data-theme="dark"] .live-panel-head span {
  color: var(--color-accent);
}

html[data-theme="dark"] .live-agent-search {
  background: var(--color-surface-soft);
  border-color: var(--color-border);
  color: var(--color-accent);
}

html[data-theme="dark"] .live-agent-search input {
  color: var(--color-text-primary);
}

html[data-theme="dark"] .live-agent-search input::placeholder {
  color: var(--color-text-secondary);
}

html[data-theme="dark"] .live-chat-list {
  border-top-color: var(--color-border-subtle);
}

html[data-theme="dark"] .live-chat-row {
  background: var(--color-surface);
  border-bottom-color: var(--color-border-subtle);
  color: var(--color-text-secondary);
}

html[data-theme="dark"] .live-chat-row:nth-child(even) {
  background: var(--color-surface-soft);
}

html[data-theme="dark"] .live-chat-row.is-unassigned {
  background:
    linear-gradient(90deg, var(--color-warning-soft), transparent 5px),
    var(--color-surface);
}

html[data-theme="dark"] .live-chat-row:hover {
  background: var(--color-surface-muted);
}

html[data-theme="dark"] .live-chat-icon {
  background: var(--color-border-subtle);
}

html[data-theme="dark"] .live-chat-row strong {
  color: var(--color-text-primary);
}

html[data-theme="dark"] .live-chat-row p,
html[data-theme="dark"] .live-chat-assignee,
html[data-theme="dark"] .live-chat-age {
  color: var(--color-text-secondary);
}

html[data-theme="dark"] .live-agent-row {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--ink);
}

html[data-theme="dark"] .live-agent-row:hover,
html[data-theme="dark"] .live-agent-row.is-active {
  background: var(--color-surface-muted);
  border-color: var(--color-border-strong);
}

html[data-theme="dark"] .live-alert-row {
  background:
    linear-gradient(90deg, var(--color-warning), var(--color-warning) 4px, transparent 4px),
    var(--color-warning-soft);
  border-color: var(--color-warning-soft);
}

html[data-theme="dark"] .live-alert-row.is-critical {
  background:
    linear-gradient(90deg, var(--color-danger), var(--color-danger) 4px, transparent 4px),
    var(--color-danger-soft);
  border-color: var(--color-danger-soft);
}

html[data-theme="dark"] .live-alert-row > span {
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

html[data-theme="dark"] .live-alert-row.is-critical > span {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

html[data-theme="dark"] .live-alert-row strong,
html[data-theme="dark"] .live-event-row strong {
  color: var(--color-text-primary);
}

html[data-theme="dark"] .live-alert-row small,
html[data-theme="dark"] .live-event-row small,
html[data-theme="dark"] .live-event-row time {
  color: var(--color-text-secondary);
}

html[data-theme="dark"] .live-event-row {
  background: transparent;
  border-color: transparent;
}

html[data-theme="dark"] .live-event-row > span {
  background: var(--color-border-subtle);
  color: var(--color-text-secondary);
  box-shadow: 0 0 0 5px var(--color-canvas);
}

html[data-theme="dark"] .live-event-row::before {
  background: var(--color-border);
}

html[data-theme="dark"] .live-skeleton-row {
  background: var(--color-surface);
  border-color: var(--color-border-subtle);
}

html[data-theme="dark"] .live-chat-list .live-skeleton-row {
  background: var(--color-surface);
  border-bottom-color: var(--color-border-subtle);
}

html[data-theme="dark"] .live-skeleton-row.is-event {
  background: transparent;
  border-color: transparent;
}

html[data-theme="dark"] .live-skeleton-icon,
html[data-theme="dark"] .live-skeleton-line {
  background: linear-gradient(90deg, var(--color-border-subtle), var(--color-border), var(--color-border-subtle));
  background-size: 220% 100%;
}

html[data-theme="dark"] .live-event-row.is-warning > span {
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

html[data-theme="dark"] .live-event-row.is-success > span {
  background: var(--color-success-soft);
  color: var(--color-success);
}

html[data-theme="dark"] .live-event-row.is-critical > span {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

html[data-theme="dark"] .live-chat-preview,
html[data-theme="dark"] .live-chat-preview-grid,
html[data-theme="dark"] .live-chat-preview-details {
  background: var(--color-canvas);
  color: var(--ink);
}

html[data-theme="dark"] .live-chat-preview-head {
  background: var(--color-surface-soft);
  border-bottom-color: var(--color-border);
}

html[data-theme="dark"] .live-chat-preview-head strong {
  color: var(--color-text-primary);
}

html[data-theme="dark"] .live-chat-preview-head small {
  color: var(--color-text-secondary);
}

html[data-theme="dark"] .live-chat-back {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text-primary);
}

html[data-theme="dark"] .live-chat-back:hover {
  background: var(--color-surface-muted);
  border-color: var(--color-border-strong);
  color: var(--color-text-primary);
}

html[data-theme="dark"] .live-chat-preview-tabs {
  background: var(--color-surface-soft);
  border-bottom-color: var(--color-border);
}

html[data-theme="dark"] .live-chat-preview-tabs button {
  color: var(--color-accent);
}

html[data-theme="dark"] .live-chat-preview-tabs button.is-active {
  color: var(--color-text-primary);
}

html[data-theme="dark"] .live-chat-preview-tabs button.is-active::after {
  background: var(--color-accent);
}

html[data-theme="dark"] .live-chat-preview-messages,
html[data-theme="dark"] .live-chat-preview-messages .agents-messages-area {
  background: var(--color-canvas);
}

html[data-theme="dark"] .tasks-board {
  gap: 0;
  padding: 0;
  background: var(--color-canvas);
  border-top-color: var(--color-border);
}

html[data-theme="dark"] .tasks-column {
  background: var(--color-canvas);
  border: 0;
  border-right: 1px solid var(--color-border);
  border-radius: 0;
  box-shadow: none;
}

html[data-theme="dark"] .tasks-column:last-child {
  border-right: 0;
}

html[data-theme="dark"] .tasks-column-head {
  background: var(--color-surface-muted);
  border-bottom-color: var(--color-border);
  box-shadow: none;
}

html[data-theme="dark"] .tasks-column[data-task-column="started"] .tasks-column-head {
  background: var(--color-info-soft);
}

html[data-theme="dark"] .tasks-column[data-task-column="finished"] .tasks-column-head {
  background: var(--color-success-soft);
}

html[data-theme="dark"] .tasks-column-head::after {
  opacity: 0.9;
}

html[data-theme="dark"] .tasks-column-body {
  background: var(--color-canvas);
}

html[data-theme="dark"] .tasks-card-open {
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: 7px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.14);
}

html[data-theme="dark"] .tasks-card-open:hover,
html[data-theme="dark"] .tasks-card-open:focus-visible {
  background: var(--color-surface-muted);
  border-color: var(--color-border-strong);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

html[data-theme="dark"] .tasks-card.is-drop-flash .tasks-card-open {
  animation-name: tasks-drop-flash-dark;
}

@keyframes tasks-drop-flash-dark {
  0% {
    background: color-mix(in srgb, var(--tasks-column-accent) 12%, var(--color-surface));
    border-color: color-mix(in srgb, var(--tasks-column-accent) 28%, var(--color-border-subtle));
  }
  42% {
    background: color-mix(in srgb, var(--tasks-column-accent) 8%, var(--color-surface));
    border-color: color-mix(in srgb, var(--tasks-column-accent) 22%, var(--color-border-subtle));
  }
  100% {
    background: var(--color-surface);
    border-color: var(--color-border-subtle);
  }
}

html[data-theme="dark"] .tasks-card-top {
  border-bottom-color: var(--color-border-subtle);
}

html[data-theme="dark"] .tasks-card-icon {
  background: rgba(148, 163, 184, 0.14);
  color: #b6c0cc;
}

html[data-theme="dark"] .tasks-card-icon.is-started {
  background: var(--color-info-soft);
  color: var(--color-info);
}

html[data-theme="dark"] .tasks-card-icon.is-finished {
  background: var(--color-success-soft);
  color: var(--color-success);
}

html[data-theme="dark"] .tasks-card.is-priority .tasks-card-icon {
  background: var(--color-warning-soft);
  color: var(--color-warning);
}

html[data-theme="dark"] .tasks-card-meta span {
  background: var(--color-border-subtle);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
}

html[data-theme="dark"] .tasks-card-meta span svg,
html[data-theme="dark"] .tasks-card-meta span i {
  color: var(--color-text-secondary);
}

html[data-theme="dark"] .tasks-card-meta .tasks-assignee-name {
  background: transparent;
  border: 0;
  color: var(--color-text-secondary);
}

html[data-theme="dark"] .crm-card-info-fields {
  background: var(--color-surface-soft);
  border-color: var(--color-border);
  color: var(--ink);
  box-shadow: none;
}

html[data-theme="dark"] .crm-card-info-head strong {
  color: var(--ink);
}

html[data-theme="dark"] .crm-card-info-head span {
  color: var(--ink-soft);
}

html[data-theme="dark"] .crm-card-info-fields :is(
  input,
  textarea,
  select,
  .tickets-custom-select-trigger
) {
  background: var(--color-canvas);
  border-color: var(--color-border-strong);
  color: var(--ink);
}

html[data-theme="dark"] .crm-card-info-fields :is(
  input::placeholder,
  textarea::placeholder
) {
  color: var(--color-text-muted);
}

/* Theme presets extend the light/dark mode contract without bypassing it. */
html[data-theme-preset="ocean-mist"] {
  color-scheme: light;
  --color-canvas: #f2f7f8;
  --color-panel: #eaf1f3;
  --color-surface: #ffffff;
  --color-surface-raised: #ffffff;
  --color-surface-soft: #f6fafb;
  --color-surface-muted: #e3edef;
  --color-input: #ffffff;
  --color-hover: rgba(21, 99, 112, 0.07);
  --color-selected: rgba(21, 99, 112, 0.11);
  --color-selected-strong: rgba(21, 99, 112, 0.16);
  --color-text-primary: #183036;
  --color-text-secondary: #536a70;
  --color-text-muted: #768a8f;
  --color-border-subtle: rgba(24, 48, 54, 0.08);
  --color-border: rgba(24, 48, 54, 0.13);
  --color-border-strong: rgba(24, 48, 54, 0.2);
  --color-border-emphasis: rgba(24, 48, 54, 0.3);
  --color-accent: #156370;
  --color-accent-hover: #197785;
  --color-accent-pressed: #104f59;
  --color-accent-soft: rgba(21, 99, 112, 0.11);
  --color-accent-border: rgba(21, 99, 112, 0.24);
  --color-focus-ring: rgba(21, 99, 112, 0.18);
  --color-info: #287b94;
  --color-info-soft: rgba(40, 123, 148, 0.12);
  --color-shadow: rgba(20, 62, 70, 0.13);
  --color-shadow-tight: rgba(20, 62, 70, 0.09);
  --color-message-inbound: #e3ecee;
  --color-message-outbound: #156370;
  --color-media-background: #17383d;
  --color-scrollbar-thumb: rgba(83, 106, 112, 0.4);
  --color-navigation: #26383c;
}

html[data-theme="dark"][data-theme-preset="forest-night"] {
  color-scheme: dark;
  --color-canvas: #101412;
  --color-panel: #171c19;
  --color-surface: #1b211e;
  --color-surface-raised: #222925;
  --color-surface-soft: #141916;
  --color-surface-muted: #28302b;
  --color-input: #121714;
  --color-hover: rgba(255, 255, 255, 0.06);
  --color-selected: rgba(101, 176, 133, 0.12);
  --color-selected-strong: rgba(101, 176, 133, 0.17);
  --color-text-primary: #f0f5f1;
  --color-text-secondary: #a7b1aa;
  --color-text-muted: #7e8b83;
  --color-border-subtle: rgba(237, 247, 240, 0.07);
  --color-border: rgba(237, 247, 240, 0.11);
  --color-border-strong: rgba(237, 247, 240, 0.18);
  --color-border-emphasis: rgba(237, 247, 240, 0.28);
  --color-accent: #65b085;
  --color-accent-hover: #78c397;
  --color-accent-pressed: #4c916a;
  --color-accent-soft: rgba(101, 176, 133, 0.13);
  --color-accent-border: rgba(101, 176, 133, 0.25);
  --color-focus-ring: rgba(101, 176, 133, 0.16);
  --color-info: #72a9b5;
  --color-info-soft: rgba(114, 169, 181, 0.14);
  --color-shadow: rgba(0, 0, 0, 0.42);
  --color-shadow-tight: rgba(0, 0, 0, 0.3);
  --color-message-inbound: #29312c;
  --color-message-outbound: #397653;
  --color-media-background: #0c1510;
  --color-scrollbar-thumb: rgba(237, 247, 240, 0.24);
  --color-navigation: #202823;
}

html[data-theme-preset="nordic-sand"] {
  color-scheme: light;
  --color-canvas: #f7f6f2;
  --color-panel: #f1f0eb;
  --color-surface: #ffffff;
  --color-surface-raised: #ffffff;
  --color-surface-soft: #faf9f6;
  --color-surface-muted: #ebe8e1;
  --color-input: #ffffff;
  --color-hover: rgba(182, 95, 63, 0.07);
  --color-selected: rgba(182, 95, 63, 0.11);
  --color-selected-strong: rgba(182, 95, 63, 0.16);
  --color-text-primary: #292622;
  --color-text-secondary: #68615a;
  --color-text-muted: #8b847c;
  --color-border-subtle: rgba(41, 38, 34, 0.08);
  --color-border: rgba(41, 38, 34, 0.13);
  --color-border-strong: rgba(41, 38, 34, 0.2);
  --color-border-emphasis: rgba(41, 38, 34, 0.3);
  --color-accent: #b65f3f;
  --color-accent-hover: #c86d4b;
  --color-accent-pressed: #984b31;
  --color-accent-soft: rgba(182, 95, 63, 0.1);
  --color-accent-border: rgba(182, 95, 63, 0.24);
  --color-focus-ring: rgba(182, 95, 63, 0.17);
  --color-info: #667d91;
  --color-info-soft: rgba(102, 125, 145, 0.12);
  --color-shadow: rgba(49, 43, 37, 0.13);
  --color-shadow-tight: rgba(49, 43, 37, 0.09);
  --color-message-inbound: #ece9e3;
  --color-message-outbound: #a85235;
  --color-media-background: #302d29;
  --color-scrollbar-thumb: rgba(104, 97, 90, 0.4);
  --color-navigation: #34302d;
}

html[data-theme-preset="sage-paper"] {
  color-scheme: light;
  --color-canvas: #f5f7f5;
  --color-panel: #eff2ef;
  --color-surface: #ffffff;
  --color-surface-raised: #ffffff;
  --color-surface-soft: #f8faf8;
  --color-surface-muted: #e5e9e5;
  --color-input: #ffffff;
  --color-hover: rgba(66, 107, 80, 0.07);
  --color-selected: rgba(66, 107, 80, 0.11);
  --color-selected-strong: rgba(66, 107, 80, 0.16);
  --color-text-primary: #243128;
  --color-text-secondary: #5d6e62;
  --color-text-muted: #7d8c81;
  --color-border-subtle: rgba(36, 49, 40, 0.08);
  --color-border: rgba(36, 49, 40, 0.13);
  --color-border-strong: rgba(36, 49, 40, 0.2);
  --color-border-emphasis: rgba(36, 49, 40, 0.3);
  --color-accent: #426b50;
  --color-accent-hover: #507e60;
  --color-accent-pressed: #345640;
  --color-accent-soft: rgba(66, 107, 80, 0.11);
  --color-accent-border: rgba(66, 107, 80, 0.25);
  --color-focus-ring: rgba(66, 107, 80, 0.18);
  --color-info: #4c7780;
  --color-info-soft: rgba(76, 119, 128, 0.12);
  --color-shadow: rgba(39, 65, 46, 0.13);
  --color-shadow-tight: rgba(39, 65, 46, 0.09);
  --color-message-inbound: #e3ebe0;
  --color-message-outbound: #426b50;
  --color-media-background: #26372b;
  --color-scrollbar-thumb: rgba(93, 110, 98, 0.4);
  --color-navigation: #2f3732;
}

html[data-theme-preset="lavender-fog"] {
  color-scheme: light;
  --color-canvas: #f7f7f9;
  --color-panel: #f1f1f5;
  --color-surface: #ffffff;
  --color-surface-raised: #ffffff;
  --color-surface-soft: #fafafd;
  --color-surface-muted: #e8e7ef;
  --color-input: #ffffff;
  --color-hover: rgba(105, 85, 166, 0.07);
  --color-selected: rgba(105, 85, 166, 0.11);
  --color-selected-strong: rgba(105, 85, 166, 0.16);
  --color-text-primary: #2e2940;
  --color-text-secondary: #665f78;
  --color-text-muted: #898198;
  --color-border-subtle: rgba(46, 41, 64, 0.08);
  --color-border: rgba(46, 41, 64, 0.13);
  --color-border-strong: rgba(46, 41, 64, 0.2);
  --color-border-emphasis: rgba(46, 41, 64, 0.3);
  --color-accent: #6955a6;
  --color-accent-hover: #7964b8;
  --color-accent-pressed: #56428e;
  --color-accent-soft: rgba(105, 85, 166, 0.11);
  --color-accent-border: rgba(105, 85, 166, 0.25);
  --color-focus-ring: rgba(105, 85, 166, 0.18);
  --color-info: #5275a3;
  --color-info-soft: rgba(82, 117, 163, 0.12);
  --color-shadow: rgba(55, 44, 88, 0.13);
  --color-shadow-tight: rgba(55, 44, 88, 0.09);
  --color-message-inbound: #e9e4f1;
  --color-message-outbound: #6955a6;
  --color-media-background: #302a43;
  --color-scrollbar-thumb: rgba(102, 95, 120, 0.4);
  --color-navigation: #343440;
}

html[data-theme="dark"][data-theme-preset="ember-night"] {
  color-scheme: dark;
  --color-canvas: #141413;
  --color-panel: #1f1e1d;
  --color-surface: #222222;
  --color-surface-raised: #3d3d3a;
  --color-surface-soft: #1f1e1d;
  --color-surface-muted: #3d3d3a;
  --color-input: #1f1e1d;
  --color-hover: rgba(250, 249, 245, 0.06);
  --color-selected: rgba(181, 99, 73, 0.13);
  --color-selected-strong: rgba(181, 99, 73, 0.18);
  --color-text-primary: #faf9f5;
  --color-text-secondary: #d1cfc5;
  --color-text-muted: #87867f;
  --color-border-subtle: rgba(232, 230, 220, 0.08);
  --color-border: rgba(232, 230, 220, 0.13);
  --color-border-strong: rgba(232, 230, 220, 0.2);
  --color-border-emphasis: rgba(232, 230, 220, 0.3);
  --color-accent: #b56349;
  --color-accent-hover: #c27155;
  --color-accent-pressed: #96503b;
  --color-accent-soft: rgba(181, 99, 73, 0.13);
  --color-accent-border: rgba(181, 99, 73, 0.25);
  --color-focus-ring: rgba(181, 99, 73, 0.18);
  --color-info: #bcd1ca;
  --color-info-soft: rgba(188, 209, 202, 0.14);
  --color-shadow: rgba(0, 0, 0, 0.44);
  --color-shadow-tight: rgba(0, 0, 0, 0.32);
  --color-message-inbound: #3d3d3a;
  --color-message-outbound: #a5573f;
  --color-media-background: #141413;
  --color-scrollbar-thumb: rgba(232, 230, 220, 0.28);
  --color-navigation: #1f1e1d;
}

html[data-theme="dark"][data-theme-preset="plum-shadow"] {
  color-scheme: dark;
  --color-canvas: #110f13;
  --color-panel: #18151b;
  --color-surface: #201b23;
  --color-surface-raised: #28222c;
  --color-surface-soft: #161218;
  --color-surface-muted: #302936;
  --color-input: #151117;
  --color-hover: rgba(255, 255, 255, 0.06);
  --color-selected: rgba(168, 122, 193, 0.13);
  --color-selected-strong: rgba(168, 122, 193, 0.18);
  --color-text-primary: #f4eff6;
  --color-text-secondary: #b5a8bb;
  --color-text-muted: #887b8f;
  --color-border-subtle: rgba(247, 239, 250, 0.07);
  --color-border: rgba(247, 239, 250, 0.11);
  --color-border-strong: rgba(247, 239, 250, 0.18);
  --color-border-emphasis: rgba(247, 239, 250, 0.28);
  --color-accent: #a87ac1;
  --color-accent-hover: #bb8dd3;
  --color-accent-pressed: #8c60a5;
  --color-accent-soft: rgba(168, 122, 193, 0.14);
  --color-accent-border: rgba(168, 122, 193, 0.27);
  --color-focus-ring: rgba(168, 122, 193, 0.18);
  --color-info: #8f8ec9;
  --color-info-soft: rgba(143, 142, 201, 0.14);
  --color-shadow: rgba(0, 0, 0, 0.45);
  --color-shadow-tight: rgba(0, 0, 0, 0.32);
  --color-message-inbound: #332b38;
  --color-message-outbound: #76508c;
  --color-media-background: #0e0911;
  --color-scrollbar-thumb: rgba(247, 239, 250, 0.24);
  --color-navigation: #29222f;
}

html[data-theme="dark"][data-theme-preset="copper-graphite"] {
  color-scheme: dark;
  --color-canvas: #101112;
  --color-panel: #18191a;
  --color-surface: #1e2021;
  --color-surface-raised: #252728;
  --color-surface-soft: #151617;
  --color-surface-muted: #2d3031;
  --color-input: #141516;
  --color-hover: rgba(255, 255, 255, 0.06);
  --color-selected: rgba(196, 135, 85, 0.13);
  --color-selected-strong: rgba(196, 135, 85, 0.18);
  --color-text-primary: #f1efec;
  --color-text-secondary: #ada8a1;
  --color-text-muted: #817c76;
  --color-border-subtle: rgba(242, 239, 234, 0.07);
  --color-border: rgba(242, 239, 234, 0.11);
  --color-border-strong: rgba(242, 239, 234, 0.18);
  --color-border-emphasis: rgba(242, 239, 234, 0.28);
  --color-accent: #c48755;
  --color-accent-hover: #d79a67;
  --color-accent-pressed: #a66e43;
  --color-accent-soft: rgba(196, 135, 85, 0.14);
  --color-accent-border: rgba(196, 135, 85, 0.27);
  --color-focus-ring: rgba(196, 135, 85, 0.18);
  --color-info: #8d9fab;
  --color-info-soft: rgba(141, 159, 171, 0.14);
  --color-shadow: rgba(0, 0, 0, 0.45);
  --color-shadow-tight: rgba(0, 0, 0, 0.32);
  --color-message-inbound: #2e3031;
  --color-message-outbound: #94623d;
  --color-media-background: #0d0e0f;
  --color-scrollbar-thumb: rgba(242, 239, 234, 0.24);
  --color-navigation: #292725;
}

html[data-theme-preset="porcelain-rose"] {
  color-scheme: light;
  --color-canvas: #f7f6f5;
  --color-panel: #f1efee;
  --color-surface: #ffffff;
  --color-surface-raised: #ffffff;
  --color-surface-soft: #faf8f8;
  --color-surface-muted: #ebe5e6;
  --color-input: #ffffff;
  --color-hover: rgba(163, 79, 98, 0.07);
  --color-selected: rgba(163, 79, 98, 0.11);
  --color-selected-strong: rgba(163, 79, 98, 0.16);
  --color-text-primary: #292326;
  --color-text-secondary: #6e6065;
  --color-text-muted: #918287;
  --color-border-subtle: rgba(41, 35, 38, 0.08);
  --color-border: rgba(41, 35, 38, 0.13);
  --color-border-strong: rgba(41, 35, 38, 0.2);
  --color-border-emphasis: rgba(41, 35, 38, 0.3);
  --color-accent: #a34f62;
  --color-accent-hover: #b45c6f;
  --color-accent-pressed: #843d4e;
  --color-accent-soft: rgba(163, 79, 98, 0.11);
  --color-accent-border: rgba(163, 79, 98, 0.25);
  --color-focus-ring: rgba(163, 79, 98, 0.18);
  --color-info: #6b769e;
  --color-info-soft: rgba(107, 118, 158, 0.12);
  --color-shadow: rgba(61, 42, 48, 0.13);
  --color-shadow-tight: rgba(61, 42, 48, 0.09);
  --color-message-inbound: #eee8e9;
  --color-message-outbound: #94465a;
  --color-media-background: #34282c;
  --color-scrollbar-thumb: rgba(110, 96, 101, 0.4);
  --color-navigation: #352b2f;
}

html[data-theme="dark"][data-theme-preset="oxblood-night"] {
  color-scheme: dark;
  --color-canvas: #120f10;
  --color-panel: #1a1517;
  --color-surface: #211a1d;
  --color-surface-raised: #2a2124;
  --color-surface-soft: #171315;
  --color-surface-muted: #34282c;
  --color-input: #161214;
  --color-hover: rgba(255, 255, 255, 0.06);
  --color-selected: rgba(189, 104, 120, 0.13);
  --color-selected-strong: rgba(189, 104, 120, 0.18);
  --color-text-primary: #f7f0f2;
  --color-text-secondary: #beaeb3;
  --color-text-muted: #8e7d82;
  --color-border-subtle: rgba(247, 240, 242, 0.07);
  --color-border: rgba(247, 240, 242, 0.11);
  --color-border-strong: rgba(247, 240, 242, 0.18);
  --color-border-emphasis: rgba(247, 240, 242, 0.28);
  --color-accent: #bd6878;
  --color-accent-hover: #cb7887;
  --color-accent-pressed: #9d5363;
  --color-accent-soft: rgba(189, 104, 120, 0.14);
  --color-accent-border: rgba(189, 104, 120, 0.27);
  --color-focus-ring: rgba(189, 104, 120, 0.18);
  --color-info: #9e94ba;
  --color-info-soft: rgba(158, 148, 186, 0.14);
  --color-shadow: rgba(0, 0, 0, 0.46);
  --color-shadow-tight: rgba(0, 0, 0, 0.33);
  --color-message-inbound: #34282c;
  --color-message-outbound: #914858;
  --color-media-background: #0d090a;
  --color-scrollbar-thumb: rgba(247, 240, 242, 0.24);
  --color-navigation: #2a2023;
}

html[data-theme-preset="arctic-glass"] {
  color-scheme: light;
  --color-canvas: #f4f7f8;
  --color-panel: #edf2f3;
  --color-surface: #ffffff;
  --color-surface-raised: #ffffff;
  --color-surface-soft: #f8fafb;
  --color-surface-muted: #e2eaec;
  --color-input: #ffffff;
  --color-hover: rgba(36, 125, 145, 0.07);
  --color-selected: rgba(36, 125, 145, 0.11);
  --color-selected-strong: rgba(36, 125, 145, 0.16);
  --color-text-primary: #1f2d31;
  --color-text-secondary: #5b6d72;
  --color-text-muted: #7f9095;
  --color-border-subtle: rgba(31, 45, 49, 0.08);
  --color-border: rgba(31, 45, 49, 0.13);
  --color-border-strong: rgba(31, 45, 49, 0.2);
  --color-border-emphasis: rgba(31, 45, 49, 0.3);
  --color-accent: #247d91;
  --color-accent-hover: #2d90a6;
  --color-accent-pressed: #1c6576;
  --color-accent-soft: rgba(36, 125, 145, 0.11);
  --color-accent-border: rgba(36, 125, 145, 0.25);
  --color-focus-ring: rgba(36, 125, 145, 0.18);
  --color-info: #397eac;
  --color-info-soft: rgba(57, 126, 172, 0.12);
  --color-shadow: rgba(30, 67, 76, 0.13);
  --color-shadow-tight: rgba(30, 67, 76, 0.09);
  --color-message-inbound: #e4ecee;
  --color-message-outbound: #247d91;
  --color-media-background: #22373c;
  --color-scrollbar-thumb: rgba(91, 109, 114, 0.4);
  --color-navigation: #25383d;
}

html[data-theme="dark"][data-theme-preset="polar-night"] {
  color-scheme: dark;
  --color-canvas: #0f1416;
  --color-panel: #161d20;
  --color-surface: #1c2528;
  --color-surface-raised: #243034;
  --color-surface-soft: #13191b;
  --color-surface-muted: #29373b;
  --color-input: #12181a;
  --color-hover: rgba(255, 255, 255, 0.06);
  --color-selected: rgba(77, 160, 181, 0.13);
  --color-selected-strong: rgba(77, 160, 181, 0.18);
  --color-text-primary: #eef5f6;
  --color-text-secondary: #a6b7bb;
  --color-text-muted: #788b90;
  --color-border-subtle: rgba(238, 245, 246, 0.07);
  --color-border: rgba(238, 245, 246, 0.11);
  --color-border-strong: rgba(238, 245, 246, 0.18);
  --color-border-emphasis: rgba(238, 245, 246, 0.28);
  --color-accent: #4da0b5;
  --color-accent-hover: #60b3c7;
  --color-accent-pressed: #39859a;
  --color-accent-soft: rgba(77, 160, 181, 0.14);
  --color-accent-border: rgba(77, 160, 181, 0.27);
  --color-focus-ring: rgba(77, 160, 181, 0.18);
  --color-info: #6f9fc3;
  --color-info-soft: rgba(111, 159, 195, 0.14);
  --color-shadow: rgba(0, 0, 0, 0.45);
  --color-shadow-tight: rgba(0, 0, 0, 0.32);
  --color-message-inbound: #29373b;
  --color-message-outbound: #347c8e;
  --color-media-background: #0b1012;
  --color-scrollbar-thumb: rgba(238, 245, 246, 0.24);
  --color-navigation: #1d2b2f;
}

html[data-theme-preset="paper-ink"] {
  color-scheme: light;
  --color-canvas: #f6f6f4;
  --color-panel: #efefec;
  --color-surface: #ffffff;
  --color-surface-raised: #ffffff;
  --color-surface-soft: #fafaf8;
  --color-surface-muted: #e7e7e2;
  --color-input: #ffffff;
  --color-hover: rgba(48, 48, 45, 0.06);
  --color-selected: rgba(48, 48, 45, 0.1);
  --color-selected-strong: rgba(48, 48, 45, 0.15);
  --color-text-primary: #1c1c1b;
  --color-text-secondary: #5f5f5b;
  --color-text-muted: #85857e;
  --color-border-subtle: rgba(28, 28, 27, 0.08);
  --color-border: rgba(28, 28, 27, 0.13);
  --color-border-strong: rgba(28, 28, 27, 0.2);
  --color-border-emphasis: rgba(28, 28, 27, 0.3);
  --color-accent: #30302d;
  --color-accent-hover: #181817;
  --color-accent-pressed: #000000;
  --color-accent-soft: rgba(48, 48, 45, 0.1);
  --color-accent-border: rgba(48, 48, 45, 0.24);
  --color-focus-ring: rgba(48, 48, 45, 0.18);
  --color-info: #555f69;
  --color-info-soft: rgba(85, 95, 105, 0.12);
  --color-shadow: rgba(20, 20, 19, 0.13);
  --color-shadow-tight: rgba(20, 20, 19, 0.09);
  --color-message-inbound: #e9e9e5;
  --color-message-outbound: #30302d;
  --color-media-background: #20201e;
  --color-scrollbar-thumb: rgba(95, 95, 91, 0.4);
  --color-navigation: #242424;
}

html[data-theme="dark"][data-theme-preset="carbon"] {
  color-scheme: dark;
  --color-canvas: #0e0f10;
  --color-panel: #151617;
  --color-surface: #1b1c1d;
  --color-surface-raised: #232425;
  --color-surface-soft: #121314;
  --color-surface-muted: #2b2c2e;
  --color-input: #111213;
  --color-hover: rgba(255, 255, 255, 0.06);
  --color-selected: rgba(217, 218, 214, 0.12);
  --color-selected-strong: rgba(217, 218, 214, 0.17);
  --color-text-primary: #f2f2ef;
  --color-text-secondary: #b3b4b0;
  --color-text-muted: #81827f;
  --color-border-subtle: rgba(242, 242, 239, 0.07);
  --color-border: rgba(242, 242, 239, 0.11);
  --color-border-strong: rgba(242, 242, 239, 0.18);
  --color-border-emphasis: rgba(242, 242, 239, 0.28);
  --color-accent: #d9dad6;
  --color-accent-hover: #f2f2ef;
  --color-accent-pressed: #b8b9b5;
  --color-accent-soft: rgba(217, 218, 214, 0.12);
  --color-accent-border: rgba(217, 218, 214, 0.25);
  --color-focus-ring: rgba(217, 218, 214, 0.18);
  --color-info: #aab4bd;
  --color-info-soft: rgba(170, 180, 189, 0.14);
  --color-on-accent: #151617;
  --color-shadow: rgba(0, 0, 0, 0.46);
  --color-shadow-tight: rgba(0, 0, 0, 0.34);
  --color-message-inbound: #2b2c2e;
  --color-message-outbound: #3b3c3e;
  --color-media-background: #090a0b;
  --color-scrollbar-thumb: rgba(242, 242, 239, 0.25);
  --color-navigation: #1c1d1e;
}

html[data-theme-preset="olive-archive"] {
  color-scheme: light;
  --color-canvas: #f6f5ef;
  --color-panel: #efeee5;
  --color-surface: #ffffff;
  --color-surface-raised: #ffffff;
  --color-surface-soft: #faf9f4;
  --color-surface-muted: #e7e5d8;
  --color-input: #ffffff;
  --color-hover: rgba(112, 120, 59, 0.07);
  --color-selected: rgba(112, 120, 59, 0.11);
  --color-selected-strong: rgba(112, 120, 59, 0.16);
  --color-text-primary: #292a22;
  --color-text-secondary: #686957;
  --color-text-muted: #898a76;
  --color-border-subtle: rgba(41, 42, 34, 0.08);
  --color-border: rgba(41, 42, 34, 0.13);
  --color-border-strong: rgba(41, 42, 34, 0.2);
  --color-border-emphasis: rgba(41, 42, 34, 0.3);
  --color-accent: #70783b;
  --color-accent-hover: #818a46;
  --color-accent-pressed: #59612f;
  --color-accent-soft: rgba(112, 120, 59, 0.11);
  --color-accent-border: rgba(112, 120, 59, 0.25);
  --color-focus-ring: rgba(112, 120, 59, 0.18);
  --color-info: #617b7f;
  --color-info-soft: rgba(97, 123, 127, 0.12);
  --color-shadow: rgba(52, 55, 35, 0.13);
  --color-shadow-tight: rgba(52, 55, 35, 0.09);
  --color-message-inbound: #eae8dd;
  --color-message-outbound: #657034;
  --color-media-background: #303224;
  --color-scrollbar-thumb: rgba(104, 105, 87, 0.4);
  --color-navigation: #303127;
}

html[data-theme="dark"][data-theme-preset="archive-night"] {
  color-scheme: dark;
  --color-canvas: #11120f;
  --color-panel: #181a14;
  --color-surface: #1e2119;
  --color-surface-raised: #262a20;
  --color-surface-soft: #151611;
  --color-surface-muted: #2e3327;
  --color-input: #141510;
  --color-hover: rgba(255, 255, 255, 0.06);
  --color-selected: rgba(163, 170, 98, 0.13);
  --color-selected-strong: rgba(163, 170, 98, 0.18);
  --color-text-primary: #f2f2e9;
  --color-text-secondary: #b2b49c;
  --color-text-muted: #82856d;
  --color-border-subtle: rgba(242, 242, 233, 0.07);
  --color-border: rgba(242, 242, 233, 0.11);
  --color-border-strong: rgba(242, 242, 233, 0.18);
  --color-border-emphasis: rgba(242, 242, 233, 0.28);
  --color-accent: #a3aa62;
  --color-accent-hover: #b5bc72;
  --color-accent-pressed: #858d4d;
  --color-accent-soft: rgba(163, 170, 98, 0.14);
  --color-accent-border: rgba(163, 170, 98, 0.27);
  --color-focus-ring: rgba(163, 170, 98, 0.18);
  --color-info: #82a2a0;
  --color-info-soft: rgba(130, 162, 160, 0.14);
  --color-on-accent: #181a14;
  --color-shadow: rgba(0, 0, 0, 0.45);
  --color-shadow-tight: rgba(0, 0, 0, 0.32);
  --color-message-inbound: #2e3327;
  --color-message-outbound: #6d743b;
  --color-media-background: #0c0d0a;
  --color-scrollbar-thumb: rgba(242, 242, 233, 0.24);
  --color-navigation: #27291f;
}

html[data-theme-preset="cloud-steel"] {
  color-scheme: light;
  --color-canvas: #f5f6f8;
  --color-panel: #eef1f4;
  --color-surface: #ffffff;
  --color-surface-raised: #ffffff;
  --color-surface-soft: #f9fafb;
  --color-surface-muted: #e3e7ec;
  --color-input: #ffffff;
  --color-hover: rgba(82, 122, 163, 0.07);
  --color-selected: rgba(82, 122, 163, 0.11);
  --color-selected-strong: rgba(82, 122, 163, 0.16);
  --color-text-primary: #202934;
  --color-text-secondary: #5c6977;
  --color-text-muted: #7e8a97;
  --color-border-subtle: rgba(32, 41, 52, 0.08);
  --color-border: rgba(32, 41, 52, 0.13);
  --color-border-strong: rgba(32, 41, 52, 0.2);
  --color-border-emphasis: rgba(32, 41, 52, 0.3);
  --color-accent: #527aa3;
  --color-accent-hover: #628db8;
  --color-accent-pressed: #406386;
  --color-accent-soft: rgba(82, 122, 163, 0.11);
  --color-accent-border: rgba(82, 122, 163, 0.25);
  --color-focus-ring: rgba(82, 122, 163, 0.18);
  --color-info: #4c8297;
  --color-info-soft: rgba(76, 130, 151, 0.12);
  --color-shadow: rgba(35, 54, 74, 0.13);
  --color-shadow-tight: rgba(35, 54, 74, 0.09);
  --color-message-inbound: #e5e9ee;
  --color-message-outbound: #527aa3;
  --color-media-background: #293744;
  --color-scrollbar-thumb: rgba(92, 105, 119, 0.4);
  --color-navigation: #2b3440;
}

html[data-theme="dark"][data-theme-preset="steel-night"] {
  color-scheme: dark;
  --color-canvas: #101214;
  --color-panel: #171a1e;
  --color-surface: #1d2126;
  --color-surface-raised: #252a30;
  --color-surface-soft: #14171a;
  --color-surface-muted: #2b3138;
  --color-input: #131619;
  --color-hover: rgba(255, 255, 255, 0.06);
  --color-selected: rgba(111, 152, 194, 0.13);
  --color-selected-strong: rgba(111, 152, 194, 0.18);
  --color-text-primary: #f0f3f5;
  --color-text-secondary: #a8b1ba;
  --color-text-muted: #78838e;
  --color-border-subtle: rgba(240, 243, 245, 0.07);
  --color-border: rgba(240, 243, 245, 0.11);
  --color-border-strong: rgba(240, 243, 245, 0.18);
  --color-border-emphasis: rgba(240, 243, 245, 0.28);
  --color-accent: #6f98c2;
  --color-accent-hover: #82abd4;
  --color-accent-pressed: #557da7;
  --color-accent-soft: rgba(111, 152, 194, 0.14);
  --color-accent-border: rgba(111, 152, 194, 0.27);
  --color-focus-ring: rgba(111, 152, 194, 0.18);
  --color-info: #70a5b0;
  --color-info-soft: rgba(112, 165, 176, 0.14);
  --color-shadow: rgba(0, 0, 0, 0.45);
  --color-shadow-tight: rgba(0, 0, 0, 0.32);
  --color-message-inbound: #2b3138;
  --color-message-outbound: #496f98;
  --color-media-background: #0c0e10;
  --color-scrollbar-thumb: rgba(240, 243, 245, 0.24);
  --color-navigation: #242a31;
}

html[data-theme-preset="high-contrast-light"] {
  color-scheme: light;
  --color-canvas: #f8f8f8;
  --color-panel: #eeeeee;
  --color-surface: #ffffff;
  --color-surface-raised: #ffffff;
  --color-surface-soft: #f7f7f7;
  --color-surface-muted: #dfdfdf;
  --color-input: #ffffff;
  --color-hover: rgba(0, 71, 168, 0.08);
  --color-selected: rgba(0, 71, 168, 0.14);
  --color-selected-strong: rgba(0, 71, 168, 0.2);
  --color-text-primary: #0b0b0b;
  --color-text-secondary: #303030;
  --color-text-muted: #5a5a5a;
  --color-border-subtle: rgba(0, 0, 0, 0.18);
  --color-border: rgba(0, 0, 0, 0.28);
  --color-border-strong: rgba(0, 0, 0, 0.42);
  --color-border-emphasis: rgba(0, 0, 0, 0.6);
  --color-accent: #0047a8;
  --color-accent-hover: #0059cc;
  --color-accent-pressed: #00367f;
  --color-accent-soft: rgba(0, 71, 168, 0.14);
  --color-accent-border: rgba(0, 71, 168, 0.42);
  --color-focus-ring: rgba(0, 71, 168, 0.34);
  --color-info: #0059a8;
  --color-info-soft: rgba(0, 89, 168, 0.14);
  --color-success: #086b3b;
  --color-success-soft: rgba(8, 107, 59, 0.14);
  --color-warning: #875500;
  --color-warning-soft: rgba(135, 85, 0, 0.14);
  --color-danger: #aa1e2e;
  --color-danger-soft: rgba(170, 30, 46, 0.14);
  --color-shadow: rgba(0, 0, 0, 0.18);
  --color-shadow-tight: rgba(0, 0, 0, 0.13);
  --color-message-inbound: #e4e4e4;
  --color-message-outbound: #0047a8;
  --color-media-background: #111111;
  --color-scrollbar-thumb: rgba(0, 0, 0, 0.56);
  --color-navigation: #111111;
}

html[data-theme="dark"][data-theme-preset="high-contrast-dark"] {
  color-scheme: dark;
  --color-canvas: #080808;
  --color-panel: #111111;
  --color-surface: #171717;
  --color-surface-raised: #202020;
  --color-surface-soft: #0d0d0d;
  --color-surface-muted: #2a2a2a;
  --color-input: #0c0c0c;
  --color-hover: rgba(255, 255, 255, 0.1);
  --color-selected: rgba(101, 169, 255, 0.18);
  --color-selected-strong: rgba(101, 169, 255, 0.26);
  --color-text-primary: #ffffff;
  --color-text-secondary: #dedede;
  --color-text-muted: #b1b1b1;
  --color-border-subtle: rgba(255, 255, 255, 0.2);
  --color-border: rgba(255, 255, 255, 0.3);
  --color-border-strong: rgba(255, 255, 255, 0.46);
  --color-border-emphasis: rgba(255, 255, 255, 0.66);
  --color-accent: #65a9ff;
  --color-accent-hover: #8bc0ff;
  --color-accent-pressed: #3f8de0;
  --color-accent-soft: rgba(101, 169, 255, 0.18);
  --color-accent-border: rgba(101, 169, 255, 0.46);
  --color-focus-ring: rgba(101, 169, 255, 0.38);
  --color-info: #78c7dc;
  --color-info-soft: rgba(120, 199, 220, 0.18);
  --color-success: #57d691;
  --color-success-soft: rgba(87, 214, 145, 0.18);
  --color-warning: #ffd166;
  --color-warning-soft: rgba(255, 209, 102, 0.18);
  --color-danger: #ff7583;
  --color-danger-soft: rgba(255, 117, 131, 0.18);
  --color-on-accent: #07111e;
  --color-shadow: rgba(0, 0, 0, 0.62);
  --color-shadow-tight: rgba(0, 0, 0, 0.46);
  --color-message-inbound: #2a2a2a;
  --color-message-outbound: #145da8;
  --color-media-background: #000000;
  --color-scrollbar-thumb: rgba(255, 255, 255, 0.56);
  --color-navigation: #000000;
}

html[data-theme-preset="colorblind-safe-light"] {
  color-scheme: light;
  --color-canvas: #f6f7f8;
  --color-panel: #eef1f3;
  --color-surface: #ffffff;
  --color-surface-raised: #ffffff;
  --color-surface-soft: #fafbfc;
  --color-surface-muted: #e2e7eb;
  --color-input: #ffffff;
  --color-hover: rgba(0, 114, 178, 0.07);
  --color-selected: rgba(0, 114, 178, 0.11);
  --color-selected-strong: rgba(0, 114, 178, 0.16);
  --color-text-primary: #17222b;
  --color-text-secondary: #53626e;
  --color-text-muted: #75838e;
  --color-border-subtle: rgba(23, 34, 43, 0.08);
  --color-border: rgba(23, 34, 43, 0.13);
  --color-border-strong: rgba(23, 34, 43, 0.2);
  --color-border-emphasis: rgba(23, 34, 43, 0.3);
  --color-accent: #0072b2;
  --color-accent-hover: #0084c9;
  --color-accent-pressed: #005b8f;
  --color-accent-soft: rgba(0, 114, 178, 0.11);
  --color-accent-border: rgba(0, 114, 178, 0.26);
  --color-focus-ring: rgba(0, 114, 178, 0.19);
  --color-info: #0072b2;
  --color-info-soft: rgba(0, 114, 178, 0.12);
  --color-success: #007c63;
  --color-success-soft: rgba(0, 124, 99, 0.13);
  --color-warning: #9a6900;
  --color-warning-soft: rgba(230, 159, 0, 0.15);
  --color-danger: #c34f00;
  --color-danger-soft: rgba(213, 94, 0, 0.13);
  --color-shadow: rgba(25, 48, 62, 0.13);
  --color-shadow-tight: rgba(25, 48, 62, 0.09);
  --color-message-inbound: #e3e8eb;
  --color-message-outbound: #00669f;
  --color-media-background: #1d303b;
  --color-scrollbar-thumb: rgba(83, 98, 110, 0.42);
  --color-navigation: #26323a;
}

html[data-theme="dark"][data-theme-preset="colorblind-safe-dark"] {
  color-scheme: dark;
  --color-canvas: #0d1114;
  --color-panel: #141a1e;
  --color-surface: #1a2227;
  --color-surface-raised: #222c32;
  --color-surface-soft: #11171a;
  --color-surface-muted: #29353c;
  --color-input: #101619;
  --color-hover: rgba(255, 255, 255, 0.06);
  --color-selected: rgba(86, 180, 233, 0.14);
  --color-selected-strong: rgba(86, 180, 233, 0.2);
  --color-text-primary: #f4f7f8;
  --color-text-secondary: #b4c0c6;
  --color-text-muted: #84939a;
  --color-border-subtle: rgba(244, 247, 248, 0.07);
  --color-border: rgba(244, 247, 248, 0.12);
  --color-border-strong: rgba(244, 247, 248, 0.2);
  --color-border-emphasis: rgba(244, 247, 248, 0.3);
  --color-accent: #56b4e9;
  --color-accent-hover: #75c4ee;
  --color-accent-pressed: #2e99cc;
  --color-accent-soft: rgba(86, 180, 233, 0.14);
  --color-accent-border: rgba(86, 180, 233, 0.28);
  --color-focus-ring: rgba(86, 180, 233, 0.2);
  --color-info: #56b4e9;
  --color-info-soft: rgba(86, 180, 233, 0.15);
  --color-success: #35c49a;
  --color-success-soft: rgba(0, 158, 115, 0.17);
  --color-warning: #e69f00;
  --color-warning-soft: rgba(230, 159, 0, 0.17);
  --color-danger: #e57228;
  --color-danger-soft: rgba(213, 94, 0, 0.17);
  --color-on-accent: #10202a;
  --color-shadow: rgba(0, 0, 0, 0.46);
  --color-shadow-tight: rgba(0, 0, 0, 0.34);
  --color-message-inbound: #29353c;
  --color-message-outbound: #0072b2;
  --color-media-background: #090d0f;
  --color-scrollbar-thumb: rgba(244, 247, 248, 0.27);
  --color-navigation: #1c272d;
}

html[data-theme-preset="berry-grove"] {
  color-scheme: light;
  --color-canvas: #f7f6f2;
  --color-panel: #f1efe9;
  --color-surface: #fcfbf8;
  --color-surface-raised: #ffffff;
  --color-surface-soft: #f5f3ed;
  --color-surface-muted: #e9e7df;
  --color-input: #ffffff;
  --color-hover: rgba(204, 58, 99, 0.07);
  --color-selected: rgba(204, 58, 99, 0.11);
  --color-selected-strong: rgba(204, 58, 99, 0.16);
  --color-text-primary: #292b2d;
  --color-text-secondary: #62666a;
  --color-text-muted: #898d90;
  --color-border-subtle: rgba(41, 43, 45, 0.08);
  --color-border: rgba(41, 43, 45, 0.13);
  --color-border-strong: rgba(41, 43, 45, 0.2);
  --color-border-emphasis: rgba(41, 43, 45, 0.3);
  --color-accent: #cc3a63;
  --color-accent-hover: #db4d73;
  --color-accent-pressed: #ab2e50;
  --color-accent-soft: rgba(204, 58, 99, 0.11);
  --color-accent-border: rgba(204, 58, 99, 0.25);
  --color-focus-ring: rgba(204, 58, 99, 0.18);
  --color-info: #7f8955;
  --color-info-soft: rgba(162, 171, 115, 0.17);
  --color-shadow: rgba(72, 54, 43, 0.13);
  --color-shadow-tight: rgba(72, 54, 43, 0.09);
  --color-message-inbound: #efede6;
  --color-message-outbound: #b83258;
  --color-media-background: #3d3e2c;
  --color-scrollbar-thumb: rgba(110, 99, 93, 0.4);
  --color-navigation: #626b3e;
}

html[data-theme="dark"][data-theme-preset="linen-graphite"] {
  color-scheme: dark;
  --color-canvas: #222831;
  --color-panel: #2a3038;
  --color-surface: #393e46;
  --color-surface-raised: #444b55;
  --color-surface-soft: #262c34;
  --color-surface-muted: #4b5058;
  --color-input: #2c323a;
  --color-hover: rgba(255, 255, 255, 0.07);
  --color-selected: rgba(223, 208, 184, 0.13);
  --color-selected-strong: rgba(223, 208, 184, 0.19);
  --color-text-primary: #f5efe6;
  --color-text-secondary: #dfd0b8;
  --color-text-muted: #aaa195;
  --color-border-subtle: rgba(245, 239, 230, 0.08);
  --color-border: rgba(245, 239, 230, 0.13);
  --color-border-strong: rgba(245, 239, 230, 0.2);
  --color-border-emphasis: rgba(245, 239, 230, 0.3);
  --color-accent: #dfd0b8;
  --color-accent-hover: #eadfce;
  --color-accent-pressed: #bcae98;
  --color-accent-soft: rgba(223, 208, 184, 0.14);
  --color-accent-border: rgba(223, 208, 184, 0.28);
  --color-focus-ring: rgba(223, 208, 184, 0.2);
  --color-info: #b4a797;
  --color-info-soft: rgba(148, 137, 121, 0.18);
  --color-shadow: rgba(0, 0, 0, 0.48);
  --color-shadow-tight: rgba(0, 0, 0, 0.35);
  --color-message-inbound: #4b5058;
  --color-message-outbound: #766d61;
  --color-media-background: #171c23;
  --color-scrollbar-thumb: rgba(223, 208, 184, 0.3);
  --color-navigation: #222831;
}

html[data-theme-preset="blush-veil"] {
  color-scheme: light;
  --color-canvas: #f7f6f7;
  --color-panel: #f1eff2;
  --color-surface: #fcfbfc;
  --color-surface-raised: #ffffff;
  --color-surface-soft: #f5f3f5;
  --color-surface-muted: #e9e4ea;
  --color-input: #ffffff;
  --color-hover: rgba(148, 120, 168, 0.08);
  --color-selected: rgba(148, 120, 168, 0.12);
  --color-selected-strong: rgba(148, 120, 168, 0.17);
  --color-text-primary: #2d2b2f;
  --color-text-secondary: #666269;
  --color-text-muted: #8d8990;
  --color-border-subtle: rgba(45, 43, 47, 0.08);
  --color-border: rgba(45, 43, 47, 0.13);
  --color-border-strong: rgba(45, 43, 47, 0.2);
  --color-border-emphasis: rgba(45, 43, 47, 0.3);
  --color-accent: #9478a8;
  --color-accent-hover: #a789b9;
  --color-accent-pressed: #795f8e;
  --color-accent-soft: rgba(148, 120, 168, 0.12);
  --color-accent-border: rgba(148, 120, 168, 0.26);
  --color-focus-ring: rgba(148, 120, 168, 0.19);
  --color-info: #a986b3;
  --color-info-soft: rgba(197, 179, 211, 0.2);
  --color-shadow: rgba(76, 53, 74, 0.13);
  --color-shadow-tight: rgba(76, 53, 74, 0.09);
  --color-message-inbound: #eee9ef;
  --color-message-outbound: #856898;
  --color-media-background: #4a394f;
  --color-scrollbar-thumb: rgba(113, 98, 114, 0.4);
  --color-navigation: #5b4966;
}

html[data-theme="dark"][data-theme-preset="deep-fjord"] {
  color-scheme: dark;
  --color-canvas: #15191d;
  --color-panel: #1b2025;
  --color-surface: #22282e;
  --color-surface-raised: #2a3239;
  --color-surface-soft: #181d22;
  --color-surface-muted: #343e46;
  --color-input: #20272d;
  --color-hover: rgba(255, 255, 255, 0.07);
  --color-selected: rgba(210, 193, 182, 0.14);
  --color-selected-strong: rgba(210, 193, 182, 0.2);
  --color-text-primary: #f1f3f4;
  --color-text-secondary: #c1c7cb;
  --color-text-muted: #8f999f;
  --color-border-subtle: rgba(241, 243, 244, 0.08);
  --color-border: rgba(241, 243, 244, 0.13);
  --color-border-strong: rgba(241, 243, 244, 0.2);
  --color-border-emphasis: rgba(241, 243, 244, 0.3);
  --color-accent: #d2c1b6;
  --color-accent-hover: #e0d3ca;
  --color-accent-pressed: #b39f93;
  --color-accent-soft: rgba(210, 193, 182, 0.14);
  --color-accent-border: rgba(210, 193, 182, 0.28);
  --color-focus-ring: rgba(210, 193, 182, 0.2);
  --color-info: #7ba0b8;
  --color-info-soft: rgba(69, 104, 130, 0.22);
  --color-shadow: rgba(5, 20, 31, 0.5);
  --color-shadow-tight: rgba(5, 20, 31, 0.36);
  --color-message-inbound: #343e46;
  --color-message-outbound: #315f7d;
  --color-media-background: #101417;
  --color-scrollbar-thumb: rgba(210, 193, 182, 0.3);
  --color-navigation: #173447;
}

html[data-theme-preset="clay-sage"] {
  color-scheme: light;
  --color-canvas: #f7f6f2;
  --color-panel: #f0ede7;
  --color-surface: #fcfbf8;
  --color-surface-raised: #ffffff;
  --color-surface-soft: #f5f2ed;
  --color-surface-muted: #e8e3da;
  --color-input: #ffffff;
  --color-hover: rgba(123, 37, 37, 0.07);
  --color-selected: rgba(186, 106, 76, 0.12);
  --color-selected-strong: rgba(186, 106, 76, 0.18);
  --color-text-primary: #2d2c29;
  --color-text-secondary: #66635e;
  --color-text-muted: #8c8880;
  --color-border-subtle: rgba(45, 44, 41, 0.08);
  --color-border: rgba(45, 44, 41, 0.13);
  --color-border-strong: rgba(45, 44, 41, 0.2);
  --color-border-emphasis: rgba(45, 44, 41, 0.3);
  --color-accent: #7b2525;
  --color-accent-hover: #8d3030;
  --color-accent-pressed: #641c1c;
  --color-accent-soft: rgba(123, 37, 37, 0.1);
  --color-accent-border: rgba(123, 37, 37, 0.24);
  --color-focus-ring: rgba(123, 37, 37, 0.18);
  --color-info: #607456;
  --color-info-soft: rgba(96, 116, 86, 0.16);
  --color-shadow: rgba(55, 45, 37, 0.13);
  --color-shadow-tight: rgba(55, 45, 37, 0.09);
  --color-message-inbound: #eeeae3;
  --color-message-outbound: #7b2525;
  --color-media-background: #30382b;
  --color-scrollbar-thumb: rgba(96, 99, 92, 0.4);
  --color-navigation: #607456;
}

html[data-theme="dark"][data-theme-preset="citrus-grove"] {
  color-scheme: dark;
  --color-canvas: #171816;
  --color-panel: #1e211d;
  --color-surface: #252923;
  --color-surface-raised: #30362f;
  --color-surface-soft: #191c18;
  --color-surface-muted: #394038;
  --color-input: #22261f;
  --color-hover: rgba(255, 255, 255, 0.07);
  --color-selected: rgba(235, 125, 0, 0.13);
  --color-selected-strong: rgba(235, 125, 0, 0.2);
  --color-text-primary: #f2f1ec;
  --color-text-secondary: #c7c7bd;
  --color-text-muted: #92978d;
  --color-border-subtle: rgba(242, 241, 236, 0.08);
  --color-border: rgba(242, 241, 236, 0.13);
  --color-border-strong: rgba(242, 241, 236, 0.2);
  --color-border-emphasis: rgba(242, 241, 236, 0.3);
  --color-accent: #eb7d00;
  --color-accent-hover: #fa901d;
  --color-accent-pressed: #c96800;
  --color-accent-soft: rgba(235, 125, 0, 0.13);
  --color-accent-border: rgba(235, 125, 0, 0.28);
  --color-focus-ring: rgba(235, 125, 0, 0.2);
  --color-info: #6e9a87;
  --color-info-soft: rgba(44, 87, 69, 0.3);
  --color-shadow: rgba(0, 0, 0, 0.48);
  --color-shadow-tight: rgba(0, 0, 0, 0.35);
  --color-message-inbound: #394038;
  --color-message-outbound: #a75d0b;
  --color-media-background: #0d0f0c;
  --color-scrollbar-thumb: rgba(235, 227, 167, 0.28);
  --color-navigation: #2e2910;
}

html[data-theme-preset="coastal-apricot"] {
  color-scheme: light;
  --color-canvas: #f6f7f7;
  --color-panel: #eef1f2;
  --color-surface: #fbfbfa;
  --color-surface-raised: #ffffff;
  --color-surface-soft: #f3f4f4;
  --color-surface-muted: #e2e5e6;
  --color-input: #ffffff;
  --color-hover: rgba(201, 120, 64, 0.07);
  --color-selected: rgba(226, 161, 111, 0.14);
  --color-selected-strong: rgba(226, 161, 111, 0.2);
  --color-text-primary: #292d2f;
  --color-text-secondary: #62696d;
  --color-text-muted: #899095;
  --color-border-subtle: rgba(41, 45, 47, 0.08);
  --color-border: rgba(41, 45, 47, 0.13);
  --color-border-strong: rgba(41, 45, 47, 0.2);
  --color-border-emphasis: rgba(41, 45, 47, 0.3);
  --color-accent: #c97840;
  --color-accent-hover: #da8950;
  --color-accent-pressed: #aa6030;
  --color-accent-soft: rgba(226, 161, 111, 0.14);
  --color-accent-border: rgba(201, 120, 64, 0.26);
  --color-focus-ring: rgba(201, 120, 64, 0.18);
  --color-info: #5f8f9e;
  --color-info-soft: rgba(134, 176, 189, 0.18);
  --color-on-accent: #211a16;
  --color-on-accent-hover: #211a16;
  --color-on-accent-pressed: #ffffff;
  --color-shadow: rgba(43, 54, 59, 0.12);
  --color-shadow-tight: rgba(43, 54, 59, 0.08);
  --color-message-inbound: #e9edef;
  --color-message-outbound: #b66b38;
  --color-media-background: #32434a;
  --color-scrollbar-thumb: rgba(98, 105, 109, 0.38);
  --color-navigation: #4e6972;
}

html[data-theme="dark"][data-theme-preset="neon-noir"] {
  color-scheme: dark;
  --color-canvas: #121214;
  --color-panel: #19191d;
  --color-surface: #222227;
  --color-surface-raised: #2c2c32;
  --color-surface-soft: #161619;
  --color-surface-muted: #35353c;
  --color-input: #1d1d21;
  --color-hover: rgba(255, 255, 255, 0.07);
  --color-selected: rgba(203, 41, 87, 0.14);
  --color-selected-strong: rgba(203, 41, 87, 0.21);
  --color-text-primary: #f2f2f3;
  --color-text-secondary: #c4c4c8;
  --color-text-muted: #909096;
  --color-border-subtle: rgba(242, 242, 243, 0.08);
  --color-border: rgba(242, 242, 243, 0.13);
  --color-border-strong: rgba(242, 242, 243, 0.2);
  --color-border-emphasis: rgba(242, 242, 243, 0.3);
  --color-accent: #cb2957;
  --color-accent-hover: #dc3a68;
  --color-accent-pressed: #a91f47;
  --color-accent-soft: rgba(203, 41, 87, 0.14);
  --color-accent-border: rgba(203, 41, 87, 0.3);
  --color-focus-ring: rgba(203, 41, 87, 0.22);
  --color-info: #d85d82;
  --color-info-soft: rgba(203, 41, 87, 0.18);
  --color-shadow: rgba(0, 0, 0, 0.52);
  --color-shadow-tight: rgba(0, 0, 0, 0.38);
  --color-message-inbound: #35353c;
  --color-message-outbound: #a9234a;
  --color-media-background: #08080a;
  --color-scrollbar-thumb: rgba(221, 221, 221, 0.27);
  --color-navigation: #000000;
}

html[data-theme-preset="harbor-signal"] {
  color-scheme: light;
  --color-canvas: #f6f7f7;
  --color-panel: #edf0f1;
  --color-surface: #fbfbfb;
  --color-surface-raised: #ffffff;
  --color-surface-soft: #f2f4f4;
  --color-surface-muted: #e2e6e7;
  --color-input: #ffffff;
  --color-hover: rgba(230, 74, 25, 0.07);
  --color-selected: rgba(118, 171, 174, 0.16);
  --color-selected-strong: rgba(118, 171, 174, 0.23);
  --color-text-primary: #262b30;
  --color-text-secondary: #606970;
  --color-text-muted: #858e94;
  --color-border-subtle: rgba(38, 43, 48, 0.08);
  --color-border: rgba(38, 43, 48, 0.13);
  --color-border-strong: rgba(38, 43, 48, 0.2);
  --color-border-emphasis: rgba(38, 43, 48, 0.3);
  --color-accent: #e64a19;
  --color-accent-hover: #f25b2c;
  --color-accent-pressed: #c53c12;
  --color-accent-soft: rgba(255, 87, 34, 0.1);
  --color-accent-border: rgba(230, 74, 25, 0.25);
  --color-focus-ring: rgba(230, 74, 25, 0.18);
  --color-info: #568f92;
  --color-info-soft: rgba(118, 171, 174, 0.18);
  --color-on-accent: #1d1714;
  --color-on-accent-hover: #1d1714;
  --color-on-accent-pressed: #ffffff;
  --color-shadow: rgba(35, 45, 51, 0.13);
  --color-shadow-tight: rgba(35, 45, 51, 0.09);
  --color-message-inbound: #e7ebec;
  --color-message-outbound: #cf4217;
  --color-media-background: #303841;
  --color-scrollbar-thumb: rgba(80, 91, 99, 0.4);
  --color-navigation: #303841;
}

html[data-theme="dark"][data-theme-preset="amethyst-pulse"] {
  color-scheme: dark;
  --color-canvas: #17151c;
  --color-panel: #1d1925;
  --color-surface: #25202d;
  --color-surface-raised: #30283a;
  --color-surface-soft: #1a171f;
  --color-surface-muted: #3a3146;
  --color-input: #211c28;
  --color-hover: rgba(255, 255, 255, 0.07);
  --color-selected: rgba(193, 51, 131, 0.15);
  --color-selected-strong: rgba(193, 51, 131, 0.22);
  --color-text-primary: #f3f1f4;
  --color-text-secondary: #cbc5ce;
  --color-text-muted: #968e9b;
  --color-border-subtle: rgba(243, 241, 244, 0.08);
  --color-border: rgba(243, 241, 244, 0.13);
  --color-border-strong: rgba(243, 241, 244, 0.2);
  --color-border-emphasis: rgba(243, 241, 244, 0.3);
  --color-accent: #e05454;
  --color-accent-hover: #eb6868;
  --color-accent-pressed: #bc4242;
  --color-accent-soft: rgba(224, 84, 84, 0.14);
  --color-accent-border: rgba(224, 84, 84, 0.3);
  --color-focus-ring: rgba(224, 84, 84, 0.22);
  --color-info: #c15a9a;
  --color-info-soft: rgba(193, 51, 131, 0.2);
  --color-shadow: rgba(0, 0, 0, 0.5);
  --color-shadow-tight: rgba(0, 0, 0, 0.36);
  --color-message-inbound: #3a3146;
  --color-message-outbound: #9c286c;
  --color-media-background: #100d14;
  --color-scrollbar-thumb: rgba(224, 84, 84, 0.29);
  --color-navigation: #443199;
}

html[data-theme-preset="amber-cream"] {
  color-scheme: light;
  --color-canvas: #f8f7f3;
  --color-panel: #f2efe8;
  --color-surface: #fffdf8;
  --color-surface-raised: #ffffff;
  --color-surface-soft: #f6f3eb;
  --color-surface-muted: #eae5d9;
  --color-input: #ffffff;
  --color-hover: rgba(230, 127, 37, 0.07);
  --color-selected: rgba(255, 150, 68, 0.14);
  --color-selected-strong: rgba(255, 150, 68, 0.2);
  --color-text-primary: #302b25;
  --color-text-secondary: #69635b;
  --color-text-muted: #8e887f;
  --color-border-subtle: rgba(48, 43, 37, 0.08);
  --color-border: rgba(48, 43, 37, 0.13);
  --color-border-strong: rgba(48, 43, 37, 0.2);
  --color-border-emphasis: rgba(48, 43, 37, 0.3);
  --color-accent: #e67f25;
  --color-accent-hover: #f18f36;
  --color-accent-pressed: #c86a18;
  --color-accent-soft: rgba(255, 150, 68, 0.13);
  --color-accent-border: rgba(230, 127, 37, 0.26);
  --color-focus-ring: rgba(230, 127, 37, 0.18);
  --color-info: #a66f35;
  --color-info-soft: rgba(255, 206, 153, 0.24);
  --color-on-accent: #21170d;
  --color-on-accent-hover: #21170d;
  --color-on-accent-pressed: #ffffff;
  --color-shadow: rgba(75, 52, 31, 0.13);
  --color-shadow-tight: rgba(75, 52, 31, 0.09);
  --color-message-inbound: #eee9de;
  --color-message-outbound: #d87520;
  --color-media-background: #562f00;
  --color-scrollbar-thumb: rgba(105, 99, 91, 0.4);
  --color-navigation: #562f00;
}

html[data-theme="dark"][data-theme-preset="moss-charcoal"] {
  color-scheme: dark;
  --color-canvas: #151713;
  --color-panel: #1b1d19;
  --color-surface: #22241f;
  --color-surface-raised: #2b2e28;
  --color-surface-soft: #181a16;
  --color-surface-muted: #383b34;
  --color-input: #20231d;
  --color-hover: rgba(255, 255, 255, 0.07);
  --color-selected: rgba(105, 117, 101, 0.2);
  --color-selected-strong: rgba(105, 117, 101, 0.28);
  --color-text-primary: #f2efe9;
  --color-text-secondary: #c9c5bd;
  --color-text-muted: #94968f;
  --color-border-subtle: rgba(242, 239, 233, 0.08);
  --color-border: rgba(242, 239, 233, 0.13);
  --color-border-strong: rgba(242, 239, 233, 0.2);
  --color-border-emphasis: rgba(242, 239, 233, 0.3);
  --color-accent: #ecdfcc;
  --color-accent-hover: #f4e9da;
  --color-accent-pressed: #c9bca9;
  --color-accent-soft: rgba(236, 223, 204, 0.13);
  --color-accent-border: rgba(236, 223, 204, 0.27);
  --color-focus-ring: rgba(236, 223, 204, 0.19);
  --color-info: #82917d;
  --color-info-soft: rgba(105, 117, 101, 0.22);
  --color-shadow: rgba(0, 0, 0, 0.48);
  --color-shadow-tight: rgba(0, 0, 0, 0.35);
  --color-message-inbound: #383b34;
  --color-message-outbound: #65705f;
  --color-media-background: #0d0f0c;
  --color-scrollbar-thumb: rgba(236, 223, 204, 0.27);
  --color-navigation: #181c14;
}

/* Dark presets use light accent fills. Pair those fills with a dark label;
   the three warmer pressed fills remain dark enough to require white. */
html[data-theme="dark"]:is(
  [data-theme-preset="forest-night"],
  [data-theme-preset="ember-night"],
  [data-theme-preset="plum-shadow"],
  [data-theme-preset="copper-graphite"],
  [data-theme-preset="oxblood-night"],
  [data-theme-preset="polar-night"],
  [data-theme-preset="carbon"],
  [data-theme-preset="archive-night"],
  [data-theme-preset="steel-night"],
  [data-theme-preset="high-contrast-dark"],
  [data-theme-preset="colorblind-safe-dark"],
  [data-theme-preset="linen-graphite"],
  [data-theme-preset="deep-fjord"],
  [data-theme-preset="citrus-grove"],
  [data-theme-preset="amethyst-pulse"],
  [data-theme-preset="moss-charcoal"]
) {
  --color-on-accent: #000000;
  --color-on-accent-hover: #000000;
  --color-on-accent-pressed: #000000;
}

html[data-theme="dark"]:is(
  [data-theme-preset="ember-night"],
  [data-theme-preset="plum-shadow"],
  [data-theme-preset="oxblood-night"],
  [data-theme-preset="amethyst-pulse"]
) {
  --color-on-accent-pressed: #ffffff;
}

.portal-theme-picker {
  position: relative;
  flex: 0 0 auto;
}

.portal-theme-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 660px;
  max-width: calc(100vw - 20px);
  max-height: calc(100vh - 74px);
  display: flex;
  flex-direction: column;
  padding: 22px;
  border: 1px solid var(--color-border-strong);
  border-radius: 22px;
  background: var(--color-surface-raised);
  color: var(--color-text-primary);
  box-shadow: 0 18px 46px var(--color-shadow);
  z-index: 320;
  transform-origin: top right;
  animation: portal-theme-menu-in 150ms ease-out both;
}

@keyframes portal-theme-menu-in {
  from { opacity: 0; transform: translateY(-5px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.portal-appearance-tabs {
  display: flex;
  align-items: center;
  gap: 26px;
  flex: 0 0 auto;
  margin: 0 6px 20px;
  border-bottom: 1px solid var(--color-border-subtle);
}

.portal-appearance-tab {
  position: relative;
  min-height: 38px;
  margin-bottom: -1px;
  padding: 0 1px 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 16px;
  font-weight: 750;
  transition: border-color 150ms ease, color 150ms ease;
}

.portal-appearance-tab:hover {
  color: var(--color-text-primary);
}

.portal-appearance-tab:focus-visible {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 3px;
  border-radius: 4px;
}

.portal-appearance-tab.is-active {
  border-bottom-color: var(--color-accent);
  color: var(--color-text-primary);
}

.portal-theme-options {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 3px;
  scrollbar-width: thin;
  scrollbar-color: var(--color-scrollbar-thumb) transparent;
}

.portal-theme-option {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  min-height: 112px;
  padding: 13px;
  border: 1px solid var(--color-border);
  border-radius: 17px;
  background: var(--color-surface-soft);
  color: var(--color-text-primary);
  text-align: left;
  transition: background-color 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.portal-theme-option:hover,
.portal-theme-option:focus-visible {
  border-color: var(--color-accent-border);
  background: var(--color-hover);
}

.portal-theme-option:focus-visible {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 1px;
}

.portal-theme-option:active { transform: translateY(1px); }

.portal-theme-option.is-active {
  border-color: var(--color-accent-border);
  background: var(--color-selected);
}

.portal-theme-preview {
  --theme-preview-canvas: #f7f8fa;
  --theme-preview-panel: #ffffff;
  --theme-preview-muted: #eef3f8;
  --theme-preview-selected: #dfe9f6;
  --theme-preview-nav: #2d3043;
  --theme-preview-line: #dbe2ea;
  --theme-preview-accent: #0f3f86;
  width: 132px;
  height: 84px;
  display: grid;
  grid-template-columns: 27px 1fr;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--theme-preview-line) 80%, transparent);
  border-radius: 12px;
  background: var(--theme-preview-canvas);
}

.portal-theme-option.is-mitsolab-dark .portal-theme-preview {
  --theme-preview-canvas: #0d0e10;
  --theme-preview-panel: #1b1c1e;
  --theme-preview-muted: #25272a;
  --theme-preview-selected: #203047;
  --theme-preview-nav: #2d3043;
  --theme-preview-line: #45474d;
  --theme-preview-accent: #4a90d9;
}

.portal-theme-option.is-ocean-mist .portal-theme-preview {
  --theme-preview-canvas: #f2f7f8;
  --theme-preview-panel: #ffffff;
  --theme-preview-muted: #e3edef;
  --theme-preview-selected: #d9eaec;
  --theme-preview-nav: #26383c;
  --theme-preview-line: #cbdadd;
  --theme-preview-accent: #156370;
}

.portal-theme-option.is-forest-night .portal-theme-preview {
  --theme-preview-canvas: #101412;
  --theme-preview-panel: #1b211e;
  --theme-preview-muted: #28302b;
  --theme-preview-selected: #21352a;
  --theme-preview-nav: #202823;
  --theme-preview-line: #465149;
  --theme-preview-accent: #65b085;
}

.portal-theme-option.is-nordic-sand .portal-theme-preview {
  --theme-preview-canvas: #f7f6f2;
  --theme-preview-panel: #ffffff;
  --theme-preview-muted: #ebe8e1;
  --theme-preview-selected: #f1e3dc;
  --theme-preview-nav: #34302d;
  --theme-preview-line: #dcd8d1;
  --theme-preview-accent: #b65f3f;
}

.portal-theme-option.is-sage-paper .portal-theme-preview {
  --theme-preview-canvas: #f5f7f5;
  --theme-preview-panel: #ffffff;
  --theme-preview-muted: #e5e9e5;
  --theme-preview-selected: #e1ebe3;
  --theme-preview-nav: #2f3732;
  --theme-preview-line: #d5dcd6;
  --theme-preview-accent: #426b50;
}

.portal-theme-option.is-lavender-fog .portal-theme-preview {
  --theme-preview-canvas: #f7f7f9;
  --theme-preview-panel: #ffffff;
  --theme-preview-muted: #e8e7ef;
  --theme-preview-selected: #eae6f4;
  --theme-preview-nav: #343440;
  --theme-preview-line: #d8d6df;
  --theme-preview-accent: #6955a6;
}

.portal-theme-option.is-ember-night .portal-theme-preview {
  --theme-preview-canvas: #141413;
  --theme-preview-panel: #222222;
  --theme-preview-muted: #3d3d3a;
  --theme-preview-selected: rgba(181, 99, 73, 0.16);
  --theme-preview-nav: #1f1e1d;
  --theme-preview-line: #5e5d59;
  --theme-preview-accent: #b56349;
}

.portal-theme-option.is-plum-shadow .portal-theme-preview {
  --theme-preview-canvas: #110f13;
  --theme-preview-panel: #201b23;
  --theme-preview-muted: #302936;
  --theme-preview-selected: #392a40;
  --theme-preview-nav: #29222f;
  --theme-preview-line: #4f4555;
  --theme-preview-accent: #a87ac1;
}

.portal-theme-option.is-copper-graphite .portal-theme-preview {
  --theme-preview-canvas: #101112;
  --theme-preview-panel: #1e2021;
  --theme-preview-muted: #2d3031;
  --theme-preview-selected: #3a3028;
  --theme-preview-nav: #292725;
  --theme-preview-line: #48494a;
  --theme-preview-accent: #c48755;
}

.portal-theme-option.is-porcelain-rose .portal-theme-preview {
  --theme-preview-canvas: #f7f6f5;
  --theme-preview-panel: #ffffff;
  --theme-preview-muted: #ebe5e6;
  --theme-preview-selected: #f0dfe3;
  --theme-preview-nav: #352b2f;
  --theme-preview-line: #dcd5d7;
  --theme-preview-accent: #a34f62;
}

.portal-theme-option.is-oxblood-night .portal-theme-preview {
  --theme-preview-canvas: #120f10;
  --theme-preview-panel: #211a1d;
  --theme-preview-muted: #34282c;
  --theme-preview-selected: #40262d;
  --theme-preview-nav: #2a2023;
  --theme-preview-line: #554148;
  --theme-preview-accent: #bd6878;
}

.portal-theme-option.is-arctic-glass .portal-theme-preview {
  --theme-preview-canvas: #f4f7f8;
  --theme-preview-panel: #ffffff;
  --theme-preview-muted: #e2eaec;
  --theme-preview-selected: #dcebee;
  --theme-preview-nav: #25383d;
  --theme-preview-line: #cfdbde;
  --theme-preview-accent: #247d91;
}

.portal-theme-option.is-polar-night .portal-theme-preview {
  --theme-preview-canvas: #0f1416;
  --theme-preview-panel: #1c2528;
  --theme-preview-muted: #29373b;
  --theme-preview-selected: #203941;
  --theme-preview-nav: #1d2b2f;
  --theme-preview-line: #405158;
  --theme-preview-accent: #4da0b5;
}

.portal-theme-option.is-paper-ink .portal-theme-preview {
  --theme-preview-canvas: #f6f6f4;
  --theme-preview-panel: #ffffff;
  --theme-preview-muted: #e7e7e2;
  --theme-preview-selected: #deded8;
  --theme-preview-nav: #242424;
  --theme-preview-line: #d1d1cc;
  --theme-preview-accent: #30302d;
}

.portal-theme-option.is-carbon .portal-theme-preview {
  --theme-preview-canvas: #0e0f10;
  --theme-preview-panel: #1b1c1d;
  --theme-preview-muted: #2b2c2e;
  --theme-preview-selected: #37383a;
  --theme-preview-nav: #1c1d1e;
  --theme-preview-line: #4a4b4d;
  --theme-preview-accent: #d9dad6;
}

.portal-theme-option.is-olive-archive .portal-theme-preview {
  --theme-preview-canvas: #f6f5ef;
  --theme-preview-panel: #ffffff;
  --theme-preview-muted: #e7e5d8;
  --theme-preview-selected: #e5e7d2;
  --theme-preview-nav: #303127;
  --theme-preview-line: #d6d4c7;
  --theme-preview-accent: #70783b;
}

.portal-theme-option.is-archive-night .portal-theme-preview {
  --theme-preview-canvas: #11120f;
  --theme-preview-panel: #1e2119;
  --theme-preview-muted: #2e3327;
  --theme-preview-selected: #363d27;
  --theme-preview-nav: #27291f;
  --theme-preview-line: #474d3c;
  --theme-preview-accent: #a3aa62;
}

.portal-theme-option.is-cloud-steel .portal-theme-preview {
  --theme-preview-canvas: #f5f6f8;
  --theme-preview-panel: #ffffff;
  --theme-preview-muted: #e3e7ec;
  --theme-preview-selected: #e0e8f0;
  --theme-preview-nav: #2b3440;
  --theme-preview-line: #d1d7df;
  --theme-preview-accent: #527aa3;
}

.portal-theme-option.is-steel-night .portal-theme-preview {
  --theme-preview-canvas: #101214;
  --theme-preview-panel: #1d2126;
  --theme-preview-muted: #2b3138;
  --theme-preview-selected: #29384a;
  --theme-preview-nav: #242a31;
  --theme-preview-line: #454d56;
  --theme-preview-accent: #6f98c2;
}

.portal-theme-option.is-high-contrast-light .portal-theme-preview {
  --theme-preview-canvas: #f8f8f8;
  --theme-preview-panel: #ffffff;
  --theme-preview-muted: #dfdfdf;
  --theme-preview-selected: #d5e4f7;
  --theme-preview-nav: #111111;
  --theme-preview-line: #a8a8a8;
  --theme-preview-accent: #0047a8;
}

.portal-theme-option.is-high-contrast-dark .portal-theme-preview {
  --theme-preview-canvas: #080808;
  --theme-preview-panel: #171717;
  --theme-preview-muted: #2a2a2a;
  --theme-preview-selected: #17365c;
  --theme-preview-nav: #000000;
  --theme-preview-line: #707070;
  --theme-preview-accent: #65a9ff;
}

.portal-theme-option.is-colorblind-safe-light .portal-theme-preview {
  --theme-preview-canvas: #f6f7f8;
  --theme-preview-panel: #ffffff;
  --theme-preview-muted: #e2e7eb;
  --theme-preview-selected: #dceaf2;
  --theme-preview-nav: #26323a;
  --theme-preview-line: #cdd6dc;
  --theme-preview-accent: #0072b2;
}

.portal-theme-option.is-colorblind-safe-dark .portal-theme-preview {
  --theme-preview-canvas: #0d1114;
  --theme-preview-panel: #1a2227;
  --theme-preview-muted: #29353c;
  --theme-preview-selected: #18384a;
  --theme-preview-nav: #1c272d;
  --theme-preview-line: #45545c;
  --theme-preview-accent: #56b4e9;
}

.portal-theme-option.is-berry-grove .portal-theme-preview {
  --theme-preview-canvas: #f7f6f2;
  --theme-preview-panel: #fcfbf8;
  --theme-preview-muted: #e9e7df;
  --theme-preview-selected: #f5dce1;
  --theme-preview-nav: #626b3e;
  --theme-preview-line: #d9d6b8;
  --theme-preview-accent: #cc3a63;
}

.portal-theme-option.is-linen-graphite .portal-theme-preview {
  --theme-preview-canvas: #222831;
  --theme-preview-panel: #393e46;
  --theme-preview-muted: #4b5058;
  --theme-preview-selected: #514d48;
  --theme-preview-nav: #222831;
  --theme-preview-line: #6a6865;
  --theme-preview-accent: #dfd0b8;
}

.portal-theme-option.is-blush-veil .portal-theme-preview {
  --theme-preview-canvas: #f7f6f7;
  --theme-preview-panel: #fcfbfc;
  --theme-preview-muted: #e9e4ea;
  --theme-preview-selected: #eadfeb;
  --theme-preview-nav: #5b4966;
  --theme-preview-line: #e6cfd8;
  --theme-preview-accent: #9478a8;
}

.portal-theme-option.is-deep-fjord .portal-theme-preview {
  --theme-preview-canvas: #15191d;
  --theme-preview-panel: #22282e;
  --theme-preview-muted: #343e46;
  --theme-preview-selected: #3d5b6c;
  --theme-preview-nav: #173447;
  --theme-preview-line: #647c8e;
  --theme-preview-accent: #d2c1b6;
}

.portal-theme-option.is-clay-sage .portal-theme-preview {
  --theme-preview-canvas: #f7f6f2;
  --theme-preview-panel: #fcfbf8;
  --theme-preview-muted: #e8e3da;
  --theme-preview-selected: #ead9d0;
  --theme-preview-nav: #607456;
  --theme-preview-line: #d7d0c5;
  --theme-preview-accent: #7b2525;
}

.portal-theme-option.is-citrus-grove .portal-theme-preview {
  --theme-preview-canvas: #171816;
  --theme-preview-panel: #252923;
  --theme-preview-muted: #394038;
  --theme-preview-selected: #46371d;
  --theme-preview-nav: #2e2910;
  --theme-preview-line: #52574e;
  --theme-preview-accent: #eb7d00;
}

.portal-theme-option.is-coastal-apricot .portal-theme-preview {
  --theme-preview-canvas: #f6f7f7;
  --theme-preview-panel: #fbfbfa;
  --theme-preview-muted: #e2e5e6;
  --theme-preview-selected: #f2ded0;
  --theme-preview-nav: #4e6972;
  --theme-preview-line: #ced8db;
  --theme-preview-accent: #c97840;
}

.portal-theme-option.is-neon-noir .portal-theme-preview {
  --theme-preview-canvas: #121214;
  --theme-preview-panel: #222227;
  --theme-preview-muted: #35353c;
  --theme-preview-selected: #482333;
  --theme-preview-nav: #000000;
  --theme-preview-line: #4b4b52;
  --theme-preview-accent: #cb2957;
}

.portal-theme-option.is-harbor-signal .portal-theme-preview {
  --theme-preview-canvas: #f6f7f7;
  --theme-preview-panel: #fbfbfb;
  --theme-preview-muted: #e2e6e7;
  --theme-preview-selected: #d9e8e9;
  --theme-preview-nav: #303841;
  --theme-preview-line: #ccd6d8;
  --theme-preview-accent: #e64a19;
}

.portal-theme-option.is-amethyst-pulse .portal-theme-preview {
  --theme-preview-canvas: #17151c;
  --theme-preview-panel: #25202d;
  --theme-preview-muted: #3a3146;
  --theme-preview-selected: #4a2742;
  --theme-preview-nav: #443199;
  --theme-preview-line: #55495e;
  --theme-preview-accent: #e05454;
}

.portal-theme-option.is-amber-cream .portal-theme-preview {
  --theme-preview-canvas: #f8f7f3;
  --theme-preview-panel: #fffdf8;
  --theme-preview-muted: #eae5d9;
  --theme-preview-selected: #f6dfca;
  --theme-preview-nav: #562f00;
  --theme-preview-line: #ddd3c3;
  --theme-preview-accent: #e67f25;
}

.portal-theme-option.is-moss-charcoal .portal-theme-preview {
  --theme-preview-canvas: #151713;
  --theme-preview-panel: #22241f;
  --theme-preview-muted: #383b34;
  --theme-preview-selected: #41493e;
  --theme-preview-nav: #181c14;
  --theme-preview-line: #53584e;
  --theme-preview-accent: #ecdfcc;
}

.portal-theme-preview-nav { background: var(--theme-preview-nav); }

.portal-theme-preview-body {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 9px;
  background: var(--theme-preview-canvas);
}

.portal-theme-preview-body::before {
  content: "";
  position: absolute;
  right: 9px;
  bottom: 8px;
  width: 24px;
  height: 8px;
  border-radius: 999px;
  background: var(--theme-preview-accent);
}

.portal-theme-preview-body::after {
  content: "";
  position: absolute;
  top: 10px;
  right: 9px;
  width: 17px;
  height: 6px;
  border-radius: 999px;
  background: var(--theme-preview-muted);
}

.portal-theme-preview-toolbar,
.portal-theme-preview-row {
  display: block;
  height: 8px;
  border-radius: 999px;
  background: var(--theme-preview-line);
}

.portal-theme-preview-toolbar { width: 58%; background: var(--theme-preview-line); }
.portal-theme-preview-row { height: 16px; background: var(--theme-preview-muted); }
.portal-theme-preview-row.is-selected {
  border-left: 4px solid var(--theme-preview-accent);
  background: var(--theme-preview-selected);
}
.portal-theme-preview-row:last-child { width: 62%; background: var(--theme-preview-panel); }

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

.portal-theme-option-copy strong,
.portal-theme-option-copy span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.portal-theme-option-copy strong { font-size: 15px; font-weight: 800; }
.portal-theme-option-copy span { color: var(--color-text-muted); font-size: 12.5px; font-weight: 650; }

.portal-theme-option-check {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 17px;
  height: 17px;
  padding: 3px;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-text-inverse);
  opacity: 0;
  transform: scale(0.75);
  transition: opacity 140ms ease, transform 140ms ease;
}

.portal-theme-option.is-active .portal-theme-option-check {
  opacity: 1;
  transform: scale(1);
}

.portal-pattern-options {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 14px;
  overflow-y: auto;
  padding-right: 3px;
  scrollbar-width: thin;
  scrollbar-color: var(--color-scrollbar-thumb) transparent;
}

.portal-pattern-options[aria-busy="true"]:empty::before {
  content: "Loading patterns...";
  grid-column: 1 / -1;
  padding: 28px 4px;
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: 650;
}

.portal-pattern-surface-settings {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  padding: 2px 3px 16px;
  border-bottom: 1px solid var(--color-border-subtle);
}

.portal-pattern-surface-title {
  color: var(--color-text-primary);
  font-size: 13px;
  font-weight: 800;
}

.portal-pattern-surface-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 20px;
}

.portal-pattern-intensity {
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border-subtle);
}

.portal-pattern-intensity-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--color-text-primary);
  font-size: 12.5px;
}

.portal-pattern-intensity-head strong {
  font-weight: 800;
}

.portal-pattern-intensity-head > span:last-child {
  color: var(--color-text-muted);
  font-weight: 700;
}

.portal-pattern-intensity input[type="range"] {
  width: 100%;
  height: 20px;
  margin: 0;
  border: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent !important;
  box-shadow: none !important;
  accent-color: var(--color-accent);
  cursor: pointer;
}

.portal-pattern-intensity input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: var(--color-surface-muted);
}

.portal-pattern-intensity input[type="range"]::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  margin-top: -6px;
  appearance: none;
  border: 2px solid var(--color-surface);
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 0 0 0 1px var(--color-accent-border);
}

.portal-pattern-intensity input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: var(--color-surface-muted);
}

.portal-pattern-intensity input[type="range"]::-moz-range-progress {
  height: 4px;
  border-radius: 999px;
  background: var(--color-accent);
}

.portal-pattern-intensity input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 2px solid var(--color-surface);
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 0 0 0 1px var(--color-accent-border);
}

.portal-pattern-intensity input[type="range"]:focus-visible {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 2px;
}

.portal-pattern-surface-row {
  min-width: 0;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-radius: 8px;
  color: var(--color-text-secondary);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.portal-pattern-surface-row:hover {
  color: var(--color-text-primary);
}

.portal-pattern-surface-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.portal-pattern-surface-check {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: grid;
  place-items: center;
  border: 1px solid var(--color-border-strong);
  border-radius: 5px;
  background: var(--color-surface);
  color: var(--color-on-accent);
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.portal-pattern-surface-check svg {
  width: 12px;
  height: 12px;
  opacity: 0;
  transform: scale(0.72);
  transition: opacity 120ms ease, transform 120ms ease;
}

.portal-pattern-surface-row input:checked + .portal-pattern-surface-check {
  border-color: var(--color-accent);
  background: var(--color-accent);
}

.portal-pattern-surface-row input:checked + .portal-pattern-surface-check svg {
  opacity: 1;
  transform: scale(1);
}

.portal-pattern-surface-row input:focus-visible + .portal-pattern-surface-check {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 2px;
}

.portal-pattern-option {
  position: relative;
  min-width: 0;
  min-height: 112px;
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 13px;
  border: 1px solid var(--color-border);
  border-radius: 17px;
  background: var(--color-surface-soft);
  color: var(--color-text-primary);
  text-align: left;
  transition: background-color 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.portal-pattern-option:hover,
.portal-pattern-option:focus-visible {
  border-color: var(--color-accent-border);
  background: var(--color-hover);
}

.portal-pattern-option:focus-visible {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 1px;
}

.portal-pattern-option:active {
  transform: translateY(1px);
}

.portal-pattern-option.is-active {
  border-color: var(--color-accent-border);
  background: var(--color-selected);
}

.portal-pattern-option > strong {
  min-width: 0;
  overflow: hidden;
  color: var(--color-text-primary);
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.portal-pattern-preview {
  position: relative;
  width: 132px;
  height: 84px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--color-accent) 4%, var(--color-surface));
}

.portal-pattern-preview::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--color-accent);
  opacity: 0.38;
  -webkit-mask-image: var(--pattern-preview-image);
  mask-image: var(--pattern-preview-image);
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: repeat;
  mask-repeat: repeat;
  -webkit-mask-size: var(--pattern-preview-size, 72px 72px);
  mask-size: var(--pattern-preview-size, 72px 72px);
}

.portal-pattern-preview.is-none::before {
  display: none;
}

.portal-pattern-preview.is-none::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 48px;
  height: 2px;
  border-radius: 999px;
  background: var(--color-text-muted);
  opacity: 0.62;
  transform: translate(-50%, -50%) rotate(-34deg);
}

.portal-pattern-option-check {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 17px;
  height: 17px;
  padding: 3px;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-on-accent);
  opacity: 0;
  transform: scale(0.75);
  transition: opacity 140ms ease, transform 140ms ease;
}

.portal-pattern-option.is-active .portal-pattern-option-check {
  opacity: 1;
  transform: scale(1);
}

@media (max-width: 640px) {
  .portal-theme-menu {
    position: fixed;
    top: 62px;
    right: 10px;
    left: 10px;
    width: auto;
  }

  .portal-theme-options,
  .portal-pattern-options {
    grid-template-columns: minmax(0, 1fr);
  }

  .portal-pattern-surface-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .portal-theme-menu { animation: none; }
}

/* MitsoLab dark theme: near-black neutral surfaces with restrained blue accents. */
html[data-theme="dark"] {
  --color-canvas: #0d0e10;
  --color-panel: #17181a;
  --color-surface: #1b1c1e;
  --color-surface-raised: #202124;
  --color-surface-soft: #141517;
  --color-surface-muted: #25272a;
  --color-input: #111214;
  --color-hover: rgba(255, 255, 255, 0.06);
  --color-selected: rgba(96, 165, 250, 0.11);
  --color-selected-strong: rgba(96, 165, 250, 0.16);
  --color-text-primary: #f3f4f6;
  --color-text-secondary: #a1a1aa;
  --color-text-muted: #7f7f87;
  --color-text-inverse: #ffffff;
  --color-border-subtle: rgba(255, 255, 255, 0.07);
  --color-border: rgba(255, 255, 255, 0.11);
  --color-border-strong: rgba(255, 255, 255, 0.18);
  --color-border-emphasis: rgba(255, 255, 255, 0.28);
  --color-accent: #4a90d9;
  --color-accent-hover: #5ca2ea;
  --color-accent-pressed: #2f6faf;
  --color-accent-soft: rgba(96, 165, 250, 0.11);
  --color-accent-border: rgba(96, 165, 250, 0.24);
  --color-focus-ring: rgba(96, 165, 250, 0.14);
  --color-success: #39b980;
  --color-success-soft: rgba(57, 185, 128, 0.14);
  --color-warning: #d59a45;
  --color-warning-soft: rgba(213, 154, 69, 0.14);
  --color-danger: #e46b73;
  --color-danger-soft: rgba(228, 107, 115, 0.14);
  --color-info: #60a5fa;
  --color-info-soft: rgba(96, 165, 250, 0.14);
  --color-overlay: rgba(0, 0, 0, 0.72);
  --color-shadow: rgba(0, 0, 0, 0.4);
  --color-shadow-tight: rgba(0, 0, 0, 0.28);
  --color-message-inbound: #28282b;
  --color-message-outbound: #24598f;
  --color-media-background: #0b1420;
  --color-scrollbar-thumb: rgba(255, 255, 255, 0.24);

  --app-bg: var(--color-canvas);
  --bg: var(--color-canvas);
  --bg-panel: var(--color-panel);
  --bg-soft: var(--color-surface-soft);
  --surface: var(--color-surface);
  --surface-soft: var(--color-surface-soft);
  --surface-muted: var(--color-surface-muted);
  --border: var(--color-border);
  --border-strong: var(--color-border-strong);
  --ink: var(--color-text-primary);
  --ink-soft: var(--color-text-secondary);
  --navy: var(--color-accent);
  --navy-deep: var(--color-accent-pressed);
  --amber: var(--color-warning);
  --chart-line: var(--color-accent);
  --chart-line-fill: var(--color-accent-soft);
  --chart-axis: var(--color-text-secondary);
  --chart-grid: var(--color-border-subtle);
}

html[data-theme="dark"] body,
html[data-theme="dark"] .app-shell,
html[data-theme="dark"] .portal-view,
html[data-theme="dark"] .portal-main,
html[data-theme="dark"] .portal-content,
html[data-theme="dark"] .live-dashboard-grid,
html[data-theme="dark"] .live-right-rail {
  background: var(--color-canvas);
}

html[data-theme="dark"] :is(
  .portal-sidebar,
  .crm-sidebar,
  .crm-main,
  .crm-view-shell,
  .crm-contact-shell,
  .ops-main,
  .ops-view,
  .agents-page,
  .agents-inbox-sidebar,
  .agents-work-column,
  .agents-details-column,
  .tasks-page,
  .analytics-view
) {
  background: var(--color-panel);
}

html[data-theme="dark"] :is(
  .portal-user-dropdown,
  .kb-dialog,
  .at-dialog,
  .at-dialog .kb-body,
  .at-dialog .kb-toolbar,
  .at-tabs,
  .at-list,
  .at-editor,
  .at-runner,
  .at-result,
  .at-history,
  .crm-contacts-filter-panel,
  .crm-contacts-filter-popover,
  .crm-organization-detail,
  .crm-org-add-contact-panel,
  .crm-pipeline-builder-card,
  .crm-pipeline-column,
  .ops-kpi-card,
  .ops-monitor-panel,
  .ops-board-panel,
  .ops-metric-card,
  .ops-empty-panel,
  .live-panel,
  .tasks-column,
  .tasks-dialog,
  .agents-modal-panel,
  .agents-right-section,
  .agents-chat-panel
) {
  background: var(--color-surface);
  border-color: var(--border);
}

html[data-theme="dark"] :is(
  input,
  textarea,
  select,
  .tickets-custom-select-trigger,
  .crm-search-field,
  .crm-toolbar-field input,
  .analytics-date-input,
  .ops-agent-search,
  .ops-mobile-agent-search,
  .live-agent-search,
  .agents-work-search-input,
  .agents-work-filter-button,
  .kb-search,
  .kb-field input,
  .kb-field textarea,
  .kb-field select
) {
  background: var(--color-input);
  border-color: var(--color-border);
}

html[data-theme="dark"] :is(
  .portal-nav-item:hover,
  .portal-nav-item.is-active,
  .portal-theme-toggle[aria-pressed="true"],
  .crm-sidebar-link:hover,
  .crm-sidebar-link.is-active,
  .crm-sidebar-child:hover,
  .crm-sidebar-child.is-active,
  .ops-agent-nav-row:hover,
  .ops-agent-nav-row.is-active,
  .agents-work-filter-item:hover,
  .agents-work-filter-item.is-active,
  .agents-inbox-nav-item:hover,
  .agents-inbox-nav-item.is-active
) {
  background: var(--color-selected);
  border-color: var(--color-accent-border);
  color: var(--color-text-primary);
}

html[data-theme="dark"] :is(
  .kb-action-button-secondary:hover,
  .modal-button-secondary:hover,
  .crm-toolbar-icon-button:hover,
  .tickets-filter-button:hover,
  .live-refresh-button:hover,
  .ops-window-preset:hover:not(:disabled)
) {
  background: var(--color-accent-soft);
  border-color: var(--color-accent-border);
  color: var(--color-text-primary);
}

html[data-theme="dark"] .portal-theme-toggle[aria-pressed="true"] {
  background: transparent;
  border-color: transparent;
  color: var(--color-accent);
  box-shadow: none;
}

html[data-theme="dark"] .portal-theme-toggle[aria-pressed="true"]:hover,
html[data-theme="dark"] .portal-theme-toggle[aria-pressed="true"]:focus-visible {
  background: var(--color-selected);
  border-color: var(--color-accent-border);
  color: var(--color-text-primary);
  box-shadow: inset 0 0 0 1px var(--color-accent-soft);
}

html[data-theme="dark"] .kb-floating-shell.at-editor-backdrop::before,
html[data-theme="dark"] .kb-floating-shell.kb-drawer-backdrop::before {
  background: var(--color-overlay);
}

html[data-theme="dark"] .login-view {
  background: var(--color-canvas);
  color: var(--color-text-primary);
}

html[data-theme="dark"] .login-card,
html[data-theme="dark"] .login-panel {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

html[data-theme="dark"] .login-brand-name,
html[data-theme="dark"] .login-copy h1 {
  color: var(--color-text-primary);
}

html[data-theme="dark"] .login-brand .eyebrow,
html[data-theme="dark"] .login-form .field span,
html[data-theme="dark"] .login-form .helper-text,
html[data-theme="dark"] .login-form .status-text {
  color: var(--color-text-secondary);
}

html[data-theme="dark"] .login-form {
  background: var(--color-surface);
  border-color: var(--color-border);
  box-shadow: 0 22px 48px var(--color-shadow-popover);
}

html[data-theme="dark"] .login-form .field input {
  background: var(--color-input);
  border-color: var(--color-border-strong);
  color: var(--color-text-primary);
}

html[data-theme="dark"] .login-form .field input::placeholder {
  color: var(--color-text-muted);
}

html[data-theme="dark"] .login-form .field input:focus {
  border-color: var(--color-focus-border);
  box-shadow: 0 0 0 4px var(--color-focus-ring);
}

html[data-theme="dark"] .login-form .primary-button {
  background: var(--color-info);
  color: var(--color-on-accent);
  box-shadow: 0 14px 30px var(--color-shadow-tight);
}

html[data-theme="dark"] .login-form .status-text.is-error {
  color: var(--color-danger);
}

html[data-theme="dark"] .login-form .status-text.is-success {
  color: var(--color-success);
}

html[data-theme="dark"] .signal-ribbon-bg {
  background:
    radial-gradient(circle at 84% 50%, var(--color-border-subtle), transparent 20%),
    radial-gradient(circle at 29% 64%, var(--color-hover), transparent 25%),
    linear-gradient(145deg, var(--color-surface-soft) 0%, var(--color-surface) 54%, var(--color-surface-muted) 100%);
  border: 1px solid var(--color-border-subtle);
}

html[data-theme="dark"] .signal-ribbon-bg::after {
  border-color: var(--color-border-subtle);
  box-shadow:
    0 0 0 78px color-mix(in srgb, var(--color-text-primary) 1.8%, transparent),
    0 0 0 156px color-mix(in srgb, var(--color-text-primary) 1%, transparent);
}

html[data-theme="dark"] .signal-destination-core {
  background: var(--color-surface-translucent);
  border-color: var(--color-border);
  box-shadow: 0 18px 44px var(--color-shadow);
}

html[data-theme="dark"] .signal-node {
  background: var(--color-hover);
  border-color: var(--color-border-subtle);
}

html[data-theme="dark"] .at-response-test-panel,
html[data-theme="dark"] .at-response-path-row {
  background: var(--color-surface);
  border-color: var(--color-border);
}

html[data-theme="dark"] .at-response-path-list {
  border-top-color: var(--color-border-subtle);
}

html[data-theme="dark"] .at-response-test-head strong,
html[data-theme="dark"] .at-response-path-list-head strong,
html[data-theme="dark"] .at-response-path-row strong {
  color: var(--color-text-primary);
}

html[data-theme="dark"] .at-response-test-head span,
html[data-theme="dark"] .at-response-path-list-head span,
html[data-theme="dark"] .at-response-path-row span {
  color: var(--color-accent);
}

/* ============================================================================
   Conversation view (inbox messages column rebuild)
   ============================================================================ */

/* Content wrapper inside the scroll container; mirrors the container's column
   layout so existing message styles are unaffected. Gives the ResizeObserver
   a content-sized element to watch for pinned-to-bottom behavior. */
.agents-messages-flow {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 100%;
}

.agents-messages-flow::after {
  content: "";
  display: block;
  flex: 0 0 22px;
}

.agents-messages-flow .agents-messages-placeholder {
  height: auto;
  flex: 1;
}

/* Fixed-size media boxes: the loading placeholder, the final image, and the
   unavailable state all occupy the exact same footprint, so resolving an
   attachment never shifts layout or scroll position. */
.cv-media-box {
  position: relative;
  display: block;
  width: min(260px, 66vw);
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--color-surface-muted), var(--color-surface-soft));
}

.cv-media-box img,
.cv-media-box video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  max-width: none;
  max-height: none;
}

/* Fade media in once decoded — only inside the live conversation surface. */
.agents-messages-area .cv-media-box img {
  opacity: 0;
  transition: opacity 200ms ease;
}

.agents-messages-area .cv-media-box img.is-loaded {
  opacity: 1;
}

.cv-media-box .cv-media-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--color-text-muted);
}

.cv-media-box .cv-media-fallback i,
.cv-media-box .cv-media-fallback svg {
  width: 26px;
  height: 26px;
}

.cv-media-box.cv-media-box-video {
  width: min(300px, 72vw);
  aspect-ratio: 16 / 9;
  background: var(--color-text-primary);
}

.cv-media-box.cv-media-box-video video {
  object-fit: contain;
}

.agents-message-video-attachment > a {
  display: inline-block;
  margin-top: 4px;
  font-size: 12px;
}

/* Loading / unavailable states reuse the identical box footprint. */
.agents-message-image-loading.cv-media-box,
.agents-message-image-unavailable.cv-media-box {
  width: min(260px, 66vw);
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 0;
}

html[data-theme="dark"] .cv-media-box {
  background: linear-gradient(135deg, var(--color-surface-muted), var(--color-surface));
}

html[data-theme="dark"] .cv-media-box .cv-media-fallback {
  color: var(--color-text-muted);
}

/* We own bottom-pinning; the browser's native scroll anchoring fights it
   while content-visibility items materialize. */
.agents-messages-area {
  overflow-anchor: none;
}

/* Spacing between media and the rest of the same message (the old
   inline-block image had a phantom baseline gap; block boxes do not). */
.agents-message-item .agents-message-media-stack + .agents-message-bubble,
.agents-message-item .agents-message-media-stack + .agents-message-attachments,
.agents-message-item .agents-message-attachments + .agents-message-bubble {
  margin-top: 6px;
}

/* Breathing room after the final message. */
.agents-messages-flow > :last-child {
  margin-bottom: 0;
}

/* Render conversation messages fully — no lazy content-visibility here.
   Estimated heights (58px vs ~200px for media) made scrollHeight inexact and
   caused layout jumps while scrolling as items materialized. A conversation
   is bounded in size and the reconciler already avoids re-renders, so exact
   layout is worth far more than render skipping. */
.agents-messages-area .agents-message-item {
  content-visibility: visible;
  contain: none;
  contain-intrinsic-size: auto;
}

/* Main app rail */
.portal-sidebar,
html[data-theme="dark"] .portal-sidebar {
  background: var(--color-navigation);
  border-right-color: var(--color-navigation-border);
  box-shadow:
    inset -1px 0 0 color-mix(in srgb, var(--color-navigation-text) 3.5%, transparent),
    10px 0 30px var(--color-shadow-side);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.portal-sidebar .portal-logo img,
html[data-theme="dark"] .portal-sidebar .portal-logo img {
  filter: brightness(0) invert(1);
  opacity: 0.94;
}

.portal-sidebar .portal-nav > .portal-nav-item,
html[data-theme="dark"] .portal-sidebar .portal-nav > .portal-nav-item {
  color: var(--color-navigation-text);
}

.portal-sidebar .portal-nav > .portal-nav-item:hover,
.portal-sidebar .portal-nav > .portal-nav-item:focus-visible,
.portal-sidebar .portal-nav > .portal-nav-item.is-active {
  color: var(--color-navigation-text);
  background: var(--color-navigation-hover);
  box-shadow: none;
}

.portal-sidebar .portal-user-online-dot,
html[data-theme="dark"] .portal-sidebar .portal-user-online-dot {
  box-shadow: 0 0 0 2px var(--color-navigation);
}

@media (min-width: 721px) {
  .portal-sidebar .portal-nav::before {
    border-color: var(--color-navigation-border-strong);
    background: var(--color-navigation-selected);
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--color-navigation-text) 4.5%, transparent);
  }

  .portal-sidebar .portal-nav > .portal-nav-item::before {
    background: var(--color-navigation-highlight);
  }

  .portal-sidebar .portal-nav > .portal-nav-item:hover,
  .portal-sidebar .portal-nav > .portal-nav-item:focus-visible,
  .portal-sidebar .portal-nav > .portal-nav-item.is-active {
    background: transparent;
  }
}

/* Shared workspace surfaces */
html[data-theme] :is(
  .portal-user-dropdown,
  .portal-utility-strip,
  .scale-popover,
  .kb-dialog,
  .kb-confirm-panel,
  .confirm-modal-dialog
) {
  background: var(--color-surface);
  border-color: var(--border-strong);
  box-shadow: 0 24px 70px var(--color-shadow-popover);
}

html[data-theme] .portal-utility-strip::before {
  background: var(--color-surface);
  border-color: var(--border-strong);
}

html[data-theme="dark"] :is(
  .login-brand img,
  .dashboard-loading-logo
) {
  filter: brightness(0) invert(1);
}

html[data-theme] .agents-page {
  --agents-inbox-bg: var(--color-canvas);
}

html[data-theme] :is(
  .agents-chat-grid,
  .agents-work-section,
  .agents-work-list,
  .agents-messages-column,
  .agents-messages-section,
  .agents-messages-area,
  .agents-empty-right
) {
  background: var(--color-canvas);
  color: var(--ink);
}

html[data-theme] :is(
  .agents-inbox-rail,
  .agents-work-column,
  .agents-details-column,
  .tickets-sidebar-panel,
  .tickets-main-panel,
  .tickets-detail-panel
) {
  background: var(--color-panel);
  border-color: var(--border);
}

html[data-theme] .agents-chat-grid {
  background: var(--color-panel);
}

html[data-theme] .agents-work-column {
  border-top-left-radius: 16px;
  border-bottom-left-radius: 16px;
  overflow: hidden;
  background: var(--color-input);
  box-shadow: -5px 0 12px var(--color-shadow-tight);
}

html[data-theme] .agents-work-column::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: 16px;
  bottom: 16px;
  left: 0;
  width: 1px;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    transparent,
    var(--color-border-subtle) 8%,
    var(--color-border-subtle) 92%,
    transparent
  );
}

html[data-theme] .agents-work-column :is(
  .agents-work-section,
  .agents-work-list
) {
  background: var(--color-input);
}

html[data-theme] .agents-messages-area {
  background: var(--color-surface-soft);
}

html[data-theme] :is(
  .agents-work-search,
  .agents-work-search-input,
  .agents-work-filter-button,
  .agents-work-filter-menu,
  .agents-work-list-head,
  .agents-messages-header,
  .agents-messages-footer,
  .agents-right-panel,
  .agents-right-section,
  .agents-right-quick-card,
  .agents-chat-panel,
  .agents-messages-placeholder,
  .agents-empty-message,
  .tickets-table-shell,
  .tickets-detail-shell,
  .tickets-detail-top,
  .tickets-detail-info,
  .tickets-detail-chat
) {
  background: var(--color-surface);
  border-color: var(--border);
  color: var(--ink);
}

html[data-theme] :is(
  .agents-inbox-nav-item,
  .agents-inbox-new-chat,
  .agents-internal-item,
  .agents-work-item
) {
  background: transparent;
  border-color: transparent;
  color: var(--ink-soft);
  box-shadow: none;
}

html[data-theme] :is(
  .agents-inbox-nav-item:hover,
  .agents-inbox-nav-item.is-active,
  .agents-inbox-new-chat:hover,
  .agents-internal-item:hover,
  .agents-internal-item.is-active,
  .agents-work-item:hover,
  .agents-work-item.is-active
) {
  background: var(--color-selected);
  border-color: var(--color-accent-border);
  color: var(--ink);
}

html[data-theme] .agents-message-day-pill {
  background: var(--color-surface);
  border-color: var(--border);
  color: var(--ink-soft);
}

html[data-theme] :is(
  .agents-message-day-divider::before,
  .agents-message-day-divider::after
) {
  background: var(--color-border-subtle);
}

html[data-theme] .agents-message-item.ai .agents-message-bubble {
  background: var(--color-message-inbound);
  border-color: var(--color-border);
  color: var(--color-text-primary);
}

html[data-theme] .agents-message-item.human .agents-message-bubble {
  background: var(--color-message-outbound);
  color: var(--color-text-inverse);
}

html[data-theme] :is(
  .agents-middle-composer,
  .agents-emoji-menu,
  .agents-attachment-menu,
  .agents-attachment-chip,
  .agents-shortcuts-menu,
  .agents-shortcut-fill,
  .agents-shortcut-delete
) {
  background: var(--color-surface-soft);
  border-color: var(--color-border);
  color: var(--ink);
}

html[data-theme] .agents-middle-composer {
  box-shadow: 0 0 0 1px var(--color-border-subtle);
}

html[data-theme] .agents-middle-composer:focus-within {
  border-color: var(--color-focus-border);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

html[data-theme] .agents-right-tab.is-active::after {
  background: var(--color-info);
}

html[data-theme] .agents-right-pipeline-list-wrap.is-collapsed::after {
  background: linear-gradient(180deg, transparent, var(--color-panel) 88%);
}

html[data-theme] :is(input, textarea, select):focus,
html[data-theme] .tickets-custom-select-trigger:focus-visible,
html[data-theme] .kb-field input:focus,
html[data-theme] .kb-field textarea:focus,
html[data-theme] .kb-field select:focus {
  border-color: var(--color-focus-border);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

html[data-theme] :is(
  .kb-action-button,
  .modal-button-primary,
  .ops-load-button,
  .crm-toolbar-icon-button-primary,
  .tickets-filter-button.is-active,
  .agents-shift-button,
  .tasks-primary-button
) {
  background: var(--color-info);
  border-color: var(--color-accent-border);
  color: var(--color-on-accent);
}

html[data-theme] :is(
  .at-switch-field input:checked + span,
  .at-required-toggle.is-on,
  .crm-pipeline-active-toggle input:checked + span,
  .crm-pipeline-admin-toggle input:checked + span
) {
  background: var(--color-info);
}

html[data-theme] ::selection {
  background: var(--color-selection);
  color: var(--color-text-inverse);
}

/* ============================================================================
   Shared component color contract
   Every application module consumes the active semantic palette.
   ============================================================================ */

html[data-theme] :is(
  .contacts-page,
  .crm-page,
  .crm-contact-main,
  .crm-contact-body,
  .crm-drawer-body,
  .crm-drawer-conversation-body,
  .crm-pipeline-board-wrap,
  .crm-pipeline-builder,
  .crm-organizations-layout,
  .analytics-shell,
  .analytics-scroll-area,
  .ops-report,
  .ops-scroll-area,
  .live-dashboard-page,
  .tasks-page,
  .tickets-page,
  .kb-body,
  .at-list,
  .at-editor,
  .at-runner,
  .at-result,
  .at-history
) {
  background: var(--color-canvas);
  color: var(--color-text-primary);
}

html[data-theme] :is(
  .contacts-list-panel,
  .contacts-detail-panel,
  .crm-sidebar,
  .crm-main,
  .crm-view-shell,
  .crm-contact-shell,
  .ops-sidebar,
  .ops-main,
  .ops-view,
  .analytics-view,
  .analytics-toolbar,
  .live-panel,
  .live-right-rail,
  .tasks-column,
  .tasks-detail,
  .tickets-sidebar-panel,
  .tickets-main-panel,
  .tickets-detail-panel,
  .kb-dialog,
  .kb-head,
  .kb-toolbar,
  .at-dialog,
  .at-dialog .kb-body,
  .at-dialog .kb-toolbar,
  .at-tabs
) {
  background: var(--color-panel);
  border-color: var(--color-border);
  color: var(--color-text-primary);
}

html[data-theme] :is(
  .surface-card,
  .surface-subcard,
  .hero-card,
  .app-card,
  .module-card,
  .metric-card,
  .contacts-toolbar,
  .contacts-bulk-bar,
  .crm-table-shell,
  .crm-pipeline-column,
  .crm-pipeline-column.is-unassigned,
  .crm-pipeline-card,
  .crm-contacts-filter-panel,
  .crm-contacts-filter-popover,
  .crm-organization-detail,
  .crm-org-add-contact-panel,
  .crm-pipeline-builder-card,
  .crm-card-info-fields,
  .analytics-panel,
  .analytics-card,
  .analytics-chart-card,
  .analytics-metric-card,
  .analytics-report-card,
  .analytics-empty-state,
  .ops-report-builder,
  .ops-report-builder-panel,
  .ops-report-toolbar-form,
  .ops-empty-panel,
  .ops-kpi-card,
  .ops-metric-card,
  .ops-monitor-kpi,
  .ops-monitor-panel,
  .ops-board-panel,
  .ops-channel-panel,
  .ops-volume-panel,
  .ops-health-panel,
  .ops-sla-panel,
  .ops-sla-card,
  .ops-sla-summary-card,
  .ops-chartjs-volume,
  .ops-monitor-chat-volume-panel,
  .ops-health-row,
  .live-metric,
  .live-agent-row,
  .live-chat-row,
  .live-alert-row,
  .live-event-row,
  .live-alert-menu,
  .live-chat-preview,
  .tasks-card,
  .tasks-card-open,
  .tasks-detail-card,
  .tasks-editor,
  .tasks-inline-detail,
  .tasks-finish-inline,
  .tasks-inline-detail-actions,
  .tickets-table-shell,
  .tickets-detail-shell,
  .tickets-detail-top,
  .tickets-detail-info,
  .tickets-detail-chat,
  .kb-card,
  .kb-editor,
  .kb-confirm-panel,
  .kb-empty,
  .at-card,
  .at-section,
  .at-config-row,
  .at-variable-card,
  .at-response-test-panel,
  .at-response-path-row,
  .at-run-summary,
  .at-selected-contact,
  .at-contact-option,
  .at-history-card,
  .at-result-panel,
  .at-variable-editor
) {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text-primary);
}

html[data-theme] .tasks-card-meta span {
  background: var(--color-surface-muted);
  border-color: var(--color-border);
  color: var(--color-text-secondary);
}

html[data-theme] .tasks-card-meta .tasks-assignee-name {
  background: transparent;
  color: var(--color-text-secondary);
}

html[data-theme] :is(
  .portal-user-dropdown,
  .portal-utility-strip,
  .scale-popover,
  .crm-contacts-filter-popover,
  .ops-mobile-agent-menu,
  .live-alert-menu,
  .agents-work-filter-menu,
  .tickets-custom-select-menu,
  .kb-dialog,
  .kb-confirm-panel,
  .at-dialog,
  .confirm-modal-dialog
) {
  background: var(--color-surface-raised);
  border-color: var(--color-border-strong);
  color: var(--color-text-primary);
  box-shadow: 0 24px 70px var(--color-shadow);
}

html[data-theme] :is(
  input,
  textarea,
  select,
  .crm-search-field,
  .crm-toolbar-field input,
  .crm-card-info-fields input,
  .crm-card-info-fields textarea,
  .crm-card-info-fields select,
  .analytics-date-input,
  .ops-agent-search,
  .ops-agent-search input,
  .ops-mobile-agent-search,
  .ops-mobile-agent-search input,
  .live-agent-search,
  .live-agent-search input,
  .agents-work-search,
  .agents-work-search-input,
  .agents-work-filter-button,
  .tickets-filter-field input,
  .tickets-filter-field select,
  .tickets-custom-select-trigger,
  .kb-search,
  .kb-search input,
  .kb-field input,
  .kb-field textarea,
  .kb-field select
) {
  background: var(--color-input);
  border-color: var(--color-border);
  color: var(--color-text-primary);
}

html[data-theme] :is(
  input,
  textarea
)::placeholder {
  color: var(--color-text-muted);
}

html[data-theme] :is(
  h1,
  h2,
  h3,
  h4,
  .crm-card-info-head strong,
  .crm-pipeline-card strong,
  .analytics-panel-head strong,
  .ops-section-head h3,
  .ops-kpi-card strong,
  .ops-metric-card strong,
  .live-panel-head strong,
  .live-chat-title strong,
  .kb-card h3,
  .kb-editor-head strong,
  .at-card-title strong,
  .at-section-head strong,
  .at-variable-summary strong,
  .at-history-row strong,
  .at-mapped-row strong
) {
  color: var(--color-text-primary);
}

html[data-theme] :is(
  .is-muted,
  .crm-card-info-head span,
  .crm-pipeline-card p,
  .crm-pipeline-card small,
  .analytics-panel-head span,
  .analytics-panel-head p,
  .ops-section-head span,
  .ops-kpi-card span,
  .ops-kpi-card em,
  .ops-metric-card span,
  .ops-metric-card em,
  .live-chat-preview,
  .live-chat-assignee,
  .live-event-row p,
  .kb-card p,
  .kb-card time,
  .kb-editor-head span,
  .at-card-title p,
  .at-section-head > div > span,
  .at-muted,
  .at-variable-summary span,
  .at-history-row span,
  .at-mapped-row span
) {
  color: var(--color-text-secondary);
}

html[data-theme] :is(
  .crm-sidebar-link:hover,
  .crm-sidebar-link.is-active,
  .crm-sidebar-child:hover,
  .crm-sidebar-child.is-active,
  .ops-agent-nav-row:hover,
  .ops-agent-nav-row.is-active,
  .ops-mobile-agent-option:hover,
  .ops-mobile-agent-option.is-active,
  .live-agent-row:hover,
  .live-agent-row.is-active,
  .live-chat-row:hover,
  .live-chat-row.is-active,
  .tickets-table-row:hover,
  .tickets-table-row.is-selected,
  .at-contact-option:hover,
  .at-contact-option.is-selected
) {
  background: var(--color-selected);
  border-color: var(--color-accent-border);
  color: var(--color-text-primary);
}

html[data-theme] :is(
  .kb-action-button,
  .modal-button-primary,
  .ops-load-button,
  .crm-toolbar-icon-button-primary,
  .tickets-filter-button.is-active,
  .agents-shift-button,
  .agents-middle-send,
  .tasks-primary-button,
  .analytics-empty-generate
) {
  background: var(--color-accent-pressed);
  border-color: var(--color-accent-pressed);
  color: var(--color-on-accent-pressed);
}

/* Accent-backed controls must use the foreground paired with each preset's
   accent. This is intentionally separate from the background contract so it
   does not flatten component-specific hover and pressed treatments. */
html[data-theme] :is(
  .primary-button,
  .tickets-filter-button-primary,
  .agents-button-primary,
  .agents-assign-confirm-button.is-primary,
  .agents-crm-add-button,
  .workspace-invitation-accept,
  .login-form .primary-button
) {
  color: var(--color-on-accent);
}

html[data-theme] :is(
  .kb-action-button:hover,
  .modal-button-primary:hover,
  .ops-load-button:hover,
  .crm-toolbar-icon-button-primary:hover,
  .agents-middle-send:hover,
  .agents-middle-send:focus-visible,
  .tasks-primary-button:hover,
  .analytics-empty-generate:hover
) {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  color: var(--color-on-accent-hover);
}

html[data-theme] :is(
  .kb-action-button-secondary,
  .kb-icon-button,
  .modal-button-secondary,
  .crm-toolbar-icon-button,
  .tickets-filter-button,
  .live-refresh-button,
  .ops-window-preset
) {
  background: var(--color-input);
  border-color: var(--color-border);
  color: var(--color-text-secondary);
}

html[data-theme] :is(
  .kb-action-button-secondary:hover,
  .kb-icon-button:hover,
  .modal-button-secondary:hover,
  .crm-toolbar-icon-button:hover,
  .tickets-filter-button:hover,
  .live-refresh-button:hover,
  .ops-window-preset:hover:not(:disabled),
  .ops-window-preset.is-active
) {
  background: var(--color-hover);
  border-color: var(--color-border-strong);
  color: var(--color-text-primary);
}

html[data-theme] :is(
  .ops-kpi-card.is-warn,
  .ops-sla-summary-card.is-warn,
  .live-alert-row
) {
  background: var(--color-warning-soft);
  border-color: color-mix(in srgb, var(--color-warning) 34%, transparent);
}

html[data-theme] :is(
  .ops-kpi-card.is-bad,
  .ops-sla-summary-card.is-bad,
  .ops-sla-card.is-bad
) {
  background: var(--color-danger-soft);
  border-color: color-mix(in srgb, var(--color-danger) 34%, transparent);
}

html[data-theme] .agents-shift-button.agents-shift-button-danger {
  background: var(--color-danger-soft);
  border: 1px solid color-mix(in srgb, var(--color-danger) 42%, transparent);
  color: var(--color-danger);
}

html[data-theme] .agents-shift-button.agents-shift-button-danger:hover:not(:disabled) {
  background: color-mix(in srgb, var(--color-danger) 20%, transparent);
  border-color: color-mix(in srgb, var(--color-danger) 58%, transparent);
}

html[data-theme] .agents-shift-button.agents-shift-button-secondary {
  background: var(--color-input);
  border: 1px solid var(--color-border-strong);
  color: var(--color-text-primary);
}

html[data-theme] .agents-shift-button.agents-shift-button-secondary:hover:not(:disabled) {
  background: var(--color-hover);
  border-color: var(--color-accent-border);
}

html[data-theme] .agents-shift-button.agents-shift-button-break {
  background: var(--color-warning-soft);
  border: 1px solid color-mix(in srgb, var(--color-warning) 38%, transparent);
  color: var(--color-warning);
}

html[data-theme] .agents-shift-button.agents-shift-button-break:hover:not(:disabled) {
  background: color-mix(in srgb, var(--color-warning) 20%, transparent);
}

html[data-theme] :is(
  .crm-sidebar-child-skeleton,
  .crm-table-skeleton-row,
  .crm-pipeline-loading-column,
  .agents-work-skeleton-row,
  .tickets-list-loading,
  .tasks-skeleton,
  .analytics-users-placeholder,
  .ops-report.is-loading .ops-metric-card,
  .ops-report.is-loading .ops-kpi-card,
  .ops-report.is-loading .ops-sla-summary-card,
  .ops-report.is-loading .ops-board-panel,
  .ops-report.is-loading .ops-monitor-kpi,
  .ops-report.is-loading .ops-monitor-panel
) {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text-secondary);
}

html[data-theme] :is(
  .crm-sidebar-skeleton-dot,
  .crm-sidebar-skeleton-line,
  .crm-table-skeleton-cell,
  .crm-pipeline-loading-column header span,
  .crm-pipeline-loading-column header strong,
  .crm-pipeline-loading-column > div span,
  .agents-work-skeleton-icon,
  .agents-work-skeleton-line,
  .live-skeleton-icon,
  .live-skeleton-line
) {
  background: var(--color-surface-muted);
  border-color: var(--color-border-subtle);
}

html[data-theme] .kb-floating-shell::before,
html[data-theme] .live-alert-menu-backdrop {
  background: var(--color-overlay);
}

html[data-theme] * {
  scrollbar-color: var(--color-scrollbar-thumb) var(--color-scrollbar-track);
}

html[data-theme] *::-webkit-scrollbar-track {
  background: var(--color-scrollbar-track);
}

html[data-theme] *::-webkit-scrollbar-thumb {
  background: var(--color-scrollbar-thumb);
}

/* Multi-workspace authentication and selection */
.login-card {
  overflow-y: auto;
}

.login-text-action {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--color-accent);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.35;
  text-decoration: none;
}

.login-text-action:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

.login-text-action:focus-visible {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 4px;
  border-radius: 4px;
}

.login-forgot-action {
  justify-self: end;
  margin-top: -6px;
}

.login-mode-prompt {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 13px;
  text-align: center;
}

.workspace-view {
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  background: var(--color-canvas);
  color: var(--color-text-primary);
}

.workspace-card:focus-visible {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 2px;
}

.workspace-view-main {
  width: 100%;
  height: 100dvh;
  margin: 0;
  padding:
    clamp(16px, 2.2vh, 26px)
    clamp(12px, 1.35vw, 22px)
    clamp(16px, 2.2vh, 26px)
    clamp(28px, 4vw, 72px);
}

.workspace-view-layout {
  --workspace-title-size: clamp(36px, 2.8vw, 56px);
  display: grid;
  grid-template-columns: minmax(400px, 0.72fr) minmax(560px, 1.28fr);
  align-items: stretch;
  gap: clamp(30px, 3.2vw, 58px);
  height: 100%;
  min-height: 0;
}

.workspace-view-selection {
  width: min(100%, 520px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  justify-self: end;
  padding: clamp(18px, 3.5vh, 34px) 0 0;
  overflow: hidden;
}

.workspace-view-intro {
  max-width: 430px;
  padding-top: 0;
}

.workspace-view-intro h1 {
  margin: 0;
  color: var(--color-text-primary);
  font-size: var(--workspace-title-size);
  line-height: 1.02;
  letter-spacing: -0.055em;
  text-wrap: balance;
}

.workspace-directory {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-top: clamp(24px, 3.5vh, 36px);
  overflow: hidden;
}

.workspace-list {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: color-mix(in srgb, var(--color-text-muted) 45%, transparent) transparent;
  scrollbar-width: thin;
}

.workspace-list::-webkit-scrollbar {
  width: 5px;
}

.workspace-list::-webkit-scrollbar-track {
  background: transparent;
}

.workspace-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-text-muted) 45%, transparent);
}

.workspace-card {
  width: 100%;
  min-height: 92px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  border: 0;
  border-bottom: 1px solid var(--color-border-subtle);
  border-radius: 0;
  background: transparent;
  color: var(--color-text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    background-color 180ms ease,
    color 180ms ease;
}

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

.workspace-card:hover:not(:disabled) {
  background: var(--color-hover);
}

.workspace-card:active:not(:disabled) {
  background: var(--color-selected);
}

.workspace-card:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.workspace-card-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-size: 16px;
  font-weight: 850;
  text-transform: uppercase;
}

.workspace-card-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.workspace-card-copy strong {
  overflow: hidden;
  color: var(--color-text-primary);
  font-size: 15.5px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-card-copy span {
  color: var(--color-text-secondary);
  font-size: 12.5px;
  font-weight: 650;
}

.workspace-card > svg {
  width: 19px;
  height: 19px;
  color: var(--color-text-muted);
  transition: transform 200ms ease, color 200ms ease;
}

.workspace-card:hover:not(:disabled) > svg {
  color: var(--color-accent);
  transform: translateX(2px);
}

.workspace-list-loading,
.workspace-list-empty {
  min-height: 220px;
  padding: 34px;
  color: var(--color-text-secondary);
  text-align: center;
}

.workspace-list-empty {
  display: grid;
  place-items: center;
}

.workspace-list-empty > div {
  max-width: 460px;
}

.workspace-list-empty h2 {
  margin: 0 0 10px;
  color: var(--color-text-primary);
  font-size: 19px;
}

.workspace-list-empty p {
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
}

.workspace-list-loading {
  display: grid;
  gap: 1px;
  min-height: 276px;
  padding: 0;
  background: var(--color-border-subtle);
}

.workspace-loading-row {
  min-height: 92px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  background: var(--color-surface);
}

.workspace-loading-mark,
.workspace-loading-copy span {
  display: block;
  overflow: hidden;
  position: relative;
  background: var(--color-selected);
}

.workspace-loading-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
}

.workspace-loading-copy {
  display: grid;
  gap: 9px;
}

.workspace-loading-copy span:first-child {
  width: min(46%, 190px);
  height: 12px;
  border-radius: 5px;
}

.workspace-loading-copy span:last-child {
  width: min(30%, 120px);
  height: 9px;
  border-radius: 4px;
}

.workspace-loading-mark::after,
.workspace-loading-copy span::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--color-surface-raised) 72%, transparent),
    transparent
  );
  transform: translateX(-100%);
  animation: workspace-loading-sweep 1.25s ease-in-out infinite;
}

@keyframes workspace-loading-sweep {
  to {
    transform: translateX(100%);
  }
}

.workspace-view-status {
  margin: 0;
  padding: 0 22px 18px;
}

.workspace-view-status:empty {
  display: none;
}

.workspace-landscape {
  --workspace-mountain-height: 50%;
  /* 50% scene offset + the center skyline at y=194/360 within the scene. */
  --workspace-sun-horizon: 76.94%;
  container-type: size;
  position: relative;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  isolation: isolate;
  border: 0;
  border-radius: 0 26px 26px 0;
  background:
    radial-gradient(circle at 50% 21%, rgba(255, 255, 255, 0.78), transparent 28%),
    linear-gradient(180deg, #edf8ff 0%, #cfeaff 61%, #9dd6ff 100%);
  -webkit-mask-image:
    linear-gradient(
      90deg,
      transparent 0%,
      rgba(0, 0, 0, 0.48) 2%,
      rgba(0, 0, 0, 0.74) 5%,
      rgba(0, 0, 0, 0.89) 9%,
      rgba(0, 0, 0, 0.96) 14%,
      rgba(0, 0, 0, 0.988) 20%,
      rgba(0, 0, 0, 0.998) 25%,
      #000 29%,
      #000 98.2%,
      rgba(0, 0, 0, 0.76) 100%
    ),
    linear-gradient(
      180deg,
      rgba(0, 0, 0, 0.76) 0%,
      #000 1.8%,
      #000 98.2%,
      rgba(0, 0, 0, 0.76) 100%
    );
  mask-image:
    linear-gradient(
      90deg,
      transparent 0%,
      rgba(0, 0, 0, 0.48) 2%,
      rgba(0, 0, 0, 0.74) 5%,
      rgba(0, 0, 0, 0.89) 9%,
      rgba(0, 0, 0, 0.96) 14%,
      rgba(0, 0, 0, 0.988) 20%,
      rgba(0, 0, 0, 0.998) 25%,
      #000 29%,
      #000 98.2%,
      rgba(0, 0, 0, 0.76) 100%
    ),
    linear-gradient(
      180deg,
      rgba(0, 0, 0, 0.76) 0%,
      #000 1.8%,
      #000 98.2%,
      rgba(0, 0, 0, 0.76) 100%
    );
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
}

.workspace-landscape-sun {
  position: absolute;
  top: calc(var(--workspace-sun-horizon) + 1px);
  left: 50%;
  z-index: 1;
  width: clamp(240px, min(46cqw, 48cqh), 430px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(84, 200, 255, 0.68);
  box-shadow: 0 0 70px rgba(84, 200, 255, 0.22);
  transform: translate(-50%, -50%);
}

.workspace-landscape-art {
  position: absolute;
  inset: 0;
  z-index: 1;
  filter: saturate(0.72) contrast(0.94);
  opacity: 0.7;
}

.workspace-landscape-sun::before {
  content: "";
  position: absolute;
  inset: 28%;
  border-radius: 50%;
  background: rgba(170, 247, 255, 0.72);
  box-shadow:
    inset 0 0 22px rgba(255, 255, 255, 0.34),
    0 0 18px rgba(220, 255, 255, 0.2);
}

.workspace-landscape-sun img {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  width: 27%;
  height: auto;
  opacity: 0.2;
  transform: translate(-50%, -50%);
}

.workspace-landscape-welcome {
  position: absolute;
  top: clamp(48px, 8.5cqh, 82px);
  left: 50%;
  z-index: 2;
  width: min(84%, 620px);
  color: #123251;
  text-align: center;
  transform: translateX(-50%);
}

.workspace-landscape-welcome h2 {
  margin: 0;
  color: inherit;
  font-size: var(--workspace-title-size);
  font-weight: 780;
  line-height: 1.12;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.workspace-landscape-welcome h2 span {
  color: rgba(18, 50, 81, 0.84);
}

.workspace-landscape-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  margin-top: clamp(58px, 8cqh, 78px);
}

.workspace-landscape-actions :is(button, a) {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(18, 50, 81, 0.66);
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color 180ms ease, transform 180ms ease;
}

.workspace-landscape-actions :is(button, a):hover {
  color: #123251;
}

.workspace-landscape-actions :is(button, a):active {
  transform: translateY(1px);
}

.workspace-landscape-actions :is(button, a):focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 4px;
}

.workspace-landscape-actions svg {
  width: 21px;
  height: 21px;
}

.workspace-mountain-scene {
  position: absolute;
  bottom: -1px;
  left: 50%;
  z-index: 2;
  display: block;
  width: max(148%, 920px);
  height: var(--workspace-mountain-height);
  transform: translateX(-50%);
}

.workspace-mountain-layer {
  shape-rendering: geometricPrecision;
}

.workspace-mountain-fog {
  fill: none;
  stroke: rgba(224, 252, 255, 0.34);
  stroke-width: 34px;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: blur(8px);
  shape-rendering: geometricPrecision;
}

.workspace-mountain-fog-far {
  stroke: rgba(234, 254, 255, 0.28);
  stroke-width: 30px;
}

.workspace-mountain-fog-mid {
  stroke: rgba(224, 250, 255, 0.32);
  stroke-width: 38px;
}

.workspace-mountain-fog-near {
  stroke: rgba(210, 242, 255, 0.26);
  stroke-width: 42px;
}

.workspace-mountain-fog-front {
  stroke: rgba(214, 243, 255, 0.14);
  stroke-width: 32px;
}

.workspace-mountain-horizon {
  fill: #75c7ff;
}

.workspace-mountain-farthest {
  fill: #56b4ff;
}

.workspace-mountain-far {
  fill: #329aff;
}

.workspace-mountain-back-soft {
  fill: #258cf8;
}

.workspace-mountain-back {
  fill: #1e7ef0;
}

.workspace-mountain-mid-soft {
  fill: #1770e7;
}

.workspace-mountain-mid {
  fill: #1262d7;
}

.workspace-mountain-near-soft {
  fill: #0d48a9;
}

.workspace-mountain-near {
  fill: #08368a;
}

.workspace-mountain-front-soft {
  fill: #061f5d;
}

.workspace-mountain-left-back {
  fill: #1a6cdb;
}

.workspace-mountain-left-mid {
  fill: #1355b7;
}

.workspace-mountain-left-front {
  fill: #0c4196;
}

.workspace-mountain-right-back {
  fill: #1f7be8;
}

.workspace-mountain-right-mid {
  fill: #1763c8;
}

.workspace-mountain-right-front {
  fill: #104ba4;
}

.workspace-mountain-front {
  fill: #010624;
}

.workspace-mountain-shadow {
  fill: #030d37;
}

html[data-theme="dark"] .workspace-landscape {
  background:
    radial-gradient(circle at 50% 21%, rgba(32, 69, 106, 0.36), transparent 30%),
    linear-gradient(180deg, #171a22 0%, #151e2d 55%, #122a46 100%);
}

html[data-theme="dark"] .workspace-landscape-welcome {
  color: rgba(241, 246, 252, 0.96);
}

html[data-theme="dark"] .workspace-landscape-welcome h2 span {
  color: rgba(241, 246, 252, 0.84);
}

html[data-theme="dark"] .workspace-landscape-actions :is(button, a) {
  color: rgba(219, 229, 241, 0.64);
}

html[data-theme="dark"] .workspace-landscape-actions :is(button, a):hover {
  color: #f1f6fc;
}

.portal-global-workspace {
  appearance: none;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  padding: 4px 5px;
  border-radius: 7px;
  background: transparent;
  color: var(--color-text-primary);
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 800;
  transition: background-color 180ms ease, color 180ms ease;
}

.portal-global-workspace:hover {
  background: var(--color-hover);
  color: var(--color-accent);
}

.portal-global-workspace:focus-visible {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 1px;
}

.portal-global-workspace span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-global-workspace svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

html[data-theme="dark"] .agents-new-whatsapp-country-menu {
  border-color: var(--color-border);
  background: var(--color-surface-raised);
  box-shadow: 0 18px 40px var(--color-shadow);
}

html[data-theme="dark"] .agents-new-whatsapp-field input,
html[data-theme="dark"] .agents-new-whatsapp-country-trigger {
  border-color: var(--color-selected-strong);
  background: var(--color-surface);
  color: var(--ink);
}

html[data-theme="dark"] .agents-new-whatsapp-dialog .agents-new-whatsapp-preview [data-new-whatsapp-preview-text] {
  color: #f3f4f6;
  font-weight: 800;
  opacity: 1;
}

html[data-theme="dark"] .agents-new-whatsapp-country-search {
  border-color: var(--color-border);
  background: var(--color-input);
  box-shadow: none;
}

html[data-theme="dark"] .agents-new-whatsapp-country-search:focus-within {
  border-color: color-mix(in srgb, var(--color-success) 48%, transparent);
  box-shadow: none;
}

html[data-theme="dark"] .agents-new-whatsapp-country-search input,
html[data-theme="dark"] .agents-new-whatsapp-country-search input:focus {
  border: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
}

html[data-theme="dark"] .agents-new-whatsapp-template-search {
  border-color: var(--color-border);
  background: var(--color-surface-raised);
  box-shadow: none;
}

html[data-theme="dark"] .agents-new-whatsapp-template-search:focus-within {
  border-color: color-mix(in srgb, var(--color-success) 48%, var(--color-border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-success) 10%, transparent);
}

html[data-theme="dark"] .agents-new-whatsapp-template-search input,
html[data-theme="dark"] .agents-new-whatsapp-template-search input:focus {
  border: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
}

@media (max-width: 680px) {
  .workspace-view-main {
    width: min(100% - 28px, 1120px);
    height: 100dvh;
    padding: 48px 0 56px;
  }

  .workspace-view-layout {
    grid-template-columns: 1fr;
    gap: 34px;
    min-height: 0;
  }

  .workspace-view-selection {
    width: 100%;
    padding: 0;
  }

  .workspace-view-intro {
    padding-top: 0;
  }

  .workspace-directory {
    margin-top: 28px;
  }

  .workspace-card,
  .workspace-loading-row {
    padding-inline: 16px;
  }

  .workspace-card {
    grid-template-columns: 44px minmax(0, 1fr) auto;
  }

  .workspace-card-mark,
  .workspace-loading-mark {
    width: 44px;
    height: 44px;
    border-radius: 12px;
  }
}

@media (min-width: 681px) and (max-width: 900px) {
  .workspace-view-main {
    width: min(100% - 48px, 640px);
    padding: 64px 0;
  }

  .workspace-view-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .workspace-view-selection {
    width: 100%;
    padding: 0;
  }
}

@media (max-width: 900px) {
  .workspace-view-layout {
    --workspace-title-size: clamp(28px, 7vw, 36px);
    grid-template-rows: auto minmax(0, 1fr);
    gap: 26px;
  }

  .workspace-view-selection {
    grid-row: 2;
  }

  .workspace-landscape {
    display: block;
    grid-row: 1;
    min-height: 0;
    overflow: visible;
    border-radius: 0;
    background: transparent;
    -webkit-mask-image: none;
    mask-image: none;
  }

  .workspace-landscape-welcome {
    position: static;
    width: 100%;
    color: var(--color-text-primary);
    text-align: left;
    transform: none;
  }

  .workspace-landscape-welcome h2 {
    font-size: var(--workspace-title-size);
  }

  .workspace-landscape-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 22px;
    margin-top: 18px;
  }

  .workspace-landscape-actions :is(button, a) {
    font-size: 16px;
  }

  .workspace-landscape-actions svg {
    width: 19px;
    height: 19px;
  }

  .workspace-landscape-actions :is(button, a),
  html[data-theme="dark"] .workspace-landscape-actions :is(button, a) {
    color: var(--color-text-secondary);
  }

  .workspace-landscape-sun,
  .workspace-landscape-art {
    display: none;
  }
}

/* Restrained authentication shell */
.login-view {
  --login-shell-gap: clamp(20px, 3vw, 44px);
  min-height: 100dvh;
  height: auto;
  display: grid;
  grid-template-columns: minmax(360px, 58vw) minmax(0, 1fr);
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--color-canvas);
  color: var(--color-text-primary);
}

.login-card {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: clamp(24px, 4vw, 48px);
  overflow: visible;
}

.login-panel {
  position: relative;
  grid-column: 1;
  grid-row: 1;
  display: block;
  min-height: 0;
  margin: var(--login-shell-gap);
  padding: 0;
  overflow: hidden;
  border-radius: 44px;
  corner-shape: squircle;
  background: #2d3043;
}

.login-panel .signal-ribbon-bg,
.login-panel .signal-ribbon {
  display: none;
}

.login-brand-wall {
  position: absolute;
  inset: 0;
  isolation: isolate;
  overflow: hidden;
}

.login-brand-wall::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border: 0;
  border-radius: inherit;
  pointer-events: none;
}

.login-brand-wall-mark {
  width: 40px;
  height: auto;
  opacity: 1;
  transform: none;
  user-select: none;
}

.login-panel-brand {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 2;
  display: grid;
  gap: 10px;
}

.login-panel-wordmark {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-panel-wordmark strong {
  color: #ffffff;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}

.login-panel-brand > span {
  color: rgba(255, 255, 255, 0.7);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.13em;
  line-height: 1.2;
  text-transform: uppercase;
}

.login-panel-workspace-welcome {
  position: absolute;
  top: clamp(102px, 14.5vh, 150px);
  right: clamp(34px, 4vw, 64px);
  left: clamp(34px, 4vw, 64px);
  z-index: 5;
  color: #ffffff;
  opacity: 0;
  pointer-events: none;
  transform: translateY(22px);
  transition:
    opacity 440ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.login-panel-workspace-welcome h2 {
  max-width: 580px;
  margin: 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: clamp(34px, 3.4vw, 54px);
  font-weight: 680;
  letter-spacing: -0.055em;
  line-height: 1.04;
}

.login-panel-workspace-welcome h2 span {
  display: block;
  color: #ffffff;
}

.login-panel-workspace-actions {
  display: flex;
  width: min(100%, 300px);
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  margin-top: clamp(30px, 4vh, 44px);
}

.login-panel-workspace-actions :is(button, a) {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-width: 0;
  border: 0;
  border-radius: 8px;
  padding: 9px 11px;
  background: transparent;
  color: rgba(255, 255, 255, 0.68);
  font: inherit;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
  transition: color 160ms ease;
}

.login-panel-workspace-actions :is(button, a).is-current {
  background: rgba(255, 255, 255, 0.075);
  color: rgba(255, 255, 255, 0.94);
}

.login-panel-workspace-actions :is(button, a):hover {
  color: #ffffff;
}

.login-panel-workspace-actions :is(button, a):focus-visible {
  border-radius: 4px;
  outline: 2px solid rgba(255, 255, 255, 0.88);
  outline-offset: 5px;
}

.login-panel-workspace-actions svg {
  width: 19px;
  height: 19px;
}

.login-panel-workspace-actions .login-menu-external-icon {
  width: 16px;
  height: 16px;
  margin-left: auto;
  opacity: 0.72;
}

.login-view.is-workspace-mode .login-panel-workspace-welcome {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.login-view.is-workspace-mode .login-panel-workspace-welcome.is-entering {
  animation: login-workspace-welcome-enter 580ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.login-view.is-workspace-mode .login-brand-wall-copy {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px);
}

.login-panel-visual {
  position: absolute;
  top: 31%;
  right: 0;
  left: 0;
  height: clamp(360px, 54vh, 560px);
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 10%, #000 92%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 10%, #000 92%, transparent);
}

.login-panel-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  background: linear-gradient(90deg, #2d3043 0%, transparent 12%, transparent 88%, #2d3043 100%);
}

.login-panel-mountain-sun {
  position: absolute;
  top: 61%;
  left: 50%;
  z-index: 1;
  width: min(47%, 260px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(132, 136, 157, 0.18);
  box-shadow: 0 0 64px rgba(255, 255, 255, 0.025);
  transform: translate(-50%, -50%);
}

.login-panel-mountain-sun::after {
  content: "";
  position: absolute;
  inset: 23%;
  border-radius: inherit;
  background: rgba(190, 193, 208, 0.04);
}

.login-panel-mountain-sun::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  width: 36%;
  aspect-ratio: 625 / 475;
  background: rgba(226, 228, 236, 0.02);
  -webkit-mask: url("/assets/images/logo/logo_nospace_white.png") center / contain no-repeat;
  mask: url("/assets/images/logo/logo_nospace_white.png") center / contain no-repeat;
  transform: translate(-50%, -50%);
}

.login-panel-mountains {
  position: absolute;
  bottom: -1px;
  left: 50%;
  z-index: 2;
  width: 145%;
  height: 72%;
  transform: translateX(-50%);
}

.login-mountain-layer {
  shape-rendering: geometricPrecision;
}

.login-mountain-horizon {
  fill: #4d5063;
}

.login-mountain-farthest {
  fill: #46495b;
}

.login-mountain-far {
  fill: #404354;
}

.login-mountain-back {
  fill: #3a3d4e;
}

.login-mountain-middle {
  fill: #353848;
}

.login-mountain-near {
  fill: #303342;
}

.login-mountain-front-soft {
  fill: #292c3a;
}

.login-mountain-front {
  fill: #242735;
}

.login-brand-wall-copy {
  position: absolute;
  top: clamp(102px, 14.5vh, 150px);
  right: clamp(28px, 3vw, 48px);
  bottom: auto;
  left: clamp(28px, 3vw, 48px);
  z-index: 5;
  display: block;
  color: #ffffff;
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 220ms ease,
    transform 260ms ease;
}

.login-brand-wall-copy h2 {
  max-width: none;
  margin: 0;
  font-family: var(--font-body);
  color: #ffffff;
  font-size: clamp(36px, 3.35vw, 54px);
  font-weight: 650;
  letter-spacing: -0.05em;
  line-height: 1.02;
  text-wrap: balance;
}

.login-brand {
  display: none;
  align-items: center;
  justify-content: flex-start;
  align-self: flex-start;
  gap: 11px;
  margin: 0;
  color: var(--color-text-primary);
}

.login-brand img {
  width: 38px;
  height: 38px;
}

.login-brand-copy {
  gap: 2px;
}

.login-brand-name {
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.login-brand .eyebrow {
  color: var(--color-text-muted);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.14em;
}

.login-form {
  position: relative;
  left: clamp(-22px, -1.2vw, -10px);
  width: min(100%, 390px);
  display: grid;
  align-self: center;
  justify-self: auto;
  gap: 16px;
  margin: auto;
  padding: clamp(44px, 8vh, 84px) 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.login-workspace-view {
  position: relative;
  left: clamp(-22px, -1.2vw, -10px);
  width: min(100%, 430px);
  min-height: 0;
  max-height: 100%;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-self: center;
  margin: auto;
  padding: clamp(44px, 8vh, 84px) 0;
  overflow: hidden;
}

.login-workspace-view.is-entering {
  animation: login-workspace-enter 460ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.login-workspace-heading {
  flex: none;
  margin-bottom: clamp(26px, 4vh, 42px);
}

.login-workspace-heading h1 {
  margin: 0;
  color: var(--color-text-primary);
  font-size: clamp(29px, 3vw, 36px);
  font-weight: 780;
  letter-spacing: -0.045em;
  line-height: 1.08;
}

.login-workspace-directory {
  min-height: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.login-workspace-view .workspace-list {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
}

.login-workspace-view .workspace-card {
  min-height: 78px;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px 4px;
}

.login-workspace-view .workspace-card-icon {
  width: 21px;
  height: 21px;
  color: var(--color-text-secondary);
}

.login-workspace-view .workspace-view-status {
  flex: none;
  padding: 14px 0 0;
}

.workspace-invitation-list {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: color-mix(in srgb, var(--color-text-muted) 45%, transparent) transparent;
  scrollbar-width: thin;
}

.workspace-invitation-list::-webkit-scrollbar {
  width: 5px;
}

.workspace-invitation-list::-webkit-scrollbar-track {
  background: transparent;
}

.workspace-invitation-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-text-muted) 45%, transparent);
}

.workspace-invitation-card {
  min-height: 88px;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--color-border-subtle);
}

.workspace-invitation-card:last-child {
  border-bottom: 0;
}

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

.workspace-invitation-actions button {
  appearance: none;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  padding: 7px 10px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 750;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    color 160ms ease,
    opacity 160ms ease;
}

.workspace-invitation-reject {
  background: transparent;
  color: var(--color-text-secondary);
}

.workspace-invitation-reject:hover:not(:disabled) {
  background: var(--color-hover);
  color: var(--color-text-primary);
}

.workspace-invitation-accept {
  background: var(--color-accent);
  color: var(--color-on-accent);
}

.workspace-invitation-accept:hover:not(:disabled) {
  background: var(--color-accent-hover);
}

.workspace-invitation-actions button:focus-visible {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 1px;
}

.workspace-invitation-actions button:disabled {
  cursor: wait;
  opacity: 0.56;
}

.workspace-invitation-list > .workspace-list-loading,
.workspace-invitation-list > .workspace-list-empty {
  width: 100%;
}

@keyframes login-workspace-enter {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes login-workspace-welcome-enter {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-copy {
  justify-items: start;
  gap: 8px;
  margin-bottom: 12px;
  text-align: left;
}

.login-copy h1 {
  margin: 0;
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: clamp(29px, 3vw, 36px);
  font-weight: 780;
  letter-spacing: -0.045em;
  line-height: 1.08;
}

.login-copy p {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}

.login-form .field {
  gap: 7px;
}

.login-form .field span {
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.login-form .field input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--color-border-strong);
  border-radius: 9px;
  background: var(--color-surface);
  color: var(--color-text-primary);
  padding: 0 13px;
  box-shadow: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.password-input-shell {
  position: relative;
  width: 100%;
}

.login-form .field .password-input-shell input {
  padding-right: 66px;
}

.password-visibility-toggle {
  position: absolute;
  top: 50%;
  right: 7px;
  min-width: 48px;
  height: 34px;
  padding: 0 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--color-accent);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transform: translateY(-50%);
  transition:
    background-color 150ms ease,
    color 150ms ease;
}

.password-visibility-toggle:hover {
  background: var(--color-surface-muted);
}

.password-visibility-toggle:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

.login-form .field input:hover {
  border-color: var(--color-border-emphasis);
}

.login-form .field input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
  transform: none;
}

.login-form .primary-button {
  height: 48px;
  border-radius: 9px;
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-size: 14px;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: none;
  box-shadow: none;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    transform 160ms ease;
}

.login-form .primary-button:hover:not(:disabled) {
  background: var(--color-accent-hover);
}

.login-form .primary-button:active:not(:disabled) {
  transform: translateY(1px);
}

.signup-otp-form {
  gap: 18px;
}

.signup-otp-form .login-copy p strong {
  color: var(--color-text-primary);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.signup-otp-expiry-note {
  margin: -5px 0 0;
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 550;
  line-height: 1.45;
}

.signup-otp-inputs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.signup-otp-inputs input {
  width: 100%;
  min-width: 0;
  height: 54px;
  padding: 0;
  border: 1px solid var(--color-border-strong);
  border-radius: 9px;
  outline: none;
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: 22px;
  font-weight: 750;
  line-height: 1;
  text-align: center;
  caret-color: var(--color-accent);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.signup-otp-inputs input:hover {
  border-color: var(--color-border-emphasis);
}

.signup-otp-inputs input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

.signup-otp-spam-hint {
  display: block;
  min-height: 15px;
  margin-top: -12px;
  opacity: 0;
  transform: translateY(2px);
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 550;
  line-height: 1.4;
  transition:
    opacity 600ms ease,
    transform 600ms ease;
}

.signup-otp-spam-hint.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.signup-otp-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.signup-otp-actions .login-text-action {
  font-size: 12px;
}

.signup-otp-actions .login-text-action:disabled {
  color: var(--color-text-muted);
  cursor: default;
  opacity: 0.8;
}

.login-forgot-action {
  margin-top: -7px;
}

.login-mode-prompt {
  margin-top: 2px;
}

.login-legal-links {
  padding-top: 4px;
  font-size: 12px;
}

html[data-theme="dark"] .login-view {
  background: var(--color-canvas);
  color: var(--color-text-primary);
}

html[data-theme="dark"] .login-card {
  background: transparent;
}

html[data-theme="dark"] .login-panel {
  border: 0;
  background: #2d3043;
}

html[data-theme="dark"] .login-brand-wall-mark {
  opacity: 1;
  filter: none;
}

html[data-theme="dark"] .login-brand-wall-copy h2 {
  color: var(--color-text-primary);
}

html[data-theme="dark"] .login-brand-wall-copy span {
  color: var(--color-text-muted);
}

html[data-theme="dark"] .login-brand-name,
html[data-theme="dark"] .login-copy h1 {
  color: var(--color-text-primary);
}

html[data-theme="dark"] .login-form {
  border: 0;
  background: transparent;
  box-shadow: none;
}

html[data-theme="dark"] .login-form .field input {
  border-color: var(--color-border-strong);
  background: var(--color-input);
  color: var(--color-text-primary);
}

html[data-theme="dark"] .signup-otp-inputs input {
  border-color: var(--color-border-strong);
  background: var(--color-input);
  color: var(--color-text-primary);
}

html[data-theme="dark"] .signup-otp-inputs input:hover {
  border-color: var(--color-border-emphasis);
}

html[data-theme="dark"] .signup-otp-inputs input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

html[data-theme="dark"] .login-form .field input:hover {
  border-color: var(--color-border-emphasis);
}

html[data-theme="dark"] .login-form .field input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

html[data-theme="dark"] .login-form .primary-button {
  background: var(--color-accent);
  color: var(--color-on-accent);
  box-shadow: none;
}

@media (max-height: 760px) and (min-width: 681px) {
  .login-card {
    padding-top: 22px;
    padding-bottom: 22px;
  }

  .login-form {
    padding: 24px 0 18px;
  }

  .login-form[data-signup-form] {
    gap: 11px;
  }

  .login-form[data-signup-form] .login-copy {
    margin-bottom: 3px;
  }

  .login-form[data-signup-form] .field {
    gap: 5px;
  }

  .login-form[data-signup-form] .field input,
  .login-form[data-signup-form] .primary-button {
    height: 44px;
  }
}

@media (max-width: 680px) {
  .login-view {
    grid-template-columns: minmax(0, 1fr);
  }

  .login-card {
    grid-column: 1;
    min-height: 100dvh;
    padding: 22px 16px 28px;
  }

  .login-brand {
    display: flex;
  }

  .login-brand img {
    width: 34px;
    height: 34px;
  }

  .login-panel {
    display: none;
  }

  .login-form {
    left: 0;
    width: 100%;
    margin: auto;
    padding: 54px 0 38px;
  }

  .login-workspace-view {
    left: 0;
    width: 100%;
    padding: 54px 0 38px;
  }

  .login-workspace-heading {
    margin-bottom: 26px;
  }

  .login-workspace-view .workspace-card {
    padding-right: 2px;
    padding-left: 2px;
  }

  .workspace-invitation-card {
    grid-template-columns: 24px minmax(0, 1fr);
    padding-right: 2px;
    padding-left: 2px;
  }

  .workspace-invitation-actions {
    grid-column: 2;
    justify-self: start;
  }

  .signup-otp-inputs {
    gap: 6px;
  }

  .signup-otp-inputs input {
    height: 48px;
    font-size: 20px;
  }

  .signup-otp-actions {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
}

@media (min-width: 681px) and (max-width: 980px) {
  .login-view {
    --login-shell-gap: 18px;
    grid-template-columns: minmax(280px, 50vw) minmax(0, 1fr);
  }

  .login-card {
    grid-column: 2;
  }

  .login-panel {
    display: block;
    margin: 18px;
  }

  .login-brand-wall-mark {
    width: 34px;
  }

  .login-panel-brand {
    top: 28px;
    left: 26px;
  }

  .login-panel-wordmark strong {
    font-size: 18px;
  }

  .login-brand-wall-copy {
    right: 26px;
    bottom: 34px;
    left: 26px;
  }

  .login-brand-wall-copy h2 {
    font-size: clamp(30px, 4.2vw, 40px);
  }
}

/* Keep the task texture on one continuous plane after all palette-specific
   task backgrounds have been resolved above. */
html:not([data-pattern="none"])[data-pattern-surface-task-columns="on"] .tasks-board > .tasks-column,
html:not([data-pattern="none"])[data-pattern-surface-task-columns="on"] .tasks-column-body {
  background-color: transparent;
}

/* The Mountains artwork is always rendered on a dark surface. Keep its
   headings light even when the active theme supplies dark heading tokens. */
html[data-theme] .login-panel .login-brand-wall-copy h2,
html[data-theme] .login-panel .login-panel-workspace-welcome h2 {
  color: rgba(255, 255, 255, 0.92);
}

html[data-theme] .login-panel .login-panel-workspace-welcome h2 span {
  color: #ffffff;
}

/* CRM dark-mode contrast refinement. Keep light mode unchanged while giving
   controls, popovers, and pipeline cards a readable surface hierarchy. */
html[data-theme="dark"] .crm-toolbar :is(
  .crm-search-field input,
  .crm-filter-menu-trigger,
  .crm-toolbar-clear-button
),
html[data-theme="dark"] .crm-contacts-filter-panel :is(
  .crm-search-field input,
  .crm-contact-filter-toggle,
  .tickets-custom-select-trigger
) {
  background: color-mix(in srgb, var(--color-surface-raised) 84%, var(--color-canvas));
  border-color: var(--color-border-strong);
  color: var(--color-text-primary);
  box-shadow: inset 0 1px 0 var(--color-border-subtle);
}

html[data-theme="dark"] .crm-toolbar :is(
  .crm-search-field input,
  .crm-filter-menu-trigger,
  .crm-toolbar-clear-button
):is(:hover, :focus-visible),
html[data-theme="dark"] .crm-contacts-filter-panel :is(
  .crm-search-field input,
  .crm-contact-filter-toggle,
  .tickets-custom-select-trigger
):is(:hover, :focus-visible) {
  background: color-mix(in srgb, var(--color-surface-raised) 92%, var(--color-text-primary) 8%);
  border-color: var(--color-border-emphasis);
}

html[data-theme="dark"] :is(
  .crm-filter-menu-panel,
  .crm-contacts-filter-popover,
  .crm-contacts-filter-popover .tickets-custom-select-menu
) {
  background: var(--color-surface-raised);
  border-color: var(--color-border-strong);
  color: var(--color-text-primary);
  box-shadow:
    0 18px 44px var(--color-shadow),
    inset 0 1px 0 var(--color-border-subtle);
}

html[data-theme="dark"] :is(
  .crm-filter-menu-panel,
  .crm-contacts-filter-popover
) .crm-filter-check,
html[data-theme="dark"] .crm-contacts-filter-popover :is(
  .crm-contact-duplicate-toggle,
  .crm-filter-checkbox-stack
) {
  background: color-mix(in srgb, var(--color-surface) 88%, var(--color-surface-raised));
  border-color: var(--color-border-strong);
  color: var(--color-text-primary);
}

html[data-theme="dark"] :is(
  .crm-filter-menu-panel,
  .crm-contacts-filter-popover
) .crm-filter-check:hover,
html[data-theme="dark"] .crm-contacts-filter-popover .crm-contact-duplicate-toggle:hover {
  background: var(--color-hover);
  border-color: var(--color-border-emphasis);
}

html[data-theme="dark"] :is(
  .crm-filter-menu-panel,
  .crm-contacts-filter-popover
) .crm-filter-check input {
  background: var(--color-input);
  border-color: var(--color-border-emphasis);
}

html[data-theme="dark"] :is(
  .crm-filter-menu-panel,
  .crm-contacts-filter-popover
) .crm-filter-check input:checked {
  border-color: var(--color-accent);
  background-color: var(--color-accent);
}

html[data-theme="dark"] .crm-contacts-filter-popover .crm-toolbar-field :is(
  input,
  .tickets-custom-select-trigger
) {
  background: var(--color-input);
  border-color: var(--color-border-strong);
  color: var(--color-text-primary);
}

html[data-theme="dark"] .crm-contacts-filter-popover .tickets-custom-select-option {
  color: var(--color-text-secondary);
}

html[data-theme="dark"] .crm-contacts-filter-popover .tickets-custom-select-option:is(:hover, .is-selected) {
  background: var(--color-selected);
  color: var(--color-text-primary);
}

html[data-theme="dark"] .crm-pipeline-card,
html[data-theme="dark"] .crm-pipeline-note-card {
  background: color-mix(in srgb, var(--color-surface-raised) 88%, var(--color-surface));
  border-color: var(--color-border-strong);
  box-shadow:
    0 5px 14px var(--color-shadow-tight),
    inset 0 1px 0 var(--color-border-subtle);
}

html[data-theme="dark"] .crm-pipeline-card-top {
  background: color-mix(in srgb, var(--color-surface-muted) 72%, var(--color-surface-raised));
  border-bottom-color: var(--color-border-strong);
}

html[data-theme="dark"] .crm-pipeline-card:hover {
  background: color-mix(in srgb, var(--color-surface-raised) 90%, var(--color-text-primary) 10%);
  border-color: var(--color-border-emphasis);
  box-shadow:
    0 8px 20px var(--color-shadow),
    inset 0 1px 0 var(--color-border);
}

.crm-organization-contact-count {
  color: inherit;
  font: inherit;
  font-weight: inherit;
}

html[data-theme="dark"] .crm-organization-contact-count {
  color: var(--color-text-primary);
}

/* Portal account settings */
.account-settings-layer {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: grid;
  place-items: center;
  padding: 24px;
}

.account-settings-layer.hidden {
  display: none;
}

.account-settings-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: color-mix(in srgb, #07111f 56%, transparent);
  backdrop-filter: blur(7px);
  cursor: default;
}

.account-settings-dialog {
  position: relative;
  width: min(880px, 100%);
  max-height: min(820px, calc(100vh - 48px));
  overflow: auto;
  border: 1px solid var(--color-border-strong);
  border-radius: 18px;
  background: var(--color-surface-raised);
  color: var(--color-text-primary);
  box-shadow: 0 28px 80px color-mix(in srgb, #07111f 30%, transparent);
}

.account-settings-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 30px 23px;
  border-bottom: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--color-surface-raised) 94%, transparent);
  backdrop-filter: blur(12px);
}

.account-settings-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--color-text-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.account-settings-header h2,
.account-email-confirmation h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.18;
  letter-spacing: -.035em;
}

.account-settings-close {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--color-border-strong);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
}

.account-settings-close:hover {
  background: var(--color-hover);
  color: var(--color-text-primary);
}

.account-settings-close svg {
  width: 17px;
  height: 17px;
}

.account-settings-section {
  display: grid;
  grid-template-columns: minmax(180px, .72fr) minmax(320px, 1.4fr);
  gap: 44px;
  padding: 30px;
  border-bottom: 1px solid var(--color-border);
}

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

.account-settings-section-copy h3 {
  margin: 0 0 7px;
  font-size: 16px;
  letter-spacing: -.02em;
}

.account-settings-section-copy p,
.account-email-confirmation p {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 13px;
  line-height: 1.6;
}

.account-settings-fields {
  display: grid;
  gap: 16px;
}

.account-settings-field {
  display: grid;
  gap: 7px;
}

.account-settings-field > span {
  color: var(--color-text-secondary);
  font-size: 11px;
  font-weight: 750;
}

.account-settings-field input {
  width: 100%;
  min-width: 0;
  height: 43px;
  padding: 0 13px;
  border: 1px solid var(--color-border-strong);
  border-radius: 9px;
  outline: 0;
  background: var(--color-input);
  color: var(--color-text-primary);
  font: inherit;
  font-size: 13px;
}

.account-settings-field input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 15%, transparent);
}

.account-settings-field input[readonly] {
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  cursor: default;
}

.account-settings-password-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.account-settings-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  min-height: 40px;
}

.account-settings-status {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.account-settings-status.is-error {
  color: var(--color-danger, #b42318);
}

.account-settings-status.is-success {
  color: var(--color-success, #19734a);
}

.account-settings-button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid color-mix(in srgb, var(--color-accent) 72%, var(--color-border-strong));
  border-radius: 9px;
  background: var(--color-accent);
  color: var(--color-accent-contrast, #fff);
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.account-settings-button:hover:not(:disabled) {
  filter: brightness(.96);
}

.account-settings-button:disabled {
  cursor: wait;
  opacity: .6;
}

.account-settings-button-secondary {
  border-color: var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-text-primary);
}

.account-email-confirmation {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  padding: 38px 34px 34px;
}

.account-email-confirmation.hidden {
  display: none;
}

.account-email-confirmation-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: color-mix(in srgb, var(--color-accent) 10%, var(--color-surface));
  color: var(--color-accent);
}

.account-email-confirmation-icon svg {
  width: 21px;
  height: 21px;
}

.account-email-confirmation h2 {
  margin-bottom: 10px;
}

.account-email-confirmation .account-settings-status {
  margin-top: 10px;
}

.account-email-confirmation-actions {
  grid-column: 2;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 8px;
}

@media (max-width: 720px) {
  .account-settings-layer {
    align-items: end;
    padding: 0;
  }

  .account-settings-dialog {
    width: 100%;
    max-height: 92vh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 18px 18px 0 0;
  }

  .account-settings-header,
  .account-settings-section {
    padding-right: 20px;
    padding-left: 20px;
  }

  .account-settings-section {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .account-settings-password-grid {
    grid-template-columns: 1fr;
  }

  .account-settings-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .account-settings-button {
    width: 100%;
  }

  .account-email-confirmation {
    grid-template-columns: 1fr;
    padding: 30px 22px;
  }

  .account-email-confirmation-actions {
    grid-column: 1;
    flex-direction: column-reverse;
  }
}

/* Private channel timeline entries: deliberately outside customer/agent bubbles. */
.agents-internal-entry {
  width: 100%; box-sizing: border-box; padding: 18px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.agents-internal-entry-meta {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  font-size: 11px; color: var(--text-muted, #a8b5bd); margin-bottom: 12px;
}
.agents-internal-entry-content {
  font-size: 13px; line-height: 1.6; color: var(--text-primary, #dce5ec);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
