/*
 * Zapbuild Smartbot — shared content components
 * Cards, tables, forms, tabs, badges, KPI cards, buttons, drawers, empty states.
 * Used by every authenticated page (dashboard, bots, inbox, settings, etc.)
 */

/* ---------------- Layout helpers ---------------- */

.zb-stack { display: flex; flex-direction: column; }
.zb-row { display: flex; align-items: center; }
.zb-row-between { display: flex; align-items: center; justify-content: space-between; }
.zb-wrap { flex-wrap: wrap; }
.zb-gap-1 { gap: 4px; }
.zb-gap-2 { gap: 8px; }
.zb-gap-3 { gap: 12px; }
.zb-gap-4 { gap: 16px; }
.zb-gap-6 { gap: 24px; }
.zb-mt-1 { margin-top: 4px; }
.zb-mt-2 { margin-top: 8px; }
.zb-mt-3 { margin-top: 12px; }
.zb-mt-4 { margin-top: 16px; }
.zb-mt-6 { margin-top: 24px; }
.zb-mb-2 { margin-bottom: 8px; }
.zb-mb-3 { margin-bottom: 12px; }
.zb-mb-4 { margin-bottom: 16px; }
.zb-flex-1 { flex: 1; min-width: 0; }
.zb-muted { color: hsl(var(--zb-text-muted)); }
.zb-text-xs { font-size: var(--text-xs); }
.zb-text-sm { font-size: var(--text-sm); }
.zb-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.zb-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.zb-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.zb-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 900px) {
  .zb-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .zb-grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .zb-grid-2, .zb-grid-3, .zb-grid-4 { grid-template-columns: 1fr; }
}

/* ---------------- Page header ---------------- */

.zb-page-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
@media (min-width: 640px) {
  .zb-page-header { flex-direction: row; align-items: flex-end; justify-content: space-between; }
}
.zb-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  color: hsl(var(--zb-text-muted));
  margin-bottom: 4px;
}
.zb-breadcrumbs .is-current { color: hsl(var(--zb-text-primary)); }
.zb-page-title {
  font-size: var(--text-2xl);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.zb-page-desc {
  margin-top: 4px;
  font-size: var(--text-sm);
  color: hsl(var(--zb-text-muted));
  max-width: 60ch;
}
.zb-page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* ---------------- Route tabs (bot workspace / settings) ---------------- */

.zb-route-tabs {
  border-bottom: 1px solid hsl(var(--zb-border));
  overflow-x: auto;
}
.zb-route-tabs__nav {
  display: flex;
  gap: 4px;
  min-width: max-content;
}
.zb-route-tab {
  position: relative;
  padding: 10px 12px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: hsl(var(--zb-text-muted));
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--zb-dur-fast) var(--zb-ease);
}
.zb-route-tab:hover { color: hsl(var(--zb-text-primary)); }
.zb-route-tab.is-active {
  color: hsl(var(--zb-text-primary));
  border-bottom-color: hsl(var(--zb-accent));
}

/* ---------------- Cards ---------------- */

.zb-card {
  background: hsl(var(--zb-bg-card));
  border: 1px solid hsl(var(--zb-border));
  border-radius: var(--radius-xl);
  padding: 20px;
}
.zb-card--pad-sm { padding: 16px; }
.zb-card-title {
  font-size: var(--text-md);
  font-weight: 600;
}
.zb-card-subtitle {
  margin-top: 2px;
  font-size: var(--text-xs);
  color: hsl(var(--zb-text-muted));
}

/* ---------------- KPI stat card ---------------- */

