/* Shared presentation follows the existing Materials/AOSR compact scale.
   Registry column widths, preview panes and business-specific layouts stay local. */
#appShell .view > .hero {
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  min-width: 0;
}

#appShell .view > .hero h1 {
  margin: 0 0 4px;
  font-size: 24px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

#appShell .view > .hero p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

#appShell .view > .hero .hero-chip {
  max-width: 100%;
  padding: 8px 12px;
  font-size: 12px;
  white-space: normal;
  overflow-wrap: anywhere;
}

#appShell .view > .panel:not(.chat-panel),
#appShell #projectDocsRegistryHost > .panel {
  min-width: 0;
  padding: 16px;
  margin-bottom: 12px;
}

#appShell .view .panel-header {
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
  min-width: 0;
}

#appShell .view .panel-header h2 { font-size: 18px; }
#appShell .view .panel-subtitle { font-size: 13px; line-height: 1.45; }

#documentRegistryPanel .working-docs-toolbar { display: grid; grid-template-columns: minmax(0, 1fr); padding: 0; }
#documentRegistryPanel .working-docs-actions { min-width: 0; justify-content: flex-start; }
#documentRegistryPanel .working-docs-actions > * { max-width: 100%; overflow-wrap: anywhere; }
#documentRegistryPanel .working-docs-actions .action-menu-panel {
  left: 0;
  right: auto;
  min-width: min(220px, calc(100vw - 64px));
  max-width: min(320px, calc(100vw - 64px));
}
#documentRegistryPanel .working-docs-empty { text-align: left; vertical-align: top; padding: 24px 12px; }
#documentRegistryPanel .working-docs-empty :is(strong, span) { max-width: min(280px, calc(100vw - 100px)); }
#documentRegistryPanel .working-docs-spec-table { border-radius: 12px; }
#documentRegistryPanel .working-docs-spec-table table.registry-table { border-collapse: separate; border-spacing: 0; font-size: 13px; }

#appShell .view .panel-header :is(button, .button-link, summary.ghost) {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.4;
}

.page-utilities {
  position: relative;
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 12px;
}

/* Keep help and feedback in their own row instead of covering long titles. */
#appShell .content .page-utilities > :is(.view-help, .view-feedback) {
  position: relative;
  inset: auto;
  margin: 0;
  min-height: 32px;
  height: 32px;
  font-size: 12px;
}

.page-utilities .view-help-text { right: 0; width: min(360px, calc(100vw - 48px)); }

#extractorAgentPanel .materials-agent-header { flex-wrap: wrap; }

@media (max-width: 1100px) {
  /* The old stacked 100vh sidebars were clipped by the 100vh shell. */
  #appShell {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    max-height: 100vh;
    max-height: 100dvh;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 56px minmax(0, 1fr);
  }

  #appShell > .panel-restore-stack {
    display: flex;
    position: relative;
    grid-column: 1;
    grid-row: 1;
    z-index: 4;
    width: 100%;
    height: 56px;
    padding: 8px 12px;
    gap: 8px;
    border: 0;
    border-bottom: 1px solid var(--border);
    overflow: visible;
  }

  #appShell .panel-restore-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    min-height: 40px;
    height: 40px;
    max-height: 40px;
    padding: 6px 10px;
    writing-mode: horizontal-tb;
    white-space: nowrap;
    box-shadow: none;
  }

  #appShell .panel-restore-btn[aria-expanded="true"] {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border-color: var(--accent);
  }

  #appShell > :is(.workspace-panel, .sidebar, .content) {
    grid-column: 1;
    grid-row: 2;
    position: relative;
    top: auto;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  #appShell > :is(.workspace-panel, .sidebar) { z-index: 8; display: none; }
  #appShell.narrow-workspace-open > .workspace-panel,
  #appShell.narrow-tools-open > .sidebar { display: flex; }
  #appShell > .content { padding: 16px; overflow-x: hidden; visibility: visible; }
  #appShell:is(.narrow-workspace-open, .narrow-tools-open) > .content { visibility: hidden; }
  #appShell .workspace-header { padding-right: 44px; }
  #appShell .workspace-collapse-btn { top: 0; }
  #appShell .tools-panel-header { padding-right: 48px; }
  #appShell .view > .hero { align-items: stretch; }
  #appShell .view > .panel:not(.chat-panel),
  #appShell #projectDocsRegistryHost > .panel { padding: 14px; }
  #appShell .view .panel-header :is(button, .button-link, summary.ghost) { min-height: 40px; }
  #documentRegistryPanel > .materials-action-status { margin: 8px 0 10px; font-size: 13px; }
  #documentRegistryPanel .working-docs-ai { margin: 0 0 10px; }
  #documentRegistryPanel .working-docs-ai > summary { padding: 8px 10px; font-size: 13px; }
  #documentRegistryPanel .working-docs-ai > summary small { display: none; }
}

@media (max-width: 1180px) {
  #documentRegistryPanel .working-docs-workspace.with-inspector .working-docs-registry-wrap { width: 100%; }
  #documentRegistryPanel .working-docs-inspector { width: 100%; }
}
