/* ── native tool host ──────────────────────────────────────────────────
   Styling for tools the workspace renders itself. Everything here is driven
   by the block types an adapter can emit, never by which tool is open: a
   selector naming a particular tool would be the contract leaking.
   Variables come from workspace.css, so a native tool is in the workspace's
   theme, light and dark, without knowing either exists. */

.ws-tool-native{display:block;padding:18px;max-height:calc(100vh - 164px);overflow-y:auto}
/* Both surfaces set display, which would otherwise beat the hidden attribute
   and leave the unused one holding its space. */
.ws-tool-native[hidden],.ws-tool-workspace-frame[hidden]{display:none}
.ws-tool-loading{padding:40px 0;color:var(--ws-muted);font-size:12px;text-align:center}

.ws-tool-search{display:flex;align-items:center;gap:9px;padding:0 12px;border:1px solid var(--ws-border-strong);border-radius:7px;background:var(--ws-surface-soft)}
.ws-tool-search:focus-within{border-color:var(--ws-accent-bright);box-shadow:0 0 0 3px var(--ws-accent-soft)}
.ws-tool-search-prompt{color:var(--ws-accent-bright);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:13px}
.ws-tool-search-input{flex:1;min-width:0;height:44px;border:0;background:none;color:var(--ws-text);font:inherit;font-size:15px;outline:none}

.ws-tool-suggestions{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px}
.ws-tool-suggestion{padding:5px 9px;border:1px solid var(--ws-border);border-radius:20px;background:var(--ws-surface);color:var(--ws-muted);font:inherit;font-size:10px;cursor:pointer}
.ws-tool-suggestion:hover{border-color:var(--ws-border-strong);color:var(--ws-text)}

.ws-tool-candidates{display:grid;gap:2px;margin-top:10px;padding:5px;border:1px solid var(--ws-border);border-radius:7px;background:var(--ws-surface-soft)}
.ws-tool-candidate{display:flex;align-items:center;gap:9px;padding:7px 9px;border:0;border-radius:5px;background:none;color:var(--ws-text);font:inherit;font-size:11px;text-align:left;cursor:pointer}
.ws-tool-candidate:hover{background:var(--ws-surface)}
.ws-tool-candidate.is-active{background:var(--ws-accent-soft)}
.ws-tool-candidate-key{width:12px;color:var(--ws-faint);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:10px}
.ws-tool-candidate-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ws-tool-candidate-detail{color:var(--ws-faint);font-size:9px;text-transform:uppercase;letter-spacing:.06em}

.ws-tool-empty{margin-top:16px;padding:26px 18px;border:1px dashed var(--ws-border);border-radius:8px;color:var(--ws-muted);font-size:12px;line-height:1.7;text-align:center}

.ws-tool-result{margin-top:14px;overflow:hidden;border:1px solid var(--ws-border);border-radius:9px;background:var(--ws-surface)}
.ws-tool-result-bar{display:flex;align-items:center;gap:8px;padding:8px 12px;border-bottom:1px solid var(--ws-border);background:var(--ws-surface-soft)}
.ws-tool-result-dot{width:7px;height:7px;border-radius:50%;background:var(--ws-accent-bright)}
.ws-tool-result-id{color:var(--ws-muted);font-size:10px;text-transform:uppercase;letter-spacing:.07em}
.ws-tool-result--stop .ws-tool-result-dot,.ws-tool-result--warn .ws-tool-result-dot{background:var(--ws-danger)}
.ws-tool-result--ask .ws-tool-result-dot{background:var(--ws-gold)}
.ws-tool-result-body{padding:16px}

