:root {
  --primary: #3b82f6;
  --secondary: #60a5fa;
  --text: #0b1220;
  --muted: #475569;
  --bg: #edf5ff;
  --card: #ffffff;
}

  * {
    box-sizing: border-box;
  }

  html,
  body {
    margin: 0;
    padding: 0;
  }

  body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text);
    background: #edf5ff;
    line-height: 1.45;
  }

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

  .dashboard .sidebar {
    background: linear-gradient(180deg, #1e3a8a 0%, #1d4ed8 100%);
    color: #dbeafe;
    padding: 14px 12px;
    border-right: 1px solid #2563eb;
    box-shadow: 10px 0 24px rgba(30, 58, 138, 0.25);
  }

  .dashboard .logo {
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .dashboard .menu-icon {
    width: 22px;
    height: 22px;
    border-radius: 8px;
    display: inline-grid;
    place-items: center;
    background: rgba(219, 234, 254, 0.22);
    color: #eff6ff;
    font-size: 11px;
  }

  .dashboard .nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border-radius: 10px;
    color: #dbeafe;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
  }

  .dashboard .nav-link:hover,
  .dashboard .nav-link.active {
    background: linear-gradient(90deg, rgba(147, 197, 253, 0.3), rgba(191, 219, 254, 0.2));
    box-shadow: inset 0 0 0 1px rgba(191, 219, 254, 0.55);
    color: #ffffff;
  }

  .dashboard .nav-sublink {
    padding-left: 18px;
    font-size: 14px;
    color: #bfdbfe;
  }

  .dashboard #aiAgentSubmenu {
    margin: 4px 0 8px 12px;
    padding-left: 10px;
    border-left: 1px solid rgba(148, 163, 184, 0.35);
    display: grid;
    gap: 4px;
  }

  .dashboard #aiAgentSubmenu .nav-link {
    padding: 8px 10px;
    border-radius: 9px;
  }

  .dashboard #aiAgentSubmenu .nav-sublink {
    padding-left: 10px;
    font-size: 13px;
  }

  .dashboard #aiAgentSubmenu .menu-icon {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    font-size: 10px;
  }

  .dashboard .has-submenu {
    background: transparent;
  }

  .dashboard .has-submenu.submenu-open {
    background: linear-gradient(90deg, rgba(147, 197, 253, 0.22), rgba(96, 165, 250, 0.2));
    box-shadow: inset 0 0 0 1px rgba(191, 219, 254, 0.4);
  }

  .dashboard #aiAgentSubmenu .nav-link:hover,
  .dashboard #aiAgentSubmenu .nav-link.active {
    background: linear-gradient(90deg, rgba(147, 197, 253, 0.3), rgba(191, 219, 254, 0.22));
    box-shadow: inset 0 0 0 1px rgba(191, 219, 254, 0.45);
    color: #ffffff;
  }

  .dashboard .submenu-arrow {
    margin-left: auto;
    font-size: 11px;
    opacity: 0.9;
    transition: transform 0.2s ease;
  }

  .dashboard .has-submenu.submenu-open .submenu-arrow {
    transform: rotate(180deg);
  }

  .dashboard .main {
    padding: 14px;
    background: transparent;
  }

  .dashboard .card,
  .main .card,
  .auth-card {
    background: var(--card);
    border: 1px solid #d5e3dd;
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  }

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

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

  input,
  select,
  textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #ffffff;
    color: var(--text);
    padding: 10px;
  }

  button {
    cursor: pointer;
  }

  .btn,
  a.btn,
  button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    border: 1px solid #1e40af;
    background: linear-gradient(135deg, #0ea5e9, #2563eb);
    color: #ffffff;
    border-radius: 10px;
    padding: 9px 12px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    line-height: 1;
    box-shadow: 0 8px 16px rgba(59, 130, 246, 0.28);
    transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease, border-color 0.16s ease, background 0.16s ease;
  }

  .btn:hover,
  a.btn:hover,
  button.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(59, 130, 246, 0.34);
    filter: saturate(1.08);
  }

  .btn:active,
  a.btn:active,
  button.btn:active {
    transform: translateY(0);
    box-shadow: none;
  }

  .btn:focus-visible,
  a.btn:focus-visible,
  button.btn:focus-visible {
    outline: 2px solid rgba(14, 165, 233, 0.28);
    outline-offset: 2px;
  }

  .btn.secondary {
    border-color: #60a5fa;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: #0f172a;
    box-shadow: 0 8px 16px rgba(59, 130, 246, 0.18);
  }

  .btn[disabled],
  button.btn:disabled,
  a.btn[aria-disabled="true"] {
    opacity: 0.86;
    color: inherit;
    pointer-events: none;
    box-shadow: none;
    transform: none;
  }

.action-icon {
  display: inline-block;
  margin-right: 6px;
  line-height: 1;
  font-size: 0.95em;
  vertical-align: -0.02em;
}

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

.dashboard-premium-grid {
  display: grid;
  gap: 12px;
}

.dashboard-row {
  display: grid;
  gap: 12px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
}

.dashboard .top-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.auth-card {
  width: min(460px, 94vw);
  margin: 40px auto;
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
  background: linear-gradient(180deg, #eef5ff 0%, #e7f1ff 100%);
}

.top-nav {
  background: rgba(239, 246, 255, 0.95);
  border-bottom: 1px solid #bfdbfe;
  box-shadow: 0 6px 14px rgba(30, 64, 175, 0.08);
}

.footer {
  background: linear-gradient(160deg, #dbeafe, #e0ecff 58%, #eff6ff 100%);
  color: #1e3a8a;
}

.dashboard .top-links {
  margin-bottom: 12px;
  align-items: center;
  padding: 10px 12px;
    border: 1px solid #bfdbfe;
    background: linear-gradient(120deg, #ffffff, #dbeafe 52%, #edf5ff);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.dashboard .top-links-intro {
  display: grid;
  gap: 2px;
}

.dashboard #topHeaderTitle {
  color: #0f172a;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.dashboard .top-links-kicker {
  margin: 0;
  color: #0369a1;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.dashboard .top-links-intro strong {
  color: #0f172a;
  font-size: 15px;
}

.dashboard .profile-dropdown {
  position: relative;
  margin-left: auto;
}

.dashboard .profile-toggle {
  border: 1px solid #cde3d8;
  background: linear-gradient(180deg, #ffffff, #eef9f2);
  color: #0f172a;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
  box-shadow: 0 7px 18px rgba(15, 23, 42, 0.1);
}

.dashboard .profile-toggle:hover {
  border-color: #93c5fd;
}

.dashboard .profile-meta {
  display: grid;
  text-align: left;
  line-height: 1.1;
  gap: 2px;
}

.dashboard .profile-greeting {
  color: #64748b;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.dashboard .profile-caret {
  margin-left: auto;
  color: #0369a1;
  font-size: 11px;
}

.dashboard .profile-image {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  object-fit: cover;
  border: 2px solid #bae6fd;
}

.dashboard .profile-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 250px;
  border: 1px solid #cfe3da;
  background: linear-gradient(180deg, #ffffff, #f4fbf7);
  box-shadow: 0 20px 32px rgba(15, 23, 42, 0.16);
  padding: 10px;
  display: grid;
  gap: 6px;
  z-index: 40;
}

.dashboard .profile-menu .nav-link,
.dashboard .top-nav-action {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: #0f172a;
  border: 1px solid #93c5fd;
  padding: 9px 11px;
  text-align: left;
  font-size: 13px;
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.1);
}

.dashboard .profile-menu .nav-link:hover,
.dashboard .top-nav-action:hover {
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  color: #0f172a;
  border-color: #60a5fa;
}

.dashboard .top-nav-action {
  display: block;
  text-decoration: none;
}

.dashboard .top-nav-action.danger {
  border-color: #60a5fa;
  color: #1e3a8a;
  background: #eff6ff;
}

#createAgentModal {
  width: 100%;
}

#createAgentModal.inline-mode {
  position: static;
  inset: auto;
  background: transparent;
  display: block;
  place-items: normal;
  padding: 0;
  z-index: auto;
  border: 0;
}

#createAgentModal.inline-mode > * {
  width: 100%;
  max-width: none;
}

#createAgentModal.inline-mode #cancelCreateAgentModalBtn {
  display: none;
}

#createAgentModal.inline-mode .modal-head {
  font-size: 15px;
}

#integrationModal .modal-card {
  background:
    radial-gradient(circle at 12% 16%, rgba(14, 165, 233, 0.14), transparent 42%),
    radial-gradient(circle at 88% 84%, rgba(14, 165, 233, 0.12), transparent 40%),
    linear-gradient(165deg, #f7fbff 0%, #eef6ff 55%, #ecfdf5 100%);
  border: 1px solid #d6e4f4;
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.18);
}

#integrationModal .modal-head {
  margin: -14px -14px 12px;
  padding: 12px 14px;
  border-bottom: 1px solid #d6e4f4;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.9), rgba(240, 249, 255, 0.95));
}

body[data-page-title="Integrations"] #integrationModal.integration-editor {
  display: block;
  margin: 18px auto 0;
  width: 100%;
  max-width: 1100px;
  padding: 0;
  border: 1px solid #cedcec;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

body[data-page-title="Integrations"] #integrationModal .integration-editor-card {
  padding: 16px;
  background:
    radial-gradient(circle at 12% 16%, rgba(14, 165, 233, 0.1), transparent 42%),
    radial-gradient(circle at 88% 84%, rgba(14, 165, 233, 0.08), transparent 40%),
    linear-gradient(165deg, #f7fbff 0%, #eef6ff 55%, #ecfdf5 100%);
}

body[data-page-title="Integrations"] #integrationModal .integration-editor-head {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -16px -16px 14px;
  padding: 12px 16px;
  border-bottom: 1px solid #d6e4f4;
  background: rgba(248, 252, 255, 0.94);
  backdrop-filter: blur(6px);
}

body[data-page-title="Integrations"] #integrationModal .integration-editor-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  column-gap: 14px;
  row-gap: 14px;
  align-items: start;
}

