:root {
  --app-bg: #f4f7f6;
  --surface: #ffffff;
  --surface-muted: #eef4f2;
  --border: #dbe5e2;
  --text: #14211d;
  --muted: #63716d;
  --primary: #0f5d46;
  --primary-dark: #0a4232;
  --primary-soft: #dceee8;
  --sidebar-bg: #102f27;
  --sidebar-bg-soft: #153a31;
  --sidebar-text: #d4e3de;
  --sidebar-muted: #95aaa3;
}

html {
  font-size: 14px;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--app-bg);
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  color: var(--primary-dark);
}

.btn-primary {
  background-color: var(--primary);
  border-color: var(--primary);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
}

.form-control:focus,
.form-check-input:focus,
.btn:focus,
.btn:active:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.18rem rgba(15, 93, 70, 0.18);
}

.app-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
}

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, #0d2923 100%);
  color: #ffffff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  padding: 4px 4px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand:hover {
  color: inherit;
}

.brand-mark {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: #12654d;
  color: #ffffff;
  font-weight: 750;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--sidebar-muted);
  font-size: 0.76rem;
  letter-spacing: 0;
}

.side-nav {
  display: grid;
  gap: 4px;
  margin-top: 18px;
}

.side-nav a {
  position: relative;
  display: flex;
  min-height: 40px;
  align-items: center;
  padding: 0 12px 0 14px;
  border-radius: 8px;
  color: var(--sidebar-text);
  font-size: 0.94rem;
  font-weight: 550;
  transition: background-color 0.16s ease, color 0.16s ease;
}

.side-nav a:hover {
  background: rgba(255, 255, 255, 0.075);
  color: #ffffff;
}

.side-nav a.is-active {
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 700;
}

.side-nav a.is-active::before {
  position: absolute;
  left: 6px;
  width: 3px;
  height: 18px;
  border-radius: 999px;
  background: var(--primary);
  content: "";
}

.app-main {
  min-width: 0;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.app-header h1 {
  margin: 0;
  color: #1b2b27;
  font-size: 1.08rem;
  font-weight: 650;
  line-height: 1.2;
}

.header-account {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-client-name {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: right;
}

.eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 650;
  text-transform: uppercase;
}

.account-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--primary-dark);
  font-size: 0.9rem;
  font-weight: 750;
}

.account-button:hover {
  border-color: var(--primary);
  background: #edf7f3;
}

.impersonation-pill {
  display: inline-flex;
  margin-top: 6px;
  padding: 3px 8px;
  border: 1px solid #f2c14e;
  border-radius: 999px;
  background: #fff6db;
  color: #7a5300;
  font-size: 0.76rem;
  font-weight: 700;
}

.impersonation-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid #ef9bb8;
  border-radius: 8px;
  background: #d6336c;
  color: #ffffff;
}

.impersonation-bar.is-empty {
  background: #ad2f62;
}

.impersonation-bar strong,
.impersonation-bar span {
  display: block;
}

.impersonation-bar span {
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.88rem;
}

.impersonation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.impersonation-actions form {
  margin: 0;
}

.dropdown-header strong,
.dropdown-header span {
  display: block;
}

.dropdown-header span {
  color: var(--muted);
  font-size: 0.78rem;
}

.app-content {
  padding: 28px;
  overflow-x: hidden;
}

.surface,
.card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.surface {
  min-width: 0;
  padding: 24px;
}