.zb-kpi {
  border-radius: var(--radius-xl);
  border: 1px solid hsl(var(--zb-border));
  background: hsl(var(--zb-bg-card));
  padding: 16px;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: box-shadow var(--zb-dur-fast) var(--zb-ease);
}
.zb-kpi:hover { box-shadow: var(--shadow-sm); }
.zb-kpi__label {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: hsl(var(--zb-text-muted));
}
.zb-kpi__value {
  margin-top: 8px;
  font-size: var(--text-2xl);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.zb-kpi__delta {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.zb-kpi__delta.is-up { color: hsl(var(--zb-success)); }
.zb-kpi__delta.is-down { color: hsl(var(--zb-danger)); }
.zb-kpi__delta.is-flat { color: hsl(var(--zb-text-muted)); }
.zb-kpi__hint { color: hsl(var(--zb-text-muted)); }

/* ---------------- Status pill / badge ---------------- */

.zb-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
}
.zb-pill__dot { height: 6px; width: 6px; border-radius: 999px; }
.zb-pill--success { background: hsl(var(--zb-success) / 0.10); color: hsl(var(--zb-success)); }
.zb-pill--success .zb-pill__dot { background: hsl(var(--zb-success)); }
.zb-pill--warning { background: hsl(var(--zb-warning) / 0.12); color: hsl(var(--zb-warning)); }
.zb-pill--warning .zb-pill__dot { background: hsl(var(--zb-warning)); }
.zb-pill--danger { background: hsl(var(--zb-danger) / 0.10); color: hsl(var(--zb-danger)); }
.zb-pill--danger .zb-pill__dot { background: hsl(var(--zb-danger)); }
.zb-pill--info { background: hsl(var(--zb-info) / 0.10); color: hsl(var(--zb-info)); }
.zb-pill--info .zb-pill__dot { background: hsl(var(--zb-info)); }
.zb-pill--neutral { background: hsl(var(--zb-bg-input)); color: hsl(var(--zb-text-muted)); }
.zb-pill--neutral .zb-pill__dot { background: hsl(var(--zb-text-muted)); }

/* ---------------- Buttons (content area — extends topbar.css's .zb-btn) ---------------- */

.zb-btn--primary {
  background: hsl(var(--zb-accent));
  color: hsl(var(--zb-text-inverse));
}
.zb-btn--primary:hover { background: hsl(var(--zb-accent-hover)); }
.zb-btn--outline {
  border: 1px solid hsl(var(--zb-border));
  color: hsl(var(--zb-text-primary));
  background: hsl(var(--zb-bg-card));
}
.zb-btn--outline:hover { background: hsl(var(--zb-bg-input)); }
.zb-btn--sm { height: 30px; padding: 0 10px; font-size: var(--text-xs); }

/* ---------------- Forms ---------------- */

.zb-field { display: flex; flex-direction: column; gap: 6px; }
.zb-label { font-size: var(--text-sm); font-weight: 500; }
.zb-input,
.zb-textarea,
.zb-select {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  border: 1px solid hsl(var(--zb-border));
  background: hsl(var(--zb-bg-card));
  font-size: var(--text-sm);
  color: hsl(var(--zb-text-primary));
  transition: border-color var(--zb-dur-fast) var(--zb-ease);
}
.zb-textarea { height: auto; padding: 10px 12px; min-height: 88px; resize: vertical; }
.zb-input:focus,
.zb-textarea:focus,
.zb-select:focus {
  outline: none;
  border-color: hsl(var(--zb-accent));
  box-shadow: 0 0 0 3px hsl(var(--zb-accent) / 0.15);
}
.zb-input::placeholder,
.zb-textarea::placeholder { color: hsl(var(--zb-text-placeholder)); }
.zb-help { font-size: var(--text-xs); color: hsl(var(--zb-text-muted)); }
.zb-form-section {
  border-bottom: 1px solid hsl(var(--zb-border));
  padding-bottom: 20px;
  margin-bottom: 20px;
}
.zb-form-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.zb-form-section__title { font-size: var(--text-md); font-weight: 600; }
.zb-form-section__desc { margin-top: 2px; font-size: var(--text-xs); color: hsl(var(--zb-text-muted)); max-width: 60ch; }

/* Switch */
.zb-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 22px;
  width: 38px;
  border-radius: 999px;
  background: hsl(var(--zb-bg-input));
  border: 1px solid hsl(var(--zb-border));
  flex-shrink: 0;
  transition: background-color var(--zb-dur-fast) var(--zb-ease);
}
.zb-switch::before {
  content: "";
  position: absolute;
  left: 2px;
  height: 16px;
  width: 16px;
  border-radius: 999px;
  background: hsl(var(--zb-bg-card));
  box-shadow: var(--shadow-xs);
  transition: transform var(--zb-dur-fast) var(--zb-ease);
}
.zb-switch.is-on { background: hsl(var(--zb-accent)); border-color: hsl(var(--zb-accent)); }
.zb-switch.is-on::before { transform: translateX(16px); background: white; }

/* Search input with icon */
.zb-search { position: relative; }
.zb-search .zb-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: hsl(var(--zb-text-muted));
}
.zb-search .zb-input { padding-left: 36px; }

/* ---------------- Table ---------------- */

.zb-table-wrap {
  border: 1px solid hsl(var(--zb-border));
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: hsl(var(--zb-bg-card));
}
.zb-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.zb-table thead th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: hsl(var(--zb-text-muted));
  background: hsl(var(--zb-bg-card-hover));
  border-bottom: 1px solid hsl(var(--zb-border));
  white-space: nowrap;
}
.zb-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid hsl(var(--zb-border));
  vertical-align: middle;
}
.zb-table tbody tr:last-child td { border-bottom: none; }
.zb-table tbody tr:hover { background: hsl(var(--zb-bg-card-hover)); }
.zb-table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

/* ---------------- Avatar ---------------- */