body[data-page-title="Integrations"] #integrationModal .integration-editor-form > * {
  grid-column: auto;
}

body[data-page-title="Integrations"] #integrationModal .integration-editor-form .full {
  grid-column: 1 / -1;
}

body[data-page-title="Integrations"] #integrationModal .integration-editor-form label {
  background: #ffffff;
  border: 1px solid #d9e5f2;
  border-radius: 10px;
  padding: 10px;
}

body[data-page-title="Integrations"] #integrationModal .integration-visitor-fields,
body[data-page-title="Integrations"] #integrationModal .integration-smtp-settings {
  border: 1px solid #d9e5f2;
  border-radius: 10px;
  background: #ffffff;
  padding: 12px;
}

body[data-page-title="Integrations"] #integrationModal .integration-preview-box {
  grid-column: 1 / -1;
  border: 1px solid #d9e5f2;
  border-radius: 10px;
  background: #ffffff;
  padding: 12px;
  position: static;
  align-self: start;
}

body[data-page-title="Integrations"] #integrationModal .integration-snippet-box {
  grid-column: 1 / -1;
  border: 1px solid #d9e5f2;
  border-radius: 10px;
  background: #ffffff;
}

body[data-page-title="Integrations"] #integrationModal .integration-editor-actions {
  grid-column: 1 / -1;
  position: sticky;
  bottom: 0;
  z-index: 7;
  padding-top: 12px;
  padding-bottom: 12px;
  border-top: 1px solid #d8e4f1;
  background: linear-gradient(180deg, rgba(247, 251, 255, 0.06) 0%, rgba(247, 251, 255, 0.96) 28%, rgba(247, 251, 255, 1) 100%);
}

body[data-page-title="Integrations"] #integrationModal .integration-snippet-box pre {
  max-height: 240px;
  overflow: auto;
}

@media (max-width: 1024px) {
  body[data-page-title="Integrations"] #integrationModal .integration-editor-form {
    grid-template-columns: 1fr;
  }

  body[data-page-title="Integrations"] #integrationModal .integration-editor-form > * {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  body[data-page-title="Integrations"] #integrationModal .integration-preview-box,
  body[data-page-title="Integrations"] #integrationModal .integration-snippet-box {
    position: static;
  }

  body[data-page-title="Integrations"] #integrationModal .integration-editor-head {
    margin: -16px -16px 12px;
  }
}

body[data-page-title="Workflows"] .main {
  padding-bottom: 12px;
}

body[data-page-title="Workflows"] #moduleSection {
  min-height: auto;
}

body[data-page-title="Subscriptions"] .main {
  padding-bottom: 16px;
}

body[data-page-title="Subscriptions"] #moduleSection {
  max-width: 1180px;
  margin: 16px auto 0;
  padding: 18px;
  border-radius: 14px;
}

body[data-page-title="Subscriptions"] #moduleForm {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

body[data-page-title="Subscriptions"] #moduleForm label {
  border: 1px solid #d7e3ef;
  border-radius: 10px;
  background: #ffffff;
  padding: 10px;
}

body[data-page-title="Subscriptions"] #moduleForm .full {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
  padding-top: 2px;
}

body[data-page-title="Subscriptions"] #moduleTable {
  background: #ffffff;
  border: 1px solid #d7e3ef;
  border-radius: 12px;
  overflow: hidden;
}

body[data-page-title="Subscriptions"] #moduleTable th {
  background: #f2f8ff;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 12px;
  font-weight: 700;
}

body[data-page-title="Subscriptions"] #moduleTable th,
body[data-page-title="Subscriptions"] #moduleTable td {
  padding: 12px 10px;
  border-bottom: 1px solid #e4edf6;
}

body[data-page-title="Subscriptions"] #moduleTable td {
  color: #0f172a;
  vertical-align: middle;
}

body[data-page-title="Subscriptions"] #modulePagination {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid #e2eaf3;
}

@media (max-width: 1080px) {
  body[data-page-title="Subscriptions"] #moduleForm {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 640px) {
  body[data-page-title="Subscriptions"] #moduleSection {
    margin-top: 10px;
    padding: 12px;
  }

  body[data-page-title="Subscriptions"] #moduleForm {
    grid-template-columns: 1fr;
  }

  body[data-page-title="Subscriptions"] #moduleForm .full {
    justify-content: stretch;
    flex-direction: column;
    align-items: stretch;
  }
}

#integrationForm {
  border: 1px solid #dbe7f3;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 250, 255, 0.96));
  padding: 12px;
}

.create-agent-info-box {
  display: grid;
  gap: 6px;
  color: #64748b;
  padding: 0;
}

.create-agent-info-box strong {
  color: #0f172a;
  font-size: 15px;
}

.create-agent-info-box span {
  font-size: 13px;
  line-height: 1.5;
}

.create-agent-channel-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
}

.create-agent-guide-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(260px, 1fr);
  gap: 16px;
  align-items: start;
}

