/* Lead Routing & Speed-to-Lead — extends app.css tokens. Prefix: rt- */

/* ---- topbar Available / Away switch ------------------------------------ */
.rt-presence { display: inline-flex; align-items: center; margin: 0 4px; }
.rt-presence-btn { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 6px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); font: inherit; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; box-shadow: var(--shadow-xs); transition: all .15s; white-space: nowrap; }
.rt-presence-btn:hover { border-color: var(--primary); }
.rt-knob { position: relative; width: 34px; height: 20px; border-radius: 999px; background: var(--border-strong); transition: background .15s; flex-shrink: 0; }
.rt-knob::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.rt-presence.is-on .rt-knob { background: var(--green); }
.rt-presence.is-on .rt-knob::after { transform: translateX(14px); }
.rt-presence.is-on .rt-presence-btn { color: var(--green-700); background: var(--green-50); border-color: #A6F4C5; }
.rt-presence:not(.is-on) .rt-presence-btn { color: var(--amber-700); background: var(--amber-50); border-color: #FEDF89; }
.rt-presence .rt-label-on, .rt-presence.is-on .rt-label-off { display: none; }
.rt-presence.is-on .rt-label-on { display: inline; }

/* ---- generic switch (members table) ------------------------------------ */
.rt-switch { display: inline-flex; align-items: center; gap: 8px; padding: 0; border: 0; background: none; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); }
.rt-switch .rt-knob { width: 36px; }
.rt-switch.is-on { color: var(--green-700); }
.rt-switch.is-on .rt-knob { background: var(--green); }
.rt-switch.is-on .rt-knob::after { transform: translateX(16px); }

/* ---- rules list ------------------------------------------------------- */
.rt-hero { display: flex; gap: 16px; align-items: center; padding: 16px 20px; margin-bottom: 20px; border-radius: var(--radius-lg); background: linear-gradient(120deg, var(--primary-50), #fff 70%); border: 1px solid var(--primary-100); }
.rt-hero-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--primary); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.rt-hero p { margin: 2px 0 0; color: var(--text-2); font-size: 13px; }
.rt-rules { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.rt-rule { display: flex; flex-direction: column; transition: box-shadow .15s, border-color .15s; }
.rt-rule:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.rt-rule.is-off { opacity: .7; }
.rt-rule-head { padding: 16px 20px 12px; display: flex; gap: 12px; align-items: flex-start; }
.rt-rule-head h3 { margin: 0; font-size: 15px; }
.rt-strategy-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--purple-50); color: var(--purple-700); flex-shrink: 0; }
.rt-rule-meta { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.rt-rule-meta div { padding: 10px 14px; border-right: 1px solid var(--border); }
.rt-rule-meta div:last-child { border-right: 0; }
.rt-rule-meta small { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.rt-rule-meta strong { font-size: 15px; }
.rt-rule-foot { padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.rt-avatars { display: flex; }
.rt-avatars .avatar { border: 2px solid #fff; margin-left: -8px; }
.rt-avatars .avatar:first-child { margin-left: 0; }
.rt-avatars .avatar.is-away { background: var(--gray-100); color: var(--muted-2); }

/* ---- rule editor ------------------------------------------------------ */
.rt-editor { display: grid; gap: 20px; grid-template-columns: 400px minmax(0, 1fr); align-items: start; }
.rt-strategies { display: grid; gap: 8px; }
.rt-strategy input { display: none; }
.rt-strategy span { display: block; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); cursor: pointer; background: #fff; transition: all .15s; }
.rt-strategy span strong { display: block; font-size: 13px; color: var(--text); }
.rt-strategy span small { display: block; font-size: 12px; color: var(--muted); line-height: 1.4; margin-top: 2px; }
.rt-strategy span:hover { border-color: var(--primary); }
.rt-strategy input:checked + span { border-color: var(--primary); background: var(--primary-50); box-shadow: 0 0 0 3px var(--primary-100); }
.rt-check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; cursor: pointer; }
.rt-check input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--primary); }
.rt-check small { display: block; color: var(--muted); font-size: 12px; }
.rt-sla { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rt-suffix { position: relative; }
.rt-suffix .input { padding-right: 44px; }
.rt-suffix::after { content: "min"; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; pointer-events: none; }
.rt-members td { vertical-align: middle; }
.rt-members .input { padding: 6px 8px; width: 70px; }
.rt-share { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.rt-share .progress { flex: 1; }
.rt-member-off td:not(:last-child) { opacity: .55; }
.rt-add { display: grid; grid-template-columns: minmax(0, 1fr) 90px 110px auto; gap: 8px; align-items: end; }
.rt-add label { font-size: 12px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 4px; }

/* ---- report ----------------------------------------------------------- */
.rt-bar { height: 8px; border-radius: 999px; background: var(--gray-100); overflow: hidden; min-width: 80px; }
.rt-bar span { display: block; height: 100%; border-radius: 999px; background: var(--primary); }
.rt-pct { font-weight: 700; }
.rt-pct.good { color: var(--green-700); } .rt-pct.ok { color: var(--amber-700); } .rt-pct.bad { color: var(--red-700); }
.rt-ring { --p: 0; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--green) calc(var(--p) * 1%), var(--gray-100) 0); flex-shrink: 0; }
.rt-ring span { width: 44px; height: 44px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.rt-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.rt-filters .input, .rt-filters .select { width: auto; min-width: 150px; padding: 7px 10px; }
.rt-arrow { color: var(--muted-2); }

@media (max-width: 1100px) { .rt-editor { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .rt-rules { grid-template-columns: 1fr; }
  .rt-add { grid-template-columns: 1fr 1fr; }
  .rt-presence-btn .rt-label-on, .rt-presence-btn .rt-label-off { display: none !important; }
  .rt-presence-btn { padding: 0 6px; }
}
