/* Revenue assurance v3: Contracts (round 3). Library, Add contract (upload or import), one contract with the step tracker,
   Next card, gate bar, three steps and the Contract tab. Kit tokens only; sizes 12/14/16/20. */

/* ---------- Library ---------- */
.ct-toolbar { margin-top: 24px; }
.ct-toolbar .spacer { flex: 1 1 0; }
.ct-id-main { display: inline-flex !important; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.ct-id { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.ct-copy { display: inline-grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted-foreground); cursor: pointer; }
.ct-copy:hover { background: var(--muted); color: var(--foreground); }
.ct-copy svg.lucide { width: 12px; height: 12px; }
.ct-new { margin-left: 6px; }
.ct-leak { color: var(--destructive); font-weight: 500; }
.ct-chev { width: 16px; height: 16px; color: var(--muted-foreground); }
.ct-foot { margin-top: 12px; }
.rx-table tr.selected td { animation: ct-flash 2.4s var(--ease-move) both; }
@keyframes ct-flash { 0% { background: var(--muted-brand); } 100% { background: transparent; } }

/* ---------- Add contract dialog ---------- */
.ct-add { display: flex; flex-direction: column; gap: 16px; }
.ct-add-lead { margin-top: -8px; }
.ct-files { display: flex; flex-direction: column; gap: 4px; max-height: 280px; overflow: auto; }
.ct-file { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-lg); cursor: pointer; transition: background var(--motion-quick), border-color var(--motion-quick); }
.ct-file:hover { background: var(--accent); }
.ct-file:has(input:checked) { border-color: var(--border-brand); background: var(--background-brand); }
.ct-file.off { cursor: default; opacity: .6; }
.ct-file.off:hover { background: transparent; }
.ct-file input { accent-color: var(--primary); }
.ct-file-name { display: block; font-weight: 500; }
.ct-pdf { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: var(--radius-md); background: var(--artifact-pdf); color: var(--universal-white); }
.ct-pdf svg.lucide { width: 16px; height: 16px; }
.ct-pdf.inv { background: var(--muted-brand); color: var(--primary); }
.rx-dialog .dialog-foot .grow { align-self: center; }

.ct-run { display: flex; flex-direction: column; gap: 12px; padding-bottom: 24px; }
.ct-run-file { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: var(--radius-lg); background: var(--muted); }
.ct-run .rx-live-card.inline { border-radius: var(--radius-lg); }
.ct-run #ct-live-b:empty, .ct-run #ct-human:empty { display: none; }
.ct-confirm { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid color-mix(in srgb, var(--warning) 45%, var(--border)); border-radius: var(--radius-lg); background: var(--warning-foreground); animation: rx-rise var(--motion-deliberate) var(--ease-enter); }
.ct-confirm-ic { display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--radius-md); background: var(--background); color: var(--warning); }
.ct-confirm-ic svg.lucide { width: 16px; height: 16px; }
.ct-map { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px; border-radius: var(--radius-md); background: var(--background); border: 1px solid var(--border); }
.ct-map > div { display: flex; flex-direction: column; min-width: 0; }
.ct-map > svg.lucide { width: 16px; height: 16px; color: var(--muted-foreground); }
.ct-map-v { font-weight: 500; }
.ct-conf { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--primary); }
.ct-conf .bar { width: 64px; }
.ct-confirm-act { gap: 8px; }
.ct-confirmed { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius-lg); background: var(--muted); font-weight: 500; }
.ct-confirmed svg.lucide { width: 16px; height: 16px; color: var(--success); }

/* ---------- One contract: header chips and tabs ---------- */
.ct-one .rx-head { margin-bottom: 16px; }
.ct-chip-btn { cursor: pointer; font-variant-numeric: tabular-nums; }
.ct-chip-btn:hover { background: var(--accent); }
.ct-chip-btn svg.lucide:last-child { width: 12px; height: 12px; }
.ct-chip-warn { border-color: color-mix(in srgb, var(--warning) 50%, var(--border)); background: var(--warning-foreground); }
.ct-chip-conf { color: var(--muted-foreground); font-weight: 400; }
.rx-chip .ct-ok { color: var(--success); }
.rx-chips .btn.sm { height: 28px; }
.ct-spark { display: inline-grid; place-items: center; }
.ct-spark .fina-spark { width: 14px; height: 14px; }

