/* Horizon system completion layer.
   This file is intentionally loaded last: it defines the final cross-page
   contract for secondary pages, forms, overlays and feedback states. */

.horizon-workbench{
  --ui-canvas:#f7f9fb;
  --ui-panel:#fff;
  --ui-ink:#111318;
  --ui-copy:#26313e;
  --ui-muted:#697589;
  --ui-line:#dce2e8;
  --ui-line-strong:#cbd3dc;
  --ui-forest:#176b50;
  --ui-forest-strong:#115440;
  --ui-forest-soft:#e7f1ed;
  --ui-amber:#8a5a12;
  --ui-amber-soft:#fff3d9;
  --ui-red:#a43f37;
  --ui-red-soft:#fff0ee;
  --ui-blue:#365f84;
  --ui-blue-soft:#edf4fa;
  --ui-radius:6px;
  --ui-overlay-radius:10px;
  --ui-overlay-shadow:0 22px 64px rgba(18,31,47,.20);
}

/* Expanded version history is content, not a clipped card preview. */
.horizon-workbench .document-card.document-card--compact:has(wa-details.moos-details[open]) .document-card-body{
  overflow:visible!important;
  grid-template-rows:84px 34px 62px minmax(32px,max-content);
}
.horizon-workbench .document-card.document-card--compact wa-details.moos-details[open] .version-list{
  display:grid!important;
  gap:6px!important;
  max-height:none!important;
  margin:0!important;
  padding:0!important;
  overflow:visible!important;
}
.horizon-workbench .document-card.document-card--compact wa-details.moos-details[open] .version-list li{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) 28px;
  gap:6px!important;
  min-width:0;
  align-items:start!important;
}
.horizon-workbench .document-card.document-card--compact wa-details.moos-details[open] .version-list li>span{
  min-width:0!important;
  overflow:visible!important;
  overflow-wrap:anywhere;
  text-overflow:clip!important;
  white-space:normal!important;
}
.horizon-workbench .document-card.document-card--compact wa-details.moos-details[open] .version-list form{
  width:28px;
  margin:0!important;
}
.horizon-workbench .document-card.document-card--compact wa-details.moos-details[open] .version-list .icon-button-small{
  width:28px!important;
  min-width:28px!important;
  height:28px!important;
}

/* Compact document cards: images, labels and controls share one predictable
   structure in project files and the recycle bin. */
