.settings-layout--wa {
  padding: 14px;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 14px;
  background: #f7fbff;
}

.settings-help--wa,
.wa-panel,
.wa-webhook-card,
.wa-integration-item,
.wa-form-section {
  border: 1px solid #dbe5f2;
  border-radius: 16px;
  background: #fff;
}

.settings-help--wa {
  padding: 16px;
  display: grid;
  align-content: start;
  gap: 14px;
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
}

.settings-guide-head {
  display: grid;
  gap: 6px;
}

.settings-guide-head strong,
.settings-hero-copy h2,
.wa-panel-head h3,
.wa-form-section-head strong,
.wa-webhook-card-head strong {
  color: #133f78;
}

.settings-guide-head p,
.settings-hero-copy p,
.wa-panel-head p,
.wa-form-section-head small,
.wa-webhook-card-head small,
.wa-inline-help,
.field-help {
  color: #627896;
}

.wa-checklist {
  display: grid;
  gap: 10px;
}

.wa-check-item {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid #e6eef8;
  border-radius: 14px;
  background: #f9fbff;
}

.wa-check-item.is-done {
  border-color: #cce5d7;
  background: #eefbf4;
}

.wa-check-index,
.wa-check-state,
.wa-status-chip,
.wa-badge,
.settings-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.wa-check-index {
  width: 34px;
  min-width: 34px;
  padding: 0;
  background: #e8f0ff;
  color: #20539f;
}

.wa-check-copy {
  display: grid;
  gap: 2px;
}

.wa-check-copy strong {
  color: #173e72;
}

.wa-check-copy small {
  color: #627896;
  line-height: 1.45;
}

.wa-check-state,
.wa-status-chip,
.wa-badge.is-muted {
  background: #f3f6fb;
  border: 1px solid #dbe5f2;
  color: #69809a;
}

.wa-status-chip.is-active,
.wa-badge.is-active {
  background: #e9f8ef;
  border: 1px solid #ccebd7;
  color: #0f6a3d;
}

.wa-status-chip.is-error,
.wa-badge.is-error {
  background: #fff3f3;
  border: 1px solid #f1cccc;
  color: #8a2626;
}

.wa-webhook-card {
  padding: 14px;
  display: grid;
  gap: 12px;
}