.ws-tool-verdict{display:flex;align-items:flex-start;gap:11px}
.ws-tool-verdict-icon{flex:none;width:24px;height:24px;margin-top:2px;color:var(--ws-accent-bright)}
.ws-tool-result--stop .ws-tool-verdict-icon,.ws-tool-result--warn .ws-tool-verdict-icon{color:var(--ws-danger)}
.ws-tool-result--ask .ws-tool-verdict-icon{color:var(--ws-gold)}
.ws-tool-verdict-line{color:var(--ws-text);font-size:20px;font-weight:700;line-height:1.3}
.ws-tool-verdict-sub{margin-top:3px;color:var(--ws-muted);font-size:12px;line-height:1.55}

.ws-tool-strip{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin-top:14px}
.ws-tool-strip-arrow{color:var(--ws-faint);font-size:11px}
.ws-tool-chip{display:inline-flex;align-items:center;gap:5px;padding:4px 9px;border:1px solid var(--ws-border);border-radius:20px;background:var(--ws-surface-soft);color:var(--ws-text);font-size:10px;font-weight:600;white-space:nowrap}
.ws-tool-chip svg{width:12px;height:12px}
.ws-tool-chip--level{border-color:var(--ws-accent-soft);background:var(--ws-accent-soft);color:var(--ws-accent)}
.ws-tool-chip--MEMBERS_SPECIAL,.ws-tool-chip--CENTRAL_GOVT,.ws-tool-chip--PROHIBITED{border-color:var(--ws-danger);background:transparent;color:var(--ws-danger)}
.ws-tool-chip--due{border-style:dashed;color:var(--ws-muted)}
.ws-tool-chip--none{color:var(--ws-faint)}
.ws-tool-chip--action{border-color:var(--ws-border-strong);font:inherit;font-size:10px;font-weight:700;cursor:pointer}
.ws-tool-chip--action:hover{border-color:var(--ws-accent-bright);color:var(--ws-accent)}

.ws-tool-controls{display:flex;flex-wrap:wrap;gap:6px;margin-top:14px;padding-top:13px;border-top:1px solid var(--ws-border)}
.ws-tool-ctl{display:inline-flex;align-items:center;gap:5px;padding:3px 7px;border:1px solid var(--ws-border);border-radius:5px;background:var(--ws-surface-soft)}
.ws-tool-ctl.is-wanted{border-color:var(--ws-gold);background:transparent}
.ws-tool-ctl-label{color:var(--ws-muted);font-size:9px;text-transform:uppercase;letter-spacing:.05em;white-space:nowrap}
.ws-tool-ctl-input{width:104px;height:24px;border:0;background:none;color:var(--ws-text);font:inherit;font-size:11px;outline:none}
.ws-tool-ctl-input[type=date]{width:120px}
select.ws-tool-ctl-input{width:auto;cursor:pointer}
.ws-tool-toggle{padding:0;border:0;background:none;color:var(--ws-muted);font:inherit;font-size:10px;font-weight:600;cursor:pointer}
.ws-tool-toggle.is-yes{color:var(--ws-accent)}
.ws-tool-toggle.is-no{color:var(--ws-danger)}

/* form-shaped tools: the questions are the interface, not a strip under it */
.ws-tool-intro{margin:0 0 10px;color:var(--ws-muted);font-size:11px}
.ws-tool-form{display:flex;flex-wrap:wrap;gap:6px;padding:12px;border:1px solid var(--ws-border);border-radius:8px;background:var(--ws-surface-soft)}
.ws-tool-form .ws-tool-ctl{background:var(--ws-surface)}

.ws-tool-multi{display:inline-flex;flex-wrap:wrap;gap:4px}
.ws-tool-multi-chip{padding:3px 8px;border:1px solid var(--ws-border);border-radius:20px;background:var(--ws-surface);color:var(--ws-muted);font:inherit;font-size:10px;cursor:pointer}
.ws-tool-multi-chip:hover{border-color:var(--ws-border-strong);color:var(--ws-text)}
.ws-tool-multi-chip.is-on{border-color:var(--ws-accent-bright);background:var(--ws-accent-soft);color:var(--ws-accent);font-weight:700}

