/*
 * Canonical component and viewport contracts.
 * Loaded after the shared desktop and responsive foundations so each critical
 * surface has one predictable geometry owner at each viewport tier.
 */

:root {
  --ui-control-h: 44px;
  --ui-control-h-compact: 34px;
  --ui-gap-1: 6px;
  --ui-gap-2: 10px;
  --ui-gap-3: 14px;
  --ui-border: rgba(32, 26, 43, 0.16);
  --ui-border-strong: rgba(32, 26, 43, 0.28);
  --ui-state-bg: #f6f1e9;
  --ui-state-accent: #946226;
  --ui-state-ink: #4b351d;
}

/* Shared chrome: page content must never start underneath navigation. */
.topbar {
  position: relative;
  top: auto;
}

.page {
  scroll-margin-top: 12px;
}

.btn-primary,
.btn-secondary {
  text-wrap: nowrap;
}

/* The shared control token is the geometry contract.  Small controls opt into
   the compact token explicitly; every other actionable control stays at 44px. */
button,
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-danger-secondary,
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
select {
  box-sizing: border-box;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
select {
  min-height: var(--ui-control-h);
}

input[type="checkbox"],
input[type="radio"] {
  width: 20px;
  min-width: 20px;
  height: 20px;
  min-height: 20px;
  accent-color: var(--accent);
}

label:has(input[type="checkbox"]),
label:has(input[type="radio"]) {
  min-height: var(--ui-control-h);
}

.compact-buttons button,
.small,
.management-action-grid button {
  min-height: var(--ui-control-h-compact);
  height: var(--ui-control-h-compact);
}

.reservation-date-filters {
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  align-items: end;
}

.reservation-date-filters > [data-apply-reservation-time-filters] {
  grid-column: auto;
  width: auto;
  min-width: 128px;
}

/* Hover must never look stronger than the selected navigation state. */
.staff-tab:not(.active):hover,
.analytics-subnav button:not(.active):hover,
.customer-member-tabs button:not(.active):hover {
  border-color: rgba(109, 40, 217, 0.28);
  background: #f7f2ff;
  color: var(--accent-hover);
  box-shadow: none;
}

.customer-tag-library-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ui-gap-2);
}

.customer-tag-library-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--ui-gap-2);
}

.category-card-grid .category-card,
.category-card {
  display: grid;
  min-height: 124px;
  align-content: center;
  justify-items: center;
  gap: 3px;
  text-align: center;
}

.category-card > *,
.category-hub-meta,
.category-hub-meta strong {
  justify-self: center;
  text-align: center;
}

/* Product detail: media is context, data is the working surface. */
.admin-detail-layout {
  grid-template-columns: minmax(260px, 0.34fr) minmax(0, 1.66fr);
  gap: 16px;
}

.admin-detail-media {
  align-content: start;
  gap: 10px;
}

.admin-detail-image {
  min-height: 168px;
  height: 188px;
  max-height: 210px;
}

.admin-product-tabs {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
}

.admin-product-tabs button {
  min-width: 0;
  min-height: 38px;
  padding: 7px 8px;
  line-height: 1.15;
  white-space: nowrap;
}

.admin-detail-section {
  min-width: 0;
  padding: 14px;
}

.condition-section-tools > span {
  flex: 0 0 auto;
  white-space: nowrap;
}

.admin-method-section {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.admin-method-actions {
  grid-column: auto;
  align-self: end;
  border-top: 0;
  padding-top: 0;
}

/* Dense management table contract (desktop and half-screen desktop). */
#productList .management-table-wrap:not(.compact-category-table) {
  overflow: hidden;
}

#productList .management-table-wrap:not(.compact-category-table) .management-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

#productList .management-table .col-select { width: 3.5%; }
#productList .management-table .col-thumb { width: 6.5%; }
#productList .management-table .col-product { width: 44%; }
#productList .management-table .col-price { width: 12.5%; }
#productList .management-table .col-method { width: 17%; }
#productList .management-table .col-actions { width: 16.5%; }

.compact-category-table td > .pill {
  display: inline-flex;
  width: auto;
  justify-self: start;
}

#productList .management-table th,
#productList .management-table td {
  padding: 7px;
}

#productList .management-row > td {
  vertical-align: middle;
}

#productList .management-thumb-stack {
  min-width: 0;
  gap: 4px;
}

#productList .management-thumb-stack .admin-thumb {
  width: 52px;
  height: 52px;
}

#productList .thumb-sensitive-mark {
  min-width: 40px;
  max-width: 100%;
  padding-inline: 5px;
}

#productList .management-name {
  min-width: 0;
}

#productList .management-name > strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#productList .merchant-card-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

#productList .merchant-card-grid.compact .merchant-card {
  min-width: 0;
  padding: 6px 7px;
}

#productList .merchant-card-grid.compact .merchant-card-head span,
#productList .merchant-card-grid.compact .merchant-card strong,
#productList .merchant-card-grid.compact .merchant-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#productList .price-edit-cell {
  display: grid;
  width: 100%;
  max-width: 148px;
  gap: 3px;
}

#productList .price-edit-cell input {
  width: 100%;
  min-width: 0;
  min-height: var(--ui-control-h);
}

#productList .inline-method-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

#productList .compact-check {
  min-width: 0;
  min-height: 34px;
  justify-content: center;
  padding: 5px 6px;
  line-height: 1.1;
  white-space: nowrap;
}

#productList .management-action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  align-items: center;
}

#productList .management-action-grid button {
  width: 100%;
  min-width: 0;
  min-height: var(--ui-control-h);
  padding: 6px 7px;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}

/* State pricing: one calm divider color, three explicit information tiers. */
.product-condition-section {
  padding: 14px;
}

.condition-section-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.condition-enable-control {
  display: grid;
  grid-template-columns: minmax(132px, 190px) auto;
  align-items: center;
  gap: 6px;
}

.condition-enable-control select,
.condition-enable-control button {
  min-height: var(--ui-control-h);
  margin: 0;
}

.condition-enable-control select {
  width: 100%;
  min-width: 0;
}

.condition-rule-list {
  gap: 14px;
}

.condition-rule-row {
  overflow: hidden;
  border: 1px solid var(--ui-border-strong);
  border-radius: 10px;
  background: var(--white);
  box-shadow: 0 3px 10px rgba(32, 26, 43, 0.04);
}

.condition-tier {
  padding: 11px 12px;
}

.condition-tier + .condition-tier {
  border-top: 1px solid var(--ui-border);
}

.condition-tier-summary {
  grid-template-columns: minmax(200px, 1fr) 112px 178px 150px;
  align-items: center;
  gap: 10px;
  border-left: 7px solid var(--ui-state-accent);
  background: linear-gradient(90deg, var(--ui-state-bg), #fbf8f3 44%, #ffffff 100%);
}

.condition-rule-name {
  color: var(--ui-state-ink);
}

.condition-rule-name strong {
  font-size: 19px;
  line-height: 1.2;
}

.condition-tier-summary .compact-check {
  min-height: 36px;
  justify-content: center;
  padding: 5px 8px;
}

.condition-rule-result,
.condition-sync-state {
  min-width: 0;
}

.condition-rule-result strong {
  white-space: nowrap;
}

.condition-sync-state {
  justify-content: flex-end;
}

.condition-tier-market {
  grid-template-columns: 146px minmax(0, 1fr);
  align-items: end;
  gap: 12px;
}

.condition-tier-market label,
.condition-tier-controls label,
.color-manual-cell {
  min-width: 0;
}

.condition-tier-market input:not([type="checkbox"]),
.condition-tier-controls input:not([type="checkbox"]),
.condition-tier-controls select {
  width: 100%;
  min-width: 0;
  min-height: var(--ui-control-h);
}

.condition-tier-controls input[type="checkbox"],
.condition-tier-summary input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 0;
}

.condition-tier-controls {
  grid-template-columns: 118px minmax(190px, 1fr) 150px 130px 110px;
  align-items: end;
  gap: 10px;
}

.condition-tier-controls .compact-check {
  min-height: var(--ui-control-h);
  align-self: end;
  justify-content: center;
}

.condition-state-benchmark .merchant-card-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.condition-rule-actions {
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.condition-rule-actions button {
  min-width: 86px;
  min-height: var(--ui-control-h);
  white-space: nowrap;
}

/* Color pricing: stable horizontal row, no duplicate-label ambiguity. */
.color-pricing-panel {
  gap: 14px;
}

.color-pricing-head {
  align-items: center;
}

.color-condition-tabs {
  width: fit-content;
  max-width: 100%;
}

.color-condition-tabs .segmented-option {
  min-height: 40px;
  white-space: nowrap;
}

.color-tag-entry {
  grid-template-columns: minmax(240px, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.color-tag-entry button {
  min-width: 126px;
  min-height: var(--ui-control-h);
}

.color-pricing-list {
  gap: 10px;
}

.color-pricing-row {
  grid-template-areas:
    "identity manual auto result"
    "merchants merchants merchants result";
  grid-template-columns: minmax(220px, 1.1fr) minmax(110px, .46fr) minmax(205px, .9fr) minmax(158px, .58fr);
  align-items: start;
  gap: 10px;
  padding: 12px;
  border-color: var(--ui-border);
}

/* Legacy styles assign explicit grid lines to some cells. Reassert the named
   areas here so every breakpoint keeps the same semantic placement. */
.color-pricing-row > * {
  min-width: 0;
  max-width: 100%;
}

.color-pricing-row .color-identity-cell { grid-area: identity; }
.color-pricing-row .color-manual-cell { grid-area: manual; }
.color-pricing-row .color-auto-cell { grid-area: auto; }
.color-pricing-row .color-merchant-cell {
  grid-area: merchants;
  grid-template-columns: auto minmax(0, 1fr);
}
.color-pricing-row .color-result-cell { grid-area: result; }

.color-name-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

button.danger-action {
  border-color: rgba(195, 32, 50, 0.3);
  background: #fff;
  color: var(--red);
}

button.danger-action:hover {
  border-color: rgba(195, 32, 50, 0.55);
  background: #fff5f6;
}

.color-name-tag {
  width: 100%;
  min-width: 0;
  min-height: 40px;
}

.color-name-line button {
  min-width: 62px;
  min-height: 38px;
  padding: 6px 10px;
  line-height: 1;
  white-space: nowrap;
}

.color-alias-tags {
  min-height: 28px;
}

.alias-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.alias-entry input {
  width: 100%;
  min-width: 0;
}

.alias-entry button {
  min-width: 82px;
  white-space: nowrap;
}

.color-manual-cell input {
  width: 100%;
  min-width: 0;
  min-height: var(--ui-control-h);
}

.color-auto-cell {
  align-content: center;
}

.color-auto-cell .compact-check {
  min-height: var(--ui-control-h);
  justify-content: flex-start;
  padding: 6px 8px;
  white-space: nowrap;
}

.color-auto-cell small {
  min-height: 1.4em;
  line-height: 1.35;
}

.color-merchant-cell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border-top: 1px solid rgba(32, 26, 43, 0.1);
  padding-top: 8px;
}

.color-merchant-heading {
  color: var(--muted);
  font-size: 12px;
  font-weight: var(--weight-semibold);
  line-height: 1.3;
  white-space: nowrap;
}

.color-merchant-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 6px;
  min-width: 0;
}

.color-merchant-adjustment {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 6px;
  min-width: 112px;
  padding: 7px 8px;
}

.color-merchant-adjustment .color-merchant-name {
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
  white-space: normal;
}

.color-merchant-adjustment strong {
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.color-unassigned-reference {
  display: grid;
  grid-template-columns: minmax(190px, .42fr) minmax(0, 1.58fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
  border: 1px solid rgba(148, 98, 38, 0.25);
  border-radius: 8px;
  background: #fbf8f3;
  padding: 10px 12px;
}

.color-unassigned-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.color-unassigned-copy strong {
  color: var(--ui-state-ink);
  font-size: 13px;
}

.color-unassigned-copy span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.color-unassigned-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(132px, 1fr));
  gap: 6px;
  min-width: 0;
}

.color-unassigned-adjustment {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
  border: 1px solid rgba(148, 98, 38, 0.2);
  border-radius: 6px;
  background: #fff;
  padding: 6px 8px;
  font-size: 12px;
}

.color-unassigned-adjustment > * {
  min-width: 0;
}

.color-unassigned-adjustment span {
  overflow-wrap: anywhere;
}

.color-unassigned-adjustment b {
  white-space: nowrap;
}

.color-unassigned-adjustment.conflict {
  border-color: rgba(180, 35, 53, 0.28);
  background: #fff0f2;
}

.color-result-cell {
  align-content: center;
  gap: 8px;
  align-self: stretch;
  border-left: 1px solid rgba(32, 26, 43, 0.1);
  padding-left: 12px;
}

.color-result-cell span {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 6px;
}

.color-result-cell strong {
  white-space: nowrap;
}

.color-pricing-actions {
  align-items: center;
}

.color-pricing-actions button {
  min-width: 96px;
  min-height: 40px;
  white-space: nowrap;
}

.cart-drawer.collapsed.empty {
  display: none;
}

/* The reservation page already contains the complete editable reservation
   list. Repeating the floating drawer there obscures form fields and adds a
   second control surface for the same items. Keep the drawer available on
   browsing/detail routes, but remove the duplicate from the reservation
   route at every viewport. */
.cart-drawer.reservation-route {
  display: none;
}

/* The drawer content is narrower than the drawer itself because the desktop
   toggle occupies the left rail. Let the descriptive column shrink instead of
   allowing long product names to force the quantity and remove controls past
   the scroll container. The same constraints remain valid after the mobile
   layout removes that rail. */
.cart-drawer .cart-items,
.cart-drawer .cart-item,
.cart-drawer .cart-item > * {
  min-width: 0;
}

.cart-drawer .cart-item {
  box-sizing: border-box;
  width: 100%;
  grid-template-columns: minmax(0, 1fr) minmax(64px, 92px) auto;
}

.cart-drawer .cart-item > div > strong {
  overflow-wrap: anywhere;
}

.cart-drawer .cart-item input {
  width: 100%;
  min-width: 0;
  max-width: 92px;
}

/* Remove the old heavy-panel visual from secondary staff tools. */
.panel,
.analytics-card,
.analytics-bucket {
  border-width: 1px;
  border-color: var(--ui-border);
  border-radius: 10px;
}

.analytics-focus > div,
.manual-items-panel,
.commitment-checklist {
  border: 1px solid var(--ui-border);
  border-radius: 10px;
}

.admin-detail-advanced input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.admin-detail-advanced [data-save-meta] {
  display: block;
  min-width: 96px;
  justify-self: end;
  margin-left: auto;
  white-space: nowrap;
}

/* Historical nth-row colors are intentionally neutralized: status dividers
   use one warm accent so they cannot be confused with merchant quote colors. */
.condition-rule-row:nth-child(n) .condition-tier-summary {
  border-left-color: var(--ui-state-accent);
  background: linear-gradient(90deg, var(--ui-state-bg), #fbf8f3 44%, #ffffff 100%);
}

@media (max-width: 1180px) and (min-width: 769px) {
  .management-responsive-selection {
    display: none;
  }

  .admin-detail-layout {
    display: grid;
    grid-template-columns: minmax(260px, 0.34fr) minmax(0, 1.66fr);
  }

  .admin-detail-layout > .admin-detail-media {
    display: grid;
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  .admin-detail-layout > .admin-detail-media > .upload-field,
  .admin-detail-layout > .admin-detail-media > .admin-detail-status {
    grid-column: 1;
  }

  .admin-detail-image {
    grid-row: auto;
    height: 164px;
    min-height: 164px;
  }

  #productList .management-table .col-select { width: 4%; }
  #productList .management-table .col-thumb { width: 7%; }
  #productList .management-table .col-product { width: 43%; }
  #productList .management-table .col-price { width: 13%; }
  #productList .management-table .col-method { width: 17%; }
  #productList .management-table .col-actions { width: 16%; }

  #productList .merchant-card-grid.compact .merchant-card {
    padding-inline: 4px;
  }

  #productList .merchant-card-grid.compact .merchant-card-head em {
    display: none;
  }

  #productList .management-action-grid {
    gap: 4px;
  }

  #productList .management-action-grid button {
    padding-inline: 4px;
  }

  .condition-tier-summary {
    grid-template-columns: minmax(170px, 1fr) 100px 162px 140px;
  }

  .condition-tier-controls {
    grid-template-columns: 110px minmax(170px, 1fr) 140px 120px 100px;
  }

  .color-pricing-row {
    grid-template-areas:
      "identity manual auto result"
      "merchants merchants merchants result";
    grid-template-columns: minmax(190px, 1fr) 108px minmax(180px, .82fr) minmax(148px, .62fr);
  }

  .color-pricing-row .color-result-cell {
    grid-area: result;
    grid-template-columns: minmax(0, 1fr);
  }

  .color-pricing-row .color-merchant-cell {
    grid-area: merchants;
  }

  .color-merchant-list {
    grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  }

  .color-unassigned-reference {
    grid-template-columns: minmax(0, 1fr);
  }

  .color-unassigned-list {
    grid-template-columns: repeat(2, minmax(132px, 1fr));
  }
}