.ct-card-title { font-size: 16px; line-height: 24px; font-weight: 600; }

/* ---------- Terms: list left, document right ---------- */
.ct-one-terms .rx-fina-card { margin-bottom: 16px; }
.ct-terms { display: grid; grid-template-columns: minmax(340px, 40%) minmax(0, 1fr); height: calc(100vh - 160px); min-height: 520px; border: 1px solid var(--border); border-radius: var(--radius-xl); overflow: hidden; }
.ct-tl { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); background: var(--background); }
.ct-tl-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); flex: none; }
.ct-tl-head .spacer { flex: 1; }
.ct-tl-list { flex: 1; min-height: 0; overflow: auto; padding: 8px 12px 24px; }
.ct-tr { min-height: 0; min-width: 0; }
.ct-viewer { height: 100%; }
.ct-legend { display: inline-flex; gap: 8px; font-size: 12px; color: var(--muted-foreground); }
.ct-legend span { display: inline-flex; align-items: center; gap: 4px; }
.ct-legend span::before { content: ""; width: 10px; height: 10px; border-radius: 3px; }
.ct-legend .st-ai::before { background: color-mix(in srgb, var(--information) 22%, transparent); }
.ct-legend .st-review::before { background: color-mix(in srgb, var(--warning) 30%, transparent); }
.ct-legend .st-confirmed::before { background: color-mix(in srgb, var(--success) 25%, transparent); }

.ct-grp + .ct-grp { margin-top: 12px; }
.ct-grp-h { display: flex; align-items: center; gap: 8px; padding: 8px 4px; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: .04em; }
.ct-term { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 10px 12px 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); cursor: pointer; transition: background var(--motion-quick), border-color var(--motion-quick), box-shadow var(--motion-quick); }
.ct-term + .ct-term { margin-top: 6px; }
.ct-term::before { content: ""; position: absolute; left: -1px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--information); }
.ct-term.st-review::before { background: var(--warning); }
.ct-term.st-confirmed::before { background: var(--success); }
.ct-term:hover { background: var(--accent); }
.ct-term.on { border-color: var(--border-brand); background: var(--background-brand); box-shadow: 0 0 0 1px var(--border-brand); }
.ct-term:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.ct-term-l { font-size: 12px; line-height: 16px; color: var(--muted-foreground); }
.ct-term-v { font-weight: 500; overflow-wrap: anywhere; }
.ct-term-m { gap: 8px; min-height: 32px; }
.ct-term-m .spacer { flex: 1; }
.ct-term-pg { font-size: 12px; color: var(--primary); font-weight: 500; }
.ct-term-ok { display: none; }
.ct-term.on .ct-term-ok, .ct-term:hover .ct-term-ok, .ct-term.st-review .ct-term-ok { display: inline-flex; }

.ct-q { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); }
.ct-q + .ct-q { margin-top: 8px; }
.ct-q-t { font-weight: 500; }
.ct-q-a { padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-md); font-family: var(--font-serif); font-size: 14px; line-height: 22px; }
.ct-q-f .spacer { flex: 1; }

/* passive marks in the document, coloured by state; the active citation stays the cite-viewer green */
mark.ct-tm { color: inherit; border-radius: 2px; padding: 0 1px; cursor: pointer; background: color-mix(in srgb, var(--information) 14%, transparent); border-bottom: 2px solid color-mix(in srgb, var(--information) 55%, transparent); }
mark.ct-tm.st-review { background: color-mix(in srgb, var(--warning) 18%, transparent); border-bottom-color: color-mix(in srgb, var(--warning) 70%, transparent); }
mark.ct-tm.st-confirmed { background: color-mix(in srgb, var(--success) 14%, transparent); border-bottom-color: color-mix(in srgb, var(--success) 60%, transparent); }
mark.ct-tm:hover { filter: brightness(.96); }