/* a dated list: what falls due, when, and what it costs to miss */
.ws-tool-entries{display:grid;gap:1px;background:var(--ws-border)}
.ws-tool-entry{display:grid;grid-template-columns:44px minmax(0,1fr) 150px;gap:12px;padding:10px 16px;background:var(--ws-surface);border-left:2px solid transparent}
/* Not every list has a lead column; one without it gets the space back. */
.ws-tool-entry:not(:has(.ws-tool-entry-lead)){grid-template-columns:minmax(0,1fr) 150px}
.ws-tool-entry--blocker{border-left-color:var(--ws-danger)}
.ws-tool-entry--warning{border-left-color:var(--ws-gold)}
.ws-tool-entry--advisory{border-left-color:var(--ws-border-strong)}
.ws-tool-entry-lead{display:grid;justify-items:center;align-content:start;padding-top:1px}
.ws-tool-entry-lead strong{color:var(--ws-text);font-size:16px;line-height:1.1;font-variant-numeric:tabular-nums}
.ws-tool-entry-lead span{color:var(--ws-faint);font-size:9px;text-transform:uppercase;letter-spacing:.06em}
.ws-tool-entry-main{min-width:0}
.ws-tool-entry-code{color:var(--ws-accent);font-size:9px;font-weight:700;text-transform:uppercase;letter-spacing:.06em}
.ws-tool-entry-title{margin-top:1px;color:var(--ws-text);font-size:11px;font-weight:700}
.ws-tool-entry-text{margin-top:3px;color:var(--ws-muted);font-size:10px;line-height:1.6}
.ws-tool-entry-side{display:grid;justify-items:end;align-content:start;gap:4px}
.ws-tool-entry-tag{padding:2px 7px;border:1px solid var(--ws-border);border-radius:20px;color:var(--ws-muted);font-size:9px;font-weight:700;letter-spacing:.04em}
.ws-tool-entry-meta{display:flex;gap:5px;align-items:baseline}
.ws-tool-entry-meta-label{color:var(--ws-faint);font-size:9px}
.ws-tool-entry-meta-value{color:var(--ws-text);font-size:9px;font-weight:600;text-align:right}
.ws-tool-entry--blocker .ws-tool-entry-meta:first-of-type .ws-tool-entry-meta-value{color:var(--ws-danger)}
.ws-tool-entry--warning .ws-tool-entry-meta:first-of-type .ws-tool-entry-meta-value{color:var(--ws-gold)}

/* a control the answer is written into */
.ws-tool-ctl--text{display:flex;flex-direction:column;align-items:stretch;gap:4px;flex:1 1 100%;padding:8px 9px}
.ws-tool-textarea{width:100%;min-height:120px;padding:8px;border:1px solid var(--ws-border);border-radius:5px;background:var(--ws-surface);color:var(--ws-text);font:inherit;font-size:11px;line-height:1.6;resize:vertical}
.ws-tool-textarea:focus{outline:none;border-color:var(--ws-accent-bright);box-shadow:0 0 0 3px var(--ws-accent-soft)}
.ws-tool-ctl-hint{color:var(--ws-faint);font-size:9px}

/* Dropping a document in. The whole text control is the target, not a
   separate strip, so a reader who aims at the box they are going to read is
   not told they missed. */