.channel-pill {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #eff6ff;
  font-size: 12px;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.channel-pill.accent {
  background: #38bdf8;
  border-color: #38bdf8;
  color: #082032;
}

.agent-guide-accordion {
  margin-top: 0;
  border: 1px solid #d6e2ef;
  border-radius: 16px;
  background: #ffffff;
  padding: 14px 16px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.agent-guide-accordion.compact {
  margin-top: 12px;
}

.agent-guide-accordion summary {
  cursor: pointer;
  font-weight: 600;
  color: #0f172a;
  list-style: none;
  padding: 6px 0;
}

.agent-guide-accordion summary::-webkit-details-marker {
  display: none;
}

.create-agent-guide-points {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  color: #334155;
  font-size: 13px;
}

.guide-step {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid #dbe6f2;
  border-radius: 14px;
  background: #f8fbff;
}

.guide-step:first-child {
  border-top: 1px solid #d6e2ef;
  padding-top: 12px;
}

.guide-step-index {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #38bdf8;
  color: #082032;
  font-weight: 800;
}

.create-agent-help-row {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.hint-pill {
  display: grid;
  gap: 4px;
  border: 1px solid #dbe6f2;
  background: #f8fbff;
  color: #475569;
  border-radius: 14px;
  padding: 12px;
  font-size: 12px;
}

.hint-pill strong {
  color: #0f172a;
  font-size: 13px;
}

.hint-pill span {
  line-height: 1.45;
}

.create-agent-guide-art {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
  align-content: start;
}

.guide-side-card {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid #d6e2ef;
  color: #475569;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.guide-side-card strong {
  color: #0f172a;
  font-size: 15px;
}

.guide-side-card span {
  font-size: 13px;
  line-height: 1.5;
}

.guide-side-card.primary {
  background: linear-gradient(135deg, #ecfeff, #f0fdf4);
  border-color: #bae6fd;
}

.create-agent-form {
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 12px;
}

.form-error-banner {
  grid-column: 1 / -1;
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #fca5a5;
  border-left: 5px solid #dc2626;
  background: linear-gradient(180deg, #fff5f5 0%, #ffe4e6 100%);
  color: #7f1d1d;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 20px rgba(127, 29, 29, 0.16);
}

.form-error-banner .error-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.form-error-banner .error-message {
  font-size: 14px;
  font-weight: 700;
}

.form-error-banner.is-visible {
  animation: createAgentErrorReveal 220ms ease-out;
}

.create-agent-form input.field-error,
.create-agent-form select.field-error,
.create-agent-form textarea.field-error {
  border-color: #dc2626;
  background: #fff7f7;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2);
}

.create-agent-form .field-error-note {
  margin: 6px 0 0;
  color: #991b1b;
  font-size: 12px;
  font-weight: 600;
}

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

.create-agent-how {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #f8fbff;
}

.create-agent-how h3 {
  margin: 0 0 10px;
  font-size: 18px;
  color: #0f172a;
}

.create-agent-how-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.create-agent-how-list li {
  color: #475569;
  font-size: 13px;
  line-height: 1.5;
}

.conversation-panel.create-agent-mode {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
}

.kpi-card {
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
  justify-content: center;
  padding: 10px 12px;

  background: #ffffff;
  border: 1px solid #d6e2ef;
  color: #1e293b;
  font-size: 13px;
}
.kpi-card h3 {
  margin: 10px 0 6px;
  font-size: 28px;
  color: #0f172a;
}

.kpi-delta.positive {
  color: #93c5fd;
}

.preview-mode-badge {
  color: #92400e;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(234, 179, 8, 0.2);
  border: 1px solid rgba(234, 179, 8, 0.45);
  padding: 4px 8px;
  border-radius: 999px;
}

body.preview-mode .top-links {
  background: linear-gradient(90deg, rgba(234, 179, 8, 0.12), rgba(245, 158, 11, 0.06));
  border: 1px solid rgba(234, 179, 8, 0.28);
  border-radius: 10px;
  padding: 8px 10px;
}

body.preview-mode #topHeaderTitle {
  color: #92400e;
}

.panel {
  border-radius: 16px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

.panel canvas {
  width: 100% !important;
  height: 240px !important;
  display: block;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.panel-header h3 {
  margin: 0;
}

.panel-sub {
  color: var(--muted);
  font-size: 12px;
}

.charts-2,
.split-activity {
  grid-template-columns: 1fr 1fr;
}

.table-tools {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 10px;
  margin-bottom: 10px;
}

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

.agent-history-shell {
  border: 1px solid #d4e2ef;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  display: grid;
  gap: 12px;
}

.agent-history-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(220px, 1fr);
  gap: 12px;
  border: 1px solid #d6e2ef;
  background: linear-gradient(135deg, #eff6ff, #dbeafe 45%, #eef2ff);
  padding: 14px;
}

.agent-history-kicker {
  margin: 0;
  color: #0369a1;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.agent-history-hero-copy h4 {
  margin: 6px 0;
  color: #0f172a;
  font-size: 22px;
  line-height: 1.2;
}

.agent-history-hero-copy p {
  margin: 0;
  color: #334155;
  font-size: 13px;
}

.agent-history-hero-bars {
  align-self: stretch;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  align-items: end;
}

.agent-history-hero-bars span {
  display: block;
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: linear-gradient(180deg, rgba(14, 165, 233, 0.25), rgba(37, 99, 235, 0.25));
  animation: heroBarsPulse 3.4s ease-in-out infinite;
}

.agent-history-hero-bars span:nth-child(1) { height: 34px; animation-delay: 0.1s; }
.agent-history-hero-bars span:nth-child(2) { height: 56px; animation-delay: 0.3s; }
.agent-history-hero-bars span:nth-child(3) { height: 42px; animation-delay: 0.5s; }
.agent-history-hero-bars span:nth-child(4) { height: 72px; animation-delay: 0.7s; }

.agent-history-content {
  border: 1px solid #dbe7f3;
  background: #ffffff;
  padding: 12px;
}

.agent-history-kpis article {
  border: 1px solid #d6e2ef;
  background: linear-gradient(160deg, #ffffff, #f5faff);
  padding: 10px 12px;
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.04);
}

.agent-history-kpis p {
  margin: 0;
  color: #64748b;
  font-size: 12px;
}

.agent-history-kpis h4 {
  margin: 6px 0 0;
  color: #0f172a;
  font-size: 22px;
}

.agent-history-tools {
  grid-template-columns: minmax(280px, 2.2fr) repeat(4, minmax(150px, 1fr));
  align-items: center;
  margin-bottom: 12px;
}

.agent-history-tools input,
.agent-history-tools select {
  border-color: #cfe0f0;
  background: #fbfdff;
}

.agent-history-tools input:focus,
.agent-history-tools select:focus {
  outline: 2px solid rgba(14, 165, 233, 0.2);
  outline-offset: 0;
  border-color: #7dd3fc;
}

.agent-history-table-wrap {
  border: 1px solid #dbe6f2;
  background: #ffffff;
  overflow: auto;
}

.agent-history-table th {
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.agent-history-table td {
  vertical-align: top;
  font-size: 13px;
}

.agent-history-table tbody tr:nth-child(even) {
  background: #fbfdff;
}

.agent-history-table tbody tr:hover {
  background: #f0f9ff;
}

.history-conv-id {
  display: inline-block;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: 0.2px;
}

.history-channel-chip {
  display: inline-block;
  border: 1px solid #dbe6f2;
  background: #f8fbff;
  color: #334155;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 600;
}

.agent-history-session-card {
  width: min(1040px, 97vw);
  max-height: 92vh;
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  grid-template-rows: auto auto minmax(360px, 1fr) auto auto;
  gap: 10px;
  border: 1px solid #d7e0ec;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.agent-history-session-messages {
  border: 1px solid #e2e8f0;
  background: #ffffff;
  padding: 10px;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 400px;
  min-height: 320px;
  display: block;
  font-size: 13px;
}

.agent-history-session-empty {
  margin: 0;
  color: #64748b;
  font-size: 13px;
}

.agent-history-session-row {
  border: 1px solid #e2e8f0;
  background: #ffffff;
.auth-page {
  min-height: calc(100vh - 140px);
  display: grid;
  place-items: center;
  padding: 24px 0;
}

.auth-page .auth-wrap {
  min-height: auto;
  padding: 0 14px;
}
.checkout-page {
  min-height: calc(100vh - 140px);
  display: grid;
  place-items: center;
  padding: 24px 0;
}
  padding: 10px;
  display: grid;
  gap: 6px;
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.03);
}

.agent-history-session-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.agent-history-session-row-head strong {
  color: #0f172a;
  font-size: 12px;
}

.agent-history-session-row-head span {
  color: #64748b;
  font-size: 11px;
}

.agent-history-session-row p {
  margin: 0;
  color: #0f172a;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.agent-history-session-lines {
  display: grid;
  gap: 6px;
}

.agent-history-session-line {
  margin: 0;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid #dce8f6;
  background: #f8fbff;
  color: #0f172a;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.agent-history-session-row.CUSTOMER {
  border-left: 4px solid #2563eb;
}

.agent-history-session-row.AI {
  border-left: 4px solid #0ea5e9;
}

.agent-history-session-row.AGENT {
  border-left: 4px solid #2563eb;
}

.agent-history-session-row.SYSTEM {
  border-left: 4px solid #64748b;
}

.agent-history-email-compose {
  margin-top: 10px;
  border: 1px solid #d9e5f3;
  border-radius: 10px;
  background: #f8fbff;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.agent-history-email-compose h4 {
  margin: 0;
  color: #1e293b;
  font-size: 13px;
}

.agent-history-email-grid {
  display: grid;
  gap: 8px;
}

.agent-history-email-grid input,
.agent-history-email-grid textarea {
  width: 100%;
  border: 1px solid #c8d8ea;
  border-radius: 8px;
  padding: 9px 10px;
  font: inherit;
  color: #0f172a;
  background: #ffffff;
}

.agent-history-email-status {
  margin: 0;
  min-height: 18px;
  font-size: 12px;
  color: #475569;
}

.agent-history-email-status.error {
  color: #b91c1c;
  font-weight: 600;
}

.agent-history-email-status.success {
  color: #166534;
  font-weight: 600;
}

.agent-history-email-actions {
  display: flex;
  justify-content: flex-end;
}

@keyframes heroBarsPulse {
  0%,
  100% { transform: translateY(0); opacity: 0.85; }
  50% { transform: translateY(-4px); opacity: 1; }
}

.activity-feed {
  max-height: 300px;
  overflow: auto;
  display: grid;
  gap: 8px;
}

.activity-item {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
  background: #ffffff;
}

.activity-item p {
  margin: 0;
}

.activity-time {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.status-pill {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  display: inline-block;
}

.status-pill.OPEN,
.status-pill.ACTIVE,
.status-pill.CONFIRMED {
  background: rgba(16, 185, 129, 0.2);
  color: #93c5fd;
}

.status-pill.PENDING,
.status-pill.WAITING {
  background: rgba(234, 179, 8, 0.2);
  color: #fde68a;
}

.status-pill.RESOLVED,
.status-pill.CANCELLED {
  background: rgba(239, 68, 68, 0.18);
  color: #fecaca;
}

.automation-panel h4 {
  margin: 6px 0 0;
  font-size: 26px;
}

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

.automation-grid div {
  border: 1px solid rgba(55, 65, 81, 0.7);
  border-radius: 12px;
  padding: 12px;
  background: #eff6ff;
}

.automation-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

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

.table th,
.table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 10px;
  text-align: left;
}

.table-actions {
  display: flex;
  gap: 8px;
}

.btn-sm {
  padding: 7px 12px;
  min-height: 34px;
  border-radius: 8px;
  border: 1px solid #60a5fa;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: #0f172a;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 6px 12px rgba(59, 130, 246, 0.14);
}

.btn-sm.danger {
  border-color: #ef4444;
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  color: #7f1d1d;
  box-shadow: 0 6px 12px rgba(239, 68, 68, 0.2);
}

.table-pagination {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.table-pagination select {
  width: auto;
}

.hidden {
  display: none !important;
}

.module-form {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  margin-bottom: 12px;
}

.module-form .full {
  grid-column: 1 / -1;
}

.integrations-grid {
  display: block;
  width: 100%;
}

.integration-card {
  border: 1px solid #d6e2ef;
  background: linear-gradient(160deg, #ffffff, #f7fbff);
  padding: 12px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.integration-card h4 {
  margin: 0 0 4px;
  color: #0f172a;
}

.integration-card p {
  margin: 0;
  color: #64748b;
  font-size: 13px;
}

.integration-meta {
  margin-top: 8px;
  display: grid;
  gap: 5px;
  font-size: 12px;
  color: #334155;
}

.integration-key-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 8px;
  align-items: center;
}

.integration-snippet-box {
  border: 1px solid #d6e2ef;
  background: #f8fbff;
  padding: 10px;
}

.integration-snippet-box pre {
  margin: 0;
  max-height: none;
  overflow: visible;
  background: #0f172a;
  color: #e2e8f0;
  padding: 8px;
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  direction: ltr;
}

.integration-actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.integrations-table-wrap {
  border: 1px solid #dbe6f2;
  background: #ffffff;
  overflow-x: auto;
  overflow-y: visible;
  width: 100%;
}

.integrations-table {
  width: 100%;
  min-width: 0;
  table-layout: auto;
}

.integrations-table th {
  background: #f1f7ff;
  color: #334155;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid #bfd1e6;
  font-weight: 800;
}

.integrations-table td {
  vertical-align: top;
  border-right: 1px solid #dfe8f2;
  border-top: 1px solid #e6edf5;
}

.integrations-table th:last-child,
.integrations-table td:last-child {
  border-right: none;
}

.integrations-table th:nth-child(1),
.integrations-table td:nth-child(1) {
  width: 24%;
}

.integrations-table th:nth-child(2),
.integrations-table td:nth-child(2) {
  width: 10%;
}

.integrations-table th:nth-child(3),
.integrations-table td:nth-child(3) {
  width: 16%;
}

.integrations-table th:nth-child(4),
.integrations-table td:nth-child(4) {
  width: 38%;
}

.integrations-table th:nth-child(5),
.integrations-table td:nth-child(5) {
  width: 12%;
}

.integrations-table th,
.integrations-table td {
  white-space: normal;
  word-break: break-word;
}

.integrations-table td:first-child {
  white-space: normal;
  min-width: 0;
}

.integration-primary {
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
}

.integration-secondary {
  margin-top: 2px;
  font-size: 12px;
  color: #64748b;
  line-height: 1.3;
}

.integrations-table tbody tr:hover {
  background: #f8fbff;
}

.integration-key-cell {
  font-family: Consolas, 'Courier New', monospace;
  font-size: 12px;
  color: #0f172a;
  display: inline-block;
  max-width: 100%;
  padding: 5px 8px;
  border: 1px solid #dbe6f2;
  background: #f8fbff;
  overflow-wrap: anywhere;
}

.integration-key-stack {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  width: 100%;
}

.integration-inline-actions {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  margin-left: auto;
}

.btn-sm.icon {
  min-width: 34px;
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-size: 15px;
  line-height: 1;
}

.integration-snippet-cell {
  display: block;
  min-width: 0;
}

.integration-snippet-codebox {
  position: relative;
  background: #0f172a;
  border: 1px solid #1e293b;
  padding-top: 28px;
}

.integration-snippet-cell pre {
  margin: 0;
  max-height: none;
  overflow: visible;
  background: transparent;
  color: #e2e8f0;
  padding: 6px 8px;
  font-size: 11px;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  align-self: start;
  place-self: start stretch;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  direction: ltr;
}

.integration-snippet-copy-btn {
  position: absolute;
  top: 6px;
  right: 6px;
}

.integration-status {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.integration-status.active {
  background: #dcfce7;
  color: #1d4ed8;
  border: 1px solid #93c5fd;
}

.integration-status.inactive {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.integration-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.split.two-col {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(340px, 1fr);
  gap: 14px;
}

.modal-card-xl {
  max-width: 1120px;
  width: min(1120px, calc(100vw - 48px));
}

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

.top-nav-module {
  display: block;
}

.conversation-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 12px;
  align-items: start;
  max-width: 100%;
}

.conversation-help-strip {
  grid-column: 1 / -1;
  border: 1px solid rgba(59, 130, 246, 0.32);
  background: linear-gradient(90deg, #eff6ff, #ffffff);
}

.conversation-help-strip h3 {
  color: #1d4ed8;
  margin: 0 0 6px;
}

.conversation-help-strip p {
  margin: 4px 0;
  color: #64748b;
}

.conversation-help-strip .meta-note {
  color: #1d4ed8;
  font-size: 13px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.section-head h3 {
  margin: 0;
}

.section-desc {
  margin: 6px 0 4px;
  color: #64748b;
  font-size: 13px;
}

.section-example {
  margin: 0 0 10px;
  color: #2563eb;
  font-size: 12px;
}

.manage-agents-hero {
  border: 1px solid #cfd8e3;
  background: linear-gradient(130deg, #fff7e6 0%, #eef6ff 52%, #effcf5 100%);
  padding: 14px;
  display: grid;
  grid-template-columns: 1.2fr 240px;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.manage-agents-kicker {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #9a3412;
  font-weight: 700;
}

.manage-agents-hero-copy h4 {
  margin: 0 0 6px;
  color: #0f172a;
  font-size: 22px;
}

.manage-agents-hero-copy p {
  margin: 0;
  color: #1f2937;
}

.manage-agents-hero-art {
  position: relative;
  min-height: 130px;
  display: grid;
  place-items: center;
}

.manage-agents-hero-art svg {
  width: 108px;
  height: 108px;
  z-index: 2;
  animation: heroFloat 3.2s ease-in-out infinite;
}

.hero-orb {
  position: absolute;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.38);
  animation: heroPulse 2.6s ease-in-out infinite;
}

.hero-orb.orb-a {
  width: 88px;
  height: 88px;
  top: 14px;
  left: 34px;
}

.hero-orb.orb-b {
  width: 54px;
  height: 54px;
  right: 28px;
  bottom: 12px;
  animation-delay: 0.6s;
}

@keyframes heroFloat {
  0%,
  100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes heroPulse {
  0%,
  100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.08); opacity: 1; }
}

.help-dot {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid rgba(59, 130, 246, 0.4);
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  color: #1d4ed8;
  background: #ecfdf5;
  cursor: help;
}

.conversation-panel > * {
  min-width: 0;
}

.conversation-list {
  min-height: 560px;
  position: sticky;
  top: 16px;
}

.conversation-system-head,
.conversation-modules-tabs,
.conversation-module {
  grid-column: 1 / -1;
}

.conversation-modules-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.module-tab-btn {
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.module-tab-btn.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.14), rgba(37, 99, 235, 0.1));
  border-color: rgba(59, 130, 246, 0.35);
  color: #9a3412;
}

.conversation-workspace-grid {
  display: grid;
  grid-template-columns: 320px 1fr 340px;
  gap: 12px;
  min-width: 0;
}

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

.module-form label {
  display: grid;
  gap: 6px;
}

.module-form label span {
  font-size: 13px;
  color: #0f172a;
  font-weight: 700;
  letter-spacing: 0.015em;
}

.field-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #0f172a;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.field-tip {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: help;
}

.info-inline {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(37, 99, 235, 0.4);
  background: #ecfdf5;
  color: #1d4ed8;
  font-size: 11px;
  line-height: 1;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
  cursor: help;
  position: relative;
  appearance: none;
  padding: 0;
}

.info-inline::after {
  content: attr(data-tip);
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  transform: translateY(4px);
  min-width: 240px;
  max-width: 320px;
  background: #ffffff;
  border: 1px solid rgba(59, 130, 246, 0.32);
  color: #334155;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.info-inline::before {
  content: '';
  position: absolute;
  left: 10px;
  bottom: calc(100% + 4px);
  transform: none;
  border-width: 6px;
  border-style: solid;
  border-color: #ffffff transparent transparent transparent;
  opacity: 0;
  transition: opacity 0.16s ease;
}

.info-inline:hover::after,
.info-inline:focus-visible::after,
.info-inline:hover::before,
.info-inline:focus-visible::before {
  opacity: 1;
}

.info-inline:hover::after,
.info-inline:focus-visible::after {
  transform: translateY(0);
}

.inline-checks {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #eff6ff;
}

.inline-checks label {
  display: inline-flex;
  align-items: center;
  gap: 0;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #ffffff;
}

.inline-checks label span {
  margin-left: 0;
}

.inline-checks.compact {
  margin-top: 0;
  padding: 8px;
  gap: 6px;
}

.marketplace-layout {
  display: grid;
  gap: 8px;
}

.marketplace-options {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 8px;
  padding: 0;
  border: none;
  background: transparent;
}

.marketplace-options label {
  min-height: 44px;
  justify-content: flex-start;
  border: 1px solid #93c5fd;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #eff6ff);
  padding: 8px 10px;
  transition: border-color 0.16s ease, transform 0.16s ease, background 0.16s ease;
  cursor: pointer;
  position: relative;
}

.marketplace-options label:hover {
  border-color: rgba(37, 99, 235, 0.55);
  transform: translateY(-1px);
}

.marketplace-options label input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.marketplace-options label span {
  display: block;
  width: 100%;
  margin-left: 0;
  font-size: 12px;
  color: #334155;
  font-weight: 600;
}

.marketplace-options label input[type="radio"]:checked + span {
  color: #1d4ed8;
}

.marketplace-options label:has(input[type="radio"]:checked) {
  border-color: rgba(59, 130, 246, 0.72);
  background: linear-gradient(180deg, #dbeafe, #eff6ff);
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.18);
}

.inline-checks label input[type="radio"] {
  margin: 0;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 8px;
}

.plain-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #ffffff;
  padding: 9px 10px;
  font-size: 13px;
}

.plain-check input[type="checkbox"] {
  margin: 0;
}

.agent-create-box {
  border: 1px dashed rgba(59, 130, 246, 0.45);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #eff6ff;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 120;
}

.modal-card {
  width: min(1100px, 96vw);
  max-height: none;
  overflow: visible;
}

.modal-head {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(71, 85, 105, 0.6);
  justify-content: flex-end;
}

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

#agentHistorySessionModal {
  z-index: 240;
  padding: 30px;
}

.modal-card.agent-history-session-card {
  width: min(1040px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  margin: 0 auto;
  padding: 14px;
  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  grid-template-rows: auto auto minmax(360px, 1fr) auto auto;
  gap: 10px;
  border: 1px solid #d7e0ec;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.agent-history-session-card .modal-head {
  display: flex;
  margin-bottom: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid #dbe6f2;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.agent-history-session-card .modal-head h3 {
  margin: 0;
  line-height: 1.2;
}

.agent-history-session-card .modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.agent-history-session-card .modal-actions .btn,
.agent-history-session-card .modal-actions .btn.secondary {
  width: auto;
}

.agent-builder-form {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 14px;
}

.builder-topbar,
.builder-progress,
.builder-footer {
  padding: 12px 14px;
}

.builder-topbar {
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #d7e0ec;
  font-size: 18px;
}

.builder-title {
  margin: 0;
  font-size: 32px;
}

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

.builder-progress {
  gap: 8px;
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.builder-steps {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  color: #475569;
  font-size: 14px;
}

.agent-builder-preview {
  border: 1px solid #d7e0ec;
  border-radius: 12px;
  background: #f8faff;
  padding: 16px;
}

.agent-builder-preview h4 {
  margin: 0 0 10px;
}

.agent-builder-avatar {
  width: 74px;
  height: 74px;
  border-radius: 999px;
  margin: 0 auto 10px;
  display: grid;
  place-items: center;
  font-size: 42px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
}

.agent-builder-preview h5,
.agent-builder-preview p {
  margin: 0;
  text-align: center;
}

.agent-builder-preview h5 {
  margin-bottom: 4px;
  font-size: 24px;
}

.agent-builder-preview p {
  color: var(--muted);
}

.agent-builder-meta {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #d7e0ec;
  display: grid;
  gap: 6px;
}

.agent-builder-meta p {
  margin: 0;
  text-align: left;
}

.agent-builder-sections {
  display: grid;
  gap: 10px;
}

.builder-section {
  border: 1px solid #d7e0ec;
  border-radius: 10px;
  background: #f8faff;
}

.builder-section-head {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #d7e0ec;
}

.builder-section-head h4 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.builder-section-body {
  padding: 12px 14px;
  gap: 10px;
}

.builder-section.collapsed .builder-section-head {
  border-bottom: none;
}

.builder-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #d7e0ec;
  padding-top: 10px;
}

.builder-saved {
  color: #0369a1;
  font-weight: 600;
}

.agent-form-section {
  border: 1px solid #d6e2ef;
  border-radius: 16px;
  padding: 18px;
  background: linear-gradient(180deg, #ffffff, #f3f9ff);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.agent-form-section h4 {
  margin: 0 0 10px;
  letter-spacing: 0.01em;
  color: #0f172a;
  font-size: 18px;
  font-weight: 800;
}

.avatar-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  overflow: visible;
}

.avatar-option {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.75);
  display: inline-grid;
  place-items: center;
  background-color: #e2e8f0;
  cursor: pointer;
  padding: 0;
  color: #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
  overflow: hidden;
  position: relative;
}

.avatar-option:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.24);
}

.avatar-option span {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.avatar-option svg,
.agent-avatar svg {
  width: 100%;
  height: 100%;
  display: block;
}

.avatar-upload span {
  position: static;
  width: auto;
  height: auto;
  padding: 0;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
  border: 0;
}

.avatar-option.active {
  outline: 2px solid rgba(37, 99, 235, 0.75);
  outline-offset: 2px;
}

.avatar-upload {
  background: #f8fafc;
  display: inline-grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
  color: #334155;
}

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

.tone-card {
  text-align: left;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
  padding: 10px;
  cursor: pointer;
}

.tone-card p {
  margin: 6px 0 0;
  font-size: 12px;
  color: #64748b;
}

.tone-card.active {
  border-color: rgba(37, 99, 235, 0.7);
  background: rgba(37, 99, 235, 0.1);
}

.starter-messages-grid {
  display: grid;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
}

.form-split-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}

.form-split-knowledge {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.9fr);
  gap: 12px;
}

.knowledge-mode-wrap {
  display: grid;
  gap: 10px;
}

.knowledge-mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px;
  border: 1px solid #d6e2ef;
  border-radius: 12px;
  background: #f8fbff;
}

.knowledge-mode-switch label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid #d7e0ec;
  border-radius: 10px;
  background: #ffffff;
  font-size: 13px;
  color: #334155;
}

.knowledge-mode-switch input[type="radio"] {
  width: auto;
  margin: 0;
}

.knowledge-mode-panel {
  display: grid;
  gap: 8px;
}

.form-detail-card {
  border: 1px solid #d6e2ef;
  border-radius: 14px;
  padding: 16px;
  background: linear-gradient(180deg, #ffffff, #f5faff);
  display: grid;
  gap: 8px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.form-detail-card-compact {
  max-width: 290px;
  justify-self: end;
}

.knowledge-guide-card {
  max-width: none;
  justify-self: stretch;
}

.knowledge-example-block {
  margin: 0;
  padding: 10px;
  border: 1px solid #d7e0ec;
  border-radius: 10px;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.knowledge-template-panel {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #d7e0ec;
  border-radius: 10px;
  background: #f8fbff;
}

.form-detail-card h5 {
  margin: 0;
  font-size: 14px;
  color: #1d4ed8;
}

.form-detail-card p {
  margin: 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
}

.form-detail-card ul {
  margin: 0;
  padding-left: 18px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
}

.starter-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
}

.starter-row .btn-sm {
  min-width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 11px;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-width: 2px;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
}

.starter-row .btn-sm.plus {
  border-color: #2563eb;
  background: #ecfdf5;
  color: #1d4ed8;
}

.starter-row .btn-sm.danger {
  border-color: #dc2626;
  background: #fef2f2;
  color: #991b1b;
}

.decision-engine-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: #f7fbff;
  border: 1px solid #d6e2ef;
  border-radius: 14px;
  padding: 12px;
}

.inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.inline-toggle input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.agent-manage-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 14px;
  margin-top: 8px;
}

.agent-list-pane,
.agent-detail-pane {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
  padding: 10px;
  min-height: 420px;
  box-shadow: none;
}

.agent-list-pane {
  background: #ffffff;
  border-color: #e2e8f0;
}

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

.agent-list-item {
  border: 1px solid #d5dce6;
  border-left: 4px solid #64748b;
  border-radius: 12px;
  padding: 12px;
  padding-right: 96px;
  background: linear-gradient(135deg, #ffffff, #fffdf8);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.agent-list-item::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 54px;
  height: 54px;
  background: radial-gradient(circle at top right, rgba(59, 130, 246, 0.22), rgba(59, 130, 246, 0));
  pointer-events: none;
}

.agent-list-item:hover {
  border-color: rgba(59, 130, 246, 0.5);
  border-left-color: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.14);
}

.agent-list-identity {
  display: flex;
  align-items: center;
  gap: 10px;
}

#agentManageSection .agent-list-identity .agent-avatar,
#agentManageSection .agent-list-identity .agent-avatar-preset,
#agentManageSection .agent-list-identity .agent-avatar-image {
  width: 52px;
  height: 52px;
  border-radius: 999px !important;
  border: 2px solid #ffffff;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.2), 0 0 0 1px rgba(14, 165, 233, 0.35);
  flex: 0 0 52px;
}

