/* ============================================================================
   Lead Routing — Admin → Lead Routing
   ============================================================================
   Styles for the routing rules page. See lead-routing.js.

   Loaded from index.html alongside the other per-page stylesheets. (The first
   cut of this page put its styles in theme.css, which nothing in the portal
   actually loads — the page rendered as raw unstyled markup.)
   ========================================================================== */

/* ── Page header ─────────────────────────────────────────────────────────── */
.lr-head { margin-bottom: 24px; }
.lr-head h1 {
  font-family: 'Playfair Display', Georgia, serif;
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 700;
  color: var(--navy, #12153D);
}
.lr-sub {
  font-size: 13.5px;
  color: var(--mu, #6B6A80);
  line-height: 1.65;
  margin: 0;
  max-width: 68ch;
}

/* ── Rule list ───────────────────────────────────────────────────────────── */
.lr-rules {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 22px 0;
  max-width: 940px;
}

.lr-rule {
  border: 1.5px solid var(--br, #E8E6DF);
  border-radius: 13px;
  padding: 16px 18px;
  background: var(--white, #fff);
  transition: opacity .15s, border-color .15s, box-shadow .15s;
}
.lr-rule:hover { border-color: var(--gold-b, rgba(201,168,76,.3)); }

/* A switched-off rule falls through to Default. Dim it and go dashed so the
   difference is obvious at a glance without reading the toggle. */
.lr-rule.lr-off {
  opacity: .6;
  border-style: dashed;
  background: var(--bg, #F7F6F2);
}

/* ── Rule header: toggle · name · destination ────────────────────────────── */
.lr-rule-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.lr-rule-title { flex: 1 1 240px; min-width: 0; }
.lr-rule-title strong {
  display: block;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--navy, #12153D);
  line-height: 1.35;
}
.lr-key {
  display: inline-block;
  margin-top: 3px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  color: var(--mu, #6B6A80);
  background: var(--bg, #F7F6F2);
  border: 1px solid var(--br, #E8E6DF);
  border-radius: 5px;
  padding: 1px 6px;
}

/* Where this source currently sends leads — the answer you came here for. */
.lr-rule-dest {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy, #12153D);
  background: var(--gold-l, rgba(201,168,76,.1));
  border: 1px solid var(--gold-b, rgba(201,168,76,.3));
  border-radius: 999px;
  padding: 5px 14px;
  white-space: nowrap;
}
.lr-off .lr-rule-dest {
  background: rgba(0,0,0,.04);
  border-color: var(--br, #E8E6DF);
  color: var(--mu, #6B6A80);
}

.lr-desc {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--mu, #6B6A80);
  line-height: 1.6;
}

/* ── Rule body: mode + who's in the rotation ─────────────────────────────── */
.lr-rule-body {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  align-items: flex-start;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--br, #E8E6DF);
}
.lr-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
}
.lr-field > span {
  color: var(--mu, #6B6A80);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.lr-field select {
  font: inherit;
  font-size: 13px;
  color: var(--navy, #12153D);
  padding: 7px 11px;
  border: 1.5px solid var(--br, #E8E6DF);
  border-radius: 8px;
  background: var(--white, #fff);
  cursor: pointer;
}
.lr-field select:hover:not(:disabled) { border-color: var(--gold, #C9A84C); }
.lr-field select:disabled { opacity: .55; cursor: not-allowed; }

.lr-pool { flex: 1 1 340px; }
.lr-pool-list { display: flex; gap: 8px; flex-wrap: wrap; }

/* Broker chips — click the name to add or remove them from the rotation. */
.lr-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border: 1.5px solid var(--br, #E8E6DF);
  border-radius: 999px;
  font-size: 13px;
  color: var(--mu, #6B6A80);
  cursor: pointer;
  user-select: none;
  background: var(--white, #fff);
  position: relative;   /* contains the visually-hidden checkbox */
  transition: border-color .12s, background .12s, color .12s;
}
.lr-chip:hover { border-color: var(--gold, #C9A84C); color: var(--navy, #12153D); }
.lr-chip.on {
  border-color: var(--gold, #C9A84C);
  background: var(--gold-l, rgba(201,168,76,.1));
  color: var(--navy, #12153D);
  font-weight: 600;
}
.lr-chip input {
  /* The chip itself is the control; the checkbox only carries state. */
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.lr-chip:has(input:disabled) { opacity: .55; cursor: not-allowed; }

/* ── Toggle switch ───────────────────────────────────────────────────────── */
.lr-toggle {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex: 0 0 auto;
  position: relative;   /* contains the visually-hidden checkbox */
}
.lr-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.lr-toggle-track {
  width: 40px;
  height: 23px;
  border-radius: 999px;
  background: #d1d5db;
  position: relative;
  transition: background .16s;
  display: inline-block;
}
.lr-toggle-dot {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform .16s;
}
.lr-toggle input:checked + .lr-toggle-track { background: #16a34a; }
.lr-toggle input:checked + .lr-toggle-track .lr-toggle-dot { transform: translateX(17px); }
.lr-toggle input:disabled + .lr-toggle-track { opacity: .45; cursor: not-allowed; }
.lr-toggle input:focus-visible + .lr-toggle-track {
  outline: 2px solid var(--gold, #C9A84C);
  outline-offset: 2px;
}

/* ── Save bar ────────────────────────────────────────────────────────────── */
.lr-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 4px;
  max-width: 940px;
}
.lr-status { font-size: 13px; font-weight: 600; }

/* ── Narrow screens ──────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .lr-rule { padding: 14px; }
  .lr-rule-dest { white-space: normal; }
  .lr-rule-body { gap: 16px; }
}