/* Staff details share the customer two-column shell, so their read-only color
   reference is materially narrower than the admin editor at the same viewport.
   Keep the result on a full-width row instead of letting the desktop grid clip
   its right edge. */
@media (min-width: 901px) {
  [data-staff-color-reference] .color-pricing-row {
    grid-template-areas:
      "identity manual auto"
      "merchants merchants merchants"
      "result result result";
    grid-template-columns: minmax(180px, 1fr) minmax(100px, .5fr) minmax(180px, 1fr);
  }

  [data-staff-color-reference] .color-pricing-row .color-result-cell {
    grid-area: result;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid rgba(32, 26, 43, 0.1);
    border-left: 0;
    padding-top: 8px;
    padding-left: 0;
  }

  [data-staff-color-reference] .color-unassigned-reference,
  [data-staff-color-reference] .color-unassigned-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 900px) and (min-width: 769px) {
  .admin-product-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .condition-tier-summary,
  .condition-tier-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .condition-rule-name,
  .condition-state-benchmark {
    grid-column: 1 / -1;
  }

  .color-pricing-row {
    grid-template-areas:
      "identity manual"
      "auto auto"
      "merchants merchants"
      "result result";
    grid-template-columns: minmax(0, 1fr) minmax(160px, .62fr);
  }

  .color-pricing-row .color-identity-cell { grid-area: identity; }
  .color-pricing-row .color-manual-cell { grid-area: manual; }
  .color-pricing-row .color-auto-cell { grid-area: auto; }
  .color-pricing-row .color-merchant-cell { grid-area: merchants; }
  .color-pricing-row .color-result-cell {
    grid-area: result;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid rgba(32, 26, 43, 0.1);
    border-left: 0;
    padding-top: 8px;
    padding-left: 0;
  }

  .color-unassigned-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  /* Mobile product controls must remain in document flow. A viewport-sticky
     action bar covered the color and quantity fields, while the collapsed cart
     pill competed for the same touch area. The reservation route remains
     available in primary navigation and an expanded cart still renders after
     an add action. */
  .refined-public-detail .detail-actions {
    position: static;
    bottom: auto;
    grid-template-columns: 1fr;
    margin: 14px 0 0;
    padding: 12px 0 0;
    border-top: 1px solid var(--ui-border);
    background: transparent;
    backdrop-filter: none;
  }

  .refined-public-detail .detail-actions button {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .refined-public-detail .detail-actions .product-cart-open:not(.hidden) {
    display: inline-flex;
  }

  .cart-drawer.product-route.collapsed {
    display: none;
  }

  .selected-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 8px;
  }

  .selected-head h2 {
    margin: 0;
    font-size: 22px;
    line-height: 1.25;
    white-space: nowrap;
  }

  .selected-head strong {
    font-size: 13px;
    white-space: nowrap;
  }

  main,
  .topbar {
    width: calc(100% - 20px);
  }

  .nav {
    max-height: min(66vh, 420px);
    overflow-y: auto;
  }

  .category-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-detail-layout,
  .admin-detail-media {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-detail-media {
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 8px 10px;
    align-items: start;
  }

  .admin-detail-image {
    grid-column: 1;
    grid-row: 1 / span 2;
    height: 112px;
    min-height: 112px;
  }

  .admin-detail-media > .upload-field,
  .admin-detail-media > .admin-detail-status {
    grid-column: 2;
  }

  .admin-detail-media > .upload-field {
    grid-row: 1;
  }

  .admin-detail-media > .admin-detail-status {
    grid-row: 2;
  }

  .admin-product-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #productList .management-table-wrap:not(.compact-category-table) tbody {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  #productList .management-table-wrap:not(.compact-category-table) .management-row {
    grid-template-columns: 32px 56px minmax(0, 1fr);
    gap: 0;
  }

  #productList .management-table-wrap:not(.compact-category-table) .cell-price,
  #productList .management-table-wrap:not(.compact-category-table) .cell-payment,
  #productList .management-table-wrap:not(.compact-category-table) .cell-actions {
    grid-column: 1 / -1;
    grid-row: auto;
    padding: 8px 10px;
  }

  #productList .management-table-wrap:not(.compact-category-table) .cell-price {
    order: 2;
  }

  #productList .management-table-wrap:not(.compact-category-table) .cell-payment {
    order: 3;
  }

  #productList .management-table-wrap:not(.compact-category-table) .cell-actions {
    order: 4;
  }

  #productList .price-edit-cell {
    max-width: none;
    grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
    align-items: center;
  }

  #productList .merchant-card-grid.compact {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .product-condition-section .condition-state-benchmark .merchant-card-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .condition-tier-summary,
  .condition-tier-market,
  .condition-tier-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .color-pricing-row {
    grid-template-areas:
      "identity manual"
      "auto auto"
      "merchants merchants"
      "result result";
    grid-template-columns: minmax(0, 1fr) minmax(150px, .48fr);
  }

  .admin-method-section {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-method-actions {
    grid-column: 1;
    border-top: 1px solid rgba(32, 26, 43, 0.1);
    padding-top: 8px;
  }

  .color-pricing-row .color-result-cell {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid rgba(32, 26, 43, 0.1);
    border-left: 0;
    padding-top: 8px;
    padding-left: 0;
  }


  .color-unassigned-reference,
  .color-unassigned-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .condition-rule-name,
  .condition-state-benchmark {
    grid-column: auto;
  }

  .condition-sync-state {
    justify-content: flex-start;
  }
}

@media (max-width: 520px) {
  main,
  .topbar {
    width: calc(100% - 14px);
  }

  .category-card-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .category-card {
    min-height: 108px;
  }

  .admin-product-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-product-tabs button {
    white-space: normal;
  }

  #productList .merchant-card-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-condition-section .condition-state-benchmark .merchant-card-grid.compact {
    grid-template-columns: minmax(0, 1fr);
  }

  #productList .price-edit-cell {
    grid-template-columns: minmax(112px, .8fr) minmax(0, 1fr);
  }

  .condition-tier-summary,
  .condition-tier-market,
  .condition-tier-controls,
  .color-pricing-row .color-result-cell {
    grid-template-columns: minmax(0, 1fr);
  }

  .color-pricing-row {
    grid-template-areas:
      "identity"
      "manual"
      "auto"
      "merchants"
      "result";
    grid-template-columns: minmax(0, 1fr);
  }

  .product-condition-section .advanced-card-head,
  .condition-section-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .condition-enable-control {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  #productList .inline-method-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #productList .management-action-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .color-pricing-row .color-merchant-cell {
    grid-template-columns: minmax(0, 1fr);
  }

  .color-merchant-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .color-tag-entry,
  .alias-entry,
  .color-name-line {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .color-tag-entry button,
  .alias-entry button,
  .color-pricing-actions button {
    width: 100%;
  }

  .color-name-line button,
  .alias-entry button,
  .color-tag-entry button {
    width: auto;
  }

  .color-pricing-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (hover: none), (pointer: coarse) {
  :root {
    --ui-control-h: 44px;
  }

  .admin-product-tabs button,
  #productList .compact-check,
  #productList .management-action-grid button,
  .condition-tier-summary .compact-check,
  .condition-tier-controls .compact-check,
  .condition-rule-actions button,
  .color-condition-tabs .segmented-option,
  .color-tag-entry button,
  .color-name-tag,
  .color-name-line button,
  .color-auto-cell .compact-check,
  .color-pricing-actions button,
  .product-card-controls :is(input, select, button),
  .pagination-buttons button,
  .catalog-admin-actions button,
  .catalog-login-actions button,
  .card-actions button,
  .small,
  .text-button,
  .weekday-picker span {
    min-height: 44px;
  }

  .favorite-icon-button,
  .icon-lite,
  .modal-close,
  .nav-toggle,
  .icon-button {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    height: 44px;
  }

  .nav a {
    min-height: 44px;
  }
}

.home-featured {
  margin: 20px 0 28px;
}

.home-featured .section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.featured-product-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.featured-product-controls button {
  min-width: 40px;
  min-height: 40px;
  height: 40px;
  padding: 6px 10px;
}

.featured-product-controls button:not(.featured-auto-toggle) {
  width: 40px;
  padding: 7px;
}

.featured-product-controls svg {
  display: block;
  width: 18px;
  height: 18px;
}

.featured-auto-toggle {
  min-width: 124px;
  white-space: nowrap;
}

.featured-auto-toggle[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  background: var(--accent-soft);
  color: var(--accent-hover);
}

/* The account drawer is a short task flow, not a compressed toolbar. Keep the
   two credentials usable at tablet/desktop widths and move the submit action
   onto its own row. The password focus treatment belongs to the compound
   control so it never paints underneath the reveal button. */
.login-strip {
  width: min(560px, calc(100vw - 32px));
  gap: 14px;
  padding: 22px;
  border-radius: var(--radius-lg, 14px);
}

.login-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 14px;
  row-gap: 12px;
}

.login-form .form-error-summary,
.login-form .login-form-actions {
  grid-column: 1 / -1;
}

.login-form-actions {
  justify-self: end;
  min-width: 136px;
}

.login-form-actions > button {
  width: 100%;
}

.login-field .field-help:empty {
  display: none;
}

.password-field {
  border-radius: var(--radius);
}

.login-form .password-field input {
  grid-column: auto;
}

.password-field input:focus,
.password-field input:focus-visible {
  outline: 0;
  box-shadow: none;
}

.password-field:focus-within {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.password-field:focus-within > :is(input, button) {
  border-color: var(--blue);
}

.auth-support-row {
  justify-content: space-between;
  gap: 16px;
}

.auth-support-row > .text-button,
.auth-registration-cta,
.auth-registration-cta > * {
  flex: none;
}

.auth-support-row > .text-button,
.auth-registration-cta > span,
.auth-registration-cta > .text-button {
  white-space: nowrap;
}

.auth-registration-cta {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.featured-product-grid {
  display: grid;
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 36px) / 4);
  gap: 12px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: inline mandatory;
  scrollbar-width: thin;
  padding: 2px 2px 10px;
}

.featured-product-grid:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.featured-product-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  min-width: 0;
  min-height: 132px;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg, 14px);
  background: linear-gradient(145deg, var(--surface) 0%, color-mix(in srgb, var(--accent-soft) 34%, white) 100%);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow-soft);
  text-align: left;
  scroll-snap-align: start;
}

@media (hover: hover) and (pointer: fine) {
  .featured-product-card:not(:disabled):hover {
    border-color: var(--accent);
    background: var(--surface);
    color: var(--ink);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
  }
}

.featured-product-image {
  display: grid;
  width: 96px;
  height: 96px;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  background: var(--white);
  color: var(--muted);
  padding: 6px;
}

.featured-product-image img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: transparent;
}

