/* Contracts, client view, contract workspace (Overview, Extraction review, Resource allocation). Kit tokens only. */
.ct-view { min-width: 0; }
.ct-view > .wash, .ct-view > .ct-work { margin-bottom: 16px; }
.ct-head { align-items: center; }
.ct-back { margin-bottom: 12px; }
.ct-gap { margin-top: 16px; }
.ct-h2 { margin: 24px 0 8px; }
.ct-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ct-id { font-weight: 500; white-space: nowrap; }

/* Filter row: 32px controls left, count and Expand all right */
.ct-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.ct-search { position: relative; width: 220px; flex: 0 1 220px; }
.ct-search svg.lucide { position: absolute; left: 10px; top: 8px; color: var(--muted-foreground); pointer-events: none; }
.ct-search .input { padding-left: 32px; }
.ct-select { width: auto; flex: 0 0 auto; }
.ct-tools-end { display: inline-flex; align-items: center; gap: 12px; margin-left: auto; white-space: nowrap; }

/* Contracts table: fixed widths sum to 940 px, inside the ~960 px content width at 1280 */
.ct-table { table-layout: fixed; }
.ct-c-id { width: 120px; } .ct-c-cust { width: 140px; } .ct-c-type { width: 166px; } .ct-c-val { width: 116px; }
.ct-c-term { width: 100px; } .ct-c-stage { width: 150px; } .ct-c-mod { width: 108px; } .ct-c-act { width: 40px; }
.ct-table td.num .cell-sub { white-space: normal; }
.table td.ct-mod { padding-left: 4px; padding-right: 4px; text-align: right; }
.ct-mod .btn { padding: 0 8px; gap: 4px; }
.ct-ell { overflow: hidden; text-overflow: ellipsis; }
.ct-cust-badge { display: block; margin-top: 4px; }
.ct-idline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.table td.act svg.lucide { color: var(--muted-foreground); }

/* Side panel: document */
.ct-doc { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.ct-doc section { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ct-dl { display: grid; grid-template-columns: 128px minmax(0, 1fr); margin: 0; }
.ct-dl dt, .ct-dl dd { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--border); }
.ct-dl dt { color: var(--muted-foreground); padding-right: 12px; }
.ct-dl dt:nth-last-of-type(1), .ct-dl dd:last-child { border-bottom: 0; }
.ct-terms { display: flex; flex-direction: column; gap: 2px; }
.ct-term { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; min-height: 32px; padding: 4px 8px; border: 0; border-radius: var(--radius-md); background: var(--background); text-align: left; cursor: pointer; }
.ct-term:hover { background: var(--accent); }
.ct-term.on { background: var(--muted-brand); }
.ct-term-l { display: flex; flex-direction: column; min-width: 0; }
.ct-term-r { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.ct-term-r .cite { margin: 0; }
.ct-sheet { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.ct-sheet-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--muted); }
.ct-clause { padding: 8px 12px; }
.ct-clause p { margin-top: 4px; color: var(--muted-foreground); }
.ct-clause.on { background: var(--background-brand); box-shadow: inset 2px 0 0 var(--primary); }
.ct-clause.on p { color: var(--foreground); }
.ct-versions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ct-versions li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border); }
.ct-versions li:last-child { border-bottom: 0; }
.ct-vpill { flex: 0 0 64px; display: inline-flex; align-items: center; justify-content: center; height: 24px; border-radius: var(--radius-full); font-size: 12px; font-weight: 500; color: var(--muted-foreground); box-shadow: inset 0 0 0 1px var(--border); white-space: nowrap; }
.ct-vpill.on { background: var(--muted-brand); color: var(--primary); box-shadow: none; }
.ct-flag { display: flex; align-items: flex-start; gap: 8px; padding: 8px 12px; margin-top: 4px; font-family: var(--font-serif); }
.ct-flag .badge { font-family: var(--font-sans); }
.ct-flag .fina-spark { margin-top: 2px; }

/* Dialogs */
.dialog.ct-dialog { width: min(880px, 100%); display: flex; flex-direction: column; gap: 16px; }
.ct-dialog .dialog-foot { margin-top: 0; }
.ct-dlg-body { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ct-dlg-table { min-width: 760px; }
.ct-dlg-table input[type="checkbox"] { accent-color: var(--primary); width: 16px; height: 16px; }
.ct-file { word-break: break-all; min-width: 200px; }
.ct-drop { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 32px 16px; border: 2px dashed var(--border); border-radius: var(--radius-lg); text-align: center; }
.ct-drop svg.lucide { width: 20px; height: 20px; color: var(--muted-foreground); }
.ct-work { padding: 16px; }

/* Stat cards above the filters (revenue product StatCard): click focuses the list */
.ct-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.ct-stat { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; text-align: left; font: inherit; color: inherit; }
.ct-stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; }
.ct-stat-top svg.lucide { color: var(--muted-foreground); }
.ct-stat-value { font-size: 20px; line-height: 28px; font-weight: 600; white-space: nowrap; }
.ct-stat.destructive .ct-stat-value { color: var(--destructive); }
.ct-stat.warning .ct-stat-value { color: var(--warning); }
.ct-stat.on { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); background: var(--background-brand); }

