@import url("https://fonts.googleapis.com/css2?family=PT+Sans:wght@400;700&family=PT+Sans+Caption:wght@400;700&display=swap");

:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --blue: #2f55d4;
  --blue-dark: #2542a6;
  --cyan: #06b6d4;
  --violet: #7c3aed;
  --ink: #101828;
  --muted: #667085;
  --line: #cfdceb;
  --panel: #ffffff;
  --canvas: #edf4fb;
  --soft: #e5eef8;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --shadow: 0 20px 50px rgba(16, 24, 40, 0.105);
  --shadow-soft: 0 12px 26px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  background:
    radial-gradient(circle at top left, rgba(47, 85, 212, 0.09), transparent 30vw),
    radial-gradient(circle at 92% 16%, rgba(6, 182, 212, 0.075), transparent 32vw),
    linear-gradient(135deg, #f4f8ff 0%, #eaf2fa 55%, #f1f8ff 100%);
  color: var(--ink);
  margin: 0;
}

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

button {
  cursor: pointer;
}

.toast-stack {
  display: grid;
  gap: 10px;
  position: fixed;
  right: 22px;
  top: 22px;
  width: min(380px, calc(100vw - 32px));
  z-index: 9999;
}

.app-toast {
  align-items: flex-start;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #dbe6f4;
  border-left: 4px solid #0f82bd;
  border-radius: 12px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.16);
  color: #172033;
  display: flex;
  gap: 10px;
  padding: 13px 14px;
}

.app-toast.danger {
  border-left-color: #dc2626;
}

.app-toast.success {
  border-left-color: #16a34a;
}

.app-toast.warning {
  border-left-color: #d97706;
}

.app-toast p {
  line-height: 1.4;
  margin: 0;
}

.toast-dot {
  background: #0f82bd;
  border-radius: 999px;
  flex: 0 0 auto;
  height: 9px;
  margin-top: 5px;
  width: 9px;
}

.app-toast.danger .toast-dot {
  background: #dc2626;
}

.app-toast.success .toast-dot {
  background: #16a34a;
}

.app-toast.warning .toast-dot {
  background: #d97706;
}

.bot-health-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
}

.bot-health-hero,
.bot-health-table {
  grid-column: span 1;
}

.bot-health-summary {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 14px;
}

.bot-health-summary span,
.bot-signal-list span {
  background: #f7fbff;
  border: 1px solid #dbe6f4;
  border-radius: 12px;
  display: grid;
  gap: 4px;
  padding: 12px;
}

.bot-health-summary span.ok {
  background: #ecfdf3;
  border-color: #b9ebcb;
}

.bot-health-summary span.warning {
  background: #fff8e6;
  border-color: #f4d38a;
}

.bot-health-summary span.danger {
  background: #fff0f0;
  border-color: #f0b6b6;
}

.bot-health-summary strong,
.bot-signal-list strong {
  color: #172033;
  font-size: 1rem;
  font-weight: 650;
}

.bot-health-summary small,
.bot-signal-list small,
.bot-signal-list em {
  color: #64748b;
  font-style: normal;
}

.bot-health-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

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

.bot-signal-list strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bot-diagnostic-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.bot-diagnostic-list button {
  align-items: center;
  background: #fff;
  border: 1px solid #dbe6f4;
  border-radius: 12px;
  color: #172033;
  display: grid;
  gap: 12px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding: 11px 12px;
  text-align: left;
}

.bot-diagnostic-list button.warning {
  background: #fffaf0;
  border-color: #f4d38a;
}

.bot-diagnostic-list button.danger {
  background: #fff6f6;
  border-color: #f0b6b6;
}

.bot-diagnostic-list strong,
.bot-diagnostic-list small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bot-diagnostic-list strong {
  font-weight: 650;
}

.bot-diagnostic-list small,
.bot-diagnostic-list em {
  color: #64748b;
  font-style: normal;
}

@media (max-width: 1100px) {
  .bot-health-grid {
    grid-template-columns: 1fr;
  }

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

.splash,
.login-page {
  align-items: center;
  display: flex;
  min-height: 100vh;
  justify-content: center;
}

.splash {
  flex-direction: column;
  gap: 10px;
}

.brand-mark {
  align-items: center;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  border-radius: 14px;
  box-shadow: 0 14px 30px rgba(49, 87, 255, 0.24);
  color: #fff;
  display: inline-flex;
  height: 52px;
  justify-content: center;
  overflow: hidden;
  width: 52px;
}

.brand-mark img {
  height: 100%;
  object-fit: contain;
  padding: 6px;
  width: 100%;
}

.login-page {
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.28), transparent 24vw),
    radial-gradient(circle at 82% 20%, rgba(6, 182, 212, 0.34), transparent 28vw),
    linear-gradient(135deg, #07111f 0%, #0f2a5f 48%, #113d66 100%);
  padding: 32px;
}

.login-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 24px;
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.32);
  display: grid;
  grid-template-columns: 1.15fr 420px;
  max-width: 1120px;
  min-height: 560px;
  overflow: hidden;
  width: 100%;
}

.login-copy {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(236, 245, 255, 0.55)),
    radial-gradient(circle at 75% 20%, rgba(49, 87, 255, 0.16), transparent 22vw);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 54px;
  position: relative;
  overflow: hidden;
}

.login-orbit {
  height: 260px;
  pointer-events: none;
  position: absolute;
  right: -70px;
  top: -60px;
  width: 260px;
}

.login-orbit span {
  border: 1px solid rgba(49, 87, 255, 0.18);
  border-radius: 999px;
  inset: 0;
  position: absolute;
}

.login-orbit span:nth-child(2) {
  inset: 42px;
}

.login-orbit span:nth-child(3) {
  background: linear-gradient(135deg, rgba(49, 87, 255, 0.13), rgba(6, 182, 212, 0.16));
  inset: 92px;
}

.brand-lockup {
  align-items: center;
  display: flex;
  gap: 14px;
}

.brand-lockup strong {
  display: block;
  font-size: 20px;
}

.brand-lockup small {
  color: var(--muted);
  display: block;
  margin-top: 3px;
}

.brand-lockup.compact .brand-mark {
  border-radius: 10px;
  height: 42px;
  width: 42px;
}

.brand-lockup.compact strong {
  color: var(--ink);
  font-size: 16px;
}

.brand-lockup.compact small {
  color: var(--muted);
}

.login-copy h1 {
  color: #0b1730;
  font-size: 48px;
  letter-spacing: 0;
  line-height: 1.02;
  margin: 46px 0 18px;
  max-width: 620px;
}

.login-copy p {
  color: #4b5872;
  font-size: 18px;
  line-height: 1.6;
  max-width: 650px;
}

.login-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.login-highlights span {
  align-items: center;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(219, 228, 240, 0.88);
  border-radius: 999px;
  display: inline-flex;
  gap: 8px;
  padding: 10px 12px;
  box-shadow: 0 8px 22px rgba(16, 24, 40, 0.06);
}

.login-form {
  background: rgba(255, 255, 255, 0.98);
  border-left: 1px solid rgba(219, 228, 240, 0.88);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 42px;
}

.login-form h2 {
  font-size: 30px;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
}

.login-kicker {
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  text-transform: uppercase;
}

label {
  color: #3b465f;
  display: grid;
  font-size: 14px;
  font-weight: 750;
  gap: 8px;
  margin-bottom: 16px;
}

input,
select,
textarea {
  background: #fbfdff;
  border: 1px solid #d5dfec;
  border-radius: 11px;
  color: var(--ink);
  min-height: 44px;
  padding: 10px 13px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
  outline: none;
}

textarea {
  resize: vertical;
}

.primary-button {
  align-items: center;
  background: linear-gradient(135deg, var(--blue), #2348d7);
  border: 0;
  border-radius: 11px;
  box-shadow: 0 12px 24px rgba(49, 87, 255, 0.22);
  color: #fff;
  display: inline-flex;
  font-weight: 700;
  gap: 8px;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
}

.primary-button:hover {
  background: linear-gradient(135deg, #254beb, var(--blue-dark));
  transform: translateY(-1px);
}

.link-button {
  background: transparent;
  border: 0;
  color: var(--blue);
  cursor: pointer;
  font-weight: 800;
  padding: 8px 0;
  text-align: left;
}

.form-error {
  background: #fff5f5;
  border: 1px solid #fecaca;
  border-radius: 10px;
  color: #b32222;
  padding: 10px;
}

.generated-password {
  background: #f0fff8;
  border: 1px solid #b9efd7;
  border-radius: 6px;
  color: #176342;
  line-height: 1.5;
  padding: 10px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.shell {
  display: grid;
  grid-template-columns: 268px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(18px);
  border-right: 1px solid rgba(219, 228, 240, 0.9);
  box-shadow: 10px 0 34px rgba(16, 24, 40, 0.05);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 22px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar nav {
  display: grid;
  gap: 7px;
}

.sidebar nav a,
.sidebar nav button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 13px;
  color: #475569;
  display: flex;
  gap: 10px;
  font-weight: 750;
  min-height: 44px;
  padding: 11px 13px;
  position: relative;
  text-align: left;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.sidebar nav a:hover,
.sidebar nav button:hover {
  background: #f1f5f9;
  color: var(--ink);
  transform: translateX(2px);
}

.sidebar nav .active,
.sidebar nav button.active {
  background: linear-gradient(135deg, #eef4ff, #f8fbff);
  box-shadow: inset 3px 0 0 var(--blue), 0 10px 22px rgba(49, 87, 255, 0.08);
  color: var(--blue-dark);
}

.sidebar-footer {
  align-items: center;
  background: rgba(248, 251, 255, 0.86);
  border: 1px solid rgba(219, 228, 240, 0.9);
  border-radius: 16px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-top: auto;
  padding: 10px;
}

.profile-trigger {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  flex: 1;
  gap: 10px;
  min-width: 0;
  padding: 0;
  text-align: left;
}

.profile-avatar {
  align-items: center;
  background: linear-gradient(135deg, #e0f2fe, #eef2ff);
  color: var(--blue-dark);
  border-radius: 12px;
  display: inline-flex;
  flex: 0 0 auto;
  height: 34px;
  justify-content: center;
  overflow: hidden;
  width: 34px;
}

.profile-avatar img,
.profile-logo-preview img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.sidebar-footer small {
  color: var(--muted);
  display: block;
}

.sidebar-footer button {
  background: #eef4fb;
  border: 0;
  border-radius: 11px;
  color: #475569;
  height: 38px;
  width: 38px;
}

.sidebar-footer .profile-trigger {
  background: transparent;
  border-radius: 0;
  height: auto;
  width: auto;
}

.sidebar-footer > button:last-child {
  flex: 0 0 auto;
}

.profile-modal {
  background: #fff;
  border-radius: 10px;
  box-sizing: border-box;
  box-shadow: 0 22px 70px rgba(12, 21, 48, 0.28);
  color: #34405b;
  display: grid;
  gap: 16px;
  max-height: calc(100vh - 56px);
  max-width: calc(100vw - 32px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 20px;
  width: min(560px, 94vw);
}

.profile-modal * {
  box-sizing: border-box;
}

.profile-logo-row {
  align-items: center;
  background: #f7f9fd;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 14px;
  min-width: 0;
  padding: 14px;
}

.profile-logo-preview {
  align-items: center;
  background: #eaf0ff;
  border-radius: 14px;
  color: var(--blue);
  display: inline-flex;
  flex: 0 0 auto;
  height: 84px;
  justify-content: center;
  overflow: hidden;
  width: 84px;
}

.profile-logo-row strong,
.profile-logo-row small {
  display: block;
}

.logo-upload {
  cursor: pointer;
  display: inline-flex;
  margin-top: 10px;
  position: relative;
}

.logo-upload input {
  inset: 0;
  opacity: 0;
  position: absolute;
}

.compact-danger {
  margin-left: 8px;
  min-height: 36px;
  padding: 7px 12px;
}

.profile-modal .menu-modal-title {
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding-bottom: 14px;
}

.profile-modal .menu-modal-title > div {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 0;
}

.profile-modal .menu-modal-title span {
  color: #0f172a;
  font-size: 20px;
  font-weight: 760;
}

.profile-modal .menu-modal-title button,
.profile-modal .menu-modal-footer button:not(.primary-button) {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #172033;
  min-height: 38px;
  padding: 8px 12px;
}

.profile-modal label:not(.logo-upload) {
  color: #34405b;
  display: grid;
  font-size: 13px;
  font-weight: 650;
  gap: 7px;
}

.profile-modal input[type="text"],
.profile-modal input[type="password"],
.profile-modal label:not(.logo-upload) input {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #0f172a;
  font-size: 15px;
  min-height: 42px;
  padding: 9px 11px;
  width: 100%;
}

.profile-logo-row > div {
  min-width: 0;
}

.profile-logo-row strong {
  color: #0f172a;
  font-size: 17px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-logo-row small {
  color: #64748b;
  margin-top: 3px;
}

.profile-logo-row .secondary-button,
.profile-logo-row .compact-danger {
  border-radius: 8px;
  font-size: 13px;
  font-weight: 650;
}

.profile-modal .menu-modal-footer {
  align-items: center;
  display: flex;
  justify-content: flex-end;
}

.profile-modal .primary-button {
  border-radius: 8px;
  min-height: 38px;
  padding: 8px 14px;
}

.profile-trigger > span:last-child {
  min-width: 0;
}

.profile-trigger > span:last-child,
.profile-trigger > span:last-child small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .profile-logo-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .compact-danger {
    margin-left: 0;
    margin-top: 8px;
  }
}

.workspace {
  min-width: 0;
  padding: 30px 34px 42px;
}

.topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(219, 228, 240, 0.86);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 22px;
  padding: 18px 20px;
}

.topbar h1 {
  font-size: 31px;
  letter-spacing: -0.025em;
  margin: 0;
}

.topbar p {
  color: var(--muted);
  margin: 6px 0 0;
}

.ghost-button {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: #334155;
  display: inline-flex;
  font-weight: 800;
  gap: 8px;
  min-height: 40px;
  padding: 9px 16px;
}

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

.metric,
.panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(219, 228, 240, 0.9);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.metric {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.94));
  display: grid;
  gap: 9px;
  min-height: 130px;
  padding: 18px;
}

.metric svg {
  color: var(--blue);
}

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

.metric strong {
  font-size: 28px;
  letter-spacing: -0.02em;
}

.metric.green strong {
  color: #12875d;
}

.metric.amber strong {
  color: #b86b00;
}

.admin-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.4fr) minmax(340px, 0.8fr);
}

.admin-metric-grid {
  grid-template-columns: repeat(6, minmax(150px, 1fr));
}

.admin-usage-list,
.admin-alert-list {
  display: grid;
  gap: 10px;
}

.admin-usage-list article,
.admin-alert-list article {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 11px 12px;
}

.admin-alert-list article {
  justify-content: flex-start;
}

.admin-alert-list article.warning {
  background: #fffbeb;
  border-color: #fde68a;
}

.admin-alert-list article.danger {
  background: #fff1f2;
  border-color: #fecdd3;
}

.admin-alert-list article.warning svg {
  color: #b45309;
}

.admin-alert-list article.danger svg {
  color: #be123c;
}

.trial-center-panel {
  margin-bottom: 18px;
}

.trial-center-panel .panel-title {
  align-items: flex-start;
}

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

.trial-center-metrics article {
  background: #f8fbff;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  display: grid;
  gap: 4px;
  padding: 14px;
}

.trial-center-metrics small,
.trial-center-metrics span,
.trial-table small {
  color: var(--muted);
}

.trial-center-metrics strong {
  color: #0f172a;
  font-size: 20px;
  font-weight: 700;
}

.trial-email-test {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(260px, 1fr) auto;
  margin-bottom: 14px;
}

.trial-email-test label {
  color: #334155;
  display: grid;
  gap: 7px;
}

.trial-email-test input {
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 42px;
  padding: 0 12px;
}

.trial-table {
  display: grid;
  gap: 8px;
}

.trial-table header,
.trial-table article {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(210px, 1.3fr) 130px minmax(160px, 0.9fr) 130px minmax(360px, 1.4fr);
}

.trial-table header {
  color: var(--muted);
  font-size: 13px;
  padding: 0 12px;
}

.trial-table article {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px;
}

.trial-table article > div {
  display: grid;
  gap: 4px;
}

.trial-table strong {
  font-weight: 700;
}

.trial-status {
  background: #e0f2fe;
  border-radius: 999px;
  color: #075985;
  display: inline-flex;
  font-size: 12px;
  justify-content: center;
  padding: 6px 10px;
  width: fit-content;
}

.trial-status.active {
  background: #dcfce7;
  color: #166534;
}

.trial-status.pending {
  background: #fef3c7;
  color: #92400e;
}

.trial-status.expired {
  background: #fee2e2;
  color: #991b1b;
}

.trial-status.paused {
  background: #e2e8f0;
  color: #475569;
}

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

.trial-actions button {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #334155;
  min-height: 34px;
  padding: 7px 10px;
}

.trial-actions button:hover {
  background: #f0f9ff;
  border-color: #7dd3fc;
  color: #075985;
}

.trial-store-notice {
  align-items: center;
  border: 1px solid #bae6fd;
  border-radius: 16px;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 13px 16px;
}

.trial-store-notice.active {
  background: #f0f9ff;
  border-color: #bae6fd;
}

.trial-store-notice.demo {
  background: #f5f3ff;
  border-color: #ddd6fe;
}

.trial-store-notice.expired {
  background: #fff7ed;
  border-color: #fed7aa;
}

.trial-store-notice div {
  display: grid;
  gap: 3px;
}

.trial-store-notice strong {
  font-weight: 700;
}

.trial-store-notice span {
  color: var(--muted);
}

.trial-store-notice a {
  background: #1188c9;
  border-radius: 10px;
  color: #fff;
  padding: 10px 14px;
  text-decoration: none;
  white-space: nowrap;
}

@media (max-width: 1280px) {
  .trial-center-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trial-table {
    overflow-x: auto;
  }

  .trial-table header,
  .trial-table article {
    min-width: 980px;
  }
}

.admin-create-account fieldset,
.admin-backup-panel fieldset {
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  display: grid;
  gap: 12px;
  margin: 0 0 14px;
  padding: 14px;
}

.admin-brand-panel {
  align-self: start;
}

.system-logo-editor {
  align-items: center;
  background: #f8fbff;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  display: grid;
  gap: 14px;
  grid-template-columns: auto 1fr;
  padding: 14px;
}

.system-logo-preview {
  align-items: center;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  border-radius: 16px;
  color: #fff;
  display: inline-flex;
  height: 76px;
  justify-content: center;
  overflow: hidden;
  width: 76px;
}

.system-logo-preview img {
  height: 100%;
  object-fit: contain;
  padding: 8px;
  width: 100%;
}

.system-logo-editor strong {
  color: #0f172a;
  display: block;
  font-size: 17px;
}

.system-logo-editor small {
  color: #64748b;
  display: block;
  line-height: 1.45;
  margin-top: 4px;
}

.admin-create-account legend,
.admin-backup-panel legend {
  color: #0f172a;
  font-size: 13px;
  font-weight: 850;
  padding: 0 6px;
}

.backup-hero {
  background: linear-gradient(135deg, #f8fbff, #eef6ff);
  border: 1px solid #dbeafe;
  border-radius: 14px;
  display: grid;
  gap: 6px;
  padding: 14px;
}

.backup-hero strong {
  color: #0f172a;
  font-size: 15px;
}

.backup-hero small {
  color: #64748b;
  line-height: 1.45;
}

.backup-control-panel {
  grid-column: 1 / -1;
}

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

.backup-action-grid article {
  background: linear-gradient(135deg, #f8fbff, #eef6ff);
  border: 1px solid #dbeafe;
  border-radius: 14px;
  display: grid;
  gap: 10px;
  padding: 14px;
}

.backup-action-grid strong {
  color: #0f172a;
  font-size: 15px;
}

.backup-action-grid small {
  color: #64748b;
  line-height: 1.45;
}

.onedrive-connect-box {
  align-items: center;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid #dbeafe;
  border-radius: 14px;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 14px;
}

.onedrive-connect-box > div:first-child {
  display: grid;
  gap: 4px;
}

.onedrive-connect-box small {
  color: #64748b;
}

.compact-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 0;
}

.backup-health-panel {
  grid-column: 1 / -1;
}

.backup-health-panel.compact {
  grid-column: auto;
}

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

.backup-health-card {
  align-items: flex-start;
  background: #f8fbff;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  display: flex;
  gap: 10px;
  padding: 14px;
}

.backup-health-card.warning {
  background: #fffaf0;
  border-color: #fde68a;
}

.backup-health-card small,
.backup-health-card em {
  color: #64748b;
  display: block;
  font-style: normal;
  line-height: 1.35;
}

.backup-health-card strong {
  color: #0f172a;
  display: block;
  font-size: 18px;
  margin: 2px 0;
}

.backup-health-card p {
  color: #475569;
  line-height: 1.4;
  margin: 0 0 6px;
}

.backup-folder-row {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-top: 12px;
  padding: 10px 12px;
}

.backup-folder-row span {
  color: #64748b;
  font-size: 13px;
}

.backup-folder-row code {
  background: transparent;
  color: #334155;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.backup-cloud-panel {
  align-self: start;
}

.backup-cloud-actions {
  justify-content: flex-start;
}

.backup-cloud-summary {
  align-items: stretch;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(150px, 0.6fr) minmax(220px, 1fr) auto;
  margin-top: 12px;
}

.backup-cloud-summary span {
  background: #f8fbff;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  display: grid;
  gap: 3px;
  padding: 10px 12px;
}

.backup-cloud-summary small,
.backup-size small,
.restore-selected-card small {
  color: #64748b;
  font-size: 12px;
}

.backup-cloud-summary strong,
.backup-size strong,
.restore-selected-card strong {
  color: #0f172a;
  font-size: 14px;
  font-weight: 700;
}

.backup-cloud-summary code {
  background: transparent;
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.backup-file-card {
  align-items: center;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  display: grid;
  gap: 10px;
  grid-template-columns: auto 1fr auto;
  padding: 11px 12px;
}

.backup-file-card strong {
  color: #0f172a;
  display: block;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.backup-file-card small {
  color: #64748b;
  display: block;
  line-height: 1.35;
  margin-top: 3px;
}

.backup-pill {
  background: #eef2ff;
  border-radius: 999px;
  color: #475569;
  font-size: 12px;
  padding: 7px 10px;
}

.backup-history-panel {
  grid-column: 1 / -1;
}

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

.backup-history-row {
  align-items: center;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  display: grid;
  gap: 12px;
  grid-template-columns: auto minmax(260px, 1fr) auto auto minmax(110px, auto) auto;
  padding: 12px;
}

.backup-history-row > div {
  min-width: 0;
}

.backup-history-row strong {
  color: #0f172a;
  display: block;
  font-size: 14px;
  font-weight: 700;
}

.backup-history-row small {
  color: #64748b;
  display: block;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.backup-size {
  display: grid;
  gap: 2px;
}

.backup-size em {
  color: #94a3b8;
  font-size: 11px;
  font-style: normal;
}

.backup-status {
  border-radius: 999px;
  font-size: 12px;
  padding: 7px 10px;
}

.backup-status.ok {
  background: #dcfce7;
  color: #15803d;
}

.backup-status.warning {
  background: #fff7ed;
  color: #c2410c;
}

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

.restore-source-toggle .check-row {
  background: #f8fbff;
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  padding: 12px;
}

.restore-selected-card {
  background: #f8fbff;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 12px;
}

.restore-selected-card span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.restore-selected-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-link {
  min-height: auto;
  padding: 8px 12px;
}

@media (max-width: 980px) {
  .backup-action-grid,
  .backup-cloud-summary,
  .backup-history-row,
  .restore-source-toggle,
  .restore-selected-card {
    grid-template-columns: 1fr;
  }

  .backup-health-grid {
    grid-template-columns: 1fr;
  }

  .backup-folder-row,
  .backup-file-card {
    align-items: flex-start;
    grid-template-columns: 1fr;
  }

  .backup-folder-row {
    flex-direction: column;
  }
}

.wa-connect-modal-backdrop {
  align-items: center;
  background: rgba(15, 23, 42, 0.48);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 22px;
  position: fixed;
  z-index: 1200;
}

.wa-connect-modal {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 28px 90px rgba(15, 23, 42, 0.28);
  color: #172033;
  max-height: min(780px, calc(100vh - 44px));
  max-width: 860px;
  overflow: hidden;
  position: relative;
  width: min(860px, 100%);
}

.wa-connect-close {
  align-items: center;
  background: #f5f7fb;
  border: 1px solid #d8e1ee;
  border-radius: 999px;
  color: #526071;
  display: inline-flex;
  font-size: 24px;
  height: 36px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  position: absolute;
  right: 18px;
  top: 18px;
  width: 36px;
  z-index: 1;
}

.wa-connect-header {
  padding: 30px 34px 18px;
  text-align: center;
}

.wa-connect-header h2 {
  color: #172033;
  font-size: 25px;
  margin: 0;
}

.wa-connect-header p {
  color: #6b778a;
  margin: 8px auto 0;
  max-width: 620px;
}

.wa-connect-content {
  display: grid;
  gap: 26px;
  grid-template-columns: minmax(0, 1.08fr) minmax(280px, 0.92fr);
  padding: 8px 34px 24px;
}

.wa-connect-help-card,
.wa-connect-qr-card {
  background: #ffffff;
  border: 1px solid #e1e7f0;
  border-radius: 10px;
}

.wa-connect-help-card {
  min-height: 370px;
  padding: 22px 24px;
}

.wa-connect-tabs {
  border-bottom: 1px solid #e5eaf2;
  display: flex;
  gap: 22px;
  margin-bottom: 24px;
}

.wa-connect-tabs button {
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  color: #69758a;
  font-weight: 650;
  padding: 0 0 13px;
}

.wa-connect-tabs button.active {
  border-color: #2474e9;
  color: #172033;
}

.wa-connect-steps,
.wa-connect-tips {
  display: grid;
  gap: 20px;
  margin: 0;
  padding-left: 22px;
}

.wa-connect-steps li,
.wa-connect-tips li {
  color: #243044;
  line-height: 1.48;
}

.wa-connect-steps strong {
  display: block;
  font-weight: 650;
}

.wa-connect-steps span {
  color: #677386;
  display: block;
  margin-top: 5px;
}

.wa-connect-safe-link,
.wa-connect-muted-link {
  align-items: center;
  background: transparent;
  border: 0;
  color: #2474e9;
  display: inline-flex;
  gap: 7px;
  margin-top: 24px;
  padding: 0;
}

.wa-connect-qr-card {
  align-items: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 370px;
  padding: 26px;
  text-align: center;
}

.wa-connect-qr-frame {
  align-items: center;
  background: #f7f9fc;
  border: 1px dashed #cbd7e8;
  border-radius: 14px;
  display: flex;
  height: 238px;
  justify-content: center;
  margin-bottom: 18px;
  width: 238px;
}

.wa-connect-qr-frame img {
  border-radius: 10px;
  display: block;
  height: 218px;
  width: 218px;
}

.wa-connect-qr-frame.connected {
  background: #effcf5;
  border-color: #9ce7be;
}

.wa-connect-qr-frame.warning {
  background: #fffaf0;
  border-color: #f7d38a;
}

.wa-connect-qr-frame.offline {
  background: #fff5f5;
  border-color: #fecaca;
}

.wa-connect-qr-card > strong {
  color: #172033;
  font-size: 18px;
  font-weight: 650;
}

.wa-connect-qr-card > span {
  color: #677386;
  margin-top: 7px;
}

.wa-connect-footer {
  align-items: center;
  border-top: 1px solid #e5eaf2;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 18px 34px 22px;
}

.wa-connect-footer span {
  color: #6b778a;
  display: block;
}

.wa-connect-footer strong {
  color: #172033;
  display: block;
  font-weight: 650;
  margin-top: 2px;
}

.wa-connect-footer-actions {
  display: flex;
  gap: 12px;
}

.wa-connect-footer-actions button {
  background: #ffffff;
  border: 1px solid #cfd9e8;
  border-radius: 999px;
  color: #243044;
  min-height: 42px;
  padding: 10px 20px;
}

.wa-connect-footer-actions button:hover {
  background: #f6f9ff;
  border-color: #2474e9;
}

.wa-connect-progress {
  background: #e5eaf2;
  height: 5px;
  overflow: hidden;
}

.wa-connect-progress span {
  background: #f4bf45;
  display: block;
  height: 100%;
  width: 28%;
}

html[data-theme="dark"] .wa-connect-modal {
  background: #102b3e;
  color: #edf6ff;
}

html[data-theme="dark"] .wa-connect-header h2,
html[data-theme="dark"] .wa-connect-tabs button.active,
html[data-theme="dark"] .wa-connect-steps li,
html[data-theme="dark"] .wa-connect-tips li,
html[data-theme="dark"] .wa-connect-qr-card > strong,
html[data-theme="dark"] .wa-connect-footer strong {
  color: #f3f8ff;
}

html[data-theme="dark"] .wa-connect-header p,
html[data-theme="dark"] .wa-connect-steps span,
html[data-theme="dark"] .wa-connect-qr-card > span,
html[data-theme="dark"] .wa-connect-footer span {
  color: #9db2c5;
}

html[data-theme="dark"] .wa-connect-help-card,
html[data-theme="dark"] .wa-connect-qr-card,
html[data-theme="dark"] .wa-connect-footer,
html[data-theme="dark"] .wa-connect-tabs {
  background: #12293b;
  border-color: rgba(133, 178, 214, 0.2);
}

html[data-theme="dark"] .wa-connect-close,
html[data-theme="dark"] .wa-connect-footer-actions button {
  background: #15354a;
  border-color: #385b76;
  color: #eaf4ff;
}

html[data-theme="dark"] .wa-connect-qr-frame {
  background: #0d2130;
  border-color: #31506a;
}

@media (max-width: 760px) {
  .wa-connect-modal-backdrop {
    align-items: flex-start;
    padding: 12px;
  }

  .wa-connect-modal {
    max-height: calc(100vh - 24px);
    overflow-y: auto;
  }

  .wa-connect-header,
  .wa-connect-content,
  .wa-connect-footer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .wa-connect-content {
    grid-template-columns: 1fr;
  }

  .wa-connect-footer,
  .wa-connect-footer-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

.restore-panel {
  border-color: #fecdd3;
}

.restore-panel .panel-title span {
  color: #be123c;
}

.restore-progress-modal {
  background: #ffffff;
  border: 1px solid #dbe4f0;
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.18);
  max-width: 560px;
  overflow: hidden;
  width: min(92vw, 560px);
}

.restore-progress-body {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.restore-progress-bar {
  background: #e2e8f0;
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
}

.restore-progress-bar span {
  background: linear-gradient(90deg, #0ea5e9, #22c55e);
  display: block;
  height: 100%;
  transition: width 0.35s ease;
}

.restore-progress-modal.is-error .restore-progress-bar span {
  background: #ef4444;
}

.restore-progress-body p {
  color: #52627a;
  margin: 0;
}

.restore-progress-body ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
}

.restore-progress-body li {
  color: #64748b;
}

.restore-progress-body li.done {
  color: #0f766e;
}

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

.migration-hero {
  align-items: flex-start;
  background: #f8fbff;
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  display: flex;
  gap: 12px;
  padding: 16px;
}

.migration-hero svg {
  color: #0f82bd;
  flex: 0 0 auto;
}

.migration-hero strong {
  display: block;
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 4px;
}

.migration-hero small {
  color: #64748b;
  line-height: 1.45;
}

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

.database-status-grid article {
  background: #f8fbff;
  border: 1px solid #dbe4f0;
  border-radius: 10px;
  display: grid;
  gap: 4px;
  padding: 13px;
}

.database-status-grid small {
  color: #66758c;
  font-size: 12px;
}

.database-status-grid span {
  color: #162033;
  font-weight: 500;
  overflow-wrap: anywhere;
}

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

.database-latest-grid article {
  background: #ffffff;
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  padding: 14px;
}

.database-latest-grid h3 {
  color: #162033;
  font-size: 15px;
  font-weight: 650;
  margin: 0 0 10px;
}

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

.database-latest-list span {
  background: #f8fbff;
  border: 1px solid #e4edf7;
  border-radius: 10px;
  display: grid;
  gap: 3px;
  padding: 9px 10px;
}

.database-latest-list b {
  color: #1f2d3d;
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.database-latest-list small,
.database-latest-list em {
  color: #66758c;
  font-size: 12px;
  font-style: normal;
  overflow-wrap: anywhere;
}

.database-comparison-panel {
  background: #ffffff;
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  display: grid;
  gap: 14px;
  margin-top: 12px;
  padding: 16px;
}

.database-comparison-panel.ok {
  border-color: #a7e5bd;
}

.database-comparison-panel.warning {
  border-color: #ffd58c;
}

.database-comparison-panel > div:first-child {
  display: grid;
  gap: 3px;
}

.database-comparison-panel strong {
  color: #162033;
  font-size: 15px;
  font-weight: 650;
}

.database-comparison-panel small {
  color: #66758c;
  font-size: 12px;
}

.database-comparison-table {
  border: 1px solid #e4edf7;
  border-radius: 12px;
  display: grid;
  grid-template-columns: minmax(140px, 1.4fr) repeat(4, minmax(80px, 0.8fr));
  overflow: hidden;
}

.database-comparison-table > * {
  align-items: center;
  border-bottom: 1px solid #e4edf7;
  color: #334155;
  display: flex;
  min-height: 38px;
  padding: 8px 10px;
}

.database-comparison-table > span {
  background: #f6f9fd;
  color: #64748b;
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
}

.database-comparison-table b {
  font-size: 13px;
  font-weight: 600;
}

.database-comparison-table small {
  color: #334155;
  font-size: 13px;
}

.database-comparison-table em {
  border-radius: 999px;
  font-size: 12px;
  font-style: normal;
  font-weight: 650;
  justify-content: center;
  margin: 8px 10px;
  min-height: auto;
  padding: 5px 9px;
}

.database-comparison-table em.ok {
  background: #dcfce7;
  color: #15803d;
}

.database-comparison-table em.warning {
  background: #fef3c7;
  color: #a16207;
}

.database-comparison-table > *:nth-last-child(-n + 5) {
  border-bottom: 0;
}

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

.database-diff-details article {
  background: #fffdf5;
  border: 1px solid #fde3a7;
  border-radius: 12px;
  display: grid;
  gap: 8px;
  padding: 12px;
}

.database-diff-details code {
  background: #ffffff;
  border: 1px solid #f3d697;
  border-radius: 8px;
  color: #6b4f08;
  font-size: 12px;
  overflow-wrap: anywhere;
  padding: 7px 8px;
}

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

.migration-grid article {
  background: #ffffff;
  border: 1px solid #dbe4f0;
  border-radius: 10px;
  padding: 14px;
}

.migration-grid h3 {
  font-size: 15px;
  font-weight: 500;
  margin: 0 0 10px;
}

.migration-grid ul {
  color: #475569;
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
}

.migration-checklist {
  display: grid;
  gap: 8px;
}

.migration-checklist span {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  color: #334155;
  display: flex;
  gap: 10px;
  padding: 9px 10px;
}

.migration-checklist b {
  align-items: center;
  background: #e0f2fe;
  border-radius: 999px;
  color: #0369a1;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 500;
  height: 24px;
  justify-content: center;
  width: 24px;
}

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

.migration-row .secondary-button {
  min-height: 36px;
}

.system-tabs-panel {
  grid-column: 1 / -1;
  padding: 12px;
}

.segmented-tabs {
  background: #edf3f9;
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  display: inline-flex;
  gap: 4px;
  padding: 4px;
}

.segmented-tabs button {
  background: transparent;
  border: 0;
  border-radius: 10px;
  color: #526070;
  font-weight: 500;
  padding: 10px 14px;
}

.segmented-tabs button.active {
  background: #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  color: #0f172a;
}

.plans-panel {
  grid-column: 1 / -1;
}

.plans-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.plan-config-card {
  background: #f8fbff;
  border: 1px solid #dbe4f0;
  border-radius: 16px;
  display: grid;
  gap: 12px;
  padding: 14px;
}

.plan-card-head,
.plan-limits-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.plan-limits-grid {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.plan-feature-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.generated-password {
  align-items: center;
  border-radius: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.whatsapp-settings-grid {
  align-items: start;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.whatsapp-settings-layout {
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.85fr);
}

.whatsapp-connection-panel {
  grid-column: 1 / -1;
}

.whatsapp-sessions-panel {
  grid-column: 1 / -1;
}

.whatsapp-runtime-panel {
  align-self: start;
  grid-column: 1;
  grid-row: 2 / span 8;
}

.whatsapp-settings-layout.whatsapp-connection-mode {
  display: none;
}

.whatsapp-settings-layout.whatsapp-connection-mode .wordpress-connector-panel,
.whatsapp-settings-layout.whatsapp-connection-mode .response-behavior-panel,
.whatsapp-settings-layout.whatsapp-connection-mode .sandbox-settings-panel,
.whatsapp-settings-layout.whatsapp-connection-mode .alias-panel,
.whatsapp-settings-layout.whatsapp-connection-mode .debug-panel,
.whatsapp-settings-layout.whatsapp-connection-mode .send-test-form,
.whatsapp-settings-layout.whatsapp-connection-mode .whatsapp-audit-list,
.whatsapp-settings-layout.whatsapp-connection-mode .whatsapp-runtime-panel > .debug-box {
  display: none;
}

.whatsapp-settings-layout.whatsapp-connection-mode .whatsapp-runtime-panel {
  grid-column: 1 / -1;
}

.whatsapp-settings-layout .wordpress-connector-panel,
.whatsapp-settings-layout .response-behavior-panel,
.whatsapp-settings-layout .sandbox-settings-panel,
.whatsapp-settings-layout .alias-panel {
  align-self: start;
  grid-column: 2;
}

.response-behavior-panel {
  align-self: start;
  height: auto;
  min-height: 0;
}

.response-behavior-panel .hint-text,
.sandbox-settings-panel .hint-text {
  margin: 0;
}

.wordpress-connector-panel {
  align-self: start;
  display: grid;
  gap: 14px;
  min-height: 0;
  padding: 18px;
}

.wordpress-connector-grid {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(260px, 1fr) minmax(220px, 0.75fr);
}

.wordpress-connector-grid label {
  display: grid;
  gap: 7px;
  margin: 0;
}

.wordpress-connector-grid input,
.compact-token {
  min-height: 42px;
}

.compact-token {
  align-items: center;
  display: flex;
  overflow: hidden;
  white-space: nowrap;
}

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

  .whatsapp-runtime-panel,
  .whatsapp-settings-layout .wordpress-connector-panel,
  .whatsapp-settings-layout .response-behavior-panel,
  .whatsapp-settings-layout .sandbox-settings-panel,
  .whatsapp-settings-layout .alias-panel {
    grid-column: 1;
    grid-row: auto;
  }
}
.users-panel {
  margin-top: 18px;
}

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

.documentation-index {
  position: sticky;
  top: 20px;
}

.documentation-search {
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  padding: 0 12px;
}

.documentation-search input {
  background: transparent;
  border: 0;
  box-shadow: none;
  flex: 1;
  min-height: 42px;
  padding: 0;
}

.documentation-search input:focus {
  box-shadow: none;
  outline: 0;
}

.documentation-index a {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #35405a;
  display: flex;
  gap: 8px;
  padding: 10px 8px;
  text-decoration: none;
}

.documentation-menu-group {
  border-bottom: 1px solid #edf2f7;
  padding: 4px 0 8px;
}

.documentation-menu-group + .documentation-menu-group {
  margin-top: 4px;
}

.documentation-menu-main {
  font-weight: 680;
}

.documentation-submenu {
  display: grid;
  gap: 2px;
  margin: 0 0 0 23px;
  padding: 0 0 2px;
}

.documentation-submenu a {
  color: #68758e;
  font-size: 13px;
  line-height: 1.25;
  padding: 6px 8px;
}

.documentation-submenu a:hover {
  background: #f8fafc;
  color: #1088c4;
}

.documentation-index a:hover {
  background: #f4f7ff;
  border-color: var(--line);
  color: var(--blue);
}

.documentation-content {
  display: grid;
  gap: 14px;
}

.documentation-section h2 {
  font-size: 20px;
  margin: 0 0 12px;
}

.documentation-summary {
  color: #63708a;
  line-height: 1.55;
  margin: -4px 0 18px;
}

.doc-subsection {
  border-top: 1px solid #eef2f7;
  scroll-margin-top: 18px;
  padding: 16px 0 0;
}

.doc-subsection + .doc-subsection,
.doc-paragraph + .doc-subsection,
.doc-subsection + .doc-paragraph {
  margin-top: 16px;
}

.doc-subsection h3 {
  color: #102044;
  font-size: 16px;
  margin: 0 0 8px;
}

.doc-subsection p,
.doc-paragraph,
.doc-empty p {
  color: #35405a;
  line-height: 1.65;
  margin: 0;
}

.documentation-section ul {
  color: #35405a;
  line-height: 1.65;
  margin: 0;
  padding-left: 22px;
}

.documentation-section li + li {
  margin-top: 8px;
}

.doc-visual {
  background: linear-gradient(135deg, #f8fbff, #eef9f6);
  border: 1px solid #d9e6f2;
  border-radius: 12px;
  margin: 16px 0 0;
  overflow: hidden;
}

.doc-visual figcaption {
  align-items: center;
  color: #172033;
  display: flex;
  font-weight: 680;
  justify-content: space-between;
  padding: 13px 16px;
}

.doc-visual figcaption span {
  color: #72809b;
  font-size: 13px;
  font-weight: 500;
}

.doc-visual-screen {
  background: #fff;
  border-top: 1px solid #dfe8f1;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  min-height: 210px;
}

.doc-visual-sidebar {
  background: linear-gradient(180deg, #edf5ff, #e8fbf3);
  border-right: 1px solid #dfe8f1;
  display: grid;
  gap: 10px;
  place-content: center;
}

.doc-visual-sidebar span {
  background: #d3e3f5;
  border-radius: 999px;
  display: block;
  height: 12px;
  width: 36px;
}

.doc-visual-sidebar span:first-child {
  background: #1088c4;
}

.doc-visual-main {
  align-items: center;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr);
  padding: 22px;
}

.doc-visual.has-phone .doc-visual-main {
  grid-template-columns: 190px minmax(0, 1fr);
}

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

.doc-visual-grid span {
  background: #f6f9fc;
  border: 1px solid #dce7f2;
  border-radius: 10px;
  color: #26344d;
  min-height: 58px;
  padding: 14px;
}

.doc-phone-preview {
  background: #eef4fb;
  border: 1px solid #d6e2ee;
  border-radius: 28px;
  display: grid;
  gap: 10px;
  min-height: 250px;
  padding: 22px 14px 16px;
}

.doc-phone-top {
  background: #172033;
  border-radius: 999px;
  height: 6px;
  margin: 0 auto 8px;
  width: 56px;
}

.doc-phone-bubble {
  align-self: start;
  background: #fff;
  border-radius: 10px;
  color: #26344d;
  font-size: 13px;
  line-height: 1.45;
  padding: 10px;
}

.doc-phone-bubble.alt {
  background: #dcfce7;
}

.doc-visual > small {
  color: #72809b;
  display: block;
  padding: 10px 16px 13px;
}

.panel {
  padding: 20px;
}

.panel-title {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel-title h2 {
  font-size: 19px;
  letter-spacing: -0.01em;
  margin: 0;
}

.panel-title span {
  color: var(--muted);
  font-size: 13px;
}

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

.row-card,
.conversation-card {
  align-items: center;
  background: linear-gradient(180deg, #fbfdff, #f7faff);
  border: 1px solid rgba(219, 228, 240, 0.9);
  border-radius: 14px;
  display: grid;
  gap: 12px;
  grid-template-columns: auto 1fr auto;
  padding: 14px;
}

.row-card small,
.conversation-card small {
  color: var(--muted);
  display: block;
  margin-top: 3px;
}

.status-dot {
  border-radius: 999px;
  height: 10px;
  width: 10px;
}

.status-dot.active {
  background: #16a36f;
}

code,
.token-box {
  background: #eef2ff;
  border-radius: 5px;
  color: #1f3a9f;
  display: inline-block;
  padding: 7px 9px;
  word-break: break-all;
}

.form-panel .primary-button {
  width: 100%;
}

.roadmap {
  display: grid;
  gap: 12px;
}

.roadmap span {
  align-items: center;
  display: flex;
  gap: 10px;
}

.dashboard-tabs {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(219, 228, 240, 0.9);
  border-radius: 14px;
  display: inline-flex;
  gap: 4px;
  margin: -4px 0 18px;
  padding: 4px;
}

.dashboard-tabs button {
  background: transparent;
  border: 0;
  border-radius: 11px;
  color: #64748b;
  font-weight: 700;
  min-height: 38px;
  padding: 8px 14px;
  position: relative;
}

.dashboard-tabs button.active {
  background: linear-gradient(135deg, var(--blue), #2348d7);
  box-shadow: 0 10px 20px rgba(49, 87, 255, 0.18);
  color: #fff;
}

.dashboard-metrics {
  display: grid;
  gap: 14px;
  grid-template-columns: 1.35fr repeat(5, minmax(118px, 1fr));
  margin-bottom: 14px;
}

.ai-cost-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(219, 228, 240, 0.9);
  border-radius: 18px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
  margin: 0 0 14px;
  padding: 14px 16px;
}

.ai-cost-head {
  align-items: center;
  display: flex;
  gap: 12px;
}

.ai-cost-head strong {
  color: #172042;
  display: block;
  font-size: 16px;
}

.ai-cost-head small,
.ai-cost-values small,
.ai-cost-foot {
  color: var(--muted);
  font-size: 13px;
}

.ai-cost-values {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
}

.ai-cost-values span {
  background: #f8fbff;
  border: 1px solid #e4ebf8;
  border-radius: 12px;
  padding: 9px 10px;
}

.ai-cost-values b {
  color: #172042;
  display: block;
  font-size: 16px;
  margin-top: 3px;
}

.ai-cost-foot {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.ai-cost-foot button {
  background: transparent;
  border: 0;
  color: var(--blue);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 0;
}

.welcome-card,
.kpi-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(219, 228, 240, 0.9);
  border-radius: 18px;
  box-shadow: var(--shadow);
  min-height: 150px;
}

.welcome-card {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 18px;
}

.welcome-card strong {
  display: block;
  font-size: 17px;
  margin-bottom: 18px;
}

.welcome-card p {
  color: #58637b;
  font-size: 16px;
  line-height: 1.45;
  margin: 0;
}

.welcome-card b {
  color: var(--blue);
}

.avatar-ring {
  align-items: center;
  border: 4px solid #5a5b74;
  border-radius: 999px;
  color: #5a5b74;
  display: inline-flex;
  flex: 0 0 auto;
  height: 88px;
  justify-content: center;
  width: 88px;
}

.kpi-card {
  align-items: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.94));
  border: 1px solid rgba(219, 228, 240, 0.9);
  display: grid;
  justify-items: center;
  padding: 15px 12px;
  text-align: center;
}

.kpi-card.clickable {
  cursor: pointer;
  font: inherit;
}

.kpi-card.clickable:hover {
  box-shadow: 0 12px 26px rgba(22, 33, 62, .12);
  transform: translateY(-1px);
}

.kpi-card strong {
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.kpi-card small {
  color: #68718a;
  line-height: 1.25;
}

.kpi-icon {
  align-items: center;
  background: linear-gradient(135deg, #eef2ff, #e0f2fe);
  border-radius: 16px;
  color: var(--blue);
  display: inline-flex;
  height: 52px;
  justify-content: center;
  width: 52px;
}

.kpi-icon.cyan {
  background: #dff8fa;
  color: #1b9dac;
}

.kpi-icon.orange {
  background: #fff1df;
  color: #df8428;
}

.kpi-icon.red {
  background: #ffe7e7;
  color: #d95a5a;
}

.kpi-icon.green {
  background: #ddf9e8;
  color: #19a969;
}

.kpi-icon.yellow {
  background: #fff3bd;
  color: #d69d00;
}

.dashboard-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 330px 1fr;
}

.smart-kpis {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  margin-bottom: 14px;
}

.section-subnav {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(219, 228, 240, 0.9);
  border-radius: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 14px;
  padding: 5px;
}

.section-subnav button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 12px;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  gap: 8px;
  min-height: 42px;
  padding: 10px 14px;
}

.section-subnav button.active {
  background: linear-gradient(135deg, var(--blue), #2348d7);
  box-shadow: 0 10px 20px rgba(49, 87, 255, 0.16);
  color: #fff;
}

.smart-dashboard-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
}

.smart-dashboard {
  display: grid;
  gap: 14px;
}

.smart-commerce-hero {
  align-items: center;
  border-left: 4px solid #22c55e;
  display: flex;
  gap: 18px;
  justify-content: space-between;
}

.smart-commerce-hero.warning {
  border-left-color: #f59e0b;
}

.smart-commerce-hero.danger {
  border-left-color: #ef4444;
}

.smart-commerce-hero h2 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0;
  margin: 4px 0 6px;
}

.smart-commerce-hero p {
  color: #64748b;
  margin: 0;
}

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

.smart-kpis-expanded {
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  margin-bottom: 0;
}

.smart-dashboard-grid-rich {
  align-items: stretch;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.smart-dashboard-grid-rich.lower {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.smart-dashboard-card {
  min-width: 0;
}

.smart-status-list.compact span {
  align-items: center;
  padding: 10px 12px;
}

.smart-status-list.compact b {
  font-weight: 400;
}

.smart-funnel {
  display: grid;
  gap: 12px;
}

.smart-funnel div {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: 120px minmax(0, 1fr) 42px;
}

.smart-funnel span {
  color: #526078;
  font-size: 13px;
}

.smart-funnel i {
  background: #dbeafe;
  border-radius: 999px;
  display: block;
  height: 9px;
  min-width: 6px;
}

.smart-funnel i.green {
  background: #86efac;
}

.smart-funnel i.orange {
  background: #fed7aa;
}

.smart-funnel i.yellow {
  background: #fde68a;
}

.smart-funnel i.slate {
  background: #cbd5e1;
}

.smart-funnel i.red {
  background: #fecaca;
}

.smart-funnel em {
  color: #172033;
  font-style: normal;
  text-align: right;
}

.smart-mini-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 10px;
}

.smart-mini-grid span {
  background: #f8fbff;
  border: 1px solid #e6edf5;
  border-radius: 12px;
  padding: 11px;
}

.smart-mini-grid strong,
.smart-mini-grid small {
  display: block;
}

.smart-mini-grid strong {
  color: #111827;
  font-size: 22px;
  font-weight: 600;
}

.smart-mini-grid small {
  color: #64748b;
  font-size: 12px;
  margin-top: 4px;
}

.meta-optin-card {
  border-color: #c7e2ff;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}

.meta-optin-flow {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}

.meta-optin-flow span {
  align-items: center;
  background: #f8fbff;
  border: 1px solid #e1edf8;
  border-radius: 10px;
  color: #334155;
  display: flex;
  font-size: 13px;
  line-height: 1.35;
  min-height: 38px;
  padding: 9px 11px;
}

.meta-optin-page {
  gap: 14px;
}

.meta-optin-explain {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.meta-optin-explain strong {
  color: #172033;
  display: block;
  font-weight: 550;
  margin-bottom: 6px;
}

.meta-optin-explain p {
  color: #526078;
  line-height: 1.55;
  margin: 0;
}

.meta-optin-list {
  display: grid;
  gap: 12px;
}

.meta-optin-row {
  align-items: stretch;
  background: #ffffff;
  border: 1px solid #dbe6f2;
  border-left: 4px solid #f59e0b;
  border-radius: 14px;
  display: grid;
  gap: 14px;
  grid-template-columns: 160px minmax(0, 1fr) 240px;
  padding: 14px;
}

.meta-optin-row.active {
  border-left-color: #22c55e;
}

.meta-optin-status,
.meta-optin-main,
.meta-optin-actions {
  min-width: 0;
}

.meta-optin-status {
  display: grid;
  gap: 8px;
  align-content: start;
}

.meta-optin-status small,
.meta-optin-main small {
  color: #64748b;
}

.meta-optin-main strong {
  color: #172033;
  display: block;
  font-weight: 550;
}

.meta-optin-main span {
  color: #526078;
  display: block;
  font-size: 13px;
  margin-top: 3px;
}

.meta-optin-main p {
  color: #334155;
  line-height: 1.45;
  margin: 8px 0;
  overflow-wrap: anywhere;
}

.meta-optin-actions {
  align-content: start;
  display: grid;
  gap: 10px;
}

.meta-optin-actions select,
.meta-optin-actions button {
  width: 100%;
}

.smart-queue-preview,
.smart-ranking {
  display: grid;
  gap: 8px;
}

.smart-queue-preview button,
.smart-ranking span {
  background: #f8fbff;
  border: 1px solid #e6edf5;
  border-radius: 12px;
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 10px 11px;
  text-align: left;
}

.smart-queue-preview button {
  cursor: pointer;
}

.smart-queue-preview button:hover {
  border-color: #b6c7dd;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.smart-queue-preview span,
.smart-ranking small {
  color: #172033;
  font-weight: 500;
  line-height: 1.25;
}

.smart-queue-preview small,
.smart-ranking em {
  color: #64748b;
  display: block;
  font-style: normal;
  line-height: 1.3;
  margin-top: 2px;
}

.smart-queue-preview em,
.smart-ranking b {
  color: #3158cf;
  font-size: 13px;
  font-style: normal;
  font-weight: 500;
}

.smart-ranking span {
  align-items: center;
  grid-template-columns: minmax(0, 1fr) auto;
}

.smart-history-dashboard {
  display: grid;
  gap: 14px;
}

.smart-history-hero {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
}

.smart-history-hero h2 {
  font-size: 24px;
  font-weight: 600;
  margin: 4px 0 6px;
}

.smart-history-hero p {
  color: #64748b;
  margin: 0;
  max-width: 780px;
}

.smart-history-filters {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(300px, 1fr) repeat(3, minmax(150px, 210px));
}

.meta-optin-filters {
  align-items: center;
  grid-template-columns: minmax(0, 1fr) 170px 170px;
}

.meta-optin-filters .history-search-field,
.meta-optin-filters .secondary-button {
  height: 44px;
}

.meta-optin-filters .secondary-button {
  align-items: center;
  display: inline-flex;
  justify-content: center;
  margin: 0;
}

.history-search-field {
  position: relative;
}

.history-search-field svg {
  color: #64748b;
  left: 14px;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.history-search-field input {
  padding-left: 42px;
}

.smart-history-kpis {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.smart-history-kpis article {
  display: grid;
  gap: 4px;
  min-height: 88px;
  place-content: center;
  text-align: center;
}

.smart-history-kpis strong {
  color: #111827;
  font-size: 28px;
  font-weight: 600;
}

.smart-history-kpis small {
  color: #64748b;
}

.meta-cost-explain {
  background: #f8fbff;
  border-color: #cfe3f4;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.meta-cost-explain strong {
  color: #0f172a;
  display: block;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.meta-cost-explain p,
.meta-optin-cost-note {
  color: #5b6b82;
  line-height: 1.55;
}

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

.smart-history-results {
  display: grid;
  gap: 12px;
}

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

.smart-history-list article {
  background: #f8fbff;
  border: 1px solid #e3ebf5;
  border-radius: 12px;
  display: grid;
  gap: 9px;
  padding: 12px;
}

.history-event-main {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: auto minmax(0, 1fr);
}

.history-event-main strong {
  color: #111827;
  display: block;
  font-size: 14px;
  font-weight: 500;
}

.history-event-main small,
.smart-history-list footer {
  color: #64748b;
  font-size: 12px;
}

.smart-history-list p {
  color: #334155;
  line-height: 1.45;
  margin: 0;
  overflow-wrap: anywhere;
}

.smart-history-list footer {
  align-items: center;
  border-top: 1px solid #e6edf5;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding-top: 8px;
}

.integration-overview {
  display: grid;
  gap: 14px;
}

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

.integration-summary-card h2 {
  font-size: 24px;
  margin: 4px 0 6px;
}

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

.integration-summary-metrics {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
}

.integration-summary-metrics span {
  background: #f8fbff;
  border: 1px solid rgba(219, 228, 240, 0.95);
  border-radius: 12px;
  padding: 12px;
}

.integration-summary-metrics strong,
.integration-summary-metrics small {
  display: block;
}

.integration-summary-metrics strong {
  color: #111827;
  font-size: 20px;
}

.integration-summary-metrics small {
  color: #64748b;
  font-weight: 700;
  margin-top: 2px;
}

.integration-overview > .integration-summary-card {
  display: none;
}

.integration-hero-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
}

.integration-health-card {
  background:
    radial-gradient(circle at 16% 12%, rgba(18, 136, 200, 0.12), transparent 30%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(243, 249, 255, 0.92));
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.integration-health-copy h2 {
  font-size: 28px;
  margin: 4px 0 8px;
}

.integration-health-copy p {
  color: #64748b;
  line-height: 1.5;
  margin: 0;
}

.integration-score-ring {
  align-items: center;
  background:
    radial-gradient(circle at center, #fff 0 57%, transparent 58%),
    conic-gradient(#16a34a var(--score), #e6edf5 0);
  border-radius: 999px;
  display: grid;
  height: 126px;
  justify-items: center;
  place-content: center;
  width: 126px;
}

.integration-score-ring strong {
  color: #0f172a;
  font-size: 30px;
  font-weight: 650;
  line-height: 1;
}

.integration-score-ring small {
  color: #64748b;
  font-size: 12px;
  margin-top: 4px;
}

.integration-health-bars {
  background: #e6edf5;
  border-radius: 999px;
  display: flex;
  gap: 2px;
  grid-column: 1 / -1;
  height: 12px;
  overflow: hidden;
}

.integration-health-bars span {
  display: block;
  min-width: 0;
}

.integration-health-bars .ok {
  background: #16a34a;
}

.integration-health-bars .warning {
  background: #f2b705;
}

.integration-health-bars .danger {
  background: #ef4444;
}

.integration-health-bars .muted {
  background: #cbd5e1;
}

.integration-command-card {
  display: grid;
  gap: 12px;
}

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

.integration-alert-list button,
.integration-all-good {
  align-items: center;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  color: #172033;
  display: grid;
  gap: 10px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding: 11px 12px;
  text-align: left;
}

.integration-alert-list button {
  cursor: pointer;
}

.integration-alert-list button:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.integration-alert-list button.warning {
  border-left: 4px solid #f2b705;
}

.integration-alert-list button.danger {
  border-left: 4px solid #ef4444;
}

.integration-alert-list strong,
.integration-all-good strong {
  color: #172033;
  display: block;
  font-weight: 650;
}

.integration-alert-list small,
.integration-alert-list em,
.integration-all-good small {
  color: #64748b;
  display: block;
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.integration-alert-list em {
  color: #0f82bd;
  font-weight: 650;
  white-space: nowrap;
}

.integration-all-good {
  background: #effdf5;
  border-color: #bbf7d0;
  color: #166534;
}

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

.integration-value-card {
  background: rgba(255, 255, 255, 0.94);
  border-radius: 14px;
  display: grid;
  gap: 4px;
  padding: 16px;
}

.integration-value-card strong {
  color: #0f82bd;
  font-size: 24px;
  font-weight: 650;
}

.integration-value-card span {
  color: #172033;
  font-weight: 650;
}

.integration-value-card small {
  color: #64748b;
}

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

.integration-overview-card {
  border-radius: 10px;
  display: grid;
  gap: 14px;
  position: relative;
}

.integration-overview-card::before {
  background: #cbd5e1;
  border-radius: 999px;
  content: "";
  height: calc(100% - 28px);
  left: 0;
  position: absolute;
  top: 14px;
  width: 4px;
}

.integration-overview-card.ok::before {
  background: #16a34a;
}

.integration-overview-card.warning::before {
  background: #eab308;
}

.integration-overview-card.danger::before {
  background: #ef4444;
}

.integration-overview-card header {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.integration-overview-card header strong {
  color: #111827;
  display: block;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
}

.integration-overview-card header small {
  color: #64748b;
  display: block;
  line-height: 1.35;
  margin-top: 4px;
}

.integration-overview-card header b {
  background: #eef2ff;
  border-radius: 999px;
  color: #2744c7;
  font-size: 12px;
  font-weight: 500;
  padding: 7px 10px;
  white-space: nowrap;
}

.integration-overview-card.ok header b {
  background: #dcfce7;
  color: #166534;
}

.integration-overview-card.warning header b {
  background: #fef9c3;
  color: #854d0e;
}

.integration-overview-card.danger header b {
  background: #fee2e2;
  color: #991b1b;
}

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

.integration-card-stats span {
  background: #f8fafc;
  border: 1px solid #e6edf5;
  border-radius: 10px;
  min-width: 0;
  padding: 9px 10px;
}

.integration-card-stats small {
  color: #64748b;
  display: block;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
}

.integration-card-stats strong {
  color: #18233a;
  display: block;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.28;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.smart-status-list span {
  align-items: flex-start;
  background: #f8fbff;
  border: 1px solid rgba(219, 228, 240, 0.9);
  border-radius: 13px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  line-height: 1.35;
  padding: 11px 12px;
}

.smart-status-list strong {
  color: #526078;
  font-size: 14px;
  font-weight: 400;
}

.smart-status-list b {
  color: #18233a;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.35;
  max-width: 68%;
  text-align: right;
}

.smart-commerce-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(250px, 290px) minmax(0, 1fr) minmax(280px, 330px);
}

.smart-commerce-grid > * {
  min-width: 0;
}

.meta-templates-grid {
  align-items: start;
  grid-template-columns: minmax(250px, 300px) minmax(0, 1fr) minmax(280px, 340px);
}

.meta-templates-grid .smart-preview {
  grid-column: 3;
  position: sticky;
  top: 16px;
}

.meta-templates-grid > .smart-list,
.meta-templates-grid > .meta-api-editor,
.meta-templates-grid > .smart-preview {
  position: relative;
  z-index: 1;
}

.smart-sandbox-panel {
  margin-bottom: 14px;
}

.smart-simulator-panel {
  margin-bottom: 14px;
}

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

.smart-simulator-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.smart-simulator-grid label {
  margin-bottom: 0;
}

.smart-simulator-grid label:nth-of-type(9) {
  grid-column: span 2;
}

.smart-simulator-options {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(220px, 1fr)) auto;
}

.smart-simulator-options .primary-button {
  min-width: 180px;
}

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

.send-mode-box {
  background: linear-gradient(135deg, #ffffff, #f1f6ff);
  border: 1px solid rgba(191, 213, 246, 0.9);
  border-radius: 16px;
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.06);
  display: grid;
  gap: 12px;
  padding: 14px;
}

.send-mode-box > span {
  color: #1e2f4d;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.send-mode-box > small {
  color: var(--muted);
  line-height: 1.35;
}

.send-mode-toggle {
  background: #e7edf7;
  border: 1px solid #d8e2f0;
  border-radius: 15px;
  display: grid;
  gap: 6px;
  grid-template-columns: 1fr 1fr;
  padding: 5px;
}

.send-mode-toggle button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 12px;
  color: #475569;
  display: grid;
  font-weight: 900;
  gap: 4px;
  justify-items: center;
  min-height: 74px;
  padding: 11px 8px;
  position: relative;
  transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, color 0.18s ease;
}

.send-mode-toggle button::before {
  align-items: center;
  background: rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  content: "✓";
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  height: 22px;
  justify-content: center;
  margin-bottom: 2px;
  width: 22px;
}

.send-mode-toggle button.risky::before,
.send-mode-toggle button:not(.active):last-child::before {
  content: "!";
}

.send-mode-toggle button:hover {
  transform: translateY(-1px);
}

.send-mode-toggle button small {
  color: inherit;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
}

.send-mode-toggle button.active {
  box-shadow: 0 14px 26px rgba(15, 23, 42, 0.14);
  color: #fff;
}

.send-mode-toggle button.active.safe {
  background: linear-gradient(135deg, #16a34a, #0f766e);
}

.send-mode-toggle button.active.risky {
  background: linear-gradient(135deg, #f97316, #dc2626);
}

.send-mode-box {
  background: #f8fafc;
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.04);
  gap: 10px;
  padding: 12px;
}

.send-mode-box > span {
  color: #334155;
}

.send-mode-toggle {
  background: #eef3f8;
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  gap: 6px;
  padding: 5px;
}

.send-mode-toggle button {
  align-items: flex-start;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #334155;
  display: flex;
  flex-direction: column;
  gap: 3px;
  justify-content: center;
  justify-items: initial;
  min-height: 58px;
  padding: 10px 12px 10px 14px;
  text-align: left;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.send-mode-toggle button::before {
  background: #cbd5e1;
  border-radius: 999px;
  content: "";
  display: block;
  height: 26px;
  left: 6px;
  margin: 0;
  opacity: 0;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
}

.send-mode-toggle button:not(.active):last-child::before {
  content: "";
}

.send-mode-toggle button:hover {
  background: rgba(255, 255, 255, 0.68);
  transform: none;
}

.send-mode-toggle button small {
  color: #64748b;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.2;
  text-align: left;
}

.send-mode-toggle button.active {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.08);
  color: #0f172a;
}

.send-mode-toggle button.active.safe {
  background: #ffffff;
  border-color: #86efac;
}

.send-mode-toggle button.active.risky {
  background: #ffffff;
  border-color: #fdba74;
}

.send-mode-toggle button.active::before {
  opacity: 1;
}

.send-mode-toggle button.active.safe::before {
  background: #16a34a;
}

.send-mode-toggle button.active.risky::before {
  background: #f97316;
}

.smart-list button {
  align-items: center;
  background: #f8fbff;
  border: 1px solid rgba(219, 228, 240, 0.9);
  border-radius: 14px;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 12px;
  text-align: left;
}

.smart-list button.active {
  background: #eff6ff;
  border-color: var(--blue);
  box-shadow: inset 3px 0 0 var(--blue);
}

.meta-template-editor {
  background: #f8fafc;
  border: 1px solid #dbe4f0;
  border-radius: 16px;
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 14px;
}

.meta-api-editor {
  padding: 0;
  overflow: visible;
}

.meta-editor-head {
  align-items: flex-start;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 20px 22px;
}

.meta-editor-head h2 {
  font-size: 24px;
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}

.meta-editor-head p {
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
  max-width: 680px;
}

.meta-api-layout {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 0;
}

.meta-config-strip {
  background: #fbfdff;
  border-bottom: 1px solid #e2e8f0;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(220px, 1.2fr) repeat(4, minmax(140px, 0.8fr));
  padding: 16px 22px;
}

.meta-readonly-field {
  background: #ffffff;
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  display: grid;
  gap: 4px;
  min-height: 56px;
  min-width: 0;
  padding: 9px 11px;
}

.meta-readonly-field span {
  color: #64748b;
  font-size: 12px;
  font-weight: 500;
}

.meta-readonly-field strong,
.meta-readonly-field b {
  color: #0f172a;
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-status-dot {
  align-items: center;
  display: inline-flex;
  gap: 6px;
  text-transform: uppercase;
}

.meta-status-dot::before {
  background: #94a3b8;
  border-radius: 999px;
  content: "";
  height: 8px;
  width: 8px;
}

.meta-status-dot.approved::before {
  background: #16a34a;
}

.meta-status-dot.approved {
  color: #047857;
}

.meta-status-dot.pending::before,
.meta-status-dot.in_review::before {
  background: #f59e0b;
}

.meta-status-dot.pending,
.meta-status-dot.in_review {
  color: #92400e;
}

.meta-status-dot.revision::before {
  background: #6366f1;
}

.meta-status-dot.rejected::before {
  background: #ef4444;
}

.meta-status-dot.rejected {
  color: #be123c;
}

.meta-status-badge {
  background: #f1f5f9;
  border-radius: 999px;
  color: #475569;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
  white-space: nowrap;
}

.meta-status-badge.approved {
  background: #dcfce7;
  color: #047857;
}

.meta-status-badge.pending,
.meta-status-badge.in_review {
  background: #fef3c7;
  color: #92400e;
}

.meta-status-badge.rejected {
  background: #ffe4e6;
  color: #be123c;
}

.meta-status-badge.revision {
  background: #e0e7ff;
  color: #4338ca;
}

.meta-official-note {
  align-items: center;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  gap: 14px;
  padding: 10px 22px;
}

.meta-official-note .hint-text {
  margin: 0;
}

.meta-preset-row {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 22px;
}

.meta-preset-row > span {
  color: #475569;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  margin-right: 4px;
  text-transform: uppercase;
}

.meta-preset-row > small {
  color: #64748b;
  flex: 1 1 220px;
  font-size: 12px;
  line-height: 1.3;
}

.meta-preset-row button {
  background: #f8fafc;
  border: 1px solid #dbe4f0;
  border-radius: 999px;
  color: #334155;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  min-height: 32px;
  padding: 6px 12px;
}

.meta-preset-row button:hover {
  background: #eef4ff;
  border-color: #bfd2ff;
}

.meta-preset-row .meta-assist-button {
  align-items: center;
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #075985;
  display: inline-flex;
  gap: 6px;
}

.meta-pending-box,
.meta-side-actions,
.meta-duplicate-box,
.meta-history-box,
.meta-rejection-box,
.meta-validation-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.meta-list-summary {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 12px;
  padding: 12px;
}

.meta-list-summary span {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  color: #475569;
  display: grid;
  gap: 2px;
  padding: 9px;
}

.meta-list-summary strong {
  color: #0f172a;
  font-size: 18px;
}

.meta-list-summary small {
  color: #64748b;
  grid-column: 1 / -1;
  line-height: 1.35;
}

.meta-pending-box > strong,
.meta-side-actions > span,
.meta-duplicate-box > summary,
.meta-validation-box > strong,
.meta-rejection-box > strong {
  color: #0f172a;
  font-size: 13px;
  font-weight: 500;
}

.meta-pending-box button,
.meta-side-actions button {
  align-items: center;
  background: #ffffff;
  border: 1px solid #dbe4f0;
  border-radius: 10px;
  color: #334155;
  cursor: pointer;
  display: flex;
  font-size: 12px;
  font-weight: 500;
  justify-content: space-between;
  min-height: 34px;
  padding: 8px 10px;
  text-align: left;
}

.meta-pending-box b {
  border-radius: 999px;
  font-size: 10px;
  padding: 3px 7px;
  text-transform: uppercase;
}

.meta-pending-box b.draft {
  background: #f1f5f9;
  color: #475569;
}

.meta-pending-box b.pending {
  background: #fef3c7;
  color: #92400e;
}

.meta-pending-box b.rejected {
  background: #ffe4e6;
  color: #be123c;
}

.meta-pending-box small {
  color: #64748b;
}

.meta-duplicate-box select {
  min-height: 36px;
}

.meta-duplicate-box {
  display: block;
}

.meta-duplicate-box summary {
  cursor: pointer;
  list-style: none;
}

.meta-duplicate-box summary::-webkit-details-marker {
  display: none;
}

.meta-duplicate-box summary::before {
  color: #2f55d4;
  content: "+";
  font-size: 16px;
  font-weight: 500;
  margin-right: 8px;
}

.meta-duplicate-box[open] summary::before {
  content: "-";
}

.meta-duplicate-box > div {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(180px, 1fr) auto;
  margin-top: 12px;
}

.meta-api-main {
  display: grid;
  gap: 16px;
  min-width: 0;
  padding: 22px;
}

.meta-language-list {
  display: grid;
  gap: 7px;
}

.meta-language-list span {
  color: #475569;
  font-weight: 800;
}

.meta-language-list button {
  background: transparent;
  border: 0;
  color: #64748b;
  cursor: pointer;
  font-weight: 800;
  padding: 6px 0;
  text-align: left;
}

.meta-language-list button.active {
  color: #059669;
}

.meta-status-pill {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 10px;
  min-width: 0;
}

.meta-status-pill span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-status-pill.approved {
  background: #ecfdf5;
  border-color: #86efac;
  color: #047857;
}

.meta-status-pill.pending,
.meta-status-pill.in_review {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
}

.meta-status-pill.rejected {
  background: #fff1f2;
  border-color: #fda4af;
  color: #be123c;
}

.danger-text {
  color: #be123c;
}

.meta-validation-box {
  background: #fff7ed;
  border-color: #fed7aa;
  max-width: 100%;
  overflow: hidden;
  padding: 10px 12px;
}

.meta-validation-box.ok {
  background: #ecfdf5;
  border-color: #bbf7d0;
}

.meta-validation-box ul {
  color: #9a3412;
  display: grid;
  gap: 5px;
  margin: 0;
  max-height: 112px;
  overflow: auto;
  padding-left: 18px;
}

.meta-validation-box li {
  overflow-wrap: anywhere;
}

.meta-validation-box.ok p {
  color: #047857;
  margin: 0;
}

.meta-category-risk {
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.meta-category-risk > div {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.meta-category-risk strong {
  color: #102033;
  font-weight: 500;
}

.meta-category-risk span,
.meta-category-risk small {
  color: #64748b;
  font-size: 12px;
}

.meta-category-risk ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
}

.meta-category-risk.utility {
  background: #ecfdf5;
  border-color: #bbf7d0;
}

.meta-category-risk.mixed {
  background: #fffbeb;
  border-color: #fde68a;
}

.meta-category-risk.marketing {
  background: #fff1f2;
  border-color: #fecdd3;
}

.meta-header-options {
  display: grid;
  gap: 10px;
}

.meta-header-options > span {
  color: #1f2937;
  font-weight: 500;
}

.meta-header-options > span small,
.meta-api-main label small {
  color: var(--muted);
  font-weight: 400;
}

.meta-header-options > div {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.meta-header-options button {
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  color: #334155;
  cursor: pointer;
  font-weight: 500;
  min-height: 58px;
}

.meta-header-options button.active {
  background: #eff6ff;
  border-color: var(--blue);
  color: var(--blue-dark);
}

.meta-samples-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  padding: 14px;
}

.meta-samples-box > div {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.meta-samples-box summary {
  align-items: center;
  color: #1e40af;
  cursor: pointer;
  display: flex;
  gap: 10px;
  font-weight: 500;
  list-style: none;
}

.meta-samples-box summary::-webkit-details-marker {
  display: none;
}

.meta-samples-box summary::before {
  content: "+";
  font-size: 16px;
}

.meta-samples-box[open] summary::before {
  content: "-";
}

.meta-samples-box strong {
  color: #1e3a8a;
}

.meta-samples-box summary span {
  color: #475569;
  font-size: 13px;
  font-weight: 650;
}

.meta-sample-row {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(140px, 0.8fr) auto minmax(160px, 1fr);
  margin-top: 10px;
}

.meta-sample-row span {
  background: #e2e8f0;
  border-radius: 8px;
  color: #334155;
  font-weight: 800;
  padding: 10px 12px;
}

.meta-revision-callout {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 12px;
}

.meta-revision-callout div {
  display: grid;
  gap: 4px;
}

.meta-revision-callout strong {
  color: #0f172a;
  font-size: 13px;
}

.meta-revision-callout span,
.meta-revision-modal-body p {
  color: #64748b;
  line-height: 1.4;
  margin: 0;
}

.meta-revision-modal {
  max-width: 520px;
}

.meta-revision-modal-body {
  display: grid;
  gap: 10px;
  padding: 18px 22px;
}

.inline-alert.danger {
  background: #fff1f2;
  border-color: #fda4af;
  color: #9f1239;
}

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

.meta-buttons-editor {
  display: grid;
  gap: 10px;
}

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

.meta-phone-preview {
  background: linear-gradient(180deg, #111827, #030712);
  border: 1px solid #0f172a;
  border-radius: 38px;
  box-shadow: 0 22px 45px rgba(15, 23, 42, 0.22);
  margin: 16px auto;
  max-width: 310px;
  padding: 14px;
  position: relative;
}

.meta-iphone-notch {
  background: #020617;
  border-radius: 0 0 16px 16px;
  height: 22px;
  left: 50%;
  position: absolute;
  top: 10px;
  transform: translateX(-50%);
  width: 98px;
  z-index: 2;
}

.meta-iphone-status {
  align-items: center;
  color: #f8fafc;
  display: flex;
  font-size: 11px;
  justify-content: space-between;
  padding: 4px 18px 10px;
}

.meta-phone-appbar {
  align-items: center;
  background: #075e54;
  border-radius: 24px 24px 0 0;
  color: #ffffff;
  display: flex;
  font-size: 12px;
  justify-content: space-between;
  min-height: 42px;
  padding: 0 14px;
}

.meta-phone-appbar b {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: #ffffff;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
}

.meta-phone-screen {
  background:
    radial-gradient(circle at 15% 18%, rgba(255, 255, 255, 0.42) 0 2px, transparent 3px),
    radial-gradient(circle at 82% 38%, rgba(255, 255, 255, 0.34) 0 2px, transparent 3px),
    linear-gradient(180deg, #efe7da, #e8dccd);
  border-radius: 0 0 24px 24px;
  min-height: 330px;
  padding: 18px 12px 22px;
}

.meta-chat-bubble {
  background: #ffffff;
  border-radius: 10px 10px 10px 2px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
  color: #17212f;
  line-height: 1.45;
  max-width: 92%;
  padding: 12px;
}

.meta-iphone-home {
  background: #f8fafc;
  border-radius: 999px;
  height: 4px;
  margin: 10px auto 0;
  opacity: 0.9;
  width: 96px;
}

.meta-rejection-box {
  background: #fff1f2;
  border-color: #fda4af;
  margin-top: 12px;
}

.meta-rejection-box p {
  color: #9f1239;
  margin: 0;
}

.meta-history-box {
  margin-top: 12px;
}

.compact-title {
  margin: 0;
}

.meta-history-box article {
  border-top: 1px solid #e2e8f0;
  display: grid;
  gap: 4px;
  padding-top: 10px;
}

.meta-history-box article:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.meta-history-box article strong {
  color: #0f172a;
  font-size: 13px;
  font-weight: 500;
  text-transform: capitalize;
}

.meta-history-box article strong span {
  color: #64748b;
  font-size: 11px;
  margin-left: 4px;
  text-transform: uppercase;
}

.meta-history-box article p {
  color: #334155;
  font-size: 13px;
  margin: 0;
}

.meta-history-box article small,
.meta-history-box article em {
  color: #64748b;
  font-size: 12px;
  font-style: normal;
}

.meta-chat-bubble > strong,
.meta-chat-bubble > p,
.meta-chat-bubble > small {
  display: block;
  line-height: 1.4;
  margin: 0 0 8px;
  white-space: pre-wrap;
}

.meta-chat-bubble > strong {
  font-weight: 500;
}

.meta-chat-bubble > p {
  color: #111827;
  font-size: 13px;
}

.meta-chat-bubble > small {
  color: #64748b;
}

.qr-phone-preview .meta-phone-screen {
  min-height: 390px;
  max-height: 520px;
  overflow-y: auto;
}

.smart-preview .compact-title:has(+ .smart-variable-list),
.smart-preview .smart-variable-list {
  display: none;
}

.qr-chat-bubble {
  max-width: 96%;
}

.qr-chat-bubble.empty {
  opacity: 0.78;
}

.qr-chat-bubble > p {
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.meta-media-placeholder {
  align-items: center;
  background: #e2e8f0;
  border: 1px dashed #94a3b8;
  border-radius: 10px;
  color: #475569;
  display: flex;
  font-weight: 800;
  height: 92px;
  justify-content: center;
  margin-bottom: 8px;
}

.meta-preview-buttons {
  display: grid;
  gap: 6px;
}

.meta-preview-buttons button {
  background: #ffffff;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  color: var(--blue);
  font-weight: 800;
  padding: 8px;
}

.smart-list button strong,
.smart-log-list strong {
  display: block;
  font-size: 14px;
  font-weight: 500;
}

.smart-list button small,
.smart-log-list span,
.smart-log-list small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 4px;
}

.smart-log-customer {
  color: #334155;
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-top: 6px;
}

.smart-log-customer.muted {
  color: #9aa3b7;
  font-weight: 400;
}

.smart-list button b {
  color: #1b8f5a;
  font-size: 12px;
}

.smart-editor textarea {
  min-height: 230px;
}

.smart-flags {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.payment-reminder-box {
  background: #f8fbff;
  border: 1px solid rgba(219, 228, 240, 0.9);
  border-radius: 14px;
  display: grid;
  gap: 12px;
  padding: 12px;
}

.variable-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.variable-row button {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #25305a;
  cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  padding: 6px 10px;
}

.smart-variable-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.smart-variable-list button {
  align-items: flex-start;
  background: #f8fbff;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  color: #263746;
  cursor: pointer;
  display: grid;
  gap: 4px;
  justify-items: start;
  padding: 10px 12px;
  text-align: left;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.smart-variable-list button:hover {
  background: #eef7fb;
  border-color: #b8d7e6;
}

.smart-variable-list span {
  color: #263746;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.25;
}

.smart-variable-list code {
  background: transparent;
  border: 0;
  color: #62718a;
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
  padding: 0;
}

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

.message-preview {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  font-family: inherit;
  line-height: 1.45;
  margin: 0 0 12px;
  min-height: 160px;
  padding: 14px;
  white-space: pre-wrap;
}

.compact-title {
  margin-top: 18px;
}

.smart-log-list {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
}

.dashboard-log-list,
.smart-log-list-full {
  max-height: none;
}

.smart-section-actions {
  margin-top: 14px;
}

.smart-queue-panel {
  display: grid;
  gap: 14px;
}

.queue-toolbar,
.queue-actions {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.queue-toolbar label {
  display: grid;
  flex: 1 1 190px;
  gap: 6px;
  margin: 0;
}

.queue-toolbar input,
.queue-toolbar select {
  min-height: 40px;
}

.queue-actions {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
}

.queue-actions span {
  color: var(--muted);
  font-weight: 800;
  margin-right: auto;
}

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

.queue-group {
  border: 1px solid var(--line);
  border-radius: 12px;
  min-width: 0;
  padding: 12px;
}

.queue-group-title {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.queue-group-title h3 {
  font-size: 16px;
  margin: 0;
}

.queue-group-title small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 800;
  margin-top: 3px;
}

.queue-group-title button,
.queue-mini-actions button {
  background: transparent;
  border: 0;
  color: var(--blue);
  cursor: pointer;
  font-weight: 800;
}

.queue-row {
  align-items: start;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 10px;
  grid-template-columns: auto minmax(0, 1fr) minmax(150px, auto);
  margin-top: 9px;
  padding: 10px;
}

.queue-row.selected {
  background: #eff6ff;
  border-color: var(--blue);
}

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

.queue-main strong,
.queue-main span,
.queue-main small {
  display: block;
}

.queue-main span,
.queue-main small,
.queue-side span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.queue-side {
  display: grid;
  gap: 4px;
  justify-items: end;
  text-align: right;
}

.queue-status {
  background: #eef2ff;
  border-radius: 999px;
  color: #3346a3;
  font-size: 12px;
  padding: 4px 8px;
}

.queue-status.queued {
  background: #fff7ed;
  color: #b45309;
}

.queue-status.sent,
.queue-status.sandbox_sent,
.queue-status.confirmed,
.queue-status.delivered,
.queue-status.read {
  background: #ecfdf3;
  color: #147346;
}

.queue-status.web_accepted {
  background: #e0f2fe;
  color: #075985;
}

.queue-status.error,
.queue-status.failed,
.queue-status.suspect {
  background: #fef2f2;
  color: #b91c1c;
}

.queue-status.cancelled,
.queue-status.ignored {
  background: #f1f5f9;
  color: #64748b;
}

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

.whatsapp-audit-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.audit-row {
  align-items: flex-start;
  background: #f8fbff;
  border: 1px solid #dbe7f3;
  border-left: 4px solid #2fbf71;
  border-radius: 12px;
  display: grid;
  gap: 10px;
  grid-template-columns: auto 1fr;
  padding: 12px;
}

.audit-row.warning {
  border-left-color: #f5a524;
}

.audit-row.danger {
  border-left-color: #e05252;
}

.audit-row strong {
  display: block;
  font-weight: 650;
}

.audit-row small,
.audit-row p {
  color: #66758a;
  margin: 3px 0 0;
}

.smart-log-list article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 11px;
}

.toast-inline,
.save-toast {
  background: #ecfdf3;
  border: 1px solid #b9ebcc;
  border-radius: 8px;
  color: #146c43;
  margin-bottom: 12px;
  padding: 10px 12px;
}

.chart-card {
  min-height: 276px;
}

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

.donut-wrap {
  align-items: center;
  display: grid;
  gap: 18px;
  justify-items: center;
  padding: 18px 0 0;
}

.donut {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  height: 172px;
  justify-content: center;
  position: relative;
  width: 172px;
}

.donut::after {
  background: #fff;
  border-radius: inherit;
  content: "";
  height: 86px;
  position: absolute;
  width: 86px;
}

.donut span {
  color: #27623d;
  font-weight: 900;
  position: relative;
  z-index: 1;
}

.legend-row {
  color: #4f5a72;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
}

.legend-row i {
  display: inline-block;
  height: 12px;
  margin-right: 6px;
  vertical-align: -1px;
  width: 12px;
}

.legend-row .sent {
  background: #39b966;
}

.legend-row .received {
  background: #80dea0;
}

.hour-chart {
  align-items: end;
  border-left: 1px solid #aeb5c4;
  border-bottom: 1px solid #aeb5c4;
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(24, minmax(18px, 1fr));
  height: 214px;
  padding: 8px 10px 0;
}

.hour-slot {
  align-items: center;
  display: grid;
  gap: 5px;
  height: 100%;
  min-width: 0;
}

.hour-bars {
  align-items: end;
  display: flex;
  gap: 3px;
  height: 170px;
  justify-content: center;
}

.bar {
  border-radius: 999px;
  display: block;
  min-height: 4px;
  width: 9px;
}

.bar.received {
  background: #86e2a7;
}

.bar.sent {
  background: #218b49;
}

.hour-slot small {
  color: #737c91;
  display: block;
  font-size: 11px;
  text-align: center;
}

.dashboard-list {
  min-height: 238px;
}

.ranking-table {
  display: grid;
  gap: 8px;
}

.ranking-table article {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: auto 1fr 60px 70px;
  min-height: 36px;
}

.ranking-table strong {
  color: #4d5871;
  display: block;
  font-size: 14px;
  font-weight: 500;
}

.ranking-table small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 2px;
}

.ranking-table b,
.ranking-table em {
  color: #596279;
  font-weight: 400;
  font-style: normal;
  text-align: right;
}

.dashboard-alerts {
  min-height: 238px;
}

.value-report-card,
.whatsapp-risk-card {
  display: grid;
  gap: 14px;
}

.value-report-main {
  background: linear-gradient(135deg, #f5fbff, #eefbf6);
  border: 1px solid #dbe8f6;
  border-radius: 12px;
  display: grid;
  gap: 4px;
  padding: 16px;
}

.value-report-main strong {
  color: #0f82bd;
  font-size: 2.1rem;
  font-weight: 650;
  line-height: 1;
}

.value-report-main span,
.value-report-grid small {
  color: #64748b;
}

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

.value-report-grid span {
  background: #f8fbff;
  border: 1px solid #dbe8f6;
  border-radius: 10px;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
}

.value-report-grid b {
  color: #17233a;
  font-weight: 550;
}

.risk-meter {
  background: #edf4fb;
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}

.risk-meter i {
  background: #22c55e;
  border-radius: inherit;
  display: block;
  height: 100%;
  min-width: 8px;
}

.whatsapp-risk-card.moderado .risk-meter i {
  background: #f59e0b;
}

.whatsapp-risk-card.alto .risk-meter i {
  background: #ef4444;
}

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

.alert-list button {
  align-items: center;
  background: #f7f8fb;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #25304b;
  display: grid;
  gap: 10px;
  grid-template-columns: auto 1fr;
  min-height: 48px;
  padding: 10px;
  text-align: left;
}

.alert-list button.warning {
  background: #fff8e8;
  border-color: #f3d38a;
}

.alert-list button.danger {
  background: #fff0f0;
  border-color: #f0b5b5;
}

.alert-list button.info {
  background: #eef5ff;
  border-color: #c8d9ff;
}

.alert-list button.success {
  background: #effcf5;
  border-color: #bfe9cf;
}

.alert-list strong,
.alert-list small {
  display: block;
}

.alert-list small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.mini-avatar {
  align-items: center;
  background: #eef2f8;
  border-radius: 999px;
  color: #b3bccb;
  display: inline-flex;
  height: 24px;
  justify-content: center;
  width: 24px;
}

@media (max-width: 1500px) {
  .dashboard-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .welcome-card {
    grid-column: span 3;
  }
}

@media (max-width: 1100px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

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

  .smart-commerce-grid {
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  }

  .smart-kpis-expanded {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .smart-dashboard-grid-rich,
  .smart-dashboard-grid-rich.lower {
    grid-template-columns: 1fr;
  }

  .smart-commerce-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .smart-history-filters,
  .smart-history-grid {
    grid-template-columns: 1fr;
  }

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

  .meta-templates-grid {
    grid-template-columns: 1fr;
  }

  .meta-templates-grid .smart-list,
  .meta-templates-grid .smart-preview {
    grid-column: 1;
  }

  .smart-commerce-grid .smart-preview {
    grid-column: 1 / -1;
  }

  .meta-templates-grid .smart-preview {
    grid-column: 1 / -1;
  }

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

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

  .ai-cost-values {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hour-chart {
    overflow-x: auto;
  }

  .hour-slot {
    min-width: 28px;
  }
}

/* Button polish: lighter SaaS controls across the app. */
.primary-button,
.form-panel .primary-button,
.flow-actions .primary-button,
.flow-test-form .primary-button,
.menu-modal-title .primary-button,
.menu-modal-footer .primary-button {
  background: #2f55d4;
  border: 1px solid #2f55d4;
  border-radius: 10px;
  box-shadow: 0 6px 14px rgba(47, 85, 212, 0.16);
  font-size: 14px;
  font-weight: 650;
  min-height: 38px;
  padding: 8px 13px;
  width: auto;
}

.primary-button:hover,
.form-panel .primary-button:hover,
.flow-actions .primary-button:hover,
.flow-test-form .primary-button:hover,
.menu-modal-title .primary-button:hover,
.menu-modal-footer .primary-button:hover {
  background: #2848bd;
  box-shadow: 0 8px 18px rgba(47, 85, 212, 0.18);
  transform: none;
}

.secondary-button,
.danger-button,
.flow-actions button,
.menu-modal-title button,
.menu-modal-footer button,
.add-option {
  border-radius: 10px;
  font-size: 14px;
  font-weight: 650;
  min-height: 38px;
  padding: 8px 13px;
}

.secondary-button,
.flow-actions button,
.menu-modal-title button,
.menu-modal-footer button {
  background: #ffffff;
  border: 1px solid #dbe4f0;
  color: #1f2937;
}

.danger-button,
.flow-actions .danger-button {
  background: #ffffff;
  border-color: #fecdd3;
  color: #be123c;
}

.add-option {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #1f2937;
}

@media (max-width: 720px) {
  .login-page {
    padding: 18px;
  }

  .login-copy,
  .login-form {
    padding: 28px;
  }

  .login-copy h1 {
    font-size: 34px;
  }

  .workspace {
    padding: 18px;
  }

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

  .dashboard-metrics,
  .smart-kpis,
  .ai-cost-values,
  .queue-groups,
  .meta-config-strip,
  .meta-header-options > div,
  .meta-button-row,
  .meta-sample-row {
    grid-template-columns: 1fr;
  }

  .meta-editor-head {
    align-items: stretch;
    flex-direction: column;
  }

  .meta-official-note,
  .meta-preset-row {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 820px) {
  .dashboard-metrics {
    grid-template-columns: 1fr;
  }

  .welcome-card {
    grid-column: auto;
  }

  .dashboard-tabs {
    grid-template-columns: 1fr;
  }

  .ai-cost-values {
    grid-template-columns: 1fr;
  }

  .ranking-table article {
    grid-template-columns: auto 1fr auto;
  }

  .ranking-table em {
    display: none;
  }
}

.flow-screen {
  display: grid;
  grid-template-rows: auto 1fr;
  height: calc(100vh - 52px);
  min-height: 720px;
  position: relative;
}

.save-notice {
  align-items: center;
  background: #122a73;
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(18, 42, 115, 0.22);
  color: #fff;
  display: flex;
  font-weight: 800;
  gap: 8px;
  left: 50%;
  min-height: 48px;
  padding: 0 22px;
  position: absolute;
  top: 18px;
  transform: translateX(-50%);
  z-index: 30;
}

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

.flow-actions button,
.danger-button {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  display: inline-flex;
  font-weight: 700;
  gap: 7px;
  min-height: 38px;
  padding: 8px 11px;
}

.flow-actions .primary-button {
  background: linear-gradient(135deg, var(--blue), #2348d7);
  border-color: var(--blue);
  color: #fff;
}

.flow-actions .danger-button {
  border-color: #ffc4c4;
  color: #c41e3a;
}

.global-alert,
.inline-alert {
  align-items: center;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  color: #92400e;
  display: flex;
  font-size: 13px;
  font-weight: 650;
  gap: 7px;
  line-height: 1.2;
  margin: 0 0 14px;
  padding: 10px 12px;
}

.global-alert.is-connected {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.inline-alert.success {
  align-items: flex-start;
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
  flex-direction: column;
  font-weight: 500;
}

.inline-alert.danger {
  align-items: flex-start;
  background: #fff1f2;
  border-color: #fecdd3;
  color: #9f1239;
  flex-direction: column;
  font-weight: 500;
}

.inline-alert.success strong,
.inline-alert.danger strong {
  font-weight: 650;
}

.inline-alert.success small,
.inline-alert.danger small {
  color: inherit;
  font-weight: 400;
}

.global-alert.is-disconnected {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.global-alert.is-reconnecting {
  background: #eef6ff;
  border-color: #a7cfff;
  color: #174a7c;
}

.inline-alert {
  margin: 0 0 12px;
}

.global-alert svg,
.inline-alert svg {
  height: 14px;
  width: 14px;
}

.flow-utility-row {
  align-items: stretch;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(220px, auto) minmax(320px, 1fr) auto;
  margin: 0 0 14px;
}

.flow-search {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-sizing: border-box;
  display: flex;
  gap: 8px;
  height: 60px;
  min-width: 0;
  padding: 0 16px;
}

.option-style-toggle {
  align-items: stretch;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-sizing: border-box;
  display: inline-flex;
  gap: 0;
  height: 60px;
  overflow: hidden;
  padding: 0;
}

.option-style-toggle span {
  align-items: center;
  background: #f8fafc;
  border-right: 1px solid var(--line);
  color: #64748b;
  display: inline-flex;
  font-size: 13px;
  font-weight: 500;
  height: 100%;
  padding: 0 13px;
}

.option-style-toggle button {
  align-items: center;
  background: #fff;
  border: 0;
  border-right: 1px solid var(--line);
  color: #334155;
  display: inline-flex;
  font-weight: 500;
  height: 100%;
  justify-content: center;
  padding: 0 18px;
}

.option-style-toggle button:last-child {
  border-right: 0;
}

.option-style-toggle button.active {
  background: #0f82bd;
  color: #fff;
}

.option-style-toggle button:not(.active):hover {
  background: #f4f8fb;
}

.flow-search input {
  border: 0;
  min-height: 30px;
  padding: 0;
}

.flow-search button {
  align-items: center;
  border-radius: 6px;
  display: inline-flex;
  font-size: 18px;
  height: 28px;
  justify-content: center;
  min-width: 30px;
  padding: 0;
}

.search-count {
  background: #e9efff;
  border-radius: 999px;
  color: #1f46d1;
  font-size: 12px;
  font-weight: 900;
  padding: 4px 8px;
  white-space: nowrap;
}

.search-count.empty {
  background: #fff0f2;
  color: #a70f2d;
}

.advanced-fields {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.advanced-fields summary {
  cursor: pointer;
  font-weight: 900;
}

.advanced-fields label {
  margin-top: 10px;
}

.flow-health {
  align-items: center;
  border-radius: 6px;
  box-sizing: border-box;
  display: inline-flex;
  font-size: 14px;
  font-weight: 500;
  height: 60px;
  justify-content: center;
  padding: 0 16px;
  white-space: nowrap;
}

.flow-health.ok {
  background: #e9f9ef;
  color: #137b37;
}

.flow-health.warn {
  background: #fff8e6;
  border: 1px solid #f3d38a;
  color: #8a5a00;
}

.flow-health.bad {
  background: #fff0f2;
  color: #a70f2d;
}

.flow-reconnect-hint {
  align-items: center;
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  color: #047857;
  display: flex;
  font-size: 13px;
  font-weight: 750;
  justify-content: space-between;
  margin-top: 10px;
  padding: 9px 12px;
}

.flow-reconnect-hint button {
  background: #ffffff;
  border: 1px solid #86efac;
  border-radius: 999px;
  color: #047857;
  font-weight: 800;
  padding: 4px 10px;
}

.flow-validation-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.flow-validation-summary {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 5px solid #d69d00;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(20, 35, 80, 0.07);
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px;
}

.flow-validation-summary.error {
  border-left-color: #c41e3a;
}

.flow-validation-summary > div:first-child {
  display: grid;
  gap: 4px;
}

.flow-validation-summary strong {
  color: var(--ink);
}

.flow-validation-summary span {
  color: var(--muted);
  font-size: 13px;
}

.flow-validation-panel button {
  align-items: center;
  background: #fff6df;
  border: 1px solid #ffe0a3;
  border-radius: 999px;
  color: #745000;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  gap: 6px;
  padding: 7px 10px;
}

.flow-validation-panel button span {
  color: inherit;
  font-size: 12px;
}

.flow-validation-panel button small {
  background: rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  color: inherit;
  font-size: 11px;
  padding: 3px 7px;
}

.flow-validation-panel button.error {
  background: #fff0f2;
  border-color: #ffc8d0;
  color: #a70f2d;
}

.history-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(20, 35, 80, 0.08);
  display: grid;
  gap: 10px;
  margin: 0 0 14px;
  padding: 14px;
}

.flow-insights-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  margin-bottom: 12px;
  padding: 14px;
}

.flow-insights-panel header {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.flow-insights-panel header div,
.flow-insights-panel article,
.insight-row,
.suggestion-card {
  display: grid;
  gap: 5px;
}

.flow-insights-panel h3 {
  font-size: 15px;
  margin: 0 0 8px;
}

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

.insight-row {
  background: #f7f9fd;
  border: 1px solid #e3e8f3;
  border-radius: 8px;
  color: var(--ink);
  margin-bottom: 8px;
  padding: 10px;
  text-align: left;
}

.insight-row.clickable {
  cursor: pointer;
  width: 100%;
}

.insight-row.clickable:hover,
.suggestion-card:hover {
  border-color: #b9c7ef;
}

.suggestion-card {
  border: 1px solid #e3e8f3;
  border-radius: 8px;
  padding: 10px;
}

.suggestion-card span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.suggestion-card p,
.suggestion-card em {
  color: #58627a;
  font-style: normal;
  margin: 0;
}

.suggestion-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.suggestion-actions .primary-button {
  min-height: 36px;
  padding: 8px 12px;
}

.insight-logs {
  border-top: 1px solid #edf1f7;
  padding-top: 8px;
}

.insight-logs code {
  display: block;
  margin-top: 6px;
  white-space: normal;
}

.history-row {
  background: #f7f9fd;
  border: 1px solid #e7ebf5;
  border-radius: 6px;
  display: grid;
  gap: 3px;
  padding: 10px;
}

.history-row span {
  font-weight: 800;
}

.history-row small,
.history-panel small {
  color: var(--muted);
}

.flow-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 0;
}

.palette-panel,
.canvas-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(219, 228, 240, 0.9);
  border-radius: 18px;
  box-shadow: var(--shadow);
  min-height: 0;
}

.palette-panel {
  align-content: start;
  display: grid;
  gap: 10px;
  padding: 14px;
}

.palette-panel strong {
  margin-bottom: 4px;
}

.palette-panel button {
  align-items: center;
  background: var(--node-color);
  border: 0;
  border-radius: 12px;
  color: #fff;
  display: flex;
  font-weight: 700;
  gap: 9px;
  min-height: 42px;
  padding: 10px 12px;
  text-align: left;
}

.canvas-panel {
  overflow: hidden;
}

.flow-node {
  background: #fff;
  border: 2px solid color-mix(in srgb, var(--node-color), white 35%);
  border-radius: 11px;
  box-shadow: 0 12px 28px rgba(21, 33, 72, 0.14);
  min-width: 230px;
  overflow: visible;
  position: relative;
}

.flow-node-search-hit .flow-node {
  box-shadow: 0 0 0 4px rgba(31, 70, 209, 0.2), 0 12px 28px rgba(21, 33, 72, 0.14);
}

.flow-node-focused .flow-node {
  box-shadow: 0 0 0 5px rgba(22, 163, 74, 0.26), 0 16px 34px rgba(21, 33, 72, 0.18);
}

.flow-node-edge-target .flow-node {
  box-shadow: 0 0 0 5px rgba(31, 70, 209, 0.3), 0 16px 34px rgba(21, 33, 72, 0.2);
}

.flow-node-edge-target .flow-node::after {
  background: #1f46d1;
  border-radius: 999px;
  color: #fff;
  content: "Destino";
  font-size: 11px;
  font-weight: 900;
  padding: 5px 9px;
  position: absolute;
  right: 10px;
  top: -28px;
}

.flow-screen-fullscreen {
  background: var(--canvas);
  inset: 0;
  min-height: 100vh;
  padding: 8px;
  position: fixed;
  z-index: 50;
}

.flow-screen-fullscreen .flow-layout {
  grid-template-columns: minmax(0, 1fr);
  height: calc(100vh - 16px);
  margin: 0;
}

.flow-screen-fullscreen .palette-panel {
  display: none;
}

.flow-screen-fullscreen .canvas-panel {
  min-height: calc(100vh - 16px);
}

.flow-fullscreen-exit {
  align-items: center;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #cfdbe9;
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
  color: #17233a;
  display: inline-flex;
  font-weight: 650;
  gap: 8px;
  min-height: 38px;
  padding: 0 13px;
  position: fixed;
  right: 18px;
  top: 14px;
  width: auto;
  z-index: 60;
}

.flow-fullscreen-exit:hover {
  border-color: #93b5d9;
  color: #0f5e89;
}

.start-badge {
  background: #16a34a;
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(22, 163, 74, 0.24);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  left: 10px;
  letter-spacing: 0;
  padding: 4px 8px;
  position: absolute;
  text-transform: uppercase;
  top: -22px;
}

.flow-node header {
  align-items: center;
  background: var(--node-color);
  border-radius: 5px 5px 0 0;
  color: #fff;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
}

.flow-node header span,
.node-tools {
  align-items: center;
  display: flex;
  gap: 8px;
}

.node-tools button {
  align-items: center;
  background: rgba(255, 255, 255, 0.24);
  border: 0;
  border-radius: 5px;
  color: #fff;
  display: inline-flex;
  height: 27px;
  justify-content: center;
  width: 27px;
}

.flow-node p {
  color: #34405b;
  font-size: 13px;
  line-height: 1.45;
  margin: 10px;
  max-width: 270px;
  white-space: pre-line;
}

.flow-node ol {
  display: grid;
  gap: 5px;
  list-style: none;
  margin: 8px;
  overflow: visible;
  padding: 0;
}

.flow-node li {
  background: #f1f4f9;
  border-radius: 4px;
  color: #3d4860;
  font-size: 12px;
  padding: 6px 7px;
}

.node-option-row {
  align-items: center;
  cursor: pointer;
  display: flex;
  min-height: 27px;
  overflow: visible;
  padding-right: 20px;
  position: relative;
}

.node-option-row:hover {
  background: #e7edf9;
}

.node-option-row span:first-child {
  flex: 1;
  overflow: hidden;
  padding-right: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-node .node-connect {
  border: 2px solid #fff;
  box-shadow: 0 8px 18px rgba(21, 33, 72, 0.18);
  opacity: 1;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 12;
}

.flow-node:hover .node-connect {
  opacity: 1;
}

.flow-node .node-connect-in {
  align-items: center;
  background: #aeb6c8;
  border-radius: 999px;
  color: #fff;
  display: flex;
  font-size: 20px;
  font-weight: 900;
  height: 28px;
  justify-content: center;
  left: -17px;
  transform: translateY(-50%);
  width: 28px;
}

.flow-node .node-connect-out {
  align-items: center;
  background: var(--node-color);
  border-radius: 999px;
  color: #fff;
  display: flex;
  font-size: 22px;
  font-weight: 900;
  height: 28px;
  justify-content: center;
  right: -17px;
  transform: translateY(-50%) scale(0.92);
  width: 28px;
}

.flow-node .node-option-connect {
  align-items: center;
  background: #2b9aad;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  display: flex;
  font-size: 12px;
  font-weight: 900;
  height: 18px;
  justify-content: center;
  left: auto !important;
  min-width: 18px;
  right: -18px !important;
  top: 50% !important;
  transform: translateY(-50%) scale(1) !important;
  width: 18px;
}

.flow-node .node-option-row .react-flow__handle-right {
  right: -18px !important;
  top: 50% !important;
  transform: translateY(-50%) scale(1) !important;
}

.flow-node .node-return-connect {
  align-items: center;
  background: #4a556f;
  border-radius: 999px;
  bottom: -16px;
  color: #fff;
  display: flex;
  font-size: 13px;
  font-weight: 900;
  height: 24px;
  justify-content: center;
  width: 24px;
}

.flow-node:hover .node-connect-out {
  transform: translateY(-50%) scale(1);
}

.flow-node:hover .node-option-connect {
  transform: translateY(-50%) scale(1);
}

.flow-node .node-connect-out span {
  line-height: 1;
  margin-top: -2px;
  pointer-events: none;
}

.flow-node .node-connect-in span,
.flow-node .node-option-connect span,
.flow-node .node-return-connect span {
  line-height: 1;
  margin-top: -2px;
  pointer-events: none;
}

.node-auto-return {
  display: inline-flex;
  align-items: center;
  max-width: calc(100% - 24px);
  margin: 8px 12px 10px;
  padding: 4px 9px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}

.flow-auto-return-note {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: #eff6ff;
  color: #334155;
}

.flow-auto-return-note strong {
  color: #1d4ed8;
}

.flow-auto-return-note span {
  font-size: 13px;
  line-height: 1.4;
}

.flow-auto-return-note.compact {
  margin-top: 10px;
}


.flow-start-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  margin: 10px 0;
  border: 1px solid rgba(37, 99, 235, 0.24);
  border-radius: 12px;
  background: #f8fbff;
  color: #1f2937;
  cursor: pointer;
}

.flow-start-checkbox input {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  accent-color: #2563eb;
  flex: 0 0 auto;
}

.flow-start-checkbox span {
  display: grid;
  gap: 3px;
}

.flow-start-checkbox strong {
  font-size: 14px;
  color: #1f2a44;
}

.flow-start-checkbox small {
  color: #64748b;
  font-size: 13px;
  line-height: 1.35;
}

.flow-start-checkbox.compact {
  margin: 8px 0 14px;
}

.dark .flow-start-checkbox {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(96, 165, 250, 0.34);
  color: #e5edf8;
}

.dark .flow-start-checkbox strong {
  color: #f8fafc;
}

.dark .flow-start-checkbox small {
  color: #a8b5c7;
}
.edge-hitbox {
  cursor: grab;
  pointer-events: stroke;
  stroke: transparent;
  stroke-width: 28;
}

.flow-edge-relinking,
.flow-edge-relinking * {
  cursor: grabbing !important;
}

.flow-edge-relinking .react-flow__node {
  outline: 2px dashed rgba(22, 163, 74, 0.45);
  outline-offset: 4px;
}

.flow-edge-group .react-flow__edge-path {
  stroke-dasharray: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.edge-delete,
.edge-text {
  position: absolute;
  pointer-events: all;
}

.edge-delete {
  align-items: center;
  background: #fff;
  border: 1px solid #ffc0c7;
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(20, 35, 80, 0.16);
  color: #c41e3a;
  display: inline-flex;
  height: 27px;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  width: 27px;
}

.edge-delete.visible,
.edge-delete:hover {
  opacity: 1;
}

.edge-text {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #566176;
  font-size: 11px;
  max-width: 160px;
  overflow: hidden;
  padding: 4px 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.backup-restore-summary {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin: 12px 0;
}

.backup-restore-summary span {
  background: #f7fbff;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 4px;
  padding: 12px;
}

.backup-restore-summary small {
  color: var(--muted);
  font-size: 12px;
}

.backup-restore-summary strong {
  color: var(--ink);
  font-size: 14px;
}

.restore-mode-box {
  background: #fff8ed;
  border: 1px solid #ffd89a;
  border-radius: 14px;
  color: #6d4b14;
  display: grid;
  gap: 8px;
  margin: 12px 0;
  padding: 12px 14px;
}

.restore-mode-box .check-row {
  color: #172033;
  font-weight: 700;
  margin: 0;
}

.restore-mode-box .hint-text {
  color: #735b35;
  margin: 0;
}

.restore-section-box {
  background: #fffaf0;
  border: 1px solid #fed7aa;
  border-radius: 18px;
  color: var(--ink);
  display: grid;
  gap: 16px;
  margin: 14px 0;
  padding: 18px;
}

.restore-section-heading {
  align-items: flex-start;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.restore-section-heading > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.restore-section-heading strong {
  color: var(--ink);
  display: block;
  font-size: 16px;
  line-height: 1.2;
}

.restore-section-heading div small {
  color: var(--muted);
  display: block;
  font-size: 13px;
  line-height: 1.4;
}

.restore-section-heading > span {
  align-self: center;
  background: rgba(255, 255, 255, .72);
  border: 1px solid #fde68a;
  border-radius: 999px;
  color: #8a5a00;
  display: inline-flex;
  font-size: 12px;
  line-height: 1.3;
  max-width: 320px;
  padding: 7px 10px;
  text-align: right;
  white-space: normal;
}

.restore-section-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.restore-section-card {
  align-items: center;
  background: #ffffff;
  border: 1px solid #f3d6a6;
  border-radius: 14px;
  cursor: pointer;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) 22px;
  min-height: 76px;
  padding: 14px 16px;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease, transform .16s ease;
}

.restore-section-card:hover {
  border-color: #f59e0b;
  box-shadow: 0 10px 28px rgba(146, 64, 14, .10);
  transform: translateY(-1px);
}

.restore-section-card.is-selected {
  background: #eff6ff;
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, .08);
}

.restore-section-card input[type="checkbox"] {
  appearance: auto;
  accent-color: #2563eb;
  align-self: center;
  height: 20px;
  justify-self: end;
  margin: 0;
  min-height: 20px;
  min-width: 20px;
  width: 20px;
}

.restore-section-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.restore-section-copy strong {
  color: var(--ink);
  display: block;
  font-size: 14px;
  line-height: 1.25;
}

.restore-section-copy small {
  color: var(--muted);
  display: block;
  font-size: 13px;
  line-height: 1.4;
}

@media (max-width: 720px) {
  .restore-section-heading {
    grid-template-columns: 1fr;
  }

  .restore-section-heading > span {
    justify-self: start;
    max-width: none;
    text-align: left;
  }

  .restore-section-grid {
    grid-template-columns: 1fr;
  }
}

.restore-danger-note {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: 12px;
  color: #991b1b;
  font-size: 13px;
  margin: 0;
  padding: 10px 12px;
}

.inspector {
  overflow: auto;
  padding: 16px;
}

.inspector.empty {
  align-content: center;
  color: var(--muted);
  display: grid;
  justify-items: center;
  text-align: center;
}

.inspector.empty strong {
  color: var(--ink);
  margin-top: 12px;
}

.inspector-title {
  align-items: center;
  border-bottom: 3px solid var(--node-color);
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 10px;
}

.inspector-title span {
  font-weight: 800;
}

.inspector-title button,
.options-editor button,
.start-node-button {
  background: #eef2f8;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
}

.start-node-button {
  color: #1f2a44;
  font-weight: 800;
  margin-bottom: 14px;
  min-height: 40px;
  width: 100%;
}

.start-node-button.compact {
  margin-bottom: 0;
  min-height: 42px;
  width: auto;
}

.start-node-button.active {
  background: #e9f9ef;
  border-color: #86efac;
  color: #137b37;
}

.options-editor {
  display: grid;
  gap: 10px;
}

.modal-backdrop {
  align-items: center;
  background: rgba(11, 18, 38, 0.42);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 28px;
  position: fixed;
  z-index: 3000;
}

.setup-assistant-card {
  align-items: center;
  background: linear-gradient(135deg, rgba(226, 246, 255, 0.88), rgba(255, 255, 255, 0.94) 52%, rgba(232, 255, 245, 0.84));
  border: 1px solid #d7e4f2;
  border-radius: 10px;
  box-shadow: 0 14px 36px rgba(27, 54, 93, 0.08);
  display: grid;
  gap: 18px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  margin-bottom: 16px;
  padding: 20px;
}

.setup-assistant-icon {
  align-items: center;
  background: #e8f6ff;
  border: 1px solid #cce7f8;
  border-radius: 12px;
  color: #1088c4;
  display: inline-flex;
  height: 52px;
  justify-content: center;
  width: 52px;
}

.setup-assistant-card h2,
.setup-assistant-head h2 {
  font-size: 24px;
  font-weight: 680;
  letter-spacing: 0;
  line-height: 1.18;
  margin: 2px 0 8px;
}

.setup-assistant-card p,
.setup-assistant-head p {
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.setup-assistant-card small {
  color: #64748b;
  display: block;
  margin-top: 8px;
}

.eyebrow {
  color: #1088c4;
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.setup-assistant-modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(12, 21, 48, 0.28);
  color: #26344d;
  display: grid;
  max-height: calc(100vh - 48px);
  overflow: hidden;
  width: min(980px, 96vw);
}

.setup-assistant-head {
  align-items: start;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 22px 24px;
}

.setup-assistant-steps {
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.setup-assistant-steps button {
  align-items: center;
  background: #fff;
  border: 0;
  border-right: 1px solid var(--line);
  color: #64748b;
  cursor: pointer;
  display: flex;
  gap: 8px;
  justify-content: center;
  min-height: 54px;
  padding: 10px;
}

.setup-assistant-steps button:last-child {
  border-right: 0;
}

.setup-assistant-steps span {
  align-items: center;
  background: #edf4fb;
  border-radius: 999px;
  color: #64748b;
  display: inline-flex;
  font-size: 12px;
  height: 24px;
  justify-content: center;
  width: 24px;
}

.setup-assistant-steps button.active {
  background: #f4fbff;
  color: #0f172a;
}

.setup-assistant-steps button.active span {
  background: #1088c4;
  color: #fff;
}

.setup-assistant-steps button.done span {
  background: #dcfce7;
  color: #15803d;
}

.setup-assistant-body {
  max-height: min(62vh, 620px);
  overflow: auto;
  padding: 24px;
}

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

.assistant-step-grid label,
.assistant-step-grid .check-row {
  color: #52617a;
  display: grid;
  gap: 7px;
  margin: 0;
}

.assistant-step-grid .check-row {
  align-items: center;
  grid-template-columns: auto minmax(0, 1fr);
}

.assistant-step-grid label input,
.assistant-step-grid label select {
  width: 100%;
}

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

.assistant-choice {
  background: #fff;
  border: 1px solid #d8e3ef;
  border-radius: 10px;
  color: #25324a;
  cursor: pointer;
  display: grid;
  gap: 8px;
  justify-items: start;
  min-height: 130px;
  padding: 18px;
  text-align: left;
}

.assistant-choice:hover {
  border-color: #9cd2ed;
  box-shadow: 0 12px 30px rgba(16, 136, 196, 0.11);
}

.assistant-choice.active {
  background: #f0faff;
  border-color: #1088c4;
}

.assistant-choice strong {
  font-weight: 680;
}

.assistant-choice span {
  color: #64748b;
  line-height: 1.42;
}

.assistant-note {
  align-items: center;
  background: #f7fafc;
  border: 1px solid #dde7f1;
  border-radius: 10px;
  color: #52617a;
  display: flex;
  gap: 10px;
  padding: 14px;
}

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

.assistant-review span {
  background: #f7fafc;
  border: 1px solid #dce7f2;
  border-radius: 10px;
  color: #26344d;
  line-height: 1.45;
  padding: 12px 14px;
}

.setup-result {
  display: grid;
  gap: 16px;
  justify-items: start;
}

.setup-result > svg {
  color: #16a34a;
}

.setup-result h3 {
  font-size: 24px;
  font-weight: 680;
  margin: 0;
}

.setup-result p {
  color: #52617a;
  margin: 0;
}

.setup-assistant-actions {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 18px 24px;
}

@media (max-width: 900px) {
  .doc-visual-screen,
  .doc-visual.has-phone .doc-visual-main,
  .doc-visual-grid {
    grid-template-columns: 1fr;
  }

  .doc-visual-sidebar {
    border-bottom: 1px solid #dfe8f1;
    border-right: 0;
    grid-auto-flow: column;
    min-height: 56px;
  }

  .doc-phone-preview {
    margin: 0 auto;
    max-width: 220px;
    width: 100%;
  }

  .setup-assistant-card,
  .setup-assistant-head,
  .assistant-step-grid,
  .assistant-choice-grid,
  .assistant-review {
    grid-template-columns: 1fr;
  }

  .setup-assistant-card {
    align-items: start;
  }

  .setup-assistant-steps {
    grid-template-columns: 1fr;
  }

  .setup-assistant-steps button {
    border-bottom: 1px solid var(--line);
    border-right: 0;
    justify-content: flex-start;
  }
}

.menu-modal {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(12, 21, 48, 0.28);
  color: #34405b;
  display: grid;
  gap: 18px;
  max-height: calc(100vh - 56px);
  overflow: auto;
  padding: 20px;
  width: min(1120px, 96vw);
}

.flow-test-modal {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(12, 21, 48, 0.28);
  color: #34405b;
  display: grid;
  gap: 16px;
  max-height: calc(100vh - 56px);
  padding: 20px;
  width: min(980px, 96vw);
}

.flow-test-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) 260px;
  min-height: 460px;
}

.flow-test-chat {
  align-content: start;
  background: #f5f7fb;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  max-height: 54vh;
  overflow: auto;
  padding: 14px;
}

.test-bubble {
  border-radius: 8px;
  display: grid;
  gap: 6px;
  max-width: 82%;
  padding: 11px 13px;
  white-space: pre-wrap;
}

.test-bubble span {
  align-items: center;
  display: flex;
  font-size: 12px;
  font-weight: 800;
  gap: 8px;
  justify-content: space-between;
  text-transform: uppercase;
}

.test-bubble p {
  line-height: 1.45;
  margin: 0;
}

.test-bubble small {
  color: #64708a;
  font-size: 12px;
}

.test-edit-button {
  align-items: center;
  background: #eef2ff;
  border: 1px solid #cbd5ff;
  border-radius: 999px;
  color: #1f46d1;
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  gap: 4px;
  min-height: 26px;
  padding: 4px 8px;
  text-transform: none;
}

.flow-test-save-notice {
  left: 50%;
  position: fixed;
  top: 22px;
  z-index: 60;
}

.test-bubble.user {
  background: #dbe7ff;
  justify-self: end;
}

.test-bubble.bot {
  background: #fff;
  border: 1px solid #d8deec;
  justify-self: start;
}

.test-bubble.system,
.test-bubble.error {
  background: #fff6df;
  border: 1px solid #ffe0a3;
  justify-self: center;
}

.test-bubble.error {
  background: #fff0f2;
  border-color: #ffc8d0;
  color: #a70f2d;
}

.flow-test-state {
  align-content: start;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 14px;
}

.flow-test-state code {
  background: #f3f5fa;
  border-radius: 6px;
  color: #1f2a44;
  display: block;
  padding: 8px;
  white-space: pre-wrap;
}

.flow-test-form {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.flow-test-form input {
  min-height: 44px;
}

.flow-test-form button {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 44px;
  padding: 8px 16px;
}

.flow-test-form .primary-button {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.menu-modal-title,
.menu-modal-footer,
.toggle-row,
.char-row {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.menu-modal-title div {
  align-items: center;
  color: #8f4fd8;
  display: flex;
  gap: 10px;
  font-size: 24px;
}

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

.menu-modal-title button,
.menu-modal-footer button,
.add-option {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 700;
  min-height: 42px;
  padding: 9px 16px;
}

.menu-modal-title .primary-button,
.menu-modal-footer .primary-button {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.add-option {
  align-items: center;
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  display: flex;
  gap: 10px;
  justify-content: center;
  width: 100%;
}

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

.toggle-row small {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-top: 7px;
}

.toggle-row input {
  width: auto;
}

.menu-option-list {
  display: grid;
  gap: 14px;
}

.menu-option-card {
  background: #f2f4f8;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 14px;
}

.menu-option-card[draggable="true"] {
  cursor: grab;
}

.menu-option-card[draggable="true"]:active {
  cursor: grabbing;
}

.menu-option-card-header {
  align-items: center;
  color: #4c5872;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.menu-option-card-header strong {
  margin-right: auto;
}

.target-picker-row {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
}

.target-picker-row button:first-child {
  background: #fff;
  border: 1px solid #aeb7cc;
  border-radius: 6px;
  color: #273252;
  cursor: pointer;
  min-height: 42px;
  overflow: hidden;
  padding: 9px 11px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button-soft {
  align-items: center;
  background: #fff4f4;
  border: 1px solid #ffd0d0;
  border-radius: 6px;
  color: #d62342;
  cursor: pointer;
  display: inline-flex;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.nested-modal {
  z-index: 3100;
}

.target-picker-modal {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(20, 28, 48, 0.24);
  display: grid;
  gap: 14px;
  grid-template-rows: auto auto minmax(0, 1fr);
  max-height: min(760px, 92vh);
  min-height: 0;
  overflow: hidden;
  padding: 18px;
  width: min(920px, 94vw);
}

.target-search-input {
  border: 1px solid #aeb7cc;
  border-radius: 8px;
  font-size: 15px;
  min-height: 44px;
  padding: 10px 12px;
}

.target-group-list {
  display: grid;
  gap: 14px;
  max-height: calc(92vh - 170px);
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
}

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

.target-group h3 {
  align-items: center;
  display: flex;
  font-size: 15px;
  gap: 7px;
  margin: 0;
}

.target-card-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}

.target-card-grid button {
  background: #f8faff;
  border: 1px solid #dfe4f0;
  border-radius: 8px;
  color: #172042;
  cursor: pointer;
  min-height: 84px;
  padding: 10px;
  text-align: left;
}

.target-card-grid button:hover {
  border-color: var(--blue);
  box-shadow: 0 8px 22px rgba(38, 72, 191, 0.12);
}

.target-card-grid strong {
  display: block;
  font-size: 14px;
  margin-bottom: 5px;
}

.target-card-grid span {
  color: #66718c;
  display: block;
  font-size: 12px;
  line-height: 1.35;
}

.drag-option-handle {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #69728b;
  display: inline-flex;
  height: 32px;
  justify-content: center;
  padding: 0;
  width: 32px;
}

.char-row {
  color: #8b93a8;
  font-size: 13px;
}

.delete-option {
  background: #fff;
  border: 1px solid #ff5b6d;
  border-radius: 7px;
  color: #ef2744;
  font-weight: 800;
  min-height: 44px;
}

.menu-modal-footer {
  border-top: 1px solid var(--line);
  gap: 12px;
  justify-content: flex-end;
  padding-top: 14px;
}

.conversation-grid {
  display: grid;
  gap: 12px;
}

.conversation-warning {
  margin-bottom: 12px;
}

.conversation-card {
  align-items: stretch;
  grid-template-columns: 260px minmax(0, 1fr) 220px;
  margin-bottom: 0;
}

.conversation-card.human {
  background: #fff8f0;
  border-color: #fed7aa;
}

.conversation-person {
  align-content: start;
  display: grid;
  gap: 6px;
}

.conversation-avatar {
  align-items: center;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  border-radius: 14px;
  color: #fff;
  display: inline-flex;
  font-size: 18px;
  font-weight: 900;
  height: 42px;
  justify-content: center;
  margin-bottom: 2px;
  width: 42px;
}

.conversation-person strong {
  color: #172042;
  font-size: 16px;
}

.conversation-person small b {
  color: #172042;
}

.conversation-phone {
  background: #f3f7ff;
  border: 1px solid #dbe6ff;
  border-radius: 999px;
  justify-self: start;
  padding: 5px 8px;
}

.conversation-person span {
  background: #e9f8f1;
  border-radius: 999px;
  color: #13764f;
  justify-self: start;
  padding: 7px 10px;
}

.conversation-card.human .conversation-person span {
  background: #fff1d6;
  color: #a45a00;
}

.conversation-main {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.conversation-identity {
  align-items: center;
  background: #f8fbff;
  border: 1px solid rgba(219, 228, 240, 0.9);
  border-radius: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  justify-content: space-between;
  padding: 9px 10px;
}

.conversation-identity strong {
  color: #172042;
}

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

.conversation-main p {
  margin: 0;
}

.conversation-meta,
.context-pills,
.conversation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.conversation-meta span {
  background: #eef2ff;
  border-radius: 999px;
  color: #46506a;
  font-size: 12px;
  padding: 6px 9px;
}

.context-pills code {
  font-size: 12px;
  padding: 6px 8px;
}

.context-pills small {
  color: var(--muted);
}

.decision-trace {
  background: #f8fbff;
  border: 1px solid #dbe6f4;
  border-left: 4px solid #0f82bd;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 11px 12px;
}

.decision-trace.ai {
  background: #fffaf0;
  border-color: #f4d38a;
  border-left-color: #d97706;
}

.decision-trace.user-facing {
  background: #f8fbff;
  border-left-color: #2f80ed;
}

.decision-trace.user-facing.ai {
  background: #f2fbf7;
  border-color: #bdebdc;
  border-left-color: #13a371;
}

.decision-trace header {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  justify-content: space-between;
}

.decision-trace header strong {
  color: #172033;
}

.decision-trace header span,
.decision-trace p,
.decision-preview {
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
  margin: 0;
}

.decision-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.decision-grid span {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid #e3eaf3;
  border-radius: 7px;
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 8px;
}

.decision-grid small,
.decision-nodes small {
  color: #64748b;
  font-size: 11px;
}

.decision-grid b {
  color: #172033;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.decision-nodes {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.decision-nodes code {
  background: #fff;
  border: 1px solid #dce5f1;
  border-radius: 999px;
  color: #34425f;
  font-size: 11px;
  padding: 5px 7px;
}

.conversation-diagnostics {
  border: 1px dashed #c8d6e6;
  border-radius: 12px;
  color: #64748b;
  margin-top: 10px;
  padding: 8px 10px;
}

.conversation-diagnostics summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  list-style-position: inside;
}

.conversation-diagnostics[open] {
  background: #f8fbff;
}

.conversation-diagnostics .decision-grid,
.conversation-diagnostics .context-pills {
  margin-top: 10px;
}

.conversation-actions {
  align-content: start;
  display: grid;
}

.conversation-actions button {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  font-weight: 800;
  min-height: 38px;
  padding: 8px 10px;
}

.conversation-actions .primary-button {
  background: linear-gradient(135deg, var(--blue), #2348d7);
  border-color: var(--blue);
  color: #fff;
}

.conversation-confirm {
  background: #fff8e8;
  border: 1px solid #f3d38a;
  border-radius: 13px;
  display: grid;
  gap: 7px;
  padding: 8px;
}

.conversation-confirm strong {
  color: #7b4b00;
  font-size: 12px;
}

.conversation-confirm button:first-of-type {
  background: #d97706;
  border-color: #d97706;
  color: #fff;
}

.empty-conversations {
  align-items: center;
  color: var(--muted);
  display: grid;
  gap: 8px;
  justify-items: center;
  min-height: 220px;
  text-align: center;
}

.empty-conversations strong {
  color: var(--ink);
}

.qr-box {
  align-items: center;
  background: linear-gradient(180deg, #f8fbff, #f3f7ff);
  border: 1px dashed #bfc7da;
  border-radius: 16px;
  display: grid;
  gap: 8px;
  justify-items: center;
  min-height: 240px;
  text-align: center;
}

.qr-image {
  border: 1px solid var(--line);
  border-radius: 6px;
  height: 210px;
  width: 210px;
}

.qr-box span {
  color: var(--muted);
}

.whatsapp-status-box {
  border-style: solid;
  min-height: 220px;
  padding: 28px;
}

.whatsapp-status-box.connected {
  background: linear-gradient(180deg, #f0fdf4, #ecfdf5);
  border-color: #bbf7d0;
}

.whatsapp-status-box.warning {
  background: linear-gradient(180deg, #fff7ed, #fffbeb);
  border-color: #fed7aa;
}

.whatsapp-status-box.offline {
  background: linear-gradient(180deg, #fff7f7, #fef2f2);
  border-color: #fecaca;
}

.whatsapp-status-box strong {
  color: #0f172a;
  font-size: 20px;
  line-height: 1.2;
}

.whatsapp-status-box small {
  color: #64748b;
}

.integration-actions,
.send-test-form {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
}

.integration-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.integration-tabs button {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  display: inline-flex;
  font-weight: 800;
  gap: 8px;
  min-height: 42px;
  padding: 9px 14px;
}

.integration-tabs button.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.hint-text {
  color: var(--muted);
  line-height: 1.5;
}

.knowledge-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.knowledge-actions button:not(.primary-button) {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: inline-flex;
  font-weight: 800;
  gap: 7px;
  min-height: 42px;
  padding: 9px 12px;
}

.knowledge-panel {
  align-content: start;
  display: grid;
  gap: 12px;
}

.knowledge-card {
  background: #f7f9fd;
  border: 1px solid #e5eaf4;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 13px;
}

.knowledge-card strong,
.knowledge-card-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}

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

.knowledge-card p {
  line-height: 1.45;
  margin: 0;
  max-height: 96px;
  overflow: auto;
  white-space: pre-line;
}

.knowledge-card-actions button {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: inline-flex;
  gap: 6px;
  min-height: 36px;
  padding: 7px 10px;
}

.operational-notice-form {
  border-color: rgba(245, 158, 11, 0.35);
}

.operational-notice-card {
  border-left: 4px solid #38bdf8;
}

.operational-notice-card.ativo {
  border-left-color: #22c55e;
}

.operational-notice-card.agendado {
  border-left-color: #f59e0b;
}

.operational-notice-card.expirado,
.operational-notice-card.pausado {
  opacity: 0.72;
}

.order-result {
  display: grid;
  gap: 10px;
}

.order-result a {
  color: var(--blue);
  font-weight: 800;
}

.integration-actions button:not(.primary-button),
.send-test-form button:not(.primary-button) {
  background: #eef4fb;
  border: 1px solid rgba(219, 228, 240, 0.9);
  border-radius: 11px;
  min-height: 42px;
}

.send-test-form {
  align-items: end;
  margin-top: 14px;
}

.send-test-form label {
  margin-bottom: 0;
}

.debug-box {
  background: #101828;
  border-radius: 14px;
  color: #d7e1ff;
  font-size: 12px;
  max-height: 180px;
  overflow: auto;
  padding: 12px;
}

.check-row {
  align-items: center;
  display: flex;
  gap: 10px;
}

.check-row input {
  min-height: auto;
}

.debug-panel {
  margin-top: 18px;
}

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

/* ContactAssist clean UI pass */
:root {
  --blue: #263746;
  --blue-dark: #172432;
  --cyan: #8cb8c8;
  --ink: #17212f;
  --muted: #64748b;
  --line: #d8e1ec;
  --soft: #f3f6fa;
  --canvas: #f7f9fc;
  --success: #0f8a5f;
  --warning: #a16207;
  --danger: #b42318;
  --shadow: 0 14px 38px rgba(15, 23, 42, 0.08);
}

body,
.page,
.content {
  background: var(--canvas);
  color: var(--ink);
}

.login-page {
  background:
    radial-gradient(circle at 22% 12%, rgba(255, 237, 237, 0.88), transparent 34%),
    radial-gradient(circle at 8% 88%, rgba(222, 241, 255, 0.96), transparent 38%),
    linear-gradient(135deg, #fff9f8 0%, #f7fbff 58%, #eef7ff 100%);
}

.login-panel,
.login-form,
.form-panel,
.panel,
.card,
.welcome-card,
.kpi-card,
.ai-cost-card,
.chart-card,
.timeline-card,
.conversation-card,
.row-card,
.knowledge-card,
.suggestion-card,
.plan-config-card,
.queue-panel,
.smart-panel,
.debug-panel,
.documentation-card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.055);
}

.login-copy {
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(216, 225, 236, 0.74);
  box-shadow: none;
}

.login-copy h1,
.page-title h1,
.content h1,
.content h2,
.content h3,
.login-form h2 {
  color: #101828;
  letter-spacing: 0;
}

.sidebar {
  background: linear-gradient(180deg, #fff6f4 0%, #f5f8fb 48%, #eaf5ff 100%);
  border-right: 1px solid var(--line);
  box-shadow: none;
  color: var(--ink);
}

.sidebar .brand,
.sidebar-footer,
.sidebar-footer small,
.sidebar-footer button,
.sidebar-footer .profile-trigger {
  color: var(--ink);
}

.brand-mark {
  background: #263746;
  box-shadow: none;
}

.sidebar nav a,
.sidebar nav button {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #283849;
  font-weight: 760;
}

.sidebar nav a:hover,
.sidebar nav button:hover {
  background: rgba(255, 255, 255, 0.76);
  border-color: rgba(216, 225, 236, 0.86);
  color: #101828;
  transform: none;
}

.sidebar nav .active,
.sidebar nav button.active {
  background: #f3f6fa;
  border-color: #dbe5f0;
  border-left-color: #2563eb;
  border-left-width: 4px;
  box-shadow: none;
  color: #111827;
}

.sidebar nav .active svg,
.sidebar nav button.active svg {
  color: #2563eb;
}

.topbar,
.app-header,
.admin-header {
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--line);
  box-shadow: none;
}

.primary-button,
.form-panel .primary-button,
.flow-actions .primary-button,
.flow-test-form .primary-button,
.menu-modal-title .primary-button,
.menu-modal-footer .primary-button,
.smart-simulator-options .primary-button,
.suggestion-actions .primary-button,
.conversation-actions .primary-button {
  background: #263746;
  border: 1px solid #263746;
  border-radius: 8px;
  box-shadow: none;
  color: #fff;
  font-weight: 760;
  letter-spacing: 0;
}

.primary-button:hover,
.form-panel .primary-button:hover,
.flow-actions .primary-button:hover,
.flow-test-form .primary-button:hover,
.menu-modal-title .primary-button:hover,
.menu-modal-footer .primary-button:hover,
.smart-simulator-options .primary-button:hover,
.suggestion-actions .primary-button:hover,
.conversation-actions .primary-button:hover {
  background: #172432;
  box-shadow: none;
  transform: none;
}

.secondary-button,
.ghost-button,
.integration-actions button:not(.primary-button),
.send-test-form button:not(.primary-button),
.knowledge-actions button:not(.primary-button),
.knowledge-card-actions button,
.flow-actions button:not(.primary-button),
.menu-modal-footer button:not(.primary-button) {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: none;
  color: #27384a;
  font-weight: 740;
}

.secondary-button:hover,
.ghost-button:hover,
.integration-actions button:not(.primary-button):hover,
.send-test-form button:not(.primary-button):hover,
.knowledge-actions button:not(.primary-button):hover,
.knowledge-card-actions button:hover,
.flow-actions button:not(.primary-button):hover,
.menu-modal-footer button:not(.primary-button):hover {
  background: #f7f9fc;
  border-color: #c4d0de;
  transform: none;
}

.danger-button,
button.danger,
.delete-button {
  background: #fff7f7;
  border: 1px solid #f2c4c4;
  border-radius: 8px;
  box-shadow: none;
  color: var(--danger);
}

input,
select,
textarea,
.input,
.select,
.textarea {
  background: #fff;
  border: 1px solid #cfd8e3;
  border-radius: 8px;
  box-shadow: none;
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
  border-color: #8aa5bc;
  box-shadow: 0 0 0 3px rgba(140, 165, 188, 0.18);
  outline: none;
}

.dashboard-tabs,
.section-subnav,
.smart-tabs,
.integration-tabs {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: none;
}

.dashboard-tabs button,
.section-subnav button,
.smart-tabs button,
.integration-tabs button {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #334155;
  font-weight: 760;
}

.dashboard-tabs button.active,
.section-subnav button.active,
.smart-tabs button.active,
.integration-tabs button.active {
  background: #263746;
  border-color: #263746;
  box-shadow: none;
  color: #fff;
}

.kpi-card strong,
.welcome-card strong,
.ai-cost-value,
.metric-value {
  color: #101828;
}

.kpi-card.clickable:hover,
.suggestion-card:hover,
.conversation-card:hover,
.row-card:hover {
  border-color: #bcc9d7;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.075);
  transform: none;
}

.table-list,
.ranking-table,
.dashboard-list,
.dashboard-log-list {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: none;
}

.ranking-table article,
.dashboard-list article,
.dashboard-log-list article,
.table-list article {
  border-bottom: 1px solid #e6edf5;
}

.status-dot,
.meta-status-badge,
.meta-status-pill,
.queue-status,
.start-badge {
  border-radius: 999px;
  box-shadow: none;
  font-weight: 760;
}

.meta-status-badge.approved,
.meta-status-pill.approved,
.queue-status.sent,
.queue-status.sandbox_sent,
.queue-status.confirmed,
.queue-status.delivered,
.queue-status.read {
  background: #e9f8ef;
  border-color: #b9ebcb;
  color: #08734e;
}

.queue-status.web_accepted {
  background: #e0f2fe;
  border-color: #bae6fd;
  color: #075985;
}

.meta-status-badge.pending,
.meta-status-badge.in_review,
.meta-status-pill.pending,
.meta-status-pill.in_review,
.queue-status.queued {
  background: #fff8e6;
  border-color: #f4d38a;
  color: #8a5a00;
}

.meta-status-badge.rejected,
.meta-status-pill.rejected,
.queue-status.error,
.queue-status.failed,
.queue-status.suspect {
  background: #fff0f0;
  border-color: #f0b6b6;
  color: #9f1c1c;
}

.flow-screen,
.canvas-panel,
.flow-canvas {
  background-color: #f8fafc;
}

.flow-actions {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: none;
}

.flow-node {
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.debug-box {
  background: #162232;
  border: 1px solid #25384d;
  color: #dce8f7;
}

/* Meta Business inspired refinement */
body,
.page,
.content {
  background:
    radial-gradient(circle at 92% 78%, rgba(218, 249, 235, 0.64), transparent 28%),
    linear-gradient(116deg, #fff7f5 0%, #f6f4fb 42%, #eaf7ff 100%);
}

.shell {
  background: transparent;
}

.sidebar {
  background: linear-gradient(180deg, #fff8f7 0%, #f8f3fb 46%, #e7f5ff 100%);
  width: 268px;
}

.sidebar .brand {
  padding: 22px 18px 18px;
}

.sidebar nav {
  gap: 8px;
  padding: 6px 18px;
}

.sidebar nav a,
.sidebar nav button {
  min-height: 42px;
  padding: 10px 14px;
}

.sidebar nav .active,
.sidebar nav button.active {
  background: #f3f6fa;
  border-color: #dbe5f0;
  border-left-color: #2563eb;
  border-left-width: 4px;
  border-radius: 4px;
  color: #111827;
}

.sidebar nav a:not(.active),
.sidebar nav button:not(.active) {
  color: #1f2937;
}

.sidebar nav a:not(.active):hover,
.sidebar nav button:not(.active):hover {
  background: #eef4ff;
  border-color: #d6e3f8;
}

.sidebar nav a svg,
.sidebar nav button svg {
  color: currentColor;
  opacity: 0.88;
}

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

.sidebar-subnav {
  display: grid;
  gap: 2px;
  padding: 2px 0 8px 32px;
}

.sidebar-subnav button {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #1f2937;
  font-size: 14px;
  font-weight: 520;
  justify-content: start;
  min-height: 34px;
  padding: 6px 10px;
}

.sidebar-subnav button svg {
  display: none;
}

.sidebar-subnav button.active {
  background: rgba(255, 255, 255, 0.58);
  border-color: rgba(203, 213, 225, 0.62);
  border-left-color: #2563eb;
  border-left-width: 3px;
  color: #111827;
  font-weight: 720;
}

.sidebar-subnav button:hover {
  background: #eef4ff;
  border-color: #d6e3f8;
}

/* Softer primary actions */
.primary-button,
.form-panel .primary-button,
.flow-actions .primary-button,
.flow-test-form .primary-button,
.menu-modal-title .primary-button,
.menu-modal-footer .primary-button,
.smart-simulator-options .primary-button,
.suggestion-actions .primary-button,
.conversation-actions .primary-button {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.primary-button:hover,
.form-panel .primary-button:hover,
.flow-actions .primary-button:hover,
.flow-test-form .primary-button:hover,
.menu-modal-title .primary-button:hover,
.menu-modal-footer .primary-button:hover,
.smart-simulator-options .primary-button:hover,
.suggestion-actions .primary-button:hover,
.conversation-actions .primary-button:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.topbar .primary-button,
.page-title .primary-button {
  background: #f8fbff;
  border-color: #bfd4ff;
  color: #174ea6;
}

.topbar .primary-button:hover,
.page-title .primary-button:hover {
  background: #eef4ff;
  border-color: #9fbeff;
  color: #174ea6;
}

/* Lighter typography and calmer buttons */
body {
  font-weight: 400;
}

button,
input,
select,
textarea,
label,
small,
p,
li,
td,
th {
  font-weight: 400;
}

.content h1,
.content h2,
.content h3,
.page-title h1,
.panel-title h2,
.topbar h1,
.login-form h2,
.login-copy h1,
.brand-lockup strong,
.kpi-card strong,
.metric strong,
.ai-cost-value,
.queue-main strong,
.conversation-person strong,
.meta-phone-screen > strong {
  font-weight: 700;
}

.primary-button,
.form-panel .primary-button,
.flow-actions .primary-button,
.flow-test-form .primary-button,
.menu-modal-title .primary-button,
.menu-modal-footer .primary-button,
.smart-simulator-options .primary-button,
.suggestion-actions .primary-button,
.conversation-actions .primary-button {
  background: #0f82bd;
  border-color: #0f82bd;
  border-radius: 4px;
  box-shadow: none;
  color: #fff;
  font-weight: 600;
  min-height: 40px;
  padding: 9px 18px;
}

.primary-button:hover,
.form-panel .primary-button:hover,
.flow-actions .primary-button:hover,
.flow-test-form .primary-button:hover,
.menu-modal-title .primary-button:hover,
.menu-modal-footer .primary-button:hover,
.smart-simulator-options .primary-button:hover,
.suggestion-actions .primary-button:hover,
.conversation-actions .primary-button:hover {
  background: #0d75aa;
  border-color: #0d75aa;
  box-shadow: none;
}

.topbar .primary-button,
.page-title .primary-button {
  background: #0f82bd;
  border-color: #0f82bd;
  color: #fff;
}

.topbar .primary-button:hover,
.page-title .primary-button:hover {
  background: #0d75aa;
  border-color: #0d75aa;
  color: #fff;
}

.secondary-button,
.ghost-button,
.integration-actions button:not(.primary-button),
.send-test-form button:not(.primary-button),
.knowledge-actions button:not(.primary-button),
.knowledge-card-actions button,
.flow-actions button:not(.primary-button),
.menu-modal-footer button:not(.primary-button),
.conversation-actions button:not(.primary-button),
.queue-mini-actions button {
  font-weight: 500;
}

.sidebar nav a,
.sidebar nav button {
  font-weight: 600;
}

.sidebar-subnav button {
  font-weight: 400;
}

.sidebar-subnav button.active {
  font-weight: 600;
}

.sidebar-footer {
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(203, 213, 225, 0.65);
  border-radius: 12px;
  margin: 14px 18px 18px;
}

.content,
.main-content {
  padding: 24px 34px;
}

.alert-banner,
.page-title,
.form-panel,
.panel,
.welcome-card,
.kpi-card,
.ai-cost-card,
.chart-card,
.timeline-card,
.table-list,
.ranking-table,
.dashboard-list,
.dashboard-log-list,
.smart-panel,
.queue-panel,
.conversation-card,
.row-card {
  border-color: #d9e1ea;
  border-radius: 4px;
  box-shadow: none;
}

.page-title,
.alert-banner {
  background: #fff;
}

.page-title h1,
.content h1 {
  font-size: 26px;
  font-weight: 760;
}

.content h2,
.content h3,
.form-panel h2,
.panel h2,
.card h2 {
  font-weight: 720;
}

.dashboard-tabs,
.section-subnav,
.smart-tabs,
.integration-tabs {
  align-items: stretch;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #ccd6e2;
  border-radius: 0;
  gap: 0;
  padding: 0;
}

.dashboard-tabs button,
.section-subnav button,
.smart-tabs button,
.integration-tabs button {
  border: 0;
  border-bottom: 4px solid transparent;
  border-radius: 0;
  min-height: 48px;
  padding: 12px 22px;
}

.dashboard-tabs button.active,
.section-subnav button.active,
.smart-tabs button.active,
.integration-tabs button.active {
  background: transparent;
  border-color: #263845;
  color: #1f2937;
}

.primary-button,
.form-panel .primary-button,
.flow-actions .primary-button,
.flow-test-form .primary-button,
.menu-modal-title .primary-button,
.menu-modal-footer .primary-button,
.smart-simulator-options .primary-button,
.suggestion-actions .primary-button,
.conversation-actions .primary-button {
  border-radius: 4px;
  min-height: 38px;
  padding: 9px 16px;
}

.secondary-button,
.ghost-button,
.integration-actions button:not(.primary-button),
.send-test-form button:not(.primary-button),
.knowledge-actions button:not(.primary-button),
.knowledge-card-actions button,
.flow-actions button:not(.primary-button),
.menu-modal-footer button:not(.primary-button) {
  border-radius: 4px;
  min-height: 38px;
}

input,
select,
textarea,
.input,
.select,
.textarea {
  border-radius: 4px;
}

.kpi-card,
.welcome-card {
  min-height: 170px;
}

.kpi-card strong {
  font-size: 25px;
}

.ai-cost-card {
  display: grid;
  gap: 12px;
}

.ranking-table article,
.dashboard-list article,
.dashboard-log-list article,
.table-list article {
  background: #fff;
  border-bottom: 1px solid #dbe3ec;
  border-radius: 0;
}

.meta-template-list,
.meta-template-editor,
.meta-template-preview {
  border-radius: 4px;
  box-shadow: none;
}

.ranking-table {
  gap: 0;
}

.ranking-table article {
  gap: 14px;
  grid-template-columns: auto minmax(0, 1fr) minmax(46px, auto) minmax(52px, auto);
  min-height: 56px;
  padding: 10px 14px;
}

.ranking-table article > div {
  min-width: 0;
}

.ranking-table strong {
  color: #18233a;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.28;
}

.ranking-table small {
  color: #64748b;
  font-size: 12px;
  line-height: 1.35;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.ranking-table b,
.ranking-table em {
  color: #475569;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.3;
  white-space: nowrap;
}

.dashboard-list-questions .ranking-table article {
  align-items: flex-start;
  grid-template-columns: minmax(0, 1fr) 32px 44px;
  gap: 10px;
  padding: 14px 12px;
}

.dashboard-list-questions .mini-avatar {
  display: none;
}

.dashboard-list-questions .ranking-table strong {
  color: #263746;
  display: -webkit-box;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.dashboard-list-questions .ranking-table small {
  background: #f4f7fb;
  border: 1px solid #dde7f2;
  border-radius: 999px;
  color: #64748b;
  display: inline-flex;
  font-size: 11px;
  margin-top: 8px;
  max-width: 100%;
  padding: 3px 8px;
}

.dashboard-list-questions .ranking-table b,
.dashboard-list-questions .ranking-table em {
  color: #334155;
  font-size: 13px;
  padding-top: 2px;
}

.alert-list strong {
  font-weight: 500;
}

.alert-list small {
  font-weight: 400;
}

.row-card,
.conversation-card,
.dashboard-list article,
.dashboard-log-list article,
.table-list article {
  line-height: 1.42;
}

.row-card small,
.conversation-card small,
.dashboard-list small,
.dashboard-log-list small {
  line-height: 1.38;
}

.admin-flow-access {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: calc(100vh - 112px);
}

.admin-flow-picker {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-flow-controls {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.admin-flow-controls label {
  display: grid;
  gap: 7px;
  color: #34425f;
  font-size: 0.9rem;
  font-weight: 600;
}

.admin-flow-controls select {
  border: 1px solid #d6e0ec;
  border-radius: 10px;
  min-height: 42px;
  padding: 0 12px;
  color: #14213d;
  background: #fff;
}

.admin-flow-selected {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid #d6e8ff;
  border-radius: 12px;
  padding: 12px;
  background: #f7fbff;
}

.admin-flow-selected div {
  display: grid;
  gap: 2px;
}

.admin-flow-selected small {
  color: #60708f;
}

.admin-flow-selected code {
  color: #375075;
  background: #edf4ff;
  border-radius: 999px;
  padding: 5px 9px;
}

.admin-flow-editor-wrap .flow-screen {
  min-height: calc(100vh - 250px);
}

.admin-flow-warning {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 10px 12px;
  color: #174a86;
  background: #eff6ff;
  font-size: 0.92rem;
}

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

.watchdog-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  border-left: 5px solid #16a34a;
}

.watchdog-hero.warning {
  border-left-color: #eab308;
}

.watchdog-hero.danger {
  border-left-color: #ef4444;
}

.watchdog-hero h2 {
  margin: 8px 0 6px;
  font-size: 1.7rem;
}

.watchdog-hero p,
.watchdog-card p {
  margin: 0;
  color: #53627d;
}

.watchdog-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #375075;
  font-weight: 700;
}

.watchdog-score {
  display: grid;
  justify-items: center;
  min-width: 120px;
  border: 1px solid #dbe7f3;
  border-radius: 14px;
  padding: 14px;
  background: #f8fbff;
}

.watchdog-score strong {
  font-size: 2rem;
}

.watchdog-score small {
  color: #64748b;
}

.watchdog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.watchdog-card {
  display: grid;
  gap: 10px;
  border: 1px solid #dbe7f3;
  border-radius: 12px;
  padding: 16px;
  background: #fff;
}

.watchdog-card.ok {
  border-top: 4px solid #16a34a;
}

.watchdog-card.warning {
  border-top: 4px solid #eab308;
}

.watchdog-card.danger {
  border-top: 4px solid #ef4444;
}

.watchdog-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.watchdog-card header span,
.watchdog-card header b {
  font-weight: 750;
}

.watchdog-card small {
  color: #64748b;
}

.watchdog-playbook {
  display: grid;
  gap: 10px;
}

.watchdog-playbook button {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid #d7e1ec;
  border-radius: 10px;
  padding: 11px 12px;
  color: #18243a;
  background: #fff;
  text-align: left;
  font-weight: 650;
}

.watchdog-playbook button:hover {
  border-color: #0f82bd;
  color: #0f82bd;
  background: #f3faff;
}

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

.watchdog-rules {
  display: grid;
  gap: 14px;
}

.watchdog-config-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, auto)) minmax(190px, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid #dbe7f3;
  border-radius: 14px;
  background: #f8fbff;
}

.watchdog-config-bar label,
.watchdog-rule-card label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #334155;
  font-weight: 500;
}

.watchdog-config-bar input[type="number"],
.watchdog-rule-card input[type="number"] {
  width: 72px;
  min-height: 38px;
  border: 1px solid #d7e1ec;
  border-radius: 10px;
  padding: 6px 8px;
  font: inherit;
}

.switch-line input {
  width: 17px;
  height: 17px;
}

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

.watchdog-custom-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.watchdog-custom-actions button {
  min-height: 38px;
  border: 1px solid #cfe0f2;
  border-radius: 10px;
  padding: 0 14px;
  background: #fff;
  color: #174a86;
  font-weight: 500;
}

.watchdog-custom-actions button:hover {
  border-color: #0f82bd;
  background: #f4fbff;
}

.watchdog-config-section {
  display: grid;
  gap: 12px;
  border: 1px solid #dbe7f3;
  border-radius: 14px;
  padding: 14px;
  background: #fff;
}

.watchdog-config-section .panel-title h3 {
  margin: 0;
  font-size: 1rem;
}

.watchdog-metric-list,
.watchdog-button-list {
  display: grid;
  gap: 10px;
}

.watchdog-metric-row,
.watchdog-button-row {
  display: grid;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid #e1eaf4;
  border-radius: 12px;
  background: #f8fbff;
}

.watchdog-metric-row {
  grid-template-columns: auto minmax(150px, 1.2fr) minmax(170px, 1fr) 70px 86px minmax(145px, 1fr) 110px 86px auto;
}

.watchdog-button-row {
  grid-template-columns: auto minmax(170px, 1fr) minmax(150px, 1fr) minmax(150px, 1fr) auto;
}

.watchdog-metric-row input,
.watchdog-metric-row select,
.watchdog-button-row input,
.watchdog-button-row select {
  min-height: 38px;
  border: 1px solid #d7e1ec;
  border-radius: 10px;
  padding: 6px 9px;
  background: #fff;
  font: inherit;
  color: #18243a;
}

.watchdog-metric-row button,
.watchdog-button-row button {
  min-height: 38px;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 0 12px;
  background: #fff;
  color: #b91c1c;
  font-weight: 500;
}

.watchdog-rule-card {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto minmax(210px, 280px);
  gap: 14px;
  align-items: center;
  border: 1px solid #dbe7f3;
  border-left: 4px solid #cbd5e1;
  border-radius: 14px;
  padding: 14px;
  background: #fff;
}

.watchdog-rule-card.enabled {
  border-left-color: #0f82bd;
}

.watchdog-rule-main {
  display: grid;
  gap: 5px;
}

.watchdog-rule-main p,
.watchdog-rule-main small,
.watchdog-rule-status small {
  margin: 0;
  color: #64748b;
  font-size: 0.9rem;
}

.watchdog-rule-status {
  display: grid;
  gap: 7px;
}

.watchdog-rule-status button {
  min-height: 36px;
  border: 1px solid #d7e1ec;
  border-radius: 10px;
  background: #fff;
  color: #18243a;
  font-weight: 500;
}

.watchdog-rule-status button:hover {
  border-color: #0f82bd;
  color: #0f82bd;
}

.watchdog-bottom-grid {
  grid-template-columns: minmax(260px, 1fr) minmax(240px, 0.75fr) minmax(320px, 1.1fr);
}

.watchdog-events .row-card,
.watchdog-incidents .row-card {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.watchdog-panel-v2 .status-pill {
  width: fit-content;
}

.system-health-dashboard {
  display: grid;
  gap: 18px;
}

.system-health-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 18px;
  align-items: center;
  border-left: 5px solid #16a34a;
}

.system-health-hero.warning {
  border-left-color: #eab308;
}

.system-health-hero.danger {
  border-left-color: #ef4444;
}

.system-health-hero h2 {
  margin: 8px 0 6px;
  font-size: 1.7rem;
}

.system-health-hero p {
  margin: 0;
  color: #64748b;
}

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

.system-health-grid {
  grid-template-columns: repeat(3, minmax(260px, 1fr));
}

.system-health-card {
  display: grid;
  gap: 12px;
  align-content: start;
}

.health-kv {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  border: 1px solid #e1eaf4;
  border-radius: 12px;
  padding: 10px 12px;
  background: #f8fbff;
  color: #64748b;
}

.health-kv strong {
  color: #18243a;
  font-weight: 550;
  text-align: right;
}

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

.health-bar > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #64748b;
}

.health-bar strong {
  color: #18243a;
  font-weight: 550;
}

.health-bar i {
  display: block;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5edf5;
}

.health-bar b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #16a34a, #0f82bd);
}

.health-path {
  display: block;
  overflow-wrap: anywhere;
  color: #64748b;
  line-height: 1.45;
}

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

.health-volume-list article {
  display: grid;
  gap: 4px;
  border: 1px solid #e1eaf4;
  border-radius: 12px;
  padding: 10px 12px;
  background: #f8fbff;
  color: #64748b;
}

.health-volume-list strong {
  color: #18243a;
  font-weight: 550;
}

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

.finance-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  border-left: 5px solid #0f82bd;
}

.finance-hero h2 {
  margin: 8px 0 6px;
  font-size: 1.7rem;
}

.finance-hero p {
  margin: 0;
  color: #64748b;
}

.finance-grid {
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
}

.finance-flow,
.finance-actions,
.finance-reminders,
.finance-playbook {
  display: grid;
  gap: 12px;
}

.finance-bars {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  min-height: 210px;
  align-items: end;
}

.finance-bars article {
  display: grid;
  gap: 7px;
  text-align: center;
  color: #64748b;
}

.finance-bars i {
  display: flex;
  height: 130px;
  align-items: end;
  justify-content: center;
  border-radius: 12px;
  background: #f1f7fd;
  overflow: hidden;
}

.finance-bars b {
  display: block;
  width: 100%;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(180deg, #22c55e, #0f82bd);
}

.finance-bars strong {
  color: #18243a;
  font-weight: 550;
  font-size: 0.88rem;
}

.finance-actions article {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid #e1eaf4;
  border-radius: 12px;
  padding: 10px 12px;
  background: #f8fbff;
}

.finance-actions strong,
.finance-table strong {
  font-weight: 600;
}

.finance-actions small,
.finance-table small {
  display: block;
  color: #64748b;
  margin-top: 3px;
}

.finance-actions button,
.finance-row-actions button {
  min-height: 36px;
  border: 1px solid #cfe0f2;
  border-radius: 10px;
  padding: 0 12px;
  background: #fff;
  color: #174a86;
  font-weight: 500;
}

.finance-table-panel {
  overflow: hidden;
}

.finance-table {
  display: grid;
  overflow-x: auto;
}

.finance-table header,
.finance-table article {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) 110px 110px 110px 130px 150px;
  gap: 12px;
  align-items: center;
  min-width: 920px;
  padding: 12px 14px;
  border-bottom: 1px solid #e1eaf4;
}

.finance-table header {
  color: #64748b;
  font-size: 0.88rem;
  background: #f8fbff;
}

.finance-status {
  width: fit-content;
  border-radius: 999px;
  padding: 5px 9px;
  background: #e0f2fe;
  color: #075985;
  font-size: 0.82rem;
  font-weight: 550;
}

.finance-status.overdue {
  background: #fee2e2;
  color: #991b1b;
}

.finance-status.trial {
  background: #fef3c7;
  color: #92400e;
}

.finance-status.paused,
.finance-status.cancelled {
  background: #e5e7eb;
  color: #374151;
}

.finance-row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.finance-modal {
  background: #ffffff;
  border: 1px solid #dbe6f3;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
  color: #17233a;
  display: grid;
  gap: 18px;
  max-height: calc(100vh - 56px);
  max-width: 860px;
  overflow: auto;
  padding: 22px;
  width: min(860px, 96vw);
}

.finance-modal header,
.finance-modal footer {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.finance-modal header h2 {
  font-size: 1.2rem;
  margin: 0;
}

.finance-modal header button,
.finance-modal footer button {
  width: auto;
}

.finance-modal label {
  color: #465674;
  display: grid;
  font-size: 0.92rem;
  gap: 7px;
}

.finance-modal input,
.finance-modal select,
.finance-modal textarea {
  background: #fff;
  border: 1px solid #cfdbe9;
  border-radius: 6px;
  color: #17233a;
  font: inherit;
  min-height: 42px;
  padding: 10px 12px;
  width: 100%;
}

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

.finance-modal .span-2 {
  grid-column: 1 / -1;
}

.finance-modal textarea {
  min-height: 100px;
  resize: vertical;
}

.finance-modal .check-row {
  align-items: center;
  display: flex;
  gap: 8px;
}

.finance-modal .check-row input {
  min-height: auto;
  width: auto;
}

@media (max-width: 1100px) {
  .watchdog-hero,
  .system-health-hero,
  .finance-hero,
  .watchdog-config-bar,
  .watchdog-rule-card,
  .watchdog-bottom-grid,
  .finance-grid,
  .integration-hero-grid,
  .integration-value-grid,
  .system-health-grid,
  .watchdog-metric-row,
  .watchdog-button-row {
    grid-template-columns: 1fr;
  }

  .watchdog-hero-actions,
  .system-health-actions {
    justify-content: flex-start;
  }

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

.status-dot.danger {
  background: #ef4444;
}

.admin-users-panel .row-card {
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
}

.user-permission-modal {
  max-width: 560px;
}

.user-permission-modal header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.user-permission-modal header div {
  display: grid;
  gap: 4px;
}

.user-permission-modal header span {
  color: #64748b;
  font-size: 0.9rem;
}

.user-permission-modal label {
  display: grid;
  gap: 7px;
}

@media (max-width: 1100px) {
  .debug-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1100px) {
  .shell,
  .login-panel,
  .admin-grid,
  .documentation-layout,
  .flow-layout,
  .smart-dashboard-grid,
  .integration-summary-card,
  .integration-card-grid,
  .integration-card-stats,
  .metric-grid,
  .smart-simulator-grid,
  .smart-simulator-options {
    grid-template-columns: 1fr;
  }

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

  .smart-simulator-grid label:nth-of-type(9) {
    grid-column: auto;
  }

  .documentation-index {
    position: static;
  }

  .sidebar {
    height: auto;
    min-height: auto;
    position: static;
  }

  .flow-screen {
    height: auto;
  }

  .canvas-panel {
    height: 620px;
  }

  .menu-modal-grid {
    grid-template-columns: 1fr;
  }

  .flow-test-grid,
  .flow-test-form {
    grid-template-columns: 1fr;
  }
}
/* Multi-flow and multi-WhatsApp controls */
.flow-selector-bar {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(300px, 1.15fr) minmax(260px, 1fr) max-content max-content;
  gap: 16px;
  align-items: start;
  margin-bottom: 14px;
  padding: 16px 18px;
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}

.flow-selector-copy {
  align-self: start;
  padding-right: 8px;
  padding-top: 24px;
}

.flow-selector-bar strong,
.flow-selector-bar span {
  display: block;
}

.flow-selector-bar span {
  margin-top: 3px;
  color: #64748b;
  font-size: 13px;
}

.flow-selector-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.flow-selector-field span {
  margin-top: 0;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.flow-selector-field small {
  color: #64748b;
  font-size: 12px;
  line-height: 1.25;
}

.flow-selector-field input,
.flow-selector-field select {
  width: 100%;
  height: 44px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  padding: 0 12px;
  outline: none;
}

.flow-selector-bar > .primary-button,
.flow-selector-bar > .danger-button {
  align-self: start;
  height: 44px;
  margin-top: 24px;
  white-space: nowrap;
}

.flow-selector-field input:focus,
.flow-selector-field select:focus {
  border-color: #2b83d3;
  box-shadow: 0 0 0 3px rgba(43, 131, 211, 0.14);
}

.flow-selector-bar .danger-button {
  background: #fff;
  border-color: #fecaca;
  color: #b42318;
}

.flow-selector-bar .danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.whatsapp-sessions-panel {
  grid-column: 1 / -1;
}

.whatsapp-session-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.whatsapp-session-card {
  display: grid;
  grid-template-columns: minmax(280px, 1.15fr) minmax(220px, 0.85fr) minmax(220px, 0.85fr) auto;
  gap: 16px;
  align-items: end;
  padding: 16px;
  border: 1px solid #dbe4f0;
  border-radius: 16px;
  background: #f8fafc;
  overflow: hidden;
}

.whatsapp-session-card.active {
  border-color: #1584c6;
  background: #eef8ff;
  box-shadow: inset 3px 0 0 #1584c6;
}

.whatsapp-session-card.connected {
  border-color: #9ce7be;
  background: #f3fff8;
}

.whatsapp-session-card.warning {
  border-color: #fed7aa;
  background: #fffaf1;
}

.whatsapp-session-card.offline {
  border-color: #fecaca;
  background: #fff7f7;
}

.whatsapp-session-card .session-main {
  align-items: center;
  display: flex;
  gap: 12px;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #0f172a;
  text-align: left;
  cursor: pointer;
}

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

.session-copy strong,
.session-copy small,
.session-copy em {
  display: block;
}

.session-copy small,
.session-copy em {
  color: #64748b;
  font-size: 13px;
}

.session-copy em {
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.whatsapp-phone-status {
  align-items: center;
  background: #eef6ff;
  border: 1px solid #cfe0f5;
  border-radius: 16px;
  color: #334155;
  display: inline-flex;
  flex: 0 0 auto;
  height: 46px;
  justify-content: center;
  position: relative;
  width: 46px;
}

.whatsapp-phone-status i {
  border: 2px solid #fff;
  border-radius: 999px;
  bottom: 5px;
  height: 12px;
  position: absolute;
  right: 5px;
  width: 12px;
}

.whatsapp-phone-status.connected {
  background: #dcfce7;
  border-color: #86efac;
  color: #047857;
}

.whatsapp-phone-status.connected i {
  background: #16a34a;
}

.whatsapp-phone-status.warning {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #c2410c;
}

.whatsapp-phone-status.warning i {
  background: #f59e0b;
}

.whatsapp-phone-status.offline {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.whatsapp-phone-status.offline i {
  background: #ef4444;
}

.whatsapp-phone-status.large {
  border-radius: 22px;
  height: 76px;
  width: 76px;
}

.whatsapp-phone-status.large i {
  bottom: 10px;
  height: 16px;
  right: 10px;
  width: 16px;
}

.whatsapp-session-card label,
.new-whatsapp-session label {
  display: grid;
  gap: 7px;
  margin: 0;
  min-width: 0;
}

.whatsapp-session-card select,
.new-whatsapp-session input,
.new-whatsapp-session select {
  min-height: 54px;
  min-width: 0;
  width: 100%;
}

.session-card-actions {
  align-items: end;
  display: flex;
  justify-content: flex-end;
  min-width: 110px;
}

.session-card-actions .danger-button {
  align-items: center;
  display: inline-flex;
  gap: 7px;
  justify-content: center;
  min-height: 54px;
  padding: 9px 12px;
  white-space: nowrap;
  width: auto;
}

.session-card-actions .danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.new-whatsapp-session {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(220px, 0.8fr) minmax(220px, 0.8fr) auto;
  gap: 16px;
  align-items: end;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #e2e8f0;
}

.new-whatsapp-session .primary-button {
  justify-content: center;
  min-height: 54px;
  min-width: 180px;
  width: auto;
}

@media (max-width: 1280px) {
  .whatsapp-session-card,
  .new-whatsapp-session {
    grid-template-columns: minmax(260px, 1fr) minmax(220px, 1fr);
  }

  .session-card-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 900px) {
  .flow-selector-bar,
  .whatsapp-session-card,
  .new-whatsapp-session {
    grid-template-columns: 1fr;
  }
}

/* Flow editor toolbar */
.flow-top .topbar {
  align-items: stretch;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
  padding: 18px 20px;
}

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

.flow-top .topbar h1 {
  font-size: 26px;
  line-height: 1.15;
}

.flow-top .topbar p {
  max-width: none;
}

.flow-top .topbar-actions {
  width: 100%;
}

.flow-top .flow-actions {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  justify-content: flex-start;
  width: 100%;
}

.flow-top .flow-actions button {
  background: #fff;
  border-color: #d8e1ec;
  border-radius: 6px;
  color: #263746;
  flex: 0 0 auto;
  font-size: 14px;
  font-weight: 500;
  min-height: 40px;
  padding: 8px 13px;
  white-space: nowrap;
}

.flow-top .flow-actions .primary-button {
  background: #0f82bd;
  border-color: #0f82bd;
  color: #fff;
}

.flow-top .flow-actions .danger-button {
  background: #fff8f8;
  border-color: #efcaca;
  color: #9f1c1c;
  margin-left: 18px;
  position: relative;
}

.flow-top .flow-actions .danger-button::before {
  background: #dbe4f0;
  content: "";
  height: 24px;
  left: -14px;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
}

@media (max-width: 1180px) {
  .flow-top .flow-actions {
    justify-content: flex-start;
  }

  .flow-top .flow-actions .danger-button {
    margin-left: 0;
  }

  .flow-top .flow-actions .danger-button::before {
    display: none;
  }

  .flow-utility-row {
    grid-template-columns: 1fr;
  }

  .option-style-toggle {
    justify-content: flex-start;
    width: 100%;
  }

  .flow-health {
    justify-self: start;
  }
}

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

.source-pill {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: 13px;
  font-weight: 650;
  min-height: 36px;
  padding: 0 12px;
  white-space: nowrap;
}

.source-pill.ok {
  background: #dcfce7;
  color: #166534;
}

.source-pill.warning {
  background: #fef3c7;
  color: #92400e;
}

.smart-topbar-actions button {
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  min-height: 36px;
  padding: 7px 12px;
  white-space: nowrap;
}

.smart-topbar-actions .secondary-button {
  background: #fff;
  border-color: #cbd5e1;
  color: #172033;
}

.smart-topbar-actions .secondary-button:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.smart-topbar-actions .primary-button {
  background: #0f82bd;
  border-color: #0f82bd;
}

.dashboard-live-grid,
.dashboard-crm-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(280px, 0.7fr) minmax(0, 1.3fr);
}

.live-status-panel,
.crm-summary-panel {
  align-self: start;
}

.live-status-kpis {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 12px 0;
}

.live-status-kpis span {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  display: grid;
  gap: 2px;
  padding: 12px;
}

.live-status-kpis strong {
  color: #0f172a;
  font-size: 24px;
}

.live-status-kpis small {
  color: #64748b;
}

.live-conversation-list,
.crm-contact-list {
  display: grid;
  gap: 8px;
}

.live-conversation-list button,
.crm-contact-list button {
  align-items: center;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  color: #172033;
  cursor: pointer;
  display: grid;
  gap: 10px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding: 11px 12px;
  text-align: left;
}

.live-conversation-list button:hover,
.crm-contact-list button:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.live-conversation-list strong,
.crm-contact-list strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-conversation-list small,
.crm-contact-list small {
  color: #64748b;
  display: block;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-conversation-list em,
.crm-contact-list em {
  color: #64748b;
  font-style: normal;
  font-size: 12px;
}

.avatar-mini {
  align-items: center;
  background: #eef6ff;
  border-radius: 999px;
  color: #0f82bd;
  display: inline-flex;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.site-editor-shell {
  display: grid;
  gap: 16px;
}

.site-editor-heading {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
}

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

.site-editor-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(420px, 0.95fr) minmax(420px, 1.05fr);
}

.site-editor-panel,
.site-preview-panel {
  align-self: start;
}

.site-editor-fields {
  display: grid;
  gap: 12px;
}

.site-editor-fields input[type="text"],
.site-editor-fields input:not([type]),
.site-editor-fields textarea,
.site-editor-fields select {
  font-weight: 500;
}

.site-color-row,
.site-two-cols {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.site-two-cols {
  grid-template-columns: 0.85fr 1.15fr;
}

.site-color-row input[type="color"] {
  cursor: pointer;
  height: 42px;
  padding: 4px;
}

.site-add-blocks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.site-section-list {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.site-section-card {
  background: #f8fbff;
  border: 1px solid #dbe6f4;
  border-radius: 14px;
  padding: 0;
}

.site-section-card summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  list-style: none;
  padding: 13px 14px;
}

.site-section-card summary::-webkit-details-marker {
  display: none;
}

.site-section-card summary span {
  align-items: center;
  color: #172033;
  display: inline-flex;
  gap: 8px;
  font-weight: 650;
}

.site-section-card summary small {
  color: #64748b;
}

.site-section-card[open] {
  background: #fff;
}

.site-section-card[open] .site-editor-fields,
.site-section-card[open] .site-section-tools {
  padding: 0 14px 14px;
}

.site-section-tools {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.site-mini-list article {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  display: grid;
  gap: 8px;
  padding: 10px;
}

.site-preview {
  --preview-accent: #1288c8;
  background:
    radial-gradient(circle at 12% 12%, rgba(18, 136, 200, 0.14), transparent 30%),
    linear-gradient(180deg, #f8fbff, #edf8f2);
  border: 1px solid #dbe6f4;
  border-radius: 18px;
  color: #172033;
  max-height: 780px;
  overflow: auto;
  padding: 18px;
}

.site-preview header {
  align-items: center;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 12px 14px;
}

.site-preview header span {
  font-weight: 700;
}

.site-preview header nav,
.site-preview p,
.site-preview small,
.site-preview figcaption {
  color: #64748b;
}

.preview-hero,
.preview-metrics,
.preview-cards,
.preview-screens,
.preview-trial {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  margin-bottom: 14px;
  padding: 18px;
}

.preview-hero {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 0.95fr) minmax(190px, 1.05fr);
}

.preview-hero h1,
.preview-cards h2,
.preview-screens h2,
.preview-trial h2 {
  font-size: 24px;
  line-height: 1.12;
  margin: 8px 0;
}

.preview-hero span,
.preview-trial button {
  background: var(--preview-accent);
  border: 0;
  border-radius: 9px;
  color: #fff;
  display: inline-flex;
  margin-top: 8px;
  padding: 10px 14px;
}

.preview-hero img {
  aspect-ratio: 16 / 10;
  border-radius: 14px;
  object-fit: cover;
  width: 100%;
}

.preview-metrics,
.preview-cards div,
.preview-screens div {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.preview-metrics article,
.preview-cards article,
.preview-screens figure {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin: 0;
  padding: 12px;
}

.preview-metrics strong {
  color: var(--preview-accent);
  display: block;
  font-size: 22px;
}

.preview-cards strong {
  display: block;
  margin-bottom: 4px;
}

.preview-screens img {
  aspect-ratio: 16 / 10;
  border-radius: 10px;
  object-fit: cover;
  width: 100%;
}

.engine-rules-panel {
  gap: 22px;
}

.field-help {
  color: #66758c;
  display: block;
  font-size: 12px;
  line-height: 1.45;
  margin-top: 7px;
}

.ai-cost-empty {
  color: #66758c;
  font-size: 13px;
  margin: 10px 0 0;
}

.engine-rule-note {
  align-items: center;
  background: linear-gradient(135deg, #eef8ff, #f8fbff);
  border: 1px solid #cfe2f2;
  border-radius: 16px;
  display: grid;
  gap: 6px 14px;
  grid-template-columns: 112px minmax(0, 1fr);
  padding: 16px 18px;
}

.engine-rule-note span,
.engine-rule-note small {
  color: #66758c;
  font-size: 12px;
}

.engine-rule-note strong {
  color: #26394f;
  font-size: 15px;
  font-weight: 600;
}

.engine-rule-note small {
  grid-column: 2;
}

.engine-rules-panel > .hint-text {
  background: #fbfdff;
  border: 1px solid #e3ebf5;
  border-radius: 14px;
  color: #53657f;
  margin: -4px 0 0;
  padding: 12px 14px;
}

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

.preset-grid button {
  align-items: flex-start;
  background: #f8fbff;
  border: 1px solid #dbe7f3;
  border-radius: 16px;
  color: #26394f;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 118px;
  padding: 16px;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.preset-grid button:hover {
  border-color: #72b7dd;
  box-shadow: 0 10px 24px rgba(19, 129, 184, 0.1);
  transform: translateY(-1px);
}

.preset-grid button.active {
  background: linear-gradient(135deg, #eef8ff, #ffffff);
  border-color: #1591cf;
  box-shadow: inset 0 0 0 1px rgba(21, 145, 207, 0.2), 0 12px 28px rgba(21, 145, 207, 0.1);
}

.preset-grid strong {
  color: #112236;
  font-size: 15px;
  font-weight: 700;
}

.preset-grid span {
  color: #627188;
  font-size: 13px;
  line-height: 1.45;
}

.engine-preset-summary {
  background: #f7fbff;
  border: 1px solid #dbe7f3;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin: 12px 0 16px;
  padding: 12px;
}

.engine-preset-summary span {
  display: grid;
  gap: 4px;
}

.engine-preset-summary strong {
  color: #66758c;
  font-size: 12px;
  font-weight: 700;
}

.engine-preset-summary b {
  color: #102033;
  font-size: 15px;
}

.engine-rules-panel .settings-grid.two-columns {
  align-items: stretch;
  gap: 14px;
}

.engine-rules-panel .engine-toggle {
  align-items: flex-start;
  background: #ffffff;
  border: 1px solid #dbe7f3;
  border-radius: 16px;
  gap: 12px;
  min-height: 94px;
  padding: 14px;
}

.engine-rules-panel .engine-toggle input {
  flex: 0 0 auto;
  margin-top: 3px;
}

.engine-rules-panel .engine-toggle span {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.engine-rules-panel .engine-toggle strong {
  color: #172033;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
}

.engine-rules-panel .engine-toggle small {
  color: #64748b;
  font-size: 12.5px;
  line-height: 1.42;
}

.engine-rules-panel .engine-number-field {
  background: #f8fbff;
  border: 1px solid #dbe7f3;
  border-radius: 16px;
  display: grid;
  gap: 9px;
  padding: 14px;
}

.engine-rules-panel .engine-number-field input {
  background: #ffffff;
}

.engine-flow-preview {
  background: #f8fbff;
  border: 1px solid #dbe7f3;
  border-radius: 18px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 14px;
}

.engine-flow-preview span {
  background: linear-gradient(180deg, #ffffff, #f6fbff);
  border: 1px solid #dbe7f3;
  border-radius: 999px;
  color: #41516a;
  font-size: 13px;
  line-height: 1.25;
  padding: 11px 12px;
  position: relative;
  text-align: center;
}

.engine-flow-preview span:not(:last-child)::after {
  color: #8aa0ba;
  content: ">";
  font-weight: 600;
  position: absolute;
  right: -12px;
  top: 50%;
  transform: translate(50%, -50%);
}

.confidence-presets {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.confidence-presets button {
  background: #ffffff;
  border: 1px solid #dbe7f3;
  border-radius: 999px;
  color: #31445f;
  cursor: pointer;
  font-size: 12px;
  padding: 8px 11px;
}

.confidence-presets button:hover {
  border-color: #1591cf;
  color: #137fb2;
}

.engine-metric-guide {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.engine-metric-guide span {
  background: #f8fbff;
  border: 1px solid #dbe7f3;
  border-radius: 16px;
  display: block;
  padding: 14px;
}

.engine-metric-guide strong {
  color: #26394f;
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.engine-metric-guide small {
  color: #66758c;
  display: block;
  line-height: 1.45;
}

.risk-stat-grid {
  grid-template-columns: repeat(3, minmax(86px, 1fr));
}

.risk-stat-grid span {
  min-width: 0;
}

.risk-stat-grid small {
  font-size: 11px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

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

.integration-card-actions button {
  flex: 1 1 120px;
}

.woocommerce-dashboard-card {
  grid-column: 1 / -1;
}

.conversation-dashboard {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin-bottom: 14px;
}

.conversation-kpi {
  min-height: 118px;
}

.conversation-kpi span,
.conversation-kpi small {
  color: #66758c;
}

.conversation-kpi strong {
  color: #102033;
  display: block;
  font-size: 30px;
  font-weight: 650;
  margin: 10px 0 2px;
}

.conversation-token-note {
  background: #f5f8fc;
  border: 1px solid #dce7f4;
  border-radius: 12px;
  color: #64748b;
  font-size: 13px;
  margin-top: 12px;
  padding: 10px 12px;
}

.conversation-token-note.used {
  background: #eefaf6;
  border-color: #bdebdc;
  color: #08745b;
}

.conversation-token-note.warning,
.conversation-phone-warning {
  background: #fff8e6;
  border-color: #f3d18b;
  color: #8a5a00;
}

.conversation-phone-warning {
  border: 1px solid #f3d18b;
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  padding: 4px 8px;
}

.conversation-toolbar {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(260px, 1fr) 220px auto;
  margin-bottom: 14px;
}

.conversation-toolbar label {
  align-items: center;
  display: flex;
  gap: 8px;
  margin: 0;
}

.conversation-toolbar input,
.conversation-toolbar select {
  width: 100%;
}

.conversation-card {
  cursor: pointer;
}

.conversation-detail-modal {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(15, 35, 55, 0.2);
  max-height: min(860px, 94vh);
  max-width: 1180px;
  overflow: hidden;
  padding: 0;
  width: min(1180px, 96vw);
}

.conversation-detail-header {
  align-items: center;
  border-bottom: 1px solid #dde8f3;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
}

.conversation-detail-person {
  align-items: center;
  display: flex;
  gap: 14px;
  min-width: 0;
}

.conversation-detail-header > div:first-child:not(.conversation-detail-header-actions) {
  min-width: 0;
}

.conversation-detail-avatar {
  align-items: center;
  background: #e8f6fb;
  border-radius: 16px;
  color: #1488bd;
  display: flex;
  flex: 0 0 48px;
  font-size: 22px;
  height: 48px;
  justify-content: center;
  width: 48px;
}

.conversation-detail-header > div:first-child span,
.conversation-detail-header > div:first-child small,
.conversation-detail-person span,
.conversation-detail-person small,
.conversation-history-top small,
.conversation-history-top span {
  color: #66758c;
}

.conversation-detail-header > div:first-child h2,
.conversation-detail-person h2 {
  font-size: 22px;
  margin: 2px 0;
}

.conversation-detail-header-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.conversation-detail-header > button,
.conversation-detail-header-actions button {
  background: #fff;
  border: 1px solid #cfdae8;
  border-radius: 10px;
  color: #27364a;
  padding: 10px 14px;
}

.conversation-status {
  border-radius: 999px;
  font-size: 13px;
  padding: 7px 11px;
}

.conversation-status.bot {
  background: #e8f8ef;
  color: #0d7d45;
}

.conversation-status.human {
  background: #fff4de;
  color: #9a5a00;
}

.conversation-detail-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  min-height: 560px;
}

.conversation-history-panel {
  background: linear-gradient(180deg, #f7fbff 0%, #f3f7fb 100%);
  border-right: 1px solid #dde8f3;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.conversation-history-top {
  align-items: center;
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid #dde8f3;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
}

.conversation-history-top strong {
  display: block;
  font-size: 16px;
}

.conversation-timeline {
  background:
    linear-gradient(rgba(247, 251, 255, 0.9), rgba(247, 251, 255, 0.9)),
    radial-gradient(circle at 12px 12px, rgba(148, 163, 184, 0.16) 1px, transparent 1px);
  background-size: auto, 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-height: 660px;
  overflow: auto;
  padding: 18px;
}

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

.conversation-message-row {
  display: flex;
  width: 100%;
}

.conversation-message-row.incoming {
  justify-content: flex-start;
}

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

.conversation-message-row.system {
  justify-content: center;
}

.conversation-timeline-time {
  color: #728098;
  font-size: 12px;
  text-align: center;
}

.conversation-timeline-messages {
  display: grid;
  gap: 8px;
}

.chat-bubble {
  border: 1px solid #dbe7f3;
  border-radius: 14px;
  max-width: 78%;
  padding: 11px 13px;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-bubble small {
  color: #66758c;
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
}

.chat-bubble p {
  margin: 0;
}

.chat-bubble em {
  color: #75849a;
  display: block;
  font-size: 11px;
  font-style: normal;
  margin-top: 7px;
  text-align: right;
}

.chat-bubble.customer {
  background: #fff;
  justify-self: start;
}

.chat-bubble.bot {
  background: #e8f6fb;
  border-color: #c4e4f1;
  justify-self: end;
}

.chat-bubble.bot.ai {
  background: #eef7ff;
  border-color: #bedcf5;
}

.chat-bubble.system {
  background: #f4f6f8;
  border-style: dashed;
  justify-self: center;
  text-align: center;
}

.chat-token-chip {
  background: rgba(15, 130, 189, 0.1);
  border-radius: 999px;
  color: #0f638f;
  display: inline-flex;
  font-size: 11px;
  margin-top: 6px;
  padding: 3px 8px;
}

.conversation-event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.conversation-event-meta span {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid #dbe7f3;
  border-radius: 999px;
  color: #66758c;
  font-size: 12px;
  padding: 4px 8px;
}

.conversation-detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 720px;
  overflow: auto;
  padding: 18px;
}

.conversation-detail-sidebar h3 {
  font-size: 15px;
  margin: 0 0 10px;
}

.conversation-detail-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 18px 22px;
}

.conversation-detail-grid.compact {
  padding: 0;
}

.conversation-detail-grid article {
  background: #f8fbff;
  border: 1px solid #dbe7f3;
  border-radius: 12px;
  padding: 14px;
}

.conversation-detail-grid small {
  color: #66758c;
}

.conversation-detail-grid p {
  color: #102033;
  margin: 6px 0 0;
}

.conversation-detail-modal .decision-trace,
.conversation-detail-modal .context-pills,
.conversation-detail-modal .conversation-token-note {
  margin: 0;
}

.conversation-modal-actions {
  display: grid;
  gap: 8px;
}

.conversation-modal-actions button,
.conversation-detail-modal .menu-modal-footer button {
  justify-content: center;
  width: 100%;
}

.conversation-loading,
.conversation-empty-history {
  align-items: center;
  color: #66758c;
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
  min-height: 220px;
  text-align: center;
}

.team-user-modal {
  max-width: 760px;
}

.live-support-kpis {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 14px;
}

.live-kpi {
  align-items: center;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  padding: 18px;
}

.live-kpi svg {
  background: #eaf6fb;
  border-radius: 14px;
  color: #1488bd;
  height: 44px;
  padding: 10px;
  width: 44px;
}

.live-kpi span {
  color: #66758c;
}

.live-kpi strong {
  color: #102033;
  font-size: 26px;
  font-weight: 620;
}

.live-sla-strip {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 14px;
}

.sla-filter {
  align-items: center;
  background: #ffffff;
  border: 1px solid #dfe9f4;
  border-radius: 12px;
  color: #26364d;
  cursor: pointer;
  display: grid;
  gap: 8px;
  grid-template-columns: auto 1fr auto;
  padding: 12px 14px;
  text-align: left;
}

.sla-filter span {
  border-radius: 999px;
  height: 10px;
  width: 10px;
}

.sla-filter strong {
  font-size: 18px;
  font-weight: 620;
}

.sla-filter.green span,
.sla-pill.green,
.sla-bar.green {
  background: #20b36b;
}

.sla-filter.yellow span,
.sla-pill.yellow,
.sla-bar.yellow {
  background: #f2b84b;
}

.sla-filter.red span,
.sla-pill.red,
.sla-bar.red {
  background: #df4b4b;
}

.sla-filter.green.active {
  border-color: #20b36b;
  box-shadow: 0 8px 20px rgba(32, 179, 107, 0.12);
}

.sla-filter.yellow.active {
  border-color: #f2b84b;
  box-shadow: 0 8px 20px rgba(242, 184, 75, 0.14);
}

.sla-filter.red.active {
  border-color: #df4b4b;
  box-shadow: 0 8px 20px rgba(223, 75, 75, 0.14);
}

.live-routing-panel {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 300px 1fr;
  margin-bottom: 14px;
  padding: 14px 16px;
}

.live-routing-panel strong {
  color: #102033;
  display: block;
  font-weight: 620;
}

.live-routing-panel span,
.live-routing-panel p {
  color: #66758c;
  margin: 0;
}

.live-support-shell {
  display: grid;
  align-items: stretch;
  gap: 16px;
  grid-template-columns: minmax(280px, 320px) minmax(520px, 1fr) minmax(280px, 320px);
  height: min(760px, calc(100vh - 250px));
  min-height: 620px;
}

body.live-operator-active {
  overflow: hidden;
}

.live-support-shell.operator-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1800;
  grid-template-columns: minmax(300px, 380px) minmax(540px, 1fr) minmax(320px, 380px);
  gap: 12px;
  min-height: 0;
  padding: 12px;
  background:
    radial-gradient(circle at 18% 0%, rgba(24, 144, 255, 0.14), transparent 34vw),
    linear-gradient(135deg, #f7fbff 0%, #eef6fb 52%, #f8fafc 100%);
  overflow: hidden;
}

.live-support-shell.operator-fullscreen .live-queue,
.live-support-shell.operator-fullscreen .live-chat,
.live-support-shell.operator-fullscreen .live-customer {
  height: calc(100vh - 24px);
  min-height: 0;
  overflow: hidden;
}

.live-support-shell.operator-fullscreen .live-queue,
.live-support-shell.operator-fullscreen .live-chat,
.live-support-shell.operator-fullscreen .live-customer {
  display: flex;
  flex-direction: column;
}

.live-support-shell.operator-fullscreen .live-queue-list,
.live-support-shell.operator-fullscreen .live-transcript,
.live-support-shell.operator-fullscreen .live-customer {
  max-height: none;
  min-height: 0;
  overflow: auto;
}

.live-support-shell.operator-fullscreen .live-transcript {
  flex: 1 1 auto;
}

.live-queue,
.live-chat,
.live-customer {
  min-height: 0;
}

.live-queue {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.live-search {
  align-items: center;
  border: 1px solid #d9e5f1;
  border-radius: 10px;
  display: flex;
  gap: 8px;
  margin: 12px 0;
  padding: 10px 12px;
}

.live-search input {
  border: 0;
  flex: 1;
  outline: 0;
}

.live-filter-row {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.live-filter-row button {
  background: #f5f8fc;
  border: 1px solid #dce7f2;
  border-radius: 999px;
  color: #41516a;
  cursor: pointer;
  padding: 7px 10px;
}

.live-filter-row button.active {
  background: #eaf6fb;
  border-color: #9bd4ee;
  color: #0e6f9c;
}

.live-queue-list {
  flex: 1 1 auto;
  display: grid;
  gap: 10px;
  max-height: none;
  overflow: auto;
  padding: 0 4px 4px 0;
}

.live-queue-card {
  background: #ffffff;
  border: 1px solid #dfe9f4;
  border-radius: 12px;
  cursor: pointer;
  display: grid;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
  padding: 12px 12px 14px 34px;
  position: relative;
  text-align: left;
}

.live-queue-card.sla-red {
  border-color: #f4b5b5;
}

.live-queue-card.sla-yellow {
  border-color: #f4d998;
}

.live-queue-card.active {
  border-color: #1488bd;
  box-shadow: 0 10px 24px rgba(20, 136, 189, 0.12);
}

.live-queue-card strong {
  color: #102033;
  font-weight: 580;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-queue-card small,
.live-queue-card em {
  color: #66758c;
  font-style: normal;
}

.live-queue-card p {
  color: #41516a;
  display: -webkit-box;
  font-size: 14px;
  line-height: 1.35;
  margin: 4px 0;
  max-height: 3.8em;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow-wrap: anywhere;
}

.support-priority {
  border-radius: 999px;
  color: #41516a;
  font-size: 12px;
  justify-self: start;
  padding: 3px 8px;
}

.support-priority.low {
  background: #eef4fb;
}

.support-priority.normal {
  background: #effbf5;
  color: #16724b;
}

.support-priority.high {
  background: #fff8e6;
  color: #9a6700;
}

.support-priority.urgent {
  background: #fff0f0;
  color: #b42318;
}

.sla-bar {
  border-radius: 999px;
  bottom: 0;
  height: 4px;
  left: 12px;
  position: absolute;
  right: 12px;
}

.live-card-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
}

.live-card-meta span {
  align-items: center;
  color: #66758c;
  display: inline-flex;
  gap: 4px;
  min-width: 0;
}

.sla-pill {
  border-radius: 999px;
  color: #ffffff !important;
  font-size: 12px;
  max-width: 100%;
  overflow: hidden;
  padding: 4px 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.support-dot {
  background: #f2b84b;
  border-radius: 999px;
  height: 10px;
  left: 14px;
  position: absolute;
  top: 17px;
  width: 10px;
}

.support-dot.in_progress {
  background: #1488bd;
}

.support-dot.pending_customer,
.support-dot.pending_internal {
  background: #f59e0b;
}

.support-dot.resolved {
  background: #20b36b;
}

.support-dot.unresolved {
  background: #df4b4b;
}

.empty-live-queue {
  align-items: center;
  color: #66758c;
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 40px 16px;
  text-align: center;
}

.live-chat {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  overflow: hidden;
  padding: 0;
}

.live-sla-banner {
  align-items: center;
  border-bottom: 1px solid #dfe9f4;
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto auto;
  padding: 12px 18px;
}

.live-sla-banner.green {
  background: #effbf5;
}

.live-sla-banner.yellow {
  background: #fff8e6;
}

.live-sla-banner.red {
  background: #fff0f0;
}

.live-sla-banner span {
  color: #26364d;
}

.live-sla-banner strong {
  font-weight: 620;
}

.live-sla-banner small {
  color: #66758c;
}

.live-chat-header {
  align-items: center;
  border-bottom: 1px solid #dfe9f4;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 16px 18px;
}

.live-chat-header strong {
  display: block;
  font-size: 18px;
  font-weight: 620;
}

.live-chat-header span {
  color: #66758c;
}

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

.live-chat-actions button,
.live-notes button {
  align-items: center;
  background: #ffffff;
  border: 1px solid #d9e5f1;
  border-radius: 8px;
  color: #26364d;
  cursor: pointer;
  display: inline-flex;
  gap: 6px;
  padding: 9px 11px;
}

.live-transcript {
  background: linear-gradient(180deg, #f8fbff, #ffffff);
  display: grid;
  align-content: start;
  gap: 12px;
  max-height: none;
  min-height: 0;
  overflow: auto;
  padding: 18px;
}

.live-message {
  border-radius: 14px;
  max-width: 78%;
  padding: 12px 14px;
}

.live-message small {
  color: #66758c;
  display: block;
  margin-bottom: 6px;
}

.live-message p {
  color: #102033;
  margin: 0;
  white-space: pre-wrap;
}

.live-message.system {
  background: #eef4fb;
}

.live-message.note {
  background: #fff7db;
  justify-self: center;
  max-width: 88%;
}

.live-message.outgoing {
  background: #dcf8e8;
  justify-self: end;
}

.live-reply-box {
  align-items: end;
  background: #ffffff;
  border-top: 1px solid #dfe9f4;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr auto;
  padding: 14px 18px;
}

.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  grid-column: 1 / -1;
}

.quick-replies button {
  background: #f8fbff;
  border: 1px solid #d9e5f1;
  border-radius: 999px;
  color: #41516a;
  cursor: pointer;
  padding: 7px 10px;
}

.quick-replies button:hover {
  background: #eaf6fb;
  border-color: #9bd4ee;
  color: #0e6f9c;
}

.live-reply-box small {
  color: #66758c;
  grid-column: 1 / -1;
}

.live-reply-box textarea,
.live-notes textarea {
  border: 1px solid #d9e5f1;
  border-radius: 10px;
  min-height: 74px;
  padding: 12px;
  resize: vertical;
}

.live-customer {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  overflow: auto;
}

.live-customer label {
  color: #41516a;
  display: grid;
  gap: 6px;
}

.live-customer select {
  border: 1px solid #d9e5f1;
  border-radius: 10px;
  padding: 10px;
}

.live-customer-card,
.live-context,
.live-notes {
  background: #f8fbff;
  border: 1px solid #dfe9f4;
  border-radius: 12px;
  display: grid;
  gap: 7px;
  padding: 14px;
}

.live-customer-card strong,
.live-context strong,
.live-notes strong {
  font-weight: 600;
}

.live-customer-card span,
.live-customer-card small,
.live-context small,
.live-notes small {
  color: #66758c;
}

.live-context code {
  background: #eef4fb;
  border-radius: 8px;
  color: #26364d;
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 7px 8px;
}

.live-notes p {
  background: #ffffff;
  border: 1px solid #e2ebf5;
  border-radius: 9px;
  color: #26364d;
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 9px;
}

@media (max-width: 900px) {
  .conversation-dashboard,
  .conversation-toolbar,
  .conversation-detail-grid,
  .conversation-detail-body,
  .live-support-kpis,
  .live-support-shell {
    grid-template-columns: 1fr;
  }

  .conversation-detail-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .conversation-detail-header-actions {
    width: 100%;
  }

  .conversation-detail-header-actions button {
    flex: 1;
  }

  .conversation-history-panel {
    border-right: 0;
  }

  .conversation-timeline,
  .conversation-detail-sidebar {
    max-height: none;
  }

  .chat-bubble {
    max-width: 92%;
  }

  .live-queue,
  .live-chat,
  .live-customer {
    min-height: auto;
  }

  .live-support-shell.operator-fullscreen {
    grid-template-columns: minmax(280px, 1fr);
    overflow: auto;
  }

  .live-support-shell.operator-fullscreen .live-queue,
  .live-support-shell.operator-fullscreen .live-chat,
  .live-support-shell.operator-fullscreen .live-customer {
    height: auto;
    min-height: 360px;
  }
}

.bot-signal-list span {
  background: #f8fbff;
}

.bot-signal-list strong {
  font-weight: 600;
}

/* Premium polish: softer visual weight and consistent controls. */
.panel h2,
.topbar h1,
.finance-hero h2,
.smart-dashboard-card h3,
.integration-health-card h3 {
  font-weight: 650;
  letter-spacing: 0;
}

.panel strong,
.dashboard-list strong,
.dashboard-log-list strong,
.ranking-table strong,
.smart-status-list strong,
.smart-event-list strong,
.integration-health-card strong,
.finance-table strong,
.finance-actions strong,
.bot-signal-list strong {
  font-weight: 550;
}

.panel b,
.metric-card b,
.kpi-card b,
.smart-dashboard-card b {
  font-weight: 600;
}

.primary-button,
.secondary-button,
.ghost-button,
.toolbar button,
.flow-toolbar button,
.finance-row-actions button,
.finance-actions button,
.alert-list button {
  border-radius: 8px;
  font-weight: 500;
}

.primary-button {
  background: #1488bd;
  box-shadow: 0 8px 18px rgba(20, 136, 189, 0.12);
}

.primary-button:hover {
  background: #0f78ab;
}

.upload-button-like {
  align-items: center;
  cursor: pointer;
  display: inline-flex;
  gap: 8px;
  justify-content: center;
}

.upload-button-like input {
  display: none;
}

.integration-test-result {
  border: 1px solid #dbe8f6;
  border-radius: 10px;
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  background: #f8fbff;
  color: #41516a;
}

.integration-test-result strong {
  color: #17233a;
  font-weight: 600;
}

.integration-test-result span,
.integration-test-result small {
  color: #64748b;
}

.integration-test-result.success {
  background: #effcf5;
  border-color: #bfe9cf;
}

.integration-test-result.success strong {
  color: #157347;
}

.integration-test-result.error {
  background: #fff3f3;
  border-color: #f2c3c3;
}

.integration-test-result.error strong {
  color: #b42318;
}

.panel,
.smart-dashboard-card,
.integration-health-card,
.finance-table article,
.alert-list button {
  border-color: #dbe6f3;
}

.hint-text,
.panel-title span,
.source-pill,
.dashboard-list small,
.dashboard-log-list small {
  line-height: 1.45;
}

@media (max-width: 980px) {
  .dashboard-live-grid,
  .dashboard-crm-grid,
  .site-editor-grid {
    grid-template-columns: 1fr;
  }

  .site-editor-heading,
  .site-editor-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .preview-hero,
  .preview-metrics,
  .preview-cards div,
  .preview-screens div,
  .site-color-row,
  .site-two-cols {
    grid-template-columns: 1fr;
  }

  .preset-grid,
  .engine-flow-preview,
  .database-status-grid,
  .database-latest-grid {
    grid-template-columns: 1fr;
  }

  .engine-flow-preview span:not(:last-child)::after {
    content: "";
  }

  .engine-rule-note {
    grid-template-columns: 1fr;
  }

  .engine-rule-note small {
    grid-column: auto;
  }

  .database-comparison-table {
    grid-template-columns: minmax(120px, 1.3fr) repeat(4, minmax(68px, 0.8fr));
    overflow-x: auto;
  }

  .database-diff-details {
    grid-template-columns: 1fr;
  }
}

.whatsapp-stability-panel {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(248, 251, 255, 0.86);
}

.panel-title.compact {
  margin-bottom: 12px;
}

.panel-title.compact h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
  color: var(--ink);
}

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

.whatsapp-stability-grid span {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.whatsapp-stability-grid small,
.whatsapp-stability-grid b {
  display: block;
}

.whatsapp-stability-grid small {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.whatsapp-stability-grid b {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
}

@media (max-width: 960px) {
  .whatsapp-stability-grid {
    grid-template-columns: 1fr;
  }
}

/* Responsive safety layer
   Keeps the SaaS usable on 14-inch notebooks, tablets and phones without
   changing the desktop layout that is already working in production. */
@media (max-width: 1366px) {
  .shell {
    grid-template-columns: 224px minmax(0, 1fr);
  }

  .sidebar {
    gap: 18px;
    padding: 18px 12px;
  }

  .sidebar nav a,
  .sidebar nav button {
    font-size: 0.92rem;
    min-height: 40px;
    padding: 9px 10px;
  }

  .topbar {
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
  }

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

  .metric-grid,
  .admin-metric-grid,
  .trial-center-metrics,
  .smart-history-kpis,
  .integration-health-grid,
  .smart-dashboard-metrics,
  .finance-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-grid,
  .bot-health-grid,
  .smart-dashboard-grid,
  .integrations-overview-grid,
  .smart-history-grid,
  .meta-cost-explain,
  .conversation-dashboard-grid,
  .live-support-grid,
  .woocommerce-dashboard-grid,
  .watchdog-dashboard-grid,
  .backup-dashboard-grid,
  .financial-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .smart-template-layout,
  .meta-template-layout,
  .qr-template-layout,
  .integration-layout,
  .flow-header-row,
  .conversation-detail-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .panel,
  .metric {
    min-width: 0;
  }
}

@media (max-width: 1180px) {
  .topbar {
    flex-direction: column;
  }

  .topbar > div,
  .topbar .smart-topbar-actions,
  .topbar-actions,
  .smart-topbar-actions,
  .flow-toolbar,
  .toolbar,
  .queue-actions,
  .form-actions,
  .integration-actions {
    flex-wrap: wrap;
    max-width: 100%;
  }

  .topbar .smart-topbar-actions button,
  .topbar-actions button,
  .flow-toolbar button,
  .toolbar button {
    min-height: 40px;
  }

  .trial-table,
  .finance-table,
  .database-comparison-table,
  .smart-history-results,
  .queue-groups,
  .conversation-table,
  .admin-table {
    overflow-x: auto;
  }

  .trial-table header,
  .trial-table article {
    min-width: 760px;
  }

  .flow-board-shell,
  .flow-canvas-wrap,
  .flow-workspace,
  .canvas-shell {
    min-height: 62vh;
  }
}

@media (max-width: 900px) {
  body {
    background: linear-gradient(180deg, #f6f9ff 0%, #edf6fb 100%);
  }

  .shell {
    display: block;
  }

  .sidebar {
    border-bottom: 1px solid rgba(219, 228, 240, 0.9);
    border-right: 0;
    box-shadow: 0 10px 24px rgba(16, 24, 40, 0.06);
    height: auto;
    padding: 12px;
    position: sticky;
    top: 0;
    z-index: 40;
  }

  .sidebar nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .sidebar nav a,
  .sidebar nav button {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .sidebar-footer {
    display: none;
  }

  .main,
  main,
  .content,
  .app-main {
    min-width: 0;
    padding: 12px;
  }

  .topbar {
    border-radius: 16px;
    margin-bottom: 14px;
  }

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

  .metric-grid,
  .admin-metric-grid,
  .trial-center-metrics,
  .smart-history-kpis,
  .integration-health-grid,
  .smart-dashboard-metrics,
  .finance-metric-grid,
  .bot-health-summary,
  .whatsapp-stability-grid {
    grid-template-columns: 1fr;
  }

  .panel,
  .metric {
    border-radius: 14px;
    box-shadow: 0 10px 24px rgba(16, 24, 40, 0.075);
  }

  .profile-modal,
  .target-picker-modal,
  .restore-progress-modal,
  .modal,
  .dialog {
    max-height: calc(100dvh - 24px);
    max-width: calc(100vw - 24px);
    overflow: auto;
    width: calc(100vw - 24px);
  }

  .menu-modal-title,
  .menu-modal-footer,
  .profile-modal .menu-modal-footer {
    flex-wrap: wrap;
    gap: 10px;
  }

  .meta-phone-preview,
  .qr-phone-preview,
  .phone-preview {
    margin-inline: auto;
    max-width: min(330px, 100%);
  }
}

@media (max-width: 640px) {
  .toast-stack {
    left: 10px;
    right: 10px;
    top: 10px;
    width: auto;
  }

  .topbar {
    padding: 14px;
  }

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

  .topbar p,
  .hint-text,
  .panel-title span {
    font-size: 0.92rem;
  }

  .panel,
  .metric,
  .whatsapp-stability-panel {
    padding: 14px;
  }

  .primary-button,
  .secondary-button,
  .ghost-button,
  .danger-button,
  .topbar button,
  .form-actions button,
  .queue-actions button {
    justify-content: center;
    min-height: 42px;
    width: 100%;
  }

  .form-actions,
  .queue-actions,
  .bot-health-actions,
  .trial-actions,
  .smart-topbar-actions,
  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  label,
  input,
  select,
  textarea {
    max-width: 100%;
  }

  .trial-email-test,
  .smart-simulator-grid,
  .smart-sandbox-grid,
  .integration-form-grid,
  .woocommerce-form-grid,
  .meta-template-grid,
  .backup-form-grid,
  .engine-settings-grid,
  .team-form-grid {
    grid-template-columns: 1fr;
  }

  .smart-history-list article,
  .queue-row,
  .meta-optin-row,
  .conversation-row,
  .dashboard-log-list article {
    grid-template-columns: 1fr;
  }

  .queue-side,
  .meta-optin-actions,
  .history-event-main,
  .panel-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .flow-toolbar,
  .flow-mode-row,
  .flow-search-row {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr;
  }

  .flow-board-shell,
  .flow-canvas-wrap,
  .flow-workspace,
  .canvas-shell {
    min-height: 68vh;
    overflow: auto;
  }

  .flow-node,
  .chatbot-node {
    max-width: calc(100vw - 48px);
  }

  .smart-history-kpis strong,
  .metric strong {
    font-size: 24px;
  }
}

/* CRM visual refresh inspired by modern sales/helpdesk products. */
:root {
  --blue: #2d6cdf;
  --blue-dark: #1f55bd;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #d9dee8;
  --panel: #ffffff;
  --canvas: #f3f4f6;
  --soft: #eef4ff;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-soft: 0 1px 2px rgba(15, 23, 42, 0.045);
}

body {
  background: #f4f5f7;
  color: #1f2937;
}

.shell {
  background: #f4f5f7;
  grid-template-columns: 238px minmax(0, 1fr);
}

.sidebar {
  background: #f8f9fb;
  backdrop-filter: none;
  border-right: 1px solid #e1e5ec;
  box-shadow: none;
  gap: 18px;
  padding: 18px 12px;
}

.sidebar .brand,
.sidebar-footer {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.sidebar nav {
  gap: 3px;
}

.sidebar nav a,
.sidebar nav button {
  border-radius: 5px;
  color: #3f4b5f;
  font-size: 0.92rem;
  font-weight: 500;
  min-height: 36px;
  padding: 8px 10px;
}

.sidebar nav a:hover,
.sidebar nav button:hover {
  background: #edf2f7;
  color: #1f2937;
  transform: none;
}

.sidebar nav .active,
.sidebar nav button.active {
  background: #dbeafe;
  box-shadow: none;
  color: #2456bf;
  font-weight: 600;
}

.sidebar nav .active svg,
.sidebar nav button.active svg {
  color: #2d6cdf;
}

.sidebar-footer {
  border-top: 1px solid #e1e5ec;
  border-radius: 0;
  padding: 12px 4px 0;
}

.profile-avatar {
  background: #e8f1ff;
  border-radius: 8px;
}

.topbar {
  background: #ffffff;
  border: 1px solid #e1e5ec;
  border-radius: 0;
  box-shadow: none;
  margin-bottom: 16px;
  padding: 18px 20px;
}

.topbar h1 {
  color: #1f2937;
  font-size: 25px;
  font-weight: 650;
  letter-spacing: 0;
}

.topbar p {
  color: #6b7280;
  font-size: 0.96rem;
}

.metric,
.panel,
.form-panel,
.queue-panel,
.smart-panel,
.debug-panel,
.integration-health-card,
.smart-dashboard-card,
.dashboard-card,
.conversation-card {
  background: #ffffff;
  border: 1px solid #e1e5ec;
  border-radius: 6px;
  box-shadow: none;
}

.metric {
  min-height: 104px;
  padding: 16px;
}

.metric strong,
.smart-history-kpis strong,
.dashboard-metrics strong {
  font-weight: 600;
  letter-spacing: 0;
}

.panel-title h2,
.panel-title h3,
.smart-dashboard-card h2,
.form-panel h2 {
  color: #1f2937;
  font-weight: 600;
  letter-spacing: 0;
}

.panel-title span,
.hint-text,
.dashboard-list small,
.dashboard-log-list small {
  color: #6b7280;
}

.primary-button,
.form-panel .primary-button,
.flow-actions .primary-button,
.flow-test-form .primary-button,
.menu-modal-title .primary-button,
.menu-modal-footer .primary-button,
.smart-simulator-options .primary-button,
.suggestion-actions .primary-button,
.conversation-actions .primary-button {
  background: #2d6cdf;
  border: 1px solid #2d6cdf;
  border-radius: 4px;
  box-shadow: none;
  color: #ffffff;
  font-weight: 600;
  min-height: 34px;
  padding: 8px 13px;
}

.primary-button:hover,
.form-panel .primary-button:hover,
.flow-actions .primary-button:hover,
.flow-test-form .primary-button:hover,
.menu-modal-title .primary-button:hover,
.menu-modal-footer .primary-button:hover,
.smart-simulator-options .primary-button:hover,
.suggestion-actions .primary-button:hover,
.conversation-actions .primary-button:hover {
  background: #245bc4;
}

.secondary-button,
.ghost-button,
.integration-actions button:not(.primary-button),
.send-test-form button:not(.primary-button),
.knowledge-actions button:not(.primary-button),
.flow-actions button:not(.primary-button),
.menu-modal-footer button:not(.primary-button) {
  background: #ffffff;
  border: 1px solid #d6dde8;
  border-radius: 4px;
  box-shadow: none;
  color: #334155;
  font-weight: 500;
  min-height: 34px;
  padding: 8px 13px;
}

.secondary-button:hover,
.ghost-button:hover,
.integration-actions button:not(.primary-button):hover,
.send-test-form button:not(.primary-button):hover,
.knowledge-actions button:not(.primary-button):hover,
.flow-actions button:not(.primary-button):hover,
.menu-modal-footer button:not(.primary-button):hover {
  background: #f3f6fb;
  border-color: #c7d2e3;
  color: #1f2937;
}

input,
select,
textarea {
  border-color: #d6dde8;
  border-radius: 4px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #2d6cdf;
  box-shadow: 0 0 0 3px rgba(45, 108, 223, 0.12);
  outline: none;
}

.source-pill,
.queue-status,
.trial-status,
.status-pill {
  border-radius: 4px;
  font-weight: 600;
}

.login-page {
  background: #f4f5f7;
}

.login-panel {
  background: #152838;
  border-radius: 0;
  box-shadow: none;
}

.login-form {
  border-radius: 6px;
  box-shadow: none;
}

.login-form input {
  border-radius: 4px;
}

.login-copy h1,
.login-form h2 {
  letter-spacing: 0;
}

.modal,
.dialog,
.profile-modal,
.target-picker-modal,
.restore-progress-modal {
  border: 1px solid #e1e5ec;
  border-radius: 6px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.18);
}

.flow-node,
.chatbot-node,
.canvas-node {
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

@media (max-width: 900px) {
  .sidebar {
    background: #ffffff;
  }

  .topbar,
  .panel,
  .metric {
    border-radius: 6px;
  }
}

/* Kommo-style CRM metrics pass based on computed layout values, not copied source. */
:root {
  font-family: "PT Sans", Arial, sans-serif;
  --blue: #3771d6;
  --blue-dark: #2860c7;
  --ink: #363b44;
  --muted: #6f7a8a;
  --line: #e8eaeb;
  --panel: #ffffff;
  --canvas: #f5f5f5;
  --soft: #e5eeff;
  --shadow: 0 2px 1px #ededed;
  --shadow-soft: 0 2px 1px #ededed;
}

html,
body {
  font-family: "PT Sans", Arial, sans-serif;
  font-size: 15px;
}

body {
  background: #f5f5f5;
  color: #363b44;
}

.shell {
  background: #f5f5f5;
  grid-template-columns: 240px minmax(0, 1fr);
}

.content,
.main-content {
  padding: 25px;
}

.sidebar {
  background: #f7f8fa;
  border-right: 1px solid #e8eaeb;
  color: #363b44;
  gap: 14px;
  padding: 14px 4px 16px;
  width: 240px;
}

.sidebar .brand {
  border: 0;
  min-height: 55px;
  padding: 8px 12px 10px;
}

.brand-lockup strong {
  color: #1f2933;
  font-family: "PT Sans Caption", "Arial Black", Arial, sans-serif;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.15;
}

.brand-lockup small {
  color: #748091;
  font-size: 13px;
  line-height: 1.2;
}

.brand-mark {
  border-radius: 4px;
}

.sidebar nav {
  gap: 0;
  padding: 4px 0;
}

.sidebar nav a,
.sidebar nav button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 4px;
  box-shadow: none;
  color: #363b44;
  display: flex;
  font-family: "PT Sans", Arial, sans-serif;
  font-size: 15px;
  font-weight: 400;
  gap: 10px;
  height: 36px;
  justify-content: flex-start;
  line-height: normal;
  margin: 0 4px;
  min-height: 36px;
  padding: 6px 14px;
  width: calc(100% - 8px);
}

.sidebar nav a svg,
.sidebar nav button svg {
  color: #6f7a8a;
  height: 16px;
  width: 16px;
}

.sidebar nav a:hover,
.sidebar nav button:hover {
  background: #eef1f4;
  color: #363b44;
}

.sidebar nav .active,
.sidebar nav button.active {
  background: #e5eeff;
  color: #3771d6;
  font-weight: 700;
}

.sidebar nav .active svg,
.sidebar nav button.active svg {
  color: #3771d6;
}

.sidebar-group {
  display: grid;
  gap: 1px;
  margin: 0 0 2px;
}

.sidebar-group > button {
  position: relative;
}

.sidebar-chevron {
  margin-left: auto;
  opacity: 0.72;
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.sidebar-group.open > button .sidebar-chevron {
  opacity: 0.95;
  transform: rotate(180deg);
}

.sidebar-subnav {
  border-left: 1px solid #dbe3ec;
  display: grid;
  gap: 1px;
  margin: -1px 0 5px 22px;
  padding: 2px 0 2px 12px;
}

.sidebar-subnav button {
  color: #536070;
  font-size: 14px;
  font-weight: 400;
  gap: 8px;
  height: 30px;
  margin: 0 4px 0 0;
  min-height: 30px;
  padding: 4px 8px;
  width: calc(100% - 4px);
}

.sidebar-subnav button svg {
  color: #7b8797;
  height: 14px;
  opacity: 0.72;
  width: 14px;
}

.sidebar-subnav button.active {
  background: #eef5ff;
  color: #1d5fbf;
  font-weight: 500;
}

.sidebar-subnav button:hover {
  background: #f2f6fb;
}

.sidebar-footer {
  border-top: 1px solid #e8eaeb;
  margin: 8px 12px 0;
  padding: 12px 0 0;
  position: relative;
}

.sidebar-footer .profile-trigger,
.sidebar-footer button {
  border-radius: 4px;
}

.sidebar-utility {
  border-top: 1px solid #e8eaeb;
  display: grid;
  gap: 2px;
  margin: auto 12px 0;
  padding-top: 12px;
  position: relative;
  z-index: 900;
}

.sidebar-utility button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 7px;
  color: #363b44;
  display: flex;
  font-family: "PT Sans", Arial, sans-serif;
  font-size: 15px;
  gap: 10px;
  height: 36px;
  justify-content: flex-start;
  padding: 7px 10px;
  text-align: left;
  width: 100%;
}

.sidebar-utility button:hover,
.sidebar-help.open > button,
.sidebar-notification-wrap > button:hover {
  background: #eef1f4;
}

.sidebar-utility .sidebar-chevron {
  margin-left: auto;
}

.sidebar-badge {
  align-items: center;
  background: #d83b4a;
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: 12px;
  height: 20px;
  justify-content: center;
  margin-left: auto;
  min-width: 20px;
  padding: 0 6px;
}

.sidebar-popover,
.profile-menu-popover {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.14);
  color: #334155;
  display: grid;
  gap: 4px;
  left: calc(100% + 8px);
  min-width: 250px;
  padding: 10px;
  position: absolute;
  z-index: 1200;
}

.sidebar-popover {
  bottom: 0;
}

.help-popover {
  bottom: 110px;
}

.notification-popover {
  bottom: 16px;
  min-width: 320px;
  max-height: min(520px, calc(100vh - 120px));
  overflow: auto;
  z-index: 2600;
}

.sidebar-popover span,
.profile-menu-popover > small,
.profile-menu-popover > span {
  color: #94a3b8;
  font-size: 12px;
  padding: 6px 10px;
}

.sidebar-popover button,
.profile-menu-popover button {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: #334155;
  display: flex;
  font-size: 14px;
  gap: 10px;
  height: 34px;
  justify-content: flex-start;
  padding: 7px 10px;
  width: 100%;
}

.sidebar-popover button:hover,
.profile-menu-popover button:hover {
  background: #f1f5f9;
}

.sidebar-popover .notification-item {
  align-items: flex-start;
  border-left: 3px solid #38bdf8;
  display: grid;
  gap: 3px;
  height: auto;
  min-height: 48px;
}

.sidebar-popover .notification-item.warning {
  border-left-color: #f59e0b;
}

.sidebar-popover .notification-item.danger {
  border-left-color: #ef4444;
}

.sidebar-popover .notification-item strong {
  color: #0f172a;
  font-size: 13px;
  line-height: 1.2;
}

.sidebar-popover .notification-item small {
  color: #64748b;
  font-size: 12px;
  line-height: 1.25;
}

.notification-empty {
  color: #64748b;
  font-size: 13px;
  line-height: 1.35;
  margin: 0;
  padding: 8px 10px 10px;
}

[data-theme="dark"] .sidebar-popover .notification-item strong {
  color: #f8fafc;
}

[data-theme="dark"] .sidebar-popover .notification-item small,
[data-theme="dark"] .notification-empty {
  color: #a8bed2;
}

.profile-menu-popover {
  bottom: 64px;
  left: 0;
  min-width: 300px;
}

.profile-menu-popover hr {
  border: 0;
  border-top: 1px solid #e2e8f0;
  margin: 6px 0;
}

.profile-menu-popover .danger {
  color: #dc2626;
}

.profile-menu-theme {
  display: grid;
  gap: 8px;
  padding: 7px 10px;
}

.profile-menu-theme span {
  align-items: center;
  color: #334155;
  display: flex;
  gap: 10px;
  font-size: 14px;
}

.profile-menu-theme div {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profile-menu-theme button {
  border: 1px solid #dbe3ec;
  height: 32px;
  justify-content: center;
}

.profile-menu-theme button.active {
  background: #e5eeff;
  border-color: #9ec5ff;
  color: #1d5fbf;
}

.profile-settings-backdrop {
  background: rgba(15, 23, 42, 0.42);
  inset: 0;
  overflow: auto;
  padding: 26px;
  position: fixed;
  z-index: 120;
}

.profile-settings-page {
  background: #f5f5f5;
  border-radius: 10px;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.24);
  color: #363b44;
  display: grid;
  grid-template-columns: 245px minmax(0, 1fr);
  margin: 0 auto;
  min-height: calc(100vh - 52px);
  overflow: hidden;
  width: min(1500px, 100%);
}

.profile-settings-nav {
  background: #fff;
  border-right: 1px solid #e5e7eb;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 22px 18px;
}

.profile-settings-nav strong {
  color: #1f2933;
  font-size: 14px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.profile-settings-nav span {
  color: #94a3b8;
  font-size: 12px;
  margin-top: 14px;
}

.profile-settings-nav a {
  border-radius: 5px;
  color: #536070;
  padding: 9px 10px;
  text-decoration: none;
}

.profile-settings-nav a:hover,
.profile-settings-nav a:first-of-type {
  background: #e5eeff;
  color: #3771d6;
}

.profile-settings-content {
  display: grid;
  gap: 18px;
  padding: 24px 28px;
}

.profile-settings-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.profile-settings-header h2 {
  font-size: 22px;
  margin: 4px 0 0;
}

.profile-settings-actions {
  display: flex;
  gap: 10px;
}

.profile-settings-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  display: grid;
  gap: 18px;
  grid-template-columns: 150px minmax(0, 1fr);
  padding: 22px;
}

.profile-photo-block {
  align-content: start;
  display: grid;
  gap: 10px;
  justify-items: center;
}

.profile-logo-preview.large {
  border-radius: 999px;
  height: 118px;
  width: 118px;
}

.profile-form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 280px));
}

.profile-form-grid .wide {
  grid-column: 1 / -1;
}

.theme-choice-row {
  display: flex;
  gap: 10px;
}

.profile-menu-settings {
  display: grid;
  gap: 12px;
}

.profile-menu-settings label {
  max-width: 360px;
}

.theme-choice-row button {
  border: 1px solid #dbe3ec;
  border-radius: 8px;
  padding: 10px 18px;
}

.theme-choice-row button.active {
  background: #e5eeff;
  border-color: #9ec5ff;
  color: #1d5fbf;
}

.profile-session-table {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
}

.profile-session-table span,
.profile-session-table small {
  border-bottom: 1px solid #edf2f7;
  padding: 10px;
}

.profile-session-table span {
  color: #94a3b8;
  font-size: 12px;
  text-transform: uppercase;
}

html[data-theme="dark"] body,
html[data-theme="dark"] .page,
html[data-theme="dark"] .content {
  background: #111827;
  color: #dbe4ef;
}

html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .profile-settings-nav,
html[data-theme="dark"] .profile-settings-card,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .sidebar-popover,
html[data-theme="dark"] .profile-menu-popover {
  background: #172033;
  border-color: #263247;
  color: #dbe4ef;
}

html[data-theme="dark"] .sidebar nav button,
html[data-theme="dark"] .sidebar-utility button,
html[data-theme="dark"] .profile-trigger,
html[data-theme="dark"] .profile-menu-popover button,
html[data-theme="dark"] .sidebar-popover button {
  color: #dbe4ef;
}

html[data-theme="dark"] .sidebar nav button:hover,
html[data-theme="dark"] .sidebar-utility button:hover,
html[data-theme="dark"] .profile-menu-popover button:hover,
html[data-theme="dark"] .sidebar-popover button:hover {
  background: #22304a;
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: #111827;
  border-color: #334155;
  color: #e5e7eb;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --blue: #5b8def;
  --blue-dark: #3f73d6;
  --cyan: #6fc9e6;
  --violet: #a78bfa;
  --ink: #e8eef6;
  --muted: #9fb0c5;
  --line: #284257;
  --panel: #143247;
  --canvas: #0b2230;
  --soft: #16384d;
  --green: #33d28f;
  --amber: #f5b84f;
  --red: #ff6b6b;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
  --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.24);
}

html[data-theme="dark"] body,
html[data-theme="dark"] .page,
html[data-theme="dark"] .content {
  background:
    radial-gradient(circle at 20% 8%, rgba(91, 141, 239, 0.12), transparent 28vw),
    linear-gradient(135deg, #081d2a 0%, #0b2636 48%, #0d2d3f 100%);
  color: var(--ink);
}

html[data-theme="dark"] .shell {
  background: transparent;
}

html[data-theme="dark"] .sidebar {
  background: #123247;
  border-color: rgba(111, 201, 230, 0.16);
  box-shadow: 8px 0 28px rgba(0, 0, 0, 0.22);
  color: #dce9f4;
}

html[data-theme="dark"] .sidebar nav a,
html[data-theme="dark"] .sidebar nav button,
html[data-theme="dark"] .sidebar-utility button,
html[data-theme="dark"] .profile-trigger,
html[data-theme="dark"] .profile-menu-popover button,
html[data-theme="dark"] .sidebar-popover button {
  color: #d2dfeb;
}

html[data-theme="dark"] .sidebar nav a:hover,
html[data-theme="dark"] .sidebar nav button:hover,
html[data-theme="dark"] .sidebar-utility button:hover,
html[data-theme="dark"] .profile-menu-popover button:hover,
html[data-theme="dark"] .sidebar-popover button:hover {
  background: rgba(107, 155, 219, 0.14);
  color: #ffffff;
}

html[data-theme="dark"] .sidebar nav .active,
html[data-theme="dark"] .sidebar nav button.active,
html[data-theme="dark"] .sidebar-subitem.active {
  background: rgba(91, 141, 239, 0.28);
  box-shadow: inset 3px 0 0 #79b8ff;
  color: #ffffff;
}

html[data-theme="dark"] .sidebar-footer,
html[data-theme="dark"] .profile-menu-popover,
html[data-theme="dark"] .sidebar-popover,
html[data-theme="dark"] .profile-settings-nav,
html[data-theme="dark"] .profile-settings-card,
html[data-theme="dark"] .modal-card {
  background: #102b3e;
  border-color: rgba(133, 178, 214, 0.2);
  color: var(--ink);
}

html[data-theme="dark"] .topbar,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .metric,
html[data-theme="dark"] .integration-card,
html[data-theme="dark"] .smart-dashboard-card,
html[data-theme="dark"] .whatsapp-session-card,
html[data-theme="dark"] .queue-card,
html[data-theme="dark"] .conversation-card,
html[data-theme="dark"] .contactflow-card,
html[data-theme="dark"] .contactflow-kanban-column,
html[data-theme="dark"] .contactflow-lead-card,
html[data-theme="dark"] .profile-settings-card {
  background: #12293b;
  border-color: rgba(133, 178, 214, 0.2);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
  color: var(--ink);
}

html[data-theme="dark"] .topbar h1,
html[data-theme="dark"] .content h1,
html[data-theme="dark"] .content h2,
html[data-theme="dark"] .content h3,
html[data-theme="dark"] .panel-title h2,
html[data-theme="dark"] .panel-title h3,
html[data-theme="dark"] .form-panel h2,
html[data-theme="dark"] strong,
html[data-theme="dark"] b {
  color: #f3f8ff;
}

html[data-theme="dark"] p,
html[data-theme="dark"] small,
html[data-theme="dark"] label,
html[data-theme="dark"] .hint,
html[data-theme="dark"] .hint-text,
html[data-theme="dark"] .panel-title span,
html[data-theme="dark"] .integration-card small,
html[data-theme="dark"] .session-copy small,
html[data-theme="dark"] .session-copy em,
html[data-theme="dark"] .sidebar-footer small {
  color: var(--muted);
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .token-box,
html[data-theme="dark"] .debug-box {
  background: #0d2130;
  border-color: #31506a;
  color: #edf6ff;
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: #7690a8;
}

html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus {
  border-color: #79b8ff;
  box-shadow: 0 0 0 4px rgba(121, 184, 255, 0.16);
}

html[data-theme="dark"] button:not(.primary-button):not(.danger-button):not(.link-button):not(.text-button),
html[data-theme="dark"] .secondary-button {
  background: #15354a;
  border-color: #385b76;
  color: #eaf4ff;
}

html[data-theme="dark"] button:not(.primary-button):not(.danger-button):not(.link-button):not(.text-button):hover,
html[data-theme="dark"] .secondary-button:hover {
  background: #1b415a;
  border-color: #5b8def;
}

html[data-theme="dark"] .primary-button {
  background: linear-gradient(135deg, #4f86ec, #2f6ed4);
  box-shadow: 0 12px 24px rgba(47, 110, 212, 0.26);
  color: #ffffff;
}

html[data-theme="dark"] .primary-button:hover {
  background: linear-gradient(135deg, #6ba0ff, #3f7be4);
}

html[data-theme="dark"] .check-row,
html[data-theme="dark"] .inline-alert,
html[data-theme="dark"] .whatsapp-stability-grid span,
html[data-theme="dark"] .integration-card-stats span,
html[data-theme="dark"] .smart-summary-row,
html[data-theme="dark"] .audit-row,
html[data-theme="dark"] .queue-item,
html[data-theme="dark"] .backup-file-card,
html[data-theme="dark"] .restore-selected-card {
  background: rgba(13, 33, 48, 0.78);
  border-color: rgba(133, 178, 214, 0.18);
  color: var(--ink);
}

html[data-theme="dark"] .whatsapp-session-card.active,
html[data-theme="dark"] .whatsapp-status-box.connected,
html[data-theme="dark"] .qr-box.connected {
  background: linear-gradient(135deg, rgba(26, 88, 70, 0.92), rgba(18, 65, 56, 0.92));
  border-color: rgba(70, 211, 145, 0.62);
  color: #ecfff6;
}

html[data-theme="dark"] .queue-status.sent,
html[data-theme="dark"] .queue-status.confirmed,
html[data-theme="dark"] .status-pill.ok,
html[data-theme="dark"] .integration-status.ok {
  background: rgba(51, 210, 143, 0.16);
  color: #7cf0b8;
}

html[data-theme="dark"] .queue-status.queued,
html[data-theme="dark"] .status-pill.warning,
html[data-theme="dark"] .integration-status.warning {
  background: rgba(245, 184, 79, 0.17);
  color: #ffd88a;
}

html[data-theme="dark"] .queue-status.failed,
html[data-theme="dark"] .status-pill.danger,
html[data-theme="dark"] .integration-status.danger {
  background: rgba(255, 107, 107, 0.16);
  color: #ffaaaa;
}

html[data-theme="dark"] .theme-choice-row button.active,
html[data-theme="dark"] .profile-menu-theme button.active {
  background: #254c6b;
  border-color: #79b8ff;
  color: #ffffff;
}

.topbar {
  background: #ffffff;
  border: 1px solid #e8eaeb;
  border-radius: 4px;
  box-shadow: none;
  margin-bottom: 20px;
  min-height: 65px;
  padding: 18px 25px;
}

.topbar h1,
.content h1,
.content h2,
.content h3,
.panel-title h2,
.panel-title h3,
.smart-dashboard-card h2,
.form-panel h2 {
  color: #363b44;
  font-family: "PT Sans Caption", "Arial Black", Arial, sans-serif;
  font-weight: 700;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 22px;
  line-height: 1.2;
}

.topbar p {
  color: #6f7a8a;
  font-size: 15px;
  margin-top: 6px;
}

.metric,
.panel,
.form-panel,
.queue-panel,
.smart-panel,
.debug-panel,
.integration-health-card,
.smart-dashboard-card,
.dashboard-card,
.conversation-card,
.whatsapp-stability-panel,
.dashboard-log-list article,
.dashboard-list article,
.queue-row,
.meta-optin-row,
.conversation-row {
  background: #ffffff;
  border: 1px solid #e8eaeb;
  border-radius: 4px;
  box-shadow: 0 2px 1px #ededed;
}

.metric {
  min-height: 102px;
  padding: 18px;
}

.metric strong,
.smart-history-kpis strong,
.dashboard-metrics strong {
  color: #363b44;
  font-family: "PT Sans Caption", "Arial Black", Arial, sans-serif;
  font-weight: 700;
}

.metric span,
.metric small,
.hint-text,
.panel-title span,
.dashboard-list small,
.dashboard-log-list small {
  color: #6f7a8a;
}

.primary-button,
.form-panel .primary-button,
.flow-actions .primary-button,
.flow-test-form .primary-button,
.menu-modal-title .primary-button,
.menu-modal-footer .primary-button,
.smart-simulator-options .primary-button,
.suggestion-actions .primary-button,
.conversation-actions .primary-button {
  background: #3771d6;
  border: 1px solid #3771d6;
  border-radius: 4px;
  box-shadow: none;
  color: #ffffff;
  font-family: "PT Sans", Arial, sans-serif;
  font-size: 15px;
  font-weight: 700;
  min-height: 36px;
  padding: 7px 14px;
}

.primary-button:hover,
.form-panel .primary-button:hover,
.flow-actions .primary-button:hover,
.flow-test-form .primary-button:hover,
.menu-modal-title .primary-button:hover,
.menu-modal-footer .primary-button:hover,
.smart-simulator-options .primary-button:hover,
.suggestion-actions .primary-button:hover,
.conversation-actions .primary-button:hover {
  background: #2860c7;
  border-color: #2860c7;
}

.secondary-button,
.ghost-button,
.integration-actions button:not(.primary-button),
.send-test-form button:not(.primary-button),
.knowledge-actions button:not(.primary-button),
.flow-actions button:not(.primary-button),
.menu-modal-footer button:not(.primary-button) {
  background: #ffffff;
  border: 1px solid #d8dde5;
  border-radius: 4px;
  box-shadow: none;
  color: #363b44;
  font-family: "PT Sans", Arial, sans-serif;
  font-size: 15px;
  font-weight: 400;
  min-height: 36px;
  padding: 7px 14px;
}

.secondary-button:hover,
.ghost-button:hover,
.integration-actions button:not(.primary-button):hover,
.send-test-form button:not(.primary-button):hover,
.knowledge-actions button:not(.primary-button):hover,
.flow-actions button:not(.primary-button):hover,
.menu-modal-footer button:not(.primary-button):hover {
  background: #f2f4f7;
  border-color: #c8d0db;
}

input,
select,
textarea {
  border-color: #cfd6df;
  border-radius: 4px;
  color: #363b44;
  font-family: "PT Sans", Arial, sans-serif;
  font-size: 15px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #3771d6;
  box-shadow: 0 0 0 2px rgba(55, 113, 214, 0.16);
}

.source-pill,
.queue-status,
.trial-status,
.status-pill {
  border-radius: 4px;
  font-family: "PT Sans", Arial, sans-serif;
  font-weight: 700;
}

.login-page {
  background: #f5f5f5;
  font-family: "PT Sans", Arial, sans-serif;
}

.login-panel,
.login-form,
.modal,
.dialog,
.profile-modal,
.target-picker-modal,
.restore-progress-modal {
  border-radius: 4px;
}

@media (max-width: 900px) {
  .content,
  .main-content {
    padding: 12px;
  }

  .sidebar nav a,
  .sidebar nav button {
    width: auto;
  }
}

.contactflow-kpis {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  margin-bottom: 16px;
}

.contactflow-kpis .panel {
  min-height: 118px;
  padding: 18px;
}

.contactflow-kpis span,
.contactflow-lead small,
.contactflow-lead-summary small,
.contactflow-message small,
.contactflow-task small {
  color: #6f7a8a;
  display: block;
}

.contactflow-kpis strong {
  color: #102033;
  display: block;
  font-size: 26px;
  font-weight: 700;
  margin: 8px 0 2px;
}

.contactflow-toolbar {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 220px;
  margin-bottom: 16px;
  padding: 14px;
}

.contactflow-toolbar label {
  align-items: center;
  display: flex;
  gap: 10px;
}

.contactflow-toolbar input,
.contactflow-toolbar select {
  width: 100%;
}

.contactflow-tabs {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.contactflow-tabs button {
  background: #fff;
  border: 1px solid #d8e2ef;
  border-radius: 10px;
  color: #243247;
  cursor: pointer;
  font-weight: 500;
  padding: 10px 14px;
}

.contactflow-tabs button.active {
  background: #1188c9;
  border-color: #1188c9;
  color: #fff;
}

.contactflow-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(300px, 360px) 1fr;
}

.contactflow-leads,
.contactflow-detail {
  padding: 20px;
}

.contactflow-lead {
  background: #fff;
  border: 1px solid #e3e8f0;
  border-radius: 10px;
  color: #1f2937;
  cursor: pointer;
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 14px;
  text-align: left;
  width: 100%;
}

.contactflow-lead:hover,
.contactflow-lead.active {
  border-color: #1188c9;
  box-shadow: 0 0 0 2px rgba(17, 136, 201, 0.12);
}

.contactflow-lead em {
  background: #e8f6ff;
  border-radius: 999px;
  color: #116394;
  font-style: normal;
  justify-self: start;
  padding: 4px 10px;
}

.contactflow-lead-summary {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  margin: 14px 0;
}

.contactflow-lead-summary span {
  background: #f8fbff;
  border: 1px solid #e3e8f0;
  border-radius: 10px;
  padding: 12px;
}

.contactflow-ai-box {
  align-items: start;
  background: linear-gradient(135deg, #f2fbff 0%, #eef8ff 100%);
  border: 1px solid #cfeeff;
  border-radius: 12px;
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr auto;
  margin: 16px 0;
  padding: 18px;
}

.contactflow-ai-box blockquote {
  background: #fff;
  border-left: 3px solid #1188c9;
  border-radius: 8px;
  margin: 10px 0 0;
  padding: 12px 14px;
}

.contactflow-columns {
  display: grid;
  gap: 16px;
  grid-template-columns: 1.2fr 0.8fr;
}

.contactflow-message,
.contactflow-task {
  background: #fff;
  border: 1px solid #e3e8f0;
  border-radius: 10px;
  margin-top: 10px;
  padding: 12px;
}

.contactflow-message p,
.contactflow-task strong {
  display: block;
  font-weight: 500;
  line-height: 1.45;
  margin: 8px 0 0;
}

.contactflow-message.inbound {
  background: #f8fafc;
}

.contactflow-message.outbound {
  background: #eefbf2;
}

.contactflow-task-form {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
}

.contactflow-task-form.extended {
  grid-template-columns: 1fr;
}

.contactflow-task.overdue {
  background: #fff7ed;
  border-color: #fdba74;
}

.contactflow-task.done {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.contactflow-task.cancelled {
  background: #f8fafc;
  opacity: 0.72;
}

.contactflow-task-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.contactflow-agenda-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  margin-top: 14px;
}

.contactflow-funnel-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.75fr);
}

.contactflow-kanban {
  grid-row: span 2;
  padding: 20px;
}

.contactflow-kanban-board {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(6, minmax(180px, 1fr));
  margin-top: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
  width: 100%;
}

.contactflow-kanban-column {
  background: #f8fbff;
  border: 1px solid #e0e8f2;
  border-radius: 12px;
  box-sizing: border-box;
  min-width: 180px;
  overflow: hidden;
  padding: 12px;
}

.contactflow-kanban-column h3 {
  color: #1f2937;
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 10px;
}

.contactflow-kanban-column h3 small {
  color: #6f7a8a;
  display: block;
  font-size: 12px;
  font-weight: 400;
  margin-top: 3px;
}

.contactflow-stage-bar {
  background: #e8eef7;
  border-radius: 999px;
  height: 6px;
  margin-bottom: 10px;
  overflow: hidden;
}

.contactflow-stage-bar span {
  background: #1188c9;
  display: block;
  height: 100%;
}

.contactflow-kanban-card,
.contactflow-watch-card {
  background: #fff;
  border: 1px solid #e3e8f0;
  border-radius: 10px;
  box-sizing: border-box;
  color: #243247;
  cursor: pointer;
  display: grid;
  gap: 6px;
  margin-top: 8px;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 10px;
  text-align: left;
  width: 100%;
}

.contactflow-kanban-card:hover,
.contactflow-watch-card:hover {
  border-color: #1188c9;
  box-shadow: 0 0 0 2px rgba(17, 136, 201, 0.1);
}

.contactflow-kanban-card strong,
.contactflow-watch-card strong {
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contactflow-kanban-card small,
.contactflow-watch-card small,
.contactflow-source-list small,
.contactflow-metric-list small {
  color: #6f7a8a;
  line-height: 1.35;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: normal;
}

.contactflow-kanban-card small {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
}

.contactflow-kanban-card em,
.contactflow-watch-card em {
  background: #fff7ed;
  border-radius: 999px;
  color: #b45309;
  font-size: 12px;
  font-style: normal;
  justify-self: start;
  padding: 3px 8px;
}

.contactflow-kanban-card.hot,
.contactflow-watch-card.hot {
  border-color: #fdba74;
}

.contactflow-metrics,
.contactflow-watch-list {
  padding: 20px;
}

.contactflow-metric-list,
.contactflow-source-list {
  display: grid;
  gap: 10px;
  margin: 12px 0 16px;
}

.contactflow-metric-list article,
.contactflow-source-list article {
  background: #f8fbff;
  border: 1px solid #e3e8f0;
  border-radius: 10px;
  padding: 12px;
}

.contactflow-metric-list span,
.contactflow-source-list span {
  color: #6f7a8a;
  display: block;
}

.contactflow-metric-list strong,
.contactflow-source-list strong {
  color: #102033;
  display: block;
  font-size: 22px;
  font-weight: 600;
  margin: 6px 0 2px;
}

.contactflow-agenda-column {
  background: #f8fbff;
  border: 1px solid #e0e8f2;
  border-radius: 12px;
  padding: 14px;
}

.contactflow-agenda-column h3 {
  margin: 0 0 10px;
}

.contactflow-safety-box {
  align-items: flex-start;
  background: #eef8ff;
  border: 1px solid #cfe7ff;
  border-radius: 12px;
  display: flex;
  gap: 10px;
  margin: 12px 0;
  padding: 14px;
}

.contactflow-safety-box small {
  color: #5e6d82;
  display: block;
  margin-top: 4px;
}

.contactflow-rules-list {
  display: grid;
  gap: 12px;
  margin: 14px 0;
}

.contactflow-rule-card {
  background: #fff;
  border: 1px solid #e1e8f2;
  border-radius: 12px;
  padding: 14px;
}

.contactflow-rule-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  margin-top: 12px;
}

.contactflow-rule-grid input,
.contactflow-rule-grid select {
  width: 100%;
}

.contactflow-config {
  padding: 20px;
}

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

.contactflow-phase-grid.ai {
  grid-template-columns: 1fr;
}

.contactflow-executive-hero,
.contactflow-ai-command {
  align-items: center;
  display: flex;
  gap: 16px;
  grid-column: 1 / -1;
  justify-content: space-between;
  padding: 22px;
}

.contactflow-executive-hero small {
  color: #1188c9;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.contactflow-executive-hero h2,
.contactflow-ai-command h2 {
  color: #102033;
  font-size: 24px;
  font-weight: 600;
  margin: 4px 0;
}

.contactflow-executive-hero p,
.contactflow-ai-command p {
  color: #617089;
  margin: 0;
}

.contactflow-kpis.executive {
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.contactflow-kpis.executive .panel {
  min-height: 118px;
}

.contactflow-chart-panel,
.contactflow-ranking,
.contactflow-health,
.contactflow-audit {
  padding: 20px;
}

.contactflow-mini-bars {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.contactflow-mini-bars article {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(90px, 160px) 1fr auto;
}

.contactflow-mini-bars span {
  color: #53627a;
}

.contactflow-mini-bars div {
  background: #eaf1f8;
  border-radius: 999px;
  height: 9px;
  overflow: hidden;
}

.contactflow-mini-bars em {
  background: linear-gradient(90deg, #1188c9, #22c7a9);
  border-radius: inherit;
  display: block;
  height: 100%;
}

.contactflow-mini-bars strong {
  color: #102033;
  font-weight: 600;
}

.contactflow-ranking {
  display: grid;
  gap: 10px;
}

.contactflow-ranking button {
  align-items: center;
  background: #f8fbff;
  border: 1px solid #dde7f2;
  border-radius: 12px;
  color: #243247;
  cursor: pointer;
  display: grid;
  gap: 6px;
  grid-template-columns: 1fr auto;
  padding: 12px;
  text-align: left;
}

.contactflow-ranking button:hover {
  border-color: #1188c9;
  box-shadow: 0 0 0 2px rgba(17, 136, 201, 0.09);
}

.contactflow-ranking small {
  color: #6f7a8a;
  grid-column: 1 / -1;
}

.contactflow-kanban.phase4 {
  grid-row: auto;
}

.contactflow-kanban-board.drag {
  grid-template-columns: repeat(6, minmax(230px, 260px));
}

.contactflow-kanban-card.draggable {
  cursor: grab;
}

.contactflow-kanban-card.draggable:active {
  cursor: grabbing;
}

.contactflow-ai-list {
  display: grid;
  gap: 12px;
  padding: 20px;
}

.contactflow-ai-list article {
  background: #fff;
  border: 1px solid #dde7f2;
  border-radius: 14px;
  display: grid;
  gap: 8px;
  padding: 14px;
}

.contactflow-ai-list article > div {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.contactflow-ai-list small,
.contactflow-health-grid small,
.contactflow-audit-list small {
  color: #6f7a8a;
}

.contactflow-ai-list p {
  color: #41516a;
  margin: 0;
}

.contactflow-ai-list blockquote {
  background: #f4f8fc;
  border-left: 3px solid #1188c9;
  margin: 0;
  padding: 10px 12px;
}

.contactflow-temp {
  border-radius: 999px;
  font-size: 12px;
  justify-self: start;
  padding: 4px 9px;
  text-transform: capitalize;
}

.contactflow-temp.quente {
  background: #fff3e8;
  color: #b45309;
}

.contactflow-temp.morno {
  background: #fff8d9;
  color: #926b00;
}

.contactflow-temp.frio {
  background: #eaf5ff;
  color: #116aa8;
}

.contactflow-health-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  margin-top: 12px;
}

.contactflow-health-grid article {
  border: 1px solid #dde7f2;
  border-radius: 14px;
  display: grid;
  gap: 7px;
  padding: 14px;
}

.contactflow-health-grid article.ok {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.contactflow-health-grid article.warn {
  background: #fff7ed;
  border-color: #fed7aa;
}

.contactflow-health-grid article div {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.contactflow-health-grid article span {
  border-radius: 999px;
  background: #fff;
  color: #53627a;
  padding: 4px 9px;
}

.contactflow-health-grid article p {
  color: #41516a;
  margin: 0;
}

.contactflow-audit-filters {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(220px, 1fr) 160px 180px auto;
  margin: 14px 0;
}

.contactflow-audit-filters input,
.contactflow-audit-filters select {
  width: 100%;
}

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

.contactflow-audit-list article {
  background: #fff;
  border: 1px solid #dde7f2;
  border-radius: 12px;
  display: grid;
  gap: 6px;
  padding: 12px;
}

.contactflow-audit-list article div {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.contactflow-audit-list article span {
  background: #eef6ff;
  border-radius: 999px;
  color: #116aa8;
  padding: 4px 9px;
}

.contactflow-audit-list p {
  color: #b42318;
  margin: 0;
}

@media (max-width: 1180px) {
  .contactflow-kpis.executive {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .contactflow-phase-grid,
  .contactflow-health-grid {
    grid-template-columns: 1fr;
  }

  .contactflow-audit-filters {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .contactflow-executive-hero,
  .contactflow-ai-command {
    align-items: flex-start;
    flex-direction: column;
  }

  .contactflow-kpis.executive {
    grid-template-columns: 1fr;
  }

  .contactflow-mini-bars article {
    grid-template-columns: 1fr;
  }

  .contactflow-audit-filters {
    grid-template-columns: 1fr;
  }
}

.contactflow-config-grid,
.contactflow-config-wide {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  margin-top: 14px;
}

.contactflow-config-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.contactflow-config-grid article,
.contactflow-config-wide article {
  background: #f8fbff;
  border: 1px solid #e1e8f2;
  border-radius: 12px;
  padding: 16px;
}

.contactflow-ai-copilot-settings {
  display: grid;
  gap: 14px;
  margin: 16px 0;
  padding: 18px;
  border: 1px solid #d8e7f8;
  border-radius: 14px;
  background: #f4faff;
}

.contactflow-config h3 {
  color: #102033;
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 12px;
}

.contactflow-config textarea,
.contactflow-config input,
.contactflow-config select {
  width: 100%;
}

.contactflow-stage-editor {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.contactflow-stage-editor > div {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr auto;
}

.check-row.compact {
  align-items: center;
  display: inline-flex;
  gap: 6px;
  margin: 0;
}

.check-row.compact span {
  display: inline;
  font-size: 13px;
}

.contactflow-config-v2 {
  display: grid;
  gap: 18px;
}

.contactflow-config-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
  padding: 22px;
  border: 1px solid #dbeafe;
  border-radius: 18px;
  background: linear-gradient(135deg, #f7fbff 0%, #eef7ff 52%, #f8fbff 100%);
}

.contactflow-config-hero span {
  color: #2487d8;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.contactflow-config-hero h2 {
  margin: 6px 0 8px;
  color: #102033;
  font-size: 28px;
}

.contactflow-config-hero p {
  max-width: 900px;
  margin: 0;
  color: #607086;
  font-size: 15px;
  line-height: 1.55;
}

.contactflow-config-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.contactflow-config-badges span {
  padding: 8px 10px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #fff;
  color: #1d4ed8;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
}

.contactflow-config-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}

.contactflow-config-overview article,
.contactflow-config-section {
  border: 1px solid #dde8f5;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .04);
}

.contactflow-config-overview article {
  padding: 16px;
}

.contactflow-config-overview strong {
  display: block;
  color: #102033;
  font-size: 24px;
}

.contactflow-config-overview span {
  color: #6b7b90;
  font-size: 13px;
}

.contactflow-config-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.contactflow-config-section {
  display: grid;
  gap: 14px;
  align-content: start;
  padding: 18px;
}

.contactflow-config-section.span-2 {
  grid-column: 1 / -1;
}

.contactflow-section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.contactflow-section-head h3 {
  margin: 0 0 5px;
  color: #102033;
  font-size: 18px;
}

.contactflow-section-head p {
  margin: 0;
  color: #69798e;
  line-height: 1.45;
}

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

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

.contactflow-setting-card,
.contactflow-field-card {
  display: grid;
  gap: 8px;
  min-height: 96px;
  padding: 14px;
  border: 1px solid #dbe5f1;
  border-radius: 14px;
  background: #f8fbff;
  cursor: pointer;
}

.contactflow-setting-card {
  grid-template-columns: auto 1fr;
  align-items: flex-start;
}

.contactflow-setting-card.enabled {
  border-color: #9bd5b4;
  background: #f0fdf6;
}

.contactflow-setting-card input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: #168f5a;
}

.contactflow-setting-card strong,
.contactflow-field-card {
  color: #1d2b3d;
  font-weight: 800;
}

.contactflow-setting-card small,
.contactflow-field-card small {
  display: block;
  margin-top: 4px;
  color: #69798e;
  font-size: 12px;
  line-height: 1.35;
}

.contactflow-field-card input,
.contactflow-config-v2 input,
.contactflow-config-v2 select,
.contactflow-config-v2 textarea {
  border-radius: 10px;
}

.contactflow-stage-editor.v2 {
  grid-template-columns: repeat(2, minmax(260px, 1fr));
}

.contactflow-stage-editor.v2 > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px;
  gap: 10px;
  align-items: stretch;
}

.contactflow-permissions-table.v2 article {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(5, auto);
  gap: 10px;
  align-items: center;
  padding: 14px;
  border: 1px solid #e1e8f2;
  border-radius: 12px;
  background: #f8fbff;
}

.contactflow-config-footer {
  position: sticky;
  bottom: 12px;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 16px 40px rgba(15, 23, 42, .12);
}

.contactflow-config-footer span {
  color: #5f7087;
  font-weight: 700;
}

.contactflow-permissions-table {
  display: grid;
  gap: 10px;
}

.contactflow-permissions-table article {
  background: #fff;
  border: 1px solid #e3e8f0;
  border-radius: 10px;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(180px, 1fr) repeat(5, auto);
  padding: 12px;
}

.contactflow-permissions-table strong,
.contactflow-permissions-table small {
  grid-column: 1;
}

.contactflow-permissions-table small {
  color: #6f7a8a;
}

.contactflow-inbox-shell {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(420px, 1.6fr) minmax(300px, 0.95fr);
  gap: 14px;
  align-items: start;
}

body.contactflow-operator-active {
  overflow: hidden;
}

.contactflow-inbox-shell.operator-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1800;
  grid-template-columns: minmax(300px, 360px) minmax(520px, 1fr) minmax(320px, 390px);
  align-items: stretch;
  gap: 12px;
  padding: 12px;
  background:
    radial-gradient(circle at 18% 0%, rgba(24, 144, 255, 0.14), transparent 34vw),
    linear-gradient(135deg, #f7fbff 0%, #eef6fb 52%, #f8fafc 100%);
  overflow: hidden;
}

.contactflow-inbox-shell.operator-fullscreen .contactflow-inbox-list,
.contactflow-inbox-shell.operator-fullscreen .contactflow-inbox-chat,
.contactflow-inbox-shell.operator-fullscreen .contactflow-inbox-side {
  min-height: 0;
  height: calc(100vh - 24px);
  overflow: hidden;
}

.contactflow-inbox-shell.operator-fullscreen .contactflow-inbox-list,
.contactflow-inbox-shell.operator-fullscreen .contactflow-inbox-side {
  display: flex;
  flex-direction: column;
}

.contactflow-inbox-shell.operator-fullscreen .contactflow-inbox-chat {
  display: flex;
  flex-direction: column;
}

.contactflow-inbox-shell.operator-fullscreen .contactflow-inbox-items,
.contactflow-inbox-shell.operator-fullscreen .contactflow-inbox-side {
  max-height: none;
  min-height: 0;
  overflow: auto;
}

.contactflow-inbox-shell.operator-fullscreen .contactflow-inbox-history {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
}

.contactflow-inbox-shell.operator-fullscreen .contactflow-suggestion-stack {
  flex: 0 0 auto;
  max-height: min(42vh, 420px);
  overflow: auto;
}

.contactflow-operator-button {
  white-space: nowrap;
}

.contactflow-inbox-list,
.contactflow-inbox-chat,
.contactflow-inbox-side {
  min-height: 680px;
}

.contactflow-inbox-search {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  margin: 12px 0;
  background: #fff;
}

.contactflow-inbox-search input {
  border: 0;
  outline: 0;
  width: 100%;
  padding: 12px 0;
  background: transparent;
}

.contactflow-inbox-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.contactflow-inbox-filters button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 11px;
  cursor: pointer;
}

.contactflow-inbox-filters button.active {
  border-color: rgba(24, 144, 255, 0.35);
  background: #e9f5ff;
  color: #0875be;
}

.contactflow-inbox-items {
  display: grid;
  gap: 10px;
  max-height: 560px;
  overflow: auto;
  padding-right: 2px;
}

.contactflow-inbox-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  padding: 12px;
  display: grid;
  gap: 8px;
  cursor: pointer;
}

.contactflow-inbox-item:hover,
.contactflow-inbox-item.active {
  border-color: #1890c8;
  box-shadow: inset 3px 0 0 #1890c8;
}

.contactflow-inbox-item span {
  display: grid;
  gap: 2px;
}

.contactflow-inbox-item strong {
  font-weight: 600;
}

.contactflow-inbox-item small,
.contactflow-inbox-item p {
  color: var(--muted);
}

.contactflow-inbox-item p {
  margin: 0;
  line-height: 1.35;
}

.contactflow-inbox-item em {
  justify-self: start;
  font-style: normal;
  color: #475467;
  background: #f2f4f7;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.78rem;
}

.contactflow-inbox-item em.hot {
  background: #fff4d8;
  color: #a15c00;
}

.contactflow-inbox-item div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.contactflow-inbox-item div small {
  border: 1px solid #d9e4f2;
  border-radius: 999px;
  padding: 2px 7px;
  background: #f8fbff;
}

.contactflow-inbox-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.contactflow-inbox-chat-head h2 {
  margin: 0 0 3px;
}

.contactflow-inbox-chat-head span {
  border-radius: 999px;
  background: #eef7ff;
  color: #0875be;
  padding: 6px 10px;
  font-size: 0.85rem;
}

.contactflow-inbox-history {
  display: grid;
  align-content: start;
  gap: 10px;
  height: 420px;
  overflow: auto;
  padding: 14px 4px 14px 0;
}

.contactflow-chat-bubble,
.contactflow-timeline-bubble {
  max-width: 82%;
  border-radius: 14px;
  padding: 11px 13px;
  border: 1px solid var(--line);
}

.contactflow-chat-bubble.inbound {
  justify-self: start;
  background: #fff;
}

.contactflow-chat-bubble.outbound {
  justify-self: end;
  background: #eaf7f1;
  border-color: #b9e5ce;
}

.contactflow-timeline-bubble {
  justify-self: center;
  max-width: 92%;
  background: #f8fafc;
  color: #475467;
}

.contactflow-chat-bubble small,
.contactflow-timeline-bubble small {
  display: block;
  color: var(--muted);
  margin-bottom: 5px;
}

.contactflow-chat-bubble p,
.contactflow-timeline-bubble p {
  margin: 0;
  line-height: 1.45;
}

.contactflow-suggestion-stack {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  display: grid;
  gap: 10px;
}

.contactflow-suggestion-card {
  border: 1px solid #b7def7;
  background: #f0f8ff;
  border-radius: 14px;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.contactflow-suggestion-card p {
  margin: 0;
  background: #fff;
  border-radius: 10px;
  padding: 10px;
  line-height: 1.45;
}

.contactflow-suggestion-card textarea,
.contactflow-inline-inputs input,
.contactflow-inbox-side textarea,
.contactflow-inbox-side select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
}

.contactflow-manual-composer {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fbff;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.contactflow-manual-composer > div {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.contactflow-manual-composer small {
  color: var(--muted);
}

.contactflow-manual-composer textarea {
  width: 100%;
  min-height: 86px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font: inherit;
}

.contactflow-manual-composer .primary-button {
  justify-self: end;
}

.contactflow-inline-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.contactflow-inbox-side {
  display: grid;
  gap: 14px;
}

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

.contactflow-side-section {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  display: grid;
  gap: 8px;
}

.contactflow-side-section h3 {
  margin: 0;
}

.contactflow-side-section p {
  margin: 0;
  display: grid;
  gap: 2px;
}

.contactflow-side-section p strong {
  font-weight: 600;
}

.contactflow-inbox-notice {
  grid-column: 1 / -1;
}

.inbox-ai-copilot {
  border-top: 0;
  border: 1px solid #b8def8;
  border-radius: 16px;
  background: linear-gradient(180deg, #f5fbff 0%, #ffffff 100%);
  padding: 14px;
  gap: 14px;
}

.inbox-ai-copilot.professional .panel-title.compact {
  margin: 0;
}

.inbox-ai-copilot.professional .panel-title.compact h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inbox-ai-copilot .primary-button,
.inbox-ai-copilot .secondary-button,
.inbox-ai-copilot .danger-button,
.inbox-ai-copilot .ghost-button {
  min-height: 36px;
}

.inbox-ai-main-action {
  width: 100%;
  justify-content: center;
}

.inbox-ai-safe-banner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #d9ecff;
  background: #eef8ff;
  color: #24546f;
  font-size: 13px;
  line-height: 1.35;
}

.inbox-ai-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  background: #f4f8ff;
  color: var(--ink);
  border: 1px solid #dbeafe;
}

.inbox-ai-loading span {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid #b8d7ff;
  border-top-color: #148dca;
  animation: spin 0.8s linear infinite;
  flex: 0 0 auto;
}

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

.inbox-ai-summary-grid span {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.74);
  min-width: 0;
}

.inbox-ai-summary-grid small,
.inbox-ai-block-title span,
.inbox-ai-source-card small,
.inbox-ai-proposal-card small,
.inbox-ai-log-list small,
.safe-mode-note {
  color: var(--muted);
  font-size: 12px;
}

.inbox-ai-summary-grid strong {
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.ai-confidence.high,
.ai-risk.low { color: #087f5b; }
.ai-confidence.medium,
.ai-risk.medium { color: #9a6700; }
.ai-confidence.low,
.ai-risk.handoff { color: #b42318; }

.inbox-ai-block {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(20, 141, 202, 0.14);
}

.inbox-ai-block-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.inbox-ai-block-title h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
}

.inbox-ai-reply {
  margin: 0;
  border-left: 3px solid #148dca;
  background: #fff;
  border-radius: 12px;
  padding: 12px 13px;
  line-height: 1.48;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.inbox-ai-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.inbox-ai-empty {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed #cfe1f4;
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
}

.inbox-ai-empty strong {
  color: var(--ink);
  font-weight: 600;
}

.inbox-ai-proposal-list,
.inbox-ai-source-list,
.inbox-ai-log-list {
  display: grid;
  gap: 10px;
}

.inbox-ai-proposal-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 12px;
  display: grid;
  gap: 9px;
}

.inbox-ai-proposal-card.approved { border-color: #b8d7ff; }
.inbox-ai-proposal-card.executed { border-color: #bdeccf; background: #fbfffc; }
.inbox-ai-proposal-card.rejected { border-color: #ffd8d8; background: #fffafa; }
.inbox-ai-proposal-card.failed { border-color: #ffc9c9; background: #fff5f5; }

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

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

.proposal-head strong {
  font-weight: 650;
  overflow-wrap: anywhere;
}

.inbox-ai-proposal-card p,
.inbox-ai-source-card p,
.inbox-ai-log-list p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.proposal-payload,
.proposal-result {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border-radius: 10px;
  background: #f7fbff;
  border: 1px solid #e3edf8;
}

.proposal-result.error {
  background: #fff5f5;
  border-color: #ffc9c9;
}

.proposal-payload span,
.proposal-result span {
  font-size: 13px;
  overflow-wrap: anywhere;
}

.inbox-ai-source-card,
.inbox-ai-log-list article {
  display: grid;
  gap: 5px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
}

.inbox-ai-source-card strong,
.inbox-ai-log-list strong {
  font-weight: 600;
}

.ai-memory-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.ai-memory-mini-grid.compact {
  grid-template-columns: 1fr;
}

.ai-memory-mini-grid section {
  min-width: 0;
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.ai-memory-mini-grid section > strong {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.inbox-ai-source-card em {
  color: #52708a;
  font-style: normal;
  font-size: 12px;
}

.inbox-ai-plan {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.inbox-ai-plan li {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 8px;
  align-items: start;
}

.inbox-ai-plan li span {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e7f4ff;
  color: #1478ad;
  font-size: 12px;
  font-weight: 700;
}

.inbox-ai-plan li p {
  margin: 1px 0 0;
  color: var(--ink);
  line-height: 1.4;
}

@media (max-width: 1280px) {
  .inbox-ai-summary-grid {
    grid-template-columns: 1fr;
  }
}

html[data-theme="dark"] .inbox-ai-copilot {
  background: linear-gradient(180deg, rgba(25, 54, 78, 0.96) 0%, rgba(18, 40, 58, 0.96) 100%);
  border-color: #315571;
}

html[data-theme="dark"] .inbox-ai-safe-banner,
html[data-theme="dark"] .inbox-ai-loading,
html[data-theme="dark"] .proposal-payload,
html[data-theme="dark"] .proposal-result {
  background: rgba(16, 35, 52, 0.86);
  border-color: #315571;
  color: #c9d7e5;
}

html[data-theme="dark"] .inbox-ai-summary-grid span,
html[data-theme="dark"] .inbox-ai-reply,
html[data-theme="dark"] .inbox-ai-empty,
html[data-theme="dark"] .inbox-ai-proposal-card,
html[data-theme="dark"] .inbox-ai-source-card,
html[data-theme="dark"] .inbox-ai-log-list article {
  background: rgba(12, 28, 43, 0.78);
  border-color: #315571;
}

html[data-theme="dark"] .inbox-ai-proposal-card.executed {
  background: rgba(15, 55, 38, 0.36);
}

html[data-theme="dark"] .inbox-ai-proposal-card.rejected,
html[data-theme="dark"] .inbox-ai-proposal-card.failed {
  background: rgba(70, 23, 23, 0.34);
}

@media (max-width: 1100px) {
  .contactflow-kpis,
  .contactflow-inbox-shell,
  .contactflow-layout,
  .contactflow-columns,
  .contactflow-lead-summary,
  .contactflow-toolbar,
  .contactflow-ai-box,
  .contactflow-funnel-grid,
  .contactflow-kanban-board,
  .contactflow-agenda-grid,
  .contactflow-config-grid,
  .contactflow-config-wide,
  .contactflow-rule-grid {
    grid-template-columns: 1fr;
  }

  .contactflow-permissions-table article {
    grid-template-columns: 1fr;
  }

  .contactflow-inbox-shell.operator-fullscreen {
    grid-template-columns: minmax(280px, 1fr);
    overflow: auto;
  }

  .contactflow-inbox-shell.operator-fullscreen .contactflow-inbox-list,
  .contactflow-inbox-shell.operator-fullscreen .contactflow-inbox-chat,
  .contactflow-inbox-shell.operator-fullscreen .contactflow-inbox-side {
    height: auto;
    min-height: 360px;
  }
}

/* Final dark-theme pass: keep contrast consistent across every screen. */
html[data-theme="dark"] {
  color-scheme: dark;
  --blue: #5b8def;
  --blue-dark: #8db8ff;
  --cyan: #6fd3ef;
  --violet: #b79cff;
  --ink: #edf6ff;
  --muted: #a9bad0;
  --line: #28465f;
  --panel: #12283a;
  --canvas: #0b2230;
  --soft: #18384d;
  --green: #38d996;
  --amber: #f7c45d;
  --red: #ff7a7a;
  --shadow: 0 20px 54px rgba(0, 0, 0, 0.38);
  --shadow-soft: 0 14px 34px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] body,
html[data-theme="dark"] .page,
html[data-theme="dark"] .content {
  background:
    radial-gradient(circle at 18% 8%, rgba(91, 141, 239, 0.12), transparent 30vw),
    linear-gradient(135deg, #071c28 0%, #0a2636 52%, #0b3044 100%);
  color: var(--ink);
}

html[data-theme="dark"] .shell {
  background: transparent;
}

html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .admin-sidebar {
  background: #123347;
  border-color: rgba(143, 191, 225, 0.18);
  color: #e6f1fb;
}

html[data-theme="dark"] .sidebar nav a,
html[data-theme="dark"] .sidebar nav button,
html[data-theme="dark"] .sidebar-utility button,
html[data-theme="dark"] .sidebar-subitem,
html[data-theme="dark"] .profile-trigger,
html[data-theme="dark"] .profile-menu-popover button,
html[data-theme="dark"] .sidebar-popover button {
  color: #d8e6f2;
}

html[data-theme="dark"] .sidebar nav a:hover,
html[data-theme="dark"] .sidebar nav button:hover,
html[data-theme="dark"] .sidebar-utility button:hover,
html[data-theme="dark"] .profile-menu-popover button:hover,
html[data-theme="dark"] .sidebar-popover button:hover {
  background: rgba(117, 164, 225, 0.16);
  color: #ffffff;
}

html[data-theme="dark"] .sidebar nav .active,
html[data-theme="dark"] .sidebar nav button.active,
html[data-theme="dark"] .sidebar-subitem.active {
  background: rgba(91, 141, 239, 0.28);
  box-shadow: inset 3px 0 0 #79b8ff;
  color: #ffffff;
}

html[data-theme="dark"] .topbar,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .form-panel,
html[data-theme="dark"] .queue-panel,
html[data-theme="dark"] .smart-panel,
html[data-theme="dark"] .debug-panel,
html[data-theme="dark"] .dashboard-card,
html[data-theme="dark"] .metric,
html[data-theme="dark"] .integration-card,
html[data-theme="dark"] .integration-health-card,
html[data-theme="dark"] .smart-dashboard-card,
html[data-theme="dark"] .whatsapp-stability-panel,
html[data-theme="dark"] .whatsapp-session-card,
html[data-theme="dark"] .queue-card,
html[data-theme="dark"] .conversation-card,
html[data-theme="dark"] .contactflow-card,
html[data-theme="dark"] .contactflow-kanban-column,
html[data-theme="dark"] .contactflow-lead-card,
html[data-theme="dark"] .profile-settings-card,
html[data-theme="dark"] .profile-settings-nav,
html[data-theme="dark"] .modal-card,
html[data-theme="dark"] .sidebar-footer,
html[data-theme="dark"] .sidebar-popover,
html[data-theme="dark"] .profile-menu-popover {
  background: var(--panel);
  border-color: rgba(143, 191, 225, 0.2);
  box-shadow: var(--shadow-soft);
  color: var(--ink);
}

html[data-theme="dark"] .topbar h1,
html[data-theme="dark"] .content h1,
html[data-theme="dark"] .content h2,
html[data-theme="dark"] .content h3,
html[data-theme="dark"] .panel-title h2,
html[data-theme="dark"] .panel-title h3,
html[data-theme="dark"] .form-panel h2,
html[data-theme="dark"] .smart-dashboard-card h2,
html[data-theme="dark"] .contactflow-card h2,
html[data-theme="dark"] .flow-screen h1 {
  color: #f5faff;
}

html[data-theme="dark"] p,
html[data-theme="dark"] small,
html[data-theme="dark"] label,
html[data-theme="dark"] .hint,
html[data-theme="dark"] .hint-text,
html[data-theme="dark"] .panel-title span,
html[data-theme="dark"] .topbar p,
html[data-theme="dark"] .sidebar-footer small,
html[data-theme="dark"] .integration-card small,
html[data-theme="dark"] .session-copy small,
html[data-theme="dark"] .session-copy em {
  color: var(--muted);
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .token-box,
html[data-theme="dark"] .debug-box {
  background: #0b2130;
  border-color: #335775;
  color: #edf6ff;
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: #85a1b8;
}

html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus {
  border-color: #7bbcff;
  box-shadow: 0 0 0 4px rgba(123, 188, 255, 0.16);
}

html[data-theme="dark"] button:not(.primary-button):not(.danger-button):not(.link-button):not(.text-button),
html[data-theme="dark"] .secondary-button {
  background: #16364c;
  border-color: #385d7b;
  color: #eef7ff;
}

html[data-theme="dark"] .flow-actions {
  justify-content: flex-start;
}

html[data-theme="dark"] .flow-actions button {
  min-height: 36px;
  padding: 7px 10px;
  white-space: nowrap;
}

html[data-theme="dark"] button:not(.primary-button):not(.danger-button):not(.link-button):not(.text-button):hover,
html[data-theme="dark"] .secondary-button:hover {
  background: #1d445e;
  border-color: #6fa9eb;
}

html[data-theme="dark"] .primary-button {
  background: linear-gradient(135deg, #4f86ec, #2f6ed4);
  border-color: #4f86ec;
  box-shadow: 0 12px 24px rgba(47, 110, 212, 0.26);
  color: #ffffff;
}

html[data-theme="dark"] .danger-button {
  background: rgba(255, 122, 122, 0.08);
  border-color: rgba(255, 122, 122, 0.44);
  color: #ffb3b3;
}

html[data-theme="dark"] .check-row,
html[data-theme="dark"] .inline-alert,
html[data-theme="dark"] .whatsapp-stability-grid span,
html[data-theme="dark"] .integration-card-stats span,
html[data-theme="dark"] .smart-summary-row,
html[data-theme="dark"] .audit-row,
html[data-theme="dark"] .queue-item,
html[data-theme="dark"] .backup-file-card,
html[data-theme="dark"] .restore-selected-card,
html[data-theme="dark"] .contactflow-inbox-item,
html[data-theme="dark"] .contactflow-manual-composer,
html[data-theme="dark"] .contactflow-suggestion-card {
  background: rgba(10, 30, 43, 0.78);
  border-color: rgba(143, 191, 225, 0.18);
  color: var(--ink);
}

html[data-theme="dark"] .flow-screen {
  background: transparent;
}

html[data-theme="dark"] .flow-selector-bar {
  background: #12283a;
  border-color: rgba(143, 191, 225, 0.2);
  box-shadow: var(--shadow-soft);
  color: var(--ink);
}

html[data-theme="dark"] .flow-selector-bar strong {
  color: #f5faff;
}

html[data-theme="dark"] .flow-selector-bar span {
  color: var(--muted);
}

html[data-theme="dark"] .flow-selector-field input,
html[data-theme="dark"] .flow-selector-field select {
  background: #0b2130;
  border-color: #335775;
  color: #edf6ff;
}

html[data-theme="dark"] .flow-selector-field span {
  color: #dcecff;
}

html[data-theme="dark"] .flow-selector-field small {
  color: var(--muted);
}

html[data-theme="dark"] .flow-selector-bar .danger-button {
  background: rgba(255, 122, 122, 0.08);
  border-color: rgba(255, 122, 122, 0.44);
  color: #ffb3b3;
}

html[data-theme="dark"] .flow-layout {
  background: transparent;
}

html[data-theme="dark"] .palette-panel,
html[data-theme="dark"] .canvas-panel {
  background: rgba(11, 34, 48, 0.94);
  border-color: rgba(143, 191, 225, 0.18);
  box-shadow: var(--shadow-soft);
}

html[data-theme="dark"] .canvas-panel .react-flow {
  background-color: #0b2230;
}

html[data-theme="dark"] .canvas-panel .react-flow__background {
  opacity: 0.32;
}

html[data-theme="dark"] .flow-node {
  background: #102d40;
  border-color: color-mix(in srgb, var(--node-color), #ffffff 30%);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.32);
  color: #eef7ff;
}

html[data-theme="dark"] .flow-node p {
  color: #d8e6f2;
}

html[data-theme="dark"] .flow-node li {
  background: #18384d;
  color: #dceaf6;
}

html[data-theme="dark"] .node-option-row:hover {
  background: #22495f;
}

html[data-theme="dark"] .flow-search,
html[data-theme="dark"] .option-style-toggle {
  background: #102d40;
  border-color: #335775;
}

html[data-theme="dark"] .flow-search input {
  background: transparent;
  border: 0;
  box-shadow: none;
  color: #edf6ff;
  width: 100%;
}

html[data-theme="dark"] .option-style-toggle span {
  background: #0d2738;
  border-color: #335775;
  color: #a9bad0;
}

html[data-theme="dark"] .option-style-toggle button {
  background: transparent;
  border-color: #335775;
  color: #d8e6f2;
}

html[data-theme="dark"] .option-style-toggle button.active {
  background: #198dca;
  color: #ffffff;
}

html[data-theme="dark"] .flow-validation-summary,
html[data-theme="dark"] .flow-validation-panel button {
  background: rgba(10, 30, 43, 0.92);
  border-color: rgba(143, 191, 225, 0.22);
  color: #edf6ff;
}

html[data-theme="dark"] .flow-validation-summary.warn,
html[data-theme="dark"] .flow-validation-summary.error,
html[data-theme="dark"] .flow-health.warn {
  background: rgba(245, 184, 79, 0.16);
  border-color: rgba(245, 184, 79, 0.42);
  color: #ffd88a;
}

html[data-theme="dark"] .whatsapp-session-card.active,
html[data-theme="dark"] .whatsapp-status-box.connected,
html[data-theme="dark"] .qr-box.connected {
  background: linear-gradient(135deg, rgba(26, 88, 70, 0.92), rgba(18, 65, 56, 0.92));
  border-color: rgba(70, 211, 145, 0.62);
  color: #ecfff6;
}

html[data-theme="dark"] .contactflow-chat-bubble.inbound {
  background: #102d40;
}

html[data-theme="dark"] .contactflow-chat-bubble.outbound {
  background: #174233;
  border-color: rgba(56, 217, 150, 0.34);
}

html[data-theme="dark"] .contactflow-timeline-bubble,
html[data-theme="dark"] .contactflow-suggestion-card p {
  background: #0b2130;
  color: #d8e6f2;
}

html[data-theme="dark"] .app-toast {
  background: rgba(18, 40, 58, 0.98);
  border-color: rgba(143, 191, 225, 0.2);
  color: var(--ink);
}
.ai-agent-page {
  display: grid;
  gap: 18px;
}

.ai-agent-landing {
  display: grid;
  gap: 18px;
}

.ai-agent-intro-card {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 148px;
  padding: 26px 30px;
}

.ai-agent-intro-card h2 {
  color: var(--text);
  font-size: clamp(1.25rem, 2vw, 1.8rem);
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1.2;
  margin: 8px 0 10px;
}

.ai-agent-intro-card p {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
  margin: 0;
  max-width: 860px;
}

.ai-agent-availability-row {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 16px 20px;
}

.ai-agent-availability-row div {
  display: grid;
  gap: 4px;
}

.ai-agent-availability-row strong {
  color: var(--text);
  font-size: 1.02rem;
  font-weight: 650;
}

.ai-agent-availability-row span {
  color: var(--muted);
}

.ai-agent-availability-row.limited {
  background: #fff7ed;
  border-color: #fed7aa;
}

.ai-agent-availability-row.limited strong {
  color: #9a3412;
}

.ai-agent-new-card {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  display: grid;
  justify-items: center;
  min-height: 340px;
  padding: 42px 24px;
  text-align: center;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.ai-agent-new-card:hover,
.ai-agent-new-card:focus {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
  box-shadow: 0 18px 42px rgba(17, 24, 39, .08);
  outline: none;
  transform: translateY(-1px);
}

.ai-agent-new-card.disabled {
  cursor: not-allowed;
  opacity: .72;
}

.ai-agent-new-card.disabled:hover,
.ai-agent-new-card.disabled:focus {
  border-color: var(--border);
  box-shadow: none;
  transform: none;
}

.ai-agent-new-icon {
  align-items: center;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  border-radius: 999px;
  color: var(--primary);
  display: inline-flex;
  height: 72px;
  justify-content: center;
  margin-bottom: 18px;
  width: 72px;
}

.ai-agent-new-card h3 {
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: 0;
  margin: 0;
}

.ai-agent-new-card p {
  color: var(--muted);
  margin: 8px 0 22px;
}

.ai-agent-overview-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, .8fr);
}

.ai-agent-current-card {
  background: var(--panel);
  border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--border));
  border-radius: 12px;
  display: grid;
  gap: 22px;
  padding: 28px;
}

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

.ai-agent-current-avatar {
  align-items: center;
  background:
    radial-gradient(circle at 50% 34%, #ffe4c4 0 18%, transparent 19%),
    radial-gradient(circle at 50% 120%, #3156d4 0 34%, transparent 35%),
    linear-gradient(145deg, #dbeafe, #f8fbff 55%, #e9f2ff);
  border: 1px solid #c7d7f5;
  border-radius: 999px;
  box-shadow: 0 18px 34px rgba(37, 99, 235, .14);
  display: inline-flex;
  height: 88px;
  justify-content: center;
  overflow: hidden;
  position: relative;
  width: 88px;
}

.ai-agent-current-avatar img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.ai-agent-current-avatar-face {
  background:
    radial-gradient(circle at 38% 42%, #1f2937 0 2px, transparent 3px),
    radial-gradient(circle at 62% 42%, #1f2937 0 2px, transparent 3px),
    radial-gradient(ellipse at 50% 66%, rgba(190, 118, 74, .45) 0 10%, transparent 11%),
    radial-gradient(circle at 50% 38%, #ffd9b0 0 30%, transparent 31%),
    radial-gradient(ellipse at 50% 95%, #2563eb 0 38%, transparent 39%);
  border-radius: inherit;
  height: 100%;
  position: relative;
  width: 100%;
}

.ai-agent-current-avatar-face::before {
  background: linear-gradient(135deg, #243044, #5d6b82);
  border-radius: 999px 999px 42px 42px;
  content: "";
  height: 33px;
  left: 24px;
  position: absolute;
  top: 13px;
  width: 40px;
}

.ai-agent-current-avatar-face::after {
  background: rgba(255, 255, 255, .86);
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .12);
  content: "";
  height: 14px;
  left: 37px;
  position: absolute;
  top: 49px;
  width: 14px;
}

.ai-agent-current-head h3 {
  color: var(--text);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0;
}

.ai-agent-current-head p {
  color: var(--muted);
  margin: 0;
}

.ai-agent-name-line {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0;
}

.ai-agent-rename-hint {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  color: #9a3412;
  cursor: pointer;
  font: inherit;
  font-size: .84rem;
  margin-top: 10px;
  padding: 7px 10px;
}

.ai-agent-rename-hint:hover {
  background: #ffedd5;
}

.ai-agent-current-stats {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ai-agent-current-stats span {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: grid;
  gap: 5px;
  grid-template-rows: auto auto 1fr;
  padding: 14px;
}

.ai-agent-current-stats small {
  color: var(--muted);
}

.ai-agent-current-stats strong {
  color: var(--text);
  font-size: 1.05rem;
}

.ai-agent-current-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ai-agent-current-actions .danger-soft-button,
.ai-knowledge-hero-actions .danger-soft-button {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.ai-agent-current-actions .danger-soft-button:hover,
.ai-knowledge-hero-actions .danger-soft-button:hover {
  background: #ffedd5;
  border-color: #fdba74;
  color: #7c2d12;
}

.ai-agent-new-card.compact {
  min-height: 0;
  padding: 28px 22px;
}

.ai-final-page {
  display: grid;
  gap: 18px;
}

.ai-settings-page {
  --ai-settings-soft: #f6f9fe;
  --ai-settings-line: #d8e3f2;
}

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

.ai-final-hero h2,
.ai-final-head h2,
.ai-final-card h2 {
  color: var(--text);
  letter-spacing: 0;
  margin: 0;
}

.ai-final-hero p,
.ai-final-head p {
  color: var(--muted);
  line-height: 1.5;
  margin: 6px 0 0;
  max-width: 780px;
}

.ai-final-card {
  display: grid;
  gap: 16px;
}

.ai-final-head {
  align-items: center;
  display: flex;
  gap: 14px;
}

.ai-final-head.compact {
  align-items: flex-start;
}

.ai-final-icon {
  align-items: center;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  border-radius: 12px;
  color: var(--primary);
  display: inline-flex;
  flex: 0 0 auto;
  height: 48px;
  justify-content: center;
  width: 48px;
}

.ai-final-safe-note {
  align-items: center;
  background: color-mix(in srgb, #22c55e 10%, var(--surface));
  border: 1px solid color-mix(in srgb, #22c55e 28%, var(--border));
  border-radius: 12px;
  color: var(--text);
  display: flex;
  gap: 9px;
  padding: 12px 14px;
}

.ai-final-safe-note svg {
  color: #16a34a;
  flex: 0 0 auto;
}

.ai-final-attention-note {
  background: color-mix(in srgb, #f59e0b 10%, var(--surface));
  border-color: color-mix(in srgb, #f59e0b 34%, var(--border));
}

.ai-final-attention-note svg {
  color: #d97706;
}

.ai-agent-secondary-card {
  border-style: solid;
}

.ai-settings-overview {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ai-settings-overview article {
  background: var(--ai-settings-soft);
  border: 1px solid var(--ai-settings-line);
  border-radius: 14px;
  display: grid;
  gap: 5px;
  padding: 14px;
}

.ai-settings-overview small,
.ai-settings-overview em {
  color: var(--muted);
}

.ai-settings-overview strong {
  color: var(--text);
  font-size: 1.1rem;
}

.ai-settings-overview em {
  font-size: .86rem;
  font-style: normal;
  line-height: 1.35;
}

.ai-settings-guide {
  align-items: center;
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  border-radius: 16px;
  color: #14532d;
  display: grid;
  gap: 14px;
  grid-template-columns: auto minmax(0, 1fr);
  padding: 16px;
}

.ai-settings-guide .ai-final-icon {
  background: #dcfce7;
  color: #16a34a;
}

.ai-settings-guide strong {
  color: #14532d;
  display: block;
  margin-bottom: 4px;
}

.ai-settings-guide p {
  margin: 0;
}

.ai-channel-final-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
}

.ai-channels-page {
  display: grid;
  gap: 18px;
}

.ai-channel-summary-grid,
.ai-channel-guide-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ai-channel-guide-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ai-channel-summary-card,
.ai-channel-guide-grid article {
  border: 1px solid var(--border);
  border-radius: 16px;
  display: grid;
  gap: 6px;
  padding: 16px;
}

.ai-channel-summary-card svg {
  margin-bottom: 4px;
}

.ai-channel-summary-card span,
.ai-channel-guide-grid span {
  color: var(--muted);
  line-height: 1.4;
}

.ai-channel-summary-card strong {
  color: var(--text);
  font-size: 1.25rem;
}

.ai-channel-summary-card.ok {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #15803d;
}

.ai-channel-summary-card.assist {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.ai-channel-summary-card.flow {
  background: #f5f3ff;
  border-color: #ddd6fe;
  color: #6d28d9;
}

.ai-channel-summary-card.safe {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #c2410c;
}

.ai-channel-guide-grid article {
  background: #f8fbff;
  border-color: #d8e3f2;
}

.ai-channel-guide-grid strong {
  color: var(--text);
}

.ai-channel-final-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-left: 5px solid #94a3b8;
  border-radius: 18px;
}

.ai-channel-final-card.ok {
  border-left-color: #22c55e;
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 72%);
}

.ai-channel-final-card.warning {
  border-left-color: #f59e0b;
  background: linear-gradient(180deg, #fffbeb 0%, #ffffff 72%);
}

.ai-channel-final-card.neutral {
  border-left-color: #94a3b8;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 72%);
}

.ai-channel-final-card h3 {
  color: var(--text);
  letter-spacing: 0;
  margin: 0;
}

.ai-final-settings-grid article {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 16px;
}

.ai-final-settings-grid .ai-settings-card {
  background: #ffffff;
  border-color: var(--ai-settings-line);
  border-radius: 18px;
  box-shadow: 0 18px 38px rgba(16, 24, 40, .05);
  gap: 14px;
  padding: 18px;
}

.ai-final-settings-grid .ai-settings-card h3 {
  color: var(--text);
  margin: 0 0 4px;
}

.ai-final-settings-grid .ai-settings-card .hint-text {
  line-height: 1.45;
  margin: 0;
}

.ai-channel-final-card .ai-final-icon,
.ai-final-settings-grid .ai-final-icon {
  height: 38px;
  width: 38px;
}

.ai-channel-final-card .ai-final-head,
.ai-final-settings-grid article > .ai-final-icon {
  margin-bottom: 2px;
}

.ai-channel-final-card .ai-final-safe-note {
  font-size: .88rem;
  padding: 10px 12px;
}

.ai-channel-card-controls {
  display: grid;
  gap: 12px;
}

.ai-channel-toggle,
.ai-channel-mode-field {
  background: #ffffff;
  border: 1px solid #d8e3f2;
  border-radius: 14px;
  color: var(--text);
  display: grid;
  gap: 8px;
  padding: 12px;
}

.ai-channel-toggle {
  align-items: center;
  grid-template-columns: auto minmax(0, 1fr);
}

.ai-channel-toggle input {
  height: 18px;
  width: 18px;
}

.ai-channel-toggle span,
.ai-channel-mode-field small {
  color: var(--muted);
  line-height: 1.35;
}

.ai-channel-toggle strong,
.ai-channel-mode-field > span {
  color: var(--text);
  font-weight: 650;
}

.ai-final-settings-grid input,
.ai-final-settings-grid select,
.ai-channel-final-card select {
  min-height: 38px;
}

.ai-final-settings-grid input[type="range"] {
  accent-color: #3b73e8;
  min-height: 28px;
}

.ai-final-settings-grid label {
  background: #f8fbff;
  border: 1px solid #d8e3f2;
  border-radius: 14px;
  color: var(--text);
  display: grid;
  gap: 8px;
  padding: 12px;
}

.ai-final-settings-grid label input:not([type="checkbox"]) {
  background: #ffffff;
}

.ai-final-settings-grid label small {
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.35;
}

.ai-final-settings-grid label b {
  color: #1f3fa8;
  font-size: .92rem;
}

.ai-settings-warning {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 14px;
  color: #9a3412;
  display: grid;
  gap: 4px;
  line-height: 1.35;
  padding: 12px;
}

.ai-settings-warning strong {
  color: #7c2d12;
  font-size: .95rem;
}

.ai-settings-warning span {
  color: #9a3412;
  font-size: .9rem;
}

.ai-settings-readonly {
  background: #f8fbff;
  border: 1px solid #d8e3f2;
  border-radius: 14px;
  color: var(--text);
  display: grid;
  gap: 7px;
  padding: 12px;
}

.ai-settings-readonly span {
  color: #1f3fa8;
  font-weight: 650;
}

.ai-settings-readonly small {
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.35;
}

.ai-settings-toggle {
  align-items: center;
  grid-template-columns: auto minmax(0, 1fr);
}

.ai-settings-toggle input {
  height: 18px;
  width: 18px;
}

.ai-settings-toggle span {
  display: grid;
  gap: 3px;
}

.ai-settings-toggle.locked {
  background: #ecfdf5;
  border-color: #bbf7d0;
}

.ai-final-page .ai-choice-grid {
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(150px, .32fr) repeat(5, minmax(110px, 1fr));
  padding: 12px;
}

.ai-final-page .ai-choice-grid > span {
  align-self: center;
  color: var(--text);
  font-weight: 700;
  line-height: 1.2;
}

.ai-final-page .ai-choice-grid button {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  display: inline-flex;
  font-weight: 650;
  justify-content: center;
  min-height: 42px;
  padding: 9px 12px;
  text-align: center;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.ai-final-page .ai-choice-grid button:hover {
  border-color: color-mix(in srgb, var(--primary) 42%, var(--border));
}

.ai-final-page .ai-choice-grid button.active {
  background: color-mix(in srgb, var(--primary) 12%, var(--panel));
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 38%, transparent);
  color: var(--primary);
}

.ai-final-page label,
.ai-final-card label,
.ai-channel-final-card label,
.ai-final-settings-grid label {
  color: var(--text);
  display: grid;
  font-weight: 650;
  gap: 8px;
}

.ai-final-page input,
.ai-final-page select,
.ai-final-page textarea {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  min-height: 42px;
  padding: 10px 12px;
}

.ai-final-page textarea {
  line-height: 1.5;
  resize: vertical;
}

.ai-settings-page .ai-final-settings-grid label {
  font-weight: 600;
}

html[data-theme="dark"] .ai-settings-page {
  --ai-settings-soft: rgba(20, 49, 70, .78);
  --ai-settings-line: rgba(143, 191, 225, .22);
}

html[data-theme="dark"] .ai-settings-overview article,
html[data-theme="dark"] .ai-final-settings-grid .ai-settings-card {
  background: rgba(18, 43, 62, .92);
  border-color: rgba(143, 191, 225, .22);
  box-shadow: none;
}

html[data-theme="dark"] .ai-settings-guide,
html[data-theme="dark"] .ai-settings-toggle.locked {
  background: rgba(22, 101, 52, .18);
  border-color: rgba(134, 239, 172, .28);
  color: #dcfce7;
}

html[data-theme="dark"] .ai-settings-guide strong {
  color: #f0fdf4;
}

html[data-theme="dark"] .ai-settings-guide .ai-final-icon {
  background: rgba(22, 101, 52, .28);
  color: #86efac;
}

html[data-theme="dark"] .ai-settings-warning {
  background: rgba(120, 53, 15, .22);
  border-color: rgba(251, 146, 60, .32);
  color: #fed7aa;
}

html[data-theme="dark"] .ai-settings-warning strong {
  color: #ffedd5;
}

html[data-theme="dark"] .ai-settings-warning span {
  color: #fed7aa;
}

html[data-theme="dark"] .ai-final-settings-grid label {
  background: rgba(8, 32, 48, .72);
  border-color: rgba(143, 191, 225, .22);
}

html[data-theme="dark"] .ai-final-settings-grid label input:not([type="checkbox"]) {
  background: rgba(5, 24, 38, .9);
}

.ai-integrations-page .ai-integration-explain {
  align-items: flex-start;
}

.ai-integration-status {
  align-items: center;
  border: 1px solid;
  border-radius: 22px;
  display: grid;
  gap: 18px;
  grid-template-columns: auto minmax(0, 1fr) minmax(360px, .82fr);
  padding: 18px;
}

.ai-integration-status h3 {
  color: var(--text);
  font-size: 1.3rem;
  letter-spacing: 0;
  margin: 3px 0 6px;
}

.ai-integration-status p {
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}

.ai-integration-status.ok {
  background: linear-gradient(135deg, #ecfdf5 0%, #f8fbff 100%);
  border-color: #86efac;
  color: #047857;
}

.ai-integration-status.danger {
  background: linear-gradient(135deg, #fff1f2 0%, #fff7ed 100%);
  border-color: #fda4af;
  color: #be123c;
}

.ai-integration-status.ok .ai-final-icon {
  background: #dcfce7;
  color: #16a34a;
}

.ai-integration-status.danger .ai-final-icon {
  background: #ffe4e6;
  color: #e11d48;
}

.ai-integration-kpis {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ai-integration-kpis article {
  background: rgba(255, 255, 255, .82);
  border: 1px solid rgba(148, 163, 184, .28);
  border-radius: 16px;
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px;
}

.ai-integration-kpis small,
.ai-integration-kpis span {
  color: var(--muted);
  font-size: .83rem;
}

.ai-integration-kpis strong {
  color: var(--text);
  font-size: .98rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-integration-help-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ai-integrations-page .ai-integration-explain.warning {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.ai-integrations-page .ai-integration-explain.warning .ai-final-icon {
  background: #ffedd5;
  color: #ea580c;
}

.ai-integrations-page .ai-final-settings-grid .span-2 {
  grid-column: 1 / -1;
}

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

.ai-integration-mode-grid button {
  align-items: flex-start;
  background: #f8fbff;
  border: 1px solid #d8e3f2;
  border-radius: 16px;
  color: var(--text);
  display: grid;
  gap: 8px;
  min-height: 112px;
  padding: 16px;
  text-align: left;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.ai-integration-mode-grid button:hover {
  border-color: #93c5fd;
  box-shadow: 0 12px 22px rgba(37, 99, 235, .09);
  transform: translateY(-1px);
}

.ai-integration-mode-grid button.active {
  background: #eff6ff;
  border-color: #3b73e8;
  box-shadow: inset 0 0 0 1px rgba(59, 115, 232, .28);
}

.ai-integration-mode-grid strong {
  color: var(--text);
  font-size: 1rem;
}

.ai-integration-mode-grid small {
  color: var(--muted);
  font-weight: 500;
  line-height: 1.35;
}

.ai-token-status {
  align-items: center;
  border: 1px solid;
  border-radius: 14px;
  display: flex;
  gap: 8px;
  padding: 11px 12px;
}

.ai-token-status.ok {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #047857;
}

.ai-token-status.danger {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #be123c;
}

.ai-provider-choice-grid button {
  min-height: 108px;
}

.ai-provider-choice-grid button small {
  display: block;
  margin-top: 8px;
  font-weight: 500;
  line-height: 1.35;
}

html[data-theme="dark"] .ai-integration-status.ok {
  background: linear-gradient(135deg, rgba(22, 101, 52, .22), rgba(18, 43, 62, .92));
  border-color: rgba(134, 239, 172, .32);
  color: #bbf7d0;
}

html[data-theme="dark"] .ai-integration-status.danger {
  background: linear-gradient(135deg, rgba(127, 29, 29, .26), rgba(120, 53, 15, .2));
  border-color: rgba(251, 113, 133, .34);
  color: #fecdd3;
}

html[data-theme="dark"] .ai-integration-kpis article,
html[data-theme="dark"] .ai-integration-mode-grid button {
  background: rgba(8, 32, 48, .72);
  border-color: rgba(143, 191, 225, .22);
}

html[data-theme="dark"] .ai-integration-mode-grid button.active {
  background: rgba(37, 99, 235, .22);
  border-color: rgba(96, 165, 250, .58);
}

html[data-theme="dark"] .ai-integrations-page .ai-integration-explain.warning {
  background: rgba(120, 53, 15, .22);
  border-color: rgba(251, 146, 60, .32);
  color: #fed7aa;
}

html[data-theme="dark"] .ai-token-status.ok {
  background: rgba(22, 101, 52, .18);
  border-color: rgba(134, 239, 172, .28);
  color: #bbf7d0;
}

html[data-theme="dark"] .ai-token-status.danger {
  background: rgba(127, 29, 29, .22);
  border-color: rgba(251, 113, 133, .34);
  color: #fecdd3;
}

@media (max-width: 1100px) {
  .ai-integration-status {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .ai-integration-kpis {
    grid-column: 1 / -1;
  }

  .ai-integration-help-grid,
  .ai-integration-mode-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .ai-integration-status {
    align-items: flex-start;
    grid-template-columns: 1fr;
  }

  .ai-integration-kpis {
    grid-template-columns: 1fr;
  }
}

html[data-theme="dark"] .ai-agent-current-avatar {
  background:
    radial-gradient(circle at 50% 34%, #f0c9a5 0 18%, transparent 19%),
    radial-gradient(circle at 50% 120%, #4f7cff 0 34%, transparent 35%),
    linear-gradient(145deg, rgba(30, 64, 175, .42), rgba(8, 32, 48, .92));
  border-color: rgba(147, 197, 253, .32);
  box-shadow: 0 18px 34px rgba(0, 0, 0, .28);
}

html[data-theme="dark"] .ai-agent-rename-hint {
  background: rgba(154, 52, 18, .22);
  border-color: rgba(253, 186, 116, .35);
  color: #fed7aa;
}

html[data-theme="dark"] .ai-rule-health-banner.ok,
html[data-theme="dark"] .ai-rule-detail-status.baixo {
  background: rgba(22, 101, 52, .18);
  border-color: rgba(134, 239, 172, .28);
  color: #dcfce7;
}

html[data-theme="dark"] .ai-rule-health-banner.warning,
html[data-theme="dark"] .ai-rule-detail-status.medio,
html[data-theme="dark"] .ai-rule-detail-status.médio {
  background: rgba(146, 64, 14, .2);
  border-color: rgba(253, 230, 138, .3);
  color: #fde68a;
}

html[data-theme="dark"] .ai-rule-health-banner.danger,
html[data-theme="dark"] .ai-rule-detail-status.alto {
  background: rgba(127, 29, 29, .22);
  border-color: rgba(252, 165, 165, .32);
  color: #fecaca;
}

html[data-theme="dark"] .ai-rule-health-banner.neutral {
  background: rgba(18, 43, 62, .92);
  border-color: rgba(143, 191, 225, .22);
  color: #edf6ff;
}

html[data-theme="dark"] .ai-brain-health-banner.ok,
html[data-theme="dark"] .ai-brain-detail-status.ok {
  background: rgba(22, 101, 52, .18);
  border-color: rgba(134, 239, 172, .28);
  color: #dcfce7;
}

html[data-theme="dark"] .ai-brain-health-banner.warning,
html[data-theme="dark"] .ai-brain-detail-status.warning {
  background: rgba(146, 64, 14, .2);
  border-color: rgba(253, 230, 138, .3);
  color: #fde68a;
}

html[data-theme="dark"] .ai-brain-health-banner.danger,
html[data-theme="dark"] .ai-brain-detail-status.danger {
  background: rgba(127, 29, 29, .22);
  border-color: rgba(252, 165, 165, .32);
  color: #fecaca;
}

html[data-theme="dark"] .ai-brain-health-banner.neutral,
html[data-theme="dark"] .ai-brain-detail-status.neutral,
html[data-theme="dark"] .ai-brain-mini-grid span {
  background: rgba(18, 43, 62, .92);
  border-color: rgba(143, 191, 225, .22);
  color: #a9bad0;
}

html[data-theme="dark"] .ai-tools-status-banner.ok {
  background: rgba(22, 101, 52, .18);
  border-color: rgba(134, 239, 172, .28);
  color: #dcfce7;
}

html[data-theme="dark"] .ai-tools-status-banner.warning {
  background: rgba(146, 64, 14, .2);
  border-color: rgba(253, 230, 138, .3);
  color: #fde68a;
}

html[data-theme="dark"] .ai-tools-status-banner.danger {
  background: rgba(127, 29, 29, .22);
  border-color: rgba(252, 165, 165, .32);
  color: #fecaca;
}

html[data-theme="dark"] .ai-tools-status-banner.neutral,
html[data-theme="dark"] .ai-tool-meta span {
  background: rgba(18, 43, 62, .92);
  border-color: rgba(143, 191, 225, .22);
  color: #a9bad0;
}

html[data-theme="dark"] .ai-simulator-guide-card.ask {
  background: rgba(30, 64, 175, .2);
  border-color: rgba(147, 197, 253, .3);
  color: #dbeafe;
}

html[data-theme="dark"] .ai-simulator-guide-card.check,
html[data-theme="dark"] .ai-simulator-status-banner.ok {
  background: rgba(22, 101, 52, .18);
  border-color: rgba(134, 239, 172, .28);
  color: #dcfce7;
}

html[data-theme="dark"] .ai-simulator-guide-card.safe,
html[data-theme="dark"] .ai-simulator-status-banner.warning {
  background: rgba(146, 64, 14, .2);
  border-color: rgba(253, 230, 138, .3);
  color: #fde68a;
}

html[data-theme="dark"] .ai-simulator-result .chat-preview-phone {
  background: rgba(18, 43, 62, .9);
  border-color: rgba(143, 191, 225, .2);
}

html[data-theme="dark"] .ai-test-chat-window {
  background: linear-gradient(180deg, rgba(8, 33, 48, .95), rgba(10, 41, 58, .92));
  border-color: rgba(125, 211, 252, .18);
}

html[data-theme="dark"] .ai-test-chat-bubble {
  background: rgba(15, 47, 67, .96);
  border-color: rgba(125, 211, 252, .2);
}

html[data-theme="dark"] .ai-test-chat-message.client .ai-test-chat-bubble {
  background: rgba(21, 78, 61, .9);
  border-color: rgba(134, 239, 172, .25);
}

html[data-theme="dark"] .ai-test-chat-bubble p {
  color: #e5f3ff;
}

html[data-theme="dark"] .ai-test-chat-composer textarea,
html[data-theme="dark"] .ai-simulator-shortcuts button {
  background: rgba(8, 32, 47, .95);
  border-color: rgba(125, 211, 252, .22);
  color: #dbeafe;
}

html[data-theme="dark"] .ai-channel-summary-card,
html[data-theme="dark"] .ai-channel-guide-grid article,
html[data-theme="dark"] .ai-channel-toggle,
html[data-theme="dark"] .ai-channel-mode-field {
  background: rgba(18, 43, 62, .9);
  border-color: rgba(143, 191, 225, .22);
}

html[data-theme="dark"] .ai-channel-summary-card strong,
html[data-theme="dark"] .ai-channel-guide-grid strong,
html[data-theme="dark"] .ai-channel-toggle strong,
html[data-theme="dark"] .ai-channel-mode-field > span {
  color: #f8fbff;
}

html[data-theme="dark"] .ai-channel-final-card.ok {
  background: linear-gradient(180deg, rgba(22, 101, 52, .2) 0%, rgba(18, 43, 62, .92) 70%);
}

html[data-theme="dark"] .ai-channel-final-card.warning {
  background: linear-gradient(180deg, rgba(146, 64, 14, .2) 0%, rgba(18, 43, 62, .92) 70%);
}

html[data-theme="dark"] .ai-channel-final-card.neutral {
  background: linear-gradient(180deg, rgba(71, 85, 105, .2) 0%, rgba(18, 43, 62, .92) 70%);
}

html[data-theme="dark"] .ai-log-summary-card,
html[data-theme="dark"] .ai-log-help-grid article,
html[data-theme="dark"] .ai-log-filter-row button {
  background: rgba(18, 43, 62, .9);
  border-color: rgba(143, 191, 225, .22);
}

html[data-theme="dark"] .ai-log-summary-card strong,
html[data-theme="dark"] .ai-log-help-grid strong,
html[data-theme="dark"] .ai-log-entry strong {
  color: #f8fbff;
}

html[data-theme="dark"] .ai-log-filter-row button.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #ffffff;
}

html[data-theme="dark"] .ai-log-entry.ok {
  background: linear-gradient(180deg, rgba(22, 101, 52, .2) 0%, rgba(18, 43, 62, .92) 70%);
}

html[data-theme="dark"] .ai-log-entry.warning {
  background: linear-gradient(180deg, rgba(146, 64, 14, .2) 0%, rgba(18, 43, 62, .92) 70%);
}

html[data-theme="dark"] .ai-log-entry.test {
  background: linear-gradient(180deg, rgba(91, 33, 182, .2) 0%, rgba(18, 43, 62, .92) 70%);
}

html[data-theme="dark"] .ai-log-entry.neutral {
  background: linear-gradient(180deg, rgba(71, 85, 105, .2) 0%, rgba(18, 43, 62, .92) 70%);
}

.ai-final-page .primary-button,
.ai-final-page .secondary-button {
  min-height: 40px;
  padding: 0 14px;
}

:where(.ai-agent-landing, .ai-final-page, .ai-knowledge-page, .ai-tools-page, .ai-brain-page, .ai-agent-logs-panel, .ai-integrations-page) :where(.primary-button, .secondary-button, .danger-button, button.small, button.pill) {
  align-items: center;
  border-radius: 12px;
  box-shadow: none;
  display: inline-flex;
  font-weight: 800;
  gap: 8px;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}

:where(.ai-agent-landing, .ai-final-page, .ai-knowledge-page, .ai-tools-page, .ai-brain-page, .ai-agent-logs-panel, .ai-integrations-page) .primary-button {
  background: #3b73e8;
  border: 1px solid #3b73e8;
  color: #fff;
}

:where(.ai-agent-landing, .ai-final-page, .ai-knowledge-page, .ai-tools-page, .ai-brain-page, .ai-agent-logs-panel, .ai-integrations-page) .secondary-button {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #1e293b;
}

:where(.ai-agent-landing, .ai-final-page, .ai-knowledge-page, .ai-tools-page, .ai-brain-page, .ai-agent-logs-panel) .danger-button {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

:where(.ai-agent-landing, .ai-final-page, .ai-knowledge-page, .ai-tools-page, .ai-brain-page, .ai-agent-logs-panel) :where(.primary-button, .secondary-button, .danger-button):hover:not(:disabled) {
  box-shadow: 0 8px 20px rgba(15, 23, 42, .08);
  transform: translateY(-1px);
}

:where(.ai-agent-landing, .ai-final-page, .ai-knowledge-page, .ai-tools-page, .ai-brain-page, .ai-agent-logs-panel) :where(.primary-button, .secondary-button, .danger-button):disabled {
  cursor: not-allowed;
  opacity: .62;
  transform: none;
}

:where(.ai-agent-landing, .ai-final-page, .ai-knowledge-page, .ai-tools-page, .ai-brain-page, .ai-agent-logs-panel) .secondary-button.edit {
  background: #f5f3ff;
  border-color: #ddd6fe;
  color: #6d28d9;
}

:where(.ai-agent-landing, .ai-final-page, .ai-knowledge-page, .ai-tools-page, .ai-brain-page, .ai-agent-logs-panel) .secondary-button.test {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #1e293b;
}

:where(.ai-agent-landing, .ai-final-page, .ai-knowledge-page, .ai-tools-page, .ai-brain-page, .ai-agent-logs-panel) .secondary-button.duplicate {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

:where(.ai-agent-landing, .ai-final-page, .ai-knowledge-page, .ai-tools-page, .ai-brain-page, .ai-agent-logs-panel) .secondary-button.activate {
  background: #ecfdf5;
  border-color: #86efac;
  color: #15803d;
}

:where(.ai-agent-landing, .ai-final-page, .ai-knowledge-page, .ai-tools-page, .ai-brain-page, .ai-agent-logs-panel) .secondary-button.pause {
  background: #fff7ed;
  border-color: #fdba74;
  color: #c2410c;
}

:where(.ai-agent-landing, .ai-final-page, .ai-knowledge-page, .ai-tools-page, .ai-brain-page, .ai-agent-logs-panel) .secondary-button.delete,
:where(.ai-agent-landing, .ai-final-page, .ai-knowledge-page, .ai-tools-page, .ai-brain-page, .ai-agent-logs-panel) .danger-button.subtle {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.ai-final-help-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.ai-final-help-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: grid;
  gap: 6px;
  padding: 14px;
}

.ai-final-help-card strong {
  color: var(--text);
}

.ai-final-help-card span,
.ai-final-help-card small {
  color: var(--muted);
  line-height: 1.4;
}

.ai-final-compact-list {
  display: grid;
  gap: 10px;
}

.ai-final-compact-row {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 14px;
}

.ai-final-compact-row strong {
  color: var(--text);
}

.ai-final-compact-row p,
.ai-final-compact-row small {
  color: var(--muted);
  margin: 3px 0 0;
}

.ai-final-compact-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.ai-final-compact-row-actions .secondary-button,
.ai-final-compact-row-actions .primary-button {
  min-height: 34px;
  padding: 0 11px;
}

.ai-agent-rule-health .panel {
  display: grid;
  gap: 16px;
}

.ai-agent-rule-health .panel-title {
  margin: 0;
}

.ai-agent-rule-health .ai-agent-decision-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.ai-agent-rule-health .ai-agent-decision-card {
  min-height: 92px;
}

.ai-rule-audit-list {
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.ai-rule-detail section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}

.ai-brain-page .ai-agent-decision-grid,
.ai-tools-page .ai-agent-decision-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.ai-brain-page .ai-brain-layout,
.ai-tools-page .ai-brain-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, .92fr) minmax(320px, .58fr);
}

.ai-brain-execution-list,
.ai-tool-history-panel .stack-list {
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.ai-brain-module-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.ai-knowledge-page {
  display: grid;
  gap: 18px;
}

.ai-knowledge-hero {
  align-items: center;
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr) auto;
  overflow: hidden;
  position: relative;
}

.ai-knowledge-hero::after {
  background: radial-gradient(circle at center, color-mix(in srgb, var(--primary) 18%, transparent), transparent 68%);
  content: "";
  height: 260px;
  pointer-events: none;
  position: absolute;
  right: -90px;
  top: -110px;
  width: 260px;
}

.ai-knowledge-hero h2 {
  color: var(--text);
  font-size: clamp(1.5rem, 2vw, 2.2rem);
  letter-spacing: 0;
  margin: 6px 0 10px;
}

.ai-knowledge-hero p {
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
  max-width: 760px;
}

.ai-knowledge-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  position: relative;
  z-index: 1;
}

.ai-knowledge-stats {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ai-knowledge-stats article {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: grid;
  gap: 4px;
  grid-template-columns: auto minmax(0, 1fr);
  padding: 18px;
}

.ai-knowledge-stats article > span {
  align-items: center;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  border-radius: 10px;
  color: var(--primary);
  display: inline-flex;
  grid-row: span 2;
  height: 44px;
  justify-content: center;
  width: 44px;
}

.ai-knowledge-stats strong {
  color: var(--text);
  font-size: 1.45rem;
  line-height: 1;
}

.ai-knowledge-stats small {
  color: var(--muted);
}

.ai-knowledge-layout {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(320px, .34fr);
}

.ai-knowledge-main,
.ai-knowledge-side {
  display: grid;
  gap: 16px;
}

.ai-knowledge-section-head {
  align-items: start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.ai-knowledge-section-head.compact {
  margin-bottom: 4px;
}

.ai-knowledge-section-head h3 {
  color: var(--text);
  font-size: 1.12rem;
  letter-spacing: 0;
  margin: 0 0 4px;
}

.ai-knowledge-section-head p {
  color: var(--muted);
  margin: 0;
}

.ai-knowledge-section-head > span {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.ai-knowledge-controls {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) 220px;
  margin-bottom: 16px;
}

.ai-knowledge-controls .search-field {
  align-items: center;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  min-height: 44px;
}

.ai-knowledge-controls .search-field svg {
  color: var(--muted);
  margin-left: 12px;
}

.ai-knowledge-controls .search-field input {
  border: 0;
  min-height: 42px;
}

.ai-knowledge-controls select {
  min-height: 44px;
}

.ai-persona-page {
  align-items: stretch;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, .55fr);
}

.ai-persona-page .ai-final-card {
  gap: 18px;
}

.ai-persona-page label {
  color: var(--ink, #101828);
  font-size: .95rem;
  font-weight: 750;
}

.ai-persona-page label input,
.ai-persona-page label textarea {
  background: var(--panel, #ffffff) !important;
  border: 2px solid #bfd0e4 !important;
  border-radius: 12px !important;
  box-shadow: inset 0 1px 0 rgba(16, 24, 40, .03) !important;
  color: var(--ink, #101828) !important;
  display: block !important;
  font-weight: 500 !important;
  margin-top: 8px !important;
  width: 100% !important;
}

.ai-persona-page label input {
  min-height: 46px !important;
  padding: 0 14px !important;
}

.ai-persona-page label textarea {
  min-height: 150px !important;
  padding: 14px !important;
}

.ai-persona-page .ai-choice-grid {
  align-items: stretch !important;
  background: var(--canvas, #f4f8ff) !important;
  border: 1px solid var(--line, #cfdceb) !important;
  border-radius: 14px !important;
  display: grid !important;
  gap: 10px !important;
  grid-template-columns: minmax(150px, .32fr) repeat(auto-fit, minmax(128px, 1fr)) !important;
  padding: 12px !important;
}

.ai-persona-page .ai-choice-grid > span {
  align-items: center !important;
  color: var(--ink, #101828) !important;
  display: flex !important;
  font-size: .95rem !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
}

.ai-persona-page .ai-choice-grid button {
  align-items: center !important;
  appearance: none !important;
  background: var(--panel, #ffffff) !important;
  border: 1px solid var(--line, #cfdceb) !important;
  border-radius: 12px !important;
  color: var(--ink, #101828) !important;
  cursor: pointer !important;
  display: inline-flex !important;
  font: inherit !important;
  font-weight: 750 !important;
  justify-content: center !important;
  min-height: 46px !important;
  padding: 10px 12px !important;
  text-align: center !important;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease !important;
}

.ai-persona-page .ai-choice-grid button:hover {
  border-color: color-mix(in srgb, var(--blue, #2f55d4) 42%, var(--line, #cfdceb)) !important;
  transform: translateY(-1px) !important;
}

.ai-persona-page .ai-choice-grid button.active {
  background: color-mix(in srgb, var(--blue, #2f55d4) 12%, var(--panel, #ffffff)) !important;
  border-color: var(--blue, #2f55d4) !important;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--blue, #2f55d4) 34%, transparent) !important;
  color: var(--blue, #2f55d4) !important;
}

.ai-persona-page .primary-button {
  min-height: 44px !important;
}

.ai-knowledge-card-list {
  display: grid;
  gap: 12px;
}

.ai-knowledge-card {
  align-items: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: grid;
  gap: 14px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding: 16px;
}

.ai-knowledge-card-icon {
  align-items: center;
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  border-radius: 10px;
  color: var(--primary);
  display: inline-flex;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.ai-knowledge-card-body {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.ai-knowledge-card-body header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-knowledge-card h4 {
  color: var(--text);
  font-size: 1rem;
  letter-spacing: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-knowledge-card p {
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}

.ai-knowledge-card small,
.ai-knowledge-card-actions span {
  color: var(--muted);
  font-size: .82rem;
}

.ai-knowledge-card-actions {
  align-items: end;
  display: grid;
  gap: 10px;
  justify-items: end;
}

.ai-knowledge-actions-card {
  display: grid;
  gap: 10px;
}

.secondary-button.full,
.primary-button.full {
  justify-content: center;
  width: 100%;
}

.ai-knowledge-manual-card h3 {
  color: var(--text);
  margin: 0;
}

html[data-theme="dark"] .ai-knowledge-card,
html[data-theme="dark"] .ai-knowledge-stats article {
  background: var(--panel);
}

@media (max-width: 640px) {
  .ai-knowledge-stats {
    grid-template-columns: 1fr;
  }

  .ai-knowledge-card {
    grid-template-columns: 1fr;
  }

  .ai-knowledge-card-icon {
    height: 38px;
    width: 38px;
  }

  .ai-knowledge-card h4 {
    white-space: normal;
  }
}

.ai-agent-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.ai-agent-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
}

.ai-agent-tabs button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.ai-agent-two-col,
.ai-agent-overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 18px;
}

.ai-agent-form {
  display: grid;
  gap: 14px;
}

.list-row-card,
.channel-config-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.list-row-card > div,
.channel-config-row > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.list-row-card span,
.channel-config-row span {
  color: var(--muted);
  font-size: 0.92rem;
}

.channel-config-row select {
  max-width: 220px;
}

.clean-steps {
  display: grid;
  gap: 10px;
  margin: 12px 0 0;
  padding-left: 22px;
  color: var(--text);
}

.ai-simulation-result {
  display: grid;
  gap: 14px;
}

.ai-agent-hero {
  align-items: center;
}

.ai-agent-mode-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.ai-agent-mode-strip button {
  display: grid;
  gap: 3px;
  min-height: 66px;
  padding: 12px 14px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  background: var(--panel);
}

.ai-agent-mode-strip button.active {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, var(--panel));
}

.ai-agent-mode-strip button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ai-agent-selected-strip {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(220px, 1fr) minmax(260px, 1.4fr);
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--primary) 24%, var(--border));
  border-radius: 16px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 8%, var(--panel)), var(--panel));
}

.ai-agent-selected-strip div {
  display: grid;
  gap: 2px;
}

.ai-agent-selected-strip span {
  color: var(--muted);
  font-size: 12px;
}

.ai-agent-selected-strip strong {
  color: var(--text);
  font-size: 16px;
}

.ai-agent-selected-strip select {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  background: var(--panel);
}

.ai-agent-selected-strip small {
  color: var(--muted);
  line-height: 1.4;
}

.ai-agent-mode-strip span,
.ai-choice-grid > span,
.ai-action-flow span {
  font-weight: 600;
}

.ai-agent-mode-strip small,
.ai-agent-empty span,
.ai-agent-decision-card small,
.ai-action-card p,
.ai-log-timeline small {
  color: var(--muted);
}

.ai-agent-kpis {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ai-agent-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 220px);
  gap: 10px;
  align-items: center;
}

.ai-agent-toolbar .search-field {
  margin: 0;
}

.ai-agent-empty {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 170px;
  padding: 24px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.ai-agent-rule-health .panel-title {
  align-items: flex-start;
  gap: 16px;
}

.ai-rule-audit-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.ai-rule-summary-title {
  margin-top: 16px;
}

.ai-rule-health-banner {
  align-items: center;
  border-radius: 16px;
  display: grid;
  gap: 14px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  margin-top: 16px;
  padding: 16px;
}

.ai-rule-health-banner strong {
  display: block;
  margin-bottom: 3px;
}

.ai-rule-health-banner span {
  color: inherit;
  line-height: 1.4;
}

.ai-rule-health-banner.ok {
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  color: #14532d;
}

.ai-rule-health-banner.warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #78350f;
}

.ai-rule-health-banner.danger {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #7f1d1d;
}

.ai-rule-health-banner.neutral {
  background: #f6f9fe;
  border: 1px solid #d8e3f2;
  color: var(--text);
}

.ai-rule-audit-card {
  width: 100%;
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.ai-rule-audit-card.baixo {
  border-left: 5px solid #22c55e;
}

.ai-rule-audit-card.medio,
.ai-rule-audit-card.médio {
  border-left: 5px solid #f59e0b;
}

.ai-rule-audit-card.alto {
  border-left: 5px solid #ef4444;
}

.ai-rule-audit-card:hover,
.ai-rule-audit-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .12);
}

.ai-rule-audit-card:hover {
  transform: translateY(-1px);
}

.ai-rule-audit-card strong {
  font-size: 15px;
  color: var(--text);
}

.ai-rule-audit-card b {
  width: max-content;
  margin-top: 4px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef4ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 600;
}

.ai-rule-audit-card small,
.ai-rule-audit-card em {
  color: var(--muted);
  font-style: normal;
}

.ai-rule-risk {
  width: max-content;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
}

.ai-rule-risk.baixo {
  background: #dcfce7;
  color: #166534;
}

.ai-rule-risk.medio {
  background: #fef3c7;
  color: #92400e;
}

.ai-rule-risk.alto {
  background: #fee2e2;
  color: #991b1b;
}

.ai-rule-detail {
  display: grid;
  align-content: start;
  gap: 16px;
}

.ai-rule-detail-status {
  border-radius: 14px;
  display: grid;
  gap: 4px;
  padding: 14px;
}

.ai-rule-detail-status strong {
  color: inherit;
}

.ai-rule-detail-status span {
  line-height: 1.4;
}

.ai-rule-detail-status.baixo {
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  color: #14532d;
}

.ai-rule-detail-status.medio,
.ai-rule-detail-status.médio {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #78350f;
}

.ai-rule-detail-status.alto {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #7f1d1d;
}

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

.ai-rule-detail-list {
  display: grid;
  gap: 10px;
}

.ai-rule-detail-list article {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.ai-rule-detail-list article strong {
  color: var(--text);
}

.ai-rule-detail-list article span {
  color: var(--muted);
}

.ai-rule-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ai-rule-detail-actions .secondary-button {
  min-height: 40px;
  border-radius: 12px;
  font-weight: 500;
}

.ai-rule-detail-actions .secondary-button.edit {
  border-color: #c4b5fd;
  background: #f5f3ff;
  color: #6d28d9;
}

.ai-rule-detail-actions .secondary-button.test {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.ai-rule-audit-note {
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}

.ai-rule-edit-backdrop {
  z-index: 1200;
  align-items: flex-start;
  padding: 48px 20px;
  overflow: auto;
}

.ai-rule-edit-modal {
  width: min(860px, calc(100vw - 40px));
  max-height: none;
  border-radius: 22px;
  border: 1px solid #cfe0ff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .22);
}

.ai-rule-edit-modal .menu-modal-title {
  align-items: flex-start;
  gap: 18px;
}

.ai-rule-edit-modal .menu-modal-title h2 {
  margin: 4px 0 6px;
  color: #1f2937;
  font-size: 26px;
  letter-spacing: 0;
}

.ai-rule-edit-modal .menu-modal-title p {
  max-width: 620px;
  color: #64748b;
  line-height: 1.45;
}

.ai-rule-edit-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 15px;
  border: 1px solid #bbf7d0;
  border-radius: 14px;
  background: #ecfdf5;
  color: #047857;
  font-size: 14px;
}

.ai-rule-origin-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.4;
}

.ai-rule-origin-note.system {
  border: 1px solid #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.ai-rule-origin-note.custom {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.ai-rule-edit-diagnosis {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid #dbeafe;
  background: #f8fbff;
}

.ai-rule-edit-diagnosis.alto {
  border-color: #fecaca;
  background: #fff7f7;
}

.ai-rule-edit-diagnosis.medio,
.ai-rule-edit-diagnosis.médio {
  border-color: #fde68a;
  background: #fffbeb;
}

.ai-rule-edit-diagnosis.baixo {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

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

.ai-rule-edit-diagnosis-head strong,
.ai-rule-edit-tips strong {
  display: block;
  color: #1f2937;
  font-size: 16px;
}

.ai-rule-edit-diagnosis-head p {
  margin: 3px 0 0;
  color: #64748b;
  line-height: 1.4;
}

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

.ai-rule-edit-diagnosis-grid section {
  display: grid;
  align-content: start;
  gap: 9px;
}

.ai-rule-edit-diagnosis-grid h3 {
  margin: 0;
  color: #334155;
  font-size: 14px;
}

.ai-rule-edit-diagnosis-grid article {
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  border: 1px solid rgba(148, 163, 184, .28);
  border-radius: 13px;
  background: rgba(255, 255, 255, .72);
}

.ai-rule-edit-diagnosis-grid article strong {
  color: #1f2937;
  font-size: 14px;
}

.ai-rule-edit-diagnosis-grid article span,
.ai-rule-edit-tips span {
  color: #64748b;
  line-height: 1.42;
}

.ai-rule-edit-tips {
  display: grid;
  gap: 5px;
  padding: 13px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  background: #eff6ff;
}

.ai-rule-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.ai-rule-edit-grid label,
.ai-rule-edit-options label {
  display: grid;
  gap: 8px;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
}

.ai-rule-edit-grid .span-2 {
  grid-column: 1 / -1;
}

.ai-rule-edit-grid input,
.ai-rule-edit-grid select,
.ai-rule-edit-grid textarea,
.ai-rule-edit-modal .wizard-automation-editor-config input,
.ai-rule-edit-modal .wizard-automation-editor-config select,
.ai-rule-edit-modal .wizard-automation-editor-config textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid #d6e2f3;
  border-radius: 14px;
  background: #fff;
  color: #1f2937;
  font-size: 15px;
  font-weight: 500;
}

.ai-rule-edit-grid textarea,
.ai-rule-edit-modal .wizard-automation-editor-config textarea {
  min-height: 108px;
  resize: vertical;
}

.ai-rule-edit-modal .wizard-automation-editor-config {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 16px;
  border: 1px solid #dbeafe;
  border-radius: 16px;
  background: #f8fbff;
}

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

.ai-rule-edit-options .automation-switch {
  align-items: center;
  min-height: 54px;
  padding: 12px 14px;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  background: #f8fbff;
}

.ai-rule-edit-options .automation-switch.compact {
  position: relative;
  grid-template-columns: auto minmax(0, 1fr);
  display: grid;
  gap: 12px;
  min-height: 58px;
  cursor: pointer;
}

.ai-rule-edit-options .automation-switch.compact input {
  position: relative;
  width: 44px;
  min-width: 44px;
  height: 24px;
  min-height: 24px;
  margin: 0;
  appearance: none;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #e2e8f0;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease;
}

.ai-rule-edit-options .automation-switch.compact input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(15, 23, 42, .18);
  transition: transform .18s ease;
}

.ai-rule-edit-options .automation-switch.compact input:checked {
  border-color: #22c55e;
  background: #22c55e;
}

.ai-rule-edit-options .automation-switch.compact input:checked::after {
  transform: translateX(20px);
}

.ai-rule-edit-options .automation-switch.compact input:disabled {
  border-color: #d1d5db;
  background: #e5e7eb;
  cursor: not-allowed;
}

.ai-rule-edit-options .automation-switch.compact input:disabled::after {
  background: #f9fafb;
}

.ai-rule-edit-options .automation-switch.compact span {
  color: #1f2937;
  font-size: 15px;
  font-weight: 500;
}

.ai-rule-edit-options .automation-switch.compact:has(input:disabled) {
  opacity: .7;
  cursor: not-allowed;
}

.ai-rule-edit-modal .menu-modal-footer {
  gap: 12px;
  padding-top: 4px;
}

.ai-rule-edit-modal .menu-modal-footer .primary-button {
  border-radius: 12px;
  font-weight: 500;
}

.ai-rule-edit-modal .menu-modal-footer .danger-button,
.ai-rule-edit-modal .menu-modal-footer .secondary-button {
  border-radius: 12px;
  font-weight: 500;
}

@media (max-width: 780px) {
  .ai-rule-edit-backdrop {
    padding: 18px 10px;
  }

  .ai-rule-edit-modal,
  .ai-rule-edit-grid,
  .ai-rule-edit-modal .wizard-automation-editor-config,
  .ai-rule-edit-diagnosis-grid,
  .ai-rule-edit-options {
    grid-template-columns: 1fr;
  }

  .ai-rule-edit-diagnosis-head {
    grid-template-columns: 1fr;
  }

  .ai-rule-edit-modal {
    width: calc(100vw - 20px);
  }

  .ai-rule-edit-modal .menu-modal-title,
  .ai-rule-edit-modal .menu-modal-footer,
  .ai-rule-detail-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

.ai-rule-simulation-explain {
  display: grid;
  gap: 10px;
}

.ai-agent-flow-steps {
  list-style: none;
  padding: 0;
}

.ai-agent-flow-steps li {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.ai-agent-source-card.warning,
.list-row-card.warning {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.08);
}

.danger-text {
  color: var(--danger);
}

.ai-choice-grid {
  display: grid;
  grid-template-columns: 120px repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  align-items: center;
}

.ai-choice-grid button {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}

.ai-choice-grid button.active {
  border-color: var(--primary);
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 9%, var(--surface));
}

.ai-agent-preview-card {
  align-content: start;
}

.prompt-preview-box {
  max-height: 240px;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  white-space: pre-wrap;
  color: var(--text);
  background: var(--surface);
}

.ai-action-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

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

.ai-action-flow > div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 12px;
  background: var(--panel);
}

.simulator-wide {
  grid-template-columns: minmax(320px, 0.75fr) minmax(0, 1.25fr);
}

.ai-simulator-page {
  display: grid;
  gap: 18px;
}

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

.ai-simulator-guide-card {
  align-items: flex-start;
  border: 1px solid var(--border);
  border-radius: 16px;
  display: grid;
  gap: 8px;
  grid-template-columns: auto minmax(0, 1fr);
  padding: 16px;
}

.ai-simulator-guide-card svg {
  margin-top: 2px;
}

.ai-simulator-guide-card strong,
.ai-simulator-guide-card span {
  grid-column: 2;
}

.ai-simulator-guide-card.ask {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e3a8a;
}

.ai-simulator-guide-card.check {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #14532d;
}

.ai-simulator-guide-card.safe {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #7c2d12;
}

.ai-simulator-test-card,
.ai-simulator-result-card {
  border-radius: 18px;
}

.ai-simulator-chat-card {
  border-radius: 18px;
  display: grid;
  gap: 14px;
}

.ai-simulator-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-simulator-shortcuts button {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  color: #1d4ed8;
  cursor: pointer;
  font: inherit;
  padding: 8px 12px;
}

.ai-test-chat-window {
  background: linear-gradient(180deg, #f8fbff 0%, #eef6ff 100%);
  border: 1px solid #d8e7fb;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 430px;
  max-height: 620px;
  overflow: auto;
  padding: 18px;
}

.ai-test-chat-message {
  align-items: flex-end;
  display: flex;
  gap: 10px;
  max-width: 86%;
}

.ai-test-chat-message.client {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ai-test-chat-avatar {
  align-items: center;
  background: #dbeafe;
  border: 1px solid #bfdbfe;
  border-radius: 50%;
  color: #1d4ed8;
  display: flex;
  flex: 0 0 34px;
  font-weight: 700;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.ai-test-chat-message.client .ai-test-chat-avatar {
  background: #dcfce7;
  border-color: #bbf7d0;
  color: #166534;
}

.ai-test-chat-bubble {
  background: #ffffff;
  border: 1px solid #dbeafe;
  border-radius: 18px 18px 18px 6px;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.06);
  display: grid;
  gap: 6px;
  padding: 12px 14px;
}

.ai-test-chat-message.client .ai-test-chat-bubble {
  background: #ecfdf5;
  border-color: #bbf7d0;
  border-radius: 18px 18px 6px 18px;
}

.ai-test-chat-message.pending .ai-test-chat-bubble {
  opacity: 0.75;
}

.ai-test-chat-bubble small {
  color: var(--muted);
  font-size: 0.78rem;
}

.ai-test-chat-bubble p {
  color: var(--text);
  line-height: 1.45;
  margin: 0;
  white-space: pre-wrap;
}

.ai-test-chat-bubble span {
  background: #eef2ff;
  border-radius: 999px;
  color: #3730a3;
  font-size: 0.78rem;
  padding: 4px 8px;
  width: fit-content;
}

.ai-test-chat-composer {
  align-items: stretch;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.ai-test-chat-composer textarea {
  border: 1px solid var(--border);
  border-radius: 16px;
  font: inherit;
  min-height: 60px;
  padding: 12px;
  resize: vertical;
}

.ai-simulator-test-card textarea {
  min-height: 210px;
}

.ai-simulator-status-banner {
  align-items: center;
  border-radius: 16px;
  display: grid;
  gap: 12px;
  grid-template-columns: auto minmax(0, 1fr);
  padding: 15px;
}

.ai-simulator-status-banner strong {
  display: block;
  margin-bottom: 3px;
}

.ai-simulator-status-banner.ok {
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  color: #14532d;
}

.ai-simulator-status-banner.warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #78350f;
}

.ai-simulator-result {
  display: grid;
  gap: 14px;
}

.ai-simulator-result .chat-preview-phone {
  background: linear-gradient(180deg, #f8fbff 0%, #eef6ff 100%);
  border: 1px solid #d8e7fb;
  border-radius: 18px;
  padding: 16px;
}

.ai-simulator-result .chat-bubble.bot {
  max-width: none;
}

.ai-simulator-result .ai-explain-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ai-simulator-result .ai-explain-grid section {
  border-radius: 16px;
  min-height: 120px;
}

.ai-simulator-result .ai-explain-grid section h3 {
  margin: 0;
}

.ai-simulator-result .ai-explain-grid section:nth-child(1)::before {
  color: var(--primary);
  content: "Memoria da conversa";
  font-weight: 650;
}

.ai-simulator-result .ai-explain-grid section:nth-child(2)::before {
  color: var(--primary);
  content: "Caminho usado";
  font-weight: 650;
}

.ai-simulator-result .ai-explain-grid section:nth-child(3)::before {
  color: #0f766e;
  content: "Fontes encontradas";
  font-weight: 650;
}

.ai-simulator-result .ai-explain-grid section:nth-child(4)::before {
  color: #b45309;
  content: "Regras importantes";
  font-weight: 650;
}

.ai-simulator-result .ai-explain-grid section:nth-child(5)::before {
  color: #7c3aed;
  content: "Sugestoes para a equipe";
  font-weight: 650;
}

.ai-simulator-result .ai-explain-grid section > h3 {
  display: none;
}

.ai-simulator-hero {
  align-items: center;
  display: flex;
  justify-content: space-between;
  min-height: auto;
}

.ai-simulator-hero-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.ai-simulator-mode-switch {
  align-items: center;
  background: #eef4ff;
  border: 1px solid #cfe0f6;
  border-radius: 999px;
  display: inline-flex;
  gap: 4px;
  padding: 4px;
}

.ai-simulator-mode-switch button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: #42526b;
  cursor: pointer;
  display: inline-flex;
  font-weight: 500;
  gap: 6px;
  min-height: 34px;
  padding: 7px 12px;
}

.ai-simulator-mode-switch button.active {
  background: #ffffff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.16);
  color: #1d4ed8;
}

.ai-simulator-flow-picker {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #dbe7f3;
  border-radius: 14px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 6px 8px;
}

.ai-simulator-flow-picker select {
  background: #ffffff;
  border: 1px solid #d7e3f7;
  border-radius: 10px;
  color: var(--text);
  min-height: 34px;
  min-width: 180px;
  padding: 5px 8px;
}

.ai-simulator-hero-actions > span {
  align-items: center;
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  color: #047857;
  display: inline-flex;
  gap: 6px;
  padding: 8px 12px;
}

.ai-simulator-workbench {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
  align-items: start;
}

.ai-simulator-live-chat {
  display: flex;
  flex-direction: column;
  height: min(680px, calc(100vh - 230px));
  min-height: 0;
  max-height: 680px;
  padding: 0;
  overflow: hidden;
}

.ai-simulator-chat-top {
  align-items: center;
  background: linear-gradient(135deg, #eff6ff, #f8fafc);
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 12px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding: 16px 18px;
}

.ai-simulator-chat-top div {
  display: grid;
  gap: 3px;
}

.ai-simulator-chat-top span,
.ai-simulator-chat-top small {
  color: var(--muted);
}

.ai-simulator-chat-top .ai-simulator-dev-engine {
  align-items: center;
  background: #f6f9ff;
  border: 1px solid #d7e3f7;
  border-radius: 999px;
  color: #47627f;
  display: inline-flex;
  font-size: 0.74rem;
  justify-content: center;
  line-height: 1;
  padding: 6px 9px;
  white-space: nowrap;
}

.ai-simulator-chat-top .ai-simulator-dev-engine.v2 {
  background: #edfff5;
  border-color: #b9f0cf;
  color: #08733c;
}

.ai-simulator-chat-top .ai-simulator-dev-engine.mismatch {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.ai-simulator-chat-top .ai-simulator-dev-engine.provider.ok {
  background: #ecfdf5;
  border-color: #86efac;
  color: #047857;
}

.ai-simulator-chat-top .ai-simulator-dev-engine.provider.warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.ai-simulator-chat-top .ai-simulator-dev-engine.model {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #3730a3;
}

.ai-simulator-chat-top .ai-simulator-dev-engine.tokens {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #334155;
}

.ai-simulator-live-chat .ai-simulator-shortcuts {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 18px;
}

.ai-simulator-live-chat .ai-simulator-shortcuts button {
  border-radius: 999px;
  flex: 0 0 auto;
  font-size: 0.86rem;
  line-height: 1.2;
  min-height: 34px;
  padding: 7px 11px;
  white-space: nowrap;
}

.ai-simulator-live-chat .ai-test-chat-window {
  border: 0;
  border-radius: 0;
  flex: 1;
  min-height: 0;
  max-height: none;
  overscroll-behavior: contain;
  padding: 18px 20px;
  scroll-padding-bottom: 20px;
}

.ai-simulator-live-chat .ai-test-chat-message {
  max-width: min(78%, 760px);
}

.ai-simulator-live-chat .ai-test-chat-message.client {
  max-width: min(70%, 560px);
}

.ai-simulator-live-chat .ai-test-chat-bubble {
  font-size: 0.95rem;
  padding: 11px 13px;
}

.ai-simulator-live-chat .ai-test-chat-bubble p {
  max-height: 180px;
  overflow: auto;
}

.ai-simulator-live-chat .ai-test-chat-message.client .ai-test-chat-bubble p {
  max-height: none;
}

.ai-simulator-live-chat .ai-test-chat-composer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex: 0 0 auto;
  padding: 14px 18px;
  position: relative;
  z-index: 2;
}

.ai-simulator-live-chat .ai-test-chat-composer textarea {
  min-height: 46px;
  resize: none;
}

.ai-simulator-live-chat .ai-test-chat-composer .primary-button {
  border-radius: 14px;
  min-width: 112px;
}

.ai-simulator-live-sidebar {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 16px;
}

.ai-simulator-live-sidebar .ai-agent-empty {
  min-height: 260px;
}

.ai-simulator-live-metrics {
  display: grid;
  gap: 10px;
}

.ai-simulator-live-metrics .ai-agent-decision-card {
  border-radius: 14px;
  padding: 12px;
}

.ai-simulator-live-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: grid;
  gap: 10px;
  padding: 14px;
}

.ai-simulator-live-section > strong {
  color: var(--text);
}

.ai-simulator-live-section.ai-simulator-dev-panel {
  background: #f8fbff;
  border-style: dashed;
}

.ai-simulator-dev-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ai-simulator-dev-grid article {
  background: #ffffff;
  border: 1px solid #dbe7f3;
  border-radius: 12px;
  display: grid;
  gap: 4px;
  padding: 10px;
}

.ai-simulator-dev-grid article.ok {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.ai-simulator-dev-grid article.warning {
  background: #fffbeb;
  border-color: #fde68a;
}

.ai-simulator-dev-grid article small {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.ai-simulator-dev-grid article strong {
  color: var(--text);
  font-size: 0.95rem;
}

.ai-simulator-dev-grid article span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
}

.ai-simulator-learned-panel {
  background: #ffffff;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.ai-simulator-learned-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ai-simulator-learned-tags span {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  color: #1d4ed8;
  font-size: 0.74rem;
  padding: 5px 8px;
}

.ai-simulator-learned-evidence {
  display: grid;
  gap: 8px;
}

.ai-simulator-learned-evidence article {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  display: grid;
  gap: 4px;
  padding: 10px;
}

.ai-simulator-learned-evidence article strong {
  color: var(--text);
  font-size: 0.88rem;
}

.ai-simulator-learned-evidence article small,
.ai-simulator-learned-evidence article span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.3;
}

.ai-simulator-learned-evidence article span {
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  display: -webkit-box;
  overflow: hidden;
}

.ai-simulator-live-section .source-evidence,
.ai-simulator-live-section .compact-row {
  border-radius: 12px;
  font-size: 0.88rem;
  padding: 10px;
}

.ai-simulator-live-section .source-evidence p,
.ai-simulator-live-section .compact-row small {
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  display: -webkit-box;
  overflow: hidden;
}

@media (max-width: 1100px) {
  .ai-simulator-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .ai-simulator-hero-actions {
    justify-content: flex-start;
    width: 100%;
  }

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

  .ai-simulator-live-sidebar {
    position: static;
  }

  .ai-simulator-dev-grid {
    grid-template-columns: 1fr;
  }

  .ai-simulator-live-chat {
    height: min(720px, calc(100vh - 180px));
    min-height: 0;
    width: 100%;
  }
}

@media (max-width: 560px) {
  .ai-simulator-page {
    gap: 12px;
  }

  .ai-simulator-hero,
  .ai-simulator-live-chat,
  .ai-simulator-live-sidebar {
    border-radius: 14px;
  }

  .ai-simulator-chat-top {
    grid-template-columns: auto minmax(0, 1fr);
    padding: 14px;
  }

  .ai-simulator-chat-top small {
    grid-column: 1 / -1;
  }

  .ai-simulator-live-chat .ai-test-chat-window {
    min-height: 0;
    max-height: none;
    padding: 16px 12px;
  }

  .ai-simulator-live-chat .ai-test-chat-message,
  .ai-simulator-live-chat .ai-test-chat-message.client {
    max-width: 94%;
  }

  .ai-simulator-live-chat .ai-test-chat-composer {
    grid-template-columns: minmax(0, 1fr);
    padding: 12px;
  }

  .ai-simulator-live-chat .ai-test-chat-composer .primary-button {
    justify-content: center;
    width: 100%;
  }
}

.ai-agent-decision-grid,
.ai-explain-grid,
.ai-settings-groups,
.channel-grid-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ai-agent-decision-card,
.ai-explain-grid section,
.ai-settings-groups article {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.ai-agent-decision-card.ok {
  border-color: rgba(34, 197, 94, 0.35);
}

.ai-agent-decision-card.warning {
  border-color: rgba(245, 158, 11, 0.4);
}

.ai-brain-command-center {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid #bfdbfe;
  border-radius: 18px;
  background: linear-gradient(135deg, #eff6ff 0%, #ffffff 72%);
}

.ai-brain-command-center.ok {
  border-color: #bbf7d0;
  background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 72%);
}

.ai-brain-command-center.warning {
  border-color: #fde68a;
  background: linear-gradient(135deg, #fffbeb 0%, #ffffff 72%);
}

.ai-brain-command-center.danger {
  border-color: #fecaca;
  background: linear-gradient(135deg, #fef2f2 0%, #ffffff 72%);
}

.ai-brain-command-status {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.ai-brain-command-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 16px;
  background: #dbeafe;
  color: #1d4ed8;
}

.ai-brain-command-center.ok .ai-brain-command-icon {
  background: #dcfce7;
  color: #15803d;
}

.ai-brain-command-center.warning .ai-brain-command-icon {
  background: #fef3c7;
  color: #b45309;
}

.ai-brain-command-center.danger .ai-brain-command-icon {
  background: #fee2e2;
  color: #b91c1c;
}

.ai-brain-command-status h2 {
  margin: 3px 0 4px;
  color: #1f2937;
  font-size: 24px;
  letter-spacing: 0;
}

.ai-brain-command-status p {
  margin: 0;
  color: #64748b;
  line-height: 1.45;
}

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

.ai-brain-command-guide article {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, .24);
  border-radius: 14px;
  background: rgba(255, 255, 255, .78);
}

.ai-brain-command-guide strong {
  color: #1f2937;
}

.ai-brain-command-guide span {
  color: #64748b;
  line-height: 1.4;
}

.ai-brain-metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.ai-brain-metrics-grid .ai-agent-decision-card {
  min-height: 118px;
  border-radius: 18px;
  background: #f8fbff;
}

.ai-brain-metrics-grid .ai-agent-decision-card strong {
  font-size: 22px;
}

.ai-brain-metrics-grid .ai-agent-decision-card.ok {
  background: #ecfdf5;
}

.ai-brain-metrics-grid .ai-agent-decision-card.warning {
  background: #fffbeb;
}

.ai-brain-review-center {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid #bfdbfe;
  border-radius: 18px;
  background: #f8fbff;
}

.ai-brain-review-center.ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.ai-brain-review-center.warning {
  border-color: #fde68a;
  background: #fffbeb;
}

.ai-brain-review-center.danger {
  border-color: #fecaca;
  background: #fff1f2;
}

.ai-brain-review-center.neutral {
  border-color: #dbe7f5;
  background: #f8fafc;
}

.ai-brain-review-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
}

.ai-brain-review-header h2 {
  margin: 4px 0;
  color: #1f2937;
  font-size: 22px;
  letter-spacing: 0;
}

.ai-brain-review-header p,
.ai-brain-review-focus p {
  margin: 0;
  color: #64748b;
  line-height: 1.45;
}

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

.ai-brain-review-action,
.ai-brain-review-list button {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 14px;
  border: 1px solid #cfe0f4;
  border-radius: 14px;
  background: #fff;
  color: #1f2937;
  text-align: left;
  cursor: pointer;
}

.ai-brain-review-action:hover,
.ai-brain-review-list button:hover {
  border-color: #3b82f6;
  box-shadow: 0 10px 24px rgba(37, 99, 235, .12);
  transform: translateY(-1px);
}

.ai-brain-review-action strong,
.ai-brain-review-focus strong,
.ai-brain-review-list span {
  color: #111827;
}

.ai-brain-review-action span,
.ai-brain-review-list small {
  color: #64748b;
  line-height: 1.4;
}

.ai-brain-review-focus {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px dashed rgba(180, 83, 9, .32);
  border-radius: 14px;
  background: rgba(255, 255, 255, .72);
}

.ai-brain-review-list {
  display: grid;
  gap: 8px;
}

.ai-brain-review-list button {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
}

.ai-brain-review-list b {
  color: #1d4ed8;
  font-weight: 600;
}

.ai-brain-fix-box {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid #fde68a;
  border-radius: 16px;
  background: #fffbeb;
}

.ai-brain-fix-box.ok {
  border-color: #bbf7d0;
  background: #ecfdf5;
}

.ai-brain-fix-box h3 {
  margin: 4px 0;
  color: #1f2937;
  font-size: 18px;
}

.ai-brain-fix-box p {
  margin: 0;
  color: #64748b;
  line-height: 1.45;
}

.ai-brain-fix-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ai-brain-fix-plan {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid rgba(180, 83, 9, .24);
  border-radius: 14px;
  background: rgba(255, 255, 255, .72);
}

.ai-brain-fix-plan strong {
  color: #92400e;
}

.ai-brain-fix-plan ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  color: #64748b;
}

.ai-brain-fix-plan small {
  color: #64748b;
  line-height: 1.4;
}

html[data-theme="dark"] .ai-brain-fix-box {
  background: rgba(120, 53, 15, .22);
  border-color: rgba(251, 191, 36, .34);
}

html[data-theme="dark"] .ai-brain-fix-box.ok {
  background: rgba(22, 101, 52, .2);
  border-color: rgba(74, 222, 128, .32);
}

html[data-theme="dark"] .ai-brain-fix-box h3 {
  color: #edf6ff;
}

html[data-theme="dark"] .ai-brain-fix-box p {
  color: #a9bad0;
}

html[data-theme="dark"] .ai-brain-fix-plan {
  background: rgba(11, 33, 48, .72);
  border-color: rgba(251, 191, 36, .28);
}

html[data-theme="dark"] .ai-brain-fix-plan strong {
  color: #fde68a;
}

html[data-theme="dark"] .ai-brain-fix-plan ul,
html[data-theme="dark"] .ai-brain-fix-plan small {
  color: #a9bad0;
}

html[data-theme="dark"] .ai-brain-review-center {
  background: #102c40;
  border-color: rgba(143, 191, 225, .28);
}

html[data-theme="dark"] .ai-brain-review-center.ok {
  background: rgba(22, 101, 52, .2);
  border-color: rgba(74, 222, 128, .32);
}

html[data-theme="dark"] .ai-brain-review-center.warning {
  background: rgba(120, 53, 15, .22);
  border-color: rgba(251, 191, 36, .34);
}

html[data-theme="dark"] .ai-brain-review-center.danger {
  background: rgba(127, 29, 29, .24);
  border-color: rgba(248, 113, 113, .36);
}

html[data-theme="dark"] .ai-brain-review-header h2,
html[data-theme="dark"] .ai-brain-review-action strong,
html[data-theme="dark"] .ai-brain-review-focus strong,
html[data-theme="dark"] .ai-brain-review-list span {
  color: #edf6ff;
}

html[data-theme="dark"] .ai-brain-review-header p,
html[data-theme="dark"] .ai-brain-review-focus p,
html[data-theme="dark"] .ai-brain-review-action span,
html[data-theme="dark"] .ai-brain-review-list small {
  color: #a9bad0;
}

html[data-theme="dark"] .ai-brain-review-action,
html[data-theme="dark"] .ai-brain-review-list button {
  background: #0b2130;
  border-color: rgba(143, 191, 225, .28);
  color: #edf6ff;
}

html[data-theme="dark"] .ai-brain-review-focus {
  background: rgba(11, 33, 48, .72);
  border-color: rgba(251, 191, 36, .3);
}

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

.ai-logs-page {
  display: grid;
  gap: 18px;
}

.ai-log-summary-grid,
.ai-log-help-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ai-log-help-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ai-log-summary-card,
.ai-log-help-grid article {
  border: 1px solid var(--border);
  border-radius: 16px;
  display: grid;
  gap: 6px;
  padding: 16px;
}

.ai-log-summary-card svg {
  margin-bottom: 4px;
}

.ai-log-summary-card span,
.ai-log-help-grid span {
  color: var(--muted);
  line-height: 1.4;
}

.ai-log-summary-card strong {
  color: var(--text);
  font-size: 1.25rem;
}

.ai-log-summary-card.total {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.ai-log-summary-card.test {
  background: #f5f3ff;
  border-color: #ddd6fe;
  color: #6d28d9;
}

.ai-log-summary-card.action {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #15803d;
}

.ai-log-summary-card.confidence {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #c2410c;
}

.ai-log-help-grid article {
  background: #f8fbff;
  border-color: #d8e3f2;
}

.ai-log-help-grid strong {
  color: var(--text);
}

.ai-log-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.ai-log-filter-row button {
  align-items: center;
  background: #ffffff;
  border: 1px solid #d8e3f2;
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  gap: 8px;
  min-height: 38px;
  padding: 8px 13px;
}

.ai-log-filter-row button strong {
  background: #eef4ff;
  border-radius: 999px;
  color: #1d4ed8;
  min-width: 24px;
  padding: 2px 7px;
}

.ai-log-filter-row button.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.ai-log-filter-row button.active strong {
  background: rgba(255, 255, 255, .2);
  color: #ffffff;
}

.ai-log-timeline article {
  display: grid;
  gap: 5px;
  padding: 14px;
  border-left: 3px solid var(--primary);
  border-radius: 12px;
  background: var(--surface);
}

.ai-log-entry {
  border-left-width: 5px;
}

.ai-log-entry.ok {
  border-left-color: #22c55e;
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 72%);
}

.ai-log-entry.warning {
  border-left-color: #f59e0b;
  background: linear-gradient(180deg, #fffbeb 0%, #ffffff 72%);
}

.ai-log-entry.test {
  border-left-color: #8b5cf6;
  background: linear-gradient(180deg, #f5f3ff 0%, #ffffff 72%);
}

.ai-log-entry.neutral {
  border-left-color: #94a3b8;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 72%);
}

.ai-log-entry strong {
  color: var(--text);
}

.ai-log-entry p {
  color: var(--muted);
  margin: 0;
}

.ai-agent-onboarding {
  width: min(860px, calc(100vw - 32px));
}

.onboarding-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.onboarding-steps button {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--surface);
  color: var(--text);
}

.onboarding-steps button.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.onboarding-card,
.ai-agent-mode-note {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.ai-agent-mode-note {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  background: rgba(14, 165, 233, 0.08);
}

.ai-agent-wizard-backdrop {
  align-items: flex-start;
  overflow: auto;
  padding: 34px 18px;
}

.ai-agent-wizard-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(1880px, calc(100vw - 44px));
  max-height: calc(100vh - 68px);
  min-height: min(760px, calc(100vh - 68px));
  overflow: hidden;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.5);
  border-radius: 20px;
  background: var(--surface, #ffffff);
  box-shadow: 0 26px 80px rgba(15, 23, 42, 0.22);
}

.ai-agent-wizard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 34px 38px 22px;
}

.ai-agent-wizard-head h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 1.32rem;
}

.ai-agent-wizard-head h2 span {
  padding: 4px 10px;
  border: 1px solid rgba(126, 87, 194, 0.45);
  border-radius: 999px;
  background: rgba(126, 87, 194, 0.14);
  color: #7e3acb;
  font-size: 0.78rem;
  font-weight: 600;
}

.ai-agent-wizard-steps {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  max-width: 920px;
  margin: 8px auto 42px;
}

.ai-agent-wizard-steps button {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
}

.ai-agent-wizard-steps button::before {
  content: "";
  position: absolute;
  top: 16px;
  left: calc(-50% + 22px);
  right: calc(50% + 22px);
  height: 1px;
  background: var(--border);
}

.ai-agent-wizard-steps button:first-child::before {
  display: none;
}

.ai-agent-wizard-steps span {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-muted);
  font-weight: 700;
}

.ai-agent-wizard-steps button.active span,
.ai-agent-wizard-steps button.done span {
  background: #2f80ed;
  color: #fff;
}

.ai-agent-wizard-steps button.active strong {
  color: var(--text);
}

.ai-agent-wizard-steps strong {
  font-size: 0.88rem;
  font-weight: 500;
}

.ai-agent-wizard-body {
  min-height: 0;
  overflow: auto;
  padding: 0 38px 24px;
}

.ai-agent-wizard-notice {
  margin: 0 0 18px;
  border: 1px solid rgba(34, 197, 94, 0.24);
  border-radius: 14px;
  background: rgba(34, 197, 94, 0.08);
  color: #137b37;
  padding: 12px 14px;
  font-size: 0.92rem;
  line-height: 1.4;
}

.ai-agent-wizard-notice.danger {
  border-color: rgba(239, 68, 68, 0.22);
  background: rgba(239, 68, 68, 0.07);
  color: #b42318;
}

.ai-agent-profile-step {
  display: grid;
  gap: 24px;
}

.ai-agent-profile-step h3,
.wizard-step-card h3 {
  margin: 0;
  font-size: 1rem;
}

.wizard-field {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-size: 0.9rem;
}

.wizard-field.full {
  grid-column: 1 / -1;
}

.wizard-field.wide {
  grid-column: span 2;
}

.wizard-field > span {
  color: #ef4444;
}

.wizard-sector-field > span {
  color: var(--text-muted);
  font-weight: 700;
}

.wizard-field input,
.wizard-field select,
.wizard-field textarea,
.wizard-url-input {
  min-height: 44px;
  border: 1px solid rgba(148, 163, 184, 0.75);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
}

.wizard-field textarea {
  border-radius: 14px;
  padding: 12px 14px;
}

.wizard-field input,
.wizard-field select {
  padding: 0 14px;
}

.wizard-sector-select {
  color: var(--text-muted);
}

.wizard-sector-select select {
  width: 100%;
  min-height: 52px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid rgba(148, 163, 184, 0.85);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.02);
  color: var(--text);
  font-size: 1rem;
}

.wizard-agent-role-section {
  display: grid;
  gap: 12px;
}

.wizard-agent-role-section > span {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.wizard-agent-role-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.wizard-agent-role-grid button {
  display: grid;
  min-height: 134px;
  align-content: start;
  gap: 10px;
  border: 1px solid rgba(148, 163, 184, 0.72);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--card), var(--surface));
  color: var(--text);
  cursor: pointer;
  padding: 18px 20px 16px;
  text-align: left;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.wizard-agent-role-grid button:hover,
.wizard-agent-role-grid button.active {
  border-color: #4f7df3;
  box-shadow: 0 0 0 3px rgba(79, 125, 243, 0.13), 0 14px 28px rgba(37, 99, 235, 0.10);
  transform: translateY(-1px);
}

.wizard-agent-role-grid button.active {
  background: linear-gradient(180deg, rgba(79, 125, 243, 0.07), var(--surface));
}

.wizard-agent-role-grid strong {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 650;
}

.wizard-agent-role-grid strong span {
  border-radius: 999px;
  background: rgba(91, 124, 250, 0.14);
  color: #4f46e5;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 9px;
}

.wizard-agent-role-grid p,
.wizard-agent-role-grid small {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.42;
}

.wizard-agent-role-grid small b {
  color: var(--text);
  font-weight: 650;
}

.wizard-segment-profile-card,
.wizard-segment-help,
.ai-agent-segment-note,
.ai-segment-side-note {
  border: 1px solid rgba(125, 145, 185, 0.25);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(245, 248, 255, 0.92), rgba(255, 255, 255, 0.96));
  box-shadow: 0 12px 30px rgba(30, 64, 175, 0.06);
}

.wizard-segment-profile-card {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(220px, 0.6fr);
  gap: 18px;
  padding: 18px;
  margin-top: 12px;
}

.wizard-segment-profile-card h4,
.wizard-segment-help strong,
.ai-agent-segment-note strong,
.ai-segment-side-note strong {
  display: block;
  margin: 0 0 6px;
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 650;
}

.wizard-segment-profile-card p,
.wizard-segment-profile-card small,
.wizard-segment-help small,
.ai-agent-segment-note span,
.ai-segment-side-note span {
  display: block;
  margin: 0;
  color: var(--text-muted);
  line-height: 1.45;
}

.wizard-segment-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: start;
}

.wizard-segment-suggestions span,
.ai-agent-suggestion-chip-grid span,
.ai-agent-suggested-automation-list span {
  border-radius: 999px;
  background: rgba(79, 125, 243, 0.10);
  color: #3159c9;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 7px 10px;
}

.wizard-segment-help {
  display: grid;
  gap: 10px;
  padding: 16px;
  margin: 14px 0;
}

.wizard-segment-help.compact {
  margin-top: 0;
}

.ai-agent-suggestion-chip-grid,
.ai-agent-suggested-automation-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-agent-segment-note {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  padding: 14px 16px;
}

.ai-segment-side-note p {
  display: grid;
  gap: 5px;
  margin: 0;
}

body.theme-dark .wizard-segment-profile-card,
body.theme-dark .wizard-segment-help,
body.theme-dark .ai-agent-segment-note,
body.theme-dark .ai-segment-side-note {
  border-color: rgba(148, 163, 184, 0.24);
  background: linear-gradient(180deg, rgba(20, 31, 51, 0.92), rgba(15, 23, 42, 0.96));
  box-shadow: none;
}

.wizard-sector-field {
  position: relative;
}

.wizard-sector-trigger {
  display: flex;
  width: 100%;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.wizard-sector-trigger:hover,
.wizard-sector-trigger.selected {
  border-color: rgba(37, 99, 235, 0.45);
  background: rgba(37, 99, 235, 0.04);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
}

.wizard-sector-trigger strong,
.wizard-sector-main strong {
  display: block;
  color: var(--text);
  font-size: 0.98rem;
}

.wizard-sector-trigger small,
.wizard-sector-main small {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.wizard-sector-trigger > span {
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
  color: #2563eb;
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 800;
}

.wizard-sector-menu {
  position: relative;
  z-index: 2;
  display: grid;
  max-height: 320px;
  overflow: auto;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card);
  margin-top: 8px;
  padding: 10px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.wizard-sector-menu button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  padding: 12px;
  text-align: left;
  cursor: pointer;
}

.wizard-sector-menu button:hover,
.wizard-sector-menu button.active {
  border-color: rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.07);
}

.wizard-sector-main em {
  display: block;
  margin-top: 2px;
  color: #2563eb;
  font-size: 0.82rem;
  font-style: normal;
  font-weight: 800;
}

.wizard-sector-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: 260px;
}

.wizard-sector-tags span {
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  color: var(--text-muted);
  padding: 6px 8px;
  font-size: 0.72rem;
  font-weight: 700;
}

.ai-agent-profile-grid {
  display: grid;
  grid-template-columns: 142px minmax(0, 1fr);
  align-items: center;
  gap: 26px;
  padding: 20px 0 10px;
}

.ai-agent-avatar-zone {
  position: relative;
  width: 142px;
}

.ai-agent-avatar-preview {
  display: grid;
  width: 142px;
  height: 142px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.55);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(241, 245, 249, 0.9), var(--surface));
  color: var(--text-muted);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.12);
}

.ai-agent-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-camera {
  position: absolute;
  right: 4px;
  bottom: 0;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}

.ai-agent-profile-actions {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(180px, 260px);
  justify-content: start;
  align-content: center;
}

.upload-like {
  justify-content: flex-start;
  cursor: pointer;
}

.ai-agent-profile-actions .secondary-button,
.ai-agent-profile-actions .upload-like {
  display: inline-flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  border-radius: 14px;
  padding: 0 16px;
  font-weight: 600;
}

.ai-agent-profile-actions .secondary-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.ai-agent-wizard-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px minmax(260px, 0.72fr);
  gap: 18px 22px;
  padding-top: 8px;
}

.wizard-toggle-line {
  display: flex;
  align-items: end;
  gap: 10px;
  padding-bottom: 12px;
}

.wizard-toggle-line input[type="checkbox"] {
  appearance: none;
  align-self: center;
  background: #cbd5e1;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  height: 24px;
  min-height: 24px;
  padding: 0;
  position: relative;
  width: 44px;
}

.wizard-toggle-line input[type="checkbox"]::after {
  background: #fff;
  border-radius: 999px;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.24);
  content: "";
  height: 18px;
  left: 3px;
  position: absolute;
  top: 3px;
  transition: transform 0.16s ease;
  width: 18px;
}

.wizard-toggle-line input[type="checkbox"]:checked {
  background: #2f80ed;
}

.wizard-toggle-line input[type="checkbox"]:checked::after {
  transform: translateX(20px);
}

.wizard-url-input {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  padding-left: 14px;
}

.wizard-url-input span {
  color: var(--text-muted);
}

.wizard-url-input input {
  border: 0;
  background: transparent;
  outline: none;
}

.wizard-more-options summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
}

.wizard-more-options[open] {
  display: grid;
  gap: 12px;
}

.wizard-step-card {
  min-height: 360px;
  align-content: start;
  border: 1px solid rgba(148, 163, 184, 0.55);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.wizard-behavior-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.48fr);
  gap: 24px;
  align-items: start;
}

.wizard-behavior-main,
.wizard-conversation-preview {
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.wizard-behavior-main {
  display: grid;
  gap: 26px;
  padding: 30px 32px 34px;
}

.wizard-behavior-main h3,
.wizard-conversation-preview h3 {
  margin: 0;
  color: #172033;
  font-size: 1.08rem;
  font-weight: 700;
}

.wizard-behavior-block {
  display: grid;
  gap: 12px;
}

.wizard-behavior-block > span {
  color: #384256;
  font-size: 0.9rem;
  font-weight: 500;
}

.wizard-identity-grid,
.wizard-tone-grid {
  display: grid;
  gap: 14px;
}

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

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

.wizard-identity-grid button,
.wizard-tone-grid button,
.wizard-pace-grid button {
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 16px;
  background: #fff;
  color: #1f2937;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.wizard-identity-grid button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "icon title"
    "icon helper";
  align-items: center;
  gap: 3px 14px;
  min-height: 86px;
  padding: 18px 20px;
  text-align: left;
}

.wizard-identity-grid svg {
  grid-area: icon;
  color: #1f2937;
}

.wizard-identity-grid strong {
  grid-area: title;
  font-size: 1rem;
  font-weight: 700;
}

.wizard-identity-grid small {
  grid-area: helper;
  color: #64748b;
  font-size: 0.86rem;
}

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

.wizard-pace-grid button {
  display: grid;
  min-height: 122px;
  justify-items: center;
  align-content: center;
  gap: 12px;
  padding: 16px 10px;
}

.wizard-pace-grid i {
  display: block;
  width: 44px;
  height: 32px;
  border-radius: 8px;
  background:
    linear-gradient(#eef1f5, #eef1f5) center 7px / 18px 5px no-repeat,
    linear-gradient(#e5e9ef, #e5e9ef) center 19px / 32px 6px no-repeat;
}

.wizard-pace-grid button:nth-child(1) i {
  background:
    linear-gradient(#eef1f5, #eef1f5) center 10px / 18px 5px no-repeat,
    linear-gradient(#f1f5f9, #f1f5f9) center 22px / 26px 5px no-repeat;
}

.wizard-pace-grid button:nth-child(3) i {
  background:
    linear-gradient(#eef1f5, #eef1f5) center 6px / 22px 5px no-repeat,
    linear-gradient(#e5e9ef, #e5e9ef) center 18px / 36px 9px no-repeat;
}

.wizard-pace-grid button:nth-child(4) i,
.wizard-pace-grid button:nth-child(5) i {
  background:
    linear-gradient(#eef1f5, #eef1f5) center 3px / 24px 5px no-repeat,
    linear-gradient(#eef1f5, #eef1f5) center 15px / 34px 6px no-repeat,
    linear-gradient(#e5e9ef, #e5e9ef) center 29px / 48px 13px no-repeat;
}

.wizard-pace-grid strong,
.wizard-tone-grid strong {
  font-size: 0.9rem;
  font-weight: 700;
}

.wizard-tone-grid button {
  display: grid;
  min-height: 90px;
  justify-items: center;
  align-content: center;
  gap: 10px;
  padding: 14px;
}

.wizard-tone-grid svg {
  color: #5b6472;
}

.wizard-identity-grid button:hover,
.wizard-tone-grid button:hover,
.wizard-pace-grid button:hover,
.wizard-identity-grid button.active,
.wizard-tone-grid button.active,
.wizard-pace-grid button.active {
  border-color: #5b7cff;
  box-shadow: 0 0 0 2px rgba(91, 124, 255, 0.13);
  transform: translateY(-1px);
}

.wizard-identity-grid button.active,
.wizard-tone-grid button.active,
.wizard-pace-grid button.active {
  background: #fff;
}

.wizard-behavior-helper {
  min-height: 20px;
  margin: 0;
  color: #667085;
  font-size: 0.9rem;
}

.wizard-behavior-more {
  margin-top: 2px;
}

.wizard-behavior-more summary {
  cursor: pointer;
  color: #1f2937;
  font-weight: 600;
}

.wizard-behavior-options {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.wizard-behavior-options.two-cols {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wizard-behavior-options label {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f8fafc;
  padding: 10px 12px;
  color: #475467;
  font-size: 0.88rem;
}

.wizard-slider-grid.compact {
  margin-top: 14px;
}

.wizard-conversation-preview {
  overflow: hidden;
}

.wizard-conversation-preview h3 {
  padding: 24px 26px 18px;
  border-bottom: 1px solid #edf1f6;
}

.wizard-phone-chat {
  display: grid;
  gap: 16px;
  min-height: 520px;
  align-content: start;
  padding: 30px 26px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.wizard-chat-bubble {
  display: grid;
  gap: 6px;
  max-width: 78%;
  border-radius: 18px;
  padding: 14px 16px 10px;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.wizard-chat-bubble p {
  margin: 0;
  color: #2f3745;
  font-size: 0.95rem;
  line-height: 1.36;
}

.wizard-chat-bubble small {
  justify-self: end;
  color: #8a93a3;
  font-size: 0.78rem;
}

.wizard-chat-bubble.client {
  justify-self: start;
  background: #eeeeef;
}

.wizard-chat-bubble.agent {
  justify-self: end;
  background: #d9f2df;
}

.wizard-knowledge-layout {
  display: grid;
  gap: 26px;
  min-height: 420px;
}

.wizard-knowledge-head {
  display: grid;
  gap: 6px;
}

.wizard-knowledge-head h3 {
  margin: 0;
  font-size: 1rem;
}

.wizard-knowledge-head p {
  margin: 0;
  color: #667085;
}

.wizard-knowledge-empty {
  display: grid;
  min-height: 220px;
  place-items: center;
  align-content: center;
  gap: 10px;
  border: 1px dashed #cfd7e6;
  border-radius: 18px;
  background: #fff;
  color: #6b7280;
  text-align: center;
}

.wizard-knowledge-empty svg {
  color: #5b7cff;
}

.wizard-knowledge-empty strong {
  color: #344054;
  font-size: 1rem;
}

.wizard-knowledge-empty .pill {
  margin-top: 8px;
  border-radius: 999px;
}

.wizard-knowledge-library {
  display: grid;
  gap: 18px;
}

.wizard-knowledge-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border: 1px solid #e6edf7;
  border-radius: 18px;
  background: #fff;
}

.wizard-knowledge-toolbar div {
  display: grid;
  gap: 4px;
}

.wizard-knowledge-toolbar span {
  color: #667085;
}

.wizard-knowledge-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.wizard-knowledge-cards article {
  display: grid;
  gap: 8px;
  min-height: 120px;
  padding: 16px;
  border: 1px solid #e1e8f4;
  border-radius: 16px;
  background: #fff;
}

.wizard-knowledge-cards article > span {
  color: #5b7cff;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.wizard-knowledge-cards small {
  color: #667085;
}

.knowledge-drawer-shell {
  position: fixed;
  inset: 0;
  z-index: 1200;
  pointer-events: none;
}

.knowledge-drawer-scrim {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(15, 23, 42, 0.52);
  pointer-events: auto;
}

.knowledge-drawer {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  grid-template-rows: auto auto auto auto 1fr;
  gap: 18px;
  width: min(430px, 100vw);
  height: 100%;
  overflow: auto;
  padding: 24px 26px 88px;
  background: #fff;
  box-shadow: -18px 0 44px rgba(15, 23, 42, 0.18);
  pointer-events: auto;
}

.knowledge-drawer-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.knowledge-drawer-head button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: #667085;
}

.knowledge-drawer-head h3 {
  margin: 0;
  font-size: 1.08rem;
}

.knowledge-drawer-create-tabs,
.knowledge-source-tabs,
.knowledge-radio-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
}

.knowledge-drawer-create-tabs button,
.knowledge-source-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #5f6b7a;
  padding: 8px 4px;
  white-space: nowrap;
}

.knowledge-drawer-create-tabs button.active {
  border-color: #5b7cff;
  color: #4f6df5;
}

.knowledge-source-tabs {
  padding: 5px;
  border-radius: 999px;
  background: #eef3ff;
}

.knowledge-source-tabs button {
  border-radius: 999px;
  border-bottom: 0;
  padding: 9px 11px;
}

.knowledge-source-tabs button.active {
  background: #5b7cff;
  color: #fff;
}

.knowledge-drawer-field,
.knowledge-drawer-card label,
.knowledge-qa-form label {
  display: grid;
  gap: 8px;
  color: #344054;
  font-size: 0.9rem;
}

.knowledge-drawer-field input,
.knowledge-drawer-card input,
.knowledge-drawer-card textarea,
.knowledge-qa-form input,
.knowledge-qa-form textarea {
  width: 100%;
  border: 1px solid #d8deea;
  border-radius: 16px;
  background: #fff;
  color: #1f2937;
  padding: 12px 14px;
}

.knowledge-drawer-card textarea,
.knowledge-qa-form textarea {
  min-height: 92px;
  resize: vertical;
}

.knowledge-drawer-field small,
.knowledge-qa-form small {
  color: #8a93a3;
  line-height: 1.35;
}

.knowledge-drawer-card {
  display: grid;
  gap: 18px;
  padding: 20px;
  border: 1px solid #edf1f6;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
}

.knowledge-toggle-row {
  display: grid;
  gap: 10px;
}

.knowledge-toggle-row div {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  overflow: hidden;
  border: 1px solid #d8deea;
  border-radius: 999px;
}

.knowledge-toggle-row button {
  border: 0;
  background: #fff;
  color: #667085;
  padding: 10px 12px;
}

.knowledge-toggle-row button.active {
  background: #5b7cff;
  color: #fff;
}

.knowledge-dropzone {
  display: grid;
  min-height: 170px;
  place-items: center;
  gap: 8px;
  border: 1px dashed #cfd7e6;
  border-radius: 16px;
  background: #fafbff;
  color: #667085;
  padding: 24px;
  text-align: center;
}

.knowledge-dropzone svg {
  color: #5b7cff;
}

.knowledge-radio-tabs {
  justify-content: space-between;
}

.knowledge-radio-tabs label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #475467;
  font-size: 0.86rem;
}

.knowledge-qa-form {
  display: grid;
  gap: 14px;
}

.knowledge-generated-faq {
  display: grid;
  gap: 8px;
  border: 1px solid #e6edf7;
  border-radius: 14px;
  background: #f8fafc;
  padding: 12px;
}

.knowledge-generated-faq p {
  margin: 0;
  color: #667085;
  line-height: 1.4;
}

@media (max-width: 1180px) {
  .wizard-behavior-layout {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 720px) {
  .wizard-behavior-main {
    padding: 22px 18px;
  }

  .wizard-identity-grid,
  .wizard-pace-grid,
  .wizard-tone-grid,
  .wizard-behavior-options.two-cols {
    grid-template-columns: 1fr;
  }

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

  .wizard-phone-chat {
    min-height: auto;
    padding: 22px 18px;
  }

  .wizard-chat-bubble {
    max-width: 92%;
  }
}

.wizard-choice {
  margin-top: 12px;
}

.wizard-step-head {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.wizard-step-head p {
  color: var(--text-muted);
  margin: 6px 0 0;
}

.wizard-step-head > span {
  background: #eef5ff;
  border: 1px solid #cfe0f7;
  border-radius: 999px;
  color: #2f6fd0;
  font-size: 12px;
  font-weight: 650;
  padding: 6px 10px;
  white-space: nowrap;
}

.wizard-slider-grid,
.wizard-check-grid,
.wizard-source-list,
.wizard-action-list,
.wizard-readiness-list {
  display: grid;
  gap: 12px;
}

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

.wizard-slider-grid label,
.wizard-check-grid label,
.wizard-source-list article,
.wizard-action-list article,
.wizard-readiness-list article {
  background: var(--surface-muted, #f8fafc);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}

.wizard-slider-grid label {
  display: grid;
  gap: 8px;
}

.wizard-slider-grid strong {
  color: #2f80ed;
  font-weight: 650;
}

.wizard-slider-grid small,
.wizard-source-list span,
.wizard-action-list span {
  color: var(--text-muted);
}

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

.wizard-check-grid label,
.wizard-action-list label {
  align-items: center;
  display: flex;
  gap: 10px;
}

.wizard-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.wizard-source-list,
.wizard-action-list {
  margin-top: 2px;
}

.wizard-source-list article,
.wizard-action-list article {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.wizard-action-list article > div {
  display: grid;
  gap: 3px;
}

.wizard-readiness-list {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.wizard-readiness-list article {
  align-items: center;
  display: grid;
  gap: 6px;
  justify-items: center;
  text-align: center;
}

.wizard-readiness-list article.ok {
  background: #effdf5;
  border-color: #b7efcd;
  color: #137b37;
}

.wizard-readiness-list article.warn {
  background: #fff8e6;
  border-color: #f3d38a;
  color: #8a5a00;
}

.ai-agent-wizard-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 22px 38px 32px;
}

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

.mini-grid span,
.compact-row {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.general-logs-page .filters-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr)) minmax(220px, 2fr) auto auto;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
}

.general-logs-page .filters-row input,
.general-logs-page .filters-row select {
  min-height: 42px;
}

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

.general-log-list .compact-row {
  border-left: 4px solid var(--border);
  align-items: flex-start;
}

.general-log-list .compact-row.log-level-warn {
  border-left-color: #f59e0b;
  background: rgba(245, 158, 11, 0.06);
}

.general-log-list .compact-row.log-level-error {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.06);
}

.general-log-list details {
  margin-top: 8px;
}

.general-log-list summary {
  cursor: pointer;
  color: var(--brand);
  font-weight: 600;
}

.general-log-list code {
  display: block;
  margin-top: 6px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}

@media (max-width: 1180px) {
  .general-logs-page .filters-row {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 720px) {
  .general-logs-page .filters-row {
    grid-template-columns: 1fr;
  }
}

.ai-source-evidence {
  display: grid;
  gap: 6px;
  line-height: 1.35;
}

.ai-source-evidence strong {
  font-weight: 650;
}

.ai-source-evidence span {
  color: var(--text-muted);
}

.ai-source-evidence small {
  color: var(--text-soft);
}


.ai-action-proposal-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--border));
  border-radius: 12px;
  background: color-mix(in srgb, var(--primary) 4%, var(--surface));
}

.ai-action-proposal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.ai-action-proposal-head > div {
  display: grid;
  gap: 2px;
}

.ai-action-proposal-head strong {
  font-weight: 650;
}

.ai-action-proposal-head small,
.ai-action-proposal-card p {
  color: var(--text-muted);
}

.ai-action-proposal-card pre {
  max-height: 180px;
  overflow: auto;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  white-space: pre-wrap;
}

.ai-action-proposal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-action-proposal-actions button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ai-actions-page {
  align-items: start;
  grid-template-columns: minmax(0, 1fr) minmax(340px, .48fr);
}

.ai-actions-main-card,
.ai-actions-create-card {
  overflow: hidden;
}

.ai-actions-hero {
  background: linear-gradient(135deg, #eff6ff 0%, #eefdf7 100%);
  border: 1px solid #bfdbfe;
  border-radius: 18px;
  padding: 18px;
}

.ai-actions-hero h2 {
  font-size: 1.65rem;
}

.ai-actions-page .ai-final-help-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ai-actions-page .ai-final-help-card {
  border: 1px solid transparent;
  border-radius: 18px;
  min-height: 128px;
  padding: 18px;
  position: relative;
}

.ai-actions-page .ai-final-help-card:nth-child(1) {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.ai-actions-page .ai-final-help-card:nth-child(2) {
  background: #ecfdf5;
  border-color: #bbf7d0;
}

.ai-actions-page .ai-final-help-card:nth-child(3) {
  background: #fff7ed;
  border-color: #fed7aa;
}

.ai-actions-page .ai-final-help-card strong {
  color: #102a43;
  font-size: 1rem;
}

.ai-actions-summary-strip {
  background: #0f172a;
  border-radius: 16px;
  color: #ffffff;
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
}

.ai-actions-summary-strip div {
  background: rgba(255, 255, 255, .08);
  display: grid;
  gap: 2px;
  padding: 14px 16px;
}

.ai-actions-summary-strip strong {
  color: #ffffff;
  font-size: 1.65rem;
  line-height: 1;
}

.ai-actions-summary-strip span {
  color: #cbd5e1;
  font-size: .88rem;
}

.ai-actions-list-head {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.ai-actions-list-head h3 {
  color: var(--ink, #101828);
  margin: 0 0 4px;
}

.ai-actions-list-head p {
  color: var(--muted, #667085);
  margin: 0;
}

.ai-actions-rule-list {
  gap: 12px;
}

.ai-actions-feedback {
  border-radius: 14px;
  font-weight: 750;
  line-height: 1.35;
  padding: 12px 14px;
}

.ai-actions-feedback.success {
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.ai-actions-feedback.danger {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.ai-actions-rule-card {
  border-radius: 16px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 16px;
}

.ai-actions-rule-card.active {
  background: #f7fffb;
  border-color: #86efac;
  box-shadow: 0 12px 30px rgba(22, 163, 74, .08);
}

.ai-actions-rule-card.paused {
  background: #fffaf0;
  border-color: #fed7aa;
}

.ai-actions-rule-card strong {
  font-size: 1.03rem;
}

.ai-actions-rule-card p {
  color: #475467;
  line-height: 1.35;
}

.ai-actions-rule-card small {
  color: #667085;
}

.ai-actions-buttons {
  align-items: stretch;
}

.ai-actions-buttons .secondary-button {
  border-radius: 10px;
  font-weight: 600;
  min-width: 78px;
}

.ai-actions-buttons .test {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #334155;
}

.ai-actions-buttons .edit {
  background: #f5f3ff;
  border-color: #ddd6fe;
  color: #6d28d9;
}

.ai-actions-buttons .duplicate {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.ai-actions-buttons .activate {
  background: #ecfdf5;
  border-color: #86efac;
  color: #15803d;
}

.ai-actions-buttons .pause {
  background: #fff7ed;
  border-color: #fdba74;
  color: #c2410c;
}

.ai-actions-buttons .delete {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.ai-actions-buttons .secondary-button:hover {
  filter: brightness(.98);
  transform: translateY(-1px);
}

.ai-agent-page :where(.primary-button, .secondary-button, .danger-button) {
  align-items: center;
  border-radius: 12px;
  display: inline-flex;
  font-weight: 600;
  gap: 8px;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.ai-agent-page .primary-button {
  background: #3b73e8;
  border: 1px solid #3b73e8;
  color: #fff;
}

.ai-agent-page .secondary-button {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #1e293b;
}

.ai-agent-delete-modal {
  border: 1px solid #dbe4f0;
  border-radius: 18px;
  gap: 0;
  max-width: 560px;
  overflow: hidden;
  padding: 0;
}

.ai-agent-delete-modal .menu-modal-title {
  align-items: flex-start;
  border-bottom: 1px solid #e2e8f0;
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr auto;
  padding: 24px 26px 20px;
}

.ai-agent-delete-modal .menu-modal-title > div {
  align-items: flex-start;
  color: #1e293b;
  display: grid;
  gap: 6px;
  font-size: inherit;
}

.ai-agent-delete-modal .menu-modal-title .eyebrow {
  color: #0284c7;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.ai-agent-delete-modal .menu-modal-title h3 {
  color: #6d28d9;
  font-size: 26px;
  line-height: 1.08;
  margin: 0;
}

.ai-agent-delete-modal .menu-modal-title p {
  color: #64748b;
  font-size: 15px;
  line-height: 1.5;
  margin: 0;
  max-width: 440px;
}

.ai-agent-delete-modal .icon-button {
  align-items: center;
  border-radius: 10px;
  display: inline-flex;
  height: 40px;
  justify-content: center;
  min-height: 40px;
  padding: 0;
  width: 40px;
}

.ai-agent-delete-body {
  display: grid;
  gap: 16px;
  padding: 22px 26px;
}

.ai-agent-delete-body label {
  color: #334155;
  display: grid;
  font-weight: 650;
  gap: 8px;
}

.ai-agent-delete-body input {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  color: #0f172a;
  font-size: 16px;
  min-height: 48px;
  padding: 0 14px;
}

.ai-agent-delete-modal .menu-modal-footer {
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 18px 26px;
}

.ai-agent-delete-modal .menu-modal-footer button {
  border-radius: 10px;
  min-height: 42px;
}

.ai-settings-warning.danger {
  background: #fff7ed;
  border-color: #fed7aa;
}

.ai-settings-warning.danger strong {
  color: #9a3412;
}

.ai-agent-page .danger-button {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.ai-agent-page :where(.primary-button, .secondary-button, .danger-button):hover:not(:disabled) {
  box-shadow: 0 8px 20px rgba(15, 23, 42, .08);
  transform: translateY(-1px);
}

.ai-agent-page .secondary-button.edit {
  background: #f5f3ff;
  border-color: #ddd6fe;
  color: #6d28d9;
}

.ai-agent-page .secondary-button.test {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #1e293b;
}

.ai-agent-page .secondary-button.duplicate {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.ai-agent-page .secondary-button.activate {
  background: #ecfdf5;
  border-color: #86efac;
  color: #15803d;
}

.ai-agent-page .secondary-button.pause {
  background: #fff7ed;
  border-color: #fdba74;
  color: #c2410c;
}

.ai-agent-page .secondary-button.delete,
.ai-agent-page .danger-button.subtle {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.ai-actions-create-card {
  border-top: 5px solid #3b82f6;
  gap: 14px;
  padding: 20px;
  position: sticky;
  top: 18px;
}

.ai-actions-create-card.editing {
  border-top-color: #8b5cf6;
}

.ai-actions-edit-banner {
  align-items: center;
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  border-radius: 14px;
  color: #5b21b6;
  display: flex;
  font-weight: 750;
  gap: 10px;
  line-height: 1.35;
  padding: 12px 14px;
}

.ai-actions-cancel-edit {
  border-radius: 12px;
  min-height: 42px;
}

.ai-actions-tip {
  align-items: flex-start;
  background: #eef6ff;
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  color: #1e3a8a;
  display: flex;
  font-size: .92rem;
  gap: 10px;
  line-height: 1.4;
  padding: 12px 14px;
}

.ai-actions-create-card label {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  color: #243044;
  gap: 7px;
  padding: 13px 14px;
}

.ai-actions-create-card input,
.ai-actions-create-card select {
  background: #f8fafc;
  border-color: #d8e3f2;
  border-radius: 10px;
  color: #111827;
  font-size: .94rem;
  min-height: 42px;
  padding-left: 12px;
}

.ai-actions-create-card .checkbox-line {
  align-items: center;
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #14532d;
  display: flex;
  gap: 12px;
  justify-content: flex-start;
  min-height: auto;
}

.ai-actions-create-card .checkbox-line input {
  accent-color: #16a34a;
  flex: 0 0 auto;
  height: 18px;
  min-height: 18px;
  width: 18px;
}

.ai-actions-enabled-line > span {
  display: grid;
  gap: 2px;
}

.ai-actions-enabled-line b {
  color: #14532d;
  font-size: .95rem;
}

.ai-actions-enabled-line small {
  color: #166534;
  font-size: .82rem;
  font-weight: 500;
  line-height: 1.3;
}

.ai-actions-create-card .primary-button {
  border-radius: 12px;
  min-height: 44px;
}

html[data-theme="dark"] .ai-actions-hero,
html[data-theme="dark"] .ai-actions-page .ai-final-help-card,
html[data-theme="dark"] .ai-actions-create-card label {
  background: var(--surface);
  border-color: var(--border);
}

html[data-theme="dark"] .ai-actions-rule-card.active,
html[data-theme="dark"] .ai-actions-rule-card.paused {
  background: var(--surface);
}

html[data-theme="dark"] .ai-actions-tip {
  background: rgba(59, 130, 246, .14);
  border-color: rgba(147, 197, 253, .35);
  color: #bfdbfe;
}

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

  .ai-actions-create-card {
    position: static;
  }
}

@media (max-width: 760px) {
  .ai-actions-page .ai-final-help-grid,
  .ai-actions-summary-strip {
    grid-template-columns: 1fr;
  }

  .ai-actions-list-head,
  .ai-actions-rule-card {
    align-items: stretch;
    grid-template-columns: 1fr;
  }
}
.ai-product-import-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border));
  border-radius: 18px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 8%, var(--panel)), var(--panel) 62%);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.06);
}

.ai-product-import-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.ai-product-import-head h3 {
  margin: 3px 0 4px;
  color: var(--text);
  font-size: 22px;
  font-weight: 700;
}

.ai-product-import-head p,
.ai-product-meta-line,
.ai-product-import-more {
  color: var(--text-muted);
}

.ai-product-import-origin {
  min-width: 190px;
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  text-align: right;
}

.ai-product-import-origin strong {
  color: var(--text);
}

.ai-product-import-origin small {
  color: var(--text-muted);
}

.ai-product-import-stats {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.ai-product-import-stat {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.ai-product-import-stat span,
.ai-product-import-stat small {
  color: var(--text-muted);
}

.ai-product-import-stat strong {
  color: var(--text);
  font-size: 22px;
  font-weight: 700;
}

.ai-product-import-stat.success { border-color: #abefc6; background: #ecfdf3; }
.ai-product-import-stat.info { border-color: #b9dcff; background: #eff8ff; }
.ai-product-import-stat.warning { border-color: #fedf89; background: #fffbeb; }
.ai-product-import-stat.danger { border-color: #fecdca; background: #fff1f3; }

.ai-product-preview-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.ai-product-preview-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid #d9e6f6;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
}

.ai-product-preview-top,
.ai-product-preview-actions,
.product-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ai-product-preview-card h4 {
  min-height: 48px;
  margin: 0;
  color: #182230;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
}

.ai-product-preview-card p {
  min-height: 38px;
  margin: 0;
  color: #667085;
  line-height: 1.4;
}

.product-price-row strong {
  color: #067647;
  font-size: 19px;
  font-weight: 750;
}

.product-price-row small {
  color: #667085;
}

.product-import-badge,
.product-stock-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
}

.product-import-badge.success,
.product-stock-pill.ok {
  background: #dcfae6;
  color: #067647;
}

.product-import-badge.info {
  background: #e0f2fe;
  color: #026aa2;
}

.product-import-badge.warning,
.product-stock-pill.warning {
  background: #fef0c7;
  color: #b54708;
}

.product-import-badge.danger {
  background: #fee4e2;
  color: #b42318;
}

.product-import-badge.neutral {
  background: #eef2f6;
  color: #475467;
}

.product-import-detail-modal {
  grid-template-rows: auto auto auto minmax(0, 1fr);
}

.product-variation-list section {
  border: 1px solid #e3eaf5;
  border-radius: 14px;
  background: #f8fbff;
  padding: 12px;
}

.product-variation-list section + section {
  margin-top: 10px;
}

@media (max-width: 1120px) {
  .ai-product-import-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .ai-product-import-head,
  .ai-product-preview-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .ai-product-import-origin {
    width: 100%;
    text-align: left;
  }

  .ai-product-import-stats,
  .ai-product-preview-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .ai-agent-intro-card {
    grid-template-columns: 1fr;
  }

  .ai-agent-availability-row {
    align-items: stretch;
    flex-direction: column;
  }

  .ai-agent-two-col,
  .ai-agent-overview-grid,
  .ai-final-hero,
  .ai-knowledge-hero,
  .ai-knowledge-layout,
  .ai-knowledge-controls {
    grid-template-columns: 1fr;
  }

  .ai-knowledge-hero-actions {
    justify-content: flex-start;
  }

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

  .ai-knowledge-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .ai-knowledge-card-actions {
    grid-column: 1 / -1;
    justify-items: stretch;
  }

  .channel-config-row,
  .list-row-card {
    align-items: stretch;
    flex-direction: column;
  }

  .ai-agent-kpis,
  .ai-agent-mode-strip,
  .ai-agent-selected-strip,
  .ai-agent-toolbar,
  .ai-agent-decision-grid,
  .ai-brain-command-guide,
  .ai-brain-metrics-grid,
  .ai-brain-review-grid,
  .ai-explain-grid,
  .ai-settings-groups,
  .channel-grid-cards,
  .simulator-wide {
    grid-template-columns: 1fr;
  }

  .ai-brain-review-header {
    flex-direction: column;
  }

  .ai-brain-review-list button {
    grid-template-columns: 1fr;
  }

  .ai-choice-grid,
  .ai-action-flow,
  .ai-agent-flow-steps li,
  .wizard-agent-role-grid {
    grid-template-columns: 1fr;
  }

  .ai-agent-wizard-panel {
    width: min(100%, calc(100vw - 20px));
  }

  .ai-agent-wizard-head,
  .ai-agent-wizard-body,
  .ai-agent-wizard-footer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .ai-agent-wizard-steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px 8px;
    margin-bottom: 28px;
  }

  .ai-agent-wizard-steps button::before {
    display: none;
  }

  .ai-agent-profile-grid,
  .ai-agent-wizard-form-grid,
  .wizard-slider-grid,
  .wizard-check-grid,
  .wizard-readiness-list {
    grid-template-columns: 1fr;
  }

  .wizard-field.wide {
    grid-column: auto;
  }

  .ai-agent-profile-actions {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .wizard-source-list article,
  .wizard-action-list article,
  .wizard-step-head {
    align-items: stretch;
    flex-direction: column;
  }
}

/* AI Agent knowledge wizard polish - Umbler-like reference */
.ai-agent-wizard-backdrop {
  background: rgba(224, 232, 247, 0.86);
  padding: 10px 6px;
}

.ai-agent-wizard-panel {
  width: min(1960px, calc(100vw - 12px));
  min-height: min(585px, calc(100vh - 20px));
  max-height: calc(100vh - 20px);
  border: 0;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
}

.ai-agent-wizard-head {
  padding: 34px 34px 12px;
}

.ai-agent-wizard-head h2 {
  color: #252b36;
  font-size: 1.42rem;
  font-weight: 700;
  letter-spacing: 0;
}

.ai-agent-wizard-head h2 span {
  border-color: #83cf61;
  background: #e9ffd8;
  color: #44a62a;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 9px;
}

.ai-agent-wizard-steps {
  max-width: 980px;
  margin: 18px auto 44px;
}

.ai-agent-wizard-steps button {
  gap: 8px;
  color: #3d4654;
  cursor: pointer;
}

.ai-agent-wizard-steps button::before {
  top: 17px;
  left: calc(-50% + 24px);
  right: calc(50% + 24px);
  height: 2px;
  background: #d4d8df;
}

.ai-agent-wizard-steps span {
  width: 35px;
  height: 35px;
  border: 0;
  background: #f2f5fb;
  color: #697386;
  font-weight: 600;
}

.ai-agent-wizard-steps button.done span {
  background: #eef3ff;
  color: #5b7cff;
}

.ai-agent-wizard-steps button.active span {
  background: #4f78f2;
  color: #fff;
  box-shadow: 0 7px 16px rgba(79, 120, 242, 0.18);
}

.ai-agent-wizard-steps strong {
  color: #3a4351;
  font-size: 0.92rem;
  font-weight: 500;
}

.ai-agent-wizard-body {
  padding: 0 34px 14px;
}

.wizard-knowledge-layout {
  min-height: 305px;
  gap: 20px;
}

.wizard-knowledge-head h3 {
  color: #252b36;
  font-size: 1rem;
  font-weight: 700;
}

.wizard-knowledge-empty {
  min-height: 186px;
  border: 1px dashed #c7cbd3;
  border-radius: 17px;
  background: #fafafa;
  color: #6c7280;
  gap: 5px;
}

.wizard-knowledge-empty svg {
  width: 42px;
  height: 42px;
  color: #5b7cff;
  margin-bottom: 2px;
}

.wizard-knowledge-empty strong {
  color: #697386;
  font-size: 1rem;
  font-weight: 500;
}

.wizard-knowledge-empty span {
  color: #5e6675;
  font-size: 0.9rem;
}

.wizard-knowledge-empty .pill,
.wizard-knowledge-toolbar .pill {
  min-height: 34px;
  margin-top: 10px;
  border: 1px solid #c9cdd4;
  border-radius: 999px;
  background: #fff;
  color: #424a57;
  padding: 0 17px;
  font-weight: 500;
  box-shadow: none;
}

.wizard-knowledge-library.compact {
  gap: 10px;
  margin-top: -2px;
}

.wizard-knowledge-library {
  display: grid;
  gap: 12px;
}

.wizard-knowledge-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid #e5eaf3;
  background: #fff;
}

.wizard-knowledge-library.compact .wizard-knowledge-toolbar {
  padding: 11px 14px;
  border-color: #edf0f5;
  border-radius: 14px;
  box-shadow: none;
}

.wizard-knowledge-toolbar div {
  display: grid;
  gap: 2px;
}

.wizard-knowledge-library.compact .wizard-knowledge-toolbar strong {
  color: #344054;
  font-size: 0.9rem;
  font-weight: 600;
}

.wizard-knowledge-library.compact .wizard-knowledge-toolbar span {
  color: #798397;
  font-size: 0.82rem;
}

.wizard-knowledge-library.compact .wizard-knowledge-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.wizard-knowledge-library.compact .wizard-knowledge-cards article {
  display: grid;
  gap: 10px;
  min-height: 132px;
  padding: 14px;
  border-color: #edf0f5;
  border-radius: 13px;
  box-shadow: none;
  background: #fff;
  border: 1px solid #e6ebf4;
}

.wizard-knowledge-library.compact .wizard-knowledge-cards article.knowledge-result-card {
  align-content: start;
}

.wizard-knowledge-library.compact .wizard-knowledge-cards article.knowledge-result-card.paused {
  background: #f8fafc;
  border-style: dashed;
}

.wizard-knowledge-library.compact .wizard-knowledge-cards article > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.wizard-knowledge-library.compact .wizard-knowledge-cards article > span,
.wizard-knowledge-library.compact .wizard-knowledge-cards article > div > span {
  color: #5b7cff;
  font-size: 0.68rem;
  font-weight: 700;
}

.wizard-knowledge-library.compact .wizard-knowledge-cards strong {
  color: #344054;
  font-size: 0.88rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wizard-knowledge-library.compact .wizard-knowledge-cards small {
  color: #778195;
  font-size: 0.78rem;
}

.knowledge-result-card header,
.knowledge-result-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.knowledge-result-card p {
  margin: 0;
  color: #48556a;
  font-size: 0.84rem;
  line-height: 1.35;
}

.knowledge-type-pill,
.knowledge-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}

.knowledge-type-pill.website {
  background: #eaf2ff;
  color: #2563eb;
}

.knowledge-type-pill.product {
  background: #ecfdf3;
  color: #12805c;
}

.knowledge-type-pill.document {
  background: #fff7ed;
  color: #c2410c;
}

.knowledge-type-pill.manual {
  background: #f4f3ff;
  color: #6d28d9;
}

.knowledge-status-pill.active {
  background: #dcfce7;
  color: #166534;
}

.knowledge-status-pill.paused {
  background: #f1f5f9;
  color: #64748b;
}

.knowledge-pages-preview {
  display: block;
  color: #5f6f89;
}

.wizard-knowledge-library.compact .wizard-knowledge-cards .source-url {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wizard-knowledge-library.compact .wizard-knowledge-cards .secondary-button.small {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  flex: 0 0 auto;
}

.knowledge-library-modal-shell {
  position: fixed;
  inset: 0;
  z-index: 1200;
}

.knowledge-library-scrim {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(15, 23, 42, 0.44);
}

.knowledge-library-modal {
  position: absolute;
  inset: 28px;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 16px;
  padding: 24px;
  border-radius: 22px;
  background: #f8fbff;
  box-shadow: 0 28px 90px rgba(15, 23, 42, 0.28);
  overflow: hidden;
}

.knowledge-library-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.knowledge-library-head div {
  display: grid;
  gap: 4px;
}

.knowledge-library-head span {
  color: #5579f5;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.knowledge-library-head h3 {
  margin: 0;
  color: #1f2937;
  font-size: 1.35rem;
  font-weight: 700;
}

.knowledge-library-head p {
  margin: 0;
  max-width: 760px;
  color: #667085;
  line-height: 1.45;
}

.knowledge-library-head button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid #dbe3ef;
  border-radius: 50%;
  background: #fff;
  color: #667085;
}

.knowledge-library-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.knowledge-library-head .knowledge-library-head-actions .danger-button {
  width: auto;
  min-width: 0;
  height: 38px;
  border-radius: 999px;
  padding: 0 14px;
  gap: 7px;
}

.knowledge-library-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.knowledge-library-stats article {
  display: grid;
  gap: 2px;
  padding: 13px 15px;
  border: 1px solid #e3eaf5;
  border-radius: 14px;
  background: #fff;
}

.knowledge-library-stats strong {
  color: #1f2937;
  font-size: 1.28rem;
  font-weight: 700;
}

.knowledge-library-stats span {
  color: #667085;
  font-size: 0.84rem;
}

.knowledge-library-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 12px;
}

.knowledge-library-controls .search-field,
.knowledge-library-controls select {
  min-height: 44px;
  border-color: #dce5f2;
  border-radius: 14px;
  background: #fff;
}

.knowledge-library-list {
  display: grid;
  gap: 12px;
  overflow: auto;
  padding-right: 4px;
}

.knowledge-library-item {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  gap: 16px;
  padding: 16px;
  border: 1px solid #e2eaf6;
  border-radius: 16px;
  background: #fff;
}

.knowledge-library-item-main,
.knowledge-library-preview {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.knowledge-library-item-main header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.knowledge-library-item h4 {
  margin: 0;
  color: #263445;
  font-size: 1rem;
  font-weight: 700;
}

.knowledge-library-item p,
.knowledge-library-item small {
  margin: 0;
  color: #667085;
  line-height: 1.42;
}

.knowledge-library-preview {
  padding: 13px;
  border-radius: 14px;
  background: #f6f9fd;
}

.knowledge-library-preview strong {
  color: #344054;
  font-size: 0.84rem;
}

.knowledge-library-preview p {
  max-height: 118px;
  overflow: auto;
  color: #475467;
}

.knowledge-library-preview .secondary-button.small {
  justify-self: start;
  min-height: 30px;
  border-radius: 999px;
}

.knowledge-library-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.knowledge-library-empty {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 220px;
  border: 1px dashed #cfd8e6;
  border-radius: 18px;
  color: #667085;
  background: #fff;
}

.knowledge-library-empty strong {
  color: #344054;
}

@media (max-width: 1180px) {
  .wizard-knowledge-library.compact .wizard-knowledge-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .knowledge-library-modal {
    inset: 18px;
  }
  .knowledge-library-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .knowledge-library-item {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .wizard-knowledge-library.compact .wizard-knowledge-cards {
    grid-template-columns: 1fr;
  }
  .wizard-knowledge-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .knowledge-library-modal {
    inset: 0;
    border-radius: 0;
    padding: 18px;
  }
  .knowledge-library-controls,
  .knowledge-library-stats {
    grid-template-columns: 1fr;
  }
}

.ai-agent-wizard-footer {
  padding: 20px 34px 30px;
  border-top: 0;
}

.ai-agent-wizard-footer .secondary-button {
  border: 0;
  background: transparent;
  color: #5b7cff;
  box-shadow: none;
  padding: 0;
}

.ai-agent-wizard-footer .primary-button {
  min-height: 43px;
  border-radius: 999px;
  background: #5579f5;
  padding: 0 20px;
  box-shadow: none;
}

.knowledge-drawer-scrim {
  background: rgba(15, 23, 42, 0.54);
}

.knowledge-drawer {
  width: min(430px, 100vw);
  gap: 14px;
  padding: 23px 21px 78px;
  box-shadow: -16px 0 42px rgba(15, 23, 42, 0.16);
}

.knowledge-drawer-head {
  gap: 10px;
}

.knowledge-drawer-head h3 {
  color: #252b36;
  font-size: 1.08rem;
  font-weight: 700;
}

.knowledge-drawer-create-tabs {
  gap: 18px;
  overflow: visible;
  border-bottom: 1px solid #eef1f6;
}

.knowledge-drawer-create-tabs button {
  padding: 8px 0 10px;
  color: #5d6675;
  font-size: 0.84rem;
}

.knowledge-drawer-create-tabs button.active {
  color: #5275f2;
}

.knowledge-drawer-field {
  gap: 7px;
  font-size: 0.84rem;
}

.knowledge-drawer-field input {
  min-height: 38px;
  border-color: #dfe3eb;
  border-radius: 15px;
  padding: 0 13px;
}

.knowledge-drawer-field small {
  font-size: 0.72rem;
}

.knowledge-source-tabs {
  display: grid;
  grid-template-columns: 0.9fr 1fr 1.35fr;
  gap: 0;
  overflow: hidden;
  padding: 4px;
  border-radius: 999px;
  background: #f0f3ff;
}

.knowledge-source-tabs button {
  justify-content: center;
  min-width: 0;
  border-radius: 999px;
  padding: 8px 7px;
  color: #5f6674;
  font-size: 0.78rem;
  line-height: 1.1;
}

.knowledge-source-tabs button svg {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
}

.knowledge-source-tabs button.active {
  background: #5579f5;
  color: #fff;
  box-shadow: 0 7px 16px rgba(85, 121, 245, 0.18);
}

.knowledge-drawer-card {
  gap: 16px;
  padding: 18px 19px;
  border-color: #eef1f6;
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.knowledge-drawer-card label,
.knowledge-qa-form label {
  color: #4b5563;
  font-size: 0.84rem;
}

.knowledge-drawer-card input,
.knowledge-drawer-card textarea,
.knowledge-qa-form input,
.knowledge-qa-form textarea {
  min-height: 40px;
  border-color: #e0e4ec;
  border-radius: 16px;
  padding: 10px 13px;
}

.knowledge-drawer-card textarea,
.knowledge-qa-form textarea {
  min-height: 82px;
}

.knowledge-toggle-row {
  gap: 9px;
  color: #5d6675;
  font-size: 0.84rem;
}

.knowledge-toggle-row div {
  min-height: 48px;
  border-color: #e3e7ef;
  background: #fff;
}

.knowledge-toggle-row button {
  font-weight: 500;
}

.knowledge-toggle-row button.active {
  background: #5579f5;
}

.knowledge-drawer-card > .primary-button {
  min-height: 48px;
  border-radius: 5px;
  background: #3f73db;
  font-weight: 600;
  box-shadow: none;
}

.knowledge-dropzone {
  min-height: 158px;
  border-color: #d0d5dd;
  background: #fafafa;
}

.knowledge-radio-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  overflow: visible;
}

.knowledge-radio-tabs label {
  align-items: start;
  color: #4b5563;
  font-size: 0.78rem;
}

/* Final alignment for knowledge wizard empty state */
.wizard-knowledge-empty .secondary-button.pill {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto;
  min-width: 148px;
  min-height: 34px;
  line-height: 1;
}

.wizard-knowledge-empty .secondary-button.pill svg {
  width: 16px;
  height: 16px;
  margin: 0;
}

/* Knowledge drawer compact form controls */
.knowledge-drawer {
  grid-template-rows: auto auto auto auto auto !important;
  align-content: start !important;
}

.knowledge-drawer .knowledge-drawer-card,
.knowledge-drawer form.knowledge-drawer-card {
  align-self: start !important;
  min-height: 0 !important;
}

.knowledge-drawer .knowledge-toggle-row {
  gap: 8px !important;
}

.knowledge-drawer .knowledge-toggle-row div {
  min-height: 44px !important;
  height: 44px !important;
}

.knowledge-drawer .knowledge-toggle-row button {
  height: 44px !important;
  min-height: 44px !important;
  padding: 0 12px !important;
}

.knowledge-drawer-card > .primary-button,
.knowledge-drawer form > .primary-button,
.knowledge-drawer .primary-button {
  width: 100% !important;
  min-height: 44px !important;
  height: 44px !important;
  max-height: 44px !important;
  border-radius: 8px !important;
  padding: 0 16px !important;
  align-self: start !important;
}

.knowledge-drawer .knowledge-dropzone {
  min-height: 156px !important;
  height: auto !important;
  padding: 28px 22px !important;
}

.knowledge-drawer .knowledge-radio-tabs {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 10px !important;
  align-items: start !important;
}

.knowledge-flow-import-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.knowledge-flow-import-card select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  padding: 0 12px;
}

.knowledge-flow-selected-preview {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-muted);
  padding: 12px 14px;
  display: grid;
  gap: 4px;
}

.knowledge-flow-selected-preview strong {
  font-size: 14px;
  color: var(--text);
}

.knowledge-flow-selected-preview span {
  font-size: 12px;
  color: var(--muted);
}

.knowledge-drawer .knowledge-radio-tabs label {
  display: grid !important;
  grid-template-columns: 18px 1fr !important;
  align-items: start !important;
  gap: 8px !important;
  min-width: 0 !important;
  line-height: 1.25 !important;
}

.knowledge-drawer .knowledge-radio-tabs input[type="radio"] {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;
  margin: 1px 0 0 !important;
  padding: 0 !important;
  accent-color: #5579f5;
}

/* AI Agent website import progress modal */
.knowledge-import-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2400;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.32);
  backdrop-filter: blur(3px);
}

.knowledge-import-modal {
  width: min(520px, calc(100vw - 32px));
  display: grid;
  gap: 16px;
  padding: 22px;
  border: 1px solid #dbe5ff;
  border-radius: 22px;
  background: #fff;
  color: #111827;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.24);
}

.knowledge-import-modal header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.knowledge-import-modal header span {
  display: inline-flex;
  margin-bottom: 6px;
  color: #5579f5;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.knowledge-import-modal h3 {
  margin: 0;
  color: #111827;
  font-size: 1.2rem;
  font-weight: 700;
}

.knowledge-import-modal header button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #fff;
  color: #64748b;
}

.knowledge-import-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.knowledge-import-steps span {
  min-height: 36px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 700;
}

.knowledge-import-steps span.active {
  background: #e8efff;
  color: #3158d4;
}

.knowledge-import-modal.running .knowledge-import-steps span.active:last-child {
  position: relative;
  overflow: hidden;
}

.knowledge-import-modal.running .knowledge-import-steps span.active:last-child::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(85, 121, 245, 0.25), transparent);
  animation: knowledge-import-sweep 1.2s linear infinite;
}

.knowledge-import-modal.done {
  border-color: #bbf7d0;
}

.knowledge-import-modal.done .knowledge-import-steps span.active {
  background: #dcfce7;
  color: #15803d;
}

.knowledge-import-modal.error {
  border-color: #fecaca;
}

.knowledge-import-modal.error header span,
.knowledge-import-modal.error .knowledge-import-steps span.active {
  color: #b91c1c;
}

.knowledge-import-modal.error .knowledge-import-steps span.active {
  background: #fee2e2;
}

.knowledge-import-modal p {
  margin: 0;
  color: #475569;
  line-height: 1.55;
}

.knowledge-import-modal small {
  overflow-wrap: anywhere;
  color: #64748b;
}

.knowledge-import-modal > button {
  justify-self: end;
  min-height: 40px;
  padding: 0 18px;
}

@keyframes knowledge-import-sweep {
  to { transform: translateX(100%); }
}

html[data-theme="dark"] .knowledge-import-modal {
  border-color: rgba(148, 163, 184, 0.28);
  background: #111827;
  color: #e5e7eb;
}

html[data-theme="dark"] .knowledge-import-modal h3 {
  color: #f8fafc;
}

html[data-theme="dark"] .knowledge-import-modal p,
html[data-theme="dark"] .knowledge-import-modal small {
  color: #cbd5e1;
}

/* Knowledge drawer final polish */
.knowledge-drawer {
  font-family: inherit;
}

.knowledge-drawer-head h3 {
  font-size: 18px;
  font-weight: 650;
  color: var(--text);
}

.knowledge-drawer-create-tabs {
  gap: 14px;
}

.knowledge-drawer-create-tabs button {
  min-height: 34px;
  font-size: 14px;
  font-weight: 500;
}

.knowledge-drawer .knowledge-source-tabs {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px !important;
  padding: 7px !important;
  border-radius: 22px !important;
  background: #f1f4ff !important;
}

.knowledge-drawer .knowledge-source-tabs button {
  min-height: 38px !important;
  padding: 0 10px !important;
  border-radius: 999px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  line-height: 1.15 !important;
}

.knowledge-drawer .knowledge-source-tabs button.active {
  background: #5579f5 !important;
  color: #fff !important;
}

.knowledge-drawer .knowledge-drawer-card {
  padding: 18px !important;
  border-radius: 18px !important;
}

.knowledge-drawer .knowledge-dropzone {
  min-height: 206px !important;
  padding: 28px 26px !important;
  color: #667085 !important;
}

.knowledge-drawer .knowledge-dropzone span {
  max-width: 320px;
  margin-inline: auto;
  font-size: 16px;
  line-height: 1.35;
}

.knowledge-drawer .knowledge-dropzone small {
  max-width: 330px;
  margin-inline: auto;
  font-size: 13px;
  line-height: 1.35;
}

.knowledge-drawer .knowledge-toggle-row div {
  overflow: hidden;
  border-radius: 999px !important;
}

.knowledge-document-card {
  align-content: start;
}

.knowledge-document-card .secondary-button,
.knowledge-document-card .primary-button {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
}

.knowledge-document-card .secondary-button {
  background: #fff;
}

.knowledge-document-card .primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.knowledge-drawer .knowledge-dropzone.has-file,
.knowledge-drawer .knowledge-dropzone.is-dragging {
  border-color: #5579f5 !important;
  background: #f4f7ff !important;
  box-shadow: inset 0 0 0 1px rgba(85, 121, 245, 0.14);
}

.knowledge-drawer .knowledge-dropzone.has-file svg,
.knowledge-drawer .knowledge-dropzone.is-dragging svg {
  color: #3f73db !important;
}

.knowledge-drawer .knowledge-dropzone.has-file span {
  color: #27384f;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.knowledge-drawer .knowledge-toggle-row button {
  border-radius: 0 !important;
  font-weight: 500 !important;
}

.knowledge-drawer .knowledge-radio-tabs {
  grid-template-columns: 1fr !important;
  gap: 8px !important;
}

.knowledge-drawer .knowledge-radio-tabs label {
  min-height: 42px !important;
  align-items: center !important;
  padding: 10px 12px !important;
  border: 1px solid #e3e8f3 !important;
  border-radius: 14px !important;
  background: #fff !important;
}

.knowledge-drawer .primary-button {
  font-size: 15px !important;
  font-weight: 650 !important;
}

.knowledge-source-progress {
  width: 100%;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eefb;
}

.knowledge-source-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #61d394, #5579f5);
}

.knowledge-source-explain {
  color: #667085 !important;
  line-height: 1.35;
}

.knowledge-import-progress {
  width: 100%;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2fb;
}

.knowledge-import-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5579f5, #73c3ff);
  transition: width 0.35s ease;
}

.knowledge-import-help {
  padding: 10px 12px;
  border-radius: 12px;
  background: #f7f9ff;
  color: #5f6b7a !important;
  font-size: 13px;
}

/* AI agent wizard UX refinement */
.ai-agent-wizard-panel {
  font-family: inherit;
}

.ai-agent-wizard-head {
  padding: 28px 34px 18px !important;
}

.ai-agent-wizard-head h2 {
  color: #2b3039;
  font-size: 22px !important;
  font-weight: 650 !important;
}

.ai-agent-wizard-head .icon-button {
  width: 34px !important;
  height: 34px !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: transparent !important;
  color: #98a2b3 !important;
  box-shadow: none !important;
}

.ai-agent-wizard-head .icon-button:hover {
  background: #f3f5f9 !important;
  color: #344054 !important;
}

.ai-agent-wizard-steps {
  margin: 2px auto 36px !important;
}

.ai-agent-wizard-body {
  padding-inline: 34px !important;
}

.ai-agent-profile-step,
.wizard-knowledge-layout {
  gap: 22px !important;
}

.ai-agent-wizard-form-grid {
  align-items: end;
  column-gap: 28px !important;
  row-gap: 24px !important;
}

.wizard-field {
  color: #475467 !important;
  font-size: 14px !important;
  font-weight: 500 !important;
}

.wizard-field input,
.wizard-field select,
.wizard-url-input {
  min-height: 48px !important;
  border-color: #d7deea !important;
  border-radius: 16px !important;
  color: #344054 !important;
  font-size: 15px !important;
  box-shadow: none !important;
}

.wizard-field input:focus,
.wizard-field select:focus {
  border-color: #7191ff !important;
  box-shadow: 0 0 0 3px rgba(85, 121, 245, 0.12) !important;
}

.wizard-toggle-line {
  align-self: center;
  justify-self: center;
  min-width: 180px;
}

.wizard-more-options summary {
  color: #344054;
  font-weight: 600;
}

.ai-agent-wizard-footer {
  align-items: center;
}

.ai-agent-wizard-footer .secondary-button {
  font-weight: 500;
}

/* Knowledge library alignment and source inspection */
.knowledge-library-head > div:first-child {
  display: grid;
  gap: 4px;
}

.knowledge-library-head-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end;
  gap: 10px;
}

.knowledge-library-head-actions > button:not(.danger-button) {
  flex: 0 0 38px;
}

.knowledge-library-controls .search-field {
  display: grid !important;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 0 12px;
}

.knowledge-library-controls .search-field svg {
  color: #667085;
}

.knowledge-library-controls .search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
}

.knowledge-library-item {
  align-items: stretch;
}

.knowledge-library-item-main header,
.knowledge-result-card header {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-wrap: wrap;
}

.knowledge-view-data-button {
  min-height: 24px;
  margin-left: auto;
  border: 1px solid #d8e2f0;
  border-radius: 999px;
  background: #fff;
  color: #344054;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 650;
}

.knowledge-view-data-button:hover {
  border-color: #5579f5;
  color: #3158d4;
  background: #f7f9ff;
}

.knowledge-delete-mini-button {
  min-height: 24px;
  border: 1px solid #fecaca;
  border-radius: 999px;
  background: #fff7f7;
  color: #b42318;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.knowledge-delete-mini-button:hover {
  border-color: #f97066;
  background: #fff1f0;
  color: #912018;
}

.knowledge-detail-modal-shell {
  position: fixed;
  inset: 0;
  z-index: 1300;
}

.knowledge-detail-scrim {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(15, 23, 42, 0.48);
}

.knowledge-detail-modal {
  position: absolute;
  inset: 34px;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 16px;
  overflow: hidden;
  border: 1px solid #dfe7f3;
  border-radius: 22px;
  background: #f8fbff;
  padding: 24px;
  box-shadow: 0 28px 90px rgba(15, 23, 42, 0.28);
}

.knowledge-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.knowledge-detail-head div {
  display: grid;
  gap: 5px;
}

.knowledge-detail-head span {
  color: #5579f5;
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.knowledge-detail-head h3 {
  margin: 0;
  color: #1f2937;
  font-size: 22px;
  font-weight: 700;
}

.knowledge-detail-head p {
  margin: 0;
  color: #667085;
}

.knowledge-detail-head button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid #dbe3ef;
  border-radius: 999px;
  background: #fff;
  color: #667085;
}

.knowledge-detail-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.knowledge-detail-summary article,
.knowledge-detail-grid article,
.knowledge-detail-content {
  border: 1px solid #e3eaf5;
  border-radius: 16px;
  background: #fff;
  padding: 16px;
}

.knowledge-detail-summary article {
  display: grid;
  gap: 4px;
}

.knowledge-detail-summary strong {
  color: #1f2937;
  font-size: 18px;
}

.knowledge-detail-summary span {
  color: #667085;
  font-size: 13px;
}

.knowledge-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 12px;
}

.knowledge-detail-grid h4,
.knowledge-detail-content h4 {
  margin: 0 0 10px;
  color: #344054;
  font-size: 15px;
  font-weight: 700;
}

.knowledge-detail-grid p,
.knowledge-detail-grid small,
.knowledge-detail-grid li,
.knowledge-detail-content p {
  color: #667085;
  line-height: 1.48;
}

.knowledge-detail-grid ul {
  max-height: 150px;
  overflow: auto;
  margin: 10px 0 0;
  padding-left: 18px;
}

.knowledge-detail-grid dl {
  display: grid;
  gap: 9px;
  margin: 0;
}

.knowledge-detail-grid dl div {
  display: grid;
  gap: 3px;
}

.knowledge-detail-grid dt {
  color: #475467;
  font-size: 12px;
  font-weight: 700;
}

.knowledge-detail-grid dd {
  margin: 0;
  color: #667085;
  overflow-wrap: anywhere;
}

.knowledge-detail-content {
  overflow: auto;
}

.knowledge-detail-content > section {
  display: grid;
  gap: 8px;
  padding: 14px 0;
  border-top: 1px solid #edf1f6;
}

.knowledge-detail-content > section:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.knowledge-detail-content > section strong {
  color: #5579f5;
  font-size: 12px;
  text-transform: uppercase;
}

.knowledge-detail-content > section small {
  color: #667085;
  font-size: 12px;
}

@media (max-width: 900px) {
  .knowledge-detail-modal {
    inset: 0;
    border-radius: 0;
  }

  .knowledge-detail-summary,
  .knowledge-detail-grid {
    grid-template-columns: 1fr;
  }
}

/* ContactAssist Fase 4.5 - Habilidades do agente */
.wizard-automation-step.refined {
  display: grid;
  gap: 14px;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
}

.wizard-automation-step.refined .wizard-step-head.compact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 16px;
  padding: 0 0 12px;
  border-bottom: 1px solid #edf1f7;
}

.wizard-automation-step.refined .wizard-step-head.compact h3 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  color: #1f2937;
}

.wizard-automation-step.refined .wizard-step-head.compact p {
  max-width: 980px;
  margin: 5px 0 0;
  color: #6b7280;
  font-size: 15px;
  line-height: 1.45;
}

.wizard-automation-step.refined .wizard-step-head.compact > span {
  padding: 7px 12px;
  border-radius: 999px;
  background: #eaf2ff;
  color: #4f6fe8;
  font-size: 13px;
  font-weight: 700;
}

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

.wizard-automation-row {
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 38px;
  align-items: center;
  gap: 14px;
  min-height: 86px;
  padding: 14px 18px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .035);
}

.wizard-automation-row.selected {
  border-color: #bed0ff;
  box-shadow: 0 12px 26px rgba(83, 113, 239, .12);
}

.wizard-automation-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: #5878f5;
  color: #fff;
}

.wizard-automation-row-body {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.wizard-automation-row-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: #222a38;
  font-size: 15px;
  font-weight: 700;
}

.wizard-automation-row-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wizard-automation-row-title em {
  padding: 4px 9px;
  border: 1px solid #d8dce5;
  border-radius: 999px;
  color: #5f6674;
  background: #fff;
  font-size: 12px;
  font-style: normal;
  font-weight: 600;
}

.wizard-automation-row-body p {
  margin: 0;
  color: #6f7787;
  font-size: 14px;
  line-height: 1.4;
}

.wizard-automation-row > .icon-button.ghost {
  justify-self: end;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: #6b7280;
}

.wizard-automation-editor {
  grid-column: 1 / -1;
  display: grid;
  gap: 14px;
  margin: 8px 0 0 60px;
  padding: 18px;
  border: 1px solid #d9e4ff;
  border-radius: 14px;
  background: #edf3ff;
}

.wizard-automation-editor-top,
.wizard-automation-editor-config,
.wizard-automation-editor-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.wizard-automation-editor label,
.wizard-automation-add-panel label {
  display: grid;
  gap: 7px;
  color: #4b5563;
  font-size: 13px;
  font-weight: 600;
}

.wizard-automation-editor input,
.wizard-automation-editor select,
.wizard-automation-editor textarea,
.wizard-automation-add-panel textarea,
.wizard-automation-add-actions select {
  width: 100%;
  border: 1px solid #d9e1f2;
  border-radius: 12px;
  background: #fff;
  color: #1f2937;
  font-size: 14px;
}

.wizard-automation-editor textarea,
.wizard-automation-add-panel textarea {
  min-height: 88px;
  resize: vertical;
}

.wizard-automation-editor-actions {
  grid-template-columns: auto auto 1fr auto auto;
  align-items: center;
}

.wizard-automation-editor-actions .secondary-button {
  justify-self: end;
}

.wizard-automation-add-panel {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 14px;
  background: #e3ebff;
}

.wizard-automation-add-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.automation-branch-mark {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: #64748b;
  font-weight: 700;
}

.wizard-automation-add-actions select {
  width: auto;
  min-width: 210px;
  min-height: 38px;
  border-radius: 999px;
  background: #f4f7ff;
  color: #6274b2;
  font-weight: 700;
}

.dark-pill-button {
  min-height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: #222938;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.dark-pill-button:hover {
  background: #101827;
}

.wizard-automation-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  color: #747d8d;
}

.wizard-automation-footer .secondary-button {
  border-radius: 999px;
}

@media (max-width: 900px) {
  .wizard-automation-step.refined .wizard-step-head.compact,
  .wizard-automation-row,
  .wizard-automation-editor-top,
  .wizard-automation-editor-config,
  .wizard-automation-editor-actions {
    grid-template-columns: 1fr;
  }

  .wizard-automation-row {
    align-items: start;
  }

  .wizard-automation-editor {
    margin-left: 0;
  }

  .wizard-automation-add-actions,
  .wizard-automation-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .wizard-automation-add-actions select,
  .dark-pill-button {
    width: 100%;
  }
}

/* AI Agent wizard final visual pass */
.ai-agent-wizard-panel {
  color: #303846;
}

.ai-agent-wizard-head {
  min-height: 74px;
}

.ai-agent-wizard-close,
.knowledge-close-button {
  appearance: none;
  display: inline-grid !important;
  place-items: center !important;
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: transparent !important;
  color: #8a94a6 !important;
  box-shadow: none !important;
}

.ai-agent-wizard-close:hover,
.knowledge-close-button:hover {
  background: #f1f4fa !important;
  color: #2f3745 !important;
}

.ai-agent-wizard-body {
  min-height: 0;
  overflow: auto;
  padding-bottom: 96px !important;
}

.ai-agent-profile-step h3,
.wizard-knowledge-head h3 {
  color: #2f3745;
  font-size: 18px;
  font-weight: 700;
}

.ai-agent-profile-grid {
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}

.ai-agent-profile-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.ai-agent-profile-actions .secondary-button {
  min-height: 44px;
  justify-content: flex-start;
  border-radius: 999px;
  padding: 0 18px;
  color: #4b5565;
  font-weight: 500;
}

.ai-agent-wizard-form-grid {
  grid-template-columns: minmax(0, 1fr) 180px minmax(320px, 0.72fr) !important;
}

.wizard-field.full,
.wizard-sector-select {
  grid-column: 1 / -1;
}

.wizard-field input,
.wizard-field select {
  width: 100%;
  background: #fff !important;
}

.wizard-url-input {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 0 18px !important;
}

.wizard-url-input input {
  height: 100%;
}

.ai-agent-wizard-footer {
  position: sticky;
  bottom: 0;
  z-index: 4;
  min-height: 76px;
  padding: 14px 34px 24px !important;
  border-top: 0 !important;
  background: linear-gradient(180deg, rgba(255,255,255,0), #fff 28%);
}

.ai-agent-wizard-footer .primary-button,
.ai-agent-wizard-footer .secondary-button {
  min-height: 42px;
  border-radius: 999px;
  padding: 0 20px;
}

.wizard-knowledge-layout {
  align-content: start;
}

.wizard-knowledge-empty {
  min-height: 178px;
  border-color: #d9dfe8;
  border-radius: 18px;
  background: #fafafa;
}

.wizard-knowledge-empty svg {
  color: #587cff;
}

.wizard-knowledge-empty strong {
  color: #7a8494;
  font-size: 16px;
  font-weight: 500;
}

.wizard-knowledge-empty p {
  color: #7a8494;
}

.wizard-knowledge-empty .secondary-button,
.wizard-knowledge-head .secondary-button {
  border-radius: 999px;
  font-weight: 500;
}

.knowledge-library-modal {
  grid-template-rows: auto auto auto minmax(0, 1fr);
}

.knowledge-library-stats article {
  min-height: 72px;
  align-content: center;
}

.knowledge-library-controls {
  align-items: stretch;
}

.knowledge-library-controls .search-field,
.knowledge-library-controls select {
  height: 54px;
}

.knowledge-library-list {
  gap: 14px;
}

.knowledge-library-item {
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.15fr);
  min-height: 188px;
  overflow: hidden;
}

.knowledge-library-item-main {
  padding-right: 12px;
}

.knowledge-library-item-main h4,
.knowledge-result-card strong {
  overflow-wrap: anywhere;
}

.knowledge-preview-box {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 150px;
  max-height: 230px;
  overflow: auto;
  border-radius: 16px;
  background: #f3f6fb;
}

.knowledge-preview-box strong {
  color: #475467;
  font-size: 12px;
}

.knowledge-preview-box p {
  white-space: normal;
  overflow-wrap: anywhere;
}

.knowledge-detail-modal {
  max-width: 1180px;
  margin: 0 auto;
}

.knowledge-detail-summary strong {
  font-weight: 700;
}

.knowledge-detail-content {
  display: grid;
  gap: 6px;
}

.knowledge-detail-content h4 {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: -16px -16px 4px;
  padding: 16px;
  border-bottom: 1px solid #edf1f6;
  background: #fff;
}

.knowledge-detail-content > section p {
  margin: 0;
  color: #4f5b6d;
  line-height: 1.62;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 1180px) {
  .ai-agent-wizard-form-grid {
    grid-template-columns: 1fr !important;
  }

  .wizard-toggle-line {
    justify-self: start;
  }

  .knowledge-library-item {
    grid-template-columns: 1fr;
  }
}

html[data-theme="dark"] .knowledge-import-steps span {
  background: rgba(148, 163, 184, 0.14);
  color: #cbd5e1;
}

/* AI agent knowledge library - product UX cleanup */
.wizard-knowledge-library.compact .wizard-knowledge-cards article.knowledge-result-card {
  min-height: 156px;
  border-color: #e3ebf7;
  background: linear-gradient(180deg, #fff 0%, #fbfdff 100%);
}

.wizard-knowledge-library.compact .wizard-knowledge-cards strong,
.knowledge-group-item h4 {
  white-space: normal;
  line-height: 1.28;
}

.knowledge-group-item {
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.knowledge-group-item .knowledge-library-preview {
  background: #f7faff;
  border: 1px solid #e5ecf7;
}

.knowledge-view-data-button {
  border: 1px solid #d8e1ef;
  border-radius: 999px;
  background: #fff;
  color: #344054;
  padding: 7px 12px;
  font-size: 0.78rem;
  font-weight: 650;
  white-space: nowrap;
}

.knowledge-view-data-button:hover {
  border-color: #9eb5ff;
  color: #3158f5;
  background: #f7f9ff;
}

.knowledge-detail-content {
  display: grid;
  align-content: start;
  gap: 12px;
  overflow: auto;
}

.knowledge-detail-content > section {
  padding: 14px !important;
  border: 1px solid #e6edf7 !important;
  border-radius: 14px;
  background: #fbfdff;
}

.knowledge-detail-content > section:first-of-type {
  border-top: 1px solid #e6edf7 !important;
  padding-top: 14px !important;
}

.knowledge-detail-content > section strong {
  color: #24364b !important;
  font-size: 0.92rem !important;
  text-transform: none !important;
}

.knowledge-detail-content > section small {
  color: #667085;
  font-size: 0.78rem;
}

.knowledge-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.knowledge-section-head span {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #eef4ff;
  color: #3158f5;
  padding: 4px 9px;
  font-size: 0.72rem;
  font-weight: 650;
}

.knowledge-detail-content > section p {
  margin: 8px 0 0;
  color: #344054;
  line-height: 1.58;
  white-space: pre-wrap;
}

.knowledge-detail-grid article {
  min-height: 0;
}

.knowledge-detail-grid dl div {
  padding: 8px 0;
  border-bottom: 1px solid #eef2f8;
}

.knowledge-detail-grid dl div:last-child {
  border-bottom: 0;
}

/* AI Agent wizard typography and form alignment hardening */
.ai-agent-wizard-panel {
  --wizard-label: #5d6a7c;
  --wizard-text: #253041;
  --wizard-border: #d9e2ee;
  --wizard-focus: #5579f5;
}

.ai-agent-wizard-panel,
.ai-agent-wizard-panel input,
.ai-agent-wizard-panel select,
.ai-agent-wizard-panel textarea,
.ai-agent-wizard-panel button {
  font-family: inherit;
}

.ai-agent-wizard-panel .ai-agent-wizard-form-grid {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.66fr) !important;
  align-items: start !important;
  gap: 26px 30px !important;
}

.ai-agent-wizard-form-grid .wizard-field,
.wizard-more-options .wizard-field {
  display: grid !important;
  align-content: start;
  gap: 9px !important;
  min-width: 0;
  color: var(--wizard-label) !important;
  font-size: 0.92rem !important;
  font-weight: 500 !important;
  line-height: 1.25 !important;
}

.wizard-field-label {
  display: inline-flex !important;
  align-items: center;
  gap: 4px;
  min-height: 18px;
  color: var(--wizard-label) !important;
  font-size: 0.92rem !important;
  font-weight: 500 !important;
  line-height: 1.25 !important;
}

.wizard-field-label em {
  color: #ef4444;
  font-style: normal;
  font-weight: 700;
}

.ai-agent-wizard-form-grid .wizard-field > span:not(.wizard-field-label),
.wizard-more-options .wizard-field > span:not(.wizard-field-label) {
  display: inline-flex;
}

.ai-agent-wizard-form-grid .wizard-field input,
.ai-agent-wizard-form-grid .wizard-field select,
.wizard-more-options .wizard-field textarea,
.wizard-more-options .wizard-field input,
.wizard-more-options .wizard-field select,
.ai-agent-wizard-form-grid .wizard-url-input {
  width: 100% !important;
  min-height: 54px !important;
  border: 1px solid var(--wizard-border) !important;
  border-radius: 16px !important;
  background: #fff !important;
  color: var(--wizard-text) !important;
  font-size: 0.98rem !important;
  font-weight: 400 !important;
  line-height: 1.35 !important;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02) !important;
}

.ai-agent-wizard-form-grid .wizard-field input,
.ai-agent-wizard-form-grid .wizard-field select {
  padding: 0 18px !important;
}

.ai-agent-wizard-form-grid .wizard-field input::placeholder,
.wizard-more-options .wizard-field textarea::placeholder,
.wizard-url-input input::placeholder {
  color: #9aa6b7 !important;
}

.ai-agent-wizard-form-grid .wizard-field input:focus,
.ai-agent-wizard-form-grid .wizard-field select:focus,
.wizard-more-options .wizard-field textarea:focus,
.wizard-url-input:focus-within {
  border-color: var(--wizard-focus) !important;
  box-shadow: 0 0 0 4px rgba(85, 121, 245, 0.12) !important;
  outline: none !important;
}

.ai-agent-wizard-form-grid .wizard-field-language {
  order: 4;
}

.ai-agent-wizard-form-grid .wizard-field-gender {
  order: 2;
  grid-column: 1 / -1;
}

.ai-agent-wizard-form-grid .wizard-field.wide {
  order: 5;
  grid-column: auto !important;
}

.ai-agent-wizard-form-grid .wizard-field-website {
  order: 6;
}

.ai-agent-wizard-form-grid .ai-agent-profile-grid {
  order: 3;
}

.ai-agent-wizard-form-grid .wizard-toggle-line {
  order: 7;
  grid-column: 1 / -1;
  justify-self: start !important;
  align-self: start !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 12px !important;
  min-width: 0 !important;
  margin-top: -4px;
  color: var(--wizard-text) !important;
  font-size: 0.95rem !important;
  font-weight: 500 !important;
}

.ai-agent-wizard-form-grid .wizard-toggle-line input[type="checkbox"] {
  flex: 0 0 auto;
  margin: 0 !important;
}

.wizard-url-input {
  grid-template-columns: auto minmax(0, 1fr) !important;
  padding: 0 18px !important;
}

.wizard-url-input span {
  color: #6b778a !important;
  font-size: 0.98rem !important;
  font-weight: 400 !important;
}

.wizard-url-input input {
  min-width: 0;
  height: 100%;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.wizard-more-options {
  display: grid;
  gap: 14px;
}

.wizard-more-options summary {
  display: inline-flex;
  align-items: center;
  width: max-content;
  color: #344054 !important;
  font-size: 0.96rem !important;
  font-weight: 600 !important;
  cursor: pointer;
}

.ai-agent-wizard-footer {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 16px !important;
}

.ai-agent-wizard-footer .primary-button,
.ai-agent-wizard-footer .secondary-button {
  width: auto !important;
  min-width: 110px;
  justify-content: center;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
}

@media (max-width: 1180px) {
  .ai-agent-wizard-panel .ai-agent-wizard-form-grid {
    grid-template-columns: 1fr !important;
  }

  .ai-agent-wizard-form-grid .wizard-field-language,
  .ai-agent-wizard-form-grid .wizard-field-gender,
  .ai-agent-wizard-form-grid .wizard-field.wide,
  .ai-agent-wizard-form-grid .wizard-field-website,
  .ai-agent-wizard-form-grid .wizard-toggle-line {
    order: initial;
    grid-column: 1 / -1 !important;
  }

  .wizard-gender-options {
    grid-template-columns: 1fr;
  }
}

/* Compact AI agent creation wizard */
.ai-agent-wizard-backdrop {
  align-items: center !important;
  justify-content: center !important;
  padding: 22px !important;
}

.ai-agent-wizard-panel {
  width: min(1180px, calc(100vw - 44px)) !important;
  min-height: 0 !important;
  height: min(780px, calc(100vh - 44px)) !important;
  max-height: calc(100vh - 44px) !important;
  border-radius: 18px !important;
}

.ai-agent-wizard-head {
  min-height: 0 !important;
  padding: 18px 24px 12px !important;
}

.ai-agent-wizard-head h2 {
  font-size: 1.14rem !important;
}

.ai-agent-wizard-steps {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  max-width: 620px !important;
  margin: 4px auto 18px !important;
}

.ai-agent-wizard-steps button {
  gap: 6px !important;
}

.ai-agent-wizard-steps span {
  width: 30px !important;
  height: 30px !important;
  font-size: 0.86rem !important;
}

.ai-agent-wizard-steps button::before {
  top: 14px !important;
}

.ai-agent-wizard-steps strong {
  font-size: 0.82rem !important;
}

.ai-agent-wizard-body {
  padding: 0 24px 18px !important;
}

.ai-agent-profile-step {
  gap: 16px !important;
}

.ai-agent-profile-step h3 {
  font-size: 1.02rem !important;
}

.wizard-agent-role-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 10px !important;
}

.wizard-agent-role-grid button {
  min-height: 104px !important;
  padding: 14px !important;
}

.ai-agent-profile-grid {
  grid-template-columns: 116px minmax(0, 1fr) !important;
  gap: 18px !important;
}

.ai-agent-avatar-preview {
  width: 108px !important;
  height: 108px !important;
}

.ai-agent-profile-actions .secondary-button {
  min-height: 40px !important;
}

.ai-agent-wizard-panel .ai-agent-wizard-form-grid {
  gap: 16px 18px !important;
}

.ai-agent-wizard-form-grid .wizard-field input,
.ai-agent-wizard-form-grid .wizard-field select,
.ai-agent-wizard-form-grid .wizard-url-input {
  min-height: 46px !important;
  border-radius: 13px !important;
}

.wizard-gender-options {
  gap: 10px !important;
}

.wizard-gender-options button {
  min-height: 74px !important;
  padding: 12px !important;
}

.wizard-behavior-layout {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.38fr) !important;
  gap: 18px !important;
}

.wizard-behavior-main,
.wizard-conversation-preview,
.wizard-knowledge-layout,
.wizard-step-card {
  border-radius: 16px !important;
}

.wizard-behavior-main {
  gap: 14px !important;
  padding: 20px !important;
}

.wizard-knowledge-empty {
  min-height: 132px !important;
}

.wizard-activation-simple .ai-agent-decision-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

.ai-agent-wizard-footer {
  min-height: 58px !important;
  padding: 10px 24px 14px !important;
}

/* ContactAssist Fase 4.5 - Automacoes do Agente */
.wizard-action-row.compact {
  justify-content: flex-end;
  gap: 10px;
}

.wizard-automation-step {
  gap: 18px;
}

.wizard-automation-help {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid #dbe7ff;
  background: #f7fbff;
  border-radius: 16px;
  color: #52627a;
}

.wizard-automation-help strong {
  color: #172033;
  font-weight: 700;
}

.wizard-automation-sections {
  display: grid;
  gap: 18px;
}

.wizard-automation-section {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid #e3eaf5;
  border-radius: 20px;
  background: #fff;
}

.wizard-automation-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.wizard-automation-section-head h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #172033;
}

.wizard-automation-section-head p {
  margin: 4px 0 0;
  color: #66748a;
}

.wizard-automation-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid #dfe7f3;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(18, 32, 59, .04);
}

.wizard-automation-card.required {
  border-color: #cfe0ff;
  background: linear-gradient(180deg, #f8fbff 0%, #fff 100%);
}

.wizard-automation-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.automation-config-grid {
  display: grid;
  grid-template-columns: minmax(220px, .75fr) minmax(260px, 1.25fr);
  gap: 12px;
  align-items: start;
}

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

.automation-switch {
  align-self: center;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid #dfe7f3;
  border-radius: 12px;
  background: #f8fafc;
  color: #41506a;
}

.secondary-button.small,
.danger-button.small {
  min-height: 38px;
  padding: 0 12px;
}

@media (max-width: 900px) {
  .wizard-automation-section-head,
  .wizard-automation-card-head,
  .ai-rule-mini-grid,
  .automation-config-grid,
  .automation-config-grid.nested {
    grid-template-columns: 1fr;
  }

  .wizard-automation-section-head {
    display: grid;
  }

  .wizard-action-row.compact {
    justify-content: stretch;
  }

  .wizard-action-row.compact > * {
    width: 100%;
  }
}

.ai-brain-page {
  display: grid;
  gap: 18px;
}

.ai-brain-layout {
  align-items: start;
}

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

.wizard-gender-options button {
  min-height: 74px;
  border: 1px solid var(--wizard-border);
  border-radius: 16px;
  background: #fff;
  color: var(--wizard-text);
  padding: 14px 16px;
  text-align: left;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
  cursor: pointer;
}

.wizard-gender-options button strong {
  display: block;
  margin-bottom: 5px;
  font-size: 0.98rem;
  font-weight: 600;
}

.wizard-gender-options button small {
  display: block;
  color: #66758a;
  font-size: 0.84rem;
  line-height: 1.3;
}

.wizard-gender-options button.active {
  border-color: #3b6ff5;
  background: #eef4ff;
  box-shadow: 0 0 0 3px rgba(59, 111, 245, 0.12);
}

.wizard-gender-options button.active strong {
  color: #153ea9;
}

/* Professional pass for the AI agent creation assistant */
.ai-agent-wizard-panel {
  --wizard-blue: #315cf4;
  --wizard-blue-soft: #eef4ff;
  --wizard-card: #ffffff;
  --wizard-line: #d8e3f2;
  --wizard-muted: #66758a;
  width: min(1120px, calc(100vw - 40px)) !important;
  height: min(720px, calc(100vh - 40px)) !important;
  border: 1px solid rgba(139, 158, 188, 0.45) !important;
  border-radius: 22px !important;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%) !important;
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.20) !important;
}

.ai-agent-wizard-head {
  min-height: 70px;
  padding: 18px 28px 14px !important;
  border-bottom: 1px solid #edf2f8;
}

.ai-agent-wizard-head h2 {
  color: #1f2937 !important;
  font-size: 1.18rem !important;
  letter-spacing: 0 !important;
}

.ai-agent-wizard-steps {
  margin: 14px auto 20px !important;
}

.ai-agent-wizard-body {
  padding: 0 28px 28px !important;
  background:
    radial-gradient(circle at 4% 0%, rgba(49, 92, 244, 0.045), transparent 260px),
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%) !important;
}

.ai-agent-profile-step {
  gap: 18px !important;
}

.ai-agent-profile-step > h3 {
  display: none;
}

.wizard-sector-select {
  display: grid !important;
  gap: 8px !important;
  max-width: 520px;
}

.wizard-sector-select select {
  min-height: 46px !important;
  border: 1px solid #d8e3f2 !important;
  border-radius: 14px !important;
  background: #ffffff !important;
  color: #253041 !important;
  font-weight: 650 !important;
  padding: 0 14px !important;
}

.wizard-segment-profile-card {
  border: 1px solid #d9e8ff !important;
  border-radius: 18px !important;
  background: linear-gradient(135deg, #f8fbff 0%, #eef6ff 100%) !important;
  box-shadow: 0 12px 28px rgba(49, 92, 244, 0.06) !important;
  padding: 16px 18px !important;
}

.wizard-segment-profile-card strong {
  color: #243044 !important;
  font-size: 0.98rem !important;
}

.wizard-segment-profile-card span,
.wizard-segment-profile-card p,
.wizard-segment-profile-card small {
  color: #5a6a80 !important;
  line-height: 1.42 !important;
}

.wizard-segment-help.compact {
  border: 1px solid #dce7f7 !important;
  border-radius: 16px !important;
  background: #ffffff !important;
  color: #536176 !important;
  padding: 12px 14px !important;
}

.wizard-agent-role-section {
  gap: 10px !important;
}

.wizard-agent-role-section > span {
  color: #315cf4 !important;
  font-size: 0.78rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase;
}

.wizard-agent-role-grid {
  gap: 12px !important;
}

.wizard-agent-role-grid button {
  min-height: 118px !important;
  padding: 16px 18px !important;
  border: 1px solid var(--wizard-line) !important;
  border-radius: 18px !important;
  background: var(--wizard-card) !important;
  color: #253041 !important;
  box-shadow: 0 10px 26px rgba(31, 45, 75, 0.045) !important;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease, background .18s ease;
}

.wizard-agent-role-grid button:hover {
  transform: translateY(-1px);
  border-color: #9db7ff !important;
  box-shadow: 0 16px 34px rgba(49, 92, 244, 0.10) !important;
}

.wizard-agent-role-grid button.active {
  border-color: var(--wizard-blue) !important;
  background: linear-gradient(180deg, #f7faff 0%, #ffffff 100%) !important;
  box-shadow: 0 0 0 3px rgba(49, 92, 244, 0.11), 0 16px 36px rgba(49, 92, 244, 0.12) !important;
}

.wizard-agent-role-grid strong {
  align-items: center;
  color: #243044 !important;
  display: flex;
  gap: 8px;
  font-size: 1rem !important;
  font-weight: 760 !important;
  line-height: 1.2;
}

.wizard-agent-role-grid strong span {
  background: #e9f0ff !important;
  border: 1px solid #cddcff !important;
  color: #315cf4 !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  padding: 3px 8px !important;
}

.wizard-agent-role-grid p {
  color: #4f5e73 !important;
  font-size: 0.9rem !important;
  line-height: 1.45 !important;
}

.wizard-agent-role-grid small {
  color: #6b778a !important;
  font-size: 0.8rem !important;
  line-height: 1.35 !important;
}

.ai-agent-profile-grid {
  align-items: stretch !important;
  display: grid !important;
  grid-template-columns: 132px minmax(0, 1fr) !important;
  gap: 18px !important;
  grid-column: 1 / -1 !important;
  margin-top: 2px;
  padding: 16px !important;
  border: 1px solid #e3ebf7;
  border-radius: 20px;
  background: #f8fbff;
}

.ai-agent-avatar-zone {
  align-self: center !important;
  justify-self: center !important;
}

.ai-agent-avatar-preview {
  width: 116px !important;
  height: 116px !important;
  border: 1px solid #d5e0ef !important;
  background: linear-gradient(180deg, #ffffff 0%, #eef4ff 100%) !important;
  box-shadow: 0 18px 38px rgba(31, 45, 75, 0.10) !important;
}

.ai-agent-avatar-preview svg {
  color: #315cf4 !important;
}

.avatar-camera {
  right: -5px !important;
  bottom: 8px !important;
  width: 32px !important;
  height: 32px !important;
  border: 1px solid #c8d7eb !important;
  background: #ffffff !important;
  color: #315cf4 !important;
  box-shadow: 0 8px 20px rgba(31, 45, 75, 0.14) !important;
}

.ai-agent-profile-actions {
  align-content: center !important;
  display: grid !important;
  gap: 10px !important;
}

.ai-agent-profile-actions .secondary-button,
.ai-agent-profile-actions .upload-like {
  min-height: 44px !important;
  justify-content: flex-start !important;
  border-color: #d5e0ef !important;
  border-radius: 14px !important;
  background: #ffffff !important;
  color: #3c4b63 !important;
  font-size: 0.94rem !important;
  font-weight: 560 !important;
  padding: 0 18px !important;
}

.ai-agent-profile-actions .secondary-button:hover,
.ai-agent-profile-actions .upload-like:hover {
  border-color: #9db7ff !important;
  background: #f7faff !important;
  color: #2349d5 !important;
}

.ai-agent-wizard-panel .ai-agent-wizard-form-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
  gap: 18px 20px !important;
  margin-top: 2px;
}

.ai-agent-wizard-form-grid .wizard-field {
  gap: 8px !important;
}

.ai-agent-wizard-form-grid .wizard-field-gender {
  grid-column: 1 / -1 !important;
}

.ai-agent-wizard-form-grid .wizard-field input,
.ai-agent-wizard-form-grid .wizard-field select,
.ai-agent-wizard-form-grid .wizard-url-input {
  min-height: 50px !important;
  border-color: #d8e3f2 !important;
  border-radius: 15px !important;
  background: #ffffff !important;
}

.wizard-field-label {
  color: #536176 !important;
  font-size: 0.86rem !important;
  font-weight: 650 !important;
}

.wizard-gender-options {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 12px !important;
}

.wizard-gender-options button {
  min-height: 86px !important;
  border-color: #d8e3f2 !important;
  border-radius: 16px !important;
  background: #ffffff !important;
  padding: 14px 16px !important;
  box-shadow: 0 8px 20px rgba(31, 45, 75, 0.035) !important;
}

.wizard-gender-options button.active {
  border-color: var(--wizard-blue) !important;
  background: var(--wizard-blue-soft) !important;
  box-shadow: 0 0 0 3px rgba(49, 92, 244, 0.11), 0 12px 26px rgba(49, 92, 244, 0.08) !important;
}

.ai-agent-wizard-form-grid .wizard-field-gender {
  margin-top: -4px;
}

.ai-agent-wizard-form-grid .wizard-field-gender .wizard-field-label {
  margin-bottom: 2px;
}

.ai-agent-wizard-form-grid .wizard-field-gender .wizard-gender-options {
  gap: 10px !important;
}

.ai-agent-wizard-form-grid .wizard-field-gender .wizard-gender-options button {
  min-height: 64px !important;
  border-radius: 14px !important;
  padding: 10px 14px !important;
}

.ai-agent-wizard-form-grid .wizard-field-gender .wizard-gender-options button strong {
  font-size: 0.94rem !important;
  font-weight: 650 !important;
}

.ai-agent-wizard-form-grid .wizard-field-gender .wizard-gender-options button small {
  font-size: 0.78rem !important;
  line-height: 1.25 !important;
}

.ai-agent-wizard-footer {
  align-items: center !important;
  min-height: 78px !important;
  padding: 14px 28px 18px !important;
  border-top: 1px solid #edf2f8 !important;
  background: rgba(255, 255, 255, 0.92) !important;
  backdrop-filter: blur(8px);
}

.ai-agent-wizard-footer .secondary-button {
  border: 0 !important;
  background: transparent !important;
  color: #5579f5 !important;
  min-width: 96px !important;
}

.ai-agent-wizard-footer .primary-button {
  min-width: 132px !important;
  min-height: 44px !important;
  border-radius: 999px !important;
  background: #4f74f7 !important;
  box-shadow: 0 14px 28px rgba(79, 116, 247, 0.26) !important;
}

.ai-agent-wizard-close {
  flex: 0 0 auto;
  margin-left: 16px;
}

@media (max-width: 980px) {
  .wizard-agent-role-grid,
  .wizard-gender-options,
  .ai-agent-wizard-panel .ai-agent-wizard-form-grid,
  .ai-agent-profile-grid {
    grid-template-columns: 1fr !important;
  }
}

.ai-brain-health-banner,
.ai-brain-detail-status {
  align-items: center;
  border-radius: 16px;
  display: grid;
  gap: 14px;
  grid-template-columns: auto minmax(0, 1fr);
  padding: 16px;
}

.ai-brain-health-banner strong,
.ai-brain-detail-status strong {
  color: inherit;
  display: block;
  margin-bottom: 3px;
}

.ai-brain-health-banner span,
.ai-brain-detail-status span {
  color: inherit;
  line-height: 1.4;
}

.ai-brain-health-banner.ok,
.ai-brain-detail-status.ok {
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  color: #14532d;
}

.ai-brain-health-banner.warning,
.ai-brain-detail-status.warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #78350f;
}

.ai-brain-health-banner.danger,
.ai-brain-detail-status.danger {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #7f1d1d;
}

.ai-brain-health-banner.neutral,
.ai-brain-detail-status.neutral {
  background: #f6f9fe;
  border: 1px solid #d8e3f2;
  color: var(--text);
}

.ai-brain-execution-list {
  display: grid;
  gap: 10px;
}

.ai-brain-execution {
  display: grid;
  grid-template-columns: minmax(110px, auto) 1fr auto auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.ai-brain-execution.ok {
  border-left: 5px solid #22c55e;
}

.ai-brain-execution.warning {
  border-left: 5px solid #f59e0b;
}

.ai-brain-execution.danger {
  border-left: 5px solid #ef4444;
}

.ai-brain-execution.neutral {
  border-left: 5px solid #94a3b8;
}

.ai-brain-execution:hover,
.ai-brain-execution.active {
  border-color: var(--accent);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.12);
}

.ai-brain-status {
  display: inline-flex;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-size: 12px;
  font-weight: 700;
}

.ai-brain-status.failed,
.ai-brain-status.error {
  background: #fee2e2;
  color: #991b1b;
}

.ai-brain-detail {
  position: sticky;
  top: 16px;
}

.ai-brain-answer-box {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 14px;
  background: #f7fbff;
  border: 1px solid var(--border);
}

.ai-brain-answer-box span {
  color: var(--muted);
  font-size: 13px;
}

.ai-brain-answer-box p {
  margin: 0;
  line-height: 1.55;
}

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

.ai-brain-mini-grid span {
  background: #f6f9fe;
  border: 1px solid #d8e3f2;
  border-radius: 12px;
  color: var(--muted);
  display: grid;
  gap: 4px;
  padding: 12px;
}

.ai-brain-mini-grid strong {
  color: var(--text);
}

.ai-brain-section {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.ai-brain-section h3 {
  margin: 0;
}

.ai-brain-operator-summary {
  background: #fbfdff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}

.ai-brain-summary-cards {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ai-brain-summary-cards article {
  background: #fff;
  border: 1px solid #dbe7f5;
  border-radius: 14px;
  display: grid;
  gap: 5px;
  padding: 12px;
}

.ai-brain-summary-cards span,
.ai-brain-summary-cards small,
.ai-brain-review-notes p {
  color: var(--muted);
  line-height: 1.4;
}

.ai-brain-summary-cards strong {
  color: var(--text);
  font-size: 1rem;
}

.ai-brain-plain-reason {
  background: #eef6ff;
  border-left: 4px solid #3b73e8;
  border-radius: 12px;
  display: grid;
  gap: 6px;
  padding: 12px 14px;
}

.ai-brain-plain-reason p,
.ai-brain-review-notes p {
  margin: 0;
}

.ai-brain-review-notes {
  display: grid;
  gap: 7px;
}

.ai-brain-technical-details {
  border-top: 1px solid var(--border);
  color: var(--muted);
  padding-top: 10px;
}

.ai-brain-technical-details summary {
  cursor: pointer;
  font-weight: 600;
}

.ai-brain-technical-details .ai-brain-step-list {
  margin-top: 10px;
}

.ai-brain-support-panel details {
  color: var(--muted);
}

.ai-brain-support-panel summary {
  cursor: pointer;
  font-weight: 600;
}

.ai-brain-support-panel .ai-brain-module-grid {
  margin-top: 12px;
}

.ai-brain-step-list {
  display: grid;
  gap: 8px;
}

.ai-brain-step {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-subtle);
}

.ai-brain-step span,
.ai-brain-step small,
.ai-brain-module span,
.ai-brain-module small {
  color: var(--muted);
}

.ai-brain-module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.ai-brain-module {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

body.dark-theme .ai-brain-answer-box,
body.dark-theme .ai-brain-step,
body.dark-theme .ai-brain-module,
body.dark-theme .ai-brain-execution {
  background: var(--surface);
}

@media (max-width: 900px) {
  .ai-channel-summary-grid,
  .ai-channel-guide-grid,
  .ai-log-summary-grid,
  .ai-log-help-grid {
    grid-template-columns: 1fr;
  }

  .ai-simulator-guide-grid,
  .ai-simulator-result .ai-explain-grid {
    grid-template-columns: 1fr;
  }

  .ai-brain-execution {
    grid-template-columns: 1fr;
  }
  .ai-brain-mini-grid {
    grid-template-columns: 1fr;
  }
}
.ai-tools-page {
  display: grid;
  gap: 18px;
}

.ai-tools-status-banner {
  align-items: center;
  border-radius: 16px;
  display: grid;
  gap: 14px;
  grid-template-columns: auto minmax(0, 1fr);
  padding: 16px;
}

.ai-tools-status-banner strong {
  color: inherit;
  display: block;
  margin-bottom: 3px;
}

.ai-tools-status-banner span {
  color: inherit;
  line-height: 1.4;
}

.ai-tools-status-banner.ok {
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  color: #14532d;
}

.ai-tools-status-banner.warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #78350f;
}

.ai-tools-status-banner.danger {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #7f1d1d;
}

.ai-tools-status-banner.neutral {
  background: #f6f9fe;
  border: 1px solid #d8e3f2;
  color: var(--text);
}

.ai-tool-category-card {
  border: 1px solid var(--border-color, #d9e2ef);
  border-radius: 14px;
  background: var(--panel-bg, #fff);
  padding: 14px;
}

.ai-tool-table {
  display: grid;
  gap: 10px;
}

.ai-tool-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(320px, 1.2fr) auto;
  gap: 14px;
  align-items: stretch;
  border: 1px solid var(--border-color, #d9e2ef);
  border-radius: 12px;
  border-left-width: 5px;
  padding: 12px;
  background: var(--soft-panel-bg, #f8fbff);
}

.ai-tool-row.ok {
  border-left-color: #22c55e;
}

.ai-tool-row.warning {
  border-left-color: #f59e0b;
}

.ai-tool-row.danger {
  border-left-color: #ef4444;
}

.ai-tool-main {
  display: grid;
  gap: 7px;
  align-content: start;
}

.ai-tool-row strong {
  font-weight: 650;
}

.ai-tool-main p,
.ai-tool-row small {
  color: var(--muted-text, #66758f);
  margin: 0;
}

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

.ai-tool-meta span {
  background: #ffffff;
  border: 1px solid #d8e3f2;
  border-radius: 12px;
  display: grid;
  gap: 3px;
  padding: 9px 10px;
}

.ai-tool-meta small {
  color: var(--muted-text, #66758f);
  font-size: .78rem;
}

.ai-tool-meta strong {
  color: var(--text);
  font-size: .88rem;
}

.ai-tool-history-item {
  border-left: 5px solid #22c55e;
}

.ai-tool-history-item.danger {
  border-left-color: #ef4444;
}

.ai-tool-history-panel .compact-row {
  align-items: flex-start;
}

@media (max-width: 1100px) {
  .ai-tool-row {
    grid-template-columns: 1fr;
  }
}

/* Dark theme hardening for operational screens that declare later component styles. */
html[data-theme="dark"] {
  --panel-bg: #12283a;
  --soft-panel-bg: #0d2433;
  --border-color: #2b4b65;
  --muted-text: #a9bad0;
  --card: #12283a;
  --surface: #0d2433;
  --border: #2b4b65;
}

html[data-theme="dark"] .workspace,
html[data-theme="dark"] .main-content {
  color: var(--ink);
}

html[data-theme="dark"] .metric-grid article,
html[data-theme="dark"] .welcome-card,
html[data-theme="dark"] .kpi-card,
html[data-theme="dark"] .ai-cost-card,
html[data-theme="dark"] .chart-card,
html[data-theme="dark"] .timeline-card,
html[data-theme="dark"] .dashboard-list,
html[data-theme="dark"] .dashboard-log-list,
html[data-theme="dark"] .live-support-shell,
html[data-theme="dark"] .live-support-shell > aside,
html[data-theme="dark"] .live-support-shell > section,
html[data-theme="dark"] .conversation-detail-modal,
html[data-theme="dark"] .conversation-detail-sidebar,
html[data-theme="dark"] .conversation-detail-grid article,
html[data-theme="dark"] .contactflow-toolbar,
html[data-theme="dark"] .contactflow-leads,
html[data-theme="dark"] .contactflow-detail,
html[data-theme="dark"] .contactflow-lead,
html[data-theme="dark"] .contactflow-lead-summary span,
html[data-theme="dark"] .contactflow-message,
html[data-theme="dark"] .contactflow-task,
html[data-theme="dark"] .contactflow-kanban-column,
html[data-theme="dark"] .contactflow-kanban-card,
html[data-theme="dark"] .contactflow-watch-card,
html[data-theme="dark"] .contactflow-metric-list article,
html[data-theme="dark"] .contactflow-source-list article,
html[data-theme="dark"] .contactflow-agenda-column,
html[data-theme="dark"] .contactflow-rule-card,
html[data-theme="dark"] .contactflow-inbox-list,
html[data-theme="dark"] .contactflow-inbox-chat,
html[data-theme="dark"] .contactflow-inbox-side,
html[data-theme="dark"] .contactflow-side-section,
html[data-theme="dark"] .contactflow-config-grid article,
html[data-theme="dark"] .contactflow-config-wide article,
html[data-theme="dark"] .profile-menu-popover {
  background: #12283a;
  border-color: rgba(143, 191, 225, 0.22);
  color: #edf6ff;
}

html[data-theme="dark"] .setup-assistant-card {
  background: linear-gradient(135deg, rgba(33, 77, 100, 0.96), rgba(21, 55, 75, 0.96));
  border-color: rgba(143, 191, 225, 0.24);
  color: #edf6ff;
}

html[data-theme="dark"] .ai-cost-values span,
html[data-theme="dark"] .dashboard-list article,
html[data-theme="dark"] .dashboard-log-list article,
html[data-theme="dark"] .live-conversation-list button,
html[data-theme="dark"] .contactflow-ai-box,
html[data-theme="dark"] .contactflow-ai-box blockquote,
html[data-theme="dark"] .contactflow-safety-box,
html[data-theme="dark"] .contactflow-message.inbound,
html[data-theme="dark"] .contactflow-task.cancelled,
html[data-theme="dark"] .contactflow-inbox-search,
html[data-theme="dark"] .contactflow-chat-bubble,
html[data-theme="dark"] .conversation-detail-modal .decision-trace,
html[data-theme="dark"] .conversation-detail-modal .context-pills,
html[data-theme="dark"] .conversation-detail-modal .conversation-token-note {
  background: #0d2433;
  border-color: rgba(143, 191, 225, 0.2);
  color: #dcecff;
}

html[data-theme="dark"] .contactflow-message.outbound,
html[data-theme="dark"] .contactflow-task.done {
  background: rgba(31, 94, 66, 0.72);
  border-color: rgba(91, 218, 150, 0.32);
  color: #ecfff6;
}

html[data-theme="dark"] .contactflow-task.overdue {
  background: rgba(111, 75, 28, 0.58);
  border-color: rgba(247, 196, 93, 0.42);
  color: #fff3d6;
}

html[data-theme="dark"] .contactflow-inbox-item:hover,
html[data-theme="dark"] .contactflow-inbox-item.active,
html[data-theme="dark"] .live-conversation-list button:hover,
html[data-theme="dark"] .live-conversation-list button.active {
  background: #17384d;
  border-color: #6fa9eb;
}

html[data-theme="dark"] .contactflow-inbox-shell.operator-fullscreen {
  background:
    radial-gradient(circle at 18% 0%, rgba(91, 141, 239, 0.16), transparent 34vw),
    linear-gradient(135deg, #071c28 0%, #0a2636 52%, #0b3044 100%);
}

html[data-theme="dark"] .conversation-diagnostics,
html[data-theme="dark"] .conversation-diagnostics[open],
html[data-theme="dark"] .decision-trace.user-facing {
  background: #0d2433;
  border-color: rgba(143, 191, 225, 0.22);
  color: #dcecff;
}

html[data-theme="dark"] .live-support-shell.operator-fullscreen {
  background:
    radial-gradient(circle at 18% 0%, rgba(91, 141, 239, 0.16), transparent 34vw),
    linear-gradient(135deg, #071c28 0%, #0a2636 52%, #0b3044 100%);
}

html[data-theme="dark"] .decision-trace.user-facing.ai {
  background: rgba(18, 64, 49, 0.54);
  border-color: rgba(91, 218, 150, 0.32);
  border-left-color: #38d996;
}

html[data-theme="dark"] .welcome-card strong,
html[data-theme="dark"] .kpi-card strong,
html[data-theme="dark"] .ai-cost-head strong,
html[data-theme="dark"] .ai-cost-values b,
html[data-theme="dark"] .chart-card h2,
html[data-theme="dark"] .timeline-card h2,
html[data-theme="dark"] .contactflow-kpis strong,
html[data-theme="dark"] .contactflow-lead strong,
html[data-theme="dark"] .contactflow-kanban-column h3,
html[data-theme="dark"] .contactflow-kanban-card strong,
html[data-theme="dark"] .contactflow-watch-card strong,
html[data-theme="dark"] .contactflow-metric-list strong,
html[data-theme="dark"] .contactflow-source-list strong,
html[data-theme="dark"] .contactflow-side-section p strong,
html[data-theme="dark"] .conversation-detail-grid p,
html[data-theme="dark"] .live-conversation-list strong {
  color: #f5faff;
}

html[data-theme="dark"] .welcome-card p,
html[data-theme="dark"] .kpi-card small,
html[data-theme="dark"] .ai-cost-head small,
html[data-theme="dark"] .ai-cost-values small,
html[data-theme="dark"] .ai-cost-foot,
html[data-theme="dark"] .contactflow-kpis span,
html[data-theme="dark"] .contactflow-lead small,
html[data-theme="dark"] .contactflow-lead-summary small,
html[data-theme="dark"] .contactflow-message small,
html[data-theme="dark"] .contactflow-task small,
html[data-theme="dark"] .contactflow-kanban-column h3 small,
html[data-theme="dark"] .contactflow-kanban-card small,
html[data-theme="dark"] .contactflow-watch-card small,
html[data-theme="dark"] .contactflow-source-list small,
html[data-theme="dark"] .contactflow-metric-list small,
html[data-theme="dark"] .contactflow-side-section p,
html[data-theme="dark"] .conversation-detail-grid small,
html[data-theme="dark"] .live-conversation-list small,
html[data-theme="dark"] .live-conversation-list em {
  color: #a9bad0;
}

html[data-theme="dark"] .contactflow-lead em,
html[data-theme="dark"] .contactflow-kanban-card em,
html[data-theme="dark"] .contactflow-watch-card em {
  background: rgba(247, 196, 93, 0.18);
  color: #ffd88a;
}

html[data-theme="dark"] .conversation-detail-modal .context-pills span,
html[data-theme="dark"] .conversation-detail-modal .decision-trace span,
html[data-theme="dark"] .conversation-detail-modal code,
html[data-theme="dark"] .token-box,
html[data-theme="dark"] code {
  background: #0b2130;
  border-color: #335775;
  color: #dcecff;
}

/* Dark theme sweep by screen: Dashboard, Support, CRM, ContactFlow, Smart, Integrations, AI Agent and account settings. */
html[data-theme="dark"],
html[data-theme="dark"] body {
  --text: #edf6ff;
  --text-muted: #a9bad0;
  --text-soft: #8fa7bd;
  --surface-muted: #0d2433;
  --brand: #79b8ff;
  --primary: #5b8def;
  --danger: #ff9b9b;
}

html[data-theme="dark"] .login-form,
html[data-theme="dark"] .dialog,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .menu-modal,
html[data-theme="dark"] .flow-test-modal,
html[data-theme="dark"] .target-picker-modal,
html[data-theme="dark"] .restore-progress-modal,
html[data-theme="dark"] .finance-modal,
html[data-theme="dark"] .user-permission-modal,
html[data-theme="dark"] .knowledge-import-modal,
html[data-theme="dark"] .knowledge-detail-modal,
html[data-theme="dark"] .knowledge-library-modal {
  background: #12283a;
  border-color: rgba(143, 191, 225, 0.24);
  color: #edf6ff;
}

html[data-theme="dark"] .dashboard-live-grid .panel,
html[data-theme="dark"] .dashboard-crm-grid .panel,
html[data-theme="dark"] .live-status-kpis span,
html[data-theme="dark"] .crm-contact-list button,
html[data-theme="dark"] .avatar-mini,
html[data-theme="dark"] .conversation-dashboard,
html[data-theme="dark"] .conversation-warning,
html[data-theme="dark"] .conversation-confirm,
html[data-theme="dark"] .empty-conversations,
html[data-theme="dark"] .conversation-status,
html[data-theme="dark"] .support-sla-row,
html[data-theme="dark"] .support-chat-panel,
html[data-theme="dark"] .support-client-panel,
html[data-theme="dark"] .support-client-card,
html[data-theme="dark"] .support-message-list,
html[data-theme="dark"] .support-message,
html[data-theme="dark"] .support-composer,
html[data-theme="dark"] .support-field-card,
html[data-theme="dark"] .support-variable-list code,
html[data-theme="dark"] .conversation-detail-body,
html[data-theme="dark"] .conversation-detail-header,
html[data-theme="dark"] .conversation-detail-sidebar,
html[data-theme="dark"] .conversation-timeline,
html[data-theme="dark"] .conversation-timeline-event {
  background: #0d2433;
  border-color: rgba(143, 191, 225, 0.22);
  color: #edf6ff;
}

html[data-theme="dark"] .live-status-kpis strong,
html[data-theme="dark"] .crm-contact-list strong,
html[data-theme="dark"] .conversation-identity strong,
html[data-theme="dark"] .conversation-person strong,
html[data-theme="dark"] .conversation-confirm strong,
html[data-theme="dark"] .support-client-panel h3,
html[data-theme="dark"] .support-client-card strong,
html[data-theme="dark"] .support-message strong,
html[data-theme="dark"] .conversation-detail-header h2,
html[data-theme="dark"] .conversation-detail-person h2,
html[data-theme="dark"] .conversation-detail-sidebar h3 {
  color: #f5faff;
}

html[data-theme="dark"] .live-status-kpis small,
html[data-theme="dark"] .crm-contact-list small,
html[data-theme="dark"] .crm-contact-list em,
html[data-theme="dark"] .conversation-phone,
html[data-theme="dark"] .conversation-main p,
html[data-theme="dark"] .conversation-meta span,
html[data-theme="dark"] .support-client-panel label,
html[data-theme="dark"] .support-client-card span,
html[data-theme="dark"] .support-message small,
html[data-theme="dark"] .conversation-detail-header span,
html[data-theme="dark"] .conversation-detail-person span,
html[data-theme="dark"] .conversation-detail-header small,
html[data-theme="dark"] .conversation-detail-person small {
  color: #a9bad0;
}

html[data-theme="dark"] .smart-history-kpis,
html[data-theme="dark"] .smart-history-kpis article,
html[data-theme="dark"] .smart-queue-panel,
html[data-theme="dark"] .smart-sandbox-panel,
html[data-theme="dark"] .smart-simulator-panel,
html[data-theme="dark"] .smart-dashboard,
html[data-theme="dark"] .smart-status-list span,
html[data-theme="dark"] .smart-template-card,
html[data-theme="dark"] .meta-optin-card,
html[data-theme="dark"] .meta-status-pill,
html[data-theme="dark"] .integration-summary-card,
html[data-theme="dark"] .integration-overview-card,
html[data-theme="dark"] .integration-command-card,
html[data-theme="dark"] .integration-value-card,
html[data-theme="dark"] .engine-rule-note,
html[data-theme="dark"] .engine-rules-panel > .hint-text,
html[data-theme="dark"] .preset-grid button,
html[data-theme="dark"] .engine-preset-summary,
html[data-theme="dark"] .engine-rules-panel .engine-toggle,
html[data-theme="dark"] .engine-rules-panel .engine-number-field,
html[data-theme="dark"] .engine-flow-preview,
html[data-theme="dark"] .engine-flow-preview span,
html[data-theme="dark"] .confidence-presets button,
html[data-theme="dark"] .engine-metric-guide span,
html[data-theme="dark"] .bot-signal-list span,
html[data-theme="dark"] .order-result,
html[data-theme="dark"] .whatsapp-status-box,
html[data-theme="dark"] .knowledge-card,
html[data-theme="dark"] .operational-notice-card,
html[data-theme="dark"] .operational-notice-form,
html[data-theme="dark"] .operational-notice-panel,
html[data-theme="dark"] .knowledge-panel,
html[data-theme="dark"] .debug-grid pre {
  background: #0d2433;
  border-color: rgba(143, 191, 225, 0.22);
  color: #edf6ff;
}

html[data-theme="dark"] .preset-grid button.active,
html[data-theme="dark"] .confidence-presets button:hover,
html[data-theme="dark"] .engine-flow-preview span:hover {
  background: #17384d;
  border-color: #6fa9eb;
}

html[data-theme="dark"] .site-section-card,
html[data-theme="dark"] .site-section-card[open],
html[data-theme="dark"] .site-mini-list article,
html[data-theme="dark"] .site-preview,
html[data-theme="dark"] .site-preview header,
html[data-theme="dark"] .preview-hero,
html[data-theme="dark"] .preview-metrics,
html[data-theme="dark"] .preview-cards,
html[data-theme="dark"] .preview-screens,
html[data-theme="dark"] .preview-trial,
html[data-theme="dark"] .preview-metrics article,
html[data-theme="dark"] .preview-cards article,
html[data-theme="dark"] .preview-screens figure,
html[data-theme="dark"] .documentation-card,
html[data-theme="dark"] .documentation-visual,
html[data-theme="dark"] .backup-control-panel,
html[data-theme="dark"] .backup-health-panel,
html[data-theme="dark"] .backup-health-card,
html[data-theme="dark"] .backup-cloud-panel,
html[data-theme="dark"] .backup-file-card,
html[data-theme="dark"] .backup-history-panel,
html[data-theme="dark"] .restore-panel,
html[data-theme="dark"] .restore-selected-card,
html[data-theme="dark"] .restore-section-card,
html[data-theme="dark"] .database-status-grid article,
html[data-theme="dark"] .database-comparison-panel,
html[data-theme="dark"] .trial-center-panel,
html[data-theme="dark"] .trial-table,
html[data-theme="dark"] .finance-panel,
html[data-theme="dark"] .finance-table-panel,
html[data-theme="dark"] .watchdog-panel,
html[data-theme="dark"] .watchdog-card,
html[data-theme="dark"] .watchdog-rule-card,
html[data-theme="dark"] .system-health-card {
  background: #12283a;
  border-color: rgba(143, 191, 225, 0.22);
  color: #edf6ff;
}

html[data-theme="dark"] .profile-settings-page,
html[data-theme="dark"] .profile-settings-content,
html[data-theme="dark"] .profile-settings-nav,
html[data-theme="dark"] .profile-settings-card,
html[data-theme="dark"] .profile-form-grid label,
html[data-theme="dark"] .profile-menu-theme,
html[data-theme="dark"] .profile-menu-theme button,
html[data-theme="dark"] .theme-choice-row button,
html[data-theme="dark"] .admin-brand-panel,
html[data-theme="dark"] .admin-backup-panel fieldset,
html[data-theme="dark"] .plan-config-card,
html[data-theme="dark"] .users-panel,
html[data-theme="dark"] .admin-alert-list article,
html[data-theme="dark"] .admin-usage-list article,
html[data-theme="dark"] .row-card,
html[data-theme="dark"] .table-list article {
  background: #12283a;
  border-color: rgba(143, 191, 225, 0.22);
  color: #edf6ff;
}

html[data-theme="dark"] .profile-settings-header h2,
html[data-theme="dark"] .profile-settings-nav strong,
html[data-theme="dark"] .profile-settings-card strong,
html[data-theme="dark"] .profile-menu-theme span,
html[data-theme="dark"] .site-section-card summary span,
html[data-theme="dark"] .site-preview h1,
html[data-theme="dark"] .site-preview h2,
html[data-theme="dark"] .documentation-card strong,
html[data-theme="dark"] .backup-health-card strong,
html[data-theme="dark"] .database-status-grid span,
html[data-theme="dark"] .database-comparison-panel strong,
html[data-theme="dark"] .watchdog-card header span,
html[data-theme="dark"] .watchdog-card header b,
html[data-theme="dark"] .system-health-card strong,
html[data-theme="dark"] .integration-overview-card header strong,
html[data-theme="dark"] .integration-value-card strong,
html[data-theme="dark"] .preset-grid strong,
html[data-theme="dark"] .engine-preset-summary b,
html[data-theme="dark"] .engine-rule-note strong,
html[data-theme="dark"] .engine-metric-guide strong,
html[data-theme="dark"] .bot-signal-list strong {
  color: #f5faff;
}

html[data-theme="dark"] .profile-settings-nav span,
html[data-theme="dark"] .profile-settings-nav a,
html[data-theme="dark"] .profile-settings-card small,
html[data-theme="dark"] .site-section-card summary small,
html[data-theme="dark"] .site-preview header nav,
html[data-theme="dark"] .site-preview p,
html[data-theme="dark"] .site-preview small,
html[data-theme="dark"] .site-preview figcaption,
html[data-theme="dark"] .documentation-card p,
html[data-theme="dark"] .backup-health-card small,
html[data-theme="dark"] .backup-health-card em,
html[data-theme="dark"] .database-status-grid small,
html[data-theme="dark"] .database-comparison-panel small,
html[data-theme="dark"] .watchdog-card small,
html[data-theme="dark"] .system-health-card span,
html[data-theme="dark"] .integration-overview-card header small,
html[data-theme="dark"] .integration-value-card small,
html[data-theme="dark"] .preset-grid span,
html[data-theme="dark"] .engine-preset-summary strong,
html[data-theme="dark"] .engine-rule-note span,
html[data-theme="dark"] .engine-rule-note small,
html[data-theme="dark"] .engine-metric-guide small,
html[data-theme="dark"] .bot-signal-list small,
html[data-theme="dark"] .bot-signal-list em,
html[data-theme="dark"] .field-help {
  color: #a9bad0;
}

html[data-theme="dark"] .contactflow-tabs button,
html[data-theme="dark"] .contactflow-ranking button,
html[data-theme="dark"] .contactflow-ai-list article,
html[data-theme="dark"] .contactflow-ai-list blockquote,
html[data-theme="dark"] .contactflow-health-grid article,
html[data-theme="dark"] .contactflow-audit-list article,
html[data-theme="dark"] .contactflow-audit-filters,
html[data-theme="dark"] .contactflow-stage-editor > div,
html[data-theme="dark"] .contactflow-permissions-table article,
html[data-theme="dark"] .contactflow-inline-inputs,
html[data-theme="dark"] .contactflow-inbox-notice,
html[data-theme="dark"] .inbox-ai-copilot,
html[data-theme="dark"] .inbox-ai-summary-grid span,
html[data-theme="dark"] .inbox-ai-reply,
html[data-theme="dark"] .inbox-ai-empty,
html[data-theme="dark"] .inbox-ai-proposal-card,
html[data-theme="dark"] .inbox-ai-source-card,
html[data-theme="dark"] .inbox-ai-log-list article,
html[data-theme="dark"] .proposal-payload,
html[data-theme="dark"] .proposal-result {
  background: #0d2433;
  border-color: rgba(143, 191, 225, 0.22);
  color: #edf6ff;
}

html[data-theme="dark"] .contactflow-tabs button.active,
html[data-theme="dark"] .contactflow-temp.quente,
html[data-theme="dark"] .contactflow-temp.morno,
html[data-theme="dark"] .contactflow-temp.frio {
  border-color: rgba(123, 188, 255, 0.5);
}

html[data-theme="dark"] .ai-agent-intro-card,
html[data-theme="dark"] .ai-agent-availability-row,
html[data-theme="dark"] .ai-agent-tabs,
html[data-theme="dark"] .ai-agent-new-card,
html[data-theme="dark"] .ai-agent-mode-strip button,
html[data-theme="dark"] .ai-agent-selected-strip,
html[data-theme="dark"] .ai-agent-selected-strip select,
html[data-theme="dark"] .ai-agent-empty,
html[data-theme="dark"] .ai-rule-audit-card,
html[data-theme="dark"] .ai-rule-detail-list article,
html[data-theme="dark"] .prompt-preview-box,
html[data-theme="dark"] .ai-action-card,
html[data-theme="dark"] .ai-action-flow > div,
html[data-theme="dark"] .ai-agent-decision-card,
html[data-theme="dark"] .ai-explain-grid section,
html[data-theme="dark"] .ai-settings-groups article,
html[data-theme="dark"] .ai-log-timeline article,
html[data-theme="dark"] .onboarding-card,
html[data-theme="dark"] .ai-agent-mode-note,
html[data-theme="dark"] .list-row-card,
html[data-theme="dark"] .channel-config-row,
html[data-theme="dark"] .ai-action-proposal-card,
html[data-theme="dark"] .ai-product-import-panel,
html[data-theme="dark"] .ai-product-import-origin,
html[data-theme="dark"] .ai-product-import-stat,
html[data-theme="dark"] .ai-product-preview-card,
html[data-theme="dark"] .product-variation-list section,
html[data-theme="dark"] .ai-tool-category-card,
html[data-theme="dark"] .ai-tool-row,
html[data-theme="dark"] .compact-row,
html[data-theme="dark"] .general-log-list code {
  background: #12283a;
  border-color: rgba(143, 191, 225, 0.22);
  color: #edf6ff;
}

html[data-theme="dark"] .ai-product-import-panel {
  background: linear-gradient(135deg, rgba(91, 141, 239, 0.14), #12283a 62%);
}

html[data-theme="dark"] .ai-product-preview-card h4,
html[data-theme="dark"] .ai-product-import-head h3,
html[data-theme="dark"] .ai-product-import-stat strong {
  color: #f5faff;
}

html[data-theme="dark"] .ai-product-preview-card p,
html[data-theme="dark"] .ai-product-import-origin small,
html[data-theme="dark"] .ai-product-import-head p,
html[data-theme="dark"] .product-price-row small,
html[data-theme="dark"] .ai-product-import-stat span,
html[data-theme="dark"] .ai-product-import-stat small {
  color: #a9bad0;
}

html[data-theme="dark"] .ai-agent-wizard-panel,
html[data-theme="dark"] .wizard-step-card,
html[data-theme="dark"] .wizard-behavior-main,
html[data-theme="dark"] .wizard-conversation-preview,
html[data-theme="dark"] .wizard-phone-chat,
html[data-theme="dark"] .wizard-identity-grid button,
html[data-theme="dark"] .wizard-tone-grid button,
html[data-theme="dark"] .wizard-pace-grid button,
html[data-theme="dark"] .wizard-behavior-options label,
html[data-theme="dark"] .wizard-knowledge-empty,
html[data-theme="dark"] .wizard-knowledge-toolbar,
html[data-theme="dark"] .wizard-knowledge-cards article,
html[data-theme="dark"] .knowledge-drawer,
html[data-theme="dark"] .knowledge-drawer-card,
html[data-theme="dark"] .knowledge-toggle-row button,
html[data-theme="dark"] .knowledge-dropzone,
html[data-theme="dark"] .knowledge-generated-faq,
html[data-theme="dark"] .knowledge-document-card,
html[data-theme="dark"] .knowledge-result-card,
html[data-theme="dark"] .knowledge-drawer .knowledge-drawer-card,
html[data-theme="dark"] .wizard-automation-card {
  background: #12283a !important;
  border-color: rgba(143, 191, 225, 0.24) !important;
  color: #edf6ff;
}

html[data-theme="dark"] .wizard-segment-profile-card,
html[data-theme="dark"] .wizard-segment-help,
html[data-theme="dark"] .ai-agent-segment-note,
html[data-theme="dark"] .ai-segment-side-note {
  background: linear-gradient(180deg, rgba(18, 40, 58, 0.98), rgba(13, 36, 51, 0.98));
  border-color: rgba(143, 191, 225, 0.22);
  color: #edf6ff;
}

html[data-theme="dark"] .wizard-chat-bubble.client {
  background: #17384d;
}

html[data-theme="dark"] .wizard-chat-bubble.agent {
  background: rgba(31, 94, 66, 0.78);
}

html[data-theme="dark"] .ai-rule-audit-card b,
html[data-theme="dark"] .ai-rule-detail-actions .secondary-button.test {
  background: rgba(59, 130, 246, .15);
  border-color: rgba(96, 165, 250, .42);
  color: #bfdbfe;
}

html[data-theme="dark"] .ai-rule-detail-actions .secondary-button.edit {
  background: rgba(124, 58, 237, .18);
  border-color: rgba(167, 139, 250, .45);
  color: #ddd6fe;
}

html[data-theme="dark"] .ai-rule-edit-modal {
  background: #0d2433;
  border-color: rgba(143, 191, 225, 0.28);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
}

html[data-theme="dark"] .ai-rule-edit-modal .menu-modal-title h2,
html[data-theme="dark"] .ai-rule-edit-grid label,
html[data-theme="dark"] .ai-rule-edit-options label {
  color: #edf6ff;
}

html[data-theme="dark"] .ai-rule-edit-modal .menu-modal-title p {
  color: #a9bad0;
}

html[data-theme="dark"] .ai-rule-edit-alert {
  background: rgba(22, 101, 52, .22);
  border-color: rgba(74, 222, 128, .3);
  color: #bbf7d0;
}

html[data-theme="dark"] .ai-rule-origin-note.system {
  background: rgba(120, 53, 15, .22);
  border-color: rgba(251, 191, 36, .35);
  color: #fde68a;
}

html[data-theme="dark"] .ai-rule-origin-note.custom {
  background: rgba(30, 64, 175, .22);
  border-color: rgba(96, 165, 250, .35);
  color: #bfdbfe;
}

html[data-theme="dark"] .ai-rule-edit-diagnosis,
html[data-theme="dark"] .ai-rule-edit-diagnosis-grid article,
html[data-theme="dark"] .ai-rule-edit-tips {
  background: #0b2130;
  border-color: #335775;
  color: #edf6ff;
}

html[data-theme="dark"] .ai-rule-edit-diagnosis.alto {
  background: rgba(127, 29, 29, .22);
  border-color: rgba(248, 113, 113, .35);
}

html[data-theme="dark"] .ai-rule-edit-diagnosis.medio,
html[data-theme="dark"] .ai-rule-edit-diagnosis.médio {
  background: rgba(120, 53, 15, .22);
  border-color: rgba(251, 191, 36, .35);
}

html[data-theme="dark"] .ai-rule-edit-diagnosis.baixo {
  background: rgba(20, 83, 45, .22);
  border-color: rgba(74, 222, 128, .3);
}

html[data-theme="dark"] .ai-rule-edit-diagnosis-head strong,
html[data-theme="dark"] .ai-rule-edit-diagnosis-grid h3,
html[data-theme="dark"] .ai-rule-edit-diagnosis-grid article strong,
html[data-theme="dark"] .ai-rule-edit-tips strong {
  color: #f5faff;
}

html[data-theme="dark"] .ai-rule-edit-diagnosis-head p,
html[data-theme="dark"] .ai-rule-edit-diagnosis-grid article span,
html[data-theme="dark"] .ai-rule-edit-tips span {
  color: #a9bad0;
}

html[data-theme="dark"] .ai-rule-edit-grid input,
html[data-theme="dark"] .ai-rule-edit-grid select,
html[data-theme="dark"] .ai-rule-edit-grid textarea,
html[data-theme="dark"] .ai-rule-edit-modal .wizard-automation-editor-config,
html[data-theme="dark"] .ai-rule-edit-modal .wizard-automation-editor-config input,
html[data-theme="dark"] .ai-rule-edit-modal .wizard-automation-editor-config select,
html[data-theme="dark"] .ai-rule-edit-modal .wizard-automation-editor-config textarea,
html[data-theme="dark"] .ai-rule-edit-options .automation-switch {
  background: #0b2130;
  border-color: #335775;
  color: #edf6ff;
}

html[data-theme="dark"] .ai-rule-edit-options .automation-switch.compact span {
  color: #edf6ff;
}

html[data-theme="dark"] .ai-rule-edit-options .automation-switch.compact input {
  background: #1e3a4f;
  border-color: #456781;
}

html[data-theme="dark"] .ai-rule-edit-options .automation-switch.compact input:checked {
  background: #22c55e;
  border-color: #4ade80;
}

html[data-theme="dark"] .ai-rule-edit-options .automation-switch.compact input:disabled {
  background: #314455;
  border-color: #526679;
}

html[data-theme="dark"] .ai-brain-command-center {
  background: linear-gradient(135deg, rgba(18, 40, 58, .98), rgba(13, 36, 51, .98));
  border-color: rgba(143, 191, 225, .24);
  color: #edf6ff;
}

html[data-theme="dark"] .ai-brain-command-center.ok {
  background: linear-gradient(135deg, rgba(20, 83, 45, .34), rgba(13, 36, 51, .98));
  border-color: rgba(74, 222, 128, .32);
}

html[data-theme="dark"] .ai-brain-command-center.warning {
  background: linear-gradient(135deg, rgba(120, 53, 15, .34), rgba(13, 36, 51, .98));
  border-color: rgba(251, 191, 36, .32);
}

html[data-theme="dark"] .ai-brain-command-center.danger {
  background: linear-gradient(135deg, rgba(127, 29, 29, .34), rgba(13, 36, 51, .98));
  border-color: rgba(248, 113, 113, .32);
}

html[data-theme="dark"] .ai-brain-command-status h2,
html[data-theme="dark"] .ai-brain-command-guide strong {
  color: #f5faff;
}

html[data-theme="dark"] .ai-brain-command-status p,
html[data-theme="dark"] .ai-brain-command-guide span {
  color: #a9bad0;
}

html[data-theme="dark"] .ai-brain-command-guide article,
html[data-theme="dark"] .ai-brain-metrics-grid .ai-agent-decision-card {
  background: rgba(11, 33, 48, .82);
  border-color: rgba(143, 191, 225, .22);
}

html[data-theme="dark"] .wizard-chat-bubble p,
html[data-theme="dark"] .wizard-behavior-main h3,
html[data-theme="dark"] .wizard-conversation-preview h3,
html[data-theme="dark"] .wizard-identity-grid strong,
html[data-theme="dark"] .wizard-tone-grid strong,
html[data-theme="dark"] .wizard-pace-grid strong,
html[data-theme="dark"] .wizard-knowledge-empty strong,
html[data-theme="dark"] .wizard-knowledge-head h3,
html[data-theme="dark"] .wizard-knowledge-cards strong,
html[data-theme="dark"] .knowledge-drawer-head h3,
html[data-theme="dark"] .knowledge-result-card strong,
html[data-theme="dark"] .ai-agent-intro-card h2,
html[data-theme="dark"] .ai-agent-new-card h3,
html[data-theme="dark"] .ai-rule-audit-card strong,
html[data-theme="dark"] .ai-rule-detail-list article strong {
  color: #f5faff;
}

html[data-theme="dark"] .wizard-chat-bubble small,
html[data-theme="dark"] .wizard-behavior-helper,
html[data-theme="dark"] .wizard-identity-grid small,
html[data-theme="dark"] .wizard-knowledge-head p,
html[data-theme="dark"] .wizard-knowledge-cards small,
html[data-theme="dark"] .knowledge-drawer-field,
html[data-theme="dark"] .knowledge-drawer-card label,
html[data-theme="dark"] .knowledge-qa-form label,
html[data-theme="dark"] .knowledge-drawer-field small,
html[data-theme="dark"] .knowledge-qa-form small,
html[data-theme="dark"] .ai-agent-intro-card p,
html[data-theme="dark"] .ai-agent-new-card p,
html[data-theme="dark"] .ai-agent-mode-strip small,
html[data-theme="dark"] .ai-agent-empty span,
html[data-theme="dark"] .ai-agent-decision-card small,
html[data-theme="dark"] .ai-action-card p,
html[data-theme="dark"] .ai-log-timeline small,
html[data-theme="dark"] .list-row-card span,
html[data-theme="dark"] .channel-config-row span {
  color: #a9bad0;
}

html[data-theme="dark"] .knowledge-drawer-field input,
html[data-theme="dark"] .knowledge-drawer-card input,
html[data-theme="dark"] .knowledge-drawer-card textarea,
html[data-theme="dark"] .knowledge-qa-form input,
html[data-theme="dark"] .knowledge-qa-form textarea,
html[data-theme="dark"] .wizard-field input,
html[data-theme="dark"] .wizard-field select,
html[data-theme="dark"] .wizard-field textarea,
html[data-theme="dark"] .wizard-url-input,
html[data-theme="dark"] .wizard-sector-select select {
  background: #0b2130;
  border-color: #335775;
  color: #edf6ff;
}

html[data-theme="dark"] .content :is(
  [class$="-card"],
  [class*="-card "],
  [class$="-panel"],
  [class*="-panel "],
  [class$="-box"],
  [class*="-box "],
  [class$="-modal"],
  [class*="-modal "],
  [class$="-drawer"],
  [class*="-drawer "],
  [class$="-popover"],
  [class*="-popover "],
  [class$="-item"],
  [class*="-item "],
  [class$="-tile"],
  [class*="-tile "],
  [class$="-section"],
  [class*="-section "]
):not(.primary-button):not(.danger-button):not(.status-dot):not(.toast-dot):not(.meta-status-dot):not(.risk-meter):not(.brand-mark):not(.profile-avatar):not(.avatar-mini) {
  background: #12283a;
  border-color: rgba(143, 191, 225, 0.22);
  color: #edf6ff;
}

html[data-theme="dark"] .content :is(
  [class$="-row"],
  [class*="-row "],
  [class$="-line"],
  [class*="-line "],
  [class$="-summary"],
  [class*="-summary "],
  [class$="-preview"],
  [class*="-preview "],
  [class$="-result"],
  [class*="-result "],
  [class$="-note"],
  [class*="-note "],
  [class$="-notice"],
  [class*="-notice "]
):not(.primary-button):not(.danger-button):not(.inline-alert):not(.trial-store-notice) {
  background: #0d2433;
  border-color: rgba(143, 191, 225, 0.2);
  color: #dcecff;
}

html[data-theme="dark"] .content :is(
  h1, h2, h3, h4, strong, b,
  .title,
  [class$="-title"],
  [class*="-title "],
  [class$="-head"],
  [class*="-head "]
) {
  color: #f5faff;
}

html[data-theme="dark"] .content :is(
  p, small, em, figcaption,
  .hint,
  .hint-text,
  .field-help,
  [class$="-helper"],
  [class*="-helper "],
  [class$="-meta"],
  [class*="-meta "],
  [class$="-description"],
  [class*="-description "]
) {
  color: #a9bad0;
}

html[data-theme="dark"] .content :is(table, thead, tbody, tr, th, td),
html[data-theme="dark"] .content :is(pre, code):not(.status-pill):not(.queue-status) {
  background: #0b2130;
  border-color: #335775;
  color: #dcecff;
}

/* Dashboard ranking/value cards: these late CRM rules use gradients and need explicit dark overrides. */
html[data-theme="dark"] .ranking-table article,
html[data-theme="dark"] .dashboard-list-questions .ranking-table article,
html[data-theme="dark"] .value-report-main,
html[data-theme="dark"] .value-report-grid span,
html[data-theme="dark"] .risk-stat-grid span {
  background: #0d2433;
  border-color: rgba(143, 191, 225, 0.28);
  color: #edf6ff;
}

html[data-theme="dark"] .ranking-table strong,
html[data-theme="dark"] .dashboard-list-questions .ranking-table strong,
html[data-theme="dark"] .value-report-main strong,
html[data-theme="dark"] .value-report-grid b,
html[data-theme="dark"] .risk-stat-grid b {
  color: #f5faff;
}

html[data-theme="dark"] .ranking-table small,
html[data-theme="dark"] .ranking-table b,
html[data-theme="dark"] .ranking-table em,
html[data-theme="dark"] .dashboard-list-questions .ranking-table b,
html[data-theme="dark"] .dashboard-list-questions .ranking-table em,
html[data-theme="dark"] .value-report-main span,
html[data-theme="dark"] .value-report-grid small,
html[data-theme="dark"] .risk-stat-grid small {
  color: #a9bad0;
}

html[data-theme="dark"] .dashboard-list-questions .ranking-table small {
  background: #12283a;
  border-color: rgba(143, 191, 225, 0.28);
  color: #a9bad0;
}

/* Live support: central transcript and customer sidebar have late light backgrounds. */
html[data-theme="dark"] .live-sla-banner,
html[data-theme="dark"] .live-sla-banner.green,
html[data-theme="dark"] .live-sla-banner.yellow,
html[data-theme="dark"] .live-sla-banner.red,
html[data-theme="dark"] .live-transcript,
html[data-theme="dark"] .live-reply-box,
html[data-theme="dark"] .live-customer-card,
html[data-theme="dark"] .live-context,
html[data-theme="dark"] .live-notes,
html[data-theme="dark"] .live-notes p,
html[data-theme="dark"] .live-message,
html[data-theme="dark"] .live-message.system,
html[data-theme="dark"] .live-message.note {
  background: #0d2433;
  border-color: rgba(143, 191, 225, 0.24);
  color: #edf6ff;
}

html[data-theme="dark"] .live-message.outgoing {
  background: rgba(31, 94, 66, 0.78);
  border-color: rgba(91, 218, 150, 0.32);
  color: #ecfff6;
}

html[data-theme="dark"] .live-context code,
html[data-theme="dark"] .live-search,
html[data-theme="dark"] .quick-replies button,
html[data-theme="dark"] .live-filter-row button {
  background: #12283a;
  border-color: rgba(143, 191, 225, 0.28);
  color: #dcecff;
}

html[data-theme="dark"] .live-filter-row button.active,
html[data-theme="dark"] .quick-replies button:hover {
  background: #17384d;
  border-color: #6fa9eb;
  color: #f5faff;
}

html[data-theme="dark"] .live-sla-banner span,
html[data-theme="dark"] .live-sla-banner strong,
html[data-theme="dark"] .live-chat-header strong,
html[data-theme="dark"] .live-customer-card strong,
html[data-theme="dark"] .live-context strong,
html[data-theme="dark"] .live-notes strong,
html[data-theme="dark"] .live-message p {
  color: #f5faff;
}

html[data-theme="dark"] .live-sla-banner small,
html[data-theme="dark"] .live-chat-header span,
html[data-theme="dark"] .live-customer label,
html[data-theme="dark"] .live-customer-card span,
html[data-theme="dark"] .live-customer-card small,
html[data-theme="dark"] .live-context small,
html[data-theme="dark"] .live-notes small,
html[data-theme="dark"] .live-message small,
html[data-theme="dark"] .live-reply-box small {
  color: #a9bad0;
}

/* Profile menu stays inside the left sidebar instead of covering the workspace. */
.sidebar-footer .profile-menu-popover {
  bottom: calc(100% + 8px);
  box-sizing: border-box;
  left: 0;
  max-height: min(520px, calc(100vh - 120px));
  min-width: 0;
  overflow: auto;
  right: 0;
  width: 100%;
}

.sidebar-footer .profile-menu-popover button,
.sidebar-footer .profile-menu-popover > small,
.sidebar-footer .profile-menu-popover > span {
  min-width: 0;
}

.sidebar-footer .profile-menu-theme div {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

/* Dark theme v1.0.1: late cleanup for operational screens with nested light cards. */
html[data-theme="dark"] .workspace :where(
  .documentation-index,
  .documentation-section,
  .documentation-search,
  .doc-subsection,
  .doc-visual,
  .doc-visual-screen,
  .doc-visual-main,
  .doc-visual-grid span,
  .doc-phone-preview,
  .doc-phone-bubble,
  .conversation-card,
  .conversation-record,
  .conversation-main,
  .conversation-main > div,
  .conversation-main > p,
  .conversation-main > article,
  .conversation-main > section,
  .conversation-detail-grid article,
  .conversation-token-note,
  .decision-trace,
  .bot-signal-list span,
  .context-pills,
  .smart-dashboard-card,
  .smart-list,
  .smart-list button,
  .smart-template-card,
  .smart-template-preview,
  .smart-preview,
  .smart-preview-card,
  .smart-queue-preview,
  .smart-queue-panel,
  .queue-actions,
  .queue-group,
  .queue-row,
  .smart-history-results,
  .smart-history-kpis article,
  .smart-history-grid > article,
  .smart-history-list article,
  .smart-ranking span,
  .smart-mini-grid span,
  .smart-status-list span,
  .meta-optin-page,
  .meta-optin-explain,
  .meta-optin-row,
  .meta-cost-explain,
  .meta-api-editor,
  .meta-config-strip,
  .meta-readonly-field,
  .meta-official-note,
  .meta-preset-row,
  .meta-validation-box,
  .meta-category-risk,
  .meta-header-options,
  .meta-samples-box,
  .meta-sample-row,
  .meta-revision-callout,
  .meta-button-row,
  .meta-duplicate-box,
  .meta-history-box,
  .meta-history-box article,
  .meta-preview-card,
  .users-panel article,
  .users-panel form,
  .team-user-row,
  .table-list article,
  .row-card
) {
  background: #12283a !important;
  border-color: rgba(143, 191, 225, 0.28) !important;
  color: #edf6ff !important;
}

html[data-theme="dark"] .workspace :where(
  .documentation-search,
  .doc-visual-grid span,
  .doc-phone-bubble,
  .conversation-main > p,
  .conversation-main > div,
  .conversation-token-note,
  .decision-trace,
  .bot-signal-list span,
  .context-pills span,
  .smart-list button,
  .smart-queue-preview button,
  .queue-row,
  .smart-history-list article,
  .smart-ranking span,
  .meta-optin-row,
  .meta-api-editor input,
  .meta-api-editor textarea,
  .meta-api-editor select,
  .meta-readonly-field,
  .meta-preset-row button,
  .meta-header-options button,
  .meta-sample-row,
  .users-panel article,
  .table-list article
) {
  background: #0d2433 !important;
}

html[data-theme="dark"] .workspace :where(
  .documentation-index a,
  .documentation-submenu a,
  .documentation-summary,
  .documentation-section p,
  .documentation-section li,
  .doc-paragraph,
  .doc-empty p,
  .doc-visual figcaption,
  .doc-visual figcaption span,
  .doc-visual > small,
  .conversation-card *,
  .conversation-record *,
  .conversation-main *,
  .bot-signal-list *,
  .smart-list *,
  .smart-queue-panel *,
  .smart-history-list *,
  .smart-history-grid *,
  .smart-ranking *,
  .meta-optin-page *,
  .meta-api-editor *,
  .meta-history-box *,
  .users-panel *,
  .table-list article *
) {
  color: #cfe0f3 !important;
}

html[data-theme="dark"] .workspace :where(
  .documentation-section h2,
  .doc-subsection h3,
  .documentation-menu-main,
  .conversation-card strong,
  .conversation-record strong,
  .conversation-main strong,
  .smart-list strong,
  .smart-queue-panel strong,
  .smart-history-list strong,
  .smart-ranking strong,
  .meta-optin-page strong,
  .meta-api-editor h2,
  .meta-api-editor h3,
  .meta-api-editor strong,
  .users-panel h2,
  .users-panel h3,
  .users-panel strong,
  .table-list article strong
) {
  color: #f6fbff !important;
}

html[data-theme="dark"] .workspace :where(
  input,
  textarea,
  select,
  .history-search-field,
  .history-search-field input,
  .documentation-search input
) {
  background: #0b2130 !important;
  border-color: #335775 !important;
  color: #edf6ff !important;
}

html[data-theme="dark"] .workspace input::placeholder,
html[data-theme="dark"] .workspace textarea::placeholder {
  color: #8fa7bd !important;
}

html[data-theme="dark"] .workspace :where(
  .status-pill,
  .conversation-pill,
  .context-pills span,
  .meta-status-badge,
  .meta-status-pill,
  .queue-status,
  .tag
) {
  background: #eaf2ff !important;
  border-color: rgba(207, 224, 243, 0.3) !important;
  color: #16324a !important;
}

html[data-theme="dark"] .workspace :where(
  .status-pill.ok,
  .meta-status-badge.approved,
  .meta-status-pill.approved,
  .meta-status-dot.approved,
  .queue-status.sent,
  .queue-status.sandbox_sent,
  .queue-status.confirmed,
  .queue-status.delivered,
  .queue-status.read,
  .queue-status.web_accepted,
  .meta-optin-row.active .meta-optin-status
) {
  background: #dcfce7 !important;
  color: #166534 !important;
}

html[data-theme="dark"] .workspace :where(
  .status-pill.warning,
  .meta-status-badge.pending,
  .meta-status-badge.in_review,
  .meta-status-pill.pending,
  .meta-status-pill.in_review,
  .meta-status-dot.pending,
  .meta-status-dot.in_review,
  .queue-status.queued
) {
  background: #fef3c7 !important;
  color: #92400e !important;
}

html[data-theme="dark"] .workspace :where(
  .status-pill.danger,
  .meta-status-badge.rejected,
  .meta-status-pill.rejected,
  .meta-status-dot.rejected,
  .queue-status.error,
  .queue-status.failed,
  .queue-status.suspect
) {
  background: #fee2e2 !important;
  color: #991b1b !important;
}

html[data-theme="dark"] .workspace :where(
  .doc-visual,
  .doc-visual-sidebar,
  .doc-phone-bubble.alt,
  .meta-phone-screen,
  .meta-chat-bubble
) {
  background: linear-gradient(135deg, #10283a, #123347) !important;
}

/* Login experience refresh */
.login-page {
  background:
    radial-gradient(circle at 12% 12%, rgba(46, 212, 157, 0.22), transparent 26vw),
    radial-gradient(circle at 88% 18%, rgba(68, 132, 255, 0.28), transparent 28vw),
    linear-gradient(135deg, #071521 0%, #0d2638 48%, #132f45 100%) !important;
  color: #eaf4ff;
  min-height: 100vh;
  overflow: hidden;
  padding: 34px;
  position: relative;
}

.login-page::before {
  background:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 54px 54px;
  content: "";
  inset: 0;
  mask-image: linear-gradient(135deg, rgba(0, 0, 0, 0.76), transparent 74%);
  pointer-events: none;
  position: absolute;
}

.login-panel {
  background: rgba(8, 23, 35, 0.76) !important;
  border: 1px solid rgba(148, 187, 216, 0.24) !important;
  border-radius: 28px !important;
  box-shadow: 0 34px 120px rgba(0, 0, 0, 0.42) !important;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(390px, 0.62fr);
  max-width: 1280px;
  min-height: 720px;
  overflow: hidden;
  position: relative;
  width: min(100%, 1280px);
  z-index: 1;
}

.login-copy {
  background:
    linear-gradient(135deg, rgba(13, 43, 62, 0.92), rgba(9, 24, 37, 0.84)),
    radial-gradient(circle at 82% 18%, rgba(46, 212, 157, 0.18), transparent 30%) !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  color: #d9ebff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
  padding: 54px 58px;
  position: relative;
}

.login-copy::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  content: "";
  height: 1px;
  left: 58px;
  position: absolute;
  right: 58px;
  top: 50%;
}

.login-copy .brand-lockup {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(196, 220, 238, 0.18);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
  color: #f8fbff;
  padding: 12px 14px;
  width: fit-content;
}

.login-copy .brand-lockup strong,
.login-copy h1 {
  color: #ffffff !important;
}

.login-copy .brand-lockup small {
  color: #a9c1d8;
}

.login-copy h1 {
  font-size: clamp(38px, 4vw, 62px);
  line-height: 0.98;
  margin: 34px 0 18px;
  max-width: 720px;
}

.login-copy > p {
  color: #b7cbe1;
  font-size: 18px;
  line-height: 1.55;
  margin: 0 0 26px;
  max-width: 690px;
}

.login-preview-card {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(199, 224, 242, 0.2);
  border-radius: 20px;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.34);
  height: 300px;
  margin: 8px 0 18px;
  max-width: 720px;
  overflow: hidden;
  padding: 10px;
  position: relative;
}

.login-preview-card img {
  border-radius: 14px;
  display: block;
  filter: saturate(1.08) contrast(1.04);
  object-fit: cover;
  position: absolute;
}

.login-preview-main {
  height: 250px;
  left: 22px;
  object-position: left top;
  top: 24px;
  width: 78%;
}

.login-preview-side {
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.24);
  height: 118px;
  object-position: left top;
  right: 20px;
  width: 36%;
}

.login-preview-side.flow {
  top: 36px;
}

.login-preview-side.smart {
  bottom: 28px;
}

.login-preview-float {
  background: rgba(6, 20, 32, 0.86);
  border: 1px solid rgba(141, 211, 177, 0.34);
  border-radius: 14px;
  bottom: 24px;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.28);
  color: #ecfff7;
  display: grid;
  gap: 4px;
  left: 24px;
  max-width: min(360px, calc(100% - 48px));
  padding: 13px 15px;
  position: absolute;
}

.login-preview-float strong {
  font-size: 15px;
}

.login-preview-float span {
  color: #aee8d1;
  font-size: 13px;
}

.login-metrics {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 720px;
}

.login-metrics span {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(196, 220, 238, 0.16);
  border-radius: 16px;
  display: grid;
  gap: 2px;
  padding: 13px 14px;
}

.login-metrics strong {
  color: #ffffff;
  font-size: 22px;
  line-height: 1;
}

.login-metrics small {
  color: #9fb7ce;
  font-size: 12px;
}

.login-highlights {
  margin-top: 18px;
}

.login-highlights span {
  background: rgba(255, 255, 255, 0.09) !important;
  border: 1px solid rgba(196, 220, 238, 0.18) !important;
  border-radius: 999px !important;
  box-shadow: none !important;
  color: #dceeff;
}

.login-form {
  background: linear-gradient(180deg, #ffffff 0%, #f6f9fd 100%) !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  justify-content: center;
  padding: 56px 48px;
}

.login-form::before {
  background: linear-gradient(90deg, #2ed49d, #4484ff);
  border-radius: 999px;
  content: "";
  display: block;
  height: 5px;
  margin: 0 0 34px;
  width: 74px;
}

.login-kicker {
  color: #2563eb !important;
}

.login-form h2 {
  color: #0b1726 !important;
  font-size: 38px;
  margin-bottom: 8px;
}

.login-form-intro {
  color: #63758a;
  line-height: 1.45;
  margin: 0 0 28px;
}

.login-form label {
  color: #314158;
  font-size: 13px;
  letter-spacing: 0;
}

.login-form input {
  background: #ffffff !important;
  border: 1px solid #cfdae8 !important;
  border-radius: 14px !important;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
  color: #0f172a !important;
  min-height: 52px;
}

.login-form input:focus {
  border-color: #4484ff !important;
  box-shadow: 0 0 0 4px rgba(68, 132, 255, 0.16), 0 12px 28px rgba(15, 23, 42, 0.08);
}

.login-form .primary-button {
  background: linear-gradient(135deg, #2563eb, #14b8a6) !important;
  border-radius: 14px !important;
  box-shadow: 0 18px 36px rgba(37, 99, 235, 0.24) !important;
  min-height: 52px;
}

.login-form .link-button {
  color: #2563eb;
  justify-content: flex-start;
}

.login-form .hint {
  color: #7a8ba0;
  margin-top: 24px;
}

html[data-theme="dark"] .login-page {
  background:
    radial-gradient(circle at 12% 12%, rgba(46, 212, 157, 0.22), transparent 26vw),
    radial-gradient(circle at 88% 18%, rgba(68, 132, 255, 0.28), transparent 28vw),
    linear-gradient(135deg, #06111c 0%, #0d2535 48%, #112c41 100%) !important;
}

html[data-theme="dark"] .login-form {
  background: linear-gradient(180deg, #f8fbff 0%, #edf4fb 100%) !important;
}

@media (max-width: 980px) {
  .login-page {
    align-items: flex-start;
    overflow: auto;
    padding: 18px;
  }

  .login-panel {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .login-copy,
  .login-form {
    padding: 30px 24px;
  }

  .login-copy::after {
    display: none;
  }

  .login-copy h1 {
    font-size: 34px;
  }

  .login-preview-card {
    margin-top: 4px;
  }

  .login-metrics {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 981px) {
  .login-panel {
    min-height: min(680px, calc(100vh - 68px));
    max-width: 1180px;
  }

  .login-copy {
    padding: 38px 50px;
  }

  .login-copy h1 {
    font-size: clamp(38px, 3.5vw, 52px);
    margin: 26px 0 14px;
  }

  .login-copy > p {
    font-size: 16px;
    margin-bottom: 18px;
  }

  .login-preview-card {
    max-width: 640px;
    margin: 4px 0 14px;
    height: clamp(220px, 28vh, 280px);
  }

  .login-preview-main {
    height: calc(100% - 48px);
  }

  .login-preview-side {
    height: 38%;
  }

  .login-form {
    padding: 42px 42px;
  }

  .login-form::before {
    margin-bottom: 28px;
  }
}

@media (min-width: 981px) and (max-height: 800px) {
  .login-page {
    padding: 14px;
  }

  .login-panel {
    min-height: calc(100vh - 28px);
  }

  .login-copy {
    padding: 28px 50px;
  }

  .login-copy .brand-lockup {
    padding: 10px 12px;
  }

  .login-copy h1 {
    font-size: 41px;
    margin: 22px 0 12px;
  }

  .login-copy > p {
    font-size: 15px;
    line-height: 1.45;
    margin-bottom: 14px;
  }

  .login-preview-card {
    height: 218px;
  }

  .login-metrics span {
    padding: 10px 12px;
  }

  .login-highlights span {
    padding: 8px 10px;
  }

  .login-form {
    padding: 30px 42px;
  }

  .login-form::before {
    margin-bottom: 22px;
  }

  .login-form h2 {
    font-size: 34px;
  }

  .login-form-intro {
    margin-bottom: 22px;
  }
}

/* Admin command center refresh */
.admin-workspace {
  background:
    radial-gradient(circle at 10% 0%, rgba(20, 184, 166, 0.1), transparent 24vw),
    radial-gradient(circle at 86% 8%, rgba(37, 99, 235, 0.1), transparent 28vw),
    var(--canvas);
}

.admin-command-hero {
  background:
    linear-gradient(135deg, rgba(8, 23, 35, 0.96), rgba(15, 47, 70, 0.94)),
    radial-gradient(circle at 78% 18%, rgba(45, 212, 191, 0.18), transparent 34%);
  border: 1px solid rgba(148, 187, 216, 0.24);
  border-radius: 22px;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.22);
  color: #eaf4ff;
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(0, 0.92fr) minmax(420px, 1fr);
  margin-bottom: 18px;
  min-height: 330px;
  overflow: hidden;
  padding: 34px;
  position: relative;
}

.admin-command-hero::before {
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  content: "";
  inset: 0;
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.8), transparent);
  pointer-events: none;
  position: absolute;
}

.admin-command-copy,
.admin-command-visual {
  position: relative;
  z-index: 1;
}

.admin-command-copy {
  align-self: center;
  display: grid;
  gap: 16px;
}

.admin-command-kicker {
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(196, 220, 238, 0.18);
  border-radius: 999px;
  color: #aee8d1;
  display: inline-flex;
  font-size: 12px;
  font-weight: 850;
  gap: 8px;
  letter-spacing: 0.08em;
  padding: 9px 12px;
  text-transform: uppercase;
  width: fit-content;
}

.admin-command-copy h1 {
  color: #ffffff;
  font-size: clamp(34px, 3.2vw, 54px);
  line-height: 1;
  margin: 0;
  max-width: 620px;
}

.admin-command-copy p {
  color: #b7cbe1;
  font-size: 17px;
  line-height: 1.55;
  margin: 0;
  max-width: 640px;
}

.admin-command-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.admin-command-actions .secondary-button {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(196, 220, 238, 0.22);
  color: #ecf7ff;
}

.admin-command-visual {
  min-height: 270px;
}

.admin-command-visual img {
  border-radius: 16px;
  display: block;
  object-fit: cover;
  object-position: left top;
  position: absolute;
}

.admin-command-main {
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  height: 248px;
  left: 0;
  top: 20px;
  width: 72%;
}

.admin-command-card {
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
  height: 128px;
  right: 0;
  width: 42%;
}

.admin-command-card.flow {
  top: 0;
}

.admin-command-card.commerce {
  bottom: 0;
}

.admin-command-status {
  background: rgba(6, 20, 32, 0.88);
  border: 1px solid rgba(141, 211, 177, 0.34);
  border-radius: 16px;
  bottom: 24px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.32);
  color: #ecfff7;
  display: grid;
  gap: 2px;
  left: 24px;
  min-width: 150px;
  padding: 14px 16px;
  position: absolute;
}

.admin-command-status strong {
  color: #ffffff;
  font-size: 30px;
  line-height: 1;
}

.admin-command-status span {
  color: #aee8d1;
  font-size: 12px;
}

.admin-workspace > .admin-metric-grid .metric-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 250, 253, 0.96)) !important;
  border-color: rgba(207, 218, 232, 0.9) !important;
  border-radius: 16px !important;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08) !important;
}

.admin-workspace > .admin-grid > .panel,
.admin-workspace .trial-center-panel,
.admin-workspace .admin-alert-panel {
  border-radius: 16px !important;
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.07) !important;
}

html[data-theme="dark"] .admin-workspace {
  background:
    radial-gradient(circle at 10% 0%, rgba(20, 184, 166, 0.12), transparent 24vw),
    radial-gradient(circle at 86% 8%, rgba(37, 99, 235, 0.12), transparent 28vw),
    #061b29;
}

html[data-theme="dark"] .admin-workspace > .admin-metric-grid .metric-card,
html[data-theme="dark"] .admin-workspace > .admin-grid > .panel,
html[data-theme="dark"] .admin-workspace .trial-center-panel,
html[data-theme="dark"] .admin-workspace .admin-alert-panel {
  background: rgba(13, 43, 62, 0.88) !important;
  border-color: rgba(148, 187, 216, 0.2) !important;
}

@media (max-width: 1120px) {
  .admin-command-hero {
    grid-template-columns: 1fr;
  }

  .admin-command-visual {
    min-height: 300px;
  }
}

@media (max-width: 760px) {
  .admin-command-hero {
    border-radius: 16px;
    padding: 22px;
  }

  .admin-command-copy h1 {
    font-size: 34px;
  }

  .admin-command-visual {
    min-height: 240px;
  }

  .admin-command-main {
    height: 190px;
    width: 82%;
  }

  .admin-command-card {
    height: 96px;
    width: 48%;
  }
}

html[data-theme="dark"] .contactflow-config-hero,
html[data-theme="dark"] .contactflow-config-overview article,
html[data-theme="dark"] .contactflow-config-section,
html[data-theme="dark"] .contactflow-setting-card,
html[data-theme="dark"] .contactflow-field-card,
html[data-theme="dark"] .contactflow-permissions-table.v2 article,
html[data-theme="dark"] .contactflow-config-footer {
  background: #102235;
  border-color: rgba(148, 163, 184, 0.24);
  box-shadow: none;
}

html[data-theme="dark"] .contactflow-config-hero {
  background: linear-gradient(135deg, #0c1b2b 0%, #102235 100%);
}

html[data-theme="dark"] .contactflow-config-badges span,
html[data-theme="dark"] .contactflow-setting-card.enabled {
  background: rgba(22, 101, 52, 0.18);
  border-color: rgba(74, 222, 128, 0.35);
}

html[data-theme="dark"] .contactflow-config-hero h2,
html[data-theme="dark"] .contactflow-config-overview strong,
html[data-theme="dark"] .contactflow-section-head h3,
html[data-theme="dark"] .contactflow-setting-card strong,
html[data-theme="dark"] .contactflow-field-card {
  color: #f8fafc;
}

html[data-theme="dark"] .contactflow-config-hero p,
html[data-theme="dark"] .contactflow-config-overview span,
html[data-theme="dark"] .contactflow-section-head p,
html[data-theme="dark"] .contactflow-setting-card small,
html[data-theme="dark"] .contactflow-field-card small,
html[data-theme="dark"] .contactflow-config-footer span {
  color: #b7c4d6;
}

@media (max-width: 1180px) {
  .contactflow-setting-grid,
  .contactflow-stage-editor.v2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .contactflow-permissions-table.v2 article {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .contactflow-config-hero,
  .contactflow-config-sections,
  .contactflow-config-overview,
  .contactflow-setting-grid,
  .contactflow-stage-editor.v2,
  .contactflow-stage-editor.v2 > div {
    grid-template-columns: 1fr;
  }

  .contactflow-config-badges,
  .contactflow-section-head,
  .contactflow-config-footer {
    align-items: stretch;
    flex-direction: column;
  }

.contactflow-config-footer {
    position: static;
  }
}

.ai-persona-page .ai-persona-choice-grid {
  align-items: stretch;
  background: #f6f9fe;
  border: 1px solid #d8e3f2;
  border-radius: 14px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(150px, .34fr) repeat(5, minmax(118px, 1fr));
  padding: 12px;
}

.ai-persona-page .ai-persona-choice-grid.compact {
  grid-template-columns: minmax(150px, .34fr) repeat(4, minmax(128px, 1fr));
}

.ai-persona-page .ai-persona-choice-grid.compact.three {
  grid-template-columns: minmax(150px, .34fr) repeat(3, minmax(160px, 1fr));
}

.ai-persona-page .ai-persona-choice-grid > span {
  align-items: center;
  color: var(--ink, #101828);
  display: flex;
  font-size: .95rem;
  font-weight: 800;
  line-height: 1.15;
}

.ai-persona-page .ai-persona-choice-grid button {
  align-items: center;
  appearance: none;
  background: #ffffff;
  border: 2px solid #bfd0e4;
  border-radius: 12px;
  color: var(--ink, #101828);
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  font: inherit;
  justify-content: center;
  min-height: 74px;
  padding: 10px 12px;
  box-shadow: 0 8px 18px rgba(16, 24, 40, .05);
  text-align: center;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.ai-persona-page .ai-persona-choice-grid button strong {
  font-weight: 600;
  line-height: 1.15;
}

.ai-persona-page .ai-persona-choice-grid button small {
  color: #66758a;
  font-size: .77rem;
  line-height: 1.25;
  margin-top: 5px;
  max-width: 190px;
}

.ai-persona-page .ai-persona-choice-grid button:hover {
  border-color: #2f55d4;
  transform: translateY(-1px);
}

.ai-persona-page .ai-persona-choice-grid button.active {
  background: #eaf1ff;
  border-color: #2f55d4;
  box-shadow: 0 10px 22px rgba(47, 85, 212, .16), inset 0 0 0 1px rgba(47, 85, 212, .22);
  color: #1f3fa8;
}

.ai-persona-page .ai-persona-choice-grid button.active small {
  color: #3754a4;
}

.ai-persona-truth-card {
  align-items: center;
  background: #ecfdf3;
  border: 1px solid #95e7b8;
  border-radius: 14px;
  color: #075b32;
  display: flex;
  gap: 10px;
  line-height: 1.35;
  padding: 12px 14px;
}

.ai-persona-truth-card svg {
  color: #0bb45d;
  flex: 0 0 auto;
}

.ai-persona-scope-card {
  background: linear-gradient(135deg, #f8fbff 0%, #eef8ff 100%);
  border: 1px solid #bfd6ff;
  border-radius: 16px;
  display: grid;
  gap: 14px;
  padding: 16px;
}

.ai-persona-scope-head {
  align-items: flex-start;
  display: flex;
  gap: 12px;
}

.ai-persona-scope-head h3 {
  color: var(--ink, #101828);
  font-size: 1.05rem;
  margin: 2px 0 4px;
}

.ai-persona-scope-head p {
  color: #5d6b82;
  margin: 0;
}

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

.ai-persona-real-preview {
  display: grid;
  gap: 10px;
}

.ai-persona-real-preview .chat-bubble {
  max-width: 88%;
}

.ai-persona-real-preview .chat-bubble.client {
  background: #ffffff;
  border-color: #d8e3f2;
  color: #344054;
  justify-self: end;
}

.ai-persona-real-preview .chat-bubble.bot {
  justify-self: start;
}

@media (max-width: 980px) {
  .ai-persona-page,
  .ai-persona-page .ai-persona-choice-grid,
  .ai-persona-page .ai-persona-choice-grid.compact,
  .ai-persona-page .ai-persona-choice-grid.compact.three,
  .ai-persona-scope-grid {
    grid-template-columns: 1fr;
  }
}

.ai-agent-landing .ai-overview-hero {
  align-items: center;
  background: linear-gradient(135deg, #ffffff 0%, #f4f8ff 100%);
  border: 1px solid #d8e3f2;
  border-radius: 18px;
  box-shadow: 0 18px 42px rgba(16, 24, 40, .06);
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 24px 28px;
}

.ai-agent-landing .ai-overview-hero h2 {
  color: var(--ink, #101828);
  font-size: clamp(1.55rem, 2vw, 2.15rem);
  line-height: 1.12;
  margin: 6px 0 8px;
}

.ai-agent-landing .ai-overview-hero p {
  color: var(--muted, #667085);
  max-width: 820px;
}

.ai-agent-hero-actions {
  align-items: center;
  column-gap: 12px;
  row-gap: 10px;
}

.ai-agent-hero-actions > * + * {
  margin-left: 10px;
}

.ai-agent-hero-actions .status-pill {
  align-items: center;
  display: inline-flex;
  margin: 0 0 0 10px;
  min-height: 42px;
  padding: 0 2px;
  white-space: nowrap;
}

.ai-overview-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.ai-agent-landing .ai-overview-plan-row {
  background: #ffffff;
  border: 1px solid #d8e3f2;
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(16, 24, 40, .04);
}

.ai-agent-landing .ai-overview-plan-row strong,
.ai-agent-current-card h3,
.ai-agent-new-card h3 {
  color: var(--ink, #101828);
}

.ai-agent-landing .ai-overview-plan-row span,
.ai-agent-current-head p,
.ai-agent-current-stats small,
.ai-agent-current-stats em,
.ai-agent-new-card p,
.ai-overview-next-steps small {
  color: var(--muted, #667085);
}

.ai-agent-landing .ai-agent-overview-grid {
  gap: 22px;
  grid-template-columns: minmax(0, 1fr);
}

.ai-agent-landing .ai-agent-current-card,
.ai-agent-landing .ai-overview-new-card {
  background: #ffffff;
  border: 1px solid #d8e3f2;
  border-radius: 18px;
  box-shadow: 0 20px 48px rgba(16, 24, 40, .07);
}

.ai-agent-landing .ai-agent-current-card {
  gap: 20px;
  padding: 28px;
}

.ai-agent-landing .ai-agent-new-icon {
  background: #eaf1ff;
  color: #2f55d4;
}

.ai-agent-landing .ai-overview-status-note {
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.ai-agent-landing .ai-agent-current-stats span {
  background: #f6f9fe;
  border: 1px solid #d8e3f2;
  border-radius: 14px;
  padding: 14px;
}

.ai-agent-landing .ai-agent-current-stats strong {
  color: var(--ink, #101828);
  font-size: 1.15rem;
}

.ai-agent-landing .ai-agent-current-stats em {
  font-size: .84rem;
  font-style: normal;
  line-height: 1.35;
}

.ai-overview-next-steps {
  background: #f8fbff;
  border: 1px solid #d8e3f2;
  border-radius: 16px;
  display: grid;
  gap: 12px;
  padding: 16px;
}

.ai-production-readiness {
  border-radius: 18px;
  display: grid;
  gap: 14px;
  padding: 18px;
}

.ai-production-readiness.pending {
  background: #fff8ed;
  border: 1px solid #fed7aa;
}

.ai-production-readiness.ready {
  background: #ecfdf5;
  border: 1px solid #86efac;
}

.ai-production-readiness-head {
  align-items: center;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.ai-production-readiness-head h4 {
  color: var(--ink, #101828);
  font-size: 1.18rem;
  margin: 4px 0 4px;
}

.ai-production-readiness-head p {
  color: var(--muted, #667085);
  line-height: 1.45;
  margin: 0;
}

.ai-production-action {
  align-items: flex-end;
  display: grid;
  gap: 6px;
  justify-items: end;
}

.ai-production-action small {
  color: #047857;
  font-size: .82rem;
  font-weight: 700;
}

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

.ai-production-checklist article {
  align-items: flex-start;
  background: #ffffff;
  border: 1px solid #d8e3f2;
  border-radius: 14px;
  display: grid;
  gap: 8px;
  grid-template-columns: auto minmax(0, 1fr);
  min-height: 132px;
  padding: 12px;
}

.ai-production-checklist article.ok {
  border-color: #bbf7d0;
}

.ai-production-checklist article.todo {
  border-color: #fdba74;
}

.ai-production-checklist article.ok svg {
  color: #16a34a;
}

.ai-production-checklist article.todo svg {
  color: #d97706;
}

.ai-production-checklist strong {
  color: var(--ink, #101828);
  display: block;
  font-size: .95rem;
}

.ai-production-checklist span {
  color: var(--muted, #667085);
  display: block;
  font-size: .86rem;
  line-height: 1.35;
  margin-top: 3px;
}

.ai-production-checklist button {
  background: #f6f9fe;
  border: 1px solid #bfd0e4;
  border-radius: 10px;
  color: #1f3fa8;
  font-weight: 750;
  grid-column: 1 / -1;
  min-height: 34px;
  padding: 0 10px;
}

.ai-overview-next-steps > strong {
  color: var(--ink, #101828);
}

.ai-overview-next-steps > div {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ai-overview-next-steps button {
  align-items: flex-start;
  background: #ffffff;
  border: 1px solid #bfd0e4;
  border-radius: 14px;
  color: var(--ink, #101828);
  display: grid;
  gap: 4px;
  grid-template-columns: auto minmax(0, 1fr);
  min-height: 76px;
  padding: 12px;
  text-align: left;
}

.ai-overview-next-steps button svg {
  color: #2f55d4;
  grid-row: span 2;
  margin-top: 2px;
}

.ai-overview-next-steps button span {
  font-weight: 750;
}

.ai-overview-new-card {
  align-content: center;
  min-height: 360px;
}

.ai-overview-mini-list {
  display: grid;
  gap: 8px;
  margin: 0 0 18px;
  width: min(100%, 260px);
}

.ai-overview-mini-list span {
  background: #f6f9fe;
  border: 1px solid #d8e3f2;
  border-radius: 999px;
  color: var(--ink, #101828);
  font-size: .9rem;
  padding: 8px 12px;
}

@media (max-width: 1100px) {
  .ai-agent-landing .ai-overview-hero,
  .ai-agent-landing .ai-agent-overview-grid,
  .ai-production-readiness-head,
  .ai-overview-next-steps > div {
    grid-template-columns: 1fr;
  }

  .ai-overview-hero-actions {
    justify-content: flex-start;
  }

  .ai-agent-hero-actions {
    justify-content: flex-start;
  }

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

@media (max-width: 720px) {
  .ai-production-checklist {
    grid-template-columns: 1fr;
  }
}