.featured-product-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.featured-product-copy strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: var(--text-sm, 14px);
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.featured-product-copy small {
  color: var(--muted);
}

.featured-product-copy b {
  color: var(--accent-strong);
  font-size: var(--text-lg, 18px);
  line-height: 1.2;
}

.featured-slot-editor {
  display: grid;
  gap: 8px;
  margin: 12px 0 16px;
}

.featured-slot-row {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(180px, 1.2fr) minmax(180px, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.featured-slot-row:has(.featured-search-result) {
  z-index: var(--z-raised);
}

.settings-save-button {
  display: block;
  width: auto;
  min-width: 132px;
  margin: 14px 0 0 auto;
}

.featured-slot-row > div {
  display: grid;
  min-width: 0;
}

.featured-slot-row b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.featured-slot-row small {
  color: var(--muted);
}

.featured-search-results {
  position: absolute;
  z-index: var(--z-raised);
  top: calc(100% - 4px);
  right: 120px;
  left: 34%;
  max-height: 240px;
  overflow: auto;
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-strong);
}

.featured-search-result {
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.sensitive-reservation-row {
  background: #fff3f3;
}

.sensitive-reservation-row > td:first-child {
  box-shadow: inset 4px 0 #c93a47;
}

.sensitive-reservation-alert {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid #e6a4a8;
  border-left: 5px solid #c93a47;
  border-radius: var(--radius-sm);
  background: #fff3f3;
  color: #7f1823;
}

@media (max-width: 1180px) {
  .featured-product-grid {
    grid-auto-columns: calc((100% - 12px) / 2);
  }
}

@media (min-width: 1920px) {
  .featured-product-grid {
    grid-auto-columns: calc((100% - 48px) / 5);
  }
}

@media (max-width: 900px) {
  .reservation-date-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reservation-date-filters > [data-apply-reservation-time-filters] {
    grid-column: 1 / -1;
    width: 100%;
  }

  .featured-slot-row {
    grid-template-columns: 28px minmax(0, 1fr) auto auto;
  }

  .featured-slot-row > div:first-of-type {
    grid-column: 2 / -1;
    grid-row: 1;
  }

  .featured-slot-row > input[data-featured-search] {
    grid-column: 1 / 3;
    grid-row: 2;
  }

  .featured-slot-row > [data-search-featured] {
    grid-column: 3;
    grid-row: 2;
  }

  .featured-slot-row > [data-clear-featured] {
    grid-column: 4;
    grid-row: 2;
  }

  .featured-search-results {
    right: 8px;
    left: 28px;
  }
}

@media (max-width: 600px) {
  .login-strip {
    top: calc(var(--login-strip-top-offset, 78px) + env(safe-area-inset-top));
    max-height: calc(100dvh - var(--login-strip-top-offset, 78px) - 10px - env(safe-area-inset-top));
    width: calc(100vw - 20px);
    padding: 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .login-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .login-form-actions {
    width: 100%;
    justify-self: stretch;
  }

  .auth-support-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 6px;
  }

  .auth-support-row > .text-button {
    justify-self: start;
  }

  .auth-registration-cta {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    justify-content: stretch;
    gap: 8px;
  }

  .auth-registration-cta > span {
    align-self: center;
    white-space: normal;
  }

  .home-featured .section-heading {
    align-items: start;
  }

  .featured-product-controls {
    width: 100%;
    justify-content: flex-end;
  }

  .email-template-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .email-template-list button {
    min-width: 0;
    min-height: 40px;
    white-space: normal;
    line-height: 1.25;
  }

  .flow-editor-grid {
    grid-template-columns: 1fr;
  }

  .settings-save-button {
    width: 100%;
  }

  .catalog-search-row:not(:has(#showFavoritesButton:not(.hidden))) #searchInput {
    grid-column: 1;
    grid-row: 1;
  }

  .catalog-search-row:not(:has(#showFavoritesButton:not(.hidden))) #refreshProductsButton {
    grid-column: 2;
    grid-row: 1;
  }

  .reservation-date-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .featured-product-grid {
    grid-auto-columns: min(86vw, 320px);
  }

  .featured-product-card {
    grid-template-columns: 78px minmax(0, 1fr);
    min-height: 108px;
    padding: 12px;
  }

  .featured-product-image {
    width: 78px;
    height: 78px;
  }

  .analytics-shell .summary-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .inventory-section-stack {
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
    width: 100%;
  }

  .inventory-main-panel,
  .inventory-events-panel {
    overflow: visible;
    width: 100%;
    box-sizing: border-box;
  }

  .inventory-events-panel,
  .inventory-events-panel > *,
  .inventory-export-form {
    min-width: 0;
    max-width: 100%;
  }

  .inventory-export-form {
    width: 100%;
    box-sizing: border-box;
  }

  .inventory-stock-table,
  .inventory-events-table {
    display: block;
    width: 100%;
    min-width: 0;
    border: 0;
  }

  .inventory-events-table {
    min-width: 0 !important;
  }

  .inventory-stock-table thead,
  .inventory-events-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }

  .inventory-stock-table tbody,
  .inventory-events-table tbody {
    display: grid;
    gap: 8px;
  }

  .inventory-stock-table tr,
  .inventory-events-table tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
    padding: 12px;
    border: 1px solid var(--ui-border);
    border-radius: var(--radius-sm);
    background: var(--paper);
  }

  .inventory-stock-table td,
  .inventory-events-table td {
    display: grid;
    min-width: 0 !important;
    gap: 2px;
    padding: 0;
    border: 0;
    overflow-wrap: anywhere;
  }

  .inventory-stock-table td:nth-child(1),
  .inventory-stock-table td:nth-child(2),
  .inventory-stock-table td:nth-child(7),
  .inventory-stock-table td:nth-child(8),
  .inventory-events-table td:nth-child(3),
  .inventory-events-table td:nth-child(4) {
    grid-column: 1 / -1;
  }

  .inventory-stock-table td::before,
  .inventory-events-table td::before {
    color: var(--muted);
    font-size: 12px;
    font-weight: var(--weight-semibold);
    line-height: 1.2;
  }

  .inventory-stock-table td:nth-child(1)::before { content: "商品"; }
  .inventory-stock-table td:nth-child(2)::before { content: "JAN"; }
  .inventory-stock-table td:nth-child(3)::before { content: "カテゴリ"; }
  .inventory-stock-table td:nth-child(4)::before { content: "状態"; }
  .inventory-stock-table td:nth-child(5)::before { content: "在庫"; }
  .inventory-stock-table td:nth-child(6)::before { content: "参考原価"; }
  .inventory-stock-table td:nth-child(7)::before { content: "最終入庫"; }
  .inventory-stock-table td:nth-child(8)::before { content: "操作"; }

  .inventory-events-table td:nth-child(1)::before { content: "日時"; }
  .inventory-events-table td:nth-child(2)::before { content: "種別"; }
  .inventory-events-table td:nth-child(3)::before { content: "商品"; }
  .inventory-events-table td:nth-child(4)::before { content: "数量"; }
  .inventory-events-table td:nth-child(5)::before { content: "金額"; }
  .inventory-events-table td:nth-child(6)::before { content: "保管"; }
  .inventory-events-table td:nth-child(7)::before { content: "理由・操作アカウント"; }

  .inventory-stock-table td:last-child button {
    width: 100%;
  }

  .analytics-bucket {
    padding: 10px 12px;
  }

  .analytics-bucket > h3 {
    margin: 0 0 4px;
  }

  .analytics-bucket .bucket-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 10px;
    padding: 8px 0;
  }

  .analytics-bucket .bucket-row.is-empty {
    min-height: 36px;
  }

  .analytics-bucket .bucket-label {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .analytics-bucket .bucket-number {
    text-align: right;
    white-space: nowrap;
  }

  .analytics-bucket .bucket-bar,
  .analytics-bucket .compact-list,
  .analytics-bucket .bucket-row > .muted-note {
    grid-column: 1 / -1;
  }

  .analytics-bucket .bucket-bar {
    height: 9px;
    border-width: 1px;
  }

  .analytics-bucket .compact-list,
  .analytics-bucket .bucket-row > .muted-note {
    margin: 0;
    font-size: 12px;
  }

  .analytics-alert {
    overflow: visible;
  }

  .analytics-alert-table {
    display: block;
    width: 100%;
    min-width: 0;
    border: 0;
  }

  .analytics-alert-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }

  .analytics-alert-table tbody {
    display: grid;
    gap: 8px;
  }

  .analytics-alert-table tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 10px;
    padding: 11px;
    border: 1px solid rgba(201, 58, 71, 0.24);
    border-radius: var(--radius-sm);
    background: var(--white);
  }

  .analytics-alert-table td {
    display: grid;
    min-width: 0;
    gap: 2px;
    padding: 0;
    border: 0;
    color: var(--black);
    overflow-wrap: anywhere;
  }

  .analytics-alert-table td:nth-child(2),
  .analytics-alert-table td:nth-child(6) {
    grid-column: 1 / -1;
  }

  .analytics-alert-table td:nth-child(2) {
    grid-row: 1;
    font-weight: var(--weight-semibold);
  }

  .analytics-alert-table td:nth-child(1) {
    grid-column: 1 / -1;
  }

  .analytics-alert-table td::before {
    color: var(--muted);
    font-size: 12px;
    font-weight: var(--weight-semibold);
    line-height: 1.2;
  }

  .analytics-alert-table td:nth-child(1)::before { content: "期間"; }
  .analytics-alert-table td:nth-child(2)::before { content: "商品"; }
  .analytics-alert-table td:nth-child(3)::before { content: "予約数"; }
  .analytics-alert-table td:nth-child(4)::before { content: "数量"; }
  .analytics-alert-table td:nth-child(5)::before { content: "過去14日"; }
  .analytics-alert-table td:nth-child(6)::before { content: "理由"; }
}

/* Admin catalog v2: a single data-dense geometry owner for active state rows. */
.batch-tools-disclosure-v2 {
  overflow: hidden;
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  background: #f7f8fb;
}

.batch-tools-disclosure-v2 > summary {
  min-height: 42px;
  padding: 8px 12px;
  background: #fff;
}

.batch-tools-disclosure-v2[open] > summary {
  border-bottom: 1px solid var(--ui-border);
  background: #fff;
}

.batch-tools-v2.grouped {
  display: grid;
  grid-template-columns: 1.15fr .9fr 1.35fr 1.25fr 1fr;
  gap: 8px;
  padding: 9px;
  background: #f7f8fb;
}

.batch-tools-v2 .batch-tool-group {
  display: grid;
  min-width: 0;
  min-height: 0;
  align-content: start;
  gap: 7px;
  padding: 9px;
  border: 1px solid rgba(32, 26, 43, 0.12);
  border-radius: 8px;
  background: #fff;
}

.batch-tools-v2 .batch-tool-head {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.batch-tools-v2 .batch-tool-head strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batch-tools-v2 .batch-tool-head span {
  flex: none;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.batch-tools-v2 .batch-tool-control-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
}

.batch-tools-v2 .batch-tool-control-row :is(input, select, button) {
  width: auto;
  min-width: 0;
  min-height: 34px;
  height: 34px;
  margin: 0;
  padding: 5px 8px;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1;
}

.batch-tools-v2 .batch-tool-control-row :is(input, select) {
  flex: 1 1 0;
}

.batch-tools-v2 .batch-tool-control-row button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.batch-tools-v2 .batch-selection-actions button:first-child,
.batch-tools-v2 .batch-condition-controls select:first-of-type,
.batch-tools-v2 .batch-payment-controls select:first-of-type {
  flex: 1 1 auto;
}

.batch-tools-v2 .batch-selection-actions .batch-save-button {
  color: var(--ink);
}

#productList .management-table-wrap:has(.management-table-v2) {
  overflow: hidden;
  border: 1px solid rgba(32, 26, 43, 0.22);
  border-radius: 10px;
  background: #fff;
}

#productList .management-table-v2 {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

#productList .management-table-v2 .col-select { width: 3.5%; }
#productList .management-table-v2 .col-thumb { width: 6%; }
#productList .management-table-v2 .col-product { width: 39.5%; }
#productList .management-table-v2 .col-price { width: 14%; }
#productList .management-table-v2 .col-method { width: 17%; }
#productList .management-table-v2 .col-actions { width: 20%; }

#productList .management-table-v2 th {
  height: 40px;
  padding: 7px 8px;
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.22);
  background: #20192b;
  color: #fff;
  font-size: 13px;
  line-height: 1;
  vertical-align: middle;
}

#productList .management-table-v2 th:last-child {
  border-right: 0;
}

#productList .management-table-v2 .management-row > td {
  min-width: 0;
  padding: 6px 7px;
  border: 0;
  border-right: 1px solid rgba(32, 26, 43, 0.12);
  border-bottom: 1px solid rgba(32, 26, 43, 0.16);
  background: #fff;
  vertical-align: middle;
}

#productList .management-table-v2 .management-row > td:last-child {
  border-right: 0;
}

#productList .management-table-v2 tbody:last-child tr:last-child > td {
  border-bottom: 0;
}

#productList .management-table-v2 .management-primary-state-row > td {
  border-top: 2px solid rgba(91, 69, 128, 0.42);
}

#productList .management-table-v2 .management-primary-state-row:first-child > td {
  border-top: 0;
}

#productList .management-table-v2 .management-state-row > td {
  background: #f8f9fc;
}

#productList .management-table-v2 .management-row.state-lookup-hit > td {
  background: #fff7dd;
  box-shadow: inset 0 2px 0 #b07a12, inset 0 -2px 0 #b07a12;
}

#productList .management-table-v2 .management-row.state-lookup-hit > td:first-child {
  box-shadow: inset 3px 0 0 #b07a12, inset 0 2px 0 #b07a12, inset 0 -2px 0 #b07a12;
}

.state-lookup-codes {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 3px;
}