.agent-list-identity strong {
  font-size: 14px;
  color: #0f172a;
  line-height: 1.25;
}

.agent-list-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.agent-list-item.active {
  border-color: rgba(37, 99, 235, 0.7);
  border-left-color: #1e40af;
  background: linear-gradient(140deg, #f3fff6, #fffef7);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.2);
}

.agent-selected-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid #bfdbfe;
  background: #dbeafe;
  color: #1e3a8a;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.agent-list-item p {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 12px;
}

.agent-list-sub {
  margin: 7px 0 6px;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.agent-list-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.agent-list-chip {
  font-size: 11px;
  font-weight: 700;
  color: #1f2937;
  border: 1px solid #d1d9e6;
  background: #ffffff;
  border-radius: 999px;
  padding: 5px 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.agent-list-chip-type {
  color: #065f46;
  border-color: #93c5fd;
  background: #ecfdf5;
}

.agent-list-chip-files {
  color: #7c2d12;
  border-color: #bfdbfe;
  background: #eff6ff;
  text-transform: none;
  letter-spacing: 0;
}

.agent-list-item .status-pill {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 5px 9px;
  border: 1px solid transparent;
  color: #ffffff;
  white-space: nowrap;
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
}

#agentManageSection .status-pill.ACTIVE,
#agentManageSection .status-pill.OPEN,
#agentManageSection .status-pill.CONFIRMED {
  background: #1e40af;
  border-color: #1d4ed8;
  color: #ffffff;
}

#agentManageSection .status-pill.PENDING,
#agentManageSection .status-pill.WAITING {
  background: #1d4ed8;
  border-color: #2563eb;
  color: #ffffff;
}

