/* Flow 5: Call results, lead detail, exports, Jobs and reports. Builds on ops.css. */

.rs-sub { display: block; margin-top: 2px; font-size: .76rem; color: var(--muted); font-weight: 500; }
.rs-nowrap { white-space: nowrap; }
.rs-link { padding: 0; border: 0; background: none; color: var(--link); font-weight: 700; text-align: left; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; cursor: pointer; }
.rs-link:hover { text-decoration-color: currentColor; }
.main-content .rs-name { color: var(--ink); text-decoration: none; }
.main-content .rs-name:hover strong { text-decoration: underline; }
.rs-notrun { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .84rem; }
.rs-notrun .lucide { width: 15px; height: 15px; }
.rs-mix { display: flex; width: 160px; height: 8px; overflow: hidden; border-radius: 99px; background: var(--tone-muted-bg); }
.rs-mix .mz-swatch { height: 100%; border-radius: 0; flex: none; }
.rs-list tbody tr[data-open] { cursor: pointer; }
.rs-toast-link { margin-left: 6px; color: inherit; font-weight: 800; text-decoration: underline; }

/* Results toolbar */
.rs-bar { display: grid; gap: 12px; }
.rs-quick .mz-count { font-variant-numeric: tabular-nums; }
.mz-toolbar .btn .mz-count:empty { display: none; }
.mz-toolbar .btn .mz-count { padding: 0 7px; border-radius: 99px; background: var(--brand-500); color: #fff; font-size: .72rem; }
.rs-filters { display: grid; gap: 14px; padding: 16px 18px; border-radius: 18px; background: var(--glass-bg); box-shadow: var(--glass-shadow); }
.rs-filters .field { gap: 6px; font-size: .8rem; font-weight: 700; color: var(--muted); }
.rs-filters input, .rs-filters select, .rs-range input, .rs-range select { width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid var(--field-border); border-radius: 10px; background: var(--field-bg); color: var(--ink); font-size: .88rem; }
.rs-filters__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 14px; }
.rs-varfilter { grid-column: span 2; }
.rs-range { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.rs-range--3 { grid-template-columns: 1.3fr 1fr 1fr; }
.rs-checks { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--ink); font-weight: 500; }
.rs-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rs-chips:empty { display: none; }
.rs-fchip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 11px; border-radius: 999px; background: var(--hover-bg); color: var(--ink); font-size: .8rem; font-weight: 650; box-shadow: inset 0 0 0 1px var(--brand-200); }
.rs-fchip button { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); }
.rs-fchip button:hover { background: var(--control-bg); color: var(--ink); }
.rs-fchip .lucide { width: 13px; height: 13px; }