.state-lookup-code {
  display: inline-flex;
  width: auto;
  min-width: 0;
  min-height: 24px;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border: 1px solid rgba(50, 80, 67, 0.24);
  border-radius: 5px;
  background: #eef4f1;
  color: #2f5142;
  box-shadow: none;
  font-family: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0;
}

.state-lookup-code:hover,
.state-lookup-code:focus-visible {
  border-color: #356b53;
  background: #e0eee7;
  color: #204735;
}

.state-lookup-code span {
  overflow-wrap: anywhere;
}

.state-lookup-code svg {
  width: 14px;
  height: 14px;
  flex: none;
}

.condition-rule-row .state-lookup-codes {
  grid-column: 1 / -1;
}

#productList .management-table-v2 .management-state-row .cell-product {
  border-left: 0;
}

#productList .management-table-v2 .cell-select,
#productList .management-table-v2 .cell-thumb {
  text-align: center;
}

#productList .management-table-v2 .cell-select input {
  width: 18px;
  height: 18px;
  margin: 0;
}

#productList .management-table-v2 .management-thumb-stack {
  display: grid;
  justify-items: center;
  gap: 3px;
}

#productList .management-table-v2 .management-thumb-stack .admin-thumb {
  width: 46px;
  height: 46px;
}

#productList .management-table-v2 .admin-thumb-placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: #8a8493;
  background: #f4f3f6;
}

#productList .management-table-v2 .admin-thumb-placeholder svg {
  width: 22px;
  height: 22px;
}

#productList .management-table-v2 .thumb-sensitive-mark {
  min-width: 38px;
  min-height: 18px;
  padding: 1px 5px;
  font-size: 12px;
  line-height: 14px;
}

#productList .management-table-v2 .state-expand-button {
  display: grid;
  width: 30px;
  min-width: 30px;
  height: 22px;
  min-height: 22px;
  margin: 0;
  padding: 2px 6px;
  place-items: center;
  border: 1px solid rgba(94, 49, 170, 0.18);
  border-radius: 999px;
  background: #f3eefb;
  color: var(--ink);
}

#productList .management-table-v2 .state-expand-button:hover {
  border-color: rgba(94, 49, 170, 0.36);
  background: #ebe1fa;
}

#productList .management-table-v2 .state-expand-button svg {
  width: 16px;
  height: 16px;
}

#productList .management-table-v2 .state-family-rail {
  display: block;
  width: 3px;
  height: 42px;
  margin: auto;
  border-radius: 999px;
  background: #7891b8;
}

#productList .management-table-v2 .management-name {
  display: grid;
  min-width: 0;
  gap: 5px;
}

#productList .management-table-v2 .state-identity-line {
  display: flex;
  min-width: 0;
  min-height: 22px;
  align-items: center;
  gap: 6px;
  line-height: 1.15;
  white-space: nowrap;
}

#productList .management-table-v2 .state-product-title {
  overflow: hidden;
  min-width: 0;
  color: var(--ink);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#productList .management-table-v2 .state-condition-title {
  color: #2f476b;
  font-size: 14px;
}

#productList .management-table-v2 .state-condition-name,
#productList .management-table-v2 .primary-condition-pill {
  flex: none;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 700;
  line-height: 16px;
}

#productList .management-table-v2 .state-condition-name {
  border: 1px solid rgba(58, 91, 73, 0.18);
  background: #edf6f0;
  color: #356148;
}

#productList .management-table-v2 .primary-condition-pill {
  border: 0;
  background: #eee9f7;
  color: #55338c;
}

#productList .management-table-v2 .management-benchmark-row.compact.empty {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  min-height: 24px;
  margin: 0;
  padding: 3px 7px;
  align-items: center;
  border: 1px solid rgba(32, 26, 43, 0.14);
  border-radius: 6px;
  background: #f5f6f8;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

#productList .management-table-v2 .merchant-card-grid.compact {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

#productList .management-table-v2 .merchant-card-grid.compact .merchant-card {
  min-width: 0;
  min-height: 52px;
  padding: 5px 6px;
  border-radius: 7px;
}

#productList .management-table-v2 .merchant-card-grid.compact :is(.merchant-card-head span, strong, small) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#productList .management-table-v2 .merchant-card-grid.compact .merchant-card-head,
#productList .management-table-v2 .merchant-card-grid.compact strong {
  font-size: 12px;
  line-height: 1.2;
}

#productList .management-table-v2 .merchant-card-grid.compact .merchant-card-head {
  gap: 2px;
}

#productList .management-table-v2 .merchant-card-grid.compact .merchant-card-head em {
  padding-inline: 2px;
}

#productList .management-table-v2 .merchant-card-grid.compact small {
  font-size: 12px;
  line-height: 1.15;
}

#productList .management-table-v2 .merchant-card-grid.compact .merchant-condition-meta,
#productList .management-table-v2 .merchant-card-grid.compact .merchant-adjustment-meta {
  display: flex;
}

#productList .management-table-v2 .merchant-card-grid.compact .merchant-grade-badge {
  padding-inline: 3px;
}

#productList .management-table-v2 .price-edit-cell {
  display: grid;
  width: 100%;
  max-width: none;
  gap: 4px;
}

#productList .management-table-v2 .price-edit-cell input {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  height: 34px;
  padding: 5px 8px;
  font-size: 13px;
}

#productList .management-table-v2 .price-edit-cell input:disabled {
  border-color: rgba(32, 26, 43, 0.14);
  background: #f5f6f8;
  color: var(--ink);
  opacity: 1;
}

#productList .management-table-v2 .state-price-meta {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.15;
  white-space: nowrap;
}

#productList .management-table-v2 .state-price-meta > span:first-child {
  overflow: hidden;
  min-width: 0;
  text-overflow: ellipsis;
}

#productList .management-table-v2 .state-price-meta .sync-badge {
  flex: none;
  padding: 2px 5px;
  font-size: 12px;
}

#productList .management-table-v2 .inline-method-list {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
}

#productList .management-table-v2 .compact-check {
  display: flex;
  min-width: 0;
  min-height: 32px;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 3px;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

#productList .management-table-v2 .compact-check input {
  width: 14px;
  height: 14px;
  flex: none;
  margin: 0;
}

#productList .management-table-v2 .compact-check span {
  overflow: hidden;
  min-width: 0;
  text-overflow: ellipsis;
}

#productList .management-table-v2 .management-action-grid {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  flex-wrap: wrap;
}

#productList .management-table-v2 .management-action-grid button {
  width: auto;
  min-width: 42px;
  min-height: 32px;
  height: 32px;
  flex: 1 1 42px;
  padding: 5px 7px;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

#productList .management-table-v2 .management-action-grid .product-level-action {
  min-width: 64px;
  flex: 0 0 64px;
  border-color: rgba(164, 48, 64, 0.28);
  background: #fff;
  color: #9d3040;
}

#productList .management-table-v2 .management-action-grid .action-sync {
  border-color: rgba(77, 95, 121, 0.24);
  background: #fff;
  color: #4d5f79;
  box-shadow: none;
}

#productList .management-table-v2 .management-action-grid > .status-badge {
  min-height: 24px;
  padding: 3px 8px;
  border: 0;
  border-radius: 999px;
  background: #f0f1f4;
  color: var(--muted);
  line-height: 18px;
}

@media (min-width: 1280px) {
  #productList .management-table-wrap:not(.compact-category-table):has(.management-table-v2) {
    display: block !important;
    overflow: hidden !important;
  }

  #productList .management-table-wrap:not(.compact-category-table) .management-table-v2 {
    display: table !important;
  }

  #productList .management-table-wrap:not(.compact-category-table) .management-table-v2 colgroup {
    display: table-column-group !important;
  }

  #productList .management-table-wrap:not(.compact-category-table) .management-table-v2 thead {
    display: table-header-group !important;
  }

  #productList .management-table-wrap:not(.compact-category-table) .management-table-v2 tbody {
    display: table-row-group !important;
  }

  #productList .management-table-wrap:not(.compact-category-table) .management-table-v2 .management-row {
    display: table-row !important;
  }

  #productList .management-table-wrap:not(.compact-category-table) .management-table-v2 .management-row > td {
    display: table-cell !important;
  }

  #productList .management-table-wrap:not(.compact-category-table) .management-table-v2 .management-row [data-label]::before {
    display: none !important;
    content: none !important;
  }
}

@media (max-width: 1180px) and (min-width: 769px) {
  .batch-tools-v2.grouped {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .batch-tools-v2 .batch-tool-selection,
  .batch-tools-v2 .batch-tool-price,
  .batch-tools-v2 .batch-tool-condition {
    grid-column: span 2;
  }

  .batch-tools-v2 .batch-tool-payment,
  .batch-tools-v2 .batch-tool-sensitive {
    grid-column: span 3;
  }

  #productList .management-table-v2 .col-thumb { width: 6.5%; }
  #productList .management-table-v2 .col-product { width: 39.5%; }
  #productList .management-table-v2 .col-price { width: 14%; }
  #productList .management-table-v2 .col-method { width: 17%; }
  #productList .management-table-v2 .col-actions { width: 20%; }

  #productList .management-table-v2 .management-row {
    display: table-row;
  }

  #productList .management-table-v2 .management-row > td {
    display: table-cell;
  }

  #productList .management-table-v2 .merchant-card-grid.compact {
    gap: 3px;
  }

  #productList .management-table-v2 .merchant-card-grid.compact .merchant-card {
    padding-inline: 4px;
  }

  #productList .management-table-v2 .inline-method-list {
    gap: 3px;
  }

  #productList .management-table-v2 .compact-check {
    gap: 2px;
    padding-inline: 2px;
    font-size: 12px;
  }

  #productList .management-table-v2 .management-action-grid {
    gap: 3px;
  }

  #productList .management-table-v2 .management-action-grid button {
    min-width: 36px;
    flex-basis: 36px;
    padding-inline: 4px;
  }

  #productList .management-table-v2 .management-action-grid .product-level-action {
    min-width: 56px;
    flex-basis: 56px;
  }
}

@media (max-width: 1399px) and (min-width: 1181px) {
  .batch-tools-v2.grouped {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .batch-tools-v2 .batch-tool-selection,
  .batch-tools-v2 .batch-tool-price,
  .batch-tools-v2 .batch-tool-condition {
    grid-column: span 2;
  }

  .batch-tools-v2 .batch-tool-payment,
  .batch-tools-v2 .batch-tool-sensitive {
    grid-column: span 3;
  }
}

@media (max-width: 840px) {
  [data-page="catalog"] .category-hub-main {
    gap: 4px;
    padding-inline: 7px;
  }

  [data-page="catalog"] .category-hub-meta {
    gap: 2px;
  }

  [data-page="catalog"] .category-hub-main strong {
    min-width: 32px;
    min-height: 28px;
    padding-inline: 6px;
  }

  [data-page="catalog"] .category-hub-chevron {
    font-size: 14px;
  }
}

@media (max-width: 768px) {
  .batch-tools-v2.grouped {
    grid-template-columns: minmax(0, 1fr);
  }

  .batch-tools-v2 .batch-tool-group {
    grid-column: 1;
  }

}

@media (max-width: 1279px) {

  #productList .management-table-wrap:has(.management-table-v2) {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  #productList .management-table-v2,
  #productList .management-table-v2 tbody {
    display: grid;
    width: 100%;
  }

  #productList .management-table-v2 colgroup {
    display: none;
  }

  #productList .management-table-v2 thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }

  #productList .management-table-v2 tbody {
    gap: 9px;
  }

  #productList .management-table-v2 .management-row {
    display: grid;
    overflow: hidden;
    grid-template-columns: 32px 60px repeat(10, minmax(0, 1fr));
    border: 1px solid rgba(32, 26, 43, 0.2);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(32, 26, 43, 0.05);
  }

  #productList .management-table-v2 .management-state-row {
    margin-left: 20px;
    border-left: 4px solid #7891b8;
    box-shadow: none;
  }

  #productList .management-table-v2 .management-row > td {
    display: block;
    padding: 8px 9px;
    border: 0;
    border-bottom: 1px solid rgba(32, 26, 43, 0.1);
    background: transparent;
  }

  #productList .management-table-v2 .cell-select {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
  }

  #productList .management-table-v2 .cell-thumb {
    grid-column: 2;
    grid-row: 1;
  }

  #productList .management-table-v2 .cell-product {
    grid-column: 3 / -1;
    grid-row: 1;
  }

  #productList .management-table-v2 .cell-price {
    grid-column: 1 / 7;
    grid-row: 2;
    border-right: 1px solid rgba(32, 26, 43, 0.1);
  }

  #productList .management-table-v2 .cell-payment {
    grid-column: 7 / -1;
    grid-row: 2;
  }

  #productList .management-table-v2 .cell-actions {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  #productList .management-table-v2 .cell-actions {
    border-bottom: 0;
  }

  #productList .management-table-v2 .management-row [data-label]::before {
    display: block;
    margin: 0 0 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    text-align: left;
  }

  #productList .management-table-v2 .state-product-title {
    font-size: 13px;
  }

  #productList .management-table-v2 .merchant-card-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #productList .management-table-v2 .price-edit-cell {
    grid-template-columns: minmax(112px, .7fr) minmax(0, 1fr);
    align-items: center;
  }

  #productList .management-table-v2 .management-action-grid {
    flex-wrap: nowrap;
  }
}

