/* Shared responsive layer: loaded after each application theme. */
main,
section,
article,
aside,
form,
fieldset,
.app-shell,
.panel,
.product-detail > *,
.form-grid > *,
.filter-panel > * {
  min-width: 0;
}
img,
video {
  max-width: 100%;
}
input,
select,
textarea {
  max-width: 100%;
}
.mobile-menu-toggle {
  display: none;
}
.responsive-table-region {
  max-width: 100%;
  overflow: auto;
  overscroll-behavior-x: contain;
}
.responsive-table-region:focus-visible {
  outline: 3px solid #7138d4;
  outline-offset: 3px;
}
.table-scroll,
.table-responsive,
.inventory-table-shell,
.guide-table {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}
.newsletter-dialog {
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.product-editor-nav button {
  scroll-margin-inline: 12px;
}
@media (max-width: 1100px) {
  .hype-header {
    gap: 16px;
  }
  .main-nav {
    gap: 12px 22px;
  }
  .product-detail {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .admin .page-heading {
    flex-wrap: wrap;
    gap: 16px;
  }
  .admin .page-actions {
    flex-wrap: wrap;
  }
  .admin .inventory-toolbar {
    flex-wrap: wrap;
  }
  .admin .toolbar > *,
  .admin .filter-drawer > * {
    min-width: 0;
  }
}
@media (max-width: 1024px) {
  /* A real menu replaces the clipped horizontal strip. It remains open without JS. */
  .hype-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 12px 16px;
    gap: 8px 12px;
  }
  .hype-header .brand-lockup-link {
    width: 154px;
    max-width: 100%;
    height: 66px;
  }
  .mobile-menu-toggle {
    display: inline-flex;
    min-height: 44px;
    padding: 8px 14px;
  }
  .header-search {
    grid-column: 1/-1;
    width: 100%;
    max-width: none;
    order: initial;
  }
  .header-search input {
    min-width: 0;
  }
  .utility {
    grid-column: 1/-1;
    margin: 0;
    justify-content: space-between;
    gap: 4px;
    flex-wrap: wrap;
    font-size: 13px;
  }
  .utility a {
    display: inline-flex !important;
    align-items: center;
    min-height: 44px;
    padding: 4px;
  }
  .main-nav {
    padding: 8px 16px 16px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 16px;
    overflow: visible;
    white-space: normal;
  }
  .mobile-enhanced .main-nav:not(.is-open) {
    display: none;
  }
  .main-nav > a {
    display: flex;
    align-items: center;
    min-height: 48px;
    border-bottom: 1px solid var(--line);
  }
  .main-nav .mega {
    grid-column: 1/-1;
  }
  .main-nav .mega-panel {
    position: static;
    width: 100%;
    max-height: min(50dvh, 400px);
    box-shadow: none;
    padding: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .mega-panel a {
    overflow-wrap: anywhere;
    min-height: 44px;
  }
  .admin .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(290px, calc(100vw - 40px));
    height: 100dvh;
    z-index: 80;
    transform: translateX(-105%);
    pointer-events: none;
    overflow-y: auto;
  }
  .admin.nav-open .sidebar {
    transform: translateX(0);
    pointer-events: auto;
    box-shadow: 14px 0 36px #0004;
  }
  .admin.nav-open {
    overflow: hidden;
  }
  .admin .sidebar-close {
    display: block;
    min-height: 44px;
    border: 0;
    background: transparent;
    color: #ddd;
  }
  .admin .sidebar-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 70;
    border: 0;
    background: #0007;
    opacity: 0;
    visibility: hidden;
  }
  .admin.nav-open .sidebar-scrim {
    opacity: 1;
    visibility: visible;
  }
  .admin .app-shell {
    margin-left: 0;
  }
  .admin .nav-toggle {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid var(--rc-line);
    border-radius: 4px;
    background: var(--rc-surface);
    color: var(--rc-text);
  }
  .admin .sidebar nav a {
    min-height: 44px;
  }
  input:not([type='checkbox']):not([type='radio']),
  select,
  textarea,
  .admin .form-control,
  .admin .form-select {
    font-size: 16px;
    min-height: 44px;
  }
}
@media (max-width: 767px) {
  main {
    padding-inline: 16px;
  }
  .home-hero .hero-copy {
    padding: 28px 24px;
  }
  .home-hero h1 {
    font-size: clamp(36px, 9vw, 54px);
  }
  .home-hero .hero-photo {
    min-height: 0;
  }
  .hero-actions {
    flex-wrap: wrap;
  }
  .product-detail,
  .checkout-layout,
  .guide-intro,
  .home-split,
  .service-band,
  .editorial,
  .category-worlds {
    grid-template-columns: minmax(0, 1fr);
  }
  .checkout-layout > aside,
  .purchase-panel {
    position: static;
  }
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .panel {
    padding: 20px 16px;
  }
  .filter-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .product-copy h3 {
    font-size: 18px;
    overflow-wrap: anywhere;
  }
  .card-actions > * {
    flex: 1 1 auto;
    min-height: 44px;
  }
  .spec-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .spec-grid dd,
  .passport-data dd,
  .cart-variant,
  .component-card strong,
  .admin-section td {
    overflow-wrap: anywhere;
  }
  .hype-footer {
    padding-inline: 16px;
    gap: 28px 20px;
  }
  .hype-footer a {
    overflow-wrap: anywhere;
  }
  .hype-footer nav a {
    display: flex;
    align-items: center;
    min-height: 44px;
    margin: 0;
  }
  .newsletter-dialog > div:last-child {
    padding: 28px 20px;
  }
  .newsletter-dialog h2 {
    font-size: 32px;
    padding-right: 20px;
  }
  .tool-hero h1,
  .story-header h1 {
    font-size: clamp(32px, 8vw, 43px);
    overflow-wrap: anywhere;
  }
  .diagram-picker {
    width: 100%;
    flex-wrap: wrap;
  }
  .diagram-picker label {
    min-width: 0;
    flex: 1 1 100%;
  }
  .diagram-stage {
    min-height: 0;
  }
  .diagram-stage img {
    height: auto;
  }
  .passport-cover,
  .delivery-card > header {
    flex-wrap: wrap;
    gap: 20px;
  }
  .pulse-grid strong {
    font-size: clamp(24px, 6vw, 36px);
    overflow-wrap: anywhere;
  }
  /* Operations: controls stay touchable and tables scroll within their own region. */
  .admin .sidebar {
    width: min(290px, calc(100vw - 40px));
    height: 100dvh;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    overscroll-behavior: contain;
  }
  .admin.nav-open {
    overflow: hidden;
  }
  .admin .sidebar nav a,
  .admin .sidebar-close,
  .admin .nav-toggle {
    min-height: 44px;
  }
  .admin .sidebar-close {
    min-width: 52px;
  }
  .admin .topbar {
    height: auto;
    min-height: 66px;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px;
  }
  .admin .top-actions {
    flex-wrap: wrap;
    min-width: 0;
  }
  .admin .page-heading h1 {
    font-size: clamp(26px, 7vw, 34px);
  }
  .admin .page-actions {
    width: 100%;
    gap: 8px;
  }
  .admin .page-actions .btn {
    flex: 1 1 auto;
    font-size: 13px;
  }
  .admin .btn,
  .admin button:not(.switch):not(.btn-close),
  .admin .pagination-bar a {
    min-height: 44px;
  }
  .admin .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .admin .form-grid label,
  .admin .product-editor-section label {
    font-size: 13px;
  }
  .admin .inventory-toolbar,
  .admin .table-tools,
  .admin .inventory-selection {
    gap: 10px;
    flex-wrap: wrap;
  }
  .admin .inventory-toolbar .search {
    width: 100%;
    flex: 1 1 100%;
    min-width: 0;
  }
  .admin .inventory-table-shell {
    max-height: 65dvh;
  }
  .admin .inventory-table [data-column-key] {
    position: static;
  }
  .admin .pagination-bar {
    flex-wrap: wrap;
    gap: 12px;
  }
  .admin .executive-scoreboard,
  .admin .signal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .admin .hero-score strong,
  .admin .metric-value {
    overflow-wrap: anywhere;
    font-size: clamp(24px, 6vw, 36px);
  }
  .admin .section-heading,
  .admin .pos-section-head {
    flex-wrap: wrap;
    gap: 12px;
  }
  .admin .line-editor {
    overflow-x: auto;
    max-width: 100%;
  }
  .admin .product-editor-section {
    grid-template-columns: minmax(0, 1fr);
  }
  .admin .product-editor-rail {
    min-height: 0;
  }
  .admin .product-editor-nav button {
    font-size: 12px;
  }
  .admin .modal-dialog {
    margin: 8px;
    max-width: calc(100% - 16px);
  }
  .admin .modal-dialog-scrollable {
    height: calc(100dvh - 16px);
  }
  .admin .modal-content {
    max-height: 100%;
  }
  .admin .modal-body {
    overscroll-behavior: contain;
    min-height: 0;
  }
  .admin .modal-footer {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
  .admin .product-editor-modal .modal-dialog {
    margin: 0;
    max-width: 100%;
    height: 100dvh;
  }
  .admin .product-editor-modal .modal-content {
    height: 100dvh;
  }
  .storefront .topbar {
    flex-wrap: wrap;
    gap: 10px;
  }
  .storefront .top-actions {
    flex-wrap: wrap;
  }
  input:not([type='checkbox']):not([type='radio']),
  select,
  textarea,
  .admin .form-control,
  .admin .form-select {
    font-size: 16px;
    min-height: 44px;
  }
  input[type='file'] {
    width: 100%;
    min-width: 0;
  }
  #hype-notice:not(:empty) {
    top: 0;
    max-height: 35dvh;
    overflow: auto;
  }
}
@media (max-width: 380px) {
  .product-grid,
  .section .product-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .filter-panel {
    grid-template-columns: minmax(0, 1fr);
  }
  .list-mode .product-card {
    grid-template-columns: minmax(0, 1fr);
  }
  .hype-footer {
    grid-template-columns: minmax(0, 1fr);
  }
  .admin .top-actions .sync {
    display: none;
  }
  .admin .hero-score {
    padding: 14px;
  }
  .admin .pos-line {
    grid-template-columns: 36px minmax(0, 1fr);
  }
  .admin .pos-line-price,
  .admin .pos-remove {
    grid-column: 2;
    grid-row: auto;
    justify-self: start;
  }
}
@media (min-width: 901px) and (max-height: 760px) {
  .admin .product-editor-rail {
    max-height: calc(100dvh - 150px);
    min-height: 0;
    overflow-y: auto;
  }
}
@media print {
  .mobile-menu-toggle {
    display: none !important;
  }
  .responsive-table-region {
    overflow: visible;
  }
}