.zb-avatar {
  height: 32px;
  width: 32px;
  border-radius: 999px;
  background: hsl(var(--zb-accent));
  color: hsl(var(--zb-text-inverse));
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ---------------- Empty state ---------------- */

.zb-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 24px;
  border-radius: var(--radius-xl);
  background: hsl(var(--zb-bg-card));
  border: 1px solid hsl(var(--zb-border));
}
.zb-empty__icon {
  height: 48px;
  width: 48px;
  border-radius: 999px;
  background: hsl(var(--zb-accent) / 0.12);
  color: hsl(var(--zb-accent-active));
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.zb-empty__title { font-size: var(--text-md); font-weight: 600; }
.zb-empty__desc { margin-top: 6px; max-width: 44ch; font-size: var(--text-sm); color: hsl(var(--zb-text-muted)); }
.zb-empty__action { margin-top: 20px; }

/* ---------------- Drawer (right side panel) ---------------- */

.zb-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 30, 32, 0.45);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--zb-dur-base) var(--zb-ease);
}
.zb-drawer-overlay.is-open { opacity: 1; pointer-events: auto; }
.zb-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 420px;
  max-width: 92vw;
  background: hsl(var(--zb-bg-card));
  box-shadow: var(--shadow-xl);
  z-index: 91;
  transform: translateX(100%);
  transition: transform var(--zb-dur-base) var(--zb-ease);
  display: flex;
  flex-direction: column;
}
.zb-drawer.is-open { transform: translateX(0); }
.zb-drawer__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid hsl(var(--zb-border));
}
.zb-drawer__title { font-size: var(--text-lg); font-weight: 600; }
.zb-drawer__desc { margin-top: 2px; font-size: var(--text-xs); color: hsl(var(--zb-text-muted)); }
.zb-drawer__body { flex: 1; overflow-y: auto; padding: 20px; }
.zb-drawer__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid hsl(var(--zb-border));
}

/* ---------------- Status dot (text-only, no pill background) ---------------- */

.zb-status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  font-weight: 500;
}
.zb-status-dot::before {
  content: "";
  height: 6px;
  width: 6px;
  border-radius: 999px;
  background: currentColor;
}
.zb-status-dot--success { color: hsl(var(--zb-success)); }
.zb-status-dot--neutral { color: hsl(var(--zb-text-muted)); }
.zb-status-dot--warning { color: hsl(var(--zb-warning)); }
.zb-status-dot--danger { color: hsl(var(--zb-danger)); }
.zb-status-dot--info { color: hsl(var(--zb-info)); }

/* Light rounded badge (e.g. platform: Website) */
.zb-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  background: hsl(var(--zb-info) / 0.10);
  color: hsl(var(--zb-info));
}

/* Row icon avatar (bot/kb icon swatch in tables) */
.zb-row-icon {
  height: 36px;
  width: 36px;
  border-radius: var(--radius-lg);
  background: hsl(var(--zb-accent) / 0.12);
  color: hsl(var(--zb-accent-active));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Row actions menu (••• button + dropdown) */
.zb-row-menu { position: relative; display: inline-block; }
.zb-row-menu__trigger {
  height: 28px;
  width: 28px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: hsl(var(--zb-text-muted));
}
.zb-row-menu__trigger:hover { background: hsl(var(--zb-bg-input)); color: hsl(var(--zb-text-primary)); }
.zb-row-menu__panel {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 160px;
  background: hsl(var(--zb-bg-card));
  border: 1px solid hsl(var(--zb-border));
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity var(--zb-dur-fast) var(--zb-ease), transform var(--zb-dur-fast) var(--zb-ease);
  z-index: 40;
}
.zb-row-menu__panel.is-open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.zb-row-menu__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  text-align: left;
}
.zb-row-menu__item:hover { background: hsl(var(--zb-bg-card-hover)); }
.zb-row-menu__item--danger { color: hsl(var(--zb-danger)); }
.zb-row-menu__item--danger:hover { background: hsl(var(--zb-danger) / 0.08); }

/* Two-column detail layout: main content + narrow info sidebar */
.zb-detail-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .zb-detail-layout { grid-template-columns: 1fr; }
}

/* Split variant: two equal columns (e.g. settings form + live preview) */
.zb-detail-layout--split {
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
}
@media (max-width: 900px) {
  .zb-detail-layout--split { grid-template-columns: 1fr; }
}

/* Sticky preview column: stays in view while the sibling column scrolls past.
   Disabled on narrow screens, where the columns stack instead. */
.zb-preview-col {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 20px;
  align-self: start;
}
@media (max-width: 900px) {
  .zb-preview-col {
    position: static;
    align-self: stretch;
  }
}

.zb-info-card { background: hsl(var(--zb-bg-card)); border: 1px solid hsl(var(--zb-border)); border-radius: var(--radius-xl); padding: 16px; }
.zb-info-card + .zb-info-card { margin-top: 16px; }
.zb-info-card__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.zb-info-card__title { font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: hsl(var(--zb-text-muted)); }
.zb-info-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-top: 1px solid hsl(var(--zb-border)); font-size: var(--text-xs); }
.zb-info-row:first-of-type { border-top: none; }
.zb-info-row__label { color: hsl(var(--zb-text-muted)); }
.zb-info-row__value { font-weight: 600; color: hsl(var(--zb-accent-active)); }

.zb-checklist-item { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: var(--text-sm); }
.zb-checklist-item__circle { height: 16px; width: 16px; border-radius: 999px; border: 2px solid hsl(var(--zb-border)); flex-shrink: 0; }
.zb-checklist-item.is-done .zb-checklist-item__circle { background: hsl(var(--zb-success)); border-color: hsl(var(--zb-success)); }

.zb-tip-box {
  border: 1px dashed hsl(var(--zb-border));
  border-radius: var(--radius-lg);
  padding: 12px;
  font-size: var(--text-xs);
  color: hsl(var(--zb-text-muted));
  line-height: 1.5;
}