.ct-fresh .ct-term, .ct-fresh .ct-q { animation: ct-in var(--motion-deliberate) var(--ease-enter) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes ct-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- Documents ---------- */
.ct-docs { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-xl); overflow: hidden; }
.ct-doc { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 16px; border: 0; border-bottom: 1px solid var(--border); background: var(--card); text-align: left; cursor: pointer; width: 100%; }
.ct-doc:last-child { border-bottom: 0; }
.ct-doc:hover { background: var(--accent); }
.ct-doc-t { display: block; font-weight: 500; }

/* ---------- Activity ---------- */
.ct-act { padding: 4px 20px; }
.ct-act-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.ct-act-row:last-child { border-bottom: 0; }
.ct-act-ic { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--muted); color: var(--muted-foreground); }
.ct-act-ic svg.lucide { width: 14px; height: 14px; }
.ct-act-w { display: block; font-weight: 500; }
.ct-act-row .t-meta { display: block; }
.ct-act-meta { display: flex; flex-direction: column; align-items: flex-end; font-size: 14px; white-space: nowrap; }

@media (prefers-reduced-motion: reduce) { .ct-fresh .ct-term, .ct-fresh .ct-q, .rx-table tr.selected td { animation: none; } }
.ct-map { flex-direction: column; align-items: stretch; gap: 8px; }
.ct-map-row { display: grid !important; grid-template-columns: 112px minmax(0, 1fr) auto; align-items: center; gap: 8px; flex-direction: row !important; }
.ct-matched-on { display: flex; flex-wrap: wrap; gap: 6px; }
.ct-matched-on .badge { background: var(--background); border: 1px solid var(--border); color: var(--muted-foreground); }
.ct-matched-on .badge svg.lucide { color: var(--success); }

/* Round 2: upload a real PDF (U3) */
.ct-drop { position: relative; display: flex; align-items: center; gap: 12px; min-height: 72px; padding: 12px 16px; border: 1px dashed var(--border); border-radius: var(--radius-lg); background: var(--muted); cursor: pointer; transition: background var(--motion-quick), border-color var(--motion-quick); }
.ct-drop:hover, .ct-drop.over { border-color: var(--border-brand); background: var(--background-brand); }
.ct-drop input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.ct-drop-ic { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: var(--radius-md); background: var(--muted-brand); color: var(--primary); }
.ct-drop-spin { display: none; }
.ct-drop.busy .ct-drop-spin { display: inline-block; }
.ct-drop.busy .btn { display: none; }
.ct-samples-link { display: inline-flex; align-items: center; gap: 4px; }
.ct-samples-link svg.lucide { width: 12px; height: 12px; }
.ct-uploads { margin-top: 32px; }
.ct-up { display: flex; flex-direction: column; gap: 24px; }
.ct-up-terms { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.ct-up-group { padding: 8px 12px; background: var(--muted); font-size: 12px; font-weight: 600; color: var(--muted-foreground); }
.ct-up-term { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-top: 1px solid var(--border); }
.ct-up-pages { display: flex; flex-direction: column; gap: 12px; }
.ct-up-page { position: relative; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; background: var(--universal-white); box-shadow: var(--shadow-sm); }
.ct-up-page canvas { display: block; }
.ct-up-no { position: absolute; right: 8px; bottom: 8px; padding: 2px 6px; border-radius: var(--radius-full); background: var(--muted); font-size: 12px; color: var(--muted-foreground); }
.ct-sup-title { margin-top: 24px; }
.ct-csv { display: flex; flex-direction: column; gap: 12px; }
.ct-csv-wrap { max-height: 70vh; overflow: auto; }
.ct-src-logo { width: 14px; height: 14px; object-fit: contain; flex: none; }

/* QA fixes (V9): SAP customer candidates under Change */
.ct-sap-list { display: flex; flex-direction: column; gap: 4px; }
.ct-sap-opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--background); text-align: left; cursor: pointer; transition: background var(--motion-quick), border-color var(--motion-quick); }
.ct-sap-opt:hover { background: var(--accent); }
.ct-sap-opt.on { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); background: var(--background-brand); }
.ct-sap-opt > svg.lucide { width: 16px; height: 16px; flex: none; color: var(--muted-foreground); }
.ct-sap-opt.on > svg.lucide { color: var(--primary); }
.ct-sap-opt .grow { display: flex; flex-direction: column; min-width: 0; }
.ct-sap-name { font-weight: 500; }
.ct-sap-opt .ct-conf { margin-left: 0; flex: none; }
.ct-tl-list { padding-bottom: 72px; }

