/* In2Com v87j | Shared admin layout. Loaded after page styles.
   Keeps existing colours and business workflows intact. */
:root { --in2c-workspace-max: 1480px; --in2c-workspace-gutter: 24px; }
html { -webkit-text-size-adjust: 100%; }
body[data-in2com-layout="v87j"] { overflow-x: clip; }
/* One workspace across all administrative pages; beat earlier narrow !important rules */
html body[data-in2com-layout="v87j"] > main,
html body[data-in2com-layout="v87j"] > main.settings-shell {
  box-sizing: border-box !important;
  width: calc(100% - 2 * var(--in2c-workspace-gutter)) !important;
  max-width: var(--in2c-workspace-max) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  min-width: 0;
}
html body[data-in2com-layout="v87j"] > main > * { min-width: 0; }
/* Internal tables must scroll rather than making the full page wider. */
body[data-in2com-layout="v87j"] :is(.table-wrap, .table-wrapper, .directory-table-wrap, .registered-users-table-wrap, .agreement-table-wrap) {
  max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
}
body[data-in2com-layout="v87j"] :is(.stats, .stat-grid, .stats-grid, .summary-grid, .kpi-grid) {
  min-width: 0;
}
body[data-in2com-layout="v87j"] :is(input, select, textarea) { max-width: 100%; }
body[data-in2com-layout="v87j"] :is(button, a, input, select, textarea):focus-visible { outline: 3px solid #3a9ed8; outline-offset: 2px; }
/* Shared navigation: preserve every tab; scroll horizontally on touch devices. */
body[data-in2com-layout="v87j"] #account-nav {
  max-width: 100%; min-width: 0;
  overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}
body[data-in2com-layout="v87j"] #account-nav :is(a, button) { white-space: nowrap; }
/* Modal surfaces remain within the visible iPad viewport. */
body[data-in2com-layout="v87j"] dialog {
  box-sizing: border-box; max-width: min(94vw, 900px);
  max-height: calc(100dvh - 32px); overflow: auto;
}
@media (hover: none), (pointer: coarse) {
  body[data-in2com-layout="v87j"] #account-nav :is(a, button) { min-height: 44px; display: inline-flex; align-items: center; }
  body[data-in2com-layout="v87j"] :is(.customer-tabs, .order-category-tabs) button { min-height: 44px; }
  body[data-in2com-layout="v87j"] :is(button, a) { touch-action: manipulation; }
}
@media (max-width: 1100px) {
  :root { --in2c-workspace-gutter: 20px; }
  body[data-in2com-layout="v87j"] :is(.stats, .stat-grid, .stats-grid, .summary-grid, .kpi-grid) {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  body[data-in2com-layout="v87j"] :is(.workspace-nav, .customer-tabs, .order-category-tabs) {
    max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
  }
  body[data-in2com-layout="v87j"] .registered-users-layout { min-width: 0; }
}
@media (max-width: 700px) {
  :root { --in2c-workspace-gutter: 12px; }
  html body[data-in2com-layout="v87j"] > main { padding-left: 0 !important; padding-right: 0 !important; }
  body[data-in2com-layout="v87j"] :is(.stats, .stat-grid, .stats-grid, .summary-grid, .kpi-grid) {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important;
  }
  body[data-in2com-layout="v87j"] :is(.editor-grid, .address-grid, .fields) {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  body[data-in2com-layout="v87j"] :is(.panel, .workspace-card) { min-width: 0; }
  body[data-in2com-layout="v87j"] :is(.table-wrap, .table-wrapper) table { min-width: 600px; }
  body[data-in2com-layout="v87j"] dialog { max-width: calc(100vw - 20px); max-height: calc(100dvh - 20px); }
}
@media (max-width: 420px) {
  body[data-in2com-layout="v87j"] :is(.stats, .stat-grid, .stats-grid, .summary-grid, .kpi-grid) {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}


/* v87j2: Customers uses the same responsive workspace as other admin pages */
html body[data-in2com-layout="v87j"]:has(#customer-list) > main {
    box-sizing: border-box !important;
    width: calc(100% - 48px) !important;
    max-width: 1480px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

@media (max-width: 700px) {
    html body[data-in2com-layout="v87j"]:has(#customer-list) > main {
        width: calc(100% - 24px) !important;
    }
}