/* Danger zone banner */
.zb-danger-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid hsl(var(--zb-danger) / 0.25);
  background: hsl(var(--zb-danger) / 0.05);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
}
.zb-danger-box__title { font-size: var(--text-sm); font-weight: 600; color: hsl(var(--zb-danger)); }
.zb-danger-box__desc { margin-top: 2px; font-size: var(--text-xs); color: hsl(var(--zb-text-muted)); }
.zb-btn--danger-outline {
  border: 1px solid hsl(var(--zb-danger) / 0.4);
  color: hsl(var(--zb-danger));
  background: hsl(var(--zb-bg-card));
}
.zb-btn--danger-outline:hover { background: hsl(var(--zb-danger) / 0.08); }

/* Code block with copy button */
.zb-code-block { position: relative; }
.zb-code-block pre {
  background: hsl(var(--zb-bg-sidebar));
  color: #d7f5f0;
  padding: 16px;
  border-radius: var(--radius-lg);
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.zb-code-block__copy { position: absolute; top: 10px; right: 10px; }

/* Sticky save bar — pins to the bottom of the scroll container so Save/Discard
   stay reachable without scrolling through long forms (Theme, Agent, etc). */
.zb-save-bar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin: 20px -20px -20px;
  padding: 16px 20px;
  background: hsl(var(--zb-bg-card));
  border-top: 1px solid hsl(var(--zb-border));
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  box-shadow: 0 -4px 12px -4px rgba(15, 23, 42, 0.06);
}


.zb-divider { height: 1px; background: hsl(var(--zb-border)); border: none; margin: 20px 0; }

.zb-skeleton {
  background: hsl(var(--zb-bg-input));
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
}

/* ---------------- Selectable preset cards (Theme/Layout sub-tabs) ---------------- */

.zb-preset-grid {
  display: grid;
  gap: 10px;
}
.zb-preset-grid--3 { grid-template-columns: repeat(3, 1fr); }
.zb-preset-grid--2 { grid-template-columns: repeat(2, 1fr); }
.zb-preset-grid--4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 640px) {
  .zb-preset-grid--4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .zb-preset-grid--3 { grid-template-columns: repeat(2, 1fr); }
}

.zb-preset-card {
  border: 1.5px solid hsl(var(--zb-border));
  border-radius: var(--radius-lg);
  padding: 10px;
  text-align: left;
  transition: border-color var(--zb-dur-fast) var(--zb-ease), background-color var(--zb-dur-fast) var(--zb-ease);
}
.zb-preset-card:hover { background: hsl(var(--zb-bg-card-hover)); }
.zb-preset-card.is-selected {
  border-color: hsl(var(--zb-accent));
  background: hsl(var(--zb-accent) / 0.05);
}
.zb-preset-card__swatch {
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid hsl(var(--zb-border));
  margin-bottom: 8px;
}
.zb-preset-card__title { display: flex; align-items: center; gap: 6px; font-size: var(--text-sm); font-weight: 600; }
.zb-preset-card__title .zb-icon { width: 14px; height: 14px; color: hsl(var(--zb-text-muted)); }
.zb-preset-card.is-selected .zb-preset-card__title .zb-icon { color: hsl(var(--zb-accent-active)); }
.zb-preset-card__desc { margin-top: 2px; font-size: 11px; color: hsl(var(--zb-text-muted)); }

/* Chat-window-style mini preview card */
.zb-style-card { display: flex; gap: 10px; align-items: flex-start; }
.zb-style-card__preview {
  flex-shrink: 0;
  width: 56px;
  height: 40px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid hsl(var(--zb-border));
}
.zb-style-card__preview-head { height: 14px; background: hsl(var(--zb-bg-sidebar)); }
.zb-style-card__preview-body { height: 26px; background: hsl(var(--zb-bg-card)); position: relative; }
.zb-style-card__preview-body::after {
  content: "";
  position: absolute; right: 4px; bottom: 4px;
  width: 14px; height: 6px; border-radius: 999px;
  background: hsl(var(--zb-accent) / 0.4);
}

/* Color swatches */
.zb-swatch-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.zb-swatch {
  height: 26px;
  width: 26px;
  border-radius: 999px;
  border: 2px solid transparent;
  box-shadow: 0 0 0 1px hsl(var(--zb-border));
  flex-shrink: 0;
}
.zb-swatch.is-selected { border-color: hsl(var(--zb-bg-card)); box-shadow: 0 0 0 2px hsl(var(--zb-accent)); }
.zb-swatch-hex {
  height: 30px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid hsl(var(--zb-border));
  font-size: 12px;
  font-family: ui-monospace, monospace;
  color: hsl(var(--zb-text-secondary));
  background: hsl(var(--zb-bg-card-hover));
  display: flex;
  align-items: center;
}