.wa-webhook-card-head,
.wa-panel-head,
.wa-integration-title-row,
.settings-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.wa-webhook-url {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.wa-webhook-url code {
  display: block;
  border: 1px solid #d7e4f6;
  border-radius: 12px;
  background: #f6faff;
  padding: 12px;
  color: #1f467e;
  word-break: break-all;
}

.wa-webhook-actions {
  display: grid;
  gap: 8px;
}

.wa-inline-help.is-ok {
  color: #186842;
}

.wa-inline-help.is-error {
  color: #9e3333;
}

.settings-main {
  display: grid;
  gap: 14px;
}

.settings-hero {
  padding: 18px;
  border: 1px solid #dbe5f2;
  border-radius: 18px;
  background: linear-gradient(135deg, #eef6ff 0%, #ffffff 65%);
}

.settings-hero-copy {
  display: grid;
  gap: 6px;
}

.settings-hero-copy h2 {
  margin: 0;
  font-size: 24px;
}

.settings-hero-copy p {
  margin: 0;
  max-width: 620px;
}

.settings-hero-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.settings-pill {
  background: #fff;
  border: 1px solid #d9e5f7;
  color: #1d4b88;
}

.wa-panel {
  padding: 16px;
  display: grid;
  gap: 14px;
}

.wa-panel-head h3 {
  margin: 0;
  font-size: 18px;
}

.wa-panel-head p {
  margin: 4px 0 0;
  font-size: 13px;
}

.wa-last-test {
  border-radius: 999px;
  border: 1px solid #dbe5f2;
  background: #f7fbff;
  color: #627896;
  padding: 8px 12px;
  font-size: 13px;
}

.wa-last-test.is-ok {
  background: #eefbf4;
  border-color: #cce5d7;
  color: #19613d;
}

.wa-last-test.is-error {
  background: #fff4f4;
  border-color: #efcccc;
  color: #9e3333;
}

.wa-integration-list {
  display: grid;
  gap: 12px;
}

.wa-integration-item {
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  box-shadow: 0 8px 20px rgba(17, 63, 135, 0.04);
}

.wa-integration-item.is-default {
  border-color: #bfd4fa;
  background: #f4f8ff;
}

.wa-integration-item.is-connected {
  border-left: 4px solid #2f9d62;
}

.wa-integration-item.is-pending {
  border-left: 4px solid #b38d1e;
}

.wa-integration-item.is-error {
  border-left: 4px solid #c94848;
}

.wa-integration-main {
  display: grid;
  gap: 6px;
}

.wa-integration-title-row h4 {
  margin: 0;
  font-size: 17px;
}

.wa-integration-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.wa-badge.is-default {
  background: #eef4ff;
  border: 1px solid #cddcff;
  color: #1b4f9c;
}

.wa-badge.is-usage {
  background: #fff9eb;
  border: 1px solid #f3dfac;
  color: #8a6410;
}

.wa-integration-phone {
  margin: 0;
  font-weight: 700;
  color: #1c355b;
}

.wa-integration-meta {
  margin: 0;
  color: #647a97;
  font-size: 13px;
}

.wa-integration-actions,
.actions-row,
.token-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

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

.wa-test-grid {
  align-items: end;
}

.wa-test-message {
  min-width: 0;
}

.wa-config-form {
  gap: 14px;
}

.wa-form-section {
  padding: 14px;
  display: grid;
  gap: 12px;
  background: #fbfdff;
}

.wa-form-section-head {
  display: grid;
  gap: 4px;
}

.field-help {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.45;
}

.token-field .token-input-wrap input {
  flex: 1 1 auto;
}

.wa-empty {
  border: 1px dashed #d7e2f1;
  border-radius: 14px;
  padding: 16px;
  color: #647a97;
  background: #f9fbff;
}

.btn-danger-soft {
  border-color: #f2c4c4;
  color: #a62f2f;
}

.btn-danger-soft:hover {
  background: #fff1f1;
}

.msg {
  margin: 0;
}

.msg.msg-ok,
.msg.msg-error {
  border-radius: 12px;
  padding: 10px 12px;
}

.msg.msg-ok {
  background: #eefbf4;
  border: 1px solid #c9e5d6;
  color: #1e5e3d;
}

.msg.msg-error {
  background: #fff3f3;
  border: 1px solid #f1cccc;
  color: #8a2626;
}

.checkbox-row {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
}

.role-banner {
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid #fee4a8;
  color: #7a5316;
  background: #fff8e8;
}

.hidden {
  display: none;
}

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

@media (max-width: 980px) {
  .wa-integration-item,
  .wa-test-grid,
  .wa-form-grid,
  .wa-webhook-url {
    grid-template-columns: 1fr;
  }
}

.wisphub-token-layout .settings-help {
  gap: 16px;
}

.wisphub-token-layout {
  grid-template-columns: 320px 1fr;
}

.wisphub-doc-grid {
  display: grid;
  gap: 12px;
}

.wisphub-doc-card,
.wisphub-mode-card,
.wisphub-log-item {
  border: 1px solid #dbe5f2;
  border-radius: 16px;
  background: #fff;
}

.wisphub-doc-card {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.wisphub-doc-accordion {
  padding: 0;
  overflow: hidden;
}

.wisphub-doc-accordion[open] {
  box-shadow: 0 10px 24px rgba(17, 63, 135, 0.05);
}

.wisphub-doc-accordion summary {
  list-style: none;
  cursor: pointer;
}

.wisphub-doc-accordion summary::-webkit-details-marker {
  display: none;
}

.wisphub-doc-head,
.wisphub-new-token-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.wisphub-doc-head {
  padding: 14px;
}

.wisphub-doc-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.wisphub-doc-card code,
.wisphub-doc-card pre {
  margin: 0 14px 14px;
  display: block;
  border: 1px solid #dce7f7;
  border-radius: 12px;
  background: #f7fbff;
  padding: 12px;
  color: #1f467e;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

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

.wisphub-token-stack {
  gap: 18px;
}

.wisphub-token-section {
  display: grid;
  gap: 14px;
  padding-top: 4px;
}

.wisphub-token-section + .wisphub-token-section {
  border-top: 1px solid #e7eef8;
  padding-top: 18px;
}

.wisphub-mode-card {
  padding: 14px;
  display: grid;
  gap: 6px;
  background: #fbfdff;
}

.wisphub-mode-card strong {
  color: #143f77;
}

.wisphub-mode-card p {
  margin: 0;
  color: #627896;
  line-height: 1.5;
}

.wisphub-mode-card.is-active {
  border-color: #bfd4fa;
  background: #eef5ff;
  box-shadow: 0 10px 24px rgba(29, 75, 136, 0.08);
}

.wisphub-mode-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
}

.wisphub-mode-badge.is-sandbox {
  background: #fff6db;
  color: #8c5b00;
  border: 1px solid #ffe2a0;
}

.wisphub-mode-badge.is-production {
  background: #eaf7ee;
  color: #1d6b44;
  border: 1px solid #ccebd8;
}

.wisphub-new-token {
  border-radius: 16px;
  padding: 14px;
  border: 1px solid #c9e5d6;
  background: #eefbf4;
  color: #1e5e3d;
  display: grid;
  gap: 8px;
}

.wisphub-new-token code {
  background: #fff;
  border: 1px solid #d7e6de;
  border-radius: 10px;
  padding: 10px 12px;
  word-break: break-all;
}

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

.wisphub-logs {
  display: grid;
  gap: 10px;
}

.wisphub-log-item {
  padding: 12px 14px;
  display: grid;
  gap: 4px;
}

.wisphub-log-item strong {
  color: #153d77;
}

.wisphub-log-item p {
  margin: 0;
  color: #5f7694;
  line-height: 1.45;
}

/* UX refresh 2026-05-03: settings-whatsapp */
.settings-layout--wa {
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 10px;
  background: #f4f7fc;
}

.settings-main {
  order: 1;
  gap: 12px;
}

.settings-help--wa {
  order: 2;
  padding: 12px;
  border-radius: 18px;
  background: #fff;
  display: none;
}

.settings-hero {
  padding: 14px 16px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #dce6f4;
}

.settings-hero-copy h2 {
  font-size: 36px;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: #122f60;
}

.settings-hero-copy p {
  font-size: 19px;
  color: #5c7292;
}

.settings-hero-pills {
  display: none;
}

.wa-panel {
  border-radius: 16px;
  border: 1px solid #dce6f4;
  background: #fff;
  padding: 14px;
}

.wa-panel-head h3 {
  font-size: 32px;
  color: #102f60;
}

.wa-panel-head p {
  font-size: 18px;
  color: #5e7392;
}

.wa-panel-head .btn {
  min-height: 44px;
  border-radius: 12px;
  padding-inline: 18px;
  font-size: 16px;
  font-weight: 800;
}

.wa-integration-list {
  gap: 10px;
}

.wa-integration-item {
  border-radius: 14px;
  padding: 14px;
  grid-template-columns: auto 1fr auto;
}

.wa-integration-logo-wrap {
  width: 58px;
  height: 58px;
  border-radius: 999px;
  background: #eaf9ef;
  border: 1px solid #cdebd9;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: start;
}

.wa-integration-logo {
  width: 100px;
  height: 100px;
  object-fit: contain;
}

.wa-integration-title-row h4 {
  font-size: 18px;
  color: #123768;
}

.wa-integration-phone {
  font-size: 34px;
  line-height: 1.08;
  color: #0f2f62;
}

.wa-integration-meta {
  font-size: 16px;
}

.wa-integration-kpis {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.wa-integration-kpis span {
  display: block;
  font-size: 12px;
  color: #6980a0;
}

.wa-integration-kpis strong {
  color: #183a6a;
  font-size: 16px;
}

.wa-panel-head-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.wa-integration-actions .btn {
  min-height: 38px;
  border-radius: 10px;
}

.settings-guide-head {
  border-bottom: 1px solid #e7eef8;
  padding-bottom: 10px;
}

.settings-guide-head strong {
  font-size: 24px;
  color: #123668;
}

.settings-guide-head p {
  font-size: 16px;
  color: #607895;
}

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

.wa-check-item {
  grid-template-columns: 30px 1fr;
  align-items: start;
  gap: 10px;
  min-height: 180px;
  border-radius: 14px;
  padding: 12px;
}

.wa-check-state {
  display: none;
}

.wa-check-index {
  width: 30px;
  min-width: 30px;
  min-height: 30px;
  font-size: 14px;
}

.wa-check-copy strong {
  font-size: 20px;
}

.wa-check-copy small {
  font-size: 14px;
}

.wa-webhook-card {
  border-radius: 14px;
  padding: 12px;
  margin-top: 2px;
}

.wa-webhook-card-head strong {
  font-size: 20px;
}

.wa-webhook-url code {
  min-height: 48px;
  display: flex;
  align-items: center;
  font-size: 13px;
}

.wa-webhook-actions .btn {
  min-height: 40px;
  border-radius: 10px;
}

.wa-test-grid {
  grid-template-columns: 1.2fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.wa-test-grid .field input,
.wa-test-grid .field select {
  min-height: 44px;
}

.wa-last-test {
  margin-top: 6px;
}

.wa-integration-item--skeleton {
  border-left: none;
}

.wa-skel {
  background: linear-gradient(90deg, #eef3fb 20%, #dfe9f7 38%, #eef3fb 56%);
  background-size: 220% 100%;
  animation: waSkel 1.1s linear infinite;
  border-radius: 10px;
}

.wa-skel-circle {
  width: 58px;
  height: 58px;
  border-radius: 999px;
}

.wa-skel-line {
  height: 14px;
  margin-bottom: 8px;
}

.wa-skel-line-lg {
  height: 22px;
  width: 48%;
}

@keyframes waSkel {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (max-width: 1260px) {
  .wa-checklist {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 860px) {
  .wa-checklist,
  .wa-test-grid {
    grid-template-columns: 1fr;
  }

  .wa-integration-item {
    grid-template-columns: 1fr;
  }

  .wa-integration-kpis {
    grid-template-columns: 1fr 1fr;
  }
}

.wa-modal-card {
  width: min(1420px, calc(100vw - 28px));
}

.wa-modal-wizard {
  display: block;
}

.wa-modal-step {
  display: none;
  padding: 12px;
  border: 1px solid #dce6f4;
  border-radius: 12px;
  gap: 10px;
  align-content: start;
}

.wa-modal-step.is-active {
  display: grid;
}

.wa-modal-step h4 {
  margin: 0;
  color: #123768;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
}

.wa-modal-step h4 span {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #1f67d8;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.wa-modal-step .field input,
.wa-modal-step .field select {
  min-height: 38px;
}

.wa-modal-ok {
  border: 1px solid #cce5d7;
  background: #eefbf4;
  color: #1a6c43;
  border-radius: 10px;
  padding: 10px;
  font-size: 13px;
}

@media (max-width: 1320px) {
  .wa-modal-wizard {
    display: block;
  }
}

@media (max-width: 860px) {
  .wa-modal-wizard {
    display: block;
  }
}

.wisphub-log-item small {
  color: #7a8ea8;
}

@media (max-width: 980px) {
  .wisphub-mode-grid {
    grid-template-columns: 1fr;
  }

  .wisphub-token-layout {
    grid-template-columns: 1fr;
  }
}

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

.openai-help-steps {
  margin: 0;
  padding: 10px 0 0;
  list-style: none;
  display: grid;
  gap: 14px;
  position: relative;
}

.openai-help-steps::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 22px;
  bottom: 18px;
  width: 2px;
  background: #d8e6fb;
}

.openai-help-steps li {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  align-items: start;
  color: #2b4974;
  line-height: 1.45;
}

.openai-help-steps .step-bullet {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #1f76ff;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  position: relative;
  z-index: 1;
}

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

.openai-result {
  border-radius: 14px;
  border: 1px solid #d5e5ff;
  background: #f5f9ff;
  padding: 14px;
  display: grid;
  gap: 8px;
  min-height: 150px;
}

.openai-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.openai-result pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: #193f74;
  line-height: 1.45;
  min-height: 64px;
}

@media (max-width: 720px) {
  .openai-grid-2 {
    grid-template-columns: 1fr;
  }
}