#agentManageSection .status-pill.INACTIVE {
  background: #64748b;
  border-color: #475569;
}

#agentManageSection .status-pill.DRAFT {
  background: #7c3aed;
  border-color: #6d28d9;
}

#agentManageSection .status-pill.RESOLVED,
#agentManageSection .status-pill.CANCELLED {
  background: #3b82f6;
  border-color: #2563eb;
  color: #ffffff;
}

.agent-detail-empty {
  color: #9ca3af;
  padding: 12px;
}

.agent-detail-shell {
  display: grid;
  gap: 12px;
  color: #111827;
}

.agent-detail-top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.agent-detail-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.agent-detail-sub {
  margin: 2px 0 0;
  color: #334155;
  font-size: 12px;
}

.agent-detail-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.agent-detail-kpis article {
  border: 1px solid #d7dfeb;
  background: linear-gradient(140deg, #ffffff, #eff6ff);
  border-radius: 10px;
  padding: 8px;
  display: grid;
  gap: 4px;
}

.agent-detail-kpis span {
  color: #64748b;
  font-size: 11px;
}

.agent-detail-kpis strong {
  color: #0f172a;
  font-size: 13px;
}

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

.agent-detail-grid p {
  margin: 0;
  color: #334155;
  font-size: 13px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  padding: 8px 10px;
}

.agent-file-empty {
  color: #64748b;
  font-size: 12px;
  border: 1px dashed #dbe6f2;
  border-radius: 8px;
  padding: 8px 10px;
  background: #ffffff;
}

.agent-file-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.agent-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid #dbe6f2;
  border-radius: 8px;
  background: #ffffff;
  padding: 8px 10px;
}