.surface h2 {
  margin-bottom: 8px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.page-header h2 {
  margin: 0;
  font-size: 1.42rem;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.field-help {
  display: inline-grid;
  width: 18px;
  height: 18px;
  margin-left: 4px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  cursor: help;
}

.empty-state {
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  display: block;
  color: var(--text);
  margin-bottom: 4px;
}

.empty-state p {
  margin: 0;
}

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.file-missing-notice {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: min(420px, 100%);
  padding: 12px;
  border: 1px solid #b8bfc4;
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
}

.file-missing-notice span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #e5e7eb;
  color: #374151;
  font-weight: 800;
}

.file-missing-notice p {
  margin: 0;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.next-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.client-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}

.operation-filter {
  grid-template-columns: minmax(220px, 1fr);
}

.client-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.client-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.client-card-main,
.client-card-footer,
.client-detail-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.client-card h3,
.client-detail-hero h3 {
  margin: 8px 0 2px;
  font-size: 1.12rem;
}

.client-card p {
  margin: 0;
  color: var(--muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
}

.status-pill.is-active {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.status-pill.is-inactive {
  background: #f4e7e7;
  color: #8a1f1f;
}

.status-pill.is-pending {
  background: #fff6db;
  color: #7a5300;
}

.client-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.dashboard-metrics {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
}

.client-metrics.detail {
  margin-top: 18px;
}

.client-metrics div {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.client-metrics dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.client-metrics dd {
  margin: 2px 0 0;
  font-weight: 800;
}

.client-metrics small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.client-card-footer {
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.86rem;
}

.entity-form {
  max-width: 880px;
}

.bot-purpose-panel {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.bot-purpose-panel.is-selected {
  border-color: var(--primary);
  background: #e8f4ef;
}

.bot-purpose-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.client-detail-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.1fr);
  gap: 18px;
}

.client-detail-layout > .surface:first-child {
  grid-column: 1 / -1;
}

.activity-list {
  display: grid;
  gap: 10px;
}

.activity-list article {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.activity-list strong,
.activity-list span {
  display: block;
}

.activity-list span,
.activity-list p {
  color: var(--muted);
  font-size: 0.86rem;
}

.activity-list p {
  margin: 6px 0 0;
}

.bot-card .client-metrics {
  grid-template-columns: minmax(0, 1fr);
}

.bot-color {
  display: inline-block;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.bot-form .form-control-color {
  width: 100%;
  min-height: 38px;
}

.bot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.bot-actions form {
  margin: 0;
}

.bot-detail-summary {
  display: grid;
  gap: 18px;
}

.bot-detail-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.quick-actions form {
  margin: 0;
}

.training-form textarea {
  resize: vertical;
}

.content-preview {
  max-height: 420px;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.app-modal {
  border: 0;
  border-radius: 8px;
}

.widget-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(300px, 420px);
  gap: 18px;
}

.widget-editor-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(360px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.widget-editor-layout .entity-form {
  max-width: none;
}

.widget-preview-panel {
  position: sticky;
  top: 104px;
}

.widget-preview-shell {
  min-height: 430px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #eaf1ef;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  overflow: hidden;
}

.widget-preview-window[hidden],
.widget-preview-body[hidden],
.widget-preview-input[hidden],
.widget-preview-launcher[hidden] {
  display: none;
}

.widget-preview-fallback {
  margin-top: 10px;
  color: var(--muted);
}

.widget-preview-window {
  width: min(100%, 320px);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
  box-shadow: 0 18px 35px rgba(20, 33, 29, 0.12);
}

.widget-preview-launcher {
  position: relative;
  display: inline-grid;
  width: 62px;
  height: 62px;
  place-items: center;
  border: 5px solid #d8e0dc;
  border-radius: 50%;
  color: #ffffff;
  box-shadow: 0 14px 30px rgba(20, 33, 29, 0.22);
  cursor: pointer;
}

.widget-preview-launcher-icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.widget-preview-launcher-badge {
  position: absolute;
  right: 4px;
  bottom: 4px;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 2px solid #d8e0dc;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
}

.widget-preview-launcher-badge svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: #ffffff;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.3;
}

.widget-preview-header,
.widget-preview-input {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px;
  color: #ffffff;
}

.widget-preview-header strong,
.widget-preview-input span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.widget-preview-header [data-widget-preview-toggle] {
  cursor: pointer;
}

.widget-preview-body {
  min-height: 220px;
  max-height: 260px;
  overflow: auto;
  padding: 14px;
  background: #f8fbfa;
}

.widget-preview-message {
  max-width: min(100%, 240px);
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  overflow-wrap: anywhere;
}

.widget-preview-message.user {
  margin-left: auto;
  background: #dcf2ea;
}

.widget-preview-input {
  border-top: 1px solid var(--border);
  color: var(--muted);
}

.widget-preview-input input {
  min-width: 0;
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

.widget-preview-input button {
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  padding: 8px 10px;
}

.widget-install-panel {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}

.widget-install-panel .content-preview {
  grid-column: 1 / -1;
  margin: 0;
}

.widget-test-layout,
.bot-detail-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.85fr) minmax(480px, 1.15fr);
  gap: 18px;
  align-items: start;
}

.widget-test-surface {
  min-height: 460px;
}

.widget-test-browser {
  display: grid;
  min-height: 300px;
  align-content: center;
  justify-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #edf4f2;
  color: var(--muted);
}

.widget-test-browser strong {
  color: var(--text);
  font-size: 1.2rem;
}

.install-actions {
  display: flex;
  justify-content: flex-end;
}

.rules-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(480px, 1.15fr);
  gap: 18px;
  align-items: start;
}

.rules-layout .entity-form {
  max-width: none;
}

.rule-section {
  margin-bottom: 18px;
}

.template-actions,
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.template-label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.health-list {
  display: grid;
  gap: 10px;
}

.health-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.operation-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid #f3b36c;
  border-radius: 8px;
  background: #fff3e3;
  color: #6f3d00;
}

.operation-alert strong,
.operation-alert span {
  display: block;
}

.operation-alert.is-new {
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.22);
}

.operation-workspace {
  min-height: calc(100vh - 170px);
}

.operation-chat-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.operation-chat-list {
  display: grid;
  align-content: start;
  gap: 8px;
  max-height: calc(100vh - 300px);
  overflow: auto;
  padding-right: 4px;
}

.operation-chat-tab {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  text-decoration: none;
}

.operation-chat-tab:hover,
.operation-chat-tab.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--text);
}