/* ---------- Round 3: menus ---------- */
.ct-dd { position: relative; }
.ct-dd > summary { list-style: none; }
.ct-dd > summary::-webkit-details-marker { display: none; }
.ct-dd > summary svg.lucide:last-child { width: 14px; height: 14px; opacity: .7; }
.ct-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 40; width: 264px; padding: 4px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--popover); box-shadow: var(--shadow-filter-popover); }
.ct-menu .rx-pop-item { width: 100%; border: 0; background: transparent; text-align: left; cursor: pointer; border-radius: var(--radius-md); }

/* Import from connector */
.ct-folder-head { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: var(--radius-lg); background: var(--muted); }
.ct-folder { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-lg); max-height: 360px; overflow-y: auto; }
.ct-fold-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background var(--motion-quick); }
.ct-fold-row:last-child { border-bottom: 0; }
.ct-fold-row:hover { background: var(--accent); }
.ct-fold-row.off { cursor: default; opacity: .6; }
.ct-fold-row.off:hover { background: transparent; }
.ct-fold-row input { accent-color: var(--primary); flex: none; }
.ct-fold-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ct-fold-change { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; line-height: 16px; color: var(--foreground); }
.ct-fold-change svg.lucide { width: 12px; height: 12px; color: var(--warning); flex: none; }
#ct-import-live:empty { display: none; }

/* ---------- One contract: tracker, Next card, gate bar ---------- */
.ct-head-stage { display: inline-flex; margin-left: 4px; }
.ct-track-row { display: flex; align-items: stretch; gap: 12px; margin-bottom: 16px; }
.ct-steps { flex: 1 1 auto; display: flex; align-items: center; gap: 4px; min-width: 0; padding: 4px; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--muted); }
.ct-step { flex: 1 1 0; display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 56px; padding: 8px 12px; border: 0; border-radius: var(--radius-lg); background: transparent; color: var(--foreground); font: inherit; text-align: left; cursor: pointer; transition: background var(--motion-quick); }
.ct-step:hover:not(:disabled) { background: var(--background); }
.ct-step.on { background: var(--background); box-shadow: var(--shadow-2xs); }
.ct-step:disabled { cursor: not-allowed; color: var(--muted-foreground); }
.ct-step-dot { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 50%; border: 1px solid var(--border); background: var(--background); font-size: 12px; font-weight: 600; color: var(--muted-foreground); }
.ct-step-dot svg.lucide { width: 14px; height: 14px; }
.ct-step.done .ct-step-dot { border-color: var(--success); background: var(--success); color: var(--universal-white); }
.ct-step.current .ct-step-dot { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 3px var(--muted-brand); }
.ct-step-text { display: flex; flex-direction: column; min-width: 0; }
.ct-step-title { font-size: 14px; line-height: 20px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct-step.current .ct-step-title { font-weight: 600; }
.ct-step-meta { font-size: 12px; line-height: 16px; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct-step-sep { flex: none; width: 16px; height: 1px; background: var(--border); }
.ct-ctab { flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 0 16px; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--background); color: var(--foreground); font: inherit; font-weight: 500; cursor: pointer; transition: background var(--motion-quick); }
.ct-ctab:hover { background: var(--accent); }
.ct-ctab.on { border-color: var(--border-brand); background: var(--background-brand); color: var(--primary); }
.ct-ctab svg.lucide { width: 16px; height: 16px; }

.ct-next { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; padding: 16px 20px; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--background); }
.ct-next-ic { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: var(--radius-lg); background: var(--muted); color: var(--muted-foreground); }
.ct-next-ic svg.lucide { width: 16px; height: 16px; }
.ct-next-ic.success { background: var(--success-foreground); color: var(--success); }
.ct-next-ic.warning { background: var(--warning-foreground); color: var(--warning); }
.ct-next-ic.info { background: var(--information-foreground); color: var(--information); }
.ct-next-ic.destructive { background: var(--destructive-foreground); color: var(--destructive); }
.ct-next-text { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }
.ct-next-l { font-size: 16px; line-height: 24px; font-weight: 600; }