.agent-file-row span {
  font-size: 12px;
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.agent-preview-chat {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #eff6ff;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.agent-preview-chat .bubble {
  padding: 8px;
  border-radius: 8px;
  max-width: 88%;
  font-size: 13px;
}

.agent-preview-chat .bubble.user {
  margin-left: auto;
  background: rgba(59, 130, 246, 0.2);
}

.agent-preview-chat .bubble.agent {
  background: rgba(16, 185, 129, 0.2);
}

.knowledge-upload-box {
  border: 1px dashed rgba(23, 107, 135, 0.38);
  border-radius: 16px;
  padding: 18px;
  background: linear-gradient(180deg, #ffffff, #f3f9ff);
  display: grid;
  grid-template-columns: minmax(200px, 1fr);
  gap: 12px;
  align-items: start;
}

.knowledge-upload-copy {
  display: grid;
  gap: 4px;
  background: #f8fbff;
  border: 1px solid #d6e2ef;
  border-radius: 14px;
  padding: 12px;
}

.knowledge-upload-box strong {
  color: #1d4ed8;
}

.knowledge-upload-box p {
  margin: 0;
  color: #64748b;
  font-size: 12px;
}

.knowledge-upload-box input[type="file"] {
  display: none;
}

.knowledge-upload-btn {
  white-space: nowrap;
  align-self: center;
}

.knowledge-upload-actions {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  background: #f8fbff;
  border: 1px solid #d6e2ef;
  border-radius: 14px;
  padding: 12px;
}

.knowledge-upload-helper {
  margin: 0;
  font-size: 11px;
  line-height: 1.35;
  color: #64748b;
  flex: 1 1 100%;
  max-width: 100%;
}

.knowledge-file-inline {
  font-size: 12px;
  color: #334155;
  border: 1px solid #d7e0ec;
  background: #eef4ff;
  border-radius: 10px;
  padding: 7px 10px;
  line-height: 1.35;
  flex: 1 1 100%;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.knowledge-file-link,
.knowledge-file-name {
  display: inline-block;
  margin: 2px 4px 2px 0;
  padding: 2px 6px;
  border: 1px solid #d7e0ec;
  background: #ffffff;
  color: #0f172a;
  text-decoration: none;
}

.knowledge-file-link:hover {
  border-color: #2563eb;
  color: #1d4ed8;
}

.knowledge-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 4px 6px 4px 0;
}

.knowledge-file-remove {
  border: 1px solid rgba(220, 38, 38, 0.35);
  background: #fef2f2;
  color: #b91c1c;
  border-radius: 999px;
  width: 20px;
  height: 20px;
  line-height: 18px;
  padding: 0;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.knowledge-file-remove:hover {
  border-color: #dc2626;
  background: #fee2e2;
}

.knowledge-template-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.knowledge-template-links .btn {
  text-decoration: none;
}

#aiKnowledgeManualInput {
  min-height: 110px;
  line-height: 1.45;
}

.knowledge-file-list {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
  min-height: 44px;
  color: #334155;
  font-size: 12px;
  background: #eff6ff;
}

.agent-avatar {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  color: #fff;
  font-size: 21px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  flex: 0 0 auto;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.18);
}

.agent-avatar-preset {
  background-color: #e2e8f0;
  text-shadow: none;
  overflow: hidden;
}

.agent-avatar-image {
  background-color: #e2e8f0;
}

.agent-list-identity strong,
.agent-detail-identity strong {
  line-height: 1.2;
}

.conversation-filters {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.inbox-list {
  max-height: 520px;
  overflow: auto;
  display: grid;
  gap: 8px;
  align-content: start;
}

.inbox-list .virtual-spacer {
  width: 100%;
}

.inbox-pagination {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

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

.inbox-pagination select {
  width: auto;
}

.conversation-item {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
  background: #eff6ff;
}

.conversation-item.active {
  border-color: var(--secondary);
  background: rgba(37, 99, 235, 0.1);
}

.conversation-item .meta-line {
  color: #9ca3af;
  font-size: 12px;
}

.conversation-item .top-line,
.conversation-item .bottom-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.channel-chip,
.unread-chip {
  font-size: 11px;
  border-radius: 999px;
  padding: 2px 8px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #64748b;
}

.unread-chip {
  border-color: rgba(37, 99, 235, 0.45);
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.08);
}

.chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.chat-meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.chat-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  min-width: 0;
}

.chat-tags-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin: 10px 0;
}

.owner-takeover-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: 10px;
  background: #eff6ff;
  margin-bottom: 8px;
}

.owner-takeover-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #334155;
  font-size: 13px;
}

.messages-box {
  min-height: 320px;
  max-height: 400px;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
  background: #ffffff;
}

.typing-indicator {
  color: #2563eb;
  font-size: 12px;
  margin: 8px 0 2px;
}

.delivery-status {
  color: #9ca3af;
  font-size: 11px;
  margin-bottom: 8px;
}

.chat-compose-grid {
  display: grid;
  grid-template-columns: 1fr 170px 160px 200px;
  gap: 8px;
  min-width: 0;
}

.chat-action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.chat-advanced-tools {
  margin-top: 10px;
  border: 1px dashed #93c5fd;
  border-radius: 10px;
  padding: 10px;
  background: #eff6ff;
}

.chat-advanced-tools summary {
  cursor: pointer;
  color: #64748b;
  font-size: 13px;
}

.message-row {
  margin-bottom: 8px;
  padding: 8px;
  border-radius: 8px;
  max-width: 85%;
  overflow-wrap: anywhere;
}

.message-row.AGENT {
  background: rgba(37, 99, 235, 0.18);
  margin-left: auto;
}

.message-row.CUSTOMER {
  background: rgba(59, 130, 246, 0.15);
}

.message-row.AI {
  background: rgba(16, 185, 129, 0.2);
}

.message-row.SYSTEM {
  background: rgba(59, 130, 246, 0.16);
}

.conversation-crm {
  grid-column: 1 / -1;
  min-height: auto;
  position: static;
}

.conversation-workspace-grid .conversation-crm {
  grid-column: auto;
  position: sticky;
  top: 16px;
}

.crm-summary {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
  background: #eff6ff;
  margin-bottom: 10px;
}

.crm-summary p {
  margin: 5px 0;
  font-size: 13px;
  color: #64748b;
}

.crm-section {
  border-top: 1px solid rgba(55, 65, 81, 0.8);
  margin-top: 10px;
  padding-top: 10px;
}

.crm-section h4 {
  margin: 0 0 8px;
}

#knowledgeImportInput {
  width: auto;
  max-width: 100%;
}

.widget-box {
  width: min(360px, 95vw);
  height: 540px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.widget-header {
  background: linear-gradient(90deg, #1d4ed8, #60a5fa);
  padding: 12px;
  font-weight: 700;
}

.widget-messages {
  flex: 1;
  overflow: auto;
  padding: 10px;
}

.msg {
  margin: 8px 0;
  padding: 8px 10px;
  border-radius: 10px;
  max-width: 85%;
}

.msg.customer {
  margin-left: auto;
  background: #dbeafe;
}

.msg.ai {
  background: #bfdbfe;
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .dashboard {
    grid-template-columns: 1fr;
  }

  .kpis {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .kpi-grid,
  .charts-2,
  .split-activity,
  .automation-grid {
    grid-template-columns: 1fr;
  }

  .table-tools {
    grid-template-columns: 1fr;
  }

  .integration-actions-row {
    min-width: 0;
  }

  .agent-history-kpis {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .agent-history-tools {
    grid-template-columns: 1fr;
  }

  .agent-history-hero {
    grid-template-columns: 1fr;
  }

  .agent-history-hero-bars {
    grid-template-columns: repeat(4, minmax(30px, 1fr));
  }

  .dashboard .top-links {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .dashboard .profile-dropdown {
    margin-left: 0;
  }

  .dashboard .profile-toggle {
    width: 100%;
    min-width: 0;
  }

  .dashboard .profile-menu {
    left: 0;
    right: auto;
    width: 100%;
    min-width: 0;
  }

  #agentHistorySessionModal {
    padding: 16px;
  }

  .modal-card.agent-history-session-card {
    width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
    padding: 10px;
    grid-template-rows: auto auto minmax(280px, 1fr) auto auto;
  }

  .agent-history-session-messages {
    min-height: 280px;
    max-height: 360px;
  }

  .agent-history-session-card .modal-actions {
    justify-content: stretch;
  }

  .agent-history-session-card .modal-actions .btn,
  .agent-history-session-card .modal-actions .btn.secondary {
    flex: 1 1 160px;
  }

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

  .manage-agents-hero {
    grid-template-columns: 1fr;
  }

  .conversation-panel {
    grid-template-columns: 1fr;
  }

  .conversation-workspace-grid {
    grid-template-columns: 1fr;
  }

  .conversation-list,
  .conversation-crm {
    position: static;
    min-height: auto;
  }

  .chat-compose-grid {
    grid-template-columns: 1fr;
  }

  .chat-tags-row {
    grid-template-columns: 1fr;
  }

  .cards-2 {
    grid-template-columns: 1fr;
  }

  .inline-checks {
    grid-template-columns: 1fr;
  }

  .check-grid {
    grid-template-columns: 1fr;
  }

  .agent-create-box {
    flex-direction: column;
    align-items: stretch;
  }

  .tone-grid,
  .agent-manage-grid {
    grid-template-columns: 1fr;
  }

  .agent-detail-top,
  .agent-detail-kpis,
  .agent-detail-grid {
    grid-template-columns: 1fr;
  }

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

  .create-agent-guide {
    grid-template-columns: 1fr;
  }

  .create-agent-guide-top,
  .create-agent-guide-grid {
    grid-template-columns: 1fr;
  }

  .create-agent-channel-row {
    grid-template-columns: 1fr 1fr;
  }

  .create-agent-guide-points {
    grid-template-columns: 1fr;
  }

  .guide-side-card {
    padding: 12px;
  }

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

  .create-agent-how-list {
    gap: 6px;
  }

  .form-split-two,
  .knowledge-upload-box {
    grid-template-columns: 1fr;
  }

  .form-detail-card-compact {
    max-width: 100%;
    justify-self: stretch;
  }

  .knowledge-upload-btn {
    justify-self: start;
  }
}

/* Stable dashboard section overrides to prevent style drift from earlier duplicate rules. */
#createAgentModal.inline-mode .modal-card {
  background: #ffffff;
  border: 1px solid #d6e2ef;
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

#createAgentModal.inline-mode .modal-head {
  border-bottom: 1px solid #dbe6f2;
  margin-bottom: 10px;
}

#createAgentModal.inline-mode .create-agent-how {
  background: #f8fbff;
  border: 1px solid #dbe6f2;
}

#agentManageSection {
  border: 1px solid #d6e2ef;
  background: #ffffff;
}

#agentManageSection .agent-list-pane,
#agentManageSection .agent-detail-pane {
  background: #ffffff;
  border: 1px solid #dbe6f2;
}

#agentManageSection .agent-list-item {
  background: #ffffff;
  border: 1px solid #d7dfeb;
  border-left: 4px solid #2563eb;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

#agentManageSection .agent-list-item.active {
  border-color: #93c5fd;
  border-left-color: #1d4ed8;
  background: #f8fbff;
}

#agentHistoryPanel {
  border: 1px solid #d6e2ef;
  background: #ffffff;
}

#agentHistoryPanel .agent-history-table-wrap {
  border: 1px solid #dbe6f2;
  background: #ffffff;
}

#agentHistoryPanel .agent-history-table th {
  background: #f8fafc;
  color: #334155;
}

/* User-requested global square UI: remove rounded corners across all themed pages. */
*,
*::before,
*::after {
  border-radius: 0 !important;
}