/* Avatar preset picker */
.zb-avatar-picker { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.zb-avatar-picker__item {
  height: 40px;
  width: 40px;
  border-radius: var(--radius-md);
  border: 1.5px solid hsl(var(--zb-border));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.zb-avatar-picker__item.is-selected { border-color: hsl(var(--zb-accent)); box-shadow: 0 0 0 1px hsl(var(--zb-accent)); }

/* Position picker (Layout sub-tab) */
.zb-position-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 480px) { .zb-position-grid { grid-template-columns: repeat(2, 1fr); } }

.zb-position-card {
  border: 1.5px solid hsl(var(--zb-border));
  border-radius: var(--radius-lg);
  padding: 8px;
  text-align: left;
}
.zb-position-card:hover { background: hsl(var(--zb-bg-card-hover)); }
.zb-position-card.is-selected { border-color: hsl(var(--zb-accent)); background: hsl(var(--zb-accent) / 0.05); }
.zb-position-card__box {
  position: relative;
  height: 48px;
  border-radius: var(--radius-sm);
  background: hsl(var(--zb-bg-input) / 0.7);
  margin-bottom: 6px;
}
.zb-position-card__dot {
  position: absolute;
  height: 8px;
  width: 8px;
  border-radius: 999px;
  background: hsl(var(--zb-text-muted));
}
.zb-position-card.is-selected .zb-position-card__dot { background: hsl(var(--zb-accent)); }
.zb-position-card__label { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; }
.zb-position-card__label .zb-icon { width: 12px; height: 12px; color: hsl(var(--zb-text-muted)); }

/* Pill-button group (window size, launcher size) */
.zb-pill-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.zb-pill-btn {
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-full);
  border: 1.5px solid hsl(var(--zb-border));
  font-size: var(--text-xs);
  font-weight: 500;
  color: hsl(var(--zb-text-secondary));
}
.zb-pill-btn:hover { background: hsl(var(--zb-bg-card-hover)); }
.zb-pill-btn.is-selected { border-color: hsl(var(--zb-accent)); color: hsl(var(--zb-accent-active)); background: hsl(var(--zb-accent) / 0.06); }

/* Shape / launcher-icon square cards */
.zb-shape-card {
  border: 1.5px solid hsl(var(--zb-border));
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: hsl(var(--zb-text-secondary));
}
.zb-shape-card:hover { background: hsl(var(--zb-bg-card-hover)); }
.zb-shape-card.is-selected { border-color: hsl(var(--zb-accent)); background: hsl(var(--zb-accent) / 0.05); color: hsl(var(--zb-text-primary)); }
.zb-shape-card .zb-icon { width: 18px; height: 18px; color: hsl(var(--zb-text-muted)); }
.zb-shape-card.is-selected .zb-icon { color: hsl(var(--zb-accent-active)); }

/* Sub-tab panels (Content/Theme/Layout) */
.zb-subtab-panel { display: none; }
.zb-subtab-panel.is-active { display: block; }

/* ---------------- Add Tool drawer: method toggle, kv rows, mini tabs ---------------- */

.zb-drawer--wide { width: 480px; }

.zb-required { color: hsl(var(--zb-danger)); }

.zb-method-toggle { display: inline-flex; gap: 6px; }
.zb-method-btn {
  height: 30px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid hsl(var(--zb-border));
  font-size: 12px;
  font-weight: 600;
  color: hsl(var(--zb-text-muted));
}
.zb-method-btn:hover { background: hsl(var(--zb-bg-card-hover)); }
.zb-method-btn.is-selected { background: hsl(var(--zb-accent)); border-color: hsl(var(--zb-accent)); color: white; }

.zb-mini-tabs { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--radius-sm); background: hsl(var(--zb-bg-input)); }
.zb-mini-tab { height: 22px; padding: 0 8px; border-radius: 4px; font-size: 11px; font-weight: 500; color: hsl(var(--zb-text-muted)); }
.zb-mini-tab.is-selected { background: hsl(var(--zb-bg-card)); color: hsl(var(--zb-text-primary)); box-shadow: var(--shadow-xs); }

.zb-kv-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.zb-kv-row .zb-input { flex: 1; }
.zb-kv-row__delete {
  height: 34px; width: 34px; flex-shrink: 0;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: hsl(var(--zb-text-muted));
}
.zb-kv-row__delete:hover { background: hsl(var(--zb-danger) / 0.08); color: hsl(var(--zb-danger)); }

.zb-add-row-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--text-xs); font-weight: 500;
  color: hsl(var(--zb-text-secondary));
  padding: 6px 4px;
}
.zb-add-row-btn:hover { color: hsl(var(--zb-accent-active)); }

/* Text-only row action (e.g. Deactivate/Activate in tables) */
.zb-link-action {
  font-size: var(--text-sm);
  font-weight: 600;
  color: hsl(var(--zb-text-primary));
}
.zb-link-action:hover { color: hsl(var(--zb-accent-active)); text-decoration: underline; }