.ct-gate { display: flex; align-items: center; gap: 16px; margin-top: 24px; padding: 12px 16px 12px 20px; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--background); box-shadow: var(--shadow-sm); }
.ct-gate-lines { flex: 1 1 auto; display: flex; flex-wrap: wrap; gap: 4px 16px; min-width: 0; }
.ct-gate-line { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; line-height: 20px; color: var(--muted-foreground); }
.ct-gate-line svg.lucide { width: 16px; height: 16px; flex: none; }
.ct-gate-line.bad { color: var(--destructive); }
.ct-gate-line.ok svg.lucide { color: var(--success); }
.ct-body { min-width: 0; }

/* ---------- Steps 2 and 3 ---------- */
.ct-step-body { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.ct-sec-row { gap: 12px; }
.ct-sec-row .rx-section-title { margin: 0; }
.ct-sec-row .select { width: auto; min-width: 200px; }
.ct-sec-row .spacer { flex: 1; }
.ct-banner { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-radius: var(--radius-lg); background: var(--muted); font-size: 14px; line-height: 20px; }
.ct-banner > svg.lucide { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.ct-banner.warn { background: var(--warning-foreground); border: 1px solid color-mix(in srgb, var(--warning) 35%, var(--border)); }
.ct-banner.warn > svg.lucide { color: var(--warning); }
.ct-pull-card { display: flex; flex-direction: column; gap: 12px; padding: 16px 20px; }
.ct-pull-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ct-pull-head > .grow { display: flex; flex-direction: column; min-width: 240px; }
#ct-alloc-live:empty, #ct-pull-live:empty { display: none; }
.ct-sys { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: var(--radius-lg); background: var(--muted); color: var(--muted-foreground); }
.ct-sys.sm { width: 28px; height: 28px; border-radius: var(--radius-md); }
.ct-sys svg.lucide { width: 16px; height: 16px; }
.ct-logo { width: 20px; height: 20px; object-fit: contain; }
.ct-sys.sm .ct-logo { width: 16px; height: 16px; }
.ct-title-sim { margin-left: 8px; display: inline-flex; }
.ct-sum-foot { margin-top: 8px; }
.ct-warn-t { color: var(--warning); font-weight: 500; }
.ct-neg { color: var(--destructive); font-weight: 500; }
.ct-strong { font-weight: 600; }
.ct-unplaced { display: flex; flex-direction: column; gap: 8px; padding: 16px 20px; }
.ct-unp-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--border); }
.ct-unp-row .grow { display: flex; flex-direction: column; min-width: 0; }
.ct-unp-row .select { width: 200px; flex: none; }
.rx-table .select.sm { height: 32px; min-width: 0; width: 100%; }

/* Period-end pull: one tile per source, each with its own progress */
.ct-pull { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--border-brand); border-radius: var(--radius-xl); background: var(--background-brand); animation: rx-rise var(--motion-deliberate) var(--ease-enter); }
.ct-pull-top { display: flex; align-items: center; gap: 8px; }
.ct-pull-top strong { font-size: 16px; line-height: 24px; font-weight: 600; }
.ct-pull-top .fina-spark { width: 16px; height: 16px; }
.ct-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.ct-tile { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--background); min-width: 0; }
.ct-tile-h { display: flex; align-items: center; gap: 8px; }
.ct-tile-h .grow { display: flex; flex-direction: column; min-width: 0; }
.ct-tile-l { font-size: 14px; line-height: 20px; font-weight: 500; }
.ct-tile-st { display: grid; place-items: center; width: 20px; height: 20px; flex: none; }
.ct-tile-st svg.lucide { width: 16px; height: 16px; color: var(--success); }
.ct-tile-bar { height: 4px; border-radius: var(--radius-full); background: var(--muted); overflow: hidden; }
.ct-tile-bar i { display: block; height: 100%; width: 0; background: var(--primary); }
.ct-tile.run .ct-tile-bar i { animation: ct-fill var(--d, 1200ms) linear forwards; }
.ct-tile.done .ct-tile-bar i { width: 100%; background: var(--success); }
@keyframes ct-fill { from { width: 0; } to { width: 100%; } }
.ct-tile-r { display: flex; flex-direction: column; gap: 2px; min-height: 36px; }
.ct-tile-n { font-weight: 600; color: var(--foreground); }

