/* Contracts desk (Gil 02.11.2026) - shared skin tokens (skin.css); controls 30 px (desktop) / 40 px (phone, from the
 * skin's own breakpoint); the screen never scrolls as a page - only the table, the list and the thread scroll inside;
 * on the phone the picker and the chat live in a bottom sheet. */
html.cd-open{overflow:hidden}
.cd-desk{position:fixed;inset:0;z-index:60;display:flex;flex-direction:column;background:var(--sk-paper);color:var(--sk-ink);
 font-family:var(--sk-font);--cd-accent:#2f5d8a;--cd-accent-weak:#e6eef6}
.cd-desk[hidden]{display:none}
.cd-desk[data-accent=teal]{--cd-accent:#2a7372;--cd-accent-weak:#e2f0ef}
.cd-desk[data-accent=green]{--cd-accent:#3b7340;--cd-accent-weak:#e5f1e5}
.cd-desk[data-accent=purple]{--cd-accent:#6a4b8f;--cd-accent-weak:#efe9f6}
.cd-desk[data-accent=red]{--cd-accent:#ab4e42;--cd-accent-weak:#f6e7e4}
.cd-desk[data-accent=orange]{--cd-accent:#a3611d;--cd-accent-weak:#f6ecdf}
.cd-desk[data-accent=gray]{--cd-accent:#555a61;--cd-accent-weak:#ececec}
.cd-desk .sk-btn--primary{background:var(--cd-accent);border-color:var(--cd-accent);color:#fff}
.cd-bar{display:flex;align-items:center;gap:8px;height:calc(var(--sk-ctl) + 14px);padding:0 12px;border-bottom:1px solid var(--sk-line);background:var(--sk-sheet,#fff);flex:none}
.cd-mark{height:22px;width:auto}
.cd-title{font-size:var(--sk-fs-lg,16px);margin:0 6px 0 10px;font-weight:600}
.cd-top-actions{display:flex;gap:6px;flex:1;align-items:center}
.cd-history{max-width:240px;height:var(--sk-ctl)}
.cd-usage{font-size:var(--sk-fs-xs,11px)}
.cd-banner{display:flex;gap:8px;align-items:center;padding:6px 12px;background:var(--cd-accent-weak);border-bottom:1px solid var(--sk-line);flex:none}
.cd-banner[hidden]{display:none}
.cd-body{flex:1;min-height:0;display:grid;grid-template-columns:290px minmax(0,1fr) 360px;
 grid-template-areas:"picker result chat" "actions result chat";grid-template-rows:minmax(0,1fr) auto}
.cd-picker{grid-area:picker;display:flex;flex-direction:column;min-height:0;padding:10px;gap:6px;border-inline-end:1px solid var(--sk-line)}
.cd-actions{grid-area:actions;display:flex;flex-wrap:wrap;gap:6px;padding:8px 10px;border-inline-end:1px solid var(--sk-line);border-top:1px solid var(--sk-line)}
.cd-actions[hidden]{display:none}
.cd-result{grid-area:result;min-height:0;min-width:0;display:flex;flex-direction:column;padding:12px 14px;gap:8px}
.cd-chat{grid-area:chat;display:flex;flex-direction:column;min-height:0;border-inline-start:1px solid var(--sk-line);background:var(--sk-sheet,#fff)}
.cd-tabs{display:none}
.cd-search{height:var(--sk-ctl);width:100%}
.cd-count{margin:0;font-size:var(--sk-fs-xs,11px)}
.cd-list{list-style:none;margin:0;padding:0;overflow:auto;flex:1;min-height:0;border:1px solid var(--sk-line);border-radius:var(--sk-r,4px)}
.cd-item label{display:grid;grid-template-columns:auto 3.2em 1fr auto;gap:6px;align-items:center;min-height:var(--sk-ctl);padding:0 8px;cursor:pointer}
.cd-item+.cd-item{border-top:1px solid var(--sk-line)}
.cd-item:hover{background:var(--sk-hover)}
.cd-ptitle{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cd-nofile{opacity:.5}
.cd-chosen{display:flex;flex-direction:column;gap:4px;max-height:30%;overflow:auto}
.cd-chosen-row{display:flex;gap:6px;align-items:center;font-size:var(--sk-fs-sm,12px)}
.cd-chosen-row select{height:var(--sk-ctl-sm,24px);flex:1;min-width:0}
.cd-chosen-row span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cd-empty,.cd-wait{margin:auto;text-align:center}
.cd-wait{color:var(--cd-accent)}
.cd-warn{color:var(--sk-fail,#a33)}
.cd-head{margin:0;font-size:var(--sk-fs-lg,16px)}
.cd-summary{margin:0;padding-inline-start:20px;line-height:1.5}
.cd-table-wrap{flex:1;min-height:0;overflow:auto;border:1px solid var(--sk-line);border-radius:var(--sk-r,4px)}
.cd-table{border-collapse:separate;border-spacing:0;font-size:var(--sk-fs-sm,12.5px);width:100%}
.cd-table th,.cd-table td{border-bottom:1px solid var(--sk-line);border-inline-start:1px solid var(--sk-line);padding:6px 8px;vertical-align:top;text-align:start;min-width:200px;overflow-wrap:anywhere}
.cd-table thead th{position:sticky;top:0;background:var(--sk-sunk,#f1eee9);z-index:1}
.cd-table tbody th{position:sticky;inset-inline-start:0;background:var(--sk-paper);min-width:120px;width:130px;z-index:1}
.cd-table th small,.cd-table th span{display:block;font-weight:400}
.cd-table .cd-target{background:var(--cd-accent-weak)}
.cd-val{margin-bottom:4px}
.cd-cite{display:block;color:var(--sk-ink-2);font-size:var(--sk-fs-xs,11px);line-height:1.4}
.cd-cite q{display:block;font-style:italic}
.cd-thread{list-style:none;margin:0;padding:10px;overflow:auto;flex:1;min-height:0;display:flex;flex-direction:column;gap:8px}
.cd-links{display:flex;flex-wrap:wrap;gap:6px;margin-top:6px}
.cd-links .sk-btn{min-height:30px;height:auto;white-space:normal}
.cd-clause-bar{align-self:flex-start}
.cd-clause-count{margin:0}
.cd-clause{table-layout:fixed}
.cd-clause th,.cd-clause td{min-width:0;white-space:pre-wrap}
.cd-clause th:nth-child(odd):not(:last-child),.cd-clause .cd-ref{width:92px}
.cd-clause th:last-child{width:22%}
.cd-clause .cd-essence{background:var(--cd-accent-weak)}
.cd-clause .cd-state-same .cd-essence,.cd-clause .cd-state-wording .cd-essence{background:none;color:var(--sk-muted,#667)}
.cd-q{align-self:flex-start;background:var(--cd-accent-weak);padding:6px 10px;border-radius:10px;max-width:90%;white-space:pre-wrap}
.cd-a{align-self:flex-end;background:var(--sk-sunk,#f1eee9);padding:6px 10px;border-radius:10px;max-width:95%}
.cd-answer{margin:0 0 4px;white-space:pre-wrap}
.cd-form{border-top:1px solid var(--sk-line);padding:8px;display:flex;flex-direction:column;gap:6px;flex:none}
.cd-input{width:100%;resize:none}
.cd-form-row{display:flex;gap:6px;align-items:center}
.cd-att-list{flex:1;font-size:var(--sk-fs-xs,11px);overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.cd-attach{cursor:pointer}
.cd-check-dialog{border:1px solid var(--sk-line);border-radius:var(--sk-r-lg,8px);padding:14px;min-width:300px}
.cd-check-form{display:flex;flex-direction:column;gap:10px}
.cd-check-form h3{margin:0}
.cd-field{display:flex;flex-direction:column;gap:4px;border:0;padding:0;margin:0}
.cd-field label{display:flex;gap:6px;align-items:center;min-height:var(--sk-ctl)}
.cd-dialog-row{display:flex;gap:6px;justify-content:flex-end}
.cd-desk[data-density=compact] .cd-item label{min-height:24px}
.cd-desk[data-density=compact] .cd-table th,.cd-desk[data-density=compact] .cd-table td{padding:3px 6px}
.cd-toggle{position:relative}
.cd-badge{position:absolute;top:-4px;inset-inline-end:-4px;min-width:16px;height:16px;border-radius:8px;background:var(--sk-accent);color:#fff;font-size:10px;line-height:16px;text-align:center}
.cd-badge[hidden]{display:none}
.cd-ping{outline:2px solid var(--sk-accent)}
body.cd-standalone{margin:0}

/* phone: the result fills the screen, the picker (+ its actions) and the chat are a bottom sheet with two tabs */
@media (max-width:760px){
 .cd-bar{padding:0 8px;gap:6px}
 .cd-title{margin:0 4px}
 .cd-history,.cd-usage{display:none}
 .cd-top-actions{overflow-x:auto}
 .cd-body{display:flex;flex-direction:column;position:relative}
 .cd-result{flex:1;padding:8px 8px calc(var(--sk-ctl) + 22px)}
 .cd-picker,.cd-actions,.cd-chat{position:fixed;inset-inline:0;z-index:61;background:var(--sk-sheet,#fff);border:0;display:none}
 .cd-desk.cd-sheet-open[data-sheet=projects] .cd-picker{display:flex;bottom:calc(var(--sk-ctl) + 70px);height:calc(68vh - var(--sk-ctl) - 70px);border-top:1px solid var(--sk-line-strong,#999);box-shadow:var(--sk-shadow)}
 .cd-desk.cd-sheet-open[data-sheet=projects][data-actions=below_picker] .cd-actions{display:flex;bottom:calc(var(--sk-ctl) + 18px);height:52px;align-items:center;flex-wrap:nowrap;overflow-x:auto}
 .cd-desk.cd-sheet-open[data-sheet=chat] .cd-chat{display:flex;bottom:calc(var(--sk-ctl) + 18px);height:calc(68vh - var(--sk-ctl) - 18px);border-top:1px solid var(--sk-line-strong,#999);box-shadow:var(--sk-shadow)}
 .cd-tabs{display:flex;position:fixed;bottom:0;inset-inline:0;z-index:62;gap:6px;padding:8px;background:var(--sk-sheet,#fff);border-top:1px solid var(--sk-line)}
 .cd-tabs button{flex:1}
 .cd-table th,.cd-table td{min-width:180px}
 .cd-clause,.cd-clause tbody,.cd-clause tr,.cd-clause td{display:block;width:auto}
 .cd-clause thead{display:none}
 .cd-clause tr{border-bottom:2px solid var(--sk-line);padding:4px 0}
 .cd-clause td{min-width:0;border:0;padding:3px 8px}
 .cd-clause td::before{content:attr(data-label);display:block;font-size:11px;color:var(--sk-muted,#667)}
 .cd-table tbody th{min-width:96px;width:96px}
}