/* Results table */
.rs-wrap { max-height: min(70vh, 760px); }
.rs-table { font-size: .86rem; }
.rs-table td { white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.rs-table td.rs-notecell { min-width: 240px; max-width: 340px; white-space: normal; }
.rs-notecell > span { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; }
.rs-table td.rs-fx { font-weight: 700; color: var(--tone-live); }
.rs-table td.rs-fx.is-error { color: var(--tone-bad); }
.rs-table .rs-namecell { position: sticky; left: 38px; z-index: 1; background: var(--panel-bg, #fff); }
.rs-table .mz-select-cell { position: sticky; left: 0; z-index: 1; background: var(--panel-bg, #fff); }
.rs-table thead .mz-select-cell { z-index: 3; }
.rs-table tbody tr:hover .rs-namecell, .rs-table tbody tr:hover .mz-select-cell { background: color-mix(in srgb, var(--panel-bg, #fff) 88%, var(--brand-500)); }
.rs-table tbody tr.is-selected .rs-namecell, .rs-table tbody tr.is-selected .mz-select-cell { background: color-mix(in srgb, var(--panel-bg, #fff) 86%, var(--brand-500)); }
.rs-table tbody tr[data-row] { cursor: pointer; }
.rs-play .lucide, .rs-table .btn--compact .lucide { width: 14px; height: 14px; }
.rs-th { padding: 0 !important; user-select: none; }
.rs-th[draggable="true"] { cursor: grab; }
.rs-th.is-dragging { opacity: .45; }
.rs-th.drop-before { box-shadow: inset 3px 0 0 var(--brand-500); }
.rs-th.drop-after { box-shadow: inset -3px 0 0 var(--brand-500); }
.rs-th__in { display: flex; align-items: center; gap: 2px; padding: 6px 22px 6px 10px; }
.rs-th__sort { display: inline-flex; align-items: center; gap: 5px; padding: 5px 4px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font: inherit; font-weight: 750; white-space: nowrap; cursor: pointer; }
.rs-th__sort:hover { color: var(--ink); }
.rs-th[aria-sort="ascending"] .rs-th__sort, .rs-th[aria-sort="descending"] .rs-th__sort { color: var(--ink); }
.rs-th__sort .lucide { width: 13px; height: 13px; }
.rs-th__menu { width: 26px; height: 26px; opacity: .5; }
.rs-th:hover .rs-th__menu, .rs-th__menu:focus-visible { opacity: 1; }
.rs-chip { padding: 0 5px; border-radius: 5px; background: var(--tone-live-bg); color: var(--tone-live); font-size: .64rem; font-weight: 800; letter-spacing: .02em; }
.rs-chip--csv { background: var(--tone-info-bg); color: var(--tone-info); }
.rs-add { position: absolute; top: 50%; right: 0; z-index: 2; display: grid; place-items: center; width: 20px; height: 20px; padding: 0; transform: translate(0, -50%); border: 0; border-radius: 50%; background: var(--brand-500); color: #fff; opacity: 0; transition: opacity .12s; cursor: pointer; }
.rs-add .lucide { width: 13px; height: 13px; }
.rs-add:hover, .rs-add:focus-visible { opacity: 1; }
.rs-th:hover .rs-add { opacity: .35; }
.rs-th:hover .rs-add:hover { opacity: 1; }
@media (hover: none) { .rs-add { opacity: .6; } }

/* Lead detail */
.rs-detail { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.rs-panel { display: grid; gap: 10px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--control-bg); }
.rs-panel > header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.rs-panel h3 { display: flex; align-items: center; gap: 7px; margin: 0; font-size: .98rem; }
.rs-panel h3 .lucide { width: 17px; height: 17px; color: var(--link); }
.rs-panel .mz-table-wrap { box-shadow: none; background: transparent; }
.rs-panel .mz-table thead th { background: var(--surface-2); }
.rs-notes { color: var(--ink); line-height: 1.5; }
.rs-inline { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 650; color: var(--muted); }
.rs-inline select { min-height: 34px; padding: 4px 8px; border: 1px solid var(--field-border); border-radius: 8px; background: var(--field-bg); color: var(--ink); }
.rs-status-edit { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.rs-status-edit .field { flex: 1 1 160px; }
.rs-history { max-height: 260px; overflow: auto; }
.rs-type { margin-left: 4px; padding: 0 5px; border-radius: 5px; background: var(--tone-muted-bg); color: var(--muted); font-size: .68rem; font-weight: 700; }
.rs-panel code, .rs-expr code { font-size: .78em; }
.rs-ticket { margin-left: 4px; font-size: .78rem; font-weight: 700; }

/* Export and add column dialogs */
.rs-fieldset { display: grid; gap: 10px; min-width: 0; margin: 0; padding: 0; border: 0; }
.rs-fieldset legend { margin-bottom: 8px; padding: 0; font-weight: 750; font-size: .92rem; color: var(--ink); }
.rs-fieldset .rs-checks { max-height: 140px; overflow: auto; padding: 8px 10px; border: 1px solid var(--field-border); border-radius: 10px; background: var(--field-bg); }
.rs-filename { display: flex; align-items: stretch; }
.rs-filename input { flex: 1; min-width: 0; border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; }
.rs-filename span { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--field-border); border-left: 0; border-radius: 0 9px 9px 0; background: var(--surface-2); color: var(--muted); font-weight: 700; }
.rs-ex-count { margin: 0; font-weight: 650; }
.rs-ac-wrap { position: relative; }
.rs-ac-wrap textarea { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9rem; }
.rs-ac { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 10; max-height: 230px; overflow: auto; margin: 0; padding: 5px; list-style: none; border: 1px solid var(--panel-border, var(--line)); border-radius: 12px; background: var(--panel-bg, #fff); box-shadow: 0 14px 36px rgba(24, 11, 32, .22); }
.rs-ac li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 7px 9px; border-radius: 8px; font-size: .86rem; cursor: pointer; }
.rs-ac li[aria-selected="true"], .rs-ac li:hover { background: var(--hover-bg); }
.rs-ac li small { color: var(--muted); }
[data-ok] .lucide { width: 15px; height: 15px; color: var(--tone-good); vertical-align: -3px; }

/* Jobs */
.rs-job { display: grid; grid-template-columns: 20px 1fr; gap: 10px; align-items: start; min-width: 260px; }
.rs-job > .lucide { width: 18px; height: 18px; margin-top: 2px; color: var(--link); }
.rs-job code { font-size: .7rem; }
.rs-jobs .mz-progress { width: 110px; }
.rs-jobs td:last-child { white-space: nowrap; }
.rs-jobfail { display: inline-flex; align-items: flex-start; gap: 5px; color: var(--tone-bad); font-weight: 600; white-space: normal; }
.rs-jobfail .lucide { flex: none; width: 13px; height: 13px; margin-top: 2px; }
.rs-scope { align-self: center; margin: 0 0 8px; }

/* Report */
.rp-tier { display: grid; gap: 10px; }
.rp-tier h2 { display: flex; align-items: baseline; gap: 10px; }
.mz-report .mz-table-wrap { box-shadow: none; border: 1px solid var(--line); background: transparent; }
.mz-report .mz-table td { white-space: normal; }
.mz-report .mz-table thead th { position: static; }
@media print {
  .mz-report .mz-table { font-size: 10pt; }
  .mz-report .mz-badge { box-shadow: none; }
}

@media (max-width: 1000px) {
  .rs-detail { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .rs-varfilter { grid-column: auto; }
  .rs-range--3 { grid-template-columns: 1fr; }
  .rs-table .rs-namecell { position: static; }
  .mz-selection .row { margin-left: 0; }
  .rs-mix { width: 110px; }
}