/* Accent-bordered drawer close button (Edit user style) */
.zb-drawer__close-accent {
  height: 30px;
  width: 30px;
  border-radius: var(--radius-sm);
  border: 1.5px solid hsl(var(--zb-accent));
  color: hsl(var(--zb-accent-active));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.zb-drawer__close-accent:hover { background: hsl(var(--zb-accent) / 0.08); }

/* Toggle option card (Active / Is lead style) */
.zb-toggle-card {
  border: 1px solid hsl(var(--zb-border));
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.zb-toggle-card__label { font-size: var(--text-sm); font-weight: 600; }
.zb-toggle-card__desc { margin-top: 2px; font-size: 11px; color: hsl(var(--zb-text-muted)); }

/* ---------------- Filter chip tabs (Knowledge Bases: All/Ready/Processing/Failed) ---------------- */

.zb-filter-chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.zb-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-full);
  border: 1.5px solid hsl(var(--zb-border));
  background: hsl(var(--zb-bg-card));
  font-size: var(--text-sm);
  font-weight: 500;
  color: hsl(var(--zb-text-secondary));
}
.zb-filter-chip:hover { background: hsl(var(--zb-bg-card-hover)); }
.zb-filter-chip.is-selected { border-color: hsl(var(--zb-accent)); color: hsl(var(--zb-accent-active)); background: hsl(var(--zb-accent) / 0.06); }
.zb-filter-chip__count { font-size: 11px; font-weight: 600; opacity: 0.7; }

.zb-clear-filters {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--text-xs);
  font-weight: 500;
  color: hsl(var(--zb-text-muted));
}
.zb-clear-filters:hover { color: hsl(var(--zb-text-primary)); }
.zb-clear-filters .zb-icon { width: 13px; height: 13px; }

/* Status pill with full-width tinted bar + sub-description line (KB table) */
.zb-status-bar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  width: 100%;
  max-width: 340px;
}
.zb-status-bar--danger { background: hsl(var(--zb-danger) / 0.12); color: hsl(var(--zb-danger)); }
.zb-status-bar--info { background: hsl(var(--zb-info) / 0.12); color: hsl(var(--zb-info)); }
.zb-status-bar--success { background: hsl(var(--zb-success) / 0.12); color: hsl(var(--zb-success)); }
.zb-status-bar__dot { height: 6px; width: 6px; border-radius: 999px; background: currentColor; }
.zb-status-subtext { margin-top: 3px; font-size: 11px; color: hsl(var(--zb-text-muted)); max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- Detail form page (Add/Edit Knowledge Base) ---------------- */

.zb-form-page {
  max-width: 720px;
  margin: auto;
}
.zb-form-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.zb-form-page-title { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
.zb-form-page-desc { margin-top: 4px; font-size: var(--text-sm); color: hsl(var(--zb-text-muted)); }

.zb-field-head { display: flex; align-items: baseline; justify-content: space-between; }
.zb-char-count { font-size: 11px; color: hsl(var(--zb-text-muted)); }
.zb-field-error { margin-top: 4px; font-size: var(--text-xs); color: hsl(var(--zb-danger)); font-weight: 500; }

.zb-status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  border: 1px solid hsl(var(--zb-danger) / 0.25);
  background: hsl(var(--zb-danger) / 0.06);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 20px;
}
.zb-status-banner__left { display: flex; align-items: center; gap: 10px; font-size: var(--text-sm); color: hsl(var(--zb-text-secondary)); }

/* Source-type picker cards (File upload / Raw text / Website URL) */
.zb-source-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 640px) { .zb-source-grid { grid-template-columns: 1fr; } }

.zb-source-card {
  border: 1.5px solid hsl(var(--zb-border));
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: left;
}
.zb-source-card:hover { background: hsl(var(--zb-bg-card-hover)); }
.zb-source-card.is-selected { border-color: hsl(var(--zb-accent)); background: hsl(var(--zb-accent) / 0.06); }
.zb-source-card .zb-icon { width: 18px; height: 18px; color: hsl(var(--zb-text-muted)); margin-bottom: 8px; }
.zb-source-card.is-selected .zb-icon { color: hsl(var(--zb-accent-active)); }
.zb-source-card__title { font-size: var(--text-sm); font-weight: 600; }
.zb-source-card__desc { margin-top: 2px; font-size: 11px; color: hsl(var(--zb-text-muted)); }

.zb-dropzone {
  border: 1.5px dashed hsl(var(--zb-border));
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  text-align: center;
  color: hsl(var(--zb-text-muted));
}
.zb-dropzone .zb-icon { width: 22px; height: 22px; margin: 0 auto 10px; color: hsl(var(--zb-text-muted)); }
.zb-dropzone__title { font-size: var(--text-sm); font-weight: 600; color: hsl(var(--zb-text-primary)); }
.zb-dropzone__desc { margin-top: 4px; font-size: 11px; }

.zb-source-panel { display: none; }
.zb-source-panel.is-active { display: block; }

/* ---------------- Visitors page: stat cards, filter dropdowns ---------------- */

.zb-visitor-stat {
  border-radius: var(--radius-xl);
  border: 1.5px solid hsl(var(--zb-border));
  background: hsl(var(--zb-bg-card));
  padding: 16px;
  text-align: left;
  transition: border-color var(--zb-dur-fast) var(--zb-ease);
}
.zb-visitor-stat:hover { background: hsl(var(--zb-bg-card-hover)); }
.zb-visitor-stat.is-selected { border-color: hsl(var(--zb-accent)); }
.zb-visitor-stat__top { display: flex; align-items: center; justify-content: space-between; }
.zb-visitor-stat__label { font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: hsl(var(--zb-text-muted)); }
.zb-visitor-stat__value { margin-top: 8px; font-size: 26px; font-weight: 700; }
.zb-visitor-stat__desc { margin-top: 6px; font-size: 11px; color: hsl(var(--zb-text-muted)); }