/* Contract workspace (round 5): meta line, step tracker, Next card, step body, gate bar */
.ct-ws-meta { gap: 8px; align-items: center; margin: -12px 0 16px; }
.ct-ws-body { margin-top: 24px; min-width: 0; }
.ct-ov-title { margin-bottom: 16px; }
.btn.ct-on { background: var(--accent); }

/* FS Prep step tracker: numbered circles; done filled with a check, current outlined and semibold, locked muted and disabled */
.ct-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 8px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); container-type: inline-size; }
/* Narrow (side panel open): keep every step visible; titles only, no separators */
@container (max-width: 720px) { .ct-step-meta, .ct-step-sep { display: none; } }
.ct-step { flex: none; height: auto; min-height: 40px; gap: 8px; padding: 4px 8px; text-align: left; }
.ct-step.on { background: var(--accent); }
.ct-step:disabled { opacity: 1; cursor: not-allowed; }
.ct-step-dot { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--border); font-size: 12px; line-height: 16px; color: var(--muted-foreground); }
.ct-step-dot svg.lucide { width: 12px; height: 12px; }
.ct-step.done .ct-step-dot { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.ct-step.current .ct-step-dot { border-color: var(--primary); color: var(--primary); }
.ct-step-text { display: flex; flex-direction: column; min-width: 0; }
.ct-step-title { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--foreground); white-space: nowrap; }
.ct-step.current .ct-step-title { font-weight: 600; }
.ct-step.locked .ct-step-title { color: var(--muted-foreground); }
.ct-step-meta { font-size: 12px; line-height: 16px; font-weight: 400; color: var(--muted-foreground); white-space: nowrap; }
.ct-step-sep { flex: 0 0 16px; height: 1px; background: var(--border); }

/* Next card (revenue contract to-do row) */
.ct-next { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.ct-next-ic { flex: none; display: inline-flex; }
.ct-next-ic.success { color: var(--success); } .ct-next-ic.warning { color: var(--warning); }
.ct-next-ic.info { color: var(--information); } .ct-next-ic.destructive { color: var(--destructive); }
.ct-next-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.ct-next .btn { flex: none; }

/* FS Prep gate bar: blockers left, move-on button right */
.ct-gate { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; margin-top: 24px; padding: 12px 0 0; border-top: 1px solid var(--border); }
.ct-gate-lines { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.ct-gate-line { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; line-height: 16px; color: var(--muted-foreground); }
.ct-gate-line svg.lucide { width: 16px; height: 16px; flex: none; }
.ct-gate-line.destructive { color: var(--foreground); } .ct-gate-line.destructive svg.lucide { color: var(--destructive); }
.ct-gate-line.success svg.lucide { color: var(--success); }
.ct-gate > .btn { margin-left: auto; }
/* Overview: summary, terms and versions left; signed document right, sticky with its own scroll */
.ct-ov { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.ct-ov .card { display: flex; flex-direction: column; gap: 8px; }
.ct-ov-sheet { position: sticky; top: 0; display: flex; flex-direction: column; max-height: calc(100vh - 160px); }
.ct-ov-sheet .ct-sheet-body { overflow: auto; min-height: 0; }
@media (max-width: 1100px) { .ct-ov { grid-template-columns: minmax(0, 1fr); } .ct-ov-sheet { position: static; max-height: none; } }

/* Extraction review tab */
.ex-tab { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.ex-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.ex-facts > div { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.ex-dhead { gap: 8px; }
.ex-sec { display: flex; flex-direction: column; gap: 8px; }
.ex-sub { table-layout: fixed; border: 1px solid var(--border); border-radius: var(--radius-lg); border-collapse: separate; border-spacing: 0; overflow: hidden; }
.ex-sub th { height: 32px; }
.ex-c1 { width: 24%; }
.ex-c3w { width: 32%; }
.ex-valline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ex-c4 { width: 208px; }
.ex-sub .cite { margin: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-extracted { padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.ex-pair { gap: 12px; }
.ex-full { align-self: flex-start; }
.table .cell-sub.clamp-2 { display: -webkit-box; }

.ct-effects { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.ct-effects li { display: flex; flex-direction: column; }
.dialog.ct-dialog-sm { width: min(640px, 100%); }
.ct-client { border: 0; background: none; padding: 0; color: var(--primary); cursor: pointer; text-align: left; max-width: 100%; font: inherit; font-weight: 500; }
.ct-table th.ct-th-wrap { white-space: normal; line-height: 16px; }
