/* WhatsApp API Messaging hub — AiSensy / WATI-style pages */
.wa-api { font-size: 14px; }
.wa-api .wa-guide {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 22px;
  margin-bottom: 22px;
}
.wa-api .wa-guide h3 { margin: 0 0 4px; font-size: 14.5px; font-weight: 700; }
.wa-api .wa-guide p { margin: 0; font-size: 12.5px; color: var(--muted); }

.wa-api .wa-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  margin-bottom: 18px;
}
.wa-api .wa-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.wa-api .wa-card-head h3 { font-size: 15px; margin: 0; font-weight: 700; }
.wa-api .wa-card-head .wa-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.wa-api .wa-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.wa-api .wa-search {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 13px;
  font-size: 13px;
  min-width: 200px;
  flex: 1;
  max-width: 320px;
}
.wa-api .wa-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.wa-api .wa-filters select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 11px;
  font-family: var(--mono);
  font-size: 11.5px;
  background: var(--card);
}

.wa-api .wa-tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.wa-api .wa-tab-btn {
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
}
.wa-api .wa-tab-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.wa-api .wa-pill {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 3px 9px;
  border-radius: 14px;
  display: inline-block;
  font-weight: 500;
}
.wa-api .wa-pill.live { background: var(--green-bg); color: var(--green); }
.wa-api .wa-pill.review { background: var(--amber-bg); color: var(--amber); }
.wa-api .wa-pill.rejected { background: var(--red-bg); color: var(--red); }
.wa-api .wa-pill.draft { background: var(--grey-bg); color: var(--muted); }
.wa-api-modal-overlay .wa-pill {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 3px 9px;
  border-radius: 14px;
  display: inline-block;
  font-weight: 500;
}
.wa-api-modal-overlay .wa-pill.live { background: var(--green-bg); color: var(--green); }
.wa-api-modal-overlay .wa-pill.review { background: var(--amber-bg); color: var(--amber); }
.wa-api-modal-overlay .wa-pill.rejected { background: var(--red-bg); color: var(--red); }
.wa-api-modal-overlay .wa-pill.draft { background: var(--grey-bg); color: var(--muted); }
.wa-api .wa-pill.marketing { background: #FDEFE2; color: #B5631B; }
.wa-api .wa-pill.utility { background: var(--brand-light); color: var(--brand); }

.wa-api table { width: 100%; border-collapse: collapse; font-size: 13px; }
.wa-api th, .wa-api td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.wa-api th {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  font-weight: 500;
}
.wa-api .wa-row-actions { display: flex; gap: 10px; color: var(--muted); font-size: 13px; }
.wa-api .wa-row-actions button {
  background: none;
  border: none;
  color: var(--brand);
  font-size: 13px;
  padding: 0;
  cursor: pointer;
}
.wa-api .wa-row-actions button:hover { text-decoration: underline; }

.wa-api .wa-stat-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.wa-api .wa-stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  flex: 1;
  min-width: 140px;
}
.wa-api .wa-stat .n { font-size: 24px; font-weight: 800; }
.wa-api .wa-stat .l {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-top: 4px;
}

.wa-api .wa-window-rail { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .wa-api .wa-window-rail { grid-template-columns: 1fr; } }
.wa-api .wa-window-card h4 { font-size: 14.5px; margin: 0 0 4px; }
.wa-api .wa-window-card .wa-sub { font-family: var(--mono); font-size: 10.5px; color: var(--muted); margin-bottom: 14px; }
.wa-api .wa-clockbar {
  height: 12px;
  border-radius: 7px;
  overflow: hidden;
  display: flex;
  border: 1px solid var(--border);
}
.wa-api .wa-clockbar .free { background: var(--green); flex: 24; }
.wa-api .wa-clockbar .paid { background: #C2622A; flex: 0; }
.wa-api .wa-window-card.paid-window .wa-clockbar .free { flex: 0; }
.wa-api .wa-window-card.paid-window .wa-clockbar .paid { flex: 24; }
.wa-api .wa-clock-labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  margin-top: 6px;
}

.wa-api .wa-toggle {
  width: 38px;
  height: 22px;
  border-radius: 12px;
  background: #DAD3F5;
  position: relative;
  cursor: pointer;
  display: inline-block;
  flex-shrink: 0;
  border: none;
  padding: 0;
}
.wa-api .wa-toggle.on { background: var(--brand); }
.wa-api .wa-toggle::after {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: .15s;
}
.wa-api .wa-toggle.on::after { left: 19px; }