/* Custom dropdown menu (bot/status filters) */
.zb-select-menu { position: relative; }
.zb-select-menu__panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  background: hsl(var(--zb-bg-card));
  border: 1px solid hsl(var(--zb-border));
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity var(--zb-dur-fast) var(--zb-ease), transform var(--zb-dur-fast) var(--zb-ease);
  z-index: 40;
}
.zb-select-menu__panel.is-open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.zb-select-menu__item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; padding: 8px 10px; border-radius: var(--radius-sm);
  font-size: var(--text-sm); white-space: nowrap; text-align: left;
}
.zb-select-menu__item:hover { background: hsl(var(--zb-bg-card-hover)); }
.zb-select-menu__item.is-selected { background: hsl(var(--zb-accent)); color: white; }
.zb-select-menu__item .zb-icon { width: 14px; height: 14px; }

/* ---------------- Grouped dropdown menu (bot detail "..." actions) ---------------- */

.zb-menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 220px;
  background: hsl(var(--zb-bg-card));
  border: 1px solid hsl(var(--zb-border));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity var(--zb-dur-fast) var(--zb-ease), transform var(--zb-dur-fast) var(--zb-ease);
  z-index: 60;
}
.zb-menu-panel.is-open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.zb-menu-panel__group-label {
  padding: 6px 10px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: hsl(var(--zb-text-muted));
}
.zb-menu-panel__divider { height: 1px; background: hsl(var(--zb-border)); margin: 4px 0; }
.zb-menu-panel__item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 7px 10px; border-radius: var(--radius-sm);
  font-size: var(--text-sm); text-align: left;
}
.zb-menu-panel__item:hover { background: hsl(var(--zb-bg-card-hover)); }
.zb-menu-panel__item--danger { color: hsl(var(--zb-danger)); }
.zb-menu-panel__item--danger:hover { background: hsl(var(--zb-danger) / 0.08); }
.zb-menu-panel__item .zb-icon { width: 14px; height: 14px; color: hsl(var(--zb-text-muted)); }
.zb-menu-panel__item--danger .zb-icon { color: hsl(var(--zb-danger)); }

/* ---------------- Bot creation wizard ---------------- */

.zb-wizard-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 20px;
  border-bottom: 1px solid hsl(var(--zb-border));
  background: hsl(var(--zb-bg-card));
}
.zb-wizard-back { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-sm); font-weight: 600; }
.zb-wizard-back .zb-icon { width: 15px; height: 15px; }
.zb-wizard-step-label { font-size: var(--text-xs); color: hsl(var(--zb-text-muted)); font-weight: 500; }

.zb-wizard-body { display: flex; flex: 1; min-height: 0; }
.zb-wizard-sidebar {
  width: 220px;
  flex-shrink: 0;
  padding: 20px 12px;
  border-right: 1px solid hsl(var(--zb-border));
  background: hsl(var(--zb-bg-card-hover));
}
.zb-wizard-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 10px;
  border-radius: var(--radius-lg);
  margin-bottom: 2px;
}
.zb-wizard-step.is-active { background: hsl(var(--zb-accent) / 0.10); }
.zb-wizard-step__badge {
  height: 22px; width: 22px; border-radius: 999px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
  background: hsl(var(--zb-bg-input)); color: hsl(var(--zb-text-muted));
}
.zb-wizard-step.is-active .zb-wizard-step__badge { background: hsl(var(--zb-accent)); color: white; }
.zb-wizard-step.is-done .zb-wizard-step__badge { background: hsl(var(--zb-success)); color: white; }
.zb-wizard-step__title { font-size: var(--text-sm); font-weight: 600; }
.zb-wizard-step:not(.is-active) .zb-wizard-step__title { color: hsl(var(--zb-text-muted)); }
.zb-wizard-step__desc { font-size: 11px; color: hsl(var(--zb-text-muted)); }

.zb-wizard-content { flex: 1; overflow-y: auto; padding: 32px; }
.zb-wizard-content-inner { max-width: 680px; }

.zb-wizard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-top: 1px solid hsl(var(--zb-border));
  background: hsl(var(--zb-bg-card));
}

.zb-wizard-panel { display: none; }
.zb-wizard-panel.is-active { display: block; }