.operation-chat-tab strong,
.operation-chat-tab small {
  display: block;
}

.operation-chat-tab small {
  color: var(--muted);
}

.operation-chat-tab-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.operation-chat-panel {
  display: grid;
  grid-template-rows: auto auto minmax(260px, 1fr) auto;
  min-height: 560px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.operation-chat-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--border);
}

.operation-chat-header h3 {
  margin: 2px 0;
  font-size: 1.2rem;
}

.operation-chat-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 8px;
}

.operation-chat-reason {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 18px;
  border-bottom: 1px solid #f3b36c;
  background: #fff3e3;
  color: #6f3d00;
}

.operation-chat-thread {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 18px;
  background: var(--surface-muted);
  overflow: auto;
}

.operation-reply-form {
  padding: 16px 18px;
  border-top: 1px solid var(--border);
  background: #ffffff;
}

.operation-reply-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.operation-reply-row textarea {
  resize: vertical;
}

.operation-source {
  margin: 14px 0 0;
  overflow-wrap: anywhere;
}

.conversation-thread {
  display: grid;
  gap: 12px;
  margin-top: 20px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.conversation-message {
  width: min(720px, 88%);
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.conversation-message.is-visitor {
  justify-self: end;
  background: #dcf2ea;
}

.conversation-message.is-agent {
  background: #fff6db;
}

.conversation-message.is-human {
  justify-self: end;
  background: #e8efff;
}

.conversation-message-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.conversation-message-meta strong {
  color: var(--text);
}

.conversation-message p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message-sources {
  display: grid;
  gap: 4px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.82rem;
}

.message-sources span {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.message-sources a,
.message-sources strong {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

.widget-test-fields {
  display: grid;
  gap: 12px;
  grid-template-columns: 2fr 1fr 1fr 1.2fr;
  margin-bottom: 16px;
}

.wizard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.wizard-header h3 {
  margin: 0 0 4px;
}

.wizard-steps {
  display: grid;
  gap: 10px;
}

.wizard-step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.wizard-step > span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--muted);
  font-weight: 800;
}

.wizard-step.is-complete > span {
  background: var(--primary);
  color: #ffffff;
}

.wizard-step p {
  margin: 4px 0 0;
  color: var(--muted);
}

.publication-preview {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.publication-preview.is-disabled {
  background: var(--surface-muted);
  opacity: 0.68;
}

.publication-preview.is-disabled a:not(.btn),
.publication-preview.is-disabled button {
  pointer-events: none;
}

.lead-settings {
  display: grid;
  grid-template-columns: repeat(4, auto) minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.lead-settings > div {
  grid-column: 1 / -1;
}

.portal-deploy-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 16px;
  align-items: start;
}

.portal-url-box {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.portal-url-box span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.portal-url-box a {
  color: var(--primary);
  overflow-wrap: anywhere;
  text-decoration: none;
}

.portal-page {
  min-height: 100vh;
  padding: 48px;
  background: linear-gradient(135deg, #f6faf8 0%, #eef6f2 100%);
}

.portal-shell {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 0.8fr);
  gap: 32px;
  align-items: center;
  min-height: calc(100vh - 96px);
  max-width: 1160px;
  margin: 0 auto;
}

.portal-main {
  display: grid;
  gap: 18px;
}

.portal-brand {
  color: var(--portal-accent, var(--primary));
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.portal-main h1 {
  margin: 0;
  color: #10231d;
  font-size: clamp(2rem, 6vw, 4.8rem);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.02;
}

.portal-main p {
  max-width: 620px;
  margin: 0;
  color: #475b53;
  font-size: 1.1rem;
  line-height: 1.65;
}

.portal-chat-card {
  min-height: 620px;
  position: relative;
}

.portal-private-note {
  display: grid;
  gap: 4px;
  max-width: 520px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.portal-private-note strong {
  color: #10231d;
}

.portal-private-note span {
  color: var(--muted);
}

.lead-settings label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.role-option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.role-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.permission-summary {
  display: grid;
  gap: 10px;
}

.permission-summary article {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.permission-summary strong,
.permission-summary span {
  display: block;
}

.permission-summary span {
  color: var(--muted);
  font-size: 0.9rem;
}

.settings-summary {
  display: grid;
  gap: 10px;
  margin: 0;
}

.settings-summary div {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.settings-summary dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.settings-summary dd {
  margin: 4px 0 0;
  white-space: pre-wrap;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.report-bar {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 2fr auto;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.report-bar div {
  height: 10px;
  border-radius: 999px;
  background: var(--surface-muted);
  overflow: hidden;
}

.report-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

@media (max-width: 900px) {
  .dashboard-layout,
  .widget-layout,
  .widget-editor-layout,
  .widget-test-layout,
  .bot-detail-layout,
  .operation-chat-layout,
  .rules-layout {
    grid-template-columns: 1fr;
  }

  .operation-chat-list {
    display: flex;
    max-height: none;
    overflow-x: auto;
    padding: 0 0 4px;
  }

  .operation-chat-tab {
    min-width: 240px;
  }

  .widget-preview-panel {
    position: static;
  }
}

.public-body {
  background: linear-gradient(180deg, #ffffff 0%, var(--app-bg) 100%);
}

.public-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 22px 20px;
}

.public-header nav {
  display: flex;
  align-items: center;
  gap: 14px;
}

.public-brand .brand-mark {
  width: 38px;
  height: 38px;
}

.public-content {
  max-width: 1120px;
  margin: 0 auto;
  padding: 60px 20px;
}

.public-content-auth {
  padding-top: 96px;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: static;
    height: auto;
    padding: 14px;
  }

  .side-nav {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
    margin-top: 14px;
    padding-bottom: 2px;
  }

  .app-header,
  .app-content {
    padding-left: 18px;
    padding-right: 18px;
  }

  .client-toolbar,
  .client-detail-layout,
  .portal-deploy-layout,
  .portal-shell,
  .widget-test-fields {
    grid-template-columns: 1fr;
  }

  .portal-page {
    padding: 28px 18px;
  }

  .portal-shell {
    min-height: calc(100vh - 56px);
  }

  .portal-chat-card {
    min-height: 520px;
  }

  .dashboard-metrics,
  .client-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bot-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .public-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-account {
    width: 100%;
    justify-content: space-between;
  }

  .account-button {
    width: 40px;
    height: 40px;
  }

  .client-metrics {
    grid-template-columns: 1fr;
  }

  .widget-install-panel {
    grid-template-columns: 1fr;
  }

  .install-actions {
    justify-content: flex-start;
  }

  .client-card-main,
  .client-card-footer,
  .client-detail-hero,
  .operation-chat-header,
  .operation-reply-row,
  .page-header {
    align-items: stretch;
    flex-direction: column;
  }

  .operation-reply-row {
    display: flex;
  }
}