.wa-api .wa-setting-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.wa-api .wa-setting-row:last-child { border-bottom: none; }
.wa-api .wa-setting-row .label { font-weight: 700; font-size: 14px; }
.wa-api .wa-setting-row .desc { font-size: 12px; color: var(--muted); margin-top: 4px; max-width: 480px; }

.wa-api .wa-chip-input { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.wa-api .wa-chip {
  background: var(--brand-light);
  color: var(--brand);
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 6px 12px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.wa-api .wa-chip button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}

.wa-api .wa-create-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 900px) { .wa-api .wa-create-grid { grid-template-columns: 1fr; } }
.wa-api .wa-field { margin-bottom: 18px; }
.wa-api .wa-field h4 { font-size: 13px; margin: 0 0 4px; }
.wa-api .wa-field .fhint { font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.wa-api .wa-field input,
.wa-api .wa-field select,
.wa-api .wa-field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 13px;
  background: var(--bg);
}
.wa-api .wa-field textarea { min-height: 100px; resize: vertical; }

.wa-api .wa-phone-frame {
  background: #ECE5DD;
  border-radius: 16px;
  padding: 20px;
  min-height: 200px;
}
.wa-api .wa-bubble {
  background: #fff;
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
  max-width: 280px;
}
.wa-api .wa-bubble .wa-body { font-size: 13px; white-space: pre-wrap; }
.wa-api .wa-actions { display: flex; flex-direction: column; border-top: 1px solid var(--border); margin-top: 8px; }
.wa-api .wa-action {
  text-align: center;
  color: var(--blue);
  font-size: 13px;
  padding: 8px;
  border-bottom: 1px solid var(--border);
}
.wa-api .wa-action:last-child { border-bottom: none; }

.wa-api .wa-back-row {
  font-size: 13px;
  color: var(--brand);
  cursor: pointer;
  margin-bottom: 18px;
  display: inline-block;
}
.wa-api .wa-back-row:hover { text-decoration: underline; }

.wa-api .wa-lang-tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }

.wa-api .wa-empty { text-align: center; padding: 40px 20px; color: var(--muted); }

.wa-api .wa-btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Create / edit pages (AiSensy / WATI style) */
.wa-api .wa-create-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.wa-api .wa-back-row {
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  margin-bottom: 0;
}
.wa-api .wa-back-row:hover { color: var(--brand); text-decoration: none; }
.wa-api .wa-wcc {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}
.wa-api .wa-wcc strong { color: var(--text); }

.wa-api .wa-create-grid {
  grid-template-columns: 1fr 320px;
  align-items: start;
}
.wa-api .wa-create-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 26px;
}
.wa-api .wa-field-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 980px) {
  .wa-api .wa-create-grid { grid-template-columns: 1fr; }
  .wa-api .wa-field-pair { grid-template-columns: 1fr; }
}
.wa-api .wa-field h4 { font-size: 14.5px; font-weight: 700; }
.wa-api .wa-field .fhint { line-height: 1.5; margin-bottom: 10px; }
.wa-api .wa-charcount {
  text-align: right;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--faint);
  margin-top: 4px;
}
.wa-api .wa-mono { font-family: var(--mono); color: var(--brand); }
.wa-api .wa-opt { font-weight: 400; color: var(--faint); font-size: 12px; }
.wa-api .wa-badge-premium {
  font-family: var(--mono);
  font-size: 9.5px;
  background: var(--brand-light);
  color: var(--brand);
  padding: 2px 8px;
  border-radius: 10px;
  vertical-align: middle;
}
.wa-api .wa-radio-row {
  display: flex;
  gap: 20px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.wa-api .wa-radio-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}