.zb-platform-card {
  border: 1.5px solid hsl(var(--zb-border));
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: left;
}
.zb-platform-card.is-selected { border-color: hsl(var(--zb-accent)); background: hsl(var(--zb-accent) / 0.05); }
.zb-platform-card .zb-icon { width: 20px; height: 20px; color: hsl(var(--zb-accent-active)); margin-bottom: 8px; }
.zb-platform-card__title { font-size: var(--text-sm); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.zb-platform-card__desc { margin-top: 2px; font-size: 11px; color: hsl(var(--zb-text-muted)); }
.zb-platform-card:disabled { opacity: 0.5; cursor: not-allowed; }

.zb-theme-card {
  border: 1.5px solid hsl(var(--zb-border));
  border-radius: var(--radius-lg);
  padding: 12px;
  text-align: left;
}
.zb-theme-card.is-selected { border-color: hsl(var(--zb-accent)); }
.zb-theme-card__preview { height: 60px; border-radius: var(--radius-sm); margin-bottom: 8px; padding: 10px; }
.zb-theme-card__bar { height: 6px; border-radius: 999px; margin-top: 6px; }
.zb-theme-card__title { font-size: var(--text-sm); font-weight: 600; display: flex; align-items: center; gap: 6px; }

.zb-kb-pick-card {
  border: 1px solid hsl(var(--zb-border));
  border-radius: var(--radius-lg);
  padding: 14px;
}
.zb-kb-pick-card .zb-icon { width: 16px; height: 16px; color: hsl(var(--zb-text-muted)); margin-bottom: 8px; }
.zb-kb-pick-card__title { font-size: var(--text-sm); font-weight: 600; }
.zb-kb-pick-card__desc { margin-top: 2px; font-size: 11px; color: hsl(var(--zb-text-muted)); }

/* ---------------- Full-page widget preview ---------------- */

.zb-preview-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 52px;
  padding: 0 16px;
  border-bottom: 1px solid hsl(var(--zb-border));
  background: hsl(var(--zb-bg-card));
}
.zb-preview-topbar__title { font-size: var(--text-sm); font-weight: 700; }
.zb-preview-topbar__spacer { flex: 1; }

.zb-wizard-page { display: flex; flex-direction: column; height: 100%; }

/* ---------------- Responsiveness pass ---------------- */

/* Any card containing a table scrolls horizontally instead of squishing columns */
.zb-card:has(> table.zb-table),
.zb-card:has(> div > table.zb-table) {
  overflow-x: auto;
}

/* visitors.html has its own horizontal-scroll wrapper. Keep the outer card
   overflow-visible so the filter menus are not clipped by the card. */
.zb-card:has(> div > table.zb-table).zb-visitors-table-card {
  overflow-x: visible;
  overflow-y: visible;
}
.zb-table { min-width: 640px; }

@media (max-width: 900px) {
  .zb-detail-layout { grid-template-columns: 1fr; }
  .zb-wizard-sidebar {
    width: auto;
    display: flex;
    overflow-x: auto;
    padding: 12px;
    gap: 4px;
  }
  .zb-wizard-sidebar .zb-wizard-step { flex-shrink: 0; min-width: 160px; }
  .zb-wizard-content { padding: 20px; }
  .zb-wizard-footer { padding: 12px 20px; flex-wrap: wrap; gap: 8px; }
}

@media (max-width: 640px) {
  .zb-page-header { align-items: flex-start; }
  .zb-page-actions { width: 100%; }
  .zb-page-actions .zb-btn { flex: 1; justify-content: center; }
  .zb-table-toolbar { flex-direction: column; align-items: stretch; }
  .zb-table-toolbar > * { width: 100%; }
  .zb-visitor-stat__value { font-size: 22px; }
  .zb-source-grid { grid-template-columns: 1fr; }
  .zb-drawer--wide { width: 100%; max-width: 100%; }
}

@media (max-width: 500px) {
  .zb-preview-topbar { flex-wrap: wrap; height: auto; padding: 10px; gap: 8px; }
  .zb-preview-topbar__title { order: -1; width: 100%; text-align: center; }
}

/* ---------------- Toast notifications ---------------- */

.zb-toast-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}
.zb-toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  background: hsl(var(--zb-bg-sidebar));
  color: white;
  font-size: var(--text-sm);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--zb-dur-fast) var(--zb-ease), transform var(--zb-dur-fast) var(--zb-ease);
}
.zb-toast.is-visible { opacity: 1; transform: translateY(0); }
.zb-toast .zb-icon { width: 15px; height: 15px; color: hsl(var(--zb-accent)); flex-shrink: 0; }

/* ---------------- Collapsible section toggle (Advanced design / custom CSS) ---------------- */

.zb-collapsible-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid hsl(var(--zb-border));
  border-radius: var(--radius-lg);
  background: hsl(var(--zb-bg-card-hover));
  text-align: left;
}
.zb-collapsible-toggle:hover { background: hsl(var(--zb-bg-input)); }
.zb-collapsible-toggle__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm);
  font-weight: 600;
}
.zb-collapsible-toggle #advancedCssChevron,
.zb-collapsible-toggle .zb-icon:last-child {
  color: hsl(var(--zb-text-muted));
  transition: transform var(--zb-dur-fast) var(--zb-ease);
}
.zb-collapsible-toggle.is-open .zb-icon:last-child { transform: rotate(180deg); }

/* ---------------- Chat window style: Modern (default) vs Classic ---------------- */

#previewWidget.is-classic {
  border-radius: var(--radius-sm) !important;
}
#previewWidget.is-classic .zb-msg__bubble {
  border-radius: var(--radius-sm) !important;
  padding: 8px 10px !important;
}
#previewWidget.is-classic #previewSendBtn {
  border-radius: var(--radius-sm) !important;
}
#threadEmpty[hidden] {
    display: none !important;
}
