/* Shared workspace geometry. Page-specific sheets retain their own content layouts. */
#appView .topbar { min-height: 64px; padding: 8px 22px; }
#appView .topbar h2 { font-size: 19px; }
#appView .topbar p { font-size: 10px; }
#appView .topbar-actions { gap: 8px; }
#appView .sidebar-brand-copy strong { white-space: nowrap; }
#appView .page-container { padding: 16px 22px 24px; scrollbar-gutter: stable; }
#appView .page-toolbar, #appView .dashboard-heading { min-height: 42px; margin-bottom: 12px; padding-bottom: 9px; gap: 10px; }
#appView .page-toolbar h3, #appView .dashboard-heading h3 { font-size: 21px; line-height: 1.3; }
#appView .page-toolbar .toolbar-controls { flex: 0 1 auto; gap: 7px; min-width: 0; flex-wrap: wrap; }
#appView .page-toolbar > div:first-child { min-width: 0; }
#appView .page-toolbar .button, #appView .page-toolbar input, #appView .page-toolbar select { min-height: 36px; }
#appView .page-toolbar .button { padding: 7px 11px; }
#appView .page-toolbar .toolbar-icon-button { width: 36px; height: 36px; }
#appView .page-toolbar.layout-title-repeated > div:first-child > h3 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#appView .page-toolbar.layout-title-repeated > div:first-child > p { font-size: 12px; }
#appView .section-heading, #appView .panel-heading, #appView .dashboard-panel-heading { padding-bottom: 10px; }
#appView .page :is(.table-surface, .table-scroll) { min-width: 0; max-width: 100%; }
#appView .page .table-scroll { overflow: auto; scrollbar-gutter: stable; scrollbar-color: var(--muted) var(--surface-soft); }
#appView .page .table-scroll::-webkit-scrollbar { width: 9px; height: 9px; }
#appView .page .table-scroll::-webkit-scrollbar-track { background: var(--surface-soft); }
#appView .page .table-scroll::-webkit-scrollbar-thumb { border: 2px solid var(--surface-soft); border-radius: 8px; background: var(--muted); }
#appView .page .table-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
#appView .page .layout-record-table { max-height: var(--layout-table-height, 480px); scroll-padding-top: 48px; }
#appView .layout-record-table table { border-collapse: separate; border-spacing: 0; }
#appView .layout-record-table th { position: sticky; top: 0; z-index: 4; background: var(--surface-solid); }
#appView .layout-record-table :is(th, td) { padding: 11px 13px; }
#appView .layout-record-table :is(th, td):first-child { position: sticky; left: 0; z-index: 2; background: var(--surface-solid); border-right: 1px solid var(--line); }
#appView .layout-record-table th:first-child { z-index: 6; }
#appView .layout-record-table :is(th, td).actions-column { position: sticky; right: 0; z-index: 3; background: var(--surface-solid); border-left: 1px solid var(--line); white-space: nowrap; }
#appView .layout-record-table td.actions-column { display: table-cell; vertical-align: middle; }
#appView .layout-record-table th.actions-column { z-index: 6; }
@media (min-width: 621px) {
  #appView .layout-record-table td.actions-column > .table-action + .table-action { margin-left: 4px; }
}
#appView .layout-record-table tbody tr:hover td { background: var(--surface-soft); }
#appView .layout-record-table td :is(code, .mono) { font-variant-numeric: tabular-nums; }
#appView .layout-record-table .table-empty { white-space: normal; }
/* V3.3.67: optional ladder chrome, independent of editing and PLC section state. */
#appView #page-cnc-ladder.layout-ladder-topbar-collapsed[data-cnc-ladder-active-section="editor"] > .cnc-ladder-section-tabs,
#appView #page-cnc-ladder.layout-ladder-topbar-collapsed[data-cnc-ladder-active-section="editor"] > .cnc-ladder-commandbar { display: none; }
#appView #page-cnc-ladder .cnc-ladder-projectbar { grid-template-columns: minmax(0, 1fr) auto auto; }
#appView #page-cnc-ladder .layout-ladder-topbar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 30px;
  padding: 3px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--muted);
  background: var(--surface);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  cursor: pointer;
}
#appView #page-cnc-ladder .layout-ladder-topbar-toggle[hidden] { display: none; }
#appView #page-cnc-ladder .layout-ladder-topbar-toggle:hover { color: var(--ink); background: var(--surface-soft); }
#appView #page-cnc-ladder .layout-ladder-topbar-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#appView #page-cnc-ladder .layout-ladder-topbar-toggle svg { width: 14px; height: 14px; flex: 0 0 14px; transform: rotate(180deg); }
#appView #page-cnc-ladder .layout-ladder-topbar-toggle[aria-expanded="false"] svg { transform: none; }
@media (max-width: 620px) {
  #appView #page-cnc-ladder .cnc-ladder-projectbar { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 6px; padding: 5px 7px; }
  #appView #page-cnc-ladder .cnc-ladder-project-identity { grid-column: 1 / -1; }
  #appView #page-cnc-ladder .cnc-ladder-project-details { grid-column: 1; justify-self: start; }
  #appView #page-cnc-ladder .cnc-ladder-project-details > summary,
  #appView #page-cnc-ladder .layout-ladder-topbar-toggle { min-height: 44px; }
  #appView #page-cnc-ladder .layout-ladder-topbar-toggle { grid-column: 2; }
}
body > .dialog-backdrop { padding: 16px; }
body > .dialog-backdrop > .dialog { max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); scroll-padding: 88px 0 86px; overscroll-behavior: contain; }
body > .dialog-backdrop > .dialog > .dialog-header,
body > .dialog-overlay > .dialog-card > .dialog-header { position: sticky; top: 0; z-index: 8; padding: 14px 18px; background: var(--surface-solid); }
body > .dialog-backdrop > .dialog > .dialog-actions,
body > .dialog-overlay > .dialog-card > .dialog-actions { position: sticky; bottom: 0; z-index: 8; padding: 12px 18px; background: var(--surface-solid); }
body > .dialog-backdrop > .dialog :is(input, select, textarea, button) { scroll-margin-top: 88px; scroll-margin-bottom: 86px; }
body > .dialog-backdrop > .dialog > .dialog-header h3 { overflow-wrap: anywhere; }
body > .dialog-backdrop > .dialog > .dialog-header .dialog-close { flex: 0 0 36px; min-width: 36px; min-height: 36px; }
@media (max-width: 1100px) {
  #appView .topbar { padding-inline: 16px; }
  #appView .page-container { padding: 14px 16px 20px; }
  #appView .page-toolbar { align-items: center; }
}
@media (min-width: 901px) and (max-width: 1180px) {
  #appView:not(.sidebar-collapsed) .sidebar-brand { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 8px 10px; }
  #appView:not(.sidebar-collapsed) .sidebar-brand img { width: 40px; height: 40px; }
  #appView:not(.sidebar-collapsed) .sidebar-brand .sidebar-language-switcher { grid-column: 1 / -1; justify-self: end; }
}
@media (min-width: 681px) and (max-width: 900px) {
  #appView .sidebar { grid-template-columns: minmax(0, 1fr) 150px; }
  #appView .sidebar-brand { display: none; }
  #appView .main-nav { justify-content: flex-start; overflow-x: auto; overflow-y: hidden; }
  #appView .main-nav > :is(.nav-button, .nav-group) { flex: 0 0 auto; }
  #appView .topbar-language-switcher { display: inline-flex; }
  #appView .mobile-subnav-host { position: fixed; inset: 72px 0 0; z-index: 40; display: block; pointer-events: none; }
  #appView .mobile-subnav-host:empty { display: none; }
  #appView .mobile-subnav-host .nav-subnav { top: 8px; right: auto; left: var(--mobile-subnav-left, 12px); width: min(196px, calc(100vw - 24px)); max-height: calc(100dvh - 92px); margin: 0; padding: 6px; transform: none; pointer-events: auto; }
}
#appView .mobile-subnav-host .nav-subnav { background: var(--surface-solid); color: var(--ink); border-color: var(--line); }
@media (max-width: 680px) {
  #appView .topbar { min-height: 58px; padding: 8px 12px; }
  #appView .topbar h2 { font-size: 17px; }
  #appView .page-container { padding: 12px 10px 20px; scrollbar-gutter: auto; }
  #appView .page-toolbar, #appView .dashboard-heading { gap: 9px; }
  #appView .page-toolbar h3, #appView .dashboard-heading h3 { font-size: 19px; }
  #appView .page-toolbar .toolbar-controls { width: 100%; justify-content: flex-start; }
  #appView .page-toolbar :is(.button, input, select) { min-height: 42px; }
  #appView .page .layout-record-table { max-height: min(560px, 70vh); }
  #appView .layout-record-table :is(th, td) { padding: 10px; }
  #appView .layout-record-table :is(th, td):first-child { position: static; }
  #appView .layout-record-table .actions-column { min-width: 66px; }
  body > .dialog-backdrop { padding: 8px; }
  body > .dialog-backdrop > .dialog { max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); max-width: 100%; }
  body > .dialog-backdrop > .dialog > :is(.dialog-header, .dialog-actions) { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  #appView .page, #appView .surface, body > .dialog-backdrop, body > .dialog-backdrop > .dialog { animation: none !important; transition: none !important; }
}
