/* ============================================================
   The Tech Pad — Web Chat setup page (/wa/webchat) styles
   LIGHT theme only: cards #fff, borders #dfe6e2/#c3d2cb,
   text #14231e, muted #74827c, accent green #128c7e.
   ============================================================ */

/* Route chrome: /wa/webchat is an unknown route to the app router, so it falls
   back to "overview" — the overview content (connected-banner, .metrics,
   .dashboard-grid) renders alongside our card and the fallback "Overview" nav
   item lights up too. Hide every non-topbar child of .dashboard except the
   webchat card (same pattern as body.ref-route in referrals-ui.css). */
body.wc-route .dashboard > :not(header):not(#wc-root) { display: none !important; }

/* neutralize the fallback Overview active state so only Web Chat stays active */
body.wc-route aside.sidebar nav button.active,
body.wc-route aside.sidebar nav a.active:not(.wc-nav-item) {
  background: transparent;
  color: #a9c0b8;
}

#wc-root.ttp-webchat {
  align-self: flex-start;
  max-width: 920px;
  width: 100%;
}

.wc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.wc-head h2 { margin: 2px 0 4px; color: #14231e; }
.wc-head p { margin: 0; color: #41544c; max-width: 640px; }

/* status pill */
.wc-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f1f5f3;
  border: 1px solid #dfe6e2;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #0f6b5f;
  cursor: pointer;
  white-space: nowrap;
}
.wc-status input { accent-color: #128c7e; cursor: pointer; }

/* KPI strip */
.wc-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.wc-kpi {
  background: #fafcfb;
  border: 1px solid #dfe6e2;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.wc-kpi b { font-size: 22px; color: #14231e; }
.wc-kpi span { font-size: 12px; color: #74827c; }

/* cards */
.wc-card {
  background: #fff;
  border: 1px solid #dfe6e2;
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 14px;
}
.wc-card h3 {
  margin: 0 0 4px;
  font-size: 15px;
  color: #14231e;
}
.wc-card > .wc-hint { margin: 4px 0 12px; }

.wc-field { margin: 12px 0; }
.wc-field > label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #14231e;
  margin-bottom: 3px;
}
.wc-hint { font-size: 12px; color: #74827c; margin: 2px 0 6px; }

.wc-input {
  width: 100%;
  max-width: 460px;
  box-sizing: border-box;
  border: 1px solid #c3d2cb;
  border-radius: 9px;
  padding: 8px 11px;
  font: inherit;
  font-size: 14px;
  color: #14231e;
  background: #fff;
  outline: none;
}
.wc-input:focus { border-color: #128c7e; box-shadow: 0 0 0 2px rgba(18, 140, 126, .14); }
textarea.wc-input { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
input.wc-color { max-width: 90px; padding: 3px 6px; height: 38px; cursor: pointer; }

.wc-snippet { background: #f6f8f7; }

.wc-btn {
  display: inline-block;
  border: 1px solid #128c7e;
  background: #128c7e;
  color: #fff;
  border-radius: 9px;
  padding: 8px 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  margin-top: 8px;
}
.wc-btn:hover { background: #0f6b5f; border-color: #0f6b5f; }
.wc-btn-ghost {
  background: #fff;
  color: #41544c;
  border-color: #c3d2cb;
  margin-left: 10px;
}
.wc-btn-ghost:hover { background: #f1f5f3; color: #14231e; border-color: #9bada6; }
.wc-btn-ghost.danger { color: #b3261e; border-color: #e5b8b5; }
.wc-btn-ghost.danger:hover { background: #fdf3f2; }

.wc-actions { display: flex; gap: 10px; align-items: center; }
.wc-save { margin-top: 0; min-width: 150px; }

/* chips (pre-chat fields) */
.wc-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 10px; }
.wc-chip {
  border: 1px solid #c3d2cb;
  background: #fff;
  color: #41544c;
  border-radius: 999px;
  padding: 6px 14px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.wc-chip.on { background: #e3f5ee; border-color: #128c7e; color: #0f6b5f; font-weight: 600; }

.wc-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #41544c;
  cursor: pointer;
  margin-top: 4px;
}
.wc-check input { accent-color: #128c7e; }

/* business hours */
.wc-hours {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 8px 18px;
  margin-top: 8px;
}
.wc-hour-row { display: flex; align-items: center; gap: 8px; }
.wc-hour-day { font-size: 13px; color: #41544c; width: 66px; }
.wc-hour {
  border: 1px solid #c3d2cb;
  border-radius: 8px;
  padding: 5px 8px;
  font: inherit;
  font-size: 13px;
  color: #14231e;
  background: #fff;
}
.wc-hour:focus { border-color: #128c7e; outline: none; }

/* toast */
.wc-toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translate(-50%, 14px);
  background: #0d2b22;
  color: #dff5eb;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 2147483100;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  pointer-events: none;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .25);
}
.wc-toast.show { opacity: 1; transform: translate(-50%, 0); }
.wc-toast.err { background: #7a1f1a; color: #ffe9e6; }

.wc-loading, .wc-error { padding: 22px; color: #74827c; font-size: 14px; }
.wc-error { color: #b3261e; }

/* ---- sidebar nav icon (matches the app's .nav-glyph treatment) ---- */
.wc-nav-glyph { display: grid; place-items: center; flex: 0 0 20px; }
.wc-nav-glyph svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---- webhooks card ---- */
.wc-wh-list { display: grid; gap: 10px; margin: 12px 0; }
.wc-wh-row {
  display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap;
  border: 1px solid #dfe6e2; border-radius: 11px; padding: 12px 14px; background: #fafcfb;
}
.wc-wh-main { min-width: 0; flex: 1; }
.wc-wh-main code {
  display: block; font-size: 12.5px; color: #14231e; word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.wc-wh-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.wc-wh-chips .wc-chip { font-size: 11px; padding: 3px 9px; }
.wc-wh-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wc-wh-acts .wc-btn { margin-top: 0; padding: 6px 11px; font-size: 12px; }
.wc-wh-add {
  border: 1px dashed #c3d2cb; border-radius: 11px; padding: 14px 16px; margin: 12px 0;
  background: #f6f8f7; display: grid; gap: 8px;
}
.wc-wh-add > label { font-size: 12px; font-weight: 600; color: #14231e; }
.wc-wh-events { display: flex; gap: 8px 18px; flex-wrap: wrap; margin: 4px 0 2px; }
.wc-wh-events .wc-check { font-size: 12px; }
.wc-wh-add .wc-btn { margin-top: 4px; width: max-content; }
.wc-wh-secret {
  border: 1px solid #f0c7bb; background: #fff8f6; border-radius: 11px; padding: 12px 14px;
  margin: 0 0 12px; display: none;
}
.wc-wh-secret.show { display: block; }
.wc-wh-secret b { font-size: 13px; color: #14231e; }
.wc-wh-secret-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.wc-wh-secret-row .wc-input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.wc-wh-secret-row .wc-btn { margin-top: 0; white-space: nowrap; }
.wc-wh-logs { display: grid; gap: 6px; margin-top: 8px; }
.wc-wh-logs-h { font-size: 12px; color: #41544c; margin: 6px 0 2px; }
.wc-wh-log {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  font-size: 11.5px; color: #41544c; background: #fafcfb; border: 1px solid #e4eae7;
  border-radius: 8px; padding: 7px 10px;
}
.wc-wh-log.err { background: #fff8f6; border-color: #f0c7bb; }
.wc-wh-ev { font-weight: 700; color: #14231e; min-width: 130px; }
.wc-wh-st { color: #0f6b5f; font-weight: 600; }
.wc-wh-log.err .wc-wh-st { color: #b3261e; }
.wc-wh-ms, .wc-wh-at { color: #74827c; }
.wc-wh-log small { width: 100%; color: #74827c; font-size: 11px; word-break: break-word; }

@media (max-width: 760px) {
  .wc-head { flex-direction: column; }
  .wc-input { max-width: 100%; }
  .wc-wh-row { flex-direction: column; align-items: stretch; }
}

/* branding: per-domain "Remove the Tech Pad link" ($10 one-time) */
.wc-badge-list { display: grid; gap: 8px; margin-top: 4px; }
.wc-badge-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: #fafcfb; border: 1px solid #e4eae7; border-radius: 10px; padding: 10px 12px;
}
.wc-badge-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wc-badge-info b { font-size: 13px; color: #14231e; word-break: break-word; }
.wc-badge-info span { font-size: 12px; }
.wc-badge-free { color: #a06a1f; }
.wc-badge-paid { color: #0f6b5f; font-weight: 600; }
.wc-badge-buy { white-space: nowrap; }
.wc-badge-row .wc-btn[disabled] { opacity: .65; cursor: default; }
@media (max-width: 760px) {
  .wc-badge-row { flex-direction: column; align-items: stretch; }
  .wc-badge-row .wc-btn { width: 100%; }
}