/* Shared shell sizing: no unnecessary page scroll with small content. */
body.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.app-shell .app-page-header {
  padding: 0 20px;
  border-bottom: 1px solid #1d4ed8;
  background: linear-gradient(95deg, #1e3a8a 0%, #1d4ed8 55%, #2563eb 100%);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
}

body.app-shell .dashboard {
  flex: 1 1 auto;
  min-height: 0;
}

body.app-shell .dashboard .main {
  min-height: 0;
}

/* Professional shared header with brand on left and account actions on right. */
body.app-shell #appHeader .top-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  box-shadow: none;
  min-height: 58px;
}

body.app-shell .header-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

body.app-shell .header-brand-mark {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

body.app-shell .header-brand-copy {
  display: grid;
  line-height: 1.1;
  gap: 2px;
}

body.app-shell .header-brand-copy strong {
  font-size: 15px;
  color: #ffffff;
}

body.app-shell .header-brand-copy span {
  font-size: 11px;
  color: #dbeafe;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

body.app-shell .plan-usage-widget {
  margin: 0;
  border: 1px solid #dbe7f7;
  background: linear-gradient(135deg, #ffffff 0%, #f7fbff 100%);
  padding: 10px 12px;
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

body.app-shell .plan-usage-title {
  margin: 0 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #4b5f7e;
  font-weight: 800;
}

body.app-shell .plan-usage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

body.app-shell .plan-usage-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid #d9e4f5;
  background: #ffffff;
  min-width: 0;
}

body.app-shell .plan-usage-icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #edf3ff;
  font-size: 12px;
  flex-shrink: 0;
}

body.app-shell .plan-usage-grid span {
  font-size: 13px;
  color: #334155;
  line-height: 1.25;
}

body.app-shell .plan-usage-item > span:last-child {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

body.app-shell .plan-usage-grid strong {
  color: #0f172a;
  font-weight: 800;
}

body.app-shell .usage-page-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

body.app-shell .usage-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

body.app-shell .usage-kpi-card {
  border: 1px solid #d7e4f7;
  border-radius: 12px;
  padding: 12px;
  background: #ffffff;
}

body.app-shell .usage-kpi-card h3 {
  margin: 0;
  font-size: 24px;
  color: #0f172a;
}

body.app-shell .usage-kpi-card p {
  margin: 4px 0 0;
  font-size: 12px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

body.app-shell .usage-detail-card {
  border: 1px solid #d7e4f7;
  border-radius: 12px;
  background: #ffffff;
  padding: 14px;
}

body.app-shell .usage-detail-card h4 {
  margin: 0 0 12px;
  font-size: 16px;
}

body.app-shell .usage-progress-row {
  margin-bottom: 12px;
}

body.app-shell .usage-progress-row:last-child {
  margin-bottom: 0;
}

body.app-shell .usage-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: #334155;
  margin-bottom: 6px;
}

body.app-shell .usage-progress-track {
  position: relative;
  height: 9px;
  border-radius: 999px;
  background: #eaf2ff;
  overflow: hidden;
}

body.app-shell .usage-progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
}

body.app-shell .usage-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

body.app-shell .usage-meta-item {
  border: 1px solid #dbe6fb;
  border-radius: 10px;
  background: #f8fbff;
  padding: 10px;
}

body.app-shell .usage-meta-item span {
  display: block;
  color: #64748b;
  font-size: 12px;
}

body.app-shell .usage-meta-item strong {
  display: block;
  margin-top: 4px;
  color: #0f172a;
  font-size: 15px;
}

body.app-shell .usage-chart-wrap {
  min-height: 250px;
}

body.app-shell .usage-refresh-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
}

body.app-shell .usage-refresh-row p {
  margin: 0;
  color: #64748b;
  font-size: 12px;
}

body.app-shell .profile-toggle {
  border: 1px solid rgba(191, 219, 254, 0.55);
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.14);
}

body.app-shell #appHeader .profile-dropdown {
  position: relative;
  margin-left: auto;
}

body.app-shell #appHeader .profile-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 250px;
  padding: 8px 12px;
}

body.app-shell #appHeader .profile-image {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border: 2px solid #bfdbfe;
}

body.app-shell #appHeader .profile-meta {
  display: grid;
  text-align: left;
  line-height: 1.1;
  gap: 2px;
}

body.app-shell #appHeader .profile-greeting {
  color: #64748b;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

body.app-shell #appHeader .profile-caret {
  margin-left: auto;
  color: #1d4ed8;
  font-size: 11px;
}

body.app-shell .profile-toggle:hover {
  border-color: #bfdbfe;
}

body.app-shell .profile-menu {
  border: 1px solid #bfdbfe;
  background: #ffffff;
}

body.app-shell #appHeader .profile-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 250px;
  padding: 10px;
  display: grid;
  gap: 6px;
  z-index: 40;
  box-shadow: 0 16px 28px rgba(15, 23, 42, 0.18);
}

body.app-shell #appHeader .profile-menu .nav-link,
body.app-shell #appHeader .top-nav-action {
  display: block;
  text-decoration: none;
  border: 1px solid #bfdbfe;
  background: #f8fbff;
  color: #0f172a;
  padding: 9px 11px;
  font-size: 13px;
}

body.app-shell #appHeader .profile-menu .nav-link:hover,
body.app-shell #appHeader .top-nav-action:hover {
  background: #eff6ff;
  border-color: #93c5fd;
}

/* Page title is shown in content area, not in header. */
body.app-shell .page-title-row {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

body.app-shell .page-title-stack {
  margin: 0 0 12px;
  display: grid;
  gap: 10px;
}

body.app-shell #pageContentTitle {
  margin: 0;
  color: #0f172a;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

@media (max-width: 900px) {
  body.app-shell .app-page-header {
    padding: 0 12px;
  }

  body.app-shell #appHeader .top-links {
    flex-direction: column;
    align-items: stretch;
  }

  body.app-shell .plan-usage-widget {
    margin: 0;
    min-width: 0;
  }

  body.app-shell .plan-usage-grid {
    grid-template-columns: 1fr;
  }

  body.app-shell .page-title-row {
    justify-content: flex-start;
  }

  body.app-shell #appHeader .profile-dropdown {
    margin-left: 0;
  }

  body.app-shell #appHeader .profile-toggle {
    width: 100%;
    min-width: 0;
  }

  body.app-shell #appHeader .profile-menu {
    left: 0;
    right: auto;
    width: 100%;
    min-width: 0;
  }

  body.app-shell .usage-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.app-shell .usage-page-grid,
  body.app-shell .usage-meta-grid {
    grid-template-columns: 1fr;
  }
}

/* Inline Create Agent should not show the top-right heading and close control. */
#createAgentModal.inline-mode .modal-head {
  display: none;
}

/* Create Agent page alignment and polish */
body[data-layout-module="create-agent"] #moduleSection {
  max-width: 1280px;
}

body[data-layout-module="create-agent"] .conversation-panel.create-agent-mode {
  gap: 14px;
}

body[data-layout-module="create-agent"] .create-agent-how {
  padding: 12px 14px;
  border: 1px solid #d6e2ef;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

body[data-layout-module="create-agent"] .create-agent-form {
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

body[data-layout-module="create-agent"] .create-form-card {
  border: 1px solid #c9d9ea;
  background: linear-gradient(180deg, #ffffff 0%, #f5f9ff 100%);
  padding: 16px;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.07);
  display: grid;
  gap: 12px;
}

body[data-layout-module="create-agent"] .create-agent-how {
  border: 1px solid #bfdbfe;
  background: linear-gradient(180deg, #eff6ff 0%, #f8fbff 100%);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.08);
}

body[data-layout-module="create-agent"] #agentManageSection {
  border: 1px solid #b6cee7;
  background: linear-gradient(160deg, #ffffff 0%, #f4f8ff 58%, #eef5ff 100%);
  box-shadow: 0 22px 44px rgba(15, 23, 42, 0.12);
  border-radius: 14px;
  padding: 16px;
}

body[data-layout-module="create-agent"] #agentManageSection .manage-agents-grid {
  grid-template-columns: minmax(250px, 0.75fr) minmax(0, 1.25fr);
  gap: 18px;
}

body[data-layout-module="create-agent"] #agentManageSection .agent-list-pane,
body[data-layout-module="create-agent"] #agentManageSection .agent-detail-pane {
  border: 1px solid #cfdded;
  background: linear-gradient(180deg, #ffffff, #f9fbff);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  padding: 13px;
}

body[data-layout-module="create-agent"] #agentManageSection .manage-pane-head {
  display: grid;
  gap: 4px;
  padding: 2px 0 10px;
  border-bottom: 1px solid #e5edf7;
  margin-bottom: 10px;
}

body[data-layout-module="create-agent"] #agentManageSection .manage-pane-head h3 {
  margin: 0;
  font-size: 17px;
  color: #0f172a;
}

body[data-layout-module="create-agent"] #agentManageSection .manage-pane-head p {
  margin: 0;
  font-size: 12px;
  color: #475569;
}

body[data-layout-module="create-agent"] #agentManageSection .agent-list {
  gap: 10px;
}

body[data-layout-module="create-agent"] #agentManageSection .agent-list-item {
  border-left-width: 5px;
  border-radius: 14px;
  padding: 12px;
  padding-right: 12px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.09);
}

body[data-layout-module="create-agent"] #agentManageSection .agent-list-item.active {
  border-color: #1d4ed8;
  border-left-color: #1e3a8a;
  background: linear-gradient(140deg, #edf4ff, #deebff);
  box-shadow: 0 15px 30px rgba(29, 78, 216, 0.24);
  transform: translateY(-1px);
}

body[data-layout-module="create-agent"] #agentManageSection .agent-list-head {
  align-items: center;
}

body[data-layout-module="create-agent"] #agentManageSection .agent-list-identity {
  min-width: 0;
  flex: 1 1 auto;
}

body[data-layout-module="create-agent"] #agentManageSection .agent-list-identity strong {
  display: block;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
}

body[data-layout-module="create-agent"] #agentManageSection .agent-list-badges {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
  flex: 0 0 auto;
}

