/* ============================================================
   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; }

/* CSP recipe panel (RAV-39) — the measured directive set an embed behind a
   Content-Security-Policy needs, plus which directive breaks what. */
.wc-csp { margin: 10px 0 2px; padding: 10px 12px; border: 1px solid #e4eae7; border-radius: 10px; background: #fbfdfc; }
.wc-csp-h { cursor: pointer; font-weight: 600; font-size: 13.5px; color: #14231e; }
.wc-csp[open] .wc-csp-h { margin-bottom: 6px; }
.wc-csp-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.wc-csp-list { margin: 8px 0 4px; padding-left: 16px; font-size: 12.5px; line-height: 1.7; color: #43514c; }
.wc-csp-list code { background: #eef2f0; padding: 1px 5px; border-radius: 5px; font-size: 12px; color: #0e6f63; }

.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%; }
}

/* Sales AI / offers / shops (0052) */
.wc-shop-row{display:flex;flex-direction:column;gap:8px;border:1px solid var(--line,#dfe6e2);border-radius:10px;padding:10px 12px;margin-bottom:8px;background:#fafcfb}
.wc-shop-meta{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.wc-shop-domain{font-size:13px;color:#14231e}
.wc-pill{font-size:11px;font-weight:600;color:#74827c;background:#eef2f0;border:1px solid #dfe6e2;border-radius:20px;padding:2px 9px;white-space:nowrap}
.wc-pill.on{color:#0d6b4d;background:#e2f4ea;border-color:#b9e4cd}
.wc-shop-acts{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.wc-sftok{flex:1;min-width:220px;font-family:ui-monospace,Menlo,Consolas,monospace;font-size:12.5px}
.wc-off-grid{display:flex;flex-direction:column;gap:8px;margin:6px 0}
.wc-off-code{max-width:220px}
.wc-sf-help summary{cursor:pointer;font-size:12.5px;color:#128c7e;margin:2px 0 6px}
.wc-sf-help .wc-hint{margin-top:4px;padding:8px 10px;background:#f1f7f4;border-radius:8px}
.wc-offactive{margin-bottom:8px}
.wc-ordhint{padding:8px 10px;background:#f1f7f4;border-radius:8px}

/* Webchat activation panel (channel-aware admin, 2026-09-05) */
.wc-activate{border:1px dashed #b9cdc6;border-radius:12px;padding:22px 24px;background:#f4faf7;max-width:640px;display:flex;flex-direction:column;gap:12px;align-items:flex-start}
.wc-activate-copy b{font-size:15px;color:#0d3025}
.wc-activate-copy p{margin:6px 0 0;font-size:13.5px;color:#41544c;line-height:1.55}
.wc-activate-btn{margin-top:2px}

/* ============================================================
   Web Chat settings — organized layout refresh (2026-09-05)
   Hero header + collapsible groups + sticky save bar.
   ============================================================ */
#wc-root { max-width: 1000px; }

/* ---- page hero ---- */
.wc-head { align-items: flex-end; padding: 6px 2px 4px; }
.wc-head-l { max-width: 660px; }
.wc-head-l .wc-kicker {
  display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .12em;
  color: #0f6b5f; background: #e3f5ee; border: 1px solid #bfe3d6; border-radius: 999px;
  padding: 3px 10px; margin-bottom: 8px;
}
.wc-head-l h2 { font-size: 24px; letter-spacing: -.01em; }
.wc-head-l p { font-size: 13.5px; line-height: 1.55; }
.wc-head-r { display: flex; align-items: center; gap: 10px; }

/* ---- live/paused toggle switch ---- */
.wc-status {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  background: #f1f5f3; border: 1px solid #dfe6e2; border-radius: 999px;
  padding: 6px 8px 6px 12px; font-size: 13px; font-weight: 600; color: #0f6b5f;
  cursor: pointer; white-space: nowrap; transition: background .15s;
}
.wc-status .wc-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #1db954; box-shadow: 0 0 0 3px rgba(29,185,84,.18); }
.wc-status.paused { color: #6b5a2c; }
.wc-status.paused .wc-status-dot { background: #c9a227; box-shadow: 0 0 0 3px rgba(201,162,39,.18); }
.wc-status input { position: absolute; opacity: 0; pointer-events: none; }
.wc-status .wc-status-sw {
  width: 34px; height: 20px; border-radius: 999px; background: #c3d2cb; position: relative;
  transition: background .15s; flex: 0 0 auto;
}
.wc-status .wc-status-sw::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: left .15s;
}
.wc-status input:checked + .wc-status-sw { background: #128c7e; }
.wc-status input:checked + .wc-status-sw::after { left: 16px; }

/* ---- one-step-from-live nudge ---- */
.wc-ready {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: linear-gradient(90deg, #f4faf7, #eaf6f1); border: 1px solid #bfe3d6;
  border-radius: 12px; padding: 10px 14px; margin: 14px 0 16px;
}
.wc-ready-ic { font-size: 16px; }
.wc-ready-t { flex: 1; min-width: 220px; font-size: 13px; color: #0d3025; }
.wc-ready-btn { margin-top: 0; padding: 6px 14px; font-size: 13px; }

/* ---- KPI strip ---- */
.wc-kpis { margin: 4px 0 18px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.wc-kpi {
  background: #fff; border: 1px solid #dfe6e2; border-radius: 14px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 3px; box-shadow: 0 1px 2px rgba(13,45,37,.04);
}
.wc-kpi b { font-size: 26px; letter-spacing: -.02em; }
.wc-kpi span { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #83918b; }

/* ---- collapsible group cards ---- */
.wc-card.wc-group { padding: 0; overflow: hidden; border-radius: 14px; background: #fff; box-shadow: 0 1px 2px rgba(13,45,37,.04); }
.wc-group-h {
  display: flex; align-items: center; gap: 12px; list-style: none; cursor: pointer;
  padding: 13px 16px; user-select: none; background: #fff; border-bottom: 1px solid transparent;
}
.wc-group-h::-webkit-details-marker { display: none; }
.wc-group-h:hover { background: #f7faf9; }
.wc-group[open] > .wc-group-h { border-bottom-color: #e8eeeb; }
.wc-group-icon {
  flex: 0 0 34px; width: 34px; height: 34px; display: grid; place-items: center;
  background: #eef4f1; border: 1px solid #dde9e4; border-radius: 10px; font-size: 16px;
}
.wc-group-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.wc-group-t b { font-size: 14px; color: #14231e; }
.wc-group-t small { font-size: 12px; color: #83918b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wc-group-chev { flex: 0 0 auto; color: #9bada6; transition: transform .18s; display: grid; place-items: center; }
.wc-group-chev svg { width: 18px; height: 18px; }
.wc-group[open] > .wc-group-h .wc-group-chev { transform: rotate(180deg); }
.wc-group > *:not(.wc-group-h) { margin-left: 62px; margin-right: 18px; }
.wc-group > .wc-hint:not(.wc-group-h) { margin-left: 62px; margin-top: 14px; }
/* install card content wider (the snippet is the star) */
#wc-g-install > *:not(.wc-group-h) { margin-left: 18px; margin-right: 18px; }
#wc-g-install > .wc-field { margin-left: 18px; }
.wc-group > .wc-field:first-of-type { margin-top: 16px; }
.wc-group > .wc-field:last-child { margin-bottom: 6px; }
.wc-group > .wc-field { margin-left: 62px; }
.wc-group > .wc-btn-ghost, .wc-group > .wc-btn:not(.wc-group-h) { margin-left: 62px; margin-bottom: 14px; }
.wc-group > .wc-hint { margin-left: 62px; }

/* textarea snippet */
.wc-snippet { font-size: 12.5px; line-height: 1.6; margin-top: 2px; }
#wc-g-install textarea.wc-input, #wc-g-install .wc-snippet { margin-left: 0 !important; }

/* inputs: slightly softer */
.wc-input { border-radius: 10px; }
.wc-field > label { font-size: 13px; }
.wc-hint { line-height: 1.5; }

/* ---- sticky save bar ---- */
.wc-actions {
  position: sticky; bottom: 12px; z-index: 5; margin-top: 18px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border: 1px solid #d8e3de; border-radius: 14px; padding: 10px 12px;
  box-shadow: 0 6px 22px rgba(13,45,37,.08);
}
.wc-actions-note { flex: 1; min-width: 160px; font-size: 11.5px; color: #83918b; }
.wc-actions .wc-save { min-width: 130px; margin-left: auto; }
.wc-actions .wc-btn { margin-top: 0; }

/* webhook rows / badge rows keep full width inside their group */
.wc-group .wc-wh-list, .wc-group .wc-badge-list, .wc-group .wc-wh-logs, .wc-group .wc-wh-add { margin-left: 18px; margin-right: 18px; }
.wc-group .wc-shop-row, .wc-group .wc-off-grid, .wc-group .wc-hours { margin-left: 18px; margin-right: 18px; }

@media (max-width: 760px) {
  .wc-head { align-items: flex-start; }
  .wc-head-r { width: 100%; justify-content: space-between; }
  .wc-group > *:not(.wc-group-h) { margin-left: 16px; margin-right: 14px; }
  .wc-group > .wc-field, .wc-group > .wc-btn:not(.wc-group-h), .wc-group > .wc-hint { margin-left: 16px; }
  #wc-g-install > *:not(.wc-group-h) { margin-left: 14px; margin-right: 14px; }
  .wc-group-t small { white-space: normal; }
  .wc-actions { bottom: 8px; }
}
