/* AMIIN Core 14.22 — integrated HAGENCIA & Halama layout fixes.
 * Intentional scope: Core-owned service routes and explicitly embedded Halama
 * catalog. Never styling Halal Work, the site theme, or third-party services.
 * Engine JS, tables, dialogs, and permissions remain under their own control.
 */
body.awc-standalone-document #amiin-core-preview.awc-native-tool-route .awc-native-tool-surface,
body.awc-standalone-document #amiin-core-preview.awc-native-tool-route .awc-native-tool-surface > *,
:is(.awc-halama-unified, .halama-single, .halama-archive) {
  box-sizing: border-box;
  min-inline-size: 0;
  max-inline-size: 100%;
}
/* An embedded HAGENCIA may request a full-bleed app layout. Inside Core it
 * must fit the allocated column rather than expanding to the viewport. */
body.awc-standalone-document #amiin-core-preview.awc-native-tool-route .awc-native-tool-surface .hagencia-root,
body.awc-standalone-document #amiin-core-preview.awc-native-tool-route .awc-native-tool-surface .hagencia-root.hag-is-embedded,
body.awc-standalone-document #amiin-core-preview.awc-native-tool-route .awc-native-tool-surface .hag-wrap,
body.awc-standalone-document #amiin-core-preview.awc-native-tool-route .awc-native-tool-surface .hag-shell,
body.awc-standalone-document #amiin-core-preview.awc-native-tool-route .awc-native-tool-surface .hag-main {
  box-sizing: border-box;
  min-inline-size: 0;
  max-inline-size: 100% !important;
}
body.awc-standalone-document #amiin-core-preview.awc-native-tool-route .awc-native-tool-surface .hagencia-root.hag-is-embedded {
  min-block-size: 0;
}
/* Auto-fitting tracks respond to the *actual width of Core's column* instead
 * of the browser viewport; min(100%,...) also supports very narrow embeds.
 * These selectors deliberately win against legacy hag-cq and app-mode grids. */
body.awc-standalone-document #amiin-core-preview.awc-native-tool-route .hagencia-root :is(.hag-grid, .hag-row, .hag-detail-grid) {
  min-inline-size: 0;
  max-inline-size: 100%;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 350px), 1fr)) !important;
}
body.awc-standalone-document #amiin-core-preview.awc-native-tool-route .hagencia-root :is(.hag-cards, .hag-results, .hag-cards-top, .hag-detail-sidecards) {
  min-inline-size: 0;
  max-inline-size: 100%;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 245px), 1fr)) !important;
}
body.awc-standalone-document #amiin-core-preview.awc-native-tool-route .hagencia-root :is(.hag-entity, .hag-card, .hag-searchbar, .hag-listbar, .hag-tabs-nav, .hag-detail-main, .hag-detail-grid, .hag-detail-sidecards, .hag-field) {
  min-inline-size: 0;
  max-inline-size: 100%;
}
body.awc-standalone-document #amiin-core-preview.awc-native-tool-route .hagencia-root :is(.hag-tabs, .hag-gallery-thumbs) {
  min-inline-size: 0;
  max-inline-size: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}
body.awc-standalone-document #amiin-core-preview.awc-native-tool-route .hagencia-root :is(input, select, textarea, .hag-search, .hag-jump, .hag-more-menu) {
  box-sizing: border-box;
  min-inline-size: 0;
  max-inline-size: 100%;
}
body.awc-standalone-document #amiin-core-preview.awc-native-tool-route .hagencia-root :is(.e-name, .e-loc, .hag-excerpt, .hag-detail-copy) {
  overflow-wrap: anywhere;
}
/* Marketplace filters were seven columns even when the embedded panel was too
 * narrow. Use flexible, legible tracks and border-box controls. */
body.awc-standalone-document #amiin-core-preview.awc-native-tool-route .awc-halama-unified,
:is(.awc-halama-unified, .halama-single, .halama-archive) :is(.halama-catalog, .halama-single, .halama-wrap, .halama-cols, .halama-results, .halama-grid) {
  min-inline-size: 0;
  max-inline-size: 100%;
  box-sizing: border-box;
}
body.awc-standalone-document #amiin-core-preview.awc-native-tool-route .awc-halama-unified .halama-filters,
:is(.awc-halama-unified, .halama-archive) .halama-filters {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)) !important;
  min-inline-size: 0;
  max-inline-size: 100%;
}
body.awc-standalone-document #amiin-core-preview.awc-native-tool-route .awc-halama-unified .halama-grid,
:is(.awc-halama-unified, .halama-archive) .halama-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)) !important;
}
:is(.awc-halama-unified, .halama-single, .halama-archive) :is(.halama-field, .halama-field-split, .halama-brand-field, .halama-card, .halama-body, .halama-cols > *, .halama-kpi, .halama-meta-box) {
  min-inline-size: 0;
  max-inline-size: 100%;
  box-sizing: border-box;
}
:is(.awc-halama-unified, .halama-single, .halama-archive) :is(.halama-input, .halama-select, .halama-btn, input, select, textarea) {
  box-sizing: border-box;
  min-inline-size: 0;
  max-inline-size: 100%;
}
:is(.awc-halama-unified, .halama-single, .halama-archive) :is(.halama-title, .halama-brand, .halama-meta, .halama-price, .halama-vendors, .halama-badge, .halama-kpi .v) {
  overflow-wrap: anywhere;
}
:is(.awc-halama-unified, .halama-archive) .halama-meta { flex-wrap: wrap; }
/* A table needs horizontal scrolling *inside* the catalog, never across the
 * document. JS inserts an accessible scroll region without altering the table. */
body.awc-standalone-document #amiin-core-preview.awc-native-tool-route .awc-native-tool-surface .awc-provider-table-scroll,
:is(.awc-halama-unified, .halama-single, .halama-archive) .awc-provider-table-scroll {
  box-sizing: border-box;
  inline-size: 100%;
  max-inline-size: 100%;
  min-inline-size: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}
.awc-provider-table-scroll > table {
  /* Keep the native table layout and column text legible while it scrolls. */
  inline-size: max-content;
  min-inline-size: 100%;
  max-inline-size: none !important;
}
.awc-provider-table-scroll:focus-visible { outline: 3px solid #176e5b; outline-offset: -3px; }

/* Halama product pages have their own WordPress template, outside the Core tool
 * route. Keep its media, offers and product details inside that template. */
.halama-single, .halama-archive { min-inline-size:0; max-inline-size:100%; box-sizing:border-box; }
.halama-single .halama-wrap, .halama-archive .halama-wrap { min-inline-size:0; max-inline-size:100%; box-sizing:border-box; }
.halama-single :is(.halama-product,.halama-col,.halama-content,.halama-offers,.halama-meta-box) { min-inline-size:0; max-inline-size:100%; box-sizing:border-box; overflow-wrap:anywhere; }
.halama-single .halama-cols { grid-template-columns:repeat(auto-fit,minmax(min(100%,360px),1fr)) !important; }
.halama-single .halama-kpis { grid-template-columns:repeat(auto-fit,minmax(min(100%,160px),1fr)); }
.halama-single img, .halama-archive img { max-inline-size:100%; height:auto; }
/* v14.25: small, non-invasive hint for genuinely scrollable provider tables. */
body.awc-standalone-document #amiin-core-preview.awc-native-tool-route .awc-provider-table-hint,
:is(.awc-halama-unified, .halama-single, .halama-archive) .awc-provider-table-hint {
  display:block; font-size:.76rem; line-height:1.45; padding:.3rem .15rem;
  color:#4b5563; max-inline-size:100%;
}