body[data-layout-module="create-agent"] #agentManageSection .agent-list-item .status-pill {
  position: static;
  top: auto;
  right: auto;
  z-index: auto;
  font-size: 11px;
  letter-spacing: 0.05em;
  padding: 6px 10px;
  border-radius: 8px;
}

body[data-layout-module="create-agent"] #agentManageSection .agent-list-sub {
  margin: 8px 0 8px;
  color: #334155;
}

body[data-layout-module="create-agent"] #agentManageSection .agent-list-chip {
  border-radius: 9px;
  padding: 5px 10px;
  font-size: 10px;
  font-weight: 800;
}

body[data-layout-module="create-agent"] #agentManageSection .agent-detail-empty {
  border: 1px dashed #d5e1ef;
  background: #f8fbff;
  border-radius: 10px;
  color: #64748b;
}

body[data-layout-module="create-agent"] .create-form-card-head {
  display: grid;
  gap: 4px;
  border-bottom: 1px solid #dbe6f2;
  padding-bottom: 10px;
}

body[data-layout-module="create-agent"] .create-form-card-head h4 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 18px;
  color: #0f172a;
  font-weight: 800;
}

body[data-layout-module="create-agent"] .create-form-card-head p {
  margin: 0;
  color: #475569;
  font-size: 13px;
}

body[data-layout-module="create-agent"] .section-icon {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

body[data-layout-module="create-agent"] .field-help {
  margin-top: 5px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.4;
}

body[data-layout-module="create-agent"] .inline-field-note {
  margin: 0;
  color: #64748b;
  font-size: 12px;
}

body[data-layout-module="create-agent"] .agent-basics-grid {
  grid-template-columns: repeat(3, minmax(200px, 1fr));
  gap: 12px;
}

body[data-layout-module="create-agent"] .avatar-section {
  display: grid;
  gap: 8px;
}

body[data-layout-module="create-agent"] .avatar-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

body[data-layout-module="create-agent"] .avatar-section-head small {
  color: #475569;
  font-size: 12px;
}

body[data-layout-module="create-agent"] .starter-messages-grid {
  background: #ffffff;
  border: 1px solid #dbe6f2;
  padding: 12px;
}

body[data-layout-module="create-agent"] #avatarOptions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 8px;
  border: 1px solid #d6e2ef;
  background: #f8fbff;
  padding: 10px;
}

body[data-layout-module="create-agent"] #avatarOptions .avatar-option {
  width: 52px;
  height: 52px;
  justify-self: center;
}

body[data-layout-module="create-agent"] #intelligentDecisionFieldsWrap {
  display: grid;
  gap: 10px;
  border: 1px solid #dbe6f2;
  background: #ffffff;
  padding: 10px;
}

body[data-layout-module="create-agent"] .knowledge-dual-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 12px;
}

body[data-layout-module="create-agent"] .knowledge-upload-pane,
body[data-layout-module="create-agent"] .knowledge-format-pane {
  border: 1px solid #dbe6f2;
  background: #ffffff;
  padding: 12px;
  display: grid;
  gap: 10px;
  align-content: start;
}

body[data-layout-module="create-agent"] .knowledge-upload-pane h5,
body[data-layout-module="create-agent"] .knowledge-format-pane h5 {
  margin: 0;
  color: #0f172a;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

body[data-layout-module="create-agent"] .pane-help {
  margin: 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
}

body[data-layout-module="create-agent"] .file-rules-list {
  margin: 0;
  padding-left: 18px;
  color: #334155;
  font-size: 12px;
  line-height: 1.45;
  display: grid;
  gap: 4px;
}

body[data-layout-module="create-agent"] .knowledge-format-card {
  border: 1px solid #dbe6f2;
  background: #f8fbff;
  padding: 10px;
  display: grid;
  gap: 6px;
}

body[data-layout-module="create-agent"] .knowledge-format-card h6 {
  margin: 0;
  color: #0f172a;
  font-size: 13px;
}

body[data-layout-module="create-agent"] .knowledge-format-card pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #334155;
  font-size: 11px;
  line-height: 1.45;
  background: #ffffff;
  border: 1px solid #dbe6f2;
  padding: 8px;
}

body[data-layout-module="create-agent"] .decision-toggle-row {
  border: 1px solid #dbe6f2;
  background: #ffffff;
  padding: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #0f172a;
}

body[data-layout-module="create-agent"] .decision-toggle-row input[type="checkbox"] {
  width: auto;
}

body[data-layout-module="create-agent"] .create-form-actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  padding: 10px 0 0;
  border: 0;
  background: transparent;
  justify-content: flex-end;
}

body[data-layout-module="create-agent"] #saveAIAgentBtn {
  background: transparent;
  border: 1px solid #1d4ed8;
  color: #1d4ed8;
  box-shadow: none;
}

body[data-layout-module="create-agent"] #saveAIAgentBtn:hover {
  background: transparent;
  border-color: #1e3a8a;
  color: #1e3a8a;
  box-shadow: none;
}

@media (max-width: 1024px) {
  body[data-layout-module="create-agent"] #agentManageSection .manage-agents-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  body[data-layout-module="create-agent"] .agent-basics-grid {
    grid-template-columns: 1fr;
  }

  body[data-layout-module="create-agent"] .avatar-section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  body[data-layout-module="create-agent"] .create-agent-form {
    grid-template-columns: 1fr;
  }

  body[data-layout-module="create-agent"] #avatarOptions {
    grid-template-columns: repeat(4, minmax(52px, 1fr));
  }

  body[data-layout-module="create-agent"] .knowledge-dual-layout {
    grid-template-columns: 1fr;
  }

  body[data-layout-module="create-agent"] .create-form-actions {
    position: static;
  }
}

/* Agent chat logs page polish */
body[data-layout-module="agent-history"] #moduleSection {
  max-width: none;
  width: 100%;
}

body[data-layout-module="agent-history"] #agentHistoryPanel {
  border: 1px solid #bfd3e8;
  background: linear-gradient(180deg, #ffffff 0%, #f4f9ff 100%);
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.1);
  padding: 10px;
}

body[data-layout-module="agent-history"] #agentHistoryPanel .agent-history-content {
  border: 1px solid #d6e2ef;
  background: #ffffff;
  width: 100%;
  padding: 10px;
}

body[data-layout-module="agent-history"] #agentHistoryPanel .agent-history-tools {
  grid-template-columns: minmax(340px, 2.6fr) repeat(4, minmax(170px, 1fr));
  width: 100%;
  gap: 8px;
  margin-bottom: 10px;
}

body[data-layout-module="agent-history"] #agentHistoryPanel .agent-history-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
}

body[data-layout-module="agent-history"] #agentHistoryPanel .agent-history-table th,
body[data-layout-module="agent-history"] #agentHistoryPanel .agent-history-table td {
  text-align: left;
  vertical-align: middle;
}

body[data-layout-module="agent-history"] #agentHistoryPanel .agent-history-table th:nth-child(1),
body[data-layout-module="agent-history"] #agentHistoryPanel .agent-history-table td:nth-child(1) { width: 20%; }
body[data-layout-module="agent-history"] #agentHistoryPanel .agent-history-table th:nth-child(2),
body[data-layout-module="agent-history"] #agentHistoryPanel .agent-history-table td:nth-child(2) { width: 13%; }
body[data-layout-module="agent-history"] #agentHistoryPanel .agent-history-table th:nth-child(3),
body[data-layout-module="agent-history"] #agentHistoryPanel .agent-history-table td:nth-child(3) { width: 12%; text-align: center; }
body[data-layout-module="agent-history"] #agentHistoryPanel .agent-history-table th:nth-child(4),
body[data-layout-module="agent-history"] #agentHistoryPanel .agent-history-table td:nth-child(4) { width: 16%; }
body[data-layout-module="agent-history"] #agentHistoryPanel .agent-history-table th:nth-child(5),
body[data-layout-module="agent-history"] #agentHistoryPanel .agent-history-table td:nth-child(5) { width: 11%; text-align: center; }
body[data-layout-module="agent-history"] #agentHistoryPanel .agent-history-table th:nth-child(6),
body[data-layout-module="agent-history"] #agentHistoryPanel .agent-history-table td:nth-child(6) { width: 11%; text-align: center; }
body[data-layout-module="agent-history"] #agentHistoryPanel .agent-history-table th:nth-child(7),
body[data-layout-module="agent-history"] #agentHistoryPanel .agent-history-table td:nth-child(7) { width: 9%; text-align: center; }
body[data-layout-module="agent-history"] #agentHistoryPanel .agent-history-table th:nth-child(8),
body[data-layout-module="agent-history"] #agentHistoryPanel .agent-history-table td:nth-child(8) { width: 8%; text-align: center; }

body[data-layout-module="agent-history"] #agentHistoryPanel .agent-history-kpis article {
  border-color: #c9daec;
  background: linear-gradient(150deg, #ffffff, #eef6ff);
  padding: 8px 10px;
}

body[data-layout-module="agent-history"] #agentHistoryPanel .agent-history-table tbody tr td {
  color: #1f2937;
  white-space: normal;
  overflow-wrap: anywhere;
}

body[data-layout-module="agent-history"] #agentHistoryPanel .status-pill {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 6px 10px;
  border: 1px solid transparent;
}

body[data-layout-module="agent-history"] #agentHistoryPanel .status-pill.OPEN {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

body[data-layout-module="agent-history"] #agentHistoryPanel .status-pill.PENDING {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}

body[data-layout-module="agent-history"] #agentHistoryPanel .status-pill.RESOLVED {
  background: #dbeafe;
  color: #1e40af;
  border-color: #93c5fd;
}

body[data-layout-module="agent-history"] #agentHistoryPanel .agent-history-table tbody tr:hover {
  background: #eaf4ff;
}

body[data-layout-module="agent-history"] #agentHistoryPanel .agent-history-table-wrap {
  overflow-x: hidden;
  overflow-y: hidden;
  border: 1px solid #d5e3f2;
}

body[data-layout-module="agent-history"] #agentHistoryPanel .btn-sm {
  border-color: #93c5fd;
  background: #f8fbff;
  color: #1e3a8a;
}



