/* Smooth sidebar collapse + custom workspace picker */
@media(min-width:621px){
:root{--sb-ease:cubic-bezier(.32,.72,0,1);--sb-dur:.32s}
html .workspace-shell #workspace-sidebar{padding-left:18px;padding-right:18px;overflow-x:hidden;transition:width var(--sb-dur) var(--sb-ease),padding-top var(--sb-dur) var(--sb-ease)}
html.sidebar-collapsed .workspace-shell #workspace-sidebar{width:76px;padding-left:18px;padding-right:18px}
html .workspace-shell .content{transition:margin-left var(--sb-dur) var(--sb-ease)}
/* labels fade + collapse width instead of snapping */
html .workspace-shell #workspace-sidebar :is(.nav>span:not(.nav-planned-label),.workspace-brand strong,.sidebar-attribution,.sidebar-section-label,.preference-label>span,.logout>span,.language-row>.preference-label>span){display:block;position:static;clip:auto;height:auto;overflow:hidden;white-space:nowrap;max-width:200px;opacity:1;transition:max-width var(--sb-dur) var(--sb-ease),opacity .18s ease .1s}
html.sidebar-collapsed .workspace-shell #workspace-sidebar :is(.nav>span:not(.nav-planned-label),.workspace-brand strong,.sidebar-attribution,.sidebar-section-label,.preference-label>span,.logout>span){display:block;position:static;clip:auto;width:auto;height:auto;max-width:0;opacity:0;transition:max-width var(--sb-dur) var(--sb-ease),opacity .1s ease}
html .workspace-shell #workspace-sidebar :is(.sidebar-attribution,.sidebar-section-label){max-height:40px;transition:max-width var(--sb-dur) var(--sb-ease),max-height var(--sb-dur) var(--sb-ease),opacity .18s ease .1s}
html.sidebar-collapsed .workspace-shell #workspace-sidebar :is(.sidebar-attribution,.sidebar-section-label){max-height:0;margin-top:0;margin-bottom:0;transition:max-width var(--sb-dur) var(--sb-ease),max-height var(--sb-dur) var(--sb-ease),opacity .1s ease}
html .workspace-shell #workspace-sidebar .nav{justify-content:flex-start;padding:11px;gap:12px;transition:background-color .16s,color .16s,gap var(--sb-dur) var(--sb-ease)}
html.sidebar-collapsed .workspace-shell #workspace-sidebar .nav{justify-content:flex-start;padding:11px;gap:0}
html .workspace-shell #workspace-sidebar .nav .p-nav-count,html .workspace-shell #workspace-sidebar .nav-planned-label small{transition:opacity .15s}
html.sidebar-collapsed .workspace-shell #workspace-sidebar .nav:is(.nav-planned) .nav-planned-label small{display:none}
html .workspace-shell .workspace-brand{padding:0 8px;gap:12px;justify-content:flex-start;transition:padding var(--sb-dur) var(--sb-ease),gap var(--sb-dur) var(--sb-ease)}
html.sidebar-collapsed .workspace-shell .workspace-brand{padding:0;gap:0;justify-content:flex-start}
html .workspace-shell .sidebar-preference{transition:padding var(--sb-dur) var(--sb-ease)}
html .workspace-shell .sidebar-switch{max-width:34px;transition:max-width var(--sb-dur) var(--sb-ease),opacity .15s,background-color .16s}
html.sidebar-collapsed .workspace-shell .sidebar-switch{display:block;max-width:0;min-width:0;width:0;opacity:0;border-width:0;overflow:hidden}
html.sidebar-collapsed .workspace-shell .sidebar-preference{justify-content:flex-start;padding:4px}
html.sidebar-collapsed .workspace-shell .language-row>.preference-label{display:flex}
html .workspace-shell .sidebar-collapse{transition:right var(--sb-dur) var(--sb-ease)}
html .workspace-shell .sidebar-collapse svg{transition:transform var(--sb-dur) var(--sb-ease)}
html .workspace-shell .workspace-picker{transition:opacity .2s ease .08s,max-height var(--sb-dur) var(--sb-ease),margin var(--sb-dur) var(--sb-ease);max-height:120px}
html.sidebar-collapsed .workspace-shell .workspace-picker,html.sidebar-collapsed .workspace-shell .workspace-select{display:block;opacity:0;max-height:0;margin:0;overflow:hidden;pointer-events:none;transition:opacity .1s ease,max-height var(--sb-dur) var(--sb-ease),margin var(--sb-dur) var(--sb-ease)}
}
@media(prefers-reduced-motion:reduce){html .workspace-shell *,html .workspace-shell #workspace-sidebar *{transition-duration:.01ms!important}}

/* Workspace picker */
.workspace-shell .workspace-select{margin:0 6px 8px!important;padding:0}
.workspace-shell .workspace-select select{display:none}
.workspace-shell .workspace-picker{position:relative;margin:0 6px 20px}
.workspace-picker-trigger{width:100%;display:flex;align-items:center;gap:10px;padding:9px 10px;text-align:left;font-size:13px;font-weight:500;color:var(--text);background:var(--surface);border:1px solid var(--border-m);border-radius:10px;transition:border-color .16s,background-color .16s,box-shadow .16s}
.workspace-picker-trigger:hover{border-color:var(--muted);filter:none}
.workspace-picker[data-open="true"] .workspace-picker-trigger,.workspace-picker-trigger:focus-visible{border-color:var(--accent);box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 22%,transparent);outline:0}
.wp-initial{flex:none;width:26px;height:26px;border-radius:8px;display:grid;place-items:center;font-size:12px;font-weight:700;color:#fff;background:var(--accent)}
.wp-text{min-width:0;flex:1;display:grid;line-height:1.25}
.wp-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.wp-role{font-size:11px;font-weight:400;color:var(--muted)}
.wp-chevron{flex:none;color:var(--muted);transition:transform .22s var(--sb-ease,ease)}
.workspace-picker[data-open="true"] .wp-chevron{transform:rotate(180deg)}
.workspace-picker-list{position:absolute;left:0;right:0;top:calc(100% + 6px);z-index:50;margin:0;padding:6px;list-style:none;background:var(--card-hi,var(--surface));border:1px solid var(--border-m);border-radius:12px;box-shadow:0 14px 36px rgba(0,0,0,.38);opacity:0;transform:translateY(-6px) scale(.98);transform-origin:top;visibility:hidden;pointer-events:none;transition:opacity .16s ease,transform .2s var(--sb-ease,ease),visibility 0s .2s}
.workspace-picker[data-open="true"] .workspace-picker-list{opacity:1;transform:none;visibility:visible;pointer-events:auto;transition:opacity .16s ease,transform .2s var(--sb-ease,ease)}
.workspace-picker-list button.subtle{width:100%;display:flex;align-items:center;gap:10px;padding:8px;text-align:left;font-size:13px;font-weight:500;color:var(--text);background:transparent;border-radius:8px}
.workspace-picker-list button:hover,.workspace-picker-list button:focus-visible{background:var(--surface);filter:none;outline:0}
.workspace-picker-list button[aria-selected="true"]{background:color-mix(in srgb,var(--accent) 16%,transparent)}
.workspace-picker-list .wp-check{margin-left:auto;color:var(--accent);opacity:0}
.workspace-picker-list button[aria-selected="true"] .wp-check{opacity:1}
.workspace-picker-list .wp-new{color:var(--muted);border-top:1px solid var(--border);border-radius:0 0 8px 8px;margin-top:4px;padding-top:12px}
.workspace-picker-list .wp-new .wp-initial{background:transparent;border:1px dashed var(--muted);color:var(--muted)}

html .workspace-shell #workspace-sidebar .nav-planned-label{overflow:hidden;white-space:nowrap;max-width:200px;opacity:1;transition:max-width var(--sb-dur) var(--sb-ease),opacity .18s ease .1s}
html.sidebar-collapsed .workspace-shell #workspace-sidebar .nav-planned-label{max-width:0;opacity:0;transition:max-width var(--sb-dur) var(--sb-ease),opacity .1s ease}
.workspace-picker-trigger.subtle{padding:9px 10px;text-align:left;font-weight:500;color:var(--text);background:var(--surface)}
.workspace-picker-list button.subtle:hover,.workspace-picker-list button.subtle:focus-visible{background:var(--surface)}
.workspace-picker-list button.subtle[aria-selected="true"]{background:color-mix(in srgb,var(--accent) 16%,transparent)}

/* Compact sidebar: keep language controls outside the clipped sidebar. */
.workspace-shell .language-trigger{padding:0;border:0;background:transparent;color:inherit;font:inherit;border-radius:8px;min-height:32px;text-align:left}
.workspace-shell .language-trigger:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
.sidebar-hover-label,.sidebar-language-popover{position:fixed;z-index:1000;color:var(--text);background:var(--card-hi,var(--surface));border:1px solid var(--border-m);border-radius:12px;box-shadow:0 8px 24px #0003;font:500 13px 'Hanken Grotesk',sans-serif}
.sidebar-hover-label{padding:9px 12px;pointer-events:none;white-space:nowrap}
.sidebar-language-popover{padding:10px 12px;display:grid;gap:8px;min-width:112px}
.sidebar-language-popover>span{font-size:12px;color:var(--muted)}
.sidebar-language-popover .process-language{display:flex;flex-direction:row;gap:4px;margin:0}
.sidebar-language-popover .process-language button{min-width:38px;min-height:32px;padding:5px 8px;border:0;border-radius:8px;color:var(--muted);background:var(--surface);opacity:1;font-size:12px}
.sidebar-language-popover .process-language button[aria-pressed="true"]{background:var(--text);color:var(--on-ink)}
.sidebar-language-popover button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
@media(min-width:621px){
  html.sidebar-collapsed .workspace-shell #workspace-sidebar .language-row>.process-language{display:none}
  html.sidebar-collapsed .workspace-shell #workspace-sidebar :is(.nav,.sidebar-preference,.logout){display:flex;align-items:center;justify-content:center;gap:0;width:100%;min-width:0;padding-left:0;padding-right:0}
  html.sidebar-collapsed .workspace-shell #workspace-sidebar :is(.nav>span,.logout>span,.preference-label>span,.sidebar-switch){display:none}
  html.sidebar-collapsed .workspace-shell #workspace-sidebar .preference-label{gap:0;justify-content:center}
  html.sidebar-collapsed .workspace-shell #workspace-sidebar .language-trigger{width:100%;min-width:0;justify-content:center;gap:0}
  html.sidebar-collapsed .workspace-shell #workspace-sidebar .workspace-brand{justify-content:center}
  html.sidebar-collapsed .workspace-shell #workspace-sidebar .sidebar-collapse{display:flex;align-items:center;justify-content:center;left:18px;right:auto;width:calc(100% - 36px)}
}