.ws-tool-ctl--text{position:relative;border:1px dashed transparent;border-radius:7px;transition:border-color .12s,background-color .12s}
.ws-tool-ctl--text.is-dragover{border-color:var(--ws-accent-bright);background:var(--ws-accent-soft)}
.ws-tool-ctl--text.is-dragover .ws-tool-textarea{border-color:var(--ws-accent-bright)}
.ws-tool-ctl--text.is-reading .ws-tool-textarea{opacity:.6}
.ws-tool-drop-bar{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:5px}
.ws-tool-drop-note{color:var(--ws-faint);font-size:9px}
.ws-tool-drop-input{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.ws-tool-drop-choose{flex:none;padding:4px 9px;border:1px solid var(--ws-border);border-radius:5px;background:var(--ws-surface);color:var(--ws-text);font-size:9px;font-weight:600;cursor:pointer}
.ws-tool-drop-choose:hover{border-color:var(--ws-border-strong)}
.ws-tool-drop-input:focus-visible + .ws-tool-drop-choose,
.ws-tool-drop-choose:focus-visible{outline:2px solid var(--ws-accent-bright);outline-offset:2px}
.ws-tool-drop-status{display:block;min-height:12px;margin-top:4px;font-size:9px;line-height:1.5;color:var(--ws-faint)}
.ws-tool-drop-status.is-busy{color:var(--ws-accent)}
.ws-tool-drop-status.is-ok{color:var(--ws-accent)}
.ws-tool-drop-status.is-error{color:var(--ws-danger,#a64242)}

/* work in progress, and work that failed */
.ws-tool-status{display:flex;align-items:center;gap:11px;padding:14px 16px}
.ws-tool-status-copy{display:grid;gap:2px;flex:1;min-width:0}
.ws-tool-status-copy strong{color:var(--ws-text);font-size:11px}
.ws-tool-status-copy span{color:var(--ws-muted);font-size:10px}
.ws-tool-status--error .ws-tool-status-copy strong{color:var(--ws-danger)}
.ws-tool-spinner{flex:none;width:15px;height:15px;border:2px solid var(--ws-border-strong);border-top-color:var(--ws-accent-bright);border-radius:50%;animation:ws-tool-spin .7s linear infinite}
@keyframes ws-tool-spin{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){.ws-tool-spinner{animation-duration:2.4s}}

.ws-tool-section{border-top:1px solid var(--ws-border)}
.ws-tool-section-summary{padding:10px 16px;color:var(--ws-muted);font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.07em;cursor:pointer;list-style:none}
.ws-tool-section-summary::-webkit-details-marker{display:none}
.ws-tool-section-summary::before{content:"+ ";color:var(--ws-faint)}
.ws-tool-section[open] .ws-tool-section-summary::before{content:"– "}
.ws-tool-section-summary:hover{color:var(--ws-text)}
.ws-tool-block-heading{padding:12px 16px 4px;color:var(--ws-faint);font-size:9px;font-weight:700;text-transform:uppercase;letter-spacing:.08em}
.ws-tool-finding{padding:9px 16px 11px;border-left:2px solid transparent}
.ws-tool-finding--blocker{border-left-color:var(--ws-danger)}
.ws-tool-finding--warning{border-left-color:var(--ws-gold)}
.ws-tool-finding--advisory{border-left-color:var(--ws-border-strong)}
.ws-tool-finding-title{color:var(--ws-text);font-size:11px;font-weight:700}
.ws-tool-finding-text{margin-top:3px;color:var(--ws-muted);font-size:11px;line-height:1.65}
.ws-tool-finding-ref{margin-top:4px;color:var(--ws-faint);font-size:9px;font-style:italic}
.ws-tool-rows{width:calc(100% - 32px);margin:0 16px 8px;border-collapse:collapse;font-size:11px}
.ws-tool-rows-label{padding:3px 0;color:var(--ws-muted)}
.ws-tool-rows-value{padding:3px 0;color:var(--ws-text);font-variant-numeric:tabular-nums;text-align:right}
.ws-tool-bullets{margin:0;padding:0 16px 10px 32px;color:var(--ws-muted);font-size:11px;line-height:1.7}
.ws-tool-bullets-ref{list-style:none;margin-left:-14px;color:var(--ws-faint);font-size:9px;font-style:italic}
.ws-tool-note{margin:10px 16px;padding:9px 11px;border-radius:6px;background:var(--ws-surface-soft);color:var(--ws-muted);font-size:11px;line-height:1.6}
.ws-tool-note--warn{border-left:2px solid var(--ws-gold);color:var(--ws-text)}
.ws-tool-pre-box{padding:0 16px 14px}
.ws-tool-pre{margin:0 0 8px;padding:12px;max-height:340px;overflow:auto;border:1px solid var(--ws-border);border-radius:6px;background:var(--ws-surface-soft);color:var(--ws-text);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px;line-height:1.7;white-space:pre-wrap}

.ws-tool-keep{display:flex;flex-wrap:wrap;align-items:center;gap:10px;padding:12px 16px;border-top:1px solid var(--ws-border);background:var(--ws-surface-soft)}
.ws-tool-keep-hint{color:var(--ws-muted);font-size:10px}
.ws-tool-foot{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:10px;margin-top:12px}
.ws-tool-footnote{margin:0;color:var(--ws-faint);font-size:9px;text-align:center}
.ws-tool-reset{padding:0;border:0;background:none;color:var(--ws-muted);font:inherit;font-size:9px;font-weight:700;text-decoration:underline;text-underline-offset:2px;cursor:pointer}
.ws-tool-reset:hover{color:var(--ws-text)}

@media(max-width:640px){
  .ws-tool-native{padding:12px;max-height:calc(100vh - 190px)}
  .ws-tool-entry{grid-template-columns:36px minmax(0,1fr);gap:9px;padding:9px 12px}
  .ws-tool-entry-side{grid-column:2;justify-items:start}
  .ws-tool-verdict-line{font-size:17px}
  .ws-tool-search-input{height:40px;font-size:14px}
}

/* ── the matter's obligation register ──────────────────────────────────
   Not styled as a checklist: an obligation carries a date and a provision,
   and both have to be readable at a glance for the list to be worth having. */
.ws-obligation-card{margin-top:14px}
.ws-obligation-list{display:grid;gap:1px;background:var(--ws-border);border:1px solid var(--ws-border);border-radius:7px;overflow:hidden}
.ws-obligation{display:grid;grid-template-columns:auto minmax(0,1fr) 110px auto;gap:10px;align-items:start;padding:9px 11px;background:var(--ws-surface)}
.ws-obligation input[type=checkbox]{margin-top:2px;accent-color:var(--ws-accent)}
.ws-obligation-copy{display:grid;gap:2px;min-width:0}
.ws-obligation-copy strong{color:var(--ws-text);font-size:11px}
.ws-obligation-copy span{color:var(--ws-muted);font-size:10px;line-height:1.5}
.ws-obligation-copy em{color:var(--ws-faint);font-size:9px;font-style:italic}
.ws-obligation-due{display:grid;gap:1px;justify-items:end;text-align:right}
.ws-obligation-due strong{color:var(--ws-text);font-size:10px;font-variant-numeric:tabular-nums}
.ws-obligation-due span{color:var(--ws-faint);font-size:9px}
.ws-obligation button{border:0;background:none;color:var(--ws-faint);font-size:13px;line-height:1;cursor:pointer;padding:0 2px}
.ws-obligation button:hover{color:var(--ws-danger)}
.ws-obligation.is-overdue .ws-obligation-due strong{color:var(--ws-danger)}
.ws-obligation.is-done .ws-obligation-copy strong{text-decoration:line-through;color:var(--ws-muted)}
.ws-obligation.is-superseded{opacity:.55}
.ws-obligation.is-superseded .ws-obligation-copy strong{text-decoration:line-through}

@media(max-width:640px){
  .ws-obligation{grid-template-columns:auto minmax(0,1fr) auto}
  .ws-obligation-due{grid-column:2;justify-items:start;text-align:left}
}

/* ── the matter's file ─────────────────────────────────────────────────
   A document row has to answer four things at a glance: what it is, what
   it says, where it came from, and whether the words are actually here. */
.ws-document-card{margin-top:14px}
.ws-document-card .ws-detail-card-heading{align-items:flex-start}
.ws-document-list{display:grid;gap:1px;background:var(--ws-border);border:1px solid var(--ws-border);border-radius:7px;overflow:hidden}
.ws-document{display:grid;grid-template-columns:78px minmax(0,1fr) 118px auto;gap:11px;align-items:start;padding:10px 11px;background:var(--ws-surface)}
.ws-document-kind{padding:2px 7px;border:1px solid var(--ws-border);border-radius:20px;color:var(--ws-accent);font-size:9px;font-weight:700;text-transform:uppercase;letter-spacing:.05em;text-align:center}
.ws-document-copy{display:grid;gap:2px;min-width:0}
.ws-document-copy strong{color:var(--ws-text);font-size:11px}
.ws-document-version{color:var(--ws-accent);font-size:9px;font-weight:700}
.ws-document-copy span{overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;color:var(--ws-muted);font-size:10px;line-height:1.5}
.ws-document-copy em{color:var(--ws-faint);font-size:9px;font-style:italic}
.ws-document-meta{display:grid;gap:1px;justify-items:end;text-align:right}
.ws-document-meta span{color:var(--ws-faint);font-size:9px}
.ws-document-held{color:var(--ws-accent)!important;font-weight:700}
.ws-document-held.is-record{color:var(--ws-faint)!important;font-weight:400}
.ws-document-actions{display:flex;gap:2px}
.ws-document-actions button{border:0;background:none;color:var(--ws-faint);font-size:13px;line-height:1;cursor:pointer;padding:0 3px}
.ws-document-actions button:hover{color:var(--ws-text)}
.ws-document-actions button[data-delete-document]:hover{color:var(--ws-danger)}
.ws-document.is-stale .ws-document-copy em{color:var(--ws-gold)}

.ws-tool-keep-copy{display:inline-flex;align-items:center;gap:6px;color:var(--ws-muted);font-size:10px;cursor:pointer}
.ws-tool-keep-copy input{accent-color:var(--ws-accent)}

@media(max-width:640px){
  .ws-document{grid-template-columns:minmax(0,1fr) auto}
  .ws-document-kind{grid-column:1;justify-self:start}
  .ws-document-copy{grid-column:1/-1}
  .ws-document-meta{grid-column:1;justify-items:start;text-align:left}
}

/* The matter's own column: workflow, file, register. */
.ws-detail-main{display:grid;align-content:start;gap:17px;min-width:0}
@media(max-width:900px){ .ws-detail-main{gap:10px} }

/* ── the company page ────────────────────────────────────────────────── */
.ws-organisation-card{cursor:pointer}
.ws-organisation-card.is-overdue{border-color:var(--ws-danger)}
.ws-org-details em{color:var(--ws-danger);font-style:normal;font-size:9px}
.ws-org-matter-list{display:grid;gap:1px;background:var(--ws-border);border:1px solid var(--ws-border);border-radius:7px;overflow:hidden}
.ws-org-matter{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:9px 11px;border:0;background:var(--ws-surface);color:var(--ws-text);font:inherit;font-size:11px;text-align:left;cursor:pointer}
.ws-org-matter:hover{background:var(--ws-surface-soft)}
.ws-org-matter > span:first-child{display:grid;gap:1px;min-width:0}
.ws-org-matter strong{font-size:11px}
.ws-org-matter span span{color:var(--ws-muted);font-size:9px}
.ws-org-matter > span:last-child{color:var(--ws-faint);font-size:9px;white-space:nowrap}
.ws-org-tags{display:flex;flex-wrap:wrap;gap:5px}
.ws-org-tag{padding:3px 8px;border:1px solid var(--ws-accent-soft);border-radius:20px;background:var(--ws-accent-soft);color:var(--ws-accent);font-size:9px;font-weight:700}
.ws-org-tag.is-empty{border-color:var(--ws-border);background:none;color:var(--ws-faint);font-weight:400}