.wa-api .wa-ia-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.wa-api .wa-ia-btn {
  font-family: var(--mono);
  font-size: 11.5px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  padding: 9px 13px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.wa-api .wa-ia-btn:disabled { opacity: .4; cursor: not-allowed; }
.wa-api .wa-ia-count {
  background: var(--brand-light);
  color: var(--brand);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 10px;
}
.wa-api .wa-create-preview {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  position: sticky;
  top: 20px;
}
.wa-api .wa-create-preview h4 { font-size: 14.5px; margin: 0 0 4px; }
@media (max-width: 980px) { .wa-api .wa-create-preview { position: static; } }
.wa-api .wa-phone-frame {
  margin-top: 14px;
  background: linear-gradient(160deg, #DCD3FF, #F3EFFF);
  border-radius: 16px;
  padding: 22px 14px;
  display: flex;
  justify-content: center;
}
.wa-api .wa-bubble {
  border-radius: 10px 10px 10px 2px;
  width: 100%;
  max-width: 230px;
  box-shadow: 0 2px 8px rgba(40, 30, 90, .12);
}
.wa-api .wa-header {
  height: 60px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--brand-light), #fff);
  border: 1px dashed var(--brand);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-bottom: 9px;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--brand);
  text-align: center;
}
.wa-api .wa-header span:first-child { font-size: 18px; }
.wa-api .wa-footer {
  font-size: 10.5px;
  color: var(--faint);
  margin-top: 8px;
}
.wa-api .wa-action {
  font-size: 11.5px;
  color: var(--brand);
  font-weight: 600;
  border-radius: 6px;
  background: var(--brand-light);
  border-bottom: none;
  margin-top: 4px;
}
.wa-api .wa-disclaimer {
  font-size: 10.5px;
  color: var(--faint);
  margin-top: 12px;
  line-height: 1.5;
}
.wa-api .wa-field-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.wa-api .wa-form-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.wa-api .wa-status-msg {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}

/* Template v6 — buttons & table actions */
.wa-api .wa-btn-solid,
.wa-api .wa-btn-ghost {
  font-family: var(--mono);
  font-size: 12px;
  padding: 9px 15px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--brand);
}
.wa-api .wa-btn-solid { background: var(--brand); color: #fff; }
.wa-api .wa-btn-ghost { background: #fff; color: var(--brand); }
.wa-api .wa-row-actions span {
  cursor: pointer;
  color: var(--brand);
}
.wa-api .wa-row-actions span:hover { text-decoration: underline; }

.wa-api .wa-draft-preview {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}
@media (max-width: 880px) { .wa-api .wa-draft-preview { grid-template-columns: 1fr; } }
.wa-api .wa-draft-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-size: 12.5px;
  background: var(--brand-light);
}
.wa-api .wa-draft-card .dlang {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--brand);
  margin-bottom: 6px;
  text-transform: uppercase;
}

/* Template journey modal */
.wa-api-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(27, 23, 48, .45);
  z-index: 1200;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.wa-api-modal-overlay.open { display: flex; }
.wa-api-modal-box {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 760px;
  max-height: 88vh;
  overflow-y: auto;
}
.wa-api-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 26px;
  border-bottom: 1px solid var(--border);
}
.wa-api-modal-name {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  margin-right: 10px;
}
.wa-api-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 16px;
}
.wa-api-modal-body {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 26px;
  padding: 26px;
}
@media (max-width: 680px) { .wa-api-modal-body { grid-template-columns: 1fr; } }
.wa-api-modal-left h4 { font-size: 14.5px; margin: 0 0 16px; }
.wa-journey-step { display: flex; gap: 14px; align-items: flex-start; }
.wa-journey-icon {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand-light); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
}
.wa-journey-icon.ok { background: var(--green-bg); color: var(--green); }
.wa-journey-icon.review { background: var(--amber-bg); color: var(--amber); }
.wa-journey-icon.rejected { background: var(--red-bg); color: var(--red); }
.wa-journey-icon.pending { background: var(--grey-bg); color: var(--muted); }
.wa-journey-label { font-weight: 700; font-size: 13.5px; }
.wa-journey-date { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 2px; }
.wa-journey-line { width: 1px; height: 22px; background: var(--border); margin-left: 14.5px; }
.wa-api-modal-right { display: flex; justify-content: center; }
.wa-api-modal-overlay .wa-footer {
  font-size: 10.5px;
  color: var(--faint);
  margin-top: 8px;
}
.wa-api-modal-overlay .wa-body {
  font-size: 12.5px;
  white-space: pre-wrap;
  line-height: 1.45;
}
.wa-api-lock-note {
  margin-top: 18px;
  background: #FCEDE2;
  color: #C2622A;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.5;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