@media (max-width: 520px) {
  .catalog-admin-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
    overflow: visible;
    scrollbar-width: auto;
  }

  .catalog-admin-actions > * {
    width: 100%;
    min-width: 0;
  }

  .catalog-admin-actions :is(button, .inline-check) {
    min-height: 42px;
    justify-content: center;
    padding: 5px 3px;
    font-size: 12px;
    white-space: nowrap;
  }

  .catalog-admin-actions .inline-check {
    gap: 3px;
    grid-column: span 2;
    justify-content: flex-start;
    min-height: 44px;
  }

  .catalog-admin-actions .inline-check input {
    width: 14px;
    height: 14px;
    flex: none;
  }

  .batch-tools-v2 .batch-tool-control-row {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .batch-tools-v2 .batch-tool-control-row :is(input, select):first-of-type {
    flex-basis: 100%;
  }

  .batch-tools-v2 :is(.batch-tool-price, .batch-tool-sensitive) .batch-tool-control-row {
    flex-wrap: nowrap;
  }

  .batch-tools-v2 :is(.batch-tool-price, .batch-tool-sensitive) .batch-tool-control-row :is(input, select):first-of-type {
    flex-basis: 0;
  }

  #productList .management-table-v2 .merchant-card-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #productList .management-table-v2 .management-row {
    grid-template-columns: 30px 54px repeat(10, minmax(0, 1fr));
  }

  #productList .management-table-v2 .management-state-row {
    margin-left: 12px;
  }

  #productList .management-table-v2 .state-condition-name,
  #productList .management-table-v2 .primary-condition-pill {
    padding-inline: 4px;
  }

  #productList .management-table-v2 .state-identity-line {
    align-content: center;
    flex-wrap: wrap;
    gap: 3px 5px;
    white-space: normal;
  }

  #productList .management-table-v2 .state-product-title {
    display: -webkit-box;
    flex: 1 0 100%;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-height: 1.2;
    white-space: normal;
  }

  #productList .management-table-wrap:not(.compact-category-table) .management-table-v2 .management-row .merchant-card-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #productList .management-table-wrap:not(.compact-category-table) .management-table-v2 .management-row .management-action-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }

  #productList .management-table-wrap:not(.compact-category-table) .management-table-v2 .management-row .management-action-grid button {
    width: 100%;
    min-width: 0;
  }
}

/* ==========================================================================
   Admin shell (staff / admin / owner): purple topbar + white sidebar.
   Public and customer views keep the default shell untouched.
   ========================================================================== */

:root {
  --admin-topbar-h: 56px;
  --admin-side-w: 232px;
  --admin-side-w-compact: 64px;
  --admin-tabbar-h: 58px;
}

.admin-sidebar,
.admin-tabbar,
.admin-public-link {
  display: none;
}

@media (max-width: 520px) {
  .price-feed-operations-panel > summary .status-badge {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: center;
    line-height: 1.2;
  }

  #productList .management-table-v2 .compact-check,
  #productList .management-responsive-selection .compact-check {
    min-height: 44px;
  }

  #productList .management-table-v2 .cell-select .touch-check {
    display: inline-flex;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
  }
}

.app-error-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  color: var(--ink);
  border-color: rgba(176, 42, 55, 0.42);
  background: #fffafb;
}

.app-error-card:focus-visible,
.settings-conflict-card:focus-visible {
  outline: 3px solid rgba(91, 45, 155, 0.24);
  outline-offset: 3px;
}

.app-error-card-copy {
  min-width: 0;
}

.app-error-card-copy h2 {
  color: #8f2030;
}

.app-error-card-copy p {
  color: var(--muted);
}

.app-error-request-id {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 12px;
}

.app-error-request-id code {
  overflow-wrap: anywhere;
}

.app-error-card-actions {
  flex: none;
}

.admin-nav-tooltip {
  position: fixed;
  z-index: var(--z-toast);
  max-width: min(260px, calc(100vw - 16px));
  padding: 7px 10px;
  border-radius: 7px;
  background: #24143d;
  color: #fff;
  box-shadow: 0 8px 22px rgba(31, 24, 48, 0.24);
  font-size: 12px;
  font-weight: var(--weight-semibold);
  line-height: 1.4;
  pointer-events: none;
}

.admin-nav-tooltip[hidden] {
  display: none;
}

body[data-shell="admin"] {
  background: #f7f7fb;
}

body[data-shell="admin"] .topbar {
  width: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: var(--purple-900);
  min-height: var(--admin-topbar-h);
  padding: 6px 20px;
  top: 0;
  position: sticky;
}

body[data-shell="admin"] .brand {
  min-width: 0;
  color: #fff;
}

body[data-shell="admin"] .brand-main {
  font-size: 19px;
  color: #fff;
}

body[data-shell="admin"] .brand-sub {
  display: none;
}

body[data-shell="admin"] #mainNav {
  display: none;
}

body[data-shell="admin"] .admin-public-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius);
  color: #e4dcfa;
  font-size: 12.5px;
  font-weight: var(--weight-semibold);
  text-decoration: none;
  white-space: nowrap;
}

body[data-shell="admin"] .admin-public-link:hover,
body[data-shell="admin"] .admin-public-link:focus-visible {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.08);
}

body[data-shell="admin"] .account-trigger {
  background: rgba(255, 255, 255, 0.12);
  border-color: transparent;
  color: #fff;
}

body[data-shell="admin"] .account-trigger .account-trigger-label,
body[data-shell="admin"] .account-trigger .account-trigger-meta {
  color: #fff;
}

body[data-shell="admin"] .account-trigger .account-trigger-meta {
  color: rgba(255, 255, 255, 0.72);
}

body[data-shell="admin"] .nav-toggle {
  color: #fff;
}

body[data-shell="admin"] .login-strip {
  top: calc(var(--admin-topbar-h) + 10px);
  right: 16px;
}

/* Sidebar */
body[data-shell="admin"] .admin-sidebar {
  display: block;
  position: fixed;
  top: var(--admin-topbar-h);
  bottom: 0;
  left: 0;
  width: var(--admin-side-w);
  padding: 12px 10px 18px;
  background: var(--white);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  z-index: var(--z-header);
}

.admin-side-group {
  margin: 14px 12px 6px;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: #9aa0ae;
  font-weight: var(--weight-bold);
}

.admin-side-group:first-child {
  margin-top: 4px;
}

.admin-side-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
  padding: 8.5px 12px;
  border-radius: var(--radius);
  color: #3d4354;
  font-size: 13.5px;
  font-weight: var(--weight-medium);
  text-decoration: none;
  white-space: nowrap;
}

.admin-side-item svg {
  flex: none;
  color: #8a8fa3;
}

.admin-side-item:hover {
  background: #f7f2ff;
  color: var(--accent-hover);
}

.admin-side-item.active {
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-weight: var(--weight-bold);
}

.admin-side-item.active svg {
  color: var(--accent);
}

.admin-side-item.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 2px;
  background: var(--accent);
}

/* Content area sits beside the fixed sidebar */
body[data-shell="admin"] main {
  width: auto;
  max-width: none;
  margin: 0 0 48px var(--admin-side-w);
  padding: 18px 24px 0;
}

body[data-shell="admin"] .page {
  scroll-margin-top: calc(var(--admin-topbar-h) + 8px);
}

body[data-shell="admin"] .toast {
  right: 24px;
  top: calc(var(--admin-topbar-h) + 16px);
  left: auto;
  bottom: auto;
  max-width: min(420px, calc(100vw - 48px));
  transform: translateY(-8px);
}

body[data-shell="admin"] .toast.show {
  transform: translateY(0);
}

@media (min-width: 981px) {
  body[data-shell="admin"]:has(#reservationModal:not(.hidden)) .toast {
    /* Keep transient operation feedback clear of the reservation status and
       close controls in the modal's upper-right action area. */
    right: clamp(184px, 18vw, 280px);
  }
}

/* Compact tier remains active until the full sidebar and wide inventory filter
   can both fit without making the content area narrower on the next pixel. */
@media (max-width: 1155px) {
  body[data-shell="admin"] .admin-sidebar {
    width: var(--admin-side-w-compact);
    padding: 10px 8px 16px;
  }

  body[data-shell="admin"] .admin-side-group {
    margin: 12px 0 4px;
    text-align: center;
    letter-spacing: 0;
    font-size: 12px;
  }

  body[data-shell="admin"] .admin-side-item {
    justify-content: center;
    padding: 10px 0;
  }

  body[data-shell="admin"] .admin-side-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  body[data-shell="admin"] .admin-side-item.active::before {
    left: -6px;
  }

  body[data-shell="admin"] main {
    margin-left: var(--admin-side-w-compact);
    padding: 16px 18px 0;
  }
}

/* Mobile tier: hamburger drawer + opaque bottom tabbar */
@media (max-width: 980px) {
  body[data-shell="admin"] .topbar {
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    padding: 6px 12px;
  }

  body[data-shell="admin"] .admin-public-link {
    display: none;
  }

  body[data-shell="admin"] .admin-sidebar {
    top: var(--admin-topbar-h);
    bottom: 0;
    width: min(300px, 84vw);
    box-shadow: var(--shadow-strong);
    transform: translateX(-100%);
    visibility: hidden;
    transition:
      transform var(--motion-panel) var(--ease-out),
      visibility 0s linear var(--motion-panel);
    z-index: var(--z-drawer);
  }

  body[data-shell="admin"] .topbar.nav-open ~ .admin-sidebar {
    transform: translateX(0);
    visibility: visible;
    transition-delay: 0s;
  }

  body[data-shell="admin"] .admin-side-item {
    min-height: 44px;
    justify-content: flex-start;
    padding: 10px 12px;
  }

  body[data-shell="admin"] .admin-side-label {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    overflow: visible;
    clip: auto;
    white-space: nowrap;
  }

  body[data-shell="admin"] .admin-side-group {
    margin: 14px 12px 6px;
    text-align: left;
    letter-spacing: 0.14em;
    font-size: 12px;
  }

  body[data-shell="admin"] main {
    margin-left: 0;
    padding: 12px 12px calc(var(--admin-tabbar-h) + 16px);
  }

  body[data-shell="admin"] .admin-tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--admin-tabbar-h);
    background: var(--white);
    border-top: 1px solid var(--line);
    box-shadow: 0 -6px 18px rgba(32, 26, 43, 0.08);
    z-index: var(--z-header);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  body[data-shell="admin"] .admin-tabbar .admin-tab-item:is(
    [data-admin-nav="inventory"],
    [data-admin-nav="accounts"]
  ) {
    display: none !important;
  }

  body[data-shell="admin"] .topbar.nav-open ~ .admin-tabbar,
  body[data-shell="admin"].catalog-filter-drawer-open .admin-tabbar {
    visibility: hidden;
    pointer-events: none;
  }

  body[data-shell="admin"] .toast {
    top: auto;
    right: 12px;
    left: 12px;
    bottom: calc(var(--admin-tabbar-h) + 12px + env(safe-area-inset-bottom, 0px));
    width: auto;
    max-width: calc(100vw - 24px);
  }

  body[data-shell="admin"] main {
    scroll-padding-top: calc(var(--admin-topbar-h) + 12px);
  }

  body[data-shell="admin"] :is(.panel, .alert-card, [role="alert"], [tabindex="-1"]) {
    scroll-margin-top: calc(var(--admin-topbar-h) + 12px);
  }

  body[data-shell="admin"] :is(.iam-action-error-summary, .settings-conflict-card) {
    display: grid;
  }

  body[data-shell="admin"] :is(.iam-action-error-summary, .settings-conflict-card) .app-error-card-actions,
  body[data-shell="admin"] .settings-conflict-card .compact-buttons {
    width: 100%;
  }

  body[data-shell="admin"] :is(.iam-action-error-summary, .settings-conflict-card) button {
    width: 100%;
  }

  .admin-tab-item {
    flex: 1 1 0;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 2px;
    min-width: 0;
    color: #5d6575;
    font-size: 12px;
    font-weight: var(--weight-semibold);
    text-decoration: none;
  }

  .admin-tab-item svg {
    color: #8a8fa3;
  }

  .admin-tab-item.active {
    color: var(--accent-hover);
  }

  .admin-tab-item.active svg {
    color: var(--accent);
  }

  .admin-tab-item.hidden {
    display: none;
  }

  body[data-shell="admin"] .site-footer {
    display: none;
  }

  .admin-nav-tooltip {
    display: none;
  }
}

@media (max-width: 640px) {
  .app-error-card {
    display: grid;
  }

  .app-error-card-actions,
  .app-error-card-actions button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-shell="admin"] .admin-sidebar {
    transition: none;
  }
}

body[data-shell="admin"] .header-auth-actions {
  justify-self: end;
}

body[data-shell="admin"] .account-trigger {
  min-height: 42px;
  border-color: transparent;
}

body[data-shell="admin"] .account-trigger:hover,
body[data-shell="admin"] .account-trigger[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
}

body[data-shell="admin"] .nav-toggle,
body[data-shell="admin"] .nav-toggle:hover {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

/* ==========================================================================
   Phase 5: internal pages aligned to concept finals 09-16
   ========================================================================== */

/* 16 owner inquiries: master list + detail */
.feedback-master-detail {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 2.1fr);
  gap: 14px;
  align-items: start;
  margin-top: 12px;
}

.feedback-list-column {
  display: grid;
  gap: 8px;
}

.feedback-list-row {
  display: grid;
  gap: 4px;
  justify-items: start;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--black);
  box-shadow: none;
  min-height: 0;
}

.feedback-list-row:hover {
  border-color: rgba(109, 40, 217, 0.28);
  background: #f7f2ff;
}

.feedback-list-row.active {
  border-color: rgba(109, 40, 217, 0.4);
  background: var(--accent-soft);
}

.feedback-list-row .feedback-row-title {
  font-weight: var(--weight-bold);
  overflow-wrap: anywhere;
}

.feedbackReplyForm .feedback-visibility-field {
  grid-column: 1 / -1;
  width: min(100%, 280px);
  min-width: 0;
}

.feedbackReplyForm select[name="visibility"] {
  width: 100%;
  min-width: 0;
}

@media (max-width: 1100px) {
  .feedback-master-detail {
    grid-template-columns: 1fr;
  }
}

/* 11 identity review cards */
.identity-queue-head-badges,
.identity-queue-mode,
.identity-review-status-line,
.identity-review-evidence-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.identity-queue-mode {
  justify-content: space-between;
  margin-bottom: 12px;
}

.identity-queue-empty {
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  text-align: center;
}

.identity-review-list {
  display: grid;
  gap: 12px;
}

