/* Shared geometry for page-header controls and directory cards. */

.ui-page-title,.ui-section-title{display:flex;align-items:center;min-width:0}
.ui-page-title h1,.ui-section-title :is(h2,h3,h4){margin:0;overflow-wrap:anywhere}
.ui-page-context{color:#596471;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.ui-info-button{display:inline-flex;align-items:center;justify-content:center;background:transparent;border-color:transparent;color:#596471}
.ui-info-button:hover,.ui-info-button[aria-expanded="true"]{background:#edf3ff;color:#254d97}
.ui-info-button:focus-visible{outline:2px solid #3669bd;outline-offset:2px}
.ui-help-popover{font-size:var(--type-body);line-height:1.8;position:fixed;inset:auto;margin:0;background:#fff;color:#273344;border:1px solid #dfe4eb;box-shadow:0 8px 32px #1b2d4926;overflow:auto}
.ui-help-heading{display:flex;align-items:center;justify-content:space-between}
.ui-help-title{font-size:inherit;font-weight:600;margin:0}
.ui-help-copy{margin:0;white-space:pre-line;overflow-wrap:anywhere;line-height:1.65}
.ui-help-popover::backdrop{background:transparent;pointer-events:none}
.ui-help-popover button{font:inherit;cursor:pointer}
.ui-help-popover:focus{outline:none}


/* One title row; only pages with tools reserve a second row. */
.ui-workspace .panel-header{min-height:136px;flex-shrink:0}
.ui-workspace .panel-header.no-toolbar{height:auto;min-height:0}
.ui-workspace .panel-header .heading-line{min-height:var(--ui-control-height)}
.ui-workspace .panel-header .toolbar{gap:var(--ui-control-gap)}
.ui-workspace .panel-header .project-config-tabs{max-width:none;flex:none}
.project-config-description{margin:0 0 18px}
.ui-workspace .panel-header .toolbar>:is(.search,select,button,.category-segments),
.ui-workspace .panel-header .toolbar>.archive-header-actions>button,
.ui-workspace .panel-header .heading-actions>button,
.ui-workspace .panel-header .heading-actions>.archive-header-actions>button,
.ui-workspace .panel-header .heading-actions>.project-switch>button{
 height:var(--ui-control-height)!important;
 min-height:var(--ui-control-height);
 border-radius:var(--ui-control-radius);
}
.ui-workspace .panel-header .toolbar>.category-segments>button{
 height:calc(var(--ui-control-height) - 2px)!important;
 min-height:calc(var(--ui-control-height) - 2px);
}

/* The five-category knowledge header aligns with team and project headers. */
@container memory-panel (min-width:701px){
 .ui-workspace .content-shell #main>.panel-header:has([data-me-kind]){height:136px;min-height:136px}
 .ui-workspace .panel-header:has([data-me-kind]) .toolbar{height:var(--ui-control-height);min-height:var(--ui-control-height);margin-top:auto}
 .ui-workspace .panel-header:has([data-me-kind]) .toolbar>.category-segments,
 .ui-workspace .panel-header:has([data-me-kind]) .toolbar>.search{height:var(--ui-control-height)!important}
}
@container memory-panel (max-width:560px){
 .ui-workspace .panel-header:has([data-me-kind]) .toolbar>.category-segments{height:auto!important}
}

/* Top-level team, work-plan and knowledge directories share one card system. */
:is(.ui-workspace, .project-page-dialog) .content-shell .directory-card{
 width:100%;
 height:var(--ui-directory-card-height);
 min-height:var(--ui-directory-card-height);
 max-height:var(--ui-directory-card-height);
 display:flex;
 align-items:center;
 gap:10px;
 padding:var(--ui-directory-card-padding);
 border:1px solid #dfe4eb;
 border-radius:var(--ui-directory-card-radius);
 background:#fff;
 box-shadow:none;
 text-align:left;
 overflow:hidden;
}
:is(.ui-workspace, .project-page-dialog) .content-shell :is(.member-roster,.library-roster)>.item-list{gap:var(--ui-directory-card-gap)}
:is(.ui-workspace, .project-page-dialog) .content-shell .team-roster .item-list{gap:var(--ui-directory-card-gap)}
:is(.ui-workspace, .project-page-dialog) .content-shell .directory-card:hover:not(:disabled):not(.active){
 background:#f7f9fd;
 border-color:#cbd6e3;
 filter:none;
}
:is(.ui-workspace, .project-page-dialog) .content-shell .directory-card.active{
 background:var(--ui-directory-selected-bg);
 border-color:var(--ui-directory-selected-border);
 box-shadow:none!important;
}
:is(.ui-workspace, .project-page-dialog) .content-shell .directory-card-copy{min-width:0;flex:1}
:is(.ui-workspace, .project-page-dialog) .content-shell .directory-card .avatar{width:36px;height:36px;flex:none}
:is(.ui-workspace, .project-page-dialog) .content-shell .directory-card h3,
:is(.ui-workspace, .project-page-dialog) .content-shell .directory-card-meta{
 display:block;
 max-width:100%;
 overflow:hidden;
 text-overflow:ellipsis;
 white-space:nowrap;
}
:is(.ui-workspace, .project-page-dialog) .content-shell .directory-card h3{margin:0}
:is(.ui-workspace, .project-page-dialog) .content-shell .directory-card-meta{
 margin:4px 0 0!important;
 color:#7d8898;
 font-size:12px!important;
 font-weight:400!important;
 line-height:1.6!important;
}

:is(.ui-workspace, .project-page-dialog) .content-shell .directory-card.plan-directory-card .directory-card-copy{
 width:100%;
 overflow:hidden;
}

/* Project team keeps its avatar size within the shared card height. */
:is(.ui-workspace, .project-page-dialog) .content-shell .directory-card.team-config-card{
 padding:var(--ui-directory-card-padding);
}
:is(.ui-workspace, .project-page-dialog) .content-shell .directory-card.team-config-card .avatar{
 width:32px;
 height:32px;
 flex:none;
}

/* Document titles and status share the same two-line directory rhythm. */
:is(.ui-workspace, .project-page-dialog) .content-shell .directory-card.directory-card-document{
 flex-direction:column;
 align-items:stretch;
 justify-content:space-between;
 gap:4px;
}
:is(.ui-workspace, .project-page-dialog) .content-shell .directory-card.directory-card-document h3{
 display:block;
 white-space:nowrap;
 text-overflow:ellipsis;
}

/* Pointer interaction uses the control's own border/state instead of WebKit's blue focus halo. */
body:not(.keyboard-focus) :is(button,a,input,textarea,select,summary,[tabindex],[contenteditable]):focus{
 outline:none!important;
}
body:not(.keyboard-focus) :is(.search,.profile-image-picker,.material-file-control):focus-within{
 outline:none!important;
 box-shadow:none!important;
}
body:not(.keyboard-focus) .search:focus-within{
 border-color:#e1e5eb!important;
}

/* Tab navigation keeps one restrained, neutral cue without restoring the blue double frame. */
body.keyboard-focus :is(button,a,input,textarea,select,summary,[tabindex],[contenteditable]):focus{
 outline:1px solid #8792a4!important;
 outline-offset:2px!important;
}
body.keyboard-focus :is(.search,.profile-image-picker,.material-file-control):focus-within{
 outline:1px solid #8792a4!important;
 outline-offset:2px!important;
 box-shadow:none!important;
}
body.keyboard-focus :is(.search,.profile-image-picker,.material-file-control):focus-within :focus{
 outline:none!important;
}
body.keyboard-focus .search:focus-within{
 border-color:#aeb7c4!important;
}

/* Instruction status and file operations live on one dedicated page. */
.ui-workspace .instruction-sync{font-size:13px;line-height:1.6}
.ui-workspace .instruction-sync{min-width:0}
.ui-workspace .instruction-status.error-text{color:#a33335}
.ui-workspace .instruction-fulltext{white-space:pre-wrap;overflow-wrap:anywhere;font:13px/1.6 ui-monospace,monospace;background:transparent;overflow:auto}
.ui-workspace [data-instructions-text]{display:block;width:100%;min-height:320px;font:12px/1.6 ui-monospace,monospace}
.ui-workspace .instruction-needs-attention{display:inline-flex;align-items:center;gap:var(--ui-control-gap);border-color:#c36b70;color:#a33335}
.ui-workspace .instruction-needs-attention::before{content:"";width:var(--ui-space-2);height:var(--ui-space-2);border-radius:50%;background:#bd4349;flex:none}
.instruction-problem-dialog .instruction-compare{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--ui-content-gap)}
.instruction-problem-dialog .instruction-compare>section{min-width:0}
.instruction-problem-dialog .instruction-compare h3{margin:0 0 var(--ui-control-gap)}
.instruction-problem-dialog .instruction-compare pre{white-space:pre-wrap;overflow-wrap:anywhere;overflow:auto;font:12px/1.6 ui-monospace,monospace;background:#f7f9fc;border:1px solid var(--line)}
.instruction-problem-dialog .instruction-choice{display:flex!important;align-items:flex-start;gap:var(--ui-control-gap);font-weight:400!important}
.instruction-problem-dialog .instruction-choice>span{display:grid;gap:var(--ui-space-1);min-width:0}
.instruction-problem-dialog .instruction-choice small{color:var(--muted);font-weight:400;line-height:1.5}
.instruction-problem-dialog .instruction-choice:has(input:disabled){opacity:.5}
.instruction-problem-dialog .instruction-problem-error:empty{display:none}
.instruction-problem-dialog .instruction-merge-editor[hidden]{display:none}

/* Resource categories share a responsive grid in role and project details. */
.ui-workspace .mm-role-resource-overview{grid-template-columns:repeat(auto-fit,minmax(min(100%,240px),1fr))}

/* One catalogue heading and count across list/detail pages. */
.directory-heading{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;min-width:0}
.directory-heading-actions{display:flex;flex-wrap:wrap;max-width:100%;margin-left:auto}
.directory-heading h2{display:flex;align-items:center;gap:var(--ui-control-gap);min-width:0;overflow-wrap:anywhere}
.directory-count{flex:none;white-space:nowrap;color:var(--muted);font-variant-numeric:tabular-nums}

/* Object overview shared by catalogue details and recorded tasks. */
.ui-detail-overview{display:grid;grid-template-columns:minmax(0,1fr);min-width:0;container-type:inline-size;container-name:ui-detail}
.ui-detail-overview:has(>:is(.ui-detail-actions,.resource-toolbar,.mm-actions,.plan-directory-actions)){grid-template-columns:minmax(0,1fr) auto}
.ui-detail-overview>.ui-detail-title{grid-column:1;grid-row:1}
.ui-detail-overview>:is(.ui-detail-actions,.resource-toolbar,.mm-actions,.plan-directory-actions){grid-column:2;grid-row:1}
.ui-detail-overview>:not(.ui-detail-title,.ui-detail-actions,.resource-toolbar,.mm-actions,.plan-directory-actions){grid-column:1/-1}
.ui-detail-title,.ui-detail-actions{display:flex;align-items:center;flex-wrap:wrap;min-width:0}
.ui-detail-title{justify-content:space-between}
.ui-detail-title h2{min-width:0;overflow-wrap:anywhere}
.ui-detail-overview p,.ui-detail-overview h2{margin:0}

/* Filled blue identifies an AI request; ordinary primary actions keep the shared button shape. */
button.primary:not(.ai-action){background:#fff;border-color:#dce1e8;color:var(--ink);box-shadow:none}
button.primary:not(.ai-action):hover:not(:disabled){background:#f5f7fa}
button.ai-action{background:var(--blue);border-color:var(--blue);color:#fff;box-shadow:inset 0 1px 0 #ffffff25,0 2px 3px #315fe918}
button.ai-action:hover:not(:disabled){background:#2458b5;border-color:#2458b5}
