/* Shared, dependency-free UI hardening. Loaded last in both application shells. */
:root { color-scheme: dark; }
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
body { overflow-x: visible; }
img, video, iframe { max-width: 100%; }
input, select, textarea, button { font: inherit; }
button, input, select, textarea, .btn { max-width: 100%; }
input, select, textarea { min-width: 0; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--cl-accent); outline-offset: 4px; }
.skip-link { position: fixed; top: .5rem; left: .5rem; z-index: 1000; padding: .75rem 1rem; background: var(--cl-accent); color: #05070a; transform: translateY(-180%); border-radius: .5rem; font-weight: 700; }
.skip-link:focus { transform: none; }
.material-symbols-outlined { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 1em; height: 1em; font-family: inherit; font-weight: normal; line-height: 1; vertical-align: -.12em; overflow: visible; }
.material-symbols-outlined svg { display: block; width: 1em; height: 1em; fill: currentColor; overflow: visible; }
.btn { white-space: normal; min-height: 44px; text-align: center; }
.nav-link, .nav-cta, .admin-topbar-link { min-height: 44px; }
.nav-burger { width: 44px; height: 44px; flex: 0 0 44px; }
.mobile-menu { position: absolute; inset: 100% 0 auto; max-height: calc(100dvh - 64px); overflow-y: auto; overscroll-behavior: contain; background: #080d12; box-shadow: 0 20px 32px rgba(0,0,0,.45); }
.mobile-menu .nav-link { min-height: 48px; }
@media (min-width: 1024px) { .mobile-menu { display: none !important; } }
.container, .main-content, main, .product-grid > *, .products-grid > *, .feature-overviews > *, .detailed-feature > *, .admin-content > * { min-width: 0; }
.product-card .title, .purchase-title, .order-card h3, .page-header h1 { overflow-wrap: break-word; }
.product-card .footer { gap: 1rem; }
.specs-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); }
.spec { min-width: 0; }
.spec .value { overflow-wrap: anywhere; }
.spec .value .pill { max-width: 100%; white-space: normal; }
.trust-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.trust-row > * { min-width: 0; }
.key-block, .admin-key-block { overflow-wrap: anywhere; word-break: normal; }
.order-card-head { gap: 1rem; flex-wrap: wrap; }
.order-card-head > * { min-width: 0; }
.order-card-head .text-muted { overflow-wrap: anywhere; }
.review-pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 1rem; margin: 1.5rem 0; }
.tabs, .admin-tabs { scroll-padding-inline: .5rem; }
.tabs button, .admin-tab { min-height: 44px; flex-shrink: 0; }
/* Native galleries use existing gallery markup. Without JS, slides remain usable. */
.splide { position: relative; min-width: 0; max-width: 100%; }
.splide__list { margin: 0; padding: 0; list-style: none; }
.splide__slide { min-width: 0; max-width: 100%; }
.splide__slide img { display: block; width: 100%; }
.native-gallery .splide__track { min-width: 0; overflow: hidden; }
.native-gallery .splide__slide { aspect-ratio: 16 / 9; position: relative; }
.native-gallery .splide__slide > img { width: 100%; height: 100%; object-fit: contain; background: #05070a; }
.gallery-main.native-gallery { aspect-ratio: auto; }
.gallery-controls { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .35rem .6rem; background: var(--cl-bg-1); border-top: 1px solid var(--cl-border); }
.gallery-controls button { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; border: 1px solid var(--cl-border); border-radius: var(--r-md); background: var(--cl-bg-2); color: var(--cl-text); }
.gallery-controls button:hover { border-color: var(--cl-accent); }
.gallery-count { font-size: .8rem; font-family: var(--ff-mono); color: var(--cl-text-muted); }
.gallery-thumbs .splide__list { display: flex; gap: .5rem; overflow-x: auto; padding: .2rem .2rem .6rem; }
.gallery-thumbs .splide__slide { flex: 0 0 88px; aspect-ratio: 16 / 9; }
.gallery-thumbs .splide__slide button { display: block; border: 0; padding: 0; background: transparent; width: 100%; height: 100%; }
.gallery-thumbs .splide__slide img { width: 100%; height: 100%; object-fit: cover; }
/* Modal content scrolls independently; close controls never cover a title. */
.modal-overlay { overscroll-behavior: contain; overflow: auto; padding: 16px; }
.modal-overlay .modal-container { max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; min-width: 0; max-width: min(100%, 920px); }
.modal-container > .modal-title, .modal-container > h4.modal-title { padding-right: 48px; }
.modal-close { width: 44px; height: 44px; z-index: 2; }
.modal-actions { flex-wrap: wrap; }
.image-modal { padding: 64px 16px 16px; }
.image-modal img { max-height: calc(100dvh - 90px); object-fit: contain; }
.image-modal .modal-close { top: 12px !important; right: 12px !important; }
/* Admin shells and data regions. Wide tables scroll locally rather than crushing cells. */
.admin-content, .admin-header { width: 100%; min-width: 0; }
.admin-header-main, .admin-title, .admin-title > span, .admin-header-actions { min-width: 0; }
.admin-title > span { overflow-wrap: break-word; }
.admin-header, .admin-header-actions, .admin-topbar-actions, .admin-table-toolbar { flex-wrap: wrap; }
.admin-table-wrap, .admin-table-scroll, .order-detail-grid > *, .admin-settings, .admin-settings-layout, .form-section, .form-group, .spec-card { min-width: 0; max-width: 100%; }
.admin-table-scroll { overflow: auto; overscroll-behavior-x: contain; }
.admin-table { min-width: 680px; table-layout: auto; }
.admin-table thead th { white-space: nowrap; }
.admin-table tbody td { word-break: normal; overflow-wrap: break-word; }
.admin-table .col-mono { white-space: nowrap; }
.admin-table td .col-actions { flex-wrap: wrap; }
.admin-kpi-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
.admin-kpi-grid.cols-3 { grid-template-columns: repeat(3,minmax(0,1fr)); }
.admin-kpi-grid.cols-2 { grid-template-columns: repeat(2,minmax(0,1fr)); }
.admin-kpi { min-width: 0; }
.admin-kpi-value { font-size: clamp(1.65rem, 3vw, 2.3rem); overflow-wrap: anywhere; }
.admin-chart-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
.chart-card { min-width: 0; }
.chart-title { flex-wrap: wrap; gap: .5rem; }
.chart-shell, .chart-shell.tall { height: auto; min-height: 200px; }
.data-chart { min-width: 0; }
.data-chart svg { width: 100%; height: auto; display: block; }
.chart-data { margin-top: .75rem; color: var(--cl-text-muted); font-size: .8rem; }
.chart-data summary { min-height: 44px; display: list-item; padding: .7rem .25rem; cursor: pointer; }
.chart-data table { width: 100%; border-collapse: collapse; }
.chart-data td, .chart-data th { padding: .45rem; border-bottom: 1px solid var(--cl-border); text-align: left; }
.chart-bars { display: grid; gap: 1rem; padding: .5rem 0; }
.chart-bar-label { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; font-size: .85rem; margin-bottom: .35rem; }
.chart-bar-label span { overflow-wrap: anywhere; }
.chart-bar-label strong { flex-shrink: 0; font-family: var(--ff-mono); }
.chart-bar-track { height: 9px; border-radius: 5px; background: var(--cl-bg-2); overflow: hidden; }
.chart-bar-fill { height: 100%; background: var(--cl-accent); border-radius: 5px; }
#chart-variants .chart-bar-fill { background: var(--cl-warning); }
.chart-empty:not([hidden]) { position: static; min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; }
.filter-disclosure { border-bottom: 1px solid var(--cl-border); padding: .25rem 0 .75rem; width: 100%; }
.filter-disclosure summary { cursor: pointer; min-height: 44px; padding: .75rem; font-size: .85rem; color: var(--cl-text); }
.filter-count { color: var(--cl-text-muted); font-family: var(--ff-mono); font-size: .75rem; }
.filter-search { margin: .35rem .75rem .75rem; width: calc(100% - 1.5rem); }
.filter-options { max-height: 240px; overflow-y: auto; padding: .25rem .75rem; align-content: start; }
.filter-options .filter-chip { white-space: normal; max-width: 100%; min-height: 44px; }
.filter-chip:has(input:checked), .order-search-chip-input:checked + .filter-chip { border-color: var(--cl-accent); color: var(--cl-text); background: rgba(0,255,102,.09); }
.order-search-chip-input:focus-visible + .filter-chip { outline: 2px solid var(--cl-accent); outline-offset: 2px; }
.savebar { gap: .75rem; flex-wrap: wrap; }
.savebar > * { min-width: 0; }
.form-input, .input, .select, .textarea { max-width: 100%; }
.feature-list-item, .dynamic-card-header, .gallery-upload-row { min-width: 0; }
.feature-list-item > input { flex: 1 1 0; width: 0; min-width: 0; }
.feature-list-item > button { flex-shrink: 0; }
.remove-btn, .icon-btn { min-width: 44px; min-height: 44px; }
.admin-key-block, pre { max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 900px) {
  .admin-kpi-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .admin-chart-grid { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 640px) {
  input, select, textarea { font-size: 16px !important; }
  .admin-content { padding: 20px 16px 36px; }
  .admin-header { padding: 20px 16px; gap: 1rem; }
  .admin-title { font-size: clamp(1.25rem,6vw,1.8rem); line-height: 1.25; }
  .admin-kpi-grid, .admin-kpi-grid.cols-3, .admin-kpi-grid.cols-2 { grid-template-columns: minmax(0,1fr); }
  .admin-kpi { padding: 18px; }
  .admin-kpi-value { font-size: 2rem; }
  .admin-settings-panel, .form-section, .purchase-panel { padding: 20px 16px; }
  .purchase-title { font-size: 1.6rem; }
  .product-grid { gap: 1.5rem; }
  .spec { padding: .85rem; }
  .trust-row { gap: .35rem; }
  .trust-row > * { font-size: .67rem; padding-inline: 0; }
  .tabs { gap: .25rem; }
  .feature-media, .overview-media { min-width: 0 !important; width: 100% !important; }
  .detailed-feature, .admin-field-grid.cols-2, .admin-field-grid.cols-3 { grid-template-columns: minmax(0,1fr); }
  .modal-overlay { padding: 10px; }
  .modal-overlay .modal-container { max-height: calc(100dvh - 20px); padding: 18px 14px; }
  .modal-title { font-size: 1.12rem; line-height: 1.4; }
  .modal-actions > .btn { flex: 1 1 auto; }
  .gallery-upload-row, .dynamic-card-header { flex-wrap: wrap; gap: .75rem; }
  .savebar { position: static; padding: 16px; margin-top: 20px; }
  .savebar > .btn, .savebar > button { flex: 1 1 auto; }
  .admin-filter-row { align-items: stretch; }
  .admin-filter-chips { min-width: 0; max-width: 100%; }
  .admin-filter-chips > .input, .admin-filter-chips > .select { width: 100%; }
  .admin-nav { padding-inline: 16px; }
  .admin-topbar { padding-inline: 16px; gap: .5rem; }
  .admin-topbar-tag { display: none; }
  .admin-topbar-user { max-width: 100px; overflow: hidden; text-overflow: ellipsis; }
  .order-card { padding: 20px 16px; }
  .order-card-head > div:last-child { text-align: left !important; }
}
@media (max-width: 380px) {
  .admin-topbar-name { font-size: .85rem; }
  .admin-topbar-user { display: none; }
  .container { padding-inline: 16px; }
  .section { padding-block: 32px; }
  .price-row { flex-wrap: wrap; gap: .5rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
/* Refinements found in the first rendered pass. */
.savebar { margin-inline: 0; margin-bottom: 0; }
.order-meta, .status-banner > div { min-width: 0; overflow-wrap: anywhere; }
.status-banner code { overflow-wrap: anywhere; }
.payment-date-field { display: grid; gap: .35rem; min-width: 0; }
.payment-date-field .field-label { margin: 0; }
@media (max-width: 640px) {
  .admin-filter-row { flex-direction: column; align-items: stretch; gap: .65rem; }
  .admin-filter-label { flex-basis: auto; width: 100%; min-width: 0; }
  .admin-filter-chips { width: 100%; flex: 1 1 auto; }
  .admin-filter-chips .filter-chip { min-height: 44px; }
  .payment-date-field { width: 100%; }
  .admin-form-container .form-actions { position: static; padding: 16px; flex-wrap: wrap; }
  .admin-form-container .form-actions button { width: 100%; }
  .admin-form-container .modal-header { padding: 14px; align-items: flex-start; }
  .admin-form-container .modal-title { flex-wrap: wrap; font-size: 1rem; }
  .admin-form-container .modal-body { padding: 14px; }
  .admin-form-container .modal-footer { padding: 14px; flex-wrap: wrap; }
  .admin-form-container .modal { width: 100%; max-height: calc(100dvh - 32px); }
  .admin-form-container .modal-table th, .admin-form-container .modal-table td { padding: .5rem .25rem; }
  .specs-grid:not(.admin-form-container .specs-grid) .spec:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
.catalogue-empty { grid-column: 1 / -1; width: 100%; }
.custom-select-option { min-height: 44px; white-space: normal; text-align: left; }
.gallery-library-card { min-width: 0; }
@media (max-width: 640px) {
  .admin-inline-form { grid-template-columns: minmax(0,1fr); }
  .admin-inline-form > * { min-width: 0; }
  .admin-form-container .modal-table, .admin-form-container .modal-table tbody { display: block; }
  .admin-form-container .modal-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .admin-form-container .modal-table tr { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; border: 1px solid var(--cl-border); border-radius: .5rem; margin-bottom: .75rem; padding: .5rem; }
  .admin-form-container .modal-table td { border: 0; display: block; min-width: 0; }
  .admin-form-container .modal-table td:first-child::before { content: 'ID '; color: var(--cl-text-muted); font-size: .7rem; }
  .admin-form-container .modal-table td:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .admin-form-container .modal-table td:nth-child(3) { grid-column: 2; grid-row: 1; }
  .admin-form-container .modal-table td[colspan] { grid-column: 1 / -1; }
  .admin-form-container .modal-table td[colspan]::before { content: none; }
}

/* Follow-up visual review: controls, empty states, and explanatory text. */
.empty-state .btn .material-symbols-outlined { font-size: 1.1em; color: inherit; }
.country-badge { font-family: var(--ff-mono); font-size: .7rem; padding: .15rem .3rem; border: 1px solid var(--cl-border); border-radius: 3px; }
.form-group.checkbox-group { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: start; gap: .6rem .75rem; }
.form-group.checkbox-group > input { margin-top: .1rem; }
.form-group.checkbox-group > p { grid-column: 1 / -1; margin: 0; min-width: 0; }
.accordion-header { width: 100%; text-align: left; color: var(--cl-text); font: inherit; }
.accordion-heading { display: flex; align-items: center; gap: .6rem; font: 700 .95rem var(--ff-mono); }
.advanced-filters, .method-filters { width: 100%; }
.advanced-filters > summary, .method-filters > summary { min-height: 44px; cursor: pointer; padding: .85rem .5rem; color: var(--cl-text); font-size: .9rem; }
.advanced-filter-content { padding-top: .5rem; }
.method-count { color: var(--cl-text-muted); font: .75rem var(--ff-mono); }
@media(min-width:769px) { .advanced-filters > summary, .method-filters > summary { border-bottom: 1px solid var(--cl-border); } }
@media(max-width:640px) { .settings-email-heading { flex-wrap: wrap; } .settings-email-heading button { flex-basis: 100%; margin-left: 0; } }
/* The library's generic thumbnail aspect ratio must not size metadata cards. */
.admin-form-container .gallery-library-card { aspect-ratio: auto; width: 100%; min-width: 0; }
.admin-form-container .gallery-library-meta { min-width: 0; }
.admin-form-container .gallery-library-actions .nav-button { min-height: 44px; }
.admin-form-container .modal-header, .admin-form-container .modal-footer { flex-shrink: 0; }
.admin-form-container .modal-body { min-height: 0; }
.admin-form-container .specs-grid .spec-card.wide { grid-column: 1 / -1; }
@media(max-width:1024px) {
  .admin-form-container .spec-card.half { grid-column: span 3; }
  .admin-form-container .spec-card .form-grid { grid-template-columns: minmax(0,1fr) !important; }
}
@media(max-width:640px) {
  .admin-form-container .spec-card, .admin-form-container .spec-card.half { grid-column: 1 / -1; }
  .admin-form-container .spec-card .form-grid { grid-template-columns: minmax(0,1fr) !important; }
  .admin-form-container .spec-card .inline-field { flex-wrap: wrap; gap: .6rem; }
  .admin-form-container .segmented { flex-shrink: 0; }
  .admin-form-container .segmented label { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .admin-form-container .spec-card { padding: 14px; }
}
/* Keep action-heavy order rows compact instead of wrapping every action vertically. */
.order-search-table { min-width: 1040px; }
.order-search-table .col-actions { min-width: 330px; flex-wrap: nowrap; }
.order-search-table .col-actions > * { flex-shrink: 0; }
.order-search-table .col-actions .btn { white-space: nowrap; }
.table-scroll-hint { display: none; }
@media(max-width:768px) {
  .admin-iconbtn { width: 44px; height: 44px; min-width: 44px; }
  .nav-button { min-height: 44px; }
  .table-scroll-hint { display: block; padding: .6rem 1rem; margin: 0; color: var(--cl-text-muted); font-size: .75rem; }
  .admin-form-container .feature-list-item:has(> .nav-button) { flex-wrap: wrap; }
  .admin-form-container .feature-list-item:has(> .nav-button) > input { flex: 1 1 100%; width: 100%; }
  .admin-form-container .feature-list-item > .nav-button { width: 100%; }
}

/* Bank verification must remain dismissible on short landscape viewports. */
.threeds-panel { position: relative; max-height: calc(100vh - 2rem); max-height: calc(100dvh - 2rem); overflow-y: auto; overscroll-behavior: contain; }
.threeds-panel .modal-close { position: sticky; top: 0; float: right; margin: -.25rem -.25rem .25rem .5rem; z-index: 1; background: var(--cl-bg-card, #171b20); }
.threeds-panel .modal-title { padding-right: 2.5rem; }
@media(max-width:640px) {
  .season-card-header { flex-direction: column; align-items: flex-start; gap: .85rem; }
  .season-card-header > div { min-width: 0; max-width: 100%; }
  .season-card-header .checkbox-group { min-height: 44px; }
}

/* Compact, dismissible purchase notices; never leave hidden controls focusable. */
.purchase-popup { left: max(12px, env(safe-area-inset-left)); bottom: max(12px, env(safe-area-inset-bottom)); width: min(320px, calc(100vw - 24px)); }
.purchase-popup .popup-close { width: 44px; height: 44px; top: 0; right: 0; color: var(--cl-text-muted); }
.purchase-popup-content { padding-right: 28px; }
.purchase-popup-text { min-width: 0; overflow-wrap: anywhere; }