.identity-review-card {
  display: grid;
  grid-template-columns: minmax(190px, 0.7fr) minmax(320px, 1.2fr) minmax(220px, 0.8fr);
  grid-template-areas:
    "applicant evidence documents"
    "actions actions actions";
  gap: 16px;
  align-items: start;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--white);
}

.identity-review-card.is-historical {
  border-style: dashed;
  background: var(--surface-muted);
}

.identity-review-applicant {
  grid-area: applicant;
}

.identity-review-name {
  display: grid;
  gap: 2px;
  margin-bottom: 8px;
}

.identity-review-facts {
  display: grid;
  gap: 6px;
  margin: 0;
}

.identity-review-facts div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.identity-review-facts dt {
  flex: none;
  min-width: 84px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: var(--weight-semibold);
}

.identity-review-facts dd {
  margin: 0;
}

.identity-review-documents {
  grid-area: documents;
  display: grid;
  gap: 8px;
  align-content: start;
}

.identity-review-evidence {
  grid-area: evidence;
  display: grid;
  gap: 8px;
  min-width: 0;
}

.identity-review-evidence-head {
  justify-content: space-between;
}

.identity-profile-comparison {
  display: grid;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.identity-profile-row {
  display: grid;
  grid-template-columns: minmax(74px, 0.6fr) repeat(2, minmax(90px, 1fr));
}

.identity-profile-row > * {
  min-width: 0;
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.identity-profile-row > * + * {
  border-left: 1px solid var(--line);
}

.identity-profile-row:last-child > * {
  border-bottom: 0;
}

.identity-profile-header {
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: var(--weight-semibold);
}

.identity-profile-row.is-changed {
  background: #fff4e5;
}

.identity-review-hashes {
  display: grid;
  gap: 5px;
  margin: 0;
  font-size: 12px;
}

.identity-review-hashes div {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 6px;
}

.identity-review-hashes dt {
  color: var(--muted);
  font-weight: var(--weight-semibold);
}

.identity-review-hashes dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.identity-review-hashes code {
  white-space: normal;
  overflow-wrap: anywhere;
}

.identity-review-actions {
  grid-area: actions;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-content: start;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.identity-review-visibility-note,
.identity-review-feedback,
.identity-review-decision-buttons,
.identity-review-readonly {
  grid-column: 1 / -1;
}

.identity-review-reason {
  display: grid;
  gap: 4px;
  font-size: 12.5px;
  font-weight: var(--weight-semibold);
  color: var(--muted);
}

.identity-review-reason textarea {
  min-height: 60px;
}

.identity-review-events {
  font-size: 12.5px;
}

.identity-review-events summary {
  cursor: pointer;
  font-weight: var(--weight-semibold);
}

.identity-review-events ol {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding-inline-start: 20px;
}

.identity-review-events li {
  display: grid;
  gap: 2px;
}

.identity-review-readonly,
.identity-review-visibility-note {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.identity-review-readonly p {
  margin: 4px 0 0;
}

.identity-session-card .identity-review-checklist label > span {
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.identity-session-card .identity-review-checklist {
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.identity-session-card .identity-review-checklist legend {
  grid-column: 1 / -1;
}

.btn-danger-secondary {
  background: var(--white);
  color: var(--red);
  border: 1px solid rgba(180, 35, 52, 0.4);
}

.btn-danger-secondary:hover {
  background: #fdecec;
  color: var(--red);
  border-color: rgba(180, 35, 52, 0.6);
}

@media (max-width: 1100px) {
  .identity-review-card {
    grid-template-columns: 1fr;
    grid-template-areas:
      "applicant"
      "evidence"
      "documents"
      "actions";
  }
}

@media (max-width: 700px) {
  .identity-session-card .identity-review-checklist {
    grid-template-columns: minmax(0, 1fr);
  }

  .identity-review-actions {
    grid-template-columns: 1fr;
  }

  .identity-review-reason,
  .identity-review-visibility-note,
  .identity-review-feedback,
  .identity-review-decision-buttons,
  .identity-review-readonly {
    grid-column: 1;
  }

  .identity-profile-row {
    grid-template-columns: minmax(66px, 0.55fr) repeat(2, minmax(72px, 1fr));
    font-size: 12px;
  }
}

/* 12 stocktake stat strip */
.stocktake-stat-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.stocktake-stat {
  display: grid;
  gap: 2px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--white);
}

.stocktake-stat span {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: var(--weight-semibold);
}

.stocktake-stat strong {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.stocktake-stat strong small {
  font-size: 12px;
  color: var(--muted);
  margin-left: 3px;
}

@media (max-width: 760px) {
  .stocktake-stat-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* 14 featured slots: status line + public preview band */
.featured-preview-band {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.featured-preview-cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.featured-preview-card {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  font-size: 12.5px;
}

.featured-preview-image {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 64px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f3f4f8;
  color: #8a8fa3;
  overflow: hidden;
}

.featured-preview-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.featured-preview-name {
  font-weight: var(--weight-bold);
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  min-height: 2.4em;
}

.featured-preview-condition {
  color: var(--muted);
}

.featured-preview-price {
  font-weight: var(--weight-bold);
  font-size: 14px;
}

.featured-rule-line {
  margin: 0;
  font-size: 12.5px;
}

@media (max-width: 1100px) {
  .featured-preview-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .featured-preview-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* 13 mail workspace step labels */
.mail-step-head {
  margin: 0 0 8px;
  font-size: 12.5px;
  font-weight: var(--weight-bold);
  color: var(--accent-hover);
  letter-spacing: 0.02em;
}

.feedback-list-row,
.feedback-list-row .feedback-row-title {
  color: var(--black);
}

.feedback-list-row.active,
.feedback-list-row.active .feedback-row-title {
  color: var(--accent-hover);
}

/* Phase 6: canonical status semantics (§3.2) — orange=todo, blue=in progress */
.status-badge.important,
.status-badge.warning {
  background: #fdf0e7;
  color: #c2540a;
  border-color: rgba(194, 84, 10, 0.3);
}

.status-badge.progress {
  background: #eaf2fd;
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.3);
}

.status-badge.danger-soft {
  background: #fff1f2;
  color: #9f1239;
  border-color: rgba(159, 18, 57, 0.28);
}

.status-badge.muted,
.status-badge.muted-cancelled {
  background: #f3f4f6;
  color: #4b5563;
  border-color: rgba(75, 85, 99, 0.26);
}

.status-badge.muted-abandoned {
  background: #eef2f7;
  color: #475569;
  border-color: rgba(71, 85, 105, 0.28);
}

.status-badge.muted-archived {
  background: #f8fafc;
  color: #64748b;
  border-color: rgba(100, 116, 139, 0.28);
}

/* Stocktake checklist (backend B) */
.stocktake-progress-strip {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.stocktake-stat strong.c-ok { color: #15803d; }
.stocktake-stat strong.c-todo { color: #c2540a; }

.stocktake-filter-row {
  margin-bottom: 12px;
}

.stocktake-launch-panel {
  margin-bottom: 12px;
}

.stocktake-line-list {
  display: grid;
  gap: 8px;
}

.stocktake-line {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) auto minmax(110px, 0.7fr) minmax(150px, 0.9fr) auto minmax(96px, auto);
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--white);
}

.stocktake-line.confirmed {
  background: #fbfcfd;
}

.stocktake-line-name {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.stocktake-line-name small {
  color: var(--muted);
}

.stocktake-line-book {
  white-space: nowrap;
  color: var(--muted);
}

.stocktake-line-book strong {
  color: var(--black);
  font-variant-numeric: tabular-nums;
}

.stocktake-line-count,
.stocktake-line-reason {
  display: grid;
  gap: 2px;
  font-size: 12px;
  font-weight: var(--weight-semibold);
  color: var(--muted);
}

.stocktake-line-count input,
.stocktake-line-reason select {
  min-height: 36px;
}

.stocktake-footer-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: 0 -6px 18px rgba(32, 26, 43, 0.08);
  z-index: var(--z-raised);
}

.stocktake-footer-bar .head-spacer {
  flex: 1;
}

.stocktake-blockers {
  font-size: 12.5px;
}

@media (max-width: 980px) {
  .stocktake-progress-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stocktake-line {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .stocktake-line-name {
    grid-column: 1 / -1;
  }

  body[data-shell="admin"] .stocktake-footer-bar {
    bottom: calc(var(--admin-tabbar-h) + 6px);
  }
}

/* Reservation workspace panel (backend A) */
.reservation-workspace-grid {
  align-items: end;
}

.reservation-workspace-grid textarea {
  min-height: 64px;
}
/* Catalog discovery, feedback, and artificial-appraisal journey. */
.catalog-result-summary {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 0 0 14px;
  color: var(--muted);
}

.catalog-result-summary strong {
  color: var(--black);
  font-size: 17px;
}

.catalog-skeleton {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.catalog-skeleton span {
  min-height: 280px;
  border-radius: var(--radius-lg);
  background: linear-gradient(100deg, #f2f0f5 20%, #faf9fb 38%, #f2f0f5 56%);
  background-size: 220% 100%;
  animation: catalog-skeleton 1.2s ease-in-out infinite;
}

@keyframes catalog-skeleton {
  to { background-position-x: -220%; }
}

.condition-compact-help {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.45;
}

.condition-guidance {
  grid-column: 1 / -1;
  min-width: 0;
  margin-top: 8px;
  color: var(--muted);
}

.condition-guidance summary {
  min-width: 0;
  cursor: pointer;
  color: var(--accent-hover);
  font-weight: 700;
  overflow-wrap: normal;
  word-break: keep-all;
}

.condition-guidance p,
.condition-guidance ul {
  margin: 8px 0 0;
}

.condition-unit-note {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.appraisal-next-step {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: #fff8e8;
  color: #66470e;
  line-height: 1.5;
}

.customer-product-identity h2 a {
  color: inherit;
  text-decoration: none;
}

.customer-product-identity h2 a:hover,
.customer-product-identity h2 a:focus-visible {
  text-decoration: underline;
}

.catalog-empty-state,
.product-detail-error {
  display: grid;
  justify-items: start;
  gap: 10px;
}

.customer-reservations-panel > .empty-state-actions {
  margin-block-start: var(--space-8, 32px);
}

.draft-sync-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0;
  padding: 9px 11px;
  border: 1px solid rgba(31, 24, 48, 0.14);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 13px;
}

.draft-sync-status.draft-sync-error {
  border-color: rgba(163, 36, 36, 0.4);
  background: #fff3f3;
  color: #7b1717;
}

.reservation-line-invalid {
  border-color: rgba(163, 36, 36, 0.45) !important;
  background: #fff8f8 !important;
}

.reservation-line-status {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.reservation-line-status.invalid {
  color: #a32424;
  font-weight: var(--weight-semibold);
}

.reservation-empty,
.catalog-unavailable-favorites {
  display: grid;
  justify-items: start;
  gap: 9px;
  padding: 14px;
  border: 1px dashed rgba(31, 24, 48, 0.22);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.reservation-empty:not(.compact),
.reservation-empty-state,
.feedback-empty-state,
.catalog-empty-state {
  margin-block-start: var(--space-8, 32px);
}

.reservation-empty-state,
.feedback-empty-state {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: var(--space-6, 24px);
  border: 1px dashed var(--ui-border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.reservation-empty.compact {
  padding: 10px;
  margin-block-start: 0;
}

.clear-cart-confirmation {
  width: min(520px, calc(100vw - 32px));
  margin-top: max(24px, 16vh);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

body.cart-drawer-modal-open::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: var(--z-backdrop);
  background: rgba(0, 0, 0, 0.5);
}

@media (max-width: 768px) {
  .cart-drawer[role="dialog"]:not(.collapsed) {
    z-index: var(--z-drawer);
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    overflow: hidden;
  }

  .cart-drawer[role="dialog"]:not(.collapsed) > .cart-toggle {
    display: none;
  }

  .reservation-item-selectors select {
    min-height: 44px;
  }

  .cart-drawer[role="dialog"]:not(.collapsed) .cart-body {
    max-height: calc(100dvh - 70px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .cart-drawer[role="dialog"]:not(.collapsed) .cart-items {
    max-height: min(48dvh, 430px);
  }

  .cart-drawer[role="dialog"] .cart-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
  }
}

@media (max-width: 480px) {
  .reservation-group-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 768px) {
  .catalog-skeleton { grid-template-columns: 1fr; }
  .topbar .nav {
    z-index: var(--z-header);
    max-height: min(66vh, 420px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  [data-page="catalog"] {
    min-width: 0;
    overflow-x: clip;
  }
}

@media (min-width: 769px) {
  [data-page="catalog"] .catalog-filter-shell,
  [data-page="catalog"] .product-area {
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .catalog-skeleton span { animation: none; }
}

/* Header controls share the same vertical rhythm at every viewport. */
.header-auth-actions {
  align-items: center;
}

.nav-toggle,
.account-trigger,
.header-register-button {
  height: var(--ui-control-h);
  min-height: var(--ui-control-h);
}

.account-trigger {
  padding: 4px 12px;
}

.account-trigger-label {
  font-size: var(--text-sm, 14px);
  line-height: 1.15;
}

.account-trigger-meta {
  font-size: var(--text-xs, 12px);
  line-height: 1.1;
}

@media (max-width: 768px) {
  :root {
    --ui-control-h: 44px;
    --ui-control-h-compact: 44px;
  }

  .nav-toggle {
    width: 44px;
    min-width: 44px;
  }

  .account-trigger {
    min-width: 116px;
  }
}

/* Catalog mobile touch-target contract: keep the high-frequency operator
   controls reachable even when the emulated pointer remains fine. */
@media (max-width: 768px) {
  body[data-shell="admin"] .brand,
  body[data-shell="admin"] .account-trigger {
    min-height: 44px;
  }

  body[data-shell="admin"] .nav-toggle,
  body[data-shell="admin"] .nav-toggle:hover {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }

  [data-page="catalog"] :is(
    button,
    select,
    input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"])
  ) {
    min-height: 44px;
  }

  [data-page="catalog"] button {
    min-width: 44px !important;
  }

  #productList .management-table-wrap:not(.compact-category-table)
    .management-table-v2 .management-row .management-action-grid button,
  #productList .management-table-v2 .state-expand-button,
  .batch-tools-v2 button,
  .pagination-buttons button {
    min-width: 44px;
    min-height: 44px;
  }

  #productList .management-table-v2 :is(
    input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
    select
  ) {
    min-height: 44px;
  }
}

@media (max-width: 520px) {
  body.catalog-filter-drawer-open {
    overflow: hidden;
    overscroll-behavior: none;
  }

  .catalog-filter-toggle {
    display: inline-flex;
    justify-self: start;
    min-height: 44px;
  }

  .catalog-filter-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: var(--z-backdrop);
    width: 100%;
    min-height: 100%;
    border: 0;
    border-radius: 0;
    background: rgba(20, 16, 30, 0.42);
  }

  #categoryFilters:not(.catalog-filters-open) {
    display: none;
  }

  #categoryFilters.catalog-filters-open {
    position: fixed;
    inset: 76px 8px 8px;
    z-index: var(--z-drawer);
    display: grid;
    gap: 8px;
    align-content: start;
    max-height: calc(100dvh - 84px);
    overflow: auto;
    overscroll-behavior: contain;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  #categoryFilters.catalog-filters-open .category-center {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    overflow: visible;
  }

  .catalog-filter-drawer-head {
    position: sticky;
    top: -8px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: -8px -8px 0;
    padding: 8px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
  }

  .catalog-filter-close {
    flex: none;
  }
}

/* Customer catalog cards keep selection details on the detail route while
   retaining one compact reservation action for the common path. */
.customer-product-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  content-visibility: visible;
  contain-intrinsic-size: none;
  padding: 0;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--line) 86%, transparent);
  border-radius: var(--radius-lg, 14px);
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(32, 26, 43, 0.08);
  transition:
    transform var(--motion-control) var(--ease-out),
    border-color var(--motion-control) var(--ease-standard),
    box-shadow var(--motion-control) var(--ease-standard);
}

.customer-product-card-link {
  display: block;
  height: auto;
  flex: 1 1 auto;
  min-width: 0;
  padding: 14px 14px 10px;
  color: inherit;
  text-decoration: none;
}

/* Catalog filter controls and category hubs use the shared touch/control token
   so one toolbar does not mix 42px selects, 44px fields, and 52px buttons. */
[data-page="catalog"] .catalog-filter-shell :is(input, select, button):not(.catalog-filter-backdrop),
[data-page="catalog"] .category-hub-main {
  height: var(--ui-control-h);
  min-height: var(--ui-control-h);
}

.customer-product-card-link:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 64%, white);
  outline-offset: -3px;
}

.customer-product-card-link .customer-product-summary {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: stretch;
  gap: 14px;
  min-width: 0;
}

.customer-product-card-link .product-thumb {
  width: 100%;
  height: 132px;
  min-width: 0;
  min-height: 0;
  aspect-ratio: auto;
  padding: 6px;
  border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  border-radius: var(--radius-md);
  background: var(--white);
}

.customer-product-card-link .product-thumb picture {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
}

.customer-product-card-link .product-thumb img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: transparent;
}

.customer-product-card-link .customer-product-identity {
  display: grid;
  min-height: 132px;
  align-content: start;
  gap: 6px;
  padding: 0;
}

.customer-product-card-link .product-card-top {
  min-width: 0;
  min-height: 18px;
  padding-right: 40px;
  color: var(--muted);
  font-size: var(--text-xs, 13px);
  line-height: 1.2;
}

.customer-product-card-link h2 {
  min-height: 65px;
  margin: 0;
  font-size: var(--text-md, 16px);
  line-height: 1.35;
  -webkit-line-clamp: 3;
}

.customer-product-card-link .public-reference-price {
  display: grid;
  align-content: center;
  gap: 2px;
  min-height: 48px;
  margin-top: auto;
  padding: 7px 0 0;
  border: 0;
  border-top: 1px solid color-mix(in srgb, var(--line) 76%, transparent);
  border-radius: 0;
  background: transparent;
}

.customer-product-card-link .public-reference-price strong {
  color: var(--accent-strong);
  font-size: var(--text-lg, 18px);
  line-height: 1.15;
}

.customer-product-card-link .public-reference-price span {
  color: var(--muted);
  font-size: var(--text-2xs, 12px);
  line-height: 1.25;
}

.customer-product-card-link .product-card-condition {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
  margin: 0;
  color: var(--muted);
  font-size: var(--text-2xs, 12px);
  line-height: 1.2;
}

.customer-product-card-link .product-card-condition strong {
  color: var(--ink);
  font-weight: var(--weight-semibold);
}

.customer-product-card-link .product-card-condition small {
  font-size: inherit;
}

.customer-product-card .favorite-icon-button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  top: 8px;
  right: 8px;
}

.customer-card-actions {
  display: grid;
  padding: 0 14px 14px;
}

.customer-card-actions > .card-reserve-button {
  display: inline-flex;
  width: 100%;
  min-height: var(--ui-control-h);
  height: var(--ui-control-h);
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

@media (hover: hover) and (pointer: fine) {
  .customer-product-card:hover {
    border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
    box-shadow: 0 16px 34px rgba(32, 26, 43, 0.13);
    transform: translateY(-2px);
  }
}

.refined-public-detail .detail-actions > .detail-text-link {
  grid-column: 1 / -1;
  justify-self: start;
}

/* F17: keep the row's two common actions visible and move risky/rare actions
   into one compact, keyboard-operable overflow menu. */
#productList .management-table-v2 .management-action-grid {
  display: flex !important;
  align-items: center;
  flex-wrap: nowrap;
  gap: 4px;
}

#productList .batch-tool-button {
  min-width: 108px;
}

.batch-tool-button {
  min-width: 108px;
}

.batch-tools-v2 .batch-tool-button {
  min-width: 108px;
}

.batch-tools.grouped .batch-tool-button {
  min-width: 108px;
}

#productList .management-table-v2 .management-action-grid > button {
  width: auto;
  flex: 0 1 auto;
  min-width: var(--ui-control-h);
  min-height: var(--ui-control-h);
  height: var(--ui-control-h);
}

#productList .management-table-v2 .management-overflow {
  position: relative;
  flex: 0 0 var(--ui-control-h);
}

#productList .management-table-v2 .management-overflow > summary {
  display: grid;
  width: var(--ui-control-h);
  min-width: var(--ui-control-h);
  min-height: var(--ui-control-h);
  height: var(--ui-control-h);
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}

#productList .management-table-v2 .management-overflow > summary::-webkit-details-marker {
  display: none;
}

#productList .management-table-v2 .management-overflow > summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 65%, white);
  outline-offset: 2px;
}

#productList .management-table-v2 .management-overflow-menu {
  position: absolute;
  z-index: var(--z-drawer);
  top: calc(100% + 4px);
  right: 0;
  display: grid;
  min-width: 132px;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--white);
  box-shadow: var(--shadow-lg, 0 12px 28px rgba(31, 24, 48, .16));
}

#productList .management-table-v2 .management-overflow-menu button {
  width: 100%;
  min-width: 44px;
  min-height: 44px;
  white-space: nowrap;
}

