/* Compact module identity and underline tabs. Opt-in; homepage is excluded. */
.altheia-layout-compact .hero,
.altheia-layout-compact .hero.hero-simple,
.altheia-layout-compact .catalog-intro{
  border:0!important;border-radius:0!important;background:transparent!important;
  box-shadow:none!important;padding:0!important;margin-bottom:24px!important;
}
.altheia-layout-compact .hero h1{margin-bottom:0!important}
.altheia-layout-compact .hero .eyebrow{margin-top:0;margin-bottom:9px}
.altheia-layout-compact .tab-list-shell{
  border:0!important;border-radius:0!important;background:transparent!important;
  box-shadow:none!important;padding:0!important;
}
.altheia-layout-compact :is(.tab-list,.workspace-nav,.view-tabs,.local-nav,.tabs):has(>button){
  display:flex!important;grid-template-columns:none!important;align-items:stretch;
  gap:24px!important;min-width:0;max-width:100%;overflow-x:auto;overflow-y:hidden;
  border:0!important;border-bottom:1px solid var(--line,#e3e7ef)!important;
  border-radius:0!important;background:transparent!important;box-shadow:none!important;
  padding:0!important;
}
.altheia-layout-compact :is(.tab-list,.workspace-nav,.view-tabs,.local-nav,.tabs)>button{
  position:relative;flex:0 0 auto!important;width:auto!important;min-height:44px;
  margin:0!important;padding:12px 0!important;
  border:0!important;border-bottom:3px solid transparent!important;border-radius:0!important;
  background:transparent!important;box-shadow:none!important;
  color:var(--muted,#68758b)!important;font:inherit;font-size:13px;font-weight:800;
  white-space:nowrap;text-align:left;cursor:pointer;
}
.altheia-layout-compact :is(.tab-list,.workspace-nav,.view-tabs,.local-nav,.tabs)>button:is(.active,.is-active,[aria-selected="true"]){
  border-bottom-color:var(--primary,#6657f5)!important;color:var(--primary,#6657f5)!important;
}
.altheia-layout-compact :is(.tab-list,.workspace-nav,.view-tabs,.local-nav,.tabs)>button::after{display:none!important}
.altheia-layout-compact :is(.tab-list,.workspace-nav,.view-tabs,.local-nav,.tabs)>button:hover:not(:disabled){color:var(--primary,#6657f5)!important}
.altheia-layout-compact :is(.tab-list,.workspace-nav,.view-tabs,.local-nav,.tabs)>button:focus-visible{outline:3px solid var(--focus,rgba(102,87,245,.18));outline-offset:-3px}
.altheia-layout-compact :is(.tab-list,.workspace-nav,.view-tabs,.local-nav,.tabs)>button:disabled{opacity:.48;cursor:not-allowed}
@media(max-width:620px){
  .altheia-layout-compact :is(.tab-list,.workspace-nav,.view-tabs,.local-nav,.tabs):has(>button){gap:20px!important}
  .altheia-layout-compact .hero,.altheia-layout-compact .hero.hero-simple{margin-bottom:20px!important}
}

.altheia-layout-compact .compact-goto-top{position:fixed;right:22px;bottom:22px;z-index:100;width:48px;height:48px;border:0;border-radius:15px;background:var(--primary,#6657f5);color:var(--on-primary,#fff);font-size:22px;cursor:pointer;opacity:0;pointer-events:none;transition:opacity .2s}
.altheia-layout-compact .compact-goto-top.visible{opacity:1;pointer-events:auto}
.altheia-layout-compact .compact-goto-top:focus-visible{outline:3px solid var(--focus,rgba(102,87,245,.18));outline-offset:3px}

/* Let tab strips scroll inside their grid cell instead of widening the page. */
.altheia-layout-compact :is(.card,.panel,.section,.flow-shell):has(.tab-list),
.altheia-layout-compact .tabs:has(.tab-list){min-width:0}

/* Workspace tabs are siblings of the content card, never inside its surface. */
.altheia-layout-compact .module-workspace{min-width:0}
.altheia-layout-compact .module-workspace > :is(.tab-list-shell,.tab-list){margin-bottom:24px}
.altheia-first-click-page{display:flex;flex-direction:column;min-height:100vh}
.altheia-first-click-page > .app{flex:1;width:100%}
.altheia-first-click-page > .footer{flex-shrink:0}

/* Top-level module actions: no card; contextual toolboxes remain unchanged. */
.altheia-layout-compact .toolbox[data-module-toolbar]{
  border:0!important;border-radius:0!important;background:transparent!important;
  box-shadow:none!important;padding:0!important;
}
.altheia-layout-compact .toolbox[data-module-toolbar] > .muted,
.altheia-layout-compact .toolbox[data-module-toolbar] > .toolbox-status:not(#saveState),
.altheia-layout-compact .toolbox[data-module-toolbar] > .toolbox-meta > .save-info{
  color:var(--ink,#172033)!important;min-width:0;overflow-wrap:anywhere;
}
.altheia-layout-compact .toolbox[data-module-toolbar] > .toolbox-meta{width:auto;max-width:100%;padding-top:0}

/* Contextual action menu: use when a visible toolbar would overwhelm local content. */
.action-menu{position:relative;display:flex;justify-content:flex-end;z-index:30}
.action-menu .action-menu-trigger{display:inline-flex!important;width:auto!important;min-width:0;align-items:center;justify-content:center;gap:9px;margin:0!important;border:1px solid var(--line,#e3e7ef);background:var(--surface-soft,#fcfdff);color:var(--ink,#172033);box-shadow:none;white-space:nowrap}
.action-menu-chevron{display:inline-grid;width:18px;height:18px;place-items:center;transition:transform .2s ease}
.action-menu-trigger[aria-expanded="true"] .action-menu-chevron{transform:rotate(180deg)}
.action-menu-panel{position:absolute;top:calc(100% + 8px);right:0;display:grid;grid-template-columns:repeat(2,minmax(210px,1fr));gap:8px;width:min(520px,calc(100vw - 56px));padding:12px;border:1px solid var(--line,#e3e7ef);border-radius:14px;background:var(--paper,#fff);box-shadow:var(--shadow,0 14px 34px rgba(22,30,55,.09))}
.action-menu-panel[hidden]{display:none!important}
.action-menu-panel .action-menu-item{width:100%!important;min-width:0;margin:0!important;border:1px solid var(--line,#e3e7ef);background:var(--surface-soft,#fcfdff);color:var(--ink,#172033);text-align:left;box-shadow:none}
.action-menu .action-menu-trigger,.action-menu-panel .action-menu-item{transition:background-color .16s ease,border-color .16s ease,color .16s ease,box-shadow .16s ease,transform .16s ease}
.action-menu .action-menu-trigger:hover:not(:disabled),.action-menu-panel .action-menu-item:hover:not(:disabled){border-color:var(--primary,#6657f5);background:var(--surface-hover,#f7f5ff);color:var(--primary-strong,#5644db);box-shadow:0 6px 16px rgba(102,87,245,.12);transform:none}
.action-menu .action-menu-trigger:active:not(:disabled),.action-menu-panel .action-menu-item:active:not(:disabled){border-color:var(--primary,#6657f5);background:var(--surface-muted,#f5f3ff);color:var(--primary-strong,#5644db);box-shadow:none;transform:translateY(1px)}
.action-menu .action-menu-trigger[aria-expanded="true"]{border-color:var(--primary,#6657f5);background:var(--surface-muted,#f5f3ff);color:var(--primary-strong,#5644db)}
.action-menu .action-menu-trigger:focus-visible,.action-menu-panel .action-menu-item:focus-visible{outline:3px solid var(--focus,rgba(102,87,245,.18));outline-offset:2px}
.action-menu .action-menu-trigger:disabled,.action-menu-panel .action-menu-item:disabled{border-color:var(--line,#e3e7ef);background:var(--surface-disabled,#f8f9fc);color:var(--muted,#68758b);box-shadow:none;cursor:not-allowed;opacity:.48;transform:none}
@media(max-width:620px){
  .action-menu-panel{grid-template-columns:1fr;width:min(330px,calc(100vw - 32px))}
}
@media(prefers-reduced-motion:reduce){.action-menu-chevron,.action-menu .action-menu-trigger,.action-menu-panel .action-menu-item{transition:none}}