.ct-imp-src { display: inline-flex; align-items: center; gap: 8px; }
.ct-imp-src > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.ct-file-link { display: inline-flex; align-items: center; gap: 4px; color: var(--primary); font-weight: 500; }
.ct-file-link svg.lucide { width: 14px; height: 14px; }
.ct-alt { gap: 8px; margin-top: 8px; }
.ct-alt > svg.lucide { width: 14px; height: 14px; }
.ct-title-unit { margin-left: 8px; font-weight: 400; }
.ct-center { text-align: center; margin-top: -8px; padding-bottom: 8px; }

.ct-asm { display: flex; flex-direction: column; gap: 16px; padding: 16px 20px; }
.ct-asm .row { gap: 8px; }
.ct-asm .spacer { flex: 1; }
.ct-asm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.ct-asm-f.wide { grid-column: 1 / -1; }
.ct-asm-f label { font-size: 14px; }
.ct-asm-num { display: flex; align-items: center; gap: 8px; }
.ct-asm-num .input { flex: 1 1 auto; min-width: 0; }

/* ---------- Contract tab ---------- */
.ct-ctab-body { display: flex; flex-direction: column; gap: 24px; }
.ct-ctab-top { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 24px; align-items: start; }
.ct-ctab-top > * { min-width: 0; }
.ct-side-card { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.ct-sub-h { margin-top: 8px; font-size: 14px; line-height: 20px; font-weight: 600; }
.ct-kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); column-gap: 24px; }
.ct-kv > div { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.ct-kv dt { color: var(--muted-foreground); font-size: 12px; line-height: 16px; }
.ct-kv dd { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; font-weight: 500; min-width: 0; }
.ct-kv dd > span { min-width: 0; overflow-wrap: anywhere; }
.ct-kv .cite-chip, .ct-kv .cite { flex: none; }
.ct-allclear { display: flex; align-items: center; gap: 8px; color: var(--muted-foreground); }
.ct-allclear svg.lucide { width: 16px; height: 16px; color: var(--success); }
.ct-tl-mods { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ct-tl-mods li { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 0 0 16px 24px; }
.ct-tl-mods li::before { content: ""; position: absolute; left: 5px; top: 14px; bottom: 0; border-left: 1px solid var(--border); }
.ct-tl-mods li:last-child::before { display: none; }
.ct-tl-mods li.off { opacity: .6; }
.ct-tl-dot { position: absolute; left: 0; top: 4px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--primary); background: var(--background); }
.ct-tl-mods .row { gap: 8px; }
.ct-tl-meta { margin-top: 2px; }
.ct-term.ct-mod::before { background: var(--primary); }

@media (max-width: 1180px) {
  .ct-ctab-top { grid-template-columns: minmax(0, 1fr); }
  .ct-step-meta { display: none; }
}
@media (prefers-reduced-motion: reduce) { .ct-tile.run .ct-tile-bar i { animation-duration: 1ms; } }

/* Chrome pass fixes: library fits 1280 px, gate bar static */
.ct-cust { display: block; max-width: 180px; }
.ct-clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; }
#ct-results .rx-table td .badge + .cell-sub { margin-top: 4px; max-width: 140px; }
#ct-results .rx-table td { overflow-wrap: normal; }
#ct-results table { table-layout: fixed; width: 100%; }
#ct-results .cell-main, #ct-results .cell-sub { display: block; min-width: 0; }
