/* V5: presentation boundary. All colors resolve through theme.css. */
:root { --workspace-rail: 180px; --workspace-tree: 340px; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
button, summary { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--color-focus-border); outline-offset: 3px; }
.app-shell { grid-template-columns: var(--workspace-rail) minmax(0, 1fr); }
.sidebar { padding: 28px 12px 18px; background: var(--color-sidebar); box-shadow: none; }
.brand { padding: 4px 10px 42px; font-size: 22px; letter-spacing: -.04em; }
.brand-mark { width: 26px; height: 26px; border: 4px solid var(--color-brand); border-right-width: 2px; border-radius: 8px; background: transparent; color: transparent; transform: rotate(-14deg); box-shadow: none; }
.brand-badge { display: none; }
.nav-label { font-size: 9px; letter-spacing: .13em; font-weight: 500; margin-block: 18px 12px; }
.sidebar nav > .nav-label:first-child { display: none; }
.nav-item { min-height: 44px; margin: 5px 0; border-radius: 8px; font-size: 12px; font-weight: 400; }
.nav-item.active { background: var(--color-sidebar-active); color: var(--color-sidebar-text-active); box-shadow: inset 2px 0 var(--color-brand); font-weight: 650; }
.nav-icon { width: 20px; font-size: 18px; font-weight: 400; }
.nav-icon svg { width: 18px; height: 18px; display: block; }
.sidebar-department-list { gap: 8px; }
.sidebar-project-copy strong { font-size: 12px; font-weight: 450; }
.sidebar-project-copy small { display: none; }
.sidebar-project-card .project-item { min-height: 42px; padding: 8px; border-radius: 6px; }
.sidebar-foot { border-top: 1px solid var(--color-sidebar-border); padding-top: 12px; }
.sidebar .system-status { display: none; }
.sidebar .profile { margin-top: 12px; gap: 8px; }
.sidebar .profile strong { max-width: 95px; overflow: hidden; text-overflow: ellipsis; }
.sidebar-theme-toggle { border: 0; font-size: 11px; }
main { padding: 28px; }
#projects-view { padding: 0; min-height: 0; overflow: hidden; position: relative; height: 100dvh; }
#messages-view { min-height: 0; }
#projects-view .projects-topbar { position: absolute; z-index: 5; top: 0; left: var(--workspace-tree); right: 0; height: 72px; margin: 0; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; gap: 12px; transition: left 280ms var(--ease-workspace); }
.projects-topbar .topbar-overview { flex: 1; min-width: 0; display: block; }
.projects-topbar #projects-greeting { display: none; }
.projects-topbar .eyebrow { margin: 0; font-size: 11px; font-weight: 400; letter-spacing: 0; text-transform: none; }
.projects-topbar .top-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.projects-topbar .world-clock-widget { width: auto; }
.projects-topbar .location-weather-card:not([data-expanded="true"]):not(:hover) { background: transparent; border-color: transparent; box-shadow: none; }
.projects-topbar .geo-card-summary { background: transparent; color: var(--color-text); border-color: transparent; box-shadow: none; }
.projects-topbar .geo-card-summary > span { color: var(--color-text-muted); font-size: 10px; font-weight: 400; }
.projects-topbar .geo-card-summary time { font-size: 12px; letter-spacing: 0; font-weight: 550; }
.workspace-focus { flex: 0 0 auto; order: 3; background: transparent; }
.workspace-focus[aria-pressed="true"] { background: var(--color-selected); color: var(--color-selected-text); }
.projects-topbar .active-timer { padding: 5px 8px; margin: 0; }
.projects-topbar .active-timer small { display: none; }
#projects-view .workspace { height: 100%; min-height: 0; margin: 0; grid-template-columns: var(--workspace-tree) minmax(0, 1fr); border: 0; border-radius: 0; box-shadow: none; background: var(--color-canvas); transition: grid-template-columns 280ms var(--ease-workspace); }
#projects-view.is-focused .workspace { grid-template-columns: 0px minmax(0, 1fr); }
#projects-view.is-focused .projects-topbar { left: 0; }
#projects-view.is-focused .task-panel { opacity: 0; pointer-events: none; }
.task-panel { background: var(--color-surface-subtle); transition: opacity 160ms ease; }
.task-panel .panel-heading { gap: 8px; min-height: 88px; padding: 24px 22px 12px; }
#task-list-title { font-size: 24px; font-weight: 600; letter-spacing: -.045em; }
.panel-heading-actions { gap: 4px; }
#task-count { display: none; }
#create-task { background: transparent; color: var(--color-text-muted); border: 0; box-shadow: none; font-size: 11px; padding: 8px; white-space: nowrap; }
#create-task:hover { color: var(--color-accent); background: var(--color-accent-soft); }
.workspace-filters { padding: 0 22px 18px; border-bottom: 1px solid var(--color-border); }
.workspace-filters > summary { padding: 8px 0; color: var(--color-text-muted); font-size: 11px; cursor: pointer; }
.workspace-scope-label { display: block; margin: 6px 0 0 12px; color: var(--color-text); font-size: 11px; }
.workspace-filters .project-view-switch { margin: 10px 0; padding: 0; flex-direction: column; border: 0; background: transparent; }
.workspace-filters .project-view-switch button { flex: none; min-height: 36px; text-align: left; font-size: 12px; font-weight: 500; }
.workspace-filters .project-view-switch button.active { color: var(--color-selected-text); background: var(--color-selected); box-shadow: none; }
.workspace-filters .toolbar { display: grid; grid-template-columns: 1fr 1fr; padding: 4px 0 0; }
.workspace-filters .search { grid-column: 1 / -1; }
.workspace-filters select { min-width: 0; }
.task-list { padding: 14px 12px; scrollbar-width: thin; }
.department-branch { margin-bottom: 14px; }
.department-branch > summary { cursor: pointer; list-style: none; }
.department-branch > summary::-webkit-details-marker { display: none; }
.department-branch > summary::before { content: '›'; font-size: 16px; font-weight: 400; transition: transform 160ms ease; }
.department-branch[open] > summary::before { transform: rotate(90deg); }
@supports (interpolate-size: allow-keywords) {
  .department-branch::details-content { interpolate-size: allow-keywords; block-size: 0; opacity: 0; overflow: clip; transition: block-size 220ms var(--ease-workspace), opacity 160ms ease, content-visibility 220ms allow-discrete; }
  .department-branch[open]::details-content { block-size: auto; opacity: 1; }
}
.task-department-heading { gap: 8px; padding: 14px 8px; margin: 0; color: var(--color-text-muted); background: transparent; border: 0; }
.task-department-heading .project-dot, .task-department-heading small { display: none; }
.task-department-heading strong { flex: 1; font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: .12em; overflow-wrap: anywhere; }
.empty-department { width: 100%; cursor: pointer; text-align: left; }
.empty-department > span { font-size: 10px; }
.task-row { position: relative; width: calc(100% - var(--task-indent)); margin: 2px 0 4px var(--task-indent); padding: 0 4px; border: 0; border-radius: 7px; background: transparent; min-height: 52px; box-shadow: none; }
.task-row:hover { background: var(--color-surface-hover); }
.task-row.selected { background: var(--color-selected); color: var(--color-selected-text); border: 0; box-shadow: none; }
.task-row.selected::after { content: ''; position: absolute; width: 3px; height: 24px; inset: calc(50% - 12px) 0 auto auto; border-radius: 3px; background: var(--color-brand); }
.task-row-select { display: flex; align-items: center; min-width: 0; min-height: 48px; gap: 0; padding: 12px 2px; color: inherit; }
.task-row.selected .task-row-select, .task-row.selected .task-title { color: var(--color-selected-text); }
.task-row.selected .task-meta span { color: var(--color-selected-meta); }
.task-row .priority, .task-row .task-hours, .task-row .status-tag { display: none; }
.task-title { color: inherit; font-size: 11px; line-height: 1.5; font-weight: 450; }
.task-row.has-chat-notifications .task-title { font-weight: 750; }
.task-title-line { gap: 6px; }
.task-status-led {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--color-danger);
  box-shadow: 0 0 0 2px var(--color-danger-soft), 0 0 7px color-mix(in srgb, var(--color-danger) 55%, transparent);
}
.task-status-led.work-status-in-progress {
  background: var(--color-warning);
  box-shadow: 0 0 0 2px var(--color-warning-soft), 0 0 7px color-mix(in srgb, var(--color-warning) 55%, transparent);
}
.task-status-led.work-status-completed {
  background: var(--color-success);
  box-shadow: 0 0 0 2px var(--color-success-soft), 0 0 7px color-mix(in srgb, var(--color-success) 55%, transparent);
}
.task-status-led.work-status-archived {
  background: color-mix(in srgb, var(--color-success) 45%, var(--color-text-disabled));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-success-soft) 40%, var(--color-surface-muted));
}
.task-meta { font-size: 10px; line-height: 1.5; margin-top: 4px; }
.task-row:not(.selected) .task-meta { display: none; }
.task-row.selected .task-meta { color: var(--color-selected-meta); }
.task-row.selected .hierarchy-toggle, .task-row.selected .task-rights-button { color: var(--color-selected-meta); }
.hierarchy-toggle, .hierarchy-spacer { flex: 0 0 19px; width: 19px; min-width: 19px; margin: 0; }
.task-rights-button { width: 24px; font-size: 12px; opacity: .6; }
.task-rights-button:hover, .task-rights-button:focus-visible { opacity: 1; }
.work-item-action-menu { z-index: 25; width: 235px; }
.directory-badges { flex-shrink: 0; }
#detail-panel { margin: 78px 28px 28px; border-radius: 14px; background: var(--color-surface); border: 0; }
.detail-head { flex-shrink: 0; padding: 28px 36px 16px; gap: 14px; align-items: flex-start; }
.detail-head > div { flex: 1; min-width: 0; }
.detail-head h2 { font-size: clamp(22px, 2.1vw, 30px); font-weight: 600; letter-spacing: -.04em; max-width: none; overflow-wrap: anywhere; }
.task-kicker { font-size: 10px; margin: 0 0 10px; color: var(--color-text-muted); }
.detail-head .status-tag { display: inline-block; margin-top: 12px; font-size: 10px; font-weight: 650; }
.workspace-details-button { flex-shrink: 0; border: 0; background: transparent; margin-top: 5px; font-size: 11px; font-weight: 450; }
.close-detail { font-size: 24px; min-width: 28px; min-height: 32px; }
.detail-content { display: flex; flex-direction: column; }
.workspace-content-tabs { flex-shrink: 0; display: flex; gap: 24px; margin: 0 36px; border-bottom: 1px solid var(--color-border); }
.workspace-content-tabs button { position: relative; min-height: 44px; border: 0; padding: 0; background: transparent; color: var(--color-text-muted); font-size: 12px; cursor: pointer; }
.workspace-content-tabs button[aria-selected="true"] { color: var(--color-text); font-weight: 650; }
.workspace-content-tabs button[aria-selected="true"]::after { content: ''; height: 2px; background: var(--color-text); position: absolute; inset: auto 0 0; }
.workspace-files-view { padding: 24px 36px; flex: 1; min-height: 0; overflow-y: auto; }
.workspace-files-view .task-files { border: 0; margin: 0; padding: 0; }
.workspace-files-view .file-link { font-size: 13px; }
.chat-pane { flex: 1; overflow: hidden; }
.chat-head { min-height: 48px; margin: 0 36px; padding: 0; background: transparent; font-size: 11px; font-weight: 500; }
.mattermost-label { font-weight: 400; font-size: 9px; text-transform: none; letter-spacing: 0; }
.native-messages { padding: 12px 20px; scrollbar-width: thin; scrollbar-gutter: stable; }
.message { grid-template-columns: 28px minmax(0, 1fr); padding: 8px 12px; gap: 10px; margin: 0 auto; max-width: 840px; }
.message.is-personal { border-left: 2px solid var(--color-personal-line); border-radius: 0 10px 10px 0; background: var(--color-personal); }
.native-conversation > .native-messages { order: 0; }
.native-conversation > .conversation-ai-bar { order: 1; padding: 6px 36px 0; border: 0; background: transparent; }
.native-conversation > .message-composer { order: 2; margin-top: 6px; }
.conversation-ai-button { font-size: 11px; font-weight: 450; border: 0; background: transparent; }
.message-avatar { width: 28px; height: 28px; min-width: 28px; border-radius: 50%; font-size: 9px; color: var(--color-text-muted); background: var(--color-surface-muted); }
.message-head { gap: 12px; }
.message-head strong { font-size: 12px; font-weight: 650; }
.message-head small { font-size: 10px; }
.message p { margin: 4px 0 0; color: var(--color-text); font-size: 10px; line-height: 1.5; }
.message-link { color: var(--color-accent); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.message-composer { flex-shrink: 0; max-width: 800px; width: calc(100% - 72px); min-height: 90px; margin: 18px auto 22px; padding: 12px; border-color: var(--color-border-strong); border-radius: 12px; }
.message-composer:focus-within { border-color: var(--color-focus-border); }
.message-composer textarea { font-size: 14px; line-height: 1.65; min-height: 60px; }
.message-composer button { padding: 10px 14px; font-size: 11px; border-radius: 8px; background: var(--color-accent); }
.detail-button, .messages-button { font-size: 12px; font-weight: 500; }
.empty-detail { min-height: 0; height: 100%; padding: 40px; }
.empty-detail h2 { font-size: 25px; font-weight: 550; letter-spacing: -.035em; }
.empty-detail p { font-size: 13px; max-width: 360px; }
.workspace-details { position: fixed; inset: 16px 16px 16px auto; margin: 0; padding: 0; width: min(430px, calc(100vw - 32px)); max-width: none; max-height: none; height: calc(100dvh - 32px); color: var(--color-text); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 14px; box-shadow: var(--shadow-dialog); overflow: hidden; }
.workspace-details[open] { display: flex; flex-direction: column; animation: workspace-drawer 240ms var(--ease-workspace); }
.workspace-details::backdrop { background: var(--color-backdrop); animation: workspace-fade 180ms ease; }
.workspace-details > header { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; padding: 22px; }
.workspace-details h2 { margin: 0; font-size: 22px; font-weight: 550; }
.workspace-details .detail-actions { padding: 0 22px 20px; flex-shrink: 0; }
.workspace-details .linked-channel { width: 100%; overflow-wrap: anywhere; }
.workspace-details .task-info { display: block; flex: 1; min-height: 0; border: 0; }
.workspace-details .description { font-size: 14px; line-height: 1.75; }
.workspace-details .property-grid strong { font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.workspace-details .property-grid small, .section-label { font-size: 10px; }
.editor-panel, .task-editor { min-height: 0; }
.editor-field input, .editor-field select, .editor-field textarea { font-size: 14px; }
.editor-field textarea { font-family: inherit; }
.editor-field > span { font-size: 12px; }
.editor-actions { flex-shrink: 0; }
.ai-assistance-workspace { left: var(--workspace-rail); background: var(--color-canvas); transition: opacity 220ms ease, transform 280ms var(--ease-workspace); }
.ai-writing-panel, .ai-reference-panel { box-shadow: none; border-radius: 12px; }
.ai-reference-panel { background: var(--color-surface-subtle); }
.ai-assistance-intro { font-size: 13px; }
.ai-assistance-intro strong { font-size: 14px; }
.ai-assistance-intro p, .ai-empty-state { font-size: 12px; line-height: 1.65; }
.ai-thread-message, .ai-assistance-composer textarea, .ai-draft-text { font-size: 14px; line-height: 1.7; }
.ai-assistance-head h1 { font-size: 28px; font-weight: 550; letter-spacing: -.035em; }
.ai-draft-text { background: var(--color-surface-subtle); border-color: var(--color-border); }
/* Writing, instructions and approved draft are distinct working areas. */
.ai-assistance-workspace{padding:28px 32px}
.ai-assistance-head{margin-bottom:24px;gap:24px}
.ai-assistance-head-actions{gap:20px}
.ai-assistance-head-actions label{gap:8px;font-size:11px}
.ai-assistance-head-actions select{min-height:40px}
.ai-assistance-layout{grid-template-columns:minmax(0,1.1fr) minmax(0,.9fr);gap:24px}
.ai-writing-panel{padding:24px;gap:18px;grid-template-rows:auto minmax(88px,1fr) auto minmax(200px,1fr)}
.ai-assistance-intro{padding:0 0 4px;border:0;background:transparent}
.ai-assistance-intro strong{font-size:16px;font-weight:600}
.ai-assistance-intro p{max-width:64ch;margin-top:10px;line-height:1.6}
.ai-assistance-intro .ai-unavailable-notice{padding:12px 14px;border:1px solid var(--color-border-strong);border-radius:8px;background:var(--color-surface-muted);color:var(--color-text);font-weight:500}
.ai-assistant-thread{padding:16px;gap:12px;border:1px solid var(--color-border);border-radius:12px;background:var(--color-surface-subtle)}
.ai-thread-message{padding:12px 14px;font-size:13px;line-height:1.6}
.ai-assistance-composer{padding:16px;gap:12px;border:1px solid var(--color-border-strong);border-radius:12px;background:var(--color-composer)}
.ai-assistance-composer textarea{min-height:80px;max-height:120px;padding:12px;font-size:13px;line-height:1.6;resize:vertical}
.ai-assistance-composer > div{gap:16px;flex-wrap:wrap}
.ai-draft-card{padding:18px;gap:12px;border:1px solid var(--color-accent-border);border-radius:12px;background:var(--color-surface)}
.ai-draft-head{gap:16px;align-items:flex-start}
.ai-draft-head strong{display:block;font-size:13px;margin-top:6px}
.ai-draft-text{padding:14px;margin:0;font-size:13px;line-height:1.6;border:0}
.ai-draft-actions{gap:16px;flex-wrap:wrap}
.ai-draft-actions button{flex-shrink:0}
.ai-reference-panel > header{padding:24px;min-height:84px}
.ai-reference-panel{background:var(--color-surface-subtle)}
@media (max-height:800px) and (min-width:821px){
 .ai-writing-panel{overflow-y:auto;grid-template-rows:auto 120px auto 260px}
}
@media (max-width:820px){
 .ai-assistance-workspace{padding:16px}
 .ai-assistance-head{flex-wrap:wrap;gap:16px;margin-bottom:18px}
 .ai-assistance-head-actions{width:100%;justify-content:space-between;gap:12px}
 .ai-assistance-layout{grid-template-columns:minmax(0,1fr);gap:18px}
 .ai-writing-panel{padding:16px;gap:16px;min-height:860px;grid-template-rows:auto 150px auto minmax(250px,1fr)}
 .ai-assistance-composer textarea{font-size:16px}
 .ai-reference-panel > header{padding:18px;flex-wrap:wrap}
}
#dashboard-view > .metrics { max-width: 900px; margin: 28px auto; }
#dashboard-view .metric-card { padding: 22px; box-shadow: none; border-radius: 12px; }
#dashboard-view .metric-card strong { font-size: 28px; }
.dashboard-placeholder { background: transparent; border: 0; box-shadow: none; }
.dashboard-welcome {
  max-width: 780px;
  margin: clamp(36px, 9vh, 108px) auto;
  padding: 0 clamp(12px, 4vw, 48px);
}
.dashboard-welcome h2 {
  margin: 0 0 44px;
  font-size: 18px;
  font-weight: 500;
  color: var(--color-text-muted);
}
.daily-quote { margin: 0; }
.daily-quote::before {
  content: '';
  display: block;
  width: 36px;
  height: 3px;
  margin-bottom: 24px;
  border-radius: 2px;
  background: var(--color-accent);
}
.daily-quote blockquote {
  margin: 0;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(25px, 2.6vw, 38px);
  font-weight: 400;
  line-height: 1.42;
  letter-spacing: -.02em;
  color: var(--color-text);
  overflow-wrap: anywhere;
  text-wrap: pretty;
}
.daily-quote figcaption {
  margin-top: 24px;
  font-size: 13px;
  color: var(--color-text-muted);
}
#dashboard-view { height:100dvh; min-height:0; display:flex; flex-direction:column; overflow:hidden; }
#dashboard-view > .topbar { flex:none; }
.chat-history-status { flex:none; padding:6px 12px; font-size:11px; color:var(--color-text-muted); }
.native-messages { overflow-anchor:none; }
.desktop-setup-dialog { max-width:460px; width:calc(100vw - 40px); padding:28px; border:1px solid var(--color-border); border-radius:16px; background:var(--color-surface); color:var(--color-text); }
.desktop-setup-dialog::backdrop { background:var(--color-backdrop); }
.desktop-setup-dialog h2 { font-size:20px; color:var(--color-text); }
.desktop-setup-dialog h3 { font-size:14px; margin-top:24px; }
.desktop-setup-dialog p { font-size:13px; line-height:1.6; }
.desktop-setup-dialog a { margin:12px 0; display:inline-flex; text-decoration:none; }
.desktop-launch-toggle { width:100%; margin:0 0 8px; padding:10px; border:0; border-radius:11px; display:flex; justify-content:center; gap:8px; font-size:11px; background:var(--color-sidebar-raised); color:var(--color-sidebar-text); }
@media(max-width:1200px){.desktop-launch-toggle span:last-child{display:none}}
@media(max-width:820px){.desktop-launch-toggle{display:none}}
#dashboard-view h1, #dashboard-view .dashboard-inbox-head h2 { color:var(--color-text); }
#dashboard-status { flex:none; margin:0 0 12px; color:var(--color-text-muted); font-size:13px; }
.dashboard-layout { flex:1; min-height:0; display:grid; grid-template-columns:minmax(0,1fr); gap:28px; }
#dashboard-view.has-lists .dashboard-layout { grid-template-columns:minmax(0,2fr) minmax(0,1fr); }
#dashboard-view.has-unread.has-starred .dashboard-layout { grid-template-columns:repeat(3,minmax(0,1fr)); }
#dashboard-view .dashboard-welcome { width:100%; max-width:none; min-width:0; margin:0; padding:clamp(24px,5vw,72px); display:flex; flex-direction:column; justify-content:center; overflow:auto; }
#dashboard-view .dashboard-welcome h2 { margin:0 0 36px; font-size:15px; }
#dashboard-view .daily-quote { max-width:900px; }
#dashboard-view .daily-quote blockquote { font-size:clamp(32px,4vw,60px); line-height:1.3; }
#dashboard-view.has-lists .dashboard-welcome { padding:28px; border-left:1px solid var(--color-border-strong); }
#dashboard-view.has-lists .daily-quote blockquote { font-size:clamp(23px,2vw,34px); line-height:1.45; }
.dashboard-inbox { min-height:0; min-width:0; display:flex; flex-direction:column; border:1px solid var(--color-border); background:var(--color-surface); border-radius:16px; overflow:hidden; }
.dashboard-inbox[hidden] { display:none; }
.dashboard-inbox-head { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px; padding:24px; border-bottom:1px solid var(--color-border); }
.dashboard-inbox-head h2 { font-size:20px; margin:0; }
.dashboard-inbox-head button { font-size:12px; }
#dashboard-inbox-list, #dashboard-starred-list { min-height:0; overflow-y:auto; overscroll-behavior:contain; padding:8px 12px 20px; }
.dashboard-group-title { padding:18px 12px 10px; margin:0; font-size:12px; font-weight:600; color:var(--color-text-muted); }
.dashboard-chat { display:flex; align-items:center; gap:14px; width:100%; padding:18px 12px; border:0; border-radius:9px; background:transparent; color:var(--color-text); text-align:left; cursor:pointer; }
.dashboard-chat + .dashboard-chat { border-top:1px solid var(--color-border); }
.dashboard-chat:hover { background:var(--color-surface-subtle); }
.dashboard-chat:focus-visible { outline:2px solid var(--color-accent); outline-offset:-2px; }
.dashboard-chat-icon { display:grid; place-items:center; width:32px; height:32px; flex:none; border:1px solid var(--color-border); border-radius:9px; font-size:16px; color:var(--color-text-muted); }
.dashboard-chat-copy { min-width:0; flex:1; display:flex; flex-direction:column; gap:5px; }
.dashboard-chat-copy strong { font-size:14px; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.dashboard-chat-copy small { font-size:11px; color:var(--color-text-muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.dashboard-preview { font-size:12px; line-height:1.5; color:var(--color-text-muted); display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; overflow-wrap:anywhere; }
.dashboard-chat-badges { display:flex; gap:5px; flex:none; }
@media(max-width:900px) {
  #dashboard-view { height:auto; min-height:100dvh; overflow:visible; }
  #dashboard-view.has-lists .dashboard-layout, #dashboard-view.has-unread.has-starred .dashboard-layout { grid-template-columns:minmax(0,1fr); }
  #dashboard-view .dashboard-welcome { min-height:65dvh; padding:28px 8px; }
  #dashboard-view.has-lists .dashboard-welcome { min-height:0; padding:24px 8px; border-left:0; border-top:1px solid var(--color-border); }
  #dashboard-inbox-list, #dashboard-starred-list { max-height:60dvh; }
  .dashboard-inbox-head { padding:18px; }
}
.messages-panel { box-shadow: none; border-radius: 14px; }
.messages-panel{grid-template-columns:340px minmax(0,1fr);background:var(--color-canvas);border:0;border-radius:0;gap:24px}
.chat-sidebar{border:1px solid var(--color-border);border-radius:14px}
.chat-sidebar-head{z-index:2;background:var(--color-surface-subtle)}
#chat-main{border-radius:16px;background:var(--color-surface);box-shadow:var(--shadow-xs);min-width:0;overflow:hidden}
:root[data-theme="dark"] #chat-main{box-shadow:inset 0 0 0 1px var(--color-border-strong),var(--shadow-sm)}
#chat-main > .detail-head{flex-wrap:wrap}
#chat-main .detail-head h2{font-size:32px;line-height:1.2}
#chat-main > .detail-head > div{flex-basis:200px}
.workspace-current-tab{display:flex;align-items:center;min-height:44px;color:var(--color-accent);border-bottom:2px solid var(--color-accent);font-size:12px;font-weight:650}
.hub-back{display:none}
@media (max-width:1200px) and (min-width:821px){.messages-panel{grid-template-columns:280px minmax(0,1fr);gap:16px}}
@media (max-width:820px){
  .messages-panel{grid-template-columns:minmax(0,1fr);gap:0}
  #messages-view:not(.has-conversation) #chat-main{display:none}
  #messages-view.has-conversation .chat-sidebar{display:none}
  #messages-view .hub-back{display:block;flex-basis:100%;text-align:left;background:transparent;border:0;padding:0;color:var(--color-text-muted)}
  #chat-main > .detail-head{padding:18px 16px 10px;gap:10px}
  #chat-main .detail-head h2{font-size:24px}
}
.detail-head { animation: workspace-fade 160ms ease; }
@keyframes workspace-fade { from { opacity: .3; } to { opacity: 1; } }
@keyframes workspace-drawer { from { opacity: 0; transform: translateX(32px); } to { opacity: 1; transform: translateX(0); } }
@media (min-width: 821px) and (max-width: 1200px) {
  :root { --workspace-rail: 72px; --workspace-tree: 280px; }
  .sidebar { padding-inline: 10px; }
  .brand { font-size: 0; justify-content: center; padding-inline: 0; }
  .nav-item { font-size: 0; justify-content: center; }
  .sidebar .nav-label, .sidebar-project-copy { display: none; }
  .sidebar .project-item { justify-content: flex-start; padding-right: 30px; }
  .sidebar .project-more { display: grid; right: 0; }
  .sidebar .profile { display: flex; justify-content: center; }
  .sidebar .profile > span { display: none; }
  .profile-logout { min-width: 36px; min-height: 36px; }
  .sidebar-theme-toggle [data-theme-label] { display: none; }
  #detail-panel { margin-inline: 20px; }
  .detail-head { padding: 24px 24px 12px; }
  .chat-head { margin-inline: 24px; }
  .message-composer { width: calc(100% - 40px); }
}
@media (max-width: 820px) {
  :root { --workspace-rail: 0px; }
  .app-shell { display: block; }
  .sidebar { height: 62px; position: relative; padding: 10px 12px; }
  .brand { padding: 0; font-size: 0; }
  .sidebar nav { flex: 1; }
  .sidebar .nav-item { margin: 0; font-size: 0; flex-shrink: 0; }
  .sidebar-foot { border: 0; padding: 0; }
  .sidebar .profile { display: flex; margin: 0; }
  .sidebar .profile > span { display: none; }
  .sidebar-theme-toggle { display: none; }
  .profile-logout { min-width: 32px; }
  #projects-view { height: calc(100dvh - 62px); overflow: hidden; }
  #projects-view .workspace { display: block; height: 100%; }
  #projects-view .task-panel { height: 100%; border: 0; }
  #projects-view .projects-topbar { display: none; }
  #projects-view.has-selection .projects-topbar { display: flex; height: 48px; left: 0; padding: 0 12px; }
  #projects-view.has-selection .task-panel { display: none; }
  #projects-view.has-selection .workspace-focus { display: none; }
  .projects-topbar .location-card-list { padding: 0; overflow: visible; max-width: none; }
  #projects-view .detail-panel { display: none; }
  #projects-view.has-selection .detail-panel { display: flex; margin: 48px 8px 8px; height: calc(100% - 56px); border-radius: 12px; }
  .detail-head { padding: 18px 16px 10px; flex-wrap: wrap; gap: 4px; }
  .detail-head > div { flex-basis: calc(100% - 38px); order: 0; }
  .detail-head .close-detail { order: 1; }
  .workspace-details-button { order: 2; margin: 4px 0 0; padding: 6px 0; }
  .detail-head h2 { font-size: 23px; }
  .detail-head .status-tag { margin-top: 6px; }
  .chat-head { min-height: 40px; height: 40px; margin-inline: 16px; }
  .workspace-content-tabs { margin-inline: 16px; }
  .workspace-files-view { padding: 16px; }
  .native-messages { padding: 6px; }
  .message { grid-template-columns: 28px minmax(0, 1fr); padding: 12px 6px; gap: 8px; }
  .native-conversation > .conversation-ai-bar { padding-inline: 16px; }
  .message p { font-size: 10px; line-height: 1.5; }
  .message-avatar { width: 28px; min-width: 28px; height: 28px; }
  .message-composer { width: calc(100% - 24px); margin: 8px auto 12px; padding: 8px; flex-wrap: wrap; min-height: 80px; }
  .message-composer textarea { font-size: 16px; flex: 1 1 60%; min-width: 0; }
  #messages-view { height: calc(100dvh - 62px); }
  .ai-assistance-workspace { inset: 62px 0 0; }
  #dashboard-view > .metrics { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Approved V5: distinct surfaces, chat emphasis and continuous SVG hierarchy. */
.department-branch{position:relative;isolation:isolate;margin:12px 0 24px}
.department-branch::details-content{interpolate-size:numeric-only;transition:none;overflow:visible}
.department-branch > summary::before{display:none}
.task-department-heading{min-height:42px;padding:6px 4px;position:relative;z-index:1;color:var(--color-text)}
.task-department-heading strong{font-size:12px;font-weight:600;text-transform:none;letter-spacing:0}
.task-department-heading small{display:block;font-size:10px;font-weight:400;color:var(--color-text-subtle)}
.department-chevron,.hierarchy-toggle svg,.hierarchy-spacer svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}
.department-branch[open] > summary .department-chevron,.hierarchy-toggle[aria-expanded="true"] svg{transform:rotate(90deg)}
.task-row{position:relative;z-index:1;min-width:218px;grid-template-columns:23px minmax(0,1fr) auto}
.task-row-child::before{display:none}
.task-row.selected::after{left:0;right:auto;background:var(--color-accent)}
.task-title-line{justify-content:space-between;flex-wrap:nowrap;gap:8px}
.task-title{min-width:0;white-space:normal;overflow-wrap:anywhere;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.task-main{min-width:0;flex:1}
.task-row .directory-badges{flex-shrink:0}
.task-rights-button{opacity:1;color:var(--color-text-subtle);height:36px}
.hierarchy-toggle,.hierarchy-spacer{display:grid;place-items:center;color:var(--color-text-subtle)}
.task-list{overflow:auto;overscroll-behavior:contain;min-height:0;padding:18px 12px}
.task-panel{position:relative}
.task-tree-wires{position:absolute;left:0;top:0;overflow:visible;fill:none;pointer-events:none;z-index:0}
.task-tree-wires path{stroke:var(--color-tree-wire);stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke}
.task-tree-wires path.selected-route{stroke:var(--color-tree-active);stroke-width:2.5}
.task-tree-wires circle{stroke:var(--color-tree-wire);stroke-width:1.6;fill:var(--color-surface-subtle);vector-effect:non-scaling-stroke}
.task-tree-wires circle.selected-route{stroke:var(--color-tree-active);fill:var(--color-tree-active)}
.chat-directory .directory-item{z-index:1}
.chat-directory .directory-copy{font-size:12px}
.chat-directory .directory-copy strong{white-space:normal;overflow-wrap:anywhere;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;line-height:1.4}
.chat-directory .directory-copy small{font-size:10px}
.task-tree-resizer{position:absolute;right:0;top:0;bottom:0;width:9px;z-index:19;cursor:col-resize;touch-action:none;display:flex;align-items:center;justify-content:center}
.task-tree-resizer::after{content:"";width:3px;height:44px;border-radius:3px;background:var(--color-text-subtle);opacity:.35;transition:height 140ms,opacity 140ms}
.task-tree-resizer:hover::after,.task-tree-resizer:focus-visible::after{height:72px;background:var(--color-accent);opacity:1}
.task-tree-resizer:focus-visible{outline-offset:-2px}
#projects-view.is-resizing .workspace,#projects-view.is-resizing .projects-topbar{transition:none;user-select:none}
.work-item-action-menu[popover]{position:fixed;inset:auto;margin:0;max-height:calc(100dvh - 16px);overflow:auto;border-radius:12px;padding:7px;background:var(--color-surface);box-shadow:var(--shadow-dialog)}
.work-item-action-menu[popover]:not(:popover-open){display:none}
.work-item-action-menu button{font-size:12px;min-height:38px}
.detail-head h2{font-size:32px;font-weight:650;letter-spacing:-.04em;line-height:1.2}
#detail-panel{border-radius:16px;box-shadow:var(--shadow-xs)}
:root[data-theme="dark"] #detail-panel{box-shadow:0 0 0 1px var(--color-border-strong),var(--shadow-sm)}
.workspace-details-button{border:1px solid var(--color-border);border-radius:8px;padding:9px 12px;background:var(--color-surface);font-size:12px}
.workspace-content-tabs button[aria-selected="true"]{color:var(--color-accent)}
.workspace-content-tabs button[aria-selected="true"]::after{background:var(--color-accent)}
.message{margin-bottom:4px}
.message-head strong{font-size:10px}
.message-head small{color:var(--color-text-subtle)}
.message.is-personal{border-left:3px solid var(--color-personal-line)}
.message-composer{background:var(--color-composer);border:1px solid var(--color-border-strong)}
.message-composer textarea{background:transparent;color:var(--color-text)}
.message-composer textarea::placeholder{color:var(--color-text-subtle)}
.message-composer .conversation-ai-button{display:grid;place-items:center;flex:0 0 34px;min-width:34px;min-height:34px;width:34px;height:34px;padding:6px;border:0;background:transparent;color:var(--color-accent);border-radius:8px}
.message-composer .conversation-ai-button:hover{background:var(--color-accent-soft)}
.conversation-ai-button svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
/* A temporary modal layer, not a replacement for the workspace. */
dialog.ai-assistance-workspace{inset:0;left:0;margin:auto;width:min(1240px,calc(100vw - 64px));height:min(880px,calc(100dvh - 64px));max-width:none;max-height:none;padding:24px;color:var(--color-text);border:1px solid var(--color-border-strong);border-radius:18px;box-shadow:var(--shadow-dialog);visibility:visible;opacity:1;pointer-events:auto;transform:none;overflow:hidden;transition:none}
dialog.ai-assistance-workspace:not([open]){display:none}
dialog.ai-assistance-workspace[open]{display:flex;animation:ai-modal-enter 180ms var(--ease-workspace)}
dialog.ai-assistance-workspace::backdrop{background:var(--color-backdrop);backdrop-filter:blur(3px)}
.ai-assistant-thread.is-idle,.ai-draft-card.is-idle{background:var(--color-ai-idle-surface);border-color:var(--color-ai-idle-border);box-shadow:none}
.ai-assistant-thread.is-idle > *,.ai-draft-card.is-idle > *{opacity:.38;filter:grayscale(1);transition:opacity 160ms ease}
.ai-writing-panel:has(.ai-draft-card.is-idle) .ai-assistance-composer{background:var(--color-composer);border-color:var(--color-accent);box-shadow:0 0 0 2px var(--color-accent-soft),var(--shadow-ai-input)}
@keyframes ai-modal-enter{from{opacity:0;transform:translateY(8px) scale(.985)}to{opacity:1;transform:none}}
@media(max-width:820px){dialog.ai-assistance-workspace{width:calc(100vw - 24px);height:calc(100dvh - 24px);padding:16px;border-radius:14px}}
.message-composer button{color:var(--color-on-accent)}
.chat-day-divider,.chat-unread-divider{display:flex;align-items:center;gap:14px;max-width:808px;margin:22px auto;font-size:11px;font-weight:600;color:var(--color-text-muted)}
.chat-day-divider::before,.chat-day-divider::after{content:"";height:var(--chat-divider-width);background:var(--color-date-rule);flex:1}
.chat-unread-divider{color:var(--color-unread-marker)}
.chat-unread-divider::after{content:"";height:var(--chat-divider-width);background:var(--color-unread-marker);flex:1}
@media(min-width:821px) and (max-width:1200px){:root{--workspace-tree:280px}.detail-head h2{font-size:27px}}
@media(max-width:820px){.task-tree-resizer{display:none}.detail-head h2{font-size:26px}.task-list{padding-inline:12px}.chat-day-divider,.chat-unread-divider{margin-inline:8px}}

/* Light style comparison affects surfaces, never layout or semantic badges. */
:root[data-theme="light"] #projects-view,
:root[data-theme="light"] #messages-view { background:var(--color-canvas); }
:root[data-theme="light"] #detail-panel .chat-pane,
:root[data-theme="light"] #detail-panel .chat-pane .native-conversation,
:root[data-theme="light"] #hub-conversation .native-conversation { background:var(--color-chat-canvas); }
:root[data-theme="light"] #messages-view .chat-sidebar { background:var(--color-surface); }
:root[data-theme="light"] #detail-panel,
:root[data-theme="light"] #chat-main {
  border:1px solid var(--color-border);
  box-shadow:var(--shadow-card, var(--shadow-sm));
}
:root[data-theme="light"] .chat-card-head { background:var(--color-card-header, var(--color-surface)); }

/* One chat heading row; all chat/file/detail actions remain available inline. */
#detail-panel > .chat-card-head, #chat-main > .chat-card-head {
  display:flex; align-items:center; flex-wrap:nowrap; gap:12px;
  min-height:52px; padding:10px 20px; border-bottom:1px solid var(--color-border);
}
.chat-card-head > .chat-title-line {
  display:flex; align-items:center; gap:12px; flex:1 1 0; min-width:0; order:0;
}
#chat-main > .chat-card-head > .chat-title-line { flex-basis:0; }
#detail-panel .chat-card-head .chat-title-line h2, #chat-main .chat-card-head .chat-title-line h2 {
  margin:0; min-width:0; flex:1; font-size:15px; line-height:22px; font-weight:600;
  letter-spacing:-.015em; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.chat-card-head .status-tag { flex-shrink:0; margin:0; white-space:nowrap; font-size:10px; }
.chat-card-head .workspace-content-tabs { flex:0 0 auto; gap:12px; margin:0; border:0; }
.chat-card-head .workspace-content-tabs button { min-height:30px; font-size:11px; }
.chat-card-head .workspace-details-button { margin:0; padding:5px 0; font-size:11px; }
.chat-card-head .close-detail { order:2; min-width:24px; width:24px; min-height:28px; font-size:20px; }
.chat-head[hidden] { display:none; }
@media(max-width:820px) {
  #detail-panel > .chat-card-head, #chat-main > .chat-card-head { gap:7px; padding:8px 12px; min-height:46px; }
  .chat-card-head > .chat-title-line { gap:6px; }
  #detail-panel .chat-card-head .chat-title-line h2, #chat-main .chat-card-head .chat-title-line h2 { font-size:13px; line-height:20px; }
  .chat-card-head .status-tag { font-size:9px; padding:3px 5px; }
  .chat-card-head .workspace-content-tabs { gap:8px; }
  .chat-card-head .workspace-content-tabs button, .chat-card-head .workspace-details-button { font-size:10px; }
  #messages-view .chat-card-head .hub-back { flex:0 0 24px; width:24px; min-height:28px; padding:0; }
}