/* F4: keep mobile navigation and detail toolbar controls in the same
   touch-target contract as the rest of the public surface. */
@media (max-width: 520px) {
  .topbar .nav a,
  .refined-public-detail .detail-toolbar button {
    min-height: 44px;
    height: 44px;
  }

  #reservationForm :is(input:not([type="checkbox"]):not([type="radio"]), select, button) {
    min-height: 44px;
    height: 44px;
  }

  #reservationForm .time-slot {
    min-height: 50px;
    height: auto;
  }

  #reservationForm .reservation-submit-help a,
  #reservationForm .reservation-empty a {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
  }
}

/* F19: a valid empty result stays compact while diagnostic/error states keep
   room for their recovery guidance and action. */
.catalog-resource-empty-catalog,
.catalog-resource-empty-filter {
  gap: 4px;
  padding: 12px;
}

/* Lifecycle and staff reservation controls share the same visible control
   contract as the public reservation form. */
.reservation-date-filters :is(input, select, button),
.reservation-action-card :is(input, select, button) {
  min-height: var(--ui-control-h);
  height: var(--ui-control-h);
}

.reservation-item-table :is(input, select, button) {
  min-height: var(--ui-control-h);
  height: var(--ui-control-h);
}

.payout-operation-form :is(input, select, button) {
  min-height: var(--ui-control-h);
  height: var(--ui-control-h);
}

.internal-reservation-items :is(th:last-child, td:last-child) {
  min-width: 144px;
}

.chip-row .chip,
.staff-reservation-table .compact-buttons :is(a, button),
.modal-close {
  min-height: 44px;
  height: 44px;
}

.modal-close {
  min-width: 44px;
  width: 44px;
}

/* V3: all section tabs use one quiet underline treatment instead of five
   competing button styles. */
:is(.staff-tabs, .admin-product-tabs, .admin-settings-tabs, .analytics-subnav, .customer-member-tabs, .email-workspace-tabs) > button {
  min-height: var(--ui-control-h-compact);
  height: auto;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

:is(.staff-tabs, .admin-product-tabs, .admin-settings-tabs, .analytics-subnav, .customer-member-tabs, .email-workspace-tabs) > button:hover:not(.active),
:is(.staff-tabs, .admin-product-tabs, .admin-settings-tabs, .analytics-subnav, .customer-member-tabs, .email-workspace-tabs) > button.active {
  border-color: transparent;
  border-bottom-color: var(--accent);
  background: transparent;
  color: var(--accent);
  box-shadow: none;
}

input[type="date"] {
  min-height: var(--ui-control-h);
  height: var(--ui-control-h);
}

.product-page-content .merchant-card {
  border-left-color: var(--line);
  background: var(--white);
}

.analytics-alert-empty {
  margin: 16px 0;
  border-color: var(--line);
  background: var(--surface-raised);
}

.analytics-alert-empty h3,
.analytics-alert-empty p {
  margin-top: 0;
}

.inventory-history-loading {
  min-height: 520px;
}

.inventory-history-skeleton {
  display: grid;
  gap: 10px;
  padding-top: 12px;
}

.inventory-history-skeleton-row {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1.6fr .75fr;
  gap: 10px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--surface-muted), var(--surface-raised), var(--surface-muted));
  background-size: 200% 100%;
  animation: member-skeleton-shimmer 1.8s linear infinite;
}

.inventory-history-skeleton-row span {
  display: block;
  align-self: center;
  height: 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 18%, transparent);
}

@media (prefers-reduced-motion: reduce) {
  .inventory-history-skeleton-row {
    animation: none;
  }
}

.workbench-source-grid {
  align-items: start;
}

@media (max-width: 980px) {
  body[data-shell="admin"] {
    padding-bottom: calc(var(--admin-tabbar-h) + 16px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 520px) {
  #productList .management-table-wrap:not(.compact-category-table) .management-row,
  #productList .management-table-v2 .management-row {
    grid-template-columns: 60px 60px minmax(0, 1fr);
  }

  #productList .management-table-v2 .cell-price,
  #productList .management-table-v2 .cell-payment,
  #productList .management-table-v2 .cell-actions {
    grid-column: 1 / -1;
    grid-row: auto;
    border-right: 0;
  }

  #productList .management-table-v2 .cell-select {
    min-width: 60px;
    padding-inline: 4px;
  }
}

/* --------------------------------------------------------------------------
   Lifecycle L3 layout remediation

   One late-loading owner for the cross-role lifecycle defects recorded as
   P1-001, P1-018--P1-021, P1-028, P1-030, P1-032, and P1-033.  Wide tables
   keep their operational geometry inside explicit scroll owners; no document-
   wide min-width or overflow clipping is used to conceal layout defects.
   -------------------------------------------------------------------------- */

/* P1-018: every major grid/flex child may shrink, while genuinely wide tables
   scroll in their nearest operational surface instead of widening the page. */
:where(
  main,
  .page,
  .staff-section-body,
  .panel,
  .panel-head,
  .dashboard-grid,
  .form-grid,
  .compact-form,
  .info-grid,
  .analytics-shell,
  .inventory-section-stack,
  .table-scroll,
  .reservation-item-table-wrap,
  #reservationDetailContent
) {
  min-width: 0;
  max-width: 100%;
}

:where(
  .page,
  .staff-section-body,
  .panel,
  .panel-head,
  .dashboard-grid,
  .form-grid,
  .compact-form,
  .info-grid,
  .analytics-shell,
  .inventory-section-stack,
  #reservationDetailContent
) > * {
  min-width: 0;
}

:where(input, select, textarea) {
  max-width: 100%;
}

:where(.table-scroll, .reservation-item-table-wrap) {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

body[data-shell="admin"] main {
  min-width: 0;
  max-width: calc(100vw - var(--admin-side-w));
}

body[data-shell="admin"] :where(.page, .staff-section-body, .panel) {
  min-width: 0;
  max-width: 100%;
}

.panel-head {
  flex-wrap: wrap;
}

.panel-head > :first-child {
  flex: 1 1 280px;
  min-width: 0;
}

.panel-head :is(h1, h2, h3, p),
.reservation-detail-head :is(h1, h2, h3, p),
.reservation-summary-card :is(dt, dd) {
  overflow-wrap: anywhere;
}

.login-strip {
  isolation: isolate;
  max-width: calc(100vw - 24px);
  background: var(--white);
  opacity: 1;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.login-strip :where(.login-form, .login-field, .password-field, .auth-support-row, .auth-registration-cta) {
  min-width: 0;
  max-width: 100%;
}

.login-strip :where(.auth-readiness-notice, .field-help, .text-button, .auth-registration-cta span) {
  overflow-wrap: anywhere;
}

/* P1-020: the reservation detail owns a definite viewport-bounded scrollport.
   Nested tables retain local horizontal scrolling without clipping the dialog. */
#reservationModal {
  overflow: hidden;
}

#reservationModal .modal-panel {
  box-sizing: border-box;
  width: min(1280px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 32px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

#reservationDetailContent,
#reservationDetailContent > *,
.reservation-detail-head,
.reservation-detail-head > *,
.reservation-detail-summary,
.reservation-summary-card,
.reservation-summary-card dl,
.reservation-summary-card dl > div,
.reservation-summary-card dd,
.reservation-action-layout,
.reservation-action-layout > * {
  min-width: 0;
  max-width: 100%;
}

.reservation-detail-head {
  display: flex;
  flex-wrap: wrap;
}

/* Keep programmatic heading focus visible without making the reservation title
   look like a full-width text input. */
#reservationModalTitle {
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  border-radius: 4px;
}

#reservationModalTitle:focus-visible {
  outline: 2px solid #6b36c9;
  outline-offset: 3px;
}

