/* email-connect.css — a settings form, not a landing page.
 *
 * Everything here is calm on purpose: the only colour that carries meaning is
 * green for a check that passed and red for one that did not, and the brand
 * lime is spent on exactly one thing, the button that does the work.
 *
 * Tokens are declared light-first on bare :root and only redefined for dark, so
 * the panel follows whichever theme the dashboard is in rather than pinning
 * itself to one.
 */

:root {
  --ec-card:   #ffffff;
  --ec-field:  #ffffff;
  --ec-edge:   #e6e9e2;
  --ec-edge-2: #eef0ea;
  --ec-ink:    #1d1b1c;
  --ec-muted:  #55606c;
  --ec-faint:  #8b939d;
  --ec-lime:   #d4fb08;
  --ec-lime-ink: #1d1b1c;
  --ec-ok:     #0f8a5f;
  --ec-ok-bg:  rgba(16, 185, 129, .12);
  --ec-bad:    #b91c1c;
  --ec-bad-bg: rgba(239, 68, 68, .10);
  --ec-hint-bg: rgba(212, 251, 8, .16);
  --ec-hint-edge: rgba(160, 190, 10, .5);
}

:root.dark,
.dark,
[data-theme="dark"] {
  --ec-card:   #1b1e23;
  --ec-field:  #101317;
  --ec-edge:   #2a2f36;
  --ec-edge-2: #23272d;
  --ec-ink:    #e8eaed;
  --ec-muted:  #8b939d;
  --ec-faint:  #6f7883;
  --ec-ok:     #34d399;
  --ec-ok-bg:  rgba(52, 211, 153, .14);
  --ec-bad:    #f87171;
  --ec-bad-bg: rgba(248, 113, 113, .12);
  --ec-hint-bg: rgba(212, 251, 8, .08);
  --ec-hint-edge: rgba(212, 251, 8, .28);
}

.crm-ec-hidden { display: none !important; }

.crm-ec {
  max-width: 620px;
  background: var(--ec-card);
  border: 1px solid var(--ec-edge);
  border-radius: 8px;
  padding: 22px 22px 24px;
  color: var(--ec-ink);
  font-family: Inter, system-ui, sans-serif;
}

.crm-ec-title { margin: 0 0 4px; font-size: 17px; font-weight: 600; }
.crm-ec-sub { margin: 0 0 20px; font-size: 13px; color: var(--ec-faint); line-height: 1.55; }

.crm-ec-field { margin-bottom: 14px; }
.crm-ec-label { display: block; font-size: 12px; color: var(--ec-muted); margin-bottom: 5px; }

.crm-ec-input {
  width: 100%;
  background: var(--ec-field);
  border: 1px solid var(--ec-edge);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 13.5px;
  color: var(--ec-ink);
  font-family: inherit;
}
.crm-ec-input:focus {
  outline: 2px solid var(--ec-lime);
  outline-offset: 1px;
  border-color: transparent;
}
.crm-ec-input::placeholder { color: var(--ec-faint); }

/* Sits between the address and the password, which is exactly where it is
   needed: after the domain is known, before the wrong password is typed. */
.crm-ec-hint {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  background: var(--ec-hint-bg);
  border: 1px solid var(--ec-hint-edge);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 12.5px;
  line-height: 1.5;
  margin: -4px 0 14px;
}
.crm-ec-hint-mark {
  flex: none;
  font-weight: 700;
  width: 15px; height: 15px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 10px;
  background: var(--ec-lime);
  color: var(--ec-lime-ink);
  margin-top: 1px;
}
.crm-ec-hint b { font-weight: 600; }

.crm-ec-actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; margin-top: 4px; }

.crm-ec-btn {
  background: var(--ec-lime);
  color: var(--ec-lime-ink);
  border: 1px solid var(--ec-lime);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.crm-ec-btn:disabled { opacity: .6; cursor: default; }
.crm-ec-btn.is-ghost {
  background: transparent;
  color: var(--ec-muted);
  border-color: var(--ec-edge);
  font-weight: 500;
}

/* ---- what happened ---- */

.crm-ec-result { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--ec-edge-2); }

.crm-ec-working { margin: 0; font-size: 13px; color: var(--ec-muted); }

.crm-ec-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  padding: 4px 0;
}
.crm-ec-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 700;
  border: 1px solid var(--ec-edge);
  color: var(--ec-faint);
}
.crm-ec-step.is-done .crm-ec-dot { background: var(--ec-ok-bg); color: var(--ec-ok); border-color: var(--ec-ok); }
.crm-ec-step.is-fail .crm-ec-dot { background: var(--ec-bad-bg); color: var(--ec-bad); border-color: var(--ec-bad); }

.crm-ec-what { color: var(--ec-ink); }
.crm-ec-detail {
  margin-inline-start: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  color: var(--ec-faint);
  text-align: end;
}
.crm-ec-step.is-fail .crm-ec-detail { color: var(--ec-bad); }

.crm-ec-ok,
.crm-ec-bad {
  margin-top: 13px;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.55;
}
.crm-ec-ok  { background: var(--ec-ok-bg);  border: 1px solid var(--ec-ok);  color: var(--ec-ink); }
.crm-ec-bad { background: var(--ec-bad-bg); border: 1px solid var(--ec-bad); color: var(--ec-ink); }

.crm-ec-found {
  margin-top: 12px;
  border: 1px solid var(--ec-edge-2);
  border-radius: 8px;
  padding: 11px 12px;
}
.crm-ec-found-t {
  font-size: 10.5px;
  color: var(--ec-faint);
  margin-bottom: 7px;
}
.crm-ec-kv { display: flex; gap: 10px; font-size: 12.5px; padding: 2px 0; }
.crm-ec-k { color: var(--ec-muted); flex: 0 0 66px; }
.crm-ec-v {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  word-break: break-all;
}

@media (max-width: 560px) {
  .crm-ec { padding: 18px; }
  .crm-ec-detail { display: none; }
}

/* --------------------------------------------------------------------------
   Reaching a human, shown only when the screen has run out of advice.

   Quieter than the error above it - the error is what happened, this is what
   to do next, and it should not compete for the eye. Both pills are real
   links: the mail one opens a message with the domain and failing stage
   already in the subject, the WhatsApp one opens a chat.
   -------------------------------------------------------------------------- */
.crm-ec-help {
  margin-top: 12px;
  border: 1px solid var(--ec-edge);
  border-radius: 8px;
  padding: 12px 13px;
  background: var(--ec-field);
}

.crm-ec-help-lead {
  margin: 0 0 10px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ec-muted);
}

.crm-ec-help-row { display: flex; flex-wrap: wrap; gap: 8px; }

.crm-ec-help-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 6px 9px;
  border-radius: 999px;
  border: 1px solid var(--ec-edge);
  background: var(--ec-card);
  color: var(--ec-ink);
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  font-variant-numeric: tabular-nums;
  transition: border-color .12s ease;
}
.crm-ec-help-pill:hover { border-color: var(--ec-lime); }
.crm-ec-help-pill:focus-visible { outline: 2px solid var(--ec-lime); outline-offset: 2px; }

.crm-ec-help-icon { width: 16px; height: 16px; flex: none; border-radius: 50%; }

@media (prefers-reduced-motion: reduce) {
  .crm-ec-help-pill { transition: none; }
}