.horizon-workbench .document-card.document-card--compact{
  height:398px!important;
  min-height:398px!important;
  max-height:398px!important;
  grid-template-rows:142px minmax(0,1fr)!important;
}
.horizon-workbench .document-card.document-card--compact .document-preview{
  position:relative!important;
  display:grid!important;
  height:142px!important;
  min-height:142px!important;
  place-items:center!important;
  overflow:hidden!important;
  background:#f4f6f4!important;
}
.horizon-workbench .document-card.document-card--compact .document-preview>img{
  position:absolute!important;
  inset:0!important;
  display:block!important;
  width:100%!important;
  height:100%!important;
  max-width:none!important;
  max-height:none!important;
  min-width:0!important;
  min-height:0!important;
  box-sizing:border-box!important;
  object-fit:contain!important;
  object-position:center!important;
  background:#fff!important;
}
.horizon-workbench .document-card.document-card--compact .document-card-body{
  display:grid!important;
  grid-template-rows:84px 34px 62px minmax(32px,auto);
  gap:4px;
  min-height:0;
  padding:10px!important;
  overflow:hidden!important;
}
.horizon-workbench .document-card.document-card--compact .document-card-heading{
  display:grid!important;
  grid-template-columns:minmax(0,1fr);
  grid-template-rows:20px minmax(0,1fr);
  align-content:start;
  gap:4px;
  min-height:0!important;
}
.horizon-workbench .document-card.document-card--compact .document-card-heading>div{
  display:grid;
  min-width:0;
  gap:2px;
}
.horizon-workbench .document-card.document-card--compact .document-card-heading .visibility-tag{
  position:static!important;
  order:-1;
  justify-self:start;
  width:auto!important;
  min-width:0!important;
  max-width:100%!important;
  min-height:20px!important;
  height:20px!important;
  padding:0 7px!important;
  font-size:9px!important;
  line-height:1!important;
  white-space:nowrap!important;
}
.horizon-workbench .document-card.document-card--compact .document-card-heading h2{
  margin:0!important;
  font-size:12px!important;
  line-height:1.22!important;
}
.horizon-workbench .document-card.document-card--compact .document-scope{
  display:block;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.horizon-workbench .document-card.document-card--compact .document-meta{
  display:block!important;
  min-height:0!important;
  margin:0!important;
  overflow:hidden;
  font-size:10px!important;
  line-height:1.3!important;
}
.horizon-workbench .document-card.document-card--compact .icon-action-group{
  align-self:start;
  align-content:start;
  min-height:62px!important;
  margin:0!important;
}
.horizon-workbench .document-card.document-card--compact details{
  display:flex;
  min-height:32px;
  align-items:center;
  margin:0!important;
  padding:0!important;
  border:0!important;
  border-top:1px solid #e6ece9!important;
  border-radius:0;
  background:transparent;
}
.horizon-workbench .document-card.document-card--compact details summary{
  display:flex;
  width:100%;
  min-height:32px;
  align-items:center;
  justify-content:space-between;
  gap:5px;
  padding:0 1px;
  list-style:none;
  color:var(--ui-forest)!important;
  font-size:10px!important;
  font-weight:700;
  line-height:1;
  white-space:nowrap;
  cursor:pointer;
}
.horizon-workbench .document-card.document-card--compact details summary::-webkit-details-marker{display:none}
.horizon-workbench .document-card.document-card--compact details summary::after{
  content:"›";
  flex:0 0 auto;
  color:#687589;
  font-size:20px;
  font-weight:400;
  line-height:1;
  transition:transform .16s ease;
}
.horizon-workbench .document-card.document-card--compact details[open]{align-items:stretch;padding:7px 8px!important;border:1px solid var(--ui-line)!important;border-radius:6px;background:#f8faf9}
.horizon-workbench .document-card.document-card--compact details[open] summary{min-height:24px;padding:0}
.horizon-workbench .document-card.document-card--compact details[open] summary::after{transform:rotate(90deg)}
.horizon-workbench .document-card.document-card--compact:has(details[open]){height:auto!important;max-height:none!important;overflow:visible!important}
.horizon-workbench .document-card.document-card--compact wa-details.moos-details{
  display:block;
  min-height:32px;
  margin:0!important;
  --spacing:0;
}
.horizon-workbench .document-card.document-card--compact wa-details.moos-details::part(base){
  border:0!important;
  border-top:1px solid #e6ece9!important;
  border-radius:0!important;
  background:transparent!important;
}
.horizon-workbench .document-card.document-card--compact wa-details.moos-details::part(header){
  min-height:32px;
  padding:0 1px!important;
  color:var(--ui-forest);
  font-size:10px;
  font-weight:700;
  line-height:1;
  white-space:nowrap;
}
.horizon-workbench .document-card.document-card--compact wa-details.moos-details::part(summary){white-space:nowrap}
.horizon-workbench .document-card.document-card--compact wa-details.moos-details::part(icon){color:#687589;font-size:14px}
.horizon-workbench .document-card.document-card--compact wa-details.moos-details[open]::part(base){border:1px solid var(--ui-line)!important;border-radius:6px!important;background:#f8faf9!important}
.horizon-workbench .document-card.document-card--compact wa-details.moos-details[open]::part(header){padding:0 8px!important}
.horizon-workbench .document-card.document-card--compact wa-details.moos-details[open]::part(content){padding:0 8px 8px!important}
.horizon-workbench .document-card.document-card--compact:has(wa-details[open]){height:auto!important;max-height:none!important;overflow:visible!important}
.horizon-workbench .recycle-document-grid .document-card.document-card--compact{
  height:330px!important;
  min-height:330px!important;
  max-height:330px!important;
}
.horizon-workbench .recycle-document-grid .document-card.document-card--compact .document-card-body{
  grid-template-rows:84px 62px;
}
@media(max-width:560px){
  .horizon-workbench .document-card.document-card--compact{height:400px!important;min-height:400px!important;max-height:400px!important}
  .horizon-workbench .recycle-document-grid .document-card.document-card--compact{height:330px!important;min-height:330px!important;max-height:330px!important}
}
.horizon-workbench .moos-ag-grid{
  --ag-row-hover-color:#edf6f2;
  --ag-range-selection-border-color:#176b50;
  --ag-range-selection-border-style:solid;
}
.horizon-workbench .topbar-brand{display:flex;min-width:150px;align-items:center;gap:11px;color:var(--ui-ink);text-decoration:none}
.horizon-workbench .topbar-brand-logo{display:block;width:auto;height:46px;flex:0 0 auto;object-fit:contain}
.horizon-workbench .topbar-brand-copy{display:grid;gap:2px;line-height:1}
.horizon-workbench .topbar-brand-copy strong{color:var(--ui-ink);font-size:16px;font-weight:850;letter-spacing:-.035em}
.horizon-workbench .topbar-brand-copy small{color:#657267;font-size:10px;font-weight:650;letter-spacing:.035em}
.horizon-workbench .dashboard-project-row{gap:14px}
.horizon-workbench .dashboard-project-main{display:flex;min-width:0;flex:1 1 auto;align-items:center;gap:12px;text-decoration:none}
.horizon-workbench .dashboard-project-thumbnail{position:relative;display:grid;width:46px;height:46px;flex:0 0 46px;place-items:center;overflow:hidden;border:1px solid var(--ui-line);border-radius:6px;color:#809087;background:#fff}
.horizon-workbench .dashboard-project-thumbnail img{position:absolute!important;inset:4px!important;display:block;width:calc(100% - 8px)!important;height:calc(100% - 8px)!important;max-width:none!important;max-height:none!important;padding:0!important;box-sizing:border-box;object-fit:contain!important;object-position:center!important;background:#fff}
.horizon-workbench .dashboard-project-thumbnail i{font-size:16px}
.horizon-workbench .dashboard-project-main .entity-link{min-width:0}
.horizon-workbench .dashboard-project-main .entity-link strong,.horizon-workbench .dashboard-project-main .entity-link small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.horizon-workbench .dashboard-project-row:hover .dashboard-project-thumbnail{border-color:#a9c6ba;background:#edf6f2}

@media(max-width:560px){
  .horizon-workbench .dashboard-project-thumbnail{width:40px;height:40px;flex-basis:40px}
  .horizon-workbench .dashboard-project-row{gap:10px}
}

@media(min-width:1161px){
  .horizon-workbench .horizon-topbar{padding-left:36px}
}

@media(max-width:560px){
  .horizon-workbench .topbar-brand{min-width:0;gap:7px;font-size:inherit}
  .horizon-workbench .topbar-brand::before{content:none}
  .horizon-workbench .topbar-brand-logo{height:32px}
  .horizon-workbench .topbar-brand-copy strong{font-size:13px}
  .horizon-workbench .topbar-brand-copy small{display:none}
}

/* Page families */
.horizon-workbench .page-heading.compact-heading{min-height:96px;padding-top:24px;padding-bottom:24px}
.horizon-workbench .page-heading.compact-heading h1{font-size:clamp(1.8rem,2.1vw,2.25rem)}
.horizon-workbench .page-heading + :is(.form-card,.list-surface,.table-wrap,.management-section,.recycle-section){margin-top:18px}
.horizon-workbench .back-link{display:inline-flex;min-height:32px;gap:7px;align-items:center;margin:0 0 10px;color:var(--ui-muted);font-size:12px;font-weight:600;text-decoration:none}
.horizon-workbench .back-link:hover{color:var(--ui-forest-strong)}

/* One panel language across low-frequency and nested pages */
.horizon-workbench :is(.card,.form-card,.document-card,.drawing-card,.settings-panel,.overview-module,.project-narrative,.product-panel,.workspace-panel,.record-list,.list-surface,.management-card,.table-wrap){
  border:1px solid var(--ui-line);
  border-radius:var(--ui-radius);
  background:var(--ui-panel);
  box-shadow:none;
}
.horizon-workbench :is(.section-heading,.outside-heading,.product-panel-heading,.overview-module-heading){background:#fff}
.horizon-workbench .section-heading{min-height:56px;padding:12px 16px}
.horizon-workbench .section-heading h2{font-size:14px;font-weight:680}

/* Tables and pagination */
.horizon-workbench .table-wrap,
.horizon-workbench .page-shell .section-block>.table-wrap{overflow-x:auto!important;overflow-y:hidden;overscroll-behavior-inline:contain}
.horizon-workbench .table-wrap>table{width:100%;min-width:780px;border-collapse:collapse}
.horizon-workbench .table-wrap>table th{height:42px;padding:9px 12px;color:#4e5b6d;background:#fbfcfd;font-size:10px;font-weight:600;letter-spacing:0;text-align:left;text-transform:none;white-space:nowrap}
.horizon-workbench .table-wrap>table td{height:58px;padding:9px 12px;border-top:1px solid #e3e7ec;color:var(--ui-copy);font-size:12px;vertical-align:middle}
.horizon-workbench .table-wrap>table tbody tr:hover{background:#f7f9fb}
.horizon-workbench .table-wrap>table td a{color:var(--ui-forest);font-weight:600;text-decoration:none}
.horizon-workbench .pagination{display:flex;min-height:58px;align-items:center;justify-content:space-between;gap:16px;margin:-1px 0 0;padding:10px 14px;border:1px solid var(--ui-line);border-radius:0 0 var(--ui-radius) var(--ui-radius);background:#fff;box-shadow:none}
.horizon-workbench .pagination-pages{display:flex;gap:6px;align-items:center}
.horizon-workbench .page-number{display:grid;width:36px;height:36px;place-items:center;border:1px solid var(--ui-line);border-radius:5px;color:var(--ui-copy);background:#fff;font-size:12px;text-decoration:none}
.horizon-workbench .page-number.active{border-color:var(--ui-forest);color:#fff;background:var(--ui-forest)}

/* Forms */
.horizon-workbench :is(.field-row,.stacked-form p,.workspace-dialog-body>label){gap:6px}
.horizon-workbench :is(.field-row>label,.stacked-form label,.workspace-dialog-body>label,.editor-label label,fieldset>legend){color:var(--ui-copy);font-size:12px;font-weight:650}
.horizon-workbench :is(.field-row,.stacked-form,.project-settings-form,.communication-modal-form,.workspace-dialog-body) :is(input,select,textarea):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]),
.horizon-workbench .command-search-form input{
  min-height:42px;
  padding:8px 11px;
  border:1px solid var(--ui-line-strong);
  border-radius:5px;
  color:var(--ui-ink);
  background:#fff;
  box-shadow:none;
  font:inherit;
}
.horizon-workbench :is(.field-row,.stacked-form,.project-settings-form,.communication-modal-form,.workspace-dialog-body) textarea{min-height:92px;line-height:1.5;resize:vertical}
.horizon-workbench .owner-search input{
  padding-left:38px;
}
.horizon-workbench .owner-search>i{
  z-index:1;
  pointer-events:none;
}
.horizon-workbench :is(.field-row,.stacked-form,.project-settings-form,.communication-modal-form,.workspace-dialog-body) :is(input,select,textarea):not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
.horizon-workbench .global-search:focus-within,
.horizon-workbench .command-search-form input:focus{
  border-color:var(--ui-forest);
  outline:0;
  box-shadow:0 0 0 3px rgba(23,107,80,.10);
}
.horizon-workbench :is(.field-row,.stacked-form) small{color:var(--ui-muted);font-size:11px;line-height:1.45}
.horizon-workbench .errorlist{margin:5px 0 0;padding:0;color:var(--ui-red);font-size:11px;font-weight:650;list-style:none}
.horizon-workbench .form-errors{margin:12px 18px 0;padding:10px 12px;border:1px solid #edc8c3;border-left:3px solid var(--ui-red);border-radius:5px;color:#7e302a;background:var(--ui-red-soft);font-size:12px}
.horizon-workbench .form-card{max-width:980px;padding:22px}
.horizon-workbench .form-actions{display:flex;gap:8px;justify-content:flex-end;margin-top:20px;padding-top:16px;border-top:1px solid var(--ui-line)}
.horizon-workbench .checkbox-card{border-color:var(--ui-line-strong);border-radius:6px;background:#fff}
.horizon-workbench .checkbox-card:has(input:checked){border-color:#79a995;background:var(--ui-forest-soft)}

/* Buttons and semantic states */
.horizon-workbench :is(.button,.secondary-button,.icon-button){border-radius:5px;box-shadow:none}
.horizon-workbench .button{color:#fff;background:var(--ui-forest)}
.horizon-workbench .button:hover{background:var(--ui-forest-strong)}
.horizon-workbench .secondary-button{border-color:var(--ui-line-strong);color:var(--ui-copy);background:#fff}
.horizon-workbench .secondary-button:hover{border-color:#aeb9c5;color:var(--ui-ink);background:#f7f9fb}
.horizon-workbench :is(.danger-button,.secondary-button.danger,.icon-button-danger,.link-danger){color:var(--ui-red)}
.horizon-workbench .danger-button{border-color:var(--ui-red);color:#fff!important;background:var(--ui-red)}
.horizon-workbench .danger-button:hover{background:#87332d}
.horizon-workbench :is(.status-pill,.product-status,.visibility-tag){display:inline-flex;min-height:26px;align-items:center;padding:4px 10px;border:1px solid transparent;border-radius:999px!important;font-size:10px;font-weight:650;line-height:1.2}
.horizon-workbench :is(.status-active,.status-draft.status-active),
.horizon-workbench .product-status.status-active{border-color:#c4dfd4;color:var(--ui-forest-strong)!important;background:var(--ui-forest-soft)!important}
.horizon-workbench :is(.status-on_hold,.status-on-hold){border-color:#ead6a9;color:var(--ui-amber)!important;background:var(--ui-amber-soft)!important}
.horizon-workbench :is(.status-archived,.status-archive,.status-cancelled,.status-canceled){border-color:#d5dbe2;color:#596577!important;background:#f0f3f6!important}
.horizon-workbench .status-draft{border-color:#cad8e6;color:var(--ui-blue)!important;background:var(--ui-blue-soft)!important}
.horizon-workbench .visibility-customer{border-color:#c4dfd4;color:var(--ui-forest-strong)!important;background:var(--ui-forest-soft)!important}
.horizon-workbench .visibility-internal{border-color:#d5dbe2;color:#536174!important;background:#f0f3f6!important}

/* Empty, messages and system feedback */
.horizon-workbench .empty-state{display:grid;min-height:164px;place-items:center;align-content:center;gap:7px;padding:28px;border:1px dashed var(--ui-line-strong);border-radius:var(--ui-radius);color:var(--ui-muted);background:#fff;text-align:center}
.horizon-workbench .empty-state i{color:#748397;font-size:24px}
.horizon-workbench .empty-state :is(h2,h3){margin:0;color:var(--ui-ink);font-size:14px;font-weight:680}
.horizon-workbench .empty-state p{max-width:460px;margin:0;color:var(--ui-muted);font-size:12px}
.horizon-workbench :is(.list-surface,.workspace-panel,.product-panel)>.empty-state,
.horizon-workbench .compact-empty{min-height:120px;border:0;border-radius:0;background:transparent}
.horizon-workbench .system-error-state{max-width:720px;min-height:300px;margin:24px auto}
.horizon-workbench .message-stack{display:grid;gap:8px;margin-bottom:14px}
.horizon-workbench .message{display:flex;min-height:44px;gap:10px;align-items:center;padding:10px 12px;border:1px solid #cad8e6;border-radius:6px;color:var(--ui-blue);background:var(--ui-blue-soft);font-size:12px}
.horizon-workbench .message-success{border-color:#c4dfd4;color:var(--ui-forest-strong);background:var(--ui-forest-soft)}
.horizon-workbench .message-warning{border-color:#ead6a9;color:var(--ui-amber);background:var(--ui-amber-soft)}
.horizon-workbench :is(.message-error,.message-danger){border-color:#edc8c3;color:var(--ui-red);background:var(--ui-red-soft)}

/* Overlay contract */
.horizon-workbench :is(.project-settings-dialog,.product-create-dialog,.communication-dialog,.workspace-dialog,.confirm-dialog){padding:0;border:1px solid var(--ui-line);border-radius:var(--ui-overlay-radius);background:#fff;box-shadow:var(--ui-overlay-shadow)}
.horizon-workbench :is(.project-settings-dialog,.product-create-dialog,.communication-dialog,.workspace-dialog,.confirm-dialog)::backdrop{background:rgba(17,19,24,.46);backdrop-filter:none}
.horizon-workbench :is(.modal-heading,.workspace-dialog header){min-height:64px;padding:14px 20px;border-bottom:1px solid var(--ui-line);background:#fff}
.horizon-workbench :is(.modal-heading,.workspace-dialog header) h2{color:var(--ui-ink);font-size:17px;font-weight:700;letter-spacing:-.02em}
.horizon-workbench :is(.modal-heading,.workspace-dialog header) p{color:var(--ui-muted);font-size:11px}
.horizon-workbench :is(.modal-actions,.workspace-dialog footer){min-height:60px;padding:10px 20px;border-top:1px solid var(--ui-line);background:#fff}
.horizon-workbench :is(.settings-scroll,.communication-form-scroll,.product-create-scroll,.workspace-dialog-body){background:#fff}
.horizon-workbench .communication-modal-form .tiptap-editor{
  display:flex;
  min-height:306px;
  flex-direction:column;
  overflow:hidden;
}
.horizon-workbench .communication-modal-form .tiptap-controls{flex:0 0 auto}
.horizon-workbench .communication-modal-form .tiptap-surface{min-height:190px;flex:1 0 190px}
.horizon-workbench :is(.modal-close,.project-settings-dialog .modal-close){display:grid;width:40px;height:40px;place-items:center;border:1px solid var(--ui-line);border-radius:5px;color:#536174;background:#fff}
.horizon-workbench :is(.modal-close,.project-settings-dialog .modal-close):hover{color:var(--ui-ink);background:#f4f6f8}
.horizon-workbench .command-dialog::part(dialog){border:1px solid var(--ui-line);border-radius:var(--ui-overlay-radius);box-shadow:var(--ui-overlay-shadow)}
.horizon-workbench details.account-menu,
.horizon-workbench details.account-menu[open]{padding:0;border:0;border-radius:0;background:transparent}
.horizon-workbench details.account-menu[open]>summary{margin:0}
.horizon-workbench :is(.account-menu-panel,.attribute-multi-select-panel,.workspace-option-popover,.field-suggestions){border-color:var(--ui-line-strong);border-radius:7px;background:#fff;box-shadow:0 16px 40px rgba(18,31,47,.14)}
.horizon-workbench .account-menu-panel{width:252px;padding:8px}
.horizon-workbench .account-menu-panel :is(a,button){min-height:42px;border-radius:5px}

/* Confirmation overlay */
.horizon-workbench .confirm-dialog{width:min(440px,calc(100vw - 32px))}
.horizon-workbench .confirm-dialog-card{display:grid;grid-template-columns:42px minmax(0,1fr);gap:14px;padding:22px}
.horizon-workbench .confirm-dialog-icon{display:grid;width:42px;height:42px;place-items:center;border-radius:50%;color:var(--ui-red);background:var(--ui-red-soft);font-size:18px}
.horizon-workbench .confirm-dialog-copy h2{margin:2px 0 6px;font-size:18px}
.horizon-workbench .confirm-dialog-copy p:last-child{margin:0;color:var(--ui-muted);font-size:12px;line-height:1.5}
.horizon-workbench .confirm-dialog-actions{display:flex;grid-column:1/-1;gap:8px;justify-content:flex-end;margin-top:8px;padding-top:16px;border-top:1px solid var(--ui-line)}

/* Long editors keep a single scroll surface and stable footer. */
.horizon-workbench .product-create-form{background:#fff}
.horizon-workbench .product-form-section{border-color:var(--ui-line)}
.horizon-workbench :is(.attribute-form-group,.packaging-level,.advanced-product-section){border-color:var(--ui-line);border-radius:6px;box-shadow:none}
.horizon-workbench :is(.attribute-form-group summary,.packaging-level-heading,.advanced-product-section>summary){background:#fbfcfd}
.horizon-workbench .attribute-multi-select-trigger{min-height:42px;border-color:var(--ui-line-strong);border-radius:5px}
.horizon-workbench .attribute-multi-select.is-open .attribute-multi-select-trigger{border-color:var(--ui-forest);box-shadow:0 0 0 3px rgba(23,107,80,.10)}

@media(max-width:860px){
  .horizon-workbench .page-heading.compact-heading{min-height:auto;padding-block:22px}
  .horizon-workbench .form-card{padding:16px}
  .horizon-workbench .pagination{align-items:flex-start;flex-direction:column}
  .horizon-workbench .table-wrap{margin-inline:0}
  .horizon-workbench :is(.project-settings-dialog,.product-create-dialog,.communication-dialog,.workspace-dialog){width:100vw;max-width:none;height:100dvh;max-height:none;border:0;border-radius:0}
  .horizon-workbench :is(.modal-heading,.workspace-dialog header){min-height:60px;padding-inline:16px}
  .horizon-workbench :is(.modal-actions,.workspace-dialog footer){padding-inline:16px}
}

@media(max-width:560px){
  .horizon-workbench .page-heading.compact-heading h1{font-size:1.75rem}
  .horizon-workbench .section-heading{align-items:flex-start;flex-direction:column}
  .horizon-workbench .form-actions{align-items:stretch;flex-direction:column-reverse}
  .horizon-workbench .form-actions :is(.button,.secondary-button){justify-content:center;width:100%}
  .horizon-workbench .confirm-dialog-card{grid-template-columns:36px minmax(0,1fr);padding:18px}
  .horizon-workbench .confirm-dialog-icon{width:36px;height:36px}
}

@media(prefers-reduced-motion:reduce){
  .horizon-workbench *, .horizon-workbench *::before, .horizon-workbench *::after{scroll-behavior:auto!important;animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}
}

/* Round 2: one visible boundary per surface, never nested card-on-card. */
.horizon-workbench .page-heading:not(.dashboard-heading){
  min-height:108px;
  margin:0 0 18px;
  padding:22px 24px;
  border:1px solid var(--ui-line);
  border-radius:var(--ui-radius);
  background:#fff;
}
.horizon-workbench .dashboard-overview-surface{
  overflow:hidden;
  border:1px solid var(--ui-line);
  border-radius:var(--ui-radius);
  background:#fff;
}
.horizon-workbench .dashboard-overview-surface .dashboard-heading{margin:0;padding:24px;border:0;background:#fff}
.horizon-workbench .dashboard-overview-surface .metric-grid{margin:0;border-width:1px 0 0;border-radius:0}
.horizon-workbench .dashboard-summary-surface{gap:0;overflow:hidden;border:1px solid var(--ui-line);border-radius:var(--ui-radius);background:#fff}
.horizon-workbench .dashboard-summary-surface>.workspace-panel{border:0;border-radius:0;box-shadow:none}
.horizon-workbench .dashboard-summary-surface>.workspace-panel+ .workspace-panel{border-left:1px solid var(--ui-line)}

.horizon-workbench .project-context-surface{overflow:hidden;margin-bottom:16px;border:1px solid var(--ui-line);border-radius:var(--ui-radius);background:#fff}
.horizon-workbench .project-context-surface .project-hero{margin:0;padding:18px 20px;border:0;border-radius:0;background:#fff}
.horizon-workbench .project-context-surface .project-hero::after{display:none}
.horizon-workbench .project-context-surface .context-tabs{margin:0;padding:0 10px;border-width:1px 0 0;background:#fbfcfd}
.horizon-workbench .product-detail-pilot .product-detail-hero{padding:18px 20px;border:1px solid var(--ui-line);border-radius:var(--ui-radius);background:#fff}
.horizon-workbench .product-detail-pilot .product-detail-hero::after{display:none}
.horizon-workbench .project-dashboard-overview .overview-module>.project-narrative{border:0;border-radius:0;background:#fff;box-shadow:none}

.horizon-workbench .section-block:has(>.file-filter-bar)>.file-filter-bar{border-bottom:1px solid var(--ui-line);border-radius:0 0 var(--ui-radius) var(--ui-radius)}
.horizon-workbench .section-block:has(>.file-filter-bar)>.document-preview-grid{margin-top:14px;padding:0;border:0;border-radius:0;background:transparent}

/* Flat semantic labels: one shape, no Web Component host/part halo. */
.horizon-workbench :is(.status-pill,.product-status,.visibility-tag){
  width:max-content!important;
  min-width:0!important;
  max-width:100%!important;
  height:26px!important;
  min-height:26px!important;
  padding:0 9px!important;
  border:0!important;
  border-radius:5px!important;
  outline:0!important;
  box-shadow:none!important;
}
.horizon-workbench :is(.status-active,.status-completed,.product-status.status-active){color:var(--ui-forest-strong)!important;background:#dcece6!important}
.horizon-workbench :is(.status-on_hold,.status-on-hold){color:var(--ui-amber)!important;background:var(--ui-amber-soft)!important}
.horizon-workbench :is(.status-draft,.product-status.status-draft){color:var(--ui-blue)!important;background:var(--ui-blue-soft)!important}
.horizon-workbench :is(.status-archived,.status-archive,.status-cancelled,.status-canceled){color:#596577!important;background:#edf0f3!important}
.horizon-workbench .visibility-customer{color:var(--ui-forest-strong)!important;background:#dcece6!important}
.horizon-workbench .visibility-internal{color:var(--ui-amber)!important;background:var(--ui-amber-soft)!important}
.horizon-workbench .timeline-marker{border-radius:50%!important}
.horizon-workbench .communication-modal-form .visibility-selector label:has(input[value="internal"]:checked){border-color:#d7b979;background:var(--ui-amber-soft)}
.horizon-workbench .communication-modal-form .visibility-selector label:has(input[value="internal"]:checked) input{border-color:#b4792d;background:#fff}
.horizon-workbench .communication-modal-form .visibility-selector label:has(input[value="internal"]:checked) input::after{background:#b4792d}

/* Document naming and recycle preview. */
.horizon-workbench .source-filename{display:block;margin-top:3px;overflow:hidden;color:#87919f;font-size:9px;font-weight:450;text-overflow:ellipsis;white-space:nowrap}
.horizon-workbench .version-list li>span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.horizon-workbench .recycle-preview-link{color:var(--ui-forest);text-decoration:none}
.horizon-workbench .recycle-preview-link:hover{text-decoration:underline}
.horizon-workbench .document-rename-dialog{width:min(540px,calc(100vw - 32px));padding:0;border:1px solid var(--ui-line);border-radius:10px;background:#fff;box-shadow:var(--ui-overlay-shadow)}
.horizon-workbench .document-rename-dialog::backdrop{background:rgba(17,19,24,.46)}
.horizon-workbench .document-rename-form{display:grid}
.horizon-workbench .document-rename-body{display:grid;gap:18px;padding:20px 22px 22px}
.horizon-workbench .document-name-field,.horizon-workbench .document-access-field{display:grid;gap:7px}
.horizon-workbench .document-name-field>label,.horizon-workbench .document-field-label{color:var(--ui-copy);font-size:12px;font-weight:650}
.horizon-workbench .document-rename-body input[name="title"]{min-height:42px;padding:8px 11px;border:1px solid var(--ui-line-strong);border-radius:5px;font:inherit}
.horizon-workbench .document-name-field>small{color:var(--ui-muted);font-size:10px}
.horizon-workbench .document-rename-body .document-visibility-toggle{display:flex;min-height:76px;align-items:center;justify-content:space-between;gap:18px;padding:13px 14px;border:1px solid var(--ui-line);border-radius:7px;background:var(--ui-surface-soft);cursor:pointer;transition:border-color .15s ease,background .15s ease,box-shadow .15s ease}
.horizon-workbench .document-rename-body .document-visibility-toggle:hover{border-color:#9bbbae;background:#f7faf8}
.horizon-workbench .document-rename-body .document-visibility-toggle:has(input:checked){border-color:#79a995;background:var(--ui-forest-soft);box-shadow:inset 3px 0 var(--ui-forest)}
.horizon-workbench .document-visibility-copy{display:flex;min-width:0;align-items:flex-start;gap:10px}
.horizon-workbench .document-visibility-copy>span:last-child{display:grid;gap:3px}
.horizon-workbench .document-visibility-copy strong{color:var(--ui-ink);font-size:12px}
.horizon-workbench .document-visibility-copy small{max-width:310px;color:var(--ui-muted);font-size:10px;font-weight:450;line-height:1.45}
.horizon-workbench .document-visibility-icon{display:grid;width:32px;height:32px;flex:0 0 32px;place-items:center;border-radius:6px;color:var(--ui-forest);background:#e5efe9;font-size:14px}
.horizon-workbench .document-visibility-control{display:flex;flex:0 0 auto;align-items:center;gap:9px}
.horizon-workbench .document-visibility-state{min-width:42px;color:var(--ui-muted);font-size:10px;font-weight:700;text-align:right}
.horizon-workbench .document-visibility-state::before{content:"Internal"}
.horizon-workbench .document-visibility-toggle:has(input:checked) .document-visibility-state{color:var(--ui-forest)}
.horizon-workbench .document-visibility-toggle:has(input:checked) .document-visibility-state::before{content:"Visible"}
.horizon-workbench .document-visibility-control input{position:absolute!important;width:1px!important;height:1px!important;margin:0!important;opacity:0!important;pointer-events:none}
.horizon-workbench .document-switch-track{display:block;position:relative;width:38px;height:22px;flex:0 0 38px;border:1px solid #9eada6;border-radius:999px;background:#cfd7d3;transition:border-color .15s ease,background .15s ease}
.horizon-workbench .document-switch-track>span{display:block;position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(19,43,34,.25);transition:transform .15s ease}
.horizon-workbench .document-visibility-control input:checked+.document-switch-track{border-color:var(--ui-forest);background:var(--ui-forest)}
.horizon-workbench .document-visibility-control input:checked+.document-switch-track>span{transform:translateX(16px)}
.horizon-workbench .document-visibility-toggle:has(input:focus-visible){outline:2px solid var(--ui-forest);outline-offset:2px}

/* Round 3: measured spacing corrections from annotation review. */
.horizon-workbench .document-rename-form{
  width:100%;
  min-width:0;
}
.horizon-workbench .document-rename-form :is(.modal-heading,.document-rename-body,.modal-actions){
  width:100%;
  min-width:0;
  box-sizing:border-box;
}
.horizon-workbench .document-rename-body input[name="title"]{width:100%;min-width:0;box-sizing:border-box}
.horizon-workbench .drawing-meta .visibility-tag{justify-self:start;color:var(--ui-copy);font-size:10px}

@media(max-width:560px){
  .horizon-workbench .document-rename-body .document-visibility-toggle{align-items:flex-start;flex-direction:column;gap:12px}
  .horizon-workbench .document-visibility-control{width:100%;justify-content:flex-end}
}

@media(min-width:861px){
  .horizon-workbench .project-context-surface .context-tabs{
    display:grid;
    grid-auto-flow:column;
    grid-auto-columns:clamp(112px,10.5vw,148px);
    justify-content:start;
    gap:0;
  }
  .horizon-workbench .project-context-surface .context-tabs a{
    width:100%;
    min-width:0;
    box-sizing:border-box;
    text-align:center;
  }
}

.horizon-workbench .dashboard-overview-surface .metric-card{
  position:relative;
  border:0;
  box-shadow:none;
}
.horizon-workbench .dashboard-overview-surface .metric-card::after{display:none}
.horizon-workbench .dashboard-overview-surface .metric-card+.metric-card::before{
  content:"";
  position:absolute;
  top:24px;
  bottom:24px;
  left:0;
  width:1px;
  background:#e3e9e6;
}

/* Reflow contract: mobile is recomposed, not a shrunken desktop canvas. */
@media(max-width:860px){
  .horizon-workbench .page-shell{width:100%;max-width:100%;overflow-x:clip}
  .horizon-workbench .page-heading:not(.dashboard-heading){min-height:auto;padding:18px}
  .horizon-workbench .page-heading-actions{width:100%;flex-wrap:wrap}
  .horizon-workbench .dashboard-overview-surface .dashboard-heading{align-items:flex-start;gap:18px;padding:20px;flex-direction:column}
  .horizon-workbench .dashboard-overview-surface .page-heading-actions{display:grid;grid-template-columns:1fr 1fr}
  .horizon-workbench .dashboard-overview-surface .metric-grid{grid-template-columns:1fr 1fr}
  .horizon-workbench .dashboard-overview-surface .metric-card+.metric-card::before{top:18px;bottom:18px}
  .horizon-workbench .dashboard-overview-surface .metric-card:nth-child(odd)::before{display:none}
  .horizon-workbench .dashboard-summary-surface{grid-template-columns:1fr}
  .horizon-workbench .dashboard-summary-surface>.workspace-panel+ .workspace-panel{border-top:1px solid var(--ui-line);border-left:0}
  .horizon-workbench .project-context-surface .project-hero{grid-template-columns:64px minmax(0,1fr);gap:14px;padding:16px}
  .horizon-workbench .project-context-surface .project-hero-image{width:64px;height:64px}
  .horizon-workbench .project-context-surface .project-hero-copy h1{font-size:clamp(1.65rem,8vw,2.15rem);overflow-wrap:anywhere}
  .horizon-workbench .project-context-surface .project-hero-actions{grid-column:1/-1;align-items:center;justify-content:space-between;flex-direction:row}
  .horizon-workbench .project-context-surface .context-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));overflow:visible;padding:6px}
  .horizon-workbench .project-context-surface .context-tabs a{min-width:0;padding:9px 6px;border-radius:4px;text-align:center}
  .horizon-workbench .project-context-surface .context-tabs a.active{background:var(--ui-forest-soft)}
  .horizon-workbench .communication-titlebar{gap:14px}
  .horizon-workbench .communication-title-actions{display:grid;width:100%;grid-template-columns:minmax(0,1fr) auto}
  .horizon-workbench .communication-title-actions>.button{grid-column:1/-1;justify-content:center}
  .horizon-workbench .entry-heading>div:first-child{min-width:0}
  .horizon-workbench .entry-heading h3{overflow-wrap:anywhere}
}

@media(max-width:680px){
  .horizon-workbench .dashboard-overview-surface .page-heading-actions{grid-template-columns:1fr}
  .horizon-workbench .dashboard-overview-surface .metric-grid{grid-template-columns:1fr 1fr}
  .horizon-workbench .metric-card,.horizon-workbench .metric-card--lead{min-height:96px!important;padding:14px!important}
  .horizon-workbench .metric-card>div{padding-left:0}
  .horizon-workbench .metric-icon{display:none}
  .horizon-workbench .project-context-surface .context-tabs{grid-template-columns:repeat(2,minmax(0,1fr))}
  .horizon-workbench .communication-entry{grid-template-columns:32px minmax(0,1fr);gap:9px}
  .horizon-workbench .timeline-marker{width:32px!important;height:32px!important;border-width:2px!important}
  .horizon-workbench .entry-heading{gap:10px}
  .horizon-workbench .entry-actions{align-items:flex-end;flex-direction:column}
  .horizon-workbench .communication-entry-body{padding:13px!important}
  .horizon-workbench .recycle-list.list-surface .recycle-row{align-items:stretch;flex-direction:column;gap:10px}
  .horizon-workbench .recycle-row .action-bar{justify-content:flex-end}
  .horizon-workbench .table-wrap{overflow:visible!important}
  .horizon-workbench .table-wrap>table:not(.moos-ag-grid){display:block;width:100%;min-width:0!important}
  .horizon-workbench .table-wrap>table:not(.moos-ag-grid)>thead{display:none}
  .horizon-workbench .table-wrap>table:not(.moos-ag-grid)>tbody{display:grid;gap:9px;padding:10px}
  .horizon-workbench .table-wrap>table:not(.moos-ag-grid)>tbody>tr{display:grid;min-width:0;grid-template-columns:48px minmax(0,1fr) auto;gap:4px 10px;padding:10px;border:1px solid var(--ui-line);border-radius:6px;background:#fff}
  .horizon-workbench .table-wrap>table:not(.moos-ag-grid)>tbody>tr>td{display:none!important;width:auto;height:auto;padding:0;border:0}
  .horizon-workbench .table-wrap>table:not(.moos-ag-grid)>tbody>tr>td:first-child{display:flex!important;grid-row:1/3;align-items:flex-start}
  .horizon-workbench .table-wrap>table:not(.moos-ag-grid)>tbody>tr>td:nth-child(2),
  .horizon-workbench .table-wrap>table:not(.moos-ag-grid)>tbody>tr>td:nth-child(3),
  .horizon-workbench .table-wrap>table:not(.moos-ag-grid)>tbody>tr>td:has(.status-pill,.product-status),
  .horizon-workbench .table-wrap>table:not(.moos-ag-grid)>tbody>tr>td:last-child{display:flex!important;min-width:0;align-items:center}
  .horizon-workbench .table-wrap>table:not(.moos-ag-grid)>tbody>tr>td:nth-child(2),
  .horizon-workbench .table-wrap>table:not(.moos-ag-grid)>tbody>tr>td:nth-child(3){grid-column:2}
  .horizon-workbench .table-wrap>table:not(.moos-ag-grid)>tbody>tr>td:has(.status-pill,.product-status){grid-column:2}
  .horizon-workbench .table-wrap>table:not(.moos-ag-grid)>tbody>tr>td:last-child{grid-column:3;grid-row:1/3}
  .horizon-workbench .supplier-development-table tbody>tr{grid-template-columns:minmax(0,1fr) auto!important}
  .horizon-workbench .supplier-development-table tbody>tr>td:first-child{grid-row:auto!important}
  .horizon-workbench .supplier-development-table tbody>tr>td:nth-child(2){grid-column:1!important}
  .horizon-workbench .supplier-development-table tbody>tr>td:last-child{grid-column:2!important;grid-row:1/3!important}
  .horizon-workbench .project-dashboard-overview .rich-content table{display:table;width:100%;table-layout:fixed;overflow:visible}
  .horizon-workbench .project-dashboard-overview .rich-content :is(th,td){overflow-wrap:anywhere}
}

/* Final compact-card disclosure override: must follow legacy list rules. */
.horizon-workbench .document-card.document-card--compact:has(wa-details.moos-details[open]) .document-card-body{
  overflow:visible!important;
  grid-template-rows:80px 34px 62px minmax(32px,max-content);
}
.horizon-workbench .document-card.document-card--compact wa-details.moos-details[open] .version-list{
  display:grid!important;
  gap:6px!important;
  max-height:none!important;
  margin:0!important;
  padding:0!important;
  overflow:visible!important;
}
.horizon-workbench .document-card.document-card--compact wa-details.moos-details[open] .version-list li{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) 28px;
  gap:6px!important;
  min-width:0;
  align-items:start!important;
}
.horizon-workbench .document-card.document-card--compact wa-details.moos-details[open] .version-list li>span{
  min-width:0!important;
  overflow:visible!important;
  overflow-wrap:anywhere;
  text-overflow:clip!important;
  white-space:normal!important;
}
.horizon-workbench .document-card.document-card--compact wa-details.moos-details[open] .version-list form{width:28px;margin:0!important}
.horizon-workbench .document-card.document-card--compact wa-details.moos-details[open] .version-list .icon-button-small{width:28px!important;min-width:28px!important;height:28px!important}