.reservation-summary-card dl > div {
  grid-template-columns: minmax(88px, 104px) minmax(0, 1fr);
}

.reservation-item-table-wrap {
  position: relative;
}

/* P1-021: the native identity dialog is a three-row viewport container. */
.identity-attachment-viewer {
  box-sizing: border-box;
  width: min(1100px, calc(100vw - 24px));
  height: min(820px, calc(100dvh - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px);
  overflow: hidden;
}

.identity-attachment-viewer[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.identity-viewer-head,
.identity-viewer-controls,
.identity-viewer-head > *,
.identity-viewer-controls > * {
  min-width: 0;
  max-width: 100%;
}

.identity-viewer-head h2 {
  flex: 1 1 auto;
  min-width: 0;
  font-size: clamp(17px, 2.2vw, 24px);
  line-height: 1.25;
}

.identity-viewer-head > button {
  flex: 0 0 auto;
}

.identity-viewer-stage {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-height: none;
  margin: 12px 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.identity-viewer-stage img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.identity-viewer-controls {
  justify-content: center;
  flex-wrap: wrap;
}

/* P1-028: compact filters plus a fixed, scannable desktop inventory matrix. */
.inventory-filter-controls {
  gap: 10px;
  padding: 10px 12px;
}

.inventory-main-panel,
.inventory-events-panel {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
}

.inventory-stock-table {
  width: 100%;
  min-width: 940px;
  table-layout: fixed;
}

.inventory-stock-table th,
.inventory-stock-table td {
  padding: 9px 8px;
}

.inventory-stock-table th {
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
}

.inventory-stock-table td {
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.inventory-stock-table :is(th, td):nth-child(1) { width: 25%; min-width: 0; }
.inventory-stock-table :is(th, td):nth-child(2) { width: 13%; }
.inventory-stock-table :is(th, td):nth-child(3) { width: 11%; }
.inventory-stock-table :is(th, td):nth-child(4) { width: 11%; }
.inventory-stock-table :is(th, td):nth-child(5) { width: 7%; text-align: right; }
.inventory-stock-table :is(th, td):nth-child(6) { width: 11%; text-align: right; }
.inventory-stock-table :is(th, td):nth-child(7) { width: 12%; }
.inventory-stock-table :is(th, td):nth-child(8) { width: 10%; }

/* P1-001: retain the full IAM data in title/accessible text while making the
   common scan path compact and the action column predictable. */
.iam-account-list .table-scroll {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}

.iam-account-table {
  width: 100%;
  min-width: 960px;
  table-layout: fixed;
}

.iam-account-table :is(th, td) {
  min-width: 0;
  padding: 8px;
  font-size: 13px;
  line-height: 1.4;
}

.iam-account-table :is(th, td):nth-child(1) { width: 22%; }
.iam-account-table :is(th, td):nth-child(2) { width: 12%; }
.iam-account-table :is(th, td):nth-child(3) { width: 18%; }
.iam-account-table :is(th, td):nth-child(4) { width: 26%; }
.iam-account-table :is(th, td):nth-child(5) { width: 22%; }

.iam-account-table td > small[title] {
  display: -webkit-box;
  max-height: 4.2em;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow-wrap: anywhere;
}

.iam-account-table select {
  width: 100%;
  min-width: 0;
  margin-bottom: 6px;
}

.iam-row-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
  gap: 6px;
}

.iam-row-actions > :is(button, .iam-irreversible-action, [data-iam-action-error]) {
  min-width: 0;
}

.iam-row-actions > button {
  width: 100%;
  padding-inline: 7px;
  white-space: normal;
}

.iam-row-actions > :is(.iam-irreversible-action, [data-iam-action-error]) {
  grid-column: 1 / -1;
}

/* P1-030: feedback stays compact and, when a reservation dialog is open,
   occupies the unused top row to the left of the sticky close control. */
.toast {
  max-width: min(380px, calc(100vw - 24px));
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.45;
  text-align: left;
  overflow-wrap: anywhere;
}

body:has(#reservationModal:not(.hidden)) .toast {
  top: max(12px, env(safe-area-inset-top));
  right: 68px;
  bottom: auto;
  left: auto;
  width: auto;
  max-width: min(360px, calc(100vw - 84px));
  transform: translateY(-6px);
}

body:has(#reservationModal:not(.hidden)) .toast.show {
  transform: translateY(0);
}

/* P1-033: final-price controls read as currency rather than raw number fields;
   the existing unsaved-detail state provides an explicit adjustment cue. */
.reservation-currency-input {
  position: relative;
  display: block;
  width: 100%;
}

.reservation-currency-symbol {
  position: absolute;
  top: 50%;
  left: 10px;
  z-index: 1;
  color: var(--muted);
  font-weight: var(--weight-semibold);
  line-height: 1;
  pointer-events: none;
  transform: translateY(-50%);
}

.internal-reservation-items input[data-final-price] {
  padding-inline: 28px 8px;
  border-color: color-mix(in srgb, var(--accent) 28%, var(--line));
  background: color-mix(in srgb, var(--accent-soft) 32%, white);
  font-variant-numeric: tabular-nums;
  font-weight: var(--weight-semibold);
  text-align: right;
}

.internal-reservation-items input[data-final-qty],
.internal-reservation-items [data-final-line],
.internal-reservation-items [data-final-grand-total],
.internal-reservation-items [data-final-price-value] {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.internal-reservation-items input[data-final-price]:focus-visible {
  border-color: var(--accent);
  background: var(--white);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

#reservationDetailContent[data-unsaved-reservation="true"] .reservation-item-table-wrap {
  border-color: color-mix(in srgb, var(--amber) 54%, var(--line));
  box-shadow: inset 4px 0 color-mix(in srgb, var(--amber) 78%, var(--accent));
}

/* Tablet ownership: two-column summaries and compact catalog media. */
@media (max-width: 1155px) and (min-width: 981px) {
  body[data-shell="admin"] main {
    max-width: calc(100vw - var(--admin-side-w-compact));
  }
}

@media (min-width: 1156px) {
  .inventory-filter-controls {
    grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(130px, 1fr)) auto;
    align-items: end;
  }

  .inventory-filter-controls > label.wide {
    grid-column: 1 / span 2;
  }

  .inventory-filter-controls > .wide.muted-text {
    grid-column: 1 / 5;
    align-self: center;
    margin: 0;
    font-size: 12px;
  }

  .inventory-filter-controls > button.wide {
    grid-column: 5;
    min-width: 160px;
    margin: 0;
  }
}

@media (max-width: 1155px) and (min-width: 761px) {
  .inventory-filter-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inventory-filter-controls > .wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 980px) {
  body[data-shell="admin"] main {
    max-width: 100vw;
  }

  .login-strip {
    --login-strip-top-offset: 78px;
    top: calc(var(--login-strip-top-offset) + env(safe-area-inset-top));
    right: auto;
    left: 50%;
    width: min(560px, calc(100vw - 20px));
    max-width: calc(100vw - 20px);
    max-height: calc(100dvh - var(--login-strip-top-offset) - 10px - env(safe-area-inset-top));
    transform: translateX(-50%);
    transform-origin: top center;
  }

  .login-strip.motion-enter,
  .login-strip.motion-leave {
    opacity: 1;
    transform: translate(-50%, -6px);
  }

  #reservationModal .modal-panel {
    width: calc(100vw - 16px);
    height: calc(100dvh - 16px);
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    margin: 8px auto;
  }

  .reservation-detail-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reservation-detail-summary > :last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .customer-product-card-link .customer-product-summary {
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 12px;
  }

  .customer-product-card-link .product-thumb {
    height: 104px;
  }

  .customer-product-card-link .customer-product-identity {
    min-height: 104px;
  }
}

@media (max-width: 760px) {
  .inventory-main-panel,
  .inventory-events-panel {
    width: 100%;
    overflow: visible;
  }

  .inventory-stock-table {
    display: block;
    width: 100%;
    min-width: 0;
    table-layout: auto;
  }

  .inventory-stock-table :is(th, td):nth-child(n) {
    width: auto;
    text-align: left;
  }

  .inventory-filter-controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .inventory-filter-controls > .wide {
    grid-column: 1;
  }

}

@media (max-width: 680px) {
  .reservation-detail-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .reservation-detail-summary > * {
    grid-column: 1 !important;
  }

  .reservation-summary-card dl > div {
    grid-template-columns: minmax(80px, 96px) minmax(0, 1fr);
    gap: 8px;
  }
}

@media (max-width: 600px) {
  .login-strip {
    top: calc(70px + env(safe-area-inset-top));
    right: 6px;
    bottom: max(6px, env(safe-area-inset-bottom));
    left: 6px;
    width: auto;
    max-width: none;
    height: auto;
    max-height: none;
    margin: 0;
    padding: 16px;
    border-radius: 12px;
    transform: none;
  }

  .login-strip.motion-enter,
  .login-strip.motion-leave {
    opacity: 1;
    transform: translateY(-4px);
  }

  .login-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .login-form-actions {
    width: 100%;
    justify-self: stretch;
  }

  #reservationModal .modal-panel {
    width: 100%;
    height: 100dvh;
    max-width: 100%;
    max-height: 100dvh;
    margin: 0;
    padding: 14px 12px max(18px, env(safe-area-inset-bottom));
    border-radius: 0;
  }

  .identity-attachment-viewer {
    width: calc(100vw - 8px);
    height: calc(100dvh - 8px);
    max-width: calc(100vw - 8px);
    max-height: calc(100dvh - 8px);
    margin: 4px auto;
    padding: 10px;
    border-radius: 12px;
  }

  .identity-viewer-head {
    align-items: flex-start;
  }

  .identity-viewer-controls > button {
    flex: 1 1 120px;
  }

  /* P1-032: one readable horizontal card per row at phone width. This is the
     sole public-card owner through 600px; narrower breakpoints do not switch
     the card back to a vertical or two-column composition. */
  .product-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .customer-product-card {
    min-height: 0;
  }

  .customer-product-card-link {
    display: block;
    padding: 12px 12px 8px;
  }

  .customer-product-card-link .customer-product-summary {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 12px;
  }

  .customer-product-card-link .product-thumb,
  .customer-product-card-link .customer-thumb {
    width: 96px;
    height: 96px;
    min-height: 96px;
    padding: 5px;
    border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
    border-radius: var(--radius-md);
  }

  .customer-product-card-link .customer-product-identity {
    display: grid;
    min-height: 96px;
    gap: 4px;
    padding: 0;
  }

  .customer-product-card-link .product-card-top {
    display: block;
    min-height: 18px;
    padding-right: 40px;
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .customer-product-card-link h2 {
    min-height: 0;
    overflow: hidden;
    font-size: 15px;
    line-height: 1.3;
    -webkit-line-clamp: 3;
  }

  .customer-product-card-link .public-reference-price {
    min-height: 0;
    padding: 5px 0 0;
  }

  .customer-product-card-link .image-placeholder span {
    width: 38px;
    height: 38px;
    font-size: 14px;
  }

  .customer-product-card-link .image-placeholder small {
    display: block;
    max-width: 9ch;
    font-size: 12px;
    line-height: 1.15;
    text-align: center;
  }

  .customer-card-actions {
    padding: 0 12px 12px;
  }

  .customer-product-card .favorite-icon-button {
    top: 8px;
    right: 8px;
    left: auto;
  }

  body:has(#reservationModal:not(.hidden)) .toast {
    top: max(8px, env(safe-area-inset-top));
    right: 60px;
    max-width: calc(100vw - 68px);
    padding: 8px 10px;
    font-size: 12px;
  }

  .reservation-item-table-wrap:has(.internal-reservation-items) {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .reservation-item-table.internal-reservation-items tbody tr {
    grid-template-columns: minmax(0, 1fr);
  }

  .reservation-item-table.internal-reservation-items tbody td:nth-child(n) {
    grid-column: 1;
  }
}
.reservation-bank-readiness {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin: 0.75rem 0 0;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--line, #d9dce5);
  border-radius: 0.75rem;
  background: var(--surface-subtle, #f7f8fb);
}

.reservation-bank-readiness.ready {
  border-color: #a7d7bd;
  background: #f1faf5;
  color: #185c39;
}

.reservation-bank-readiness.required {
  align-items: flex-start;
  border-color: #e1b457;
  background: #fff8e6;
  color: #6b4a00;
}

.reservation-bank-readiness.required span {
  flex: 1 1 18rem;
}

.reservation-bank-readiness .btn-secondary {
  margin-inline-start: auto;
}

@media (max-width: 640px) {
  .reservation-bank-readiness,
  .reservation-bank-readiness.required {
    align-items: stretch;
    flex-direction: column;
  }

  .reservation-bank-readiness .btn-secondary {
    width: 100%;
    margin-inline-start: 0;
  }

  #registerForm [data-register-step-panel="verify"] .register-step-actions {
    align-items: stretch;
    flex-direction: column;
  }

  #registerForm [data-register-step-panel="verify"] .register-submit-action {
    width: 100%;
    min-width: 0;
  }

  #registerForm [data-register-submit] {
    white-space: nowrap;
  }
}
