html:has(.compact-shell) {
  --ui-bg:#050a08; --ui-panel:#0c1310; --ui-line:#202b26;
  --ui-text:#d7dfdb; --ui-muted:#89978f; --ui-accent:#31c99b;
  --ui-accent-hover:#58d8af; --ui-on-accent:#05291d;
  --ui-soft:#0b2219; --ui-input:#0e1612;
  --green:var(--ui-accent); --border:var(--ui-line);
  color:var(--ui-text); background:var(--ui-bg); color-scheme:dark;
}
html:has(.compact-shell.crm-light) {
  --ui-bg:#e2e6eb; --ui-panel:#eceff2; --ui-line:#c5cdd5;
  --ui-text:#18252f; --ui-muted:#485763; --ui-accent:#087256;
  --ui-accent-hover:#065e48; --ui-on-accent:#fff;
  --ui-brand-accent:#007d92;
  --ui-soft:#d8e5e1; --ui-input:#e4e9ed; color-scheme:light;
}
.compact-shell { min-height:100vh; font-size:13px; }
.compact-shell .app-header { height:48px; min-height:48px; padding:0 12px; gap:12px; justify-content:flex-start; flex-wrap:nowrap; background:var(--ui-panel); border-color:var(--ui-line); }
.compact-shell .brand { font-size:14px; gap:8px; white-space:nowrap; flex-shrink:0; color:var(--ui-text); }
.compact-shell .brand .logo { width:26px; height:27px; display:grid; place-items:center; padding:0; border-radius:6px; font-size:11px; line-height:1; }
.compact-shell .header-toolbar { display:flex; align-items:center; flex:1; min-width:0; overflow-x:auto; scrollbar-width:thin; scrollbar-color:var(--ui-line) transparent; }
.compact-shell .header-tools { display:flex; align-items:center; gap:3px; margin-left:auto; flex-shrink:0; }
.compact-shell .icon-button { display:grid; place-items:center; width:27px; height:28px; border:0; padding:0; border-radius:4px; text-decoration:none; background:transparent; color:var(--ui-muted); font-size:20px; line-height:1; cursor:pointer; }
.compact-shell .icon-button:hover { color:var(--ui-text); background:var(--ui-soft); }
.compact-shell .icon-button svg { width:18px; height:18px; }
.compact-shell .app-nav { height:34px; min-height:34px; padding:0 12px; gap:10px; align-items:stretch; background:var(--ui-panel); border-color:var(--ui-line); scrollbar-width:none; }
.compact-shell .app-nav a { padding:7px 13px 6px; border-radius:0; border-bottom:2px solid transparent; font-size:12px; line-height:19px; font-weight:500; color:var(--ui-muted); }
.compact-shell .app-nav a.active { color:var(--ui-text); background:transparent; border-bottom-color:var(--ui-brand-accent); }
.compact-shell .app-nav a:hover { color:var(--ui-text); background:var(--ui-soft); }
.compact-shell main { max-width:none; padding:16px; margin:0; }
.compact-shell main.ws-main,.compact-shell main.rs-main { padding:0; }
.compact-shell button,.compact-shell .button { color:var(--ui-text); background:var(--ui-panel); border-color:var(--ui-line); }
.compact-shell button:hover,.compact-shell .button:hover { background:var(--ui-soft); }
.compact-shell :is(.primary,.rs-primary) { color:var(--ui-on-accent); background:var(--ui-accent); border-color:var(--ui-accent); }
.compact-shell :is(.primary,.rs-primary):hover { background:var(--ui-accent-hover); }
.compact-shell input:not([type=checkbox]),.compact-shell select,.compact-shell textarea { color:var(--ui-text); background:var(--ui-input); border-color:var(--ui-line); }
.compact-shell input::placeholder,.compact-shell textarea::placeholder { color:var(--ui-muted); opacity:1; }
.compact-shell input[type=checkbox] { accent-color:var(--ui-accent); }
.compact-shell .muted,.compact-shell .eyebrow { color:var(--ui-muted); }
.compact-shell .panel,.compact-shell .stat,.compact-shell .table-wrap,.compact-shell .card,.compact-shell .column { color:var(--ui-text); background:var(--ui-panel); border-color:var(--ui-line); }
.compact-shell .stat,.compact-shell .panel { padding:16px; border-radius:6px; }
.compact-shell .stats { gap:12px; margin-bottom:16px; }
.compact-shell .stat p,.compact-shell .stat small { color:var(--ui-muted); }
.compact-shell .stat strong { font-size:25px; }
.compact-shell .page-head { margin-bottom:12px; }
.compact-shell .page-head h1 { font-size:21px; letter-spacing:-.4px; }
.compact-shell .page-head .eyebrow,.compact-shell .page-head .muted { display:none; }
.compact-shell .toolbar { gap:8px; margin-bottom:12px; }
.compact-shell .toolbar input,.compact-shell .toolbar select,.compact-shell .toolbar button { padding:6px 9px; font-size:12px; }
.compact-shell .grid-two { gap:16px; }
.compact-shell .stage-row { margin:12px 0; }
.compact-shell .activity { border-color:var(--ui-line); }
.compact-shell .activity small,.compact-shell footer { color:var(--ui-muted); }
.compact-shell .notice { color:var(--ui-text); background:var(--ui-soft); border-color:var(--ui-line); }
.compact-shell .badge { color:var(--ui-text); background:var(--ui-soft); }
#workspace-toolbar:empty { display:none; }
#workspace-toolbar .ws-toolbar { flex:1; flex-wrap:nowrap; gap:5px; align-items:center; margin:0; min-width:0; }
#workspace-toolbar .ws-toolbar label { flex:0 1 110px; min-width:76px; gap:0; margin:0; }
#workspace-toolbar .ws-toolbar label.ws-search { flex:1 1 165px; min-width:120px; }
#workspace-toolbar .ws-toolbar label>span { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
#workspace-toolbar .ws-toolbar input,#workspace-toolbar .ws-toolbar select { height:29px; min-height:29px; padding:4px 6px; border-radius:4px; font-size:11px; }
#workspace-toolbar .ws-filter-actions { flex-shrink:0; gap:4px; }
#workspace-toolbar .ws-filter-actions button { height:29px; padding:3px 7px; font-size:11px; border-radius:4px; white-space:nowrap; }
.compact-shell dialog { background:var(--ui-panel); color:var(--ui-text); border-color:var(--ui-line); }
.compact-shell dialog::backdrop { background:#0009; }
.compact-shell dialog h2,.compact-shell dialog p,.compact-shell dialog label,.compact-shell dialog legend { color:var(--ui-text); }
.compact-shell dialog .ws-dialog-notice,.compact-shell dialog fieldset { color:var(--ui-muted); background:var(--ui-bg); border-color:var(--ui-line); }
.compact-shell #editor input,.compact-shell #editor select,.compact-shell #editor textarea { color:var(--ui-text); background:var(--ui-input); }
.compact-shell .visually-hidden { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.compact-shell .overview-filters { display:flex; align-items:center; gap:7px; margin-left:auto; white-space:nowrap; }
.compact-shell .overview-filters label { display:flex; align-items:center; gap:5px; font-size:11px; color:var(--ui-muted); }
.compact-shell .overview-filters input,.compact-shell .overview-filters button,.compact-shell .overview-filters .button { padding:4px 8px; border-radius:4px; height:29px; font-size:11px; }
.compact-shell main>footer { display:none; }
.compact-shell~#editor { color:var(--ui-text); background:var(--ui-panel); border-color:var(--ui-line); }
.compact-shell~#editor::backdrop { background:#0009; }
.compact-shell~#editor :is(input:not([type=checkbox]),select,textarea,button:not(.primary)) { color:inherit; background:var(--ui-input); border-color:var(--ui-line); }
.compact-shell~#editor .primary { color:var(--ui-on-accent); }
.compact-shell~#editor .primary:hover { background:var(--ui-accent-hover); }
.compact-shell.crm-light { font-weight:500; }
.compact-shell.crm-light :is(.app-nav a,.ws-content-bar h1,.ws-stage-name,.ws-contact-name,.ws-board-card>a,.ws-board-card>.ws-observed-open,.ws-thread-heading h2,.ws-thread-tabs button) {
  font-weight:650;
}
.compact-shell.crm-light :is(.ws-sidebar-container>summary,.ws-side-section>summary,.ws-workspace .ws-side-item,.ws-workspace th,.rs-table th,.credit-provider-heading .credit-unit) {
  font-weight:600;
}
.compact-shell.crm-light :is(.ws-last-text,.ws-board-text,.ws-message-heading,.credit-details) { font-weight:550; }

.compact-shell.crm-light .ws-label-lead { --ws-label-color:#164d85; }
.compact-shell.crm-light .ws-label-potential { --ws-label-color:#125d51; }
.compact-shell.crm-light .ws-label-follow { --ws-label-color:#654909; }
.compact-shell.crm-light .ws-label-nurture { --ws-label-color:#633d87; }
.compact-shell.crm-light .ws-label-dnc { --ws-label-color:#852e29; }
.compact-shell.crm-light .ws-label-rejected { --ws-label-color:#8b402c; }
.compact-shell.crm-light .ws-label-contractsent { --ws-label-color:#764810; }
.compact-shell.crm-light .ws-label-contractsigned { --ws-label-color:#235c34; }
.compact-shell.crm-light .ws-label-ghosted { --ws-label-color:#354657; }
.compact-shell.crm-light .ws-label {
  background:color-mix(in srgb,var(--ws-label-color,var(--ui-muted)) 20%,var(--ui-panel));
  border-color:color-mix(in srgb,var(--ws-label-color,var(--ui-muted)) 56%,var(--ui-line));
  font-weight:650;
}
.compact-shell.crm-light .ws-label.needs-label { --ws-label-color:#354151; background:#cdd5de; color:var(--ws-label-color); border-color:#8b98a8; }
.compact-shell.crm-light .ws-needs-label-text { --ws-label-color:#3f4a58; }
.compact-shell.crm-light :is(.ws-side-label-text,.ws-label-select,.ws-label-option-text) {
  color:var(--ws-label-color,var(--ui-text));
  font-weight:650;
}
@media(max-width:1120px) {
  .compact-shell .app-header { height:auto; min-height:46px; flex-wrap:wrap; gap:0 8px; padding:7px 10px; }
  .compact-shell .brand { flex:1; font-size:13px; }
  .compact-shell .header-tools { order:2; }
  .compact-shell .header-toolbar { order:3; flex-basis:100%; padding-top:6px; }
  #workspace-toolbar .ws-toolbar { min-width:650px; }
}
@media(max-width:600px) {
  .compact-shell .app-nav { gap:0; padding:0 4px; }
  .compact-shell .app-nav a { padding-left:10px; padding-right:10px; font-size:11px; }
  .compact-shell .brand { font-size:12px; }
  .compact-shell main { padding:10px; }
}

/* Keep the track clear while retaining a visible, draggable scroll thumb. */
html:has(.compact-shell) {
  --ui-scroll-thumb:color-mix(in srgb,var(--ui-muted) 36%,transparent);
  --ui-scroll-thumb-active:color-mix(in srgb,var(--ui-muted) 65%,transparent);
  scrollbar-width:thin; scrollbar-color:var(--ui-scroll-thumb) transparent;
}
@supports not selector(::-webkit-scrollbar) {
.compact-shell :is(.ws-sidebar,.ws-sidebar-content,.rs-sidebar,.header-toolbar,.ws-toolbar,.ws-table-scroll,.rs-table-scroll,.ws-thread-history,.ws-stage-body,.ws-recommended-sms,.ws-pipeline-board,.bot-nav,textarea) {
  scrollbar-width:thin; scrollbar-color:var(--ui-scroll-thumb) transparent;
}
.compact-shell :is(.ws-sidebar,.ws-sidebar-content,.rs-sidebar,.header-toolbar,.ws-toolbar,.ws-table-scroll,.rs-table-scroll,.ws-thread-history,.ws-stage-body,.ws-recommended-sms,.ws-pipeline-board,.bot-nav,textarea):is(:hover,:focus-within) {
  scrollbar-color:var(--ui-scroll-thumb-active) transparent;
}
}
@supports selector(::-webkit-scrollbar) {
  /* Chromium needs the native defaults to let the custom no-arrow bar render. */
  html:has(.compact-shell),.compact-shell :is(.ws-sidebar,.ws-sidebar-content,.rs-sidebar,.header-toolbar,.ws-toolbar,.ws-table-scroll,.rs-table-scroll,.ws-thread-history,.ws-stage-body,.ws-recommended-sms,.ws-pipeline-board,.bot-nav,textarea) {
    scrollbar-width:auto; scrollbar-color:auto;
  }
  html:has(.compact-shell)::-webkit-scrollbar,.compact-shell ::-webkit-scrollbar {
    width:6px; height:6px; background:transparent;
  }
  html:has(.compact-shell)::-webkit-scrollbar-track,.compact-shell ::-webkit-scrollbar-track,
  html:has(.compact-shell)::-webkit-scrollbar-corner,.compact-shell ::-webkit-scrollbar-corner {
    background:transparent;
  }
  html:has(.compact-shell)::-webkit-scrollbar-thumb,.compact-shell ::-webkit-scrollbar-thumb {
    background:var(--ui-scroll-thumb); border-radius:8px;
  }
  html:has(.compact-shell)::-webkit-scrollbar-thumb:hover,.compact-shell ::-webkit-scrollbar-thumb:hover,
  .compact-shell :is(.ws-sidebar,.ws-sidebar-content,.rs-sidebar,.header-toolbar,.ws-toolbar,.ws-table-scroll,.rs-table-scroll,.ws-thread-history,.ws-stage-body,.ws-recommended-sms,.ws-pipeline-board,.bot-nav,textarea):is(:hover,:focus-within)::-webkit-scrollbar-thumb {
    background:var(--ui-scroll-thumb-active);
  }
  html:has(.compact-shell)::-webkit-scrollbar-button,.compact-shell ::-webkit-scrollbar-button {
    display:none; width:0; height:0; background:transparent;
  }
  .compact-shell .app-nav::-webkit-scrollbar { display:none; width:0; height:0; }
}
