/* AURORA workspace responsive baseline
   Loaded after legacy stylesheets to resolve conflicting viewport and scroll rules.
   The document is the single vertical scroll owner on every device. */

html {
  width: 100%;
  min-height: 100%;
  height: auto !important;
  max-height: none !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

body.workspace-active {
  display: block !important;
  position: relative !important;
  width: 100% !important;
  height: auto !important;
  min-height: 100vh !important;
  min-height: 100dvh !important;
  max-height: none !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior-y: auto !important;
  touch-action: auto !important;
  padding: 0 0 calc(104px + env(safe-area-inset-bottom, 0px)) !important;
}

body.workspace-active main.shell,
body.workspace-active .shell {
  box-sizing: border-box !important;
  display: block !important;
  position: relative !important;
  inset: auto !important;
  width: min(100%, 1440px) !important;
  max-width: 1440px !important;
  height: auto !important;
  min-height: 100vh !important;
  min-height: 100dvh !important;
  max-height: none !important;
  margin: 0 auto !important;
  padding: clamp(14px, 2.2vw, 30px) clamp(12px, 2.4vw, 32px) calc(112px + env(safe-area-inset-bottom, 0px)) !important;
  overflow: visible !important;
  overflow-x: clip !important;
  overflow-y: visible !important;
  contain: none !important;
  touch-action: auto !important;
}

body.workspace-active main.shell > :not(#workspace-nav) {
  min-width: 0 !important;
  max-width: 100% !important;
  max-height: none !important;
}

body.workspace-active #owner-home:not(.hidden),
body.workspace-active #receipts-home:not(.hidden),
body.workspace-active #pos-view:not(.hidden),
body.workspace-active #shop-home:not(.hidden),
body.workspace-active #subscription-home:not(.hidden),
body.workspace-active #owner-dashboard-view:not(.hidden),
body.workspace-active #profile-panel:not(.hidden),
body.workspace-active #staff-profile-panel:not(.hidden),
body.workspace-active [data-workspace-page]:not(.hidden) {
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 0 !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  contain: none !important;
}

body.workspace-active .dashboard-wrap {
  box-sizing: border-box;
  width: 100%;
  max-width: 1440px;
  margin-left: auto;
  margin-right: auto;
}

body.workspace-active .dashboard-layout {
  grid-template-columns: minmax(190px, 230px) minmax(0, 1fr);
  min-width: 0;
}

body.workspace-active .dashboard-main,
body.workspace-active .panel,
body.workspace-active .card,
body.workspace-active .profile-grid,
body.workspace-active .shop-grid,
body.workspace-active .content-grid {
  min-width: 0;
  max-width: 100%;
}

body.workspace-active input,
body.workspace-active select,
body.workspace-active textarea,
body.workspace-active button {
  box-sizing: border-box;
  max-width: 100%;
}

body.workspace-active input,
body.workspace-active select,
body.workspace-active textarea {
  min-width: 0;
}

body.workspace-active form,
body.workspace-active .form-scroll,
body.workspace-active .declaration-form,
body.workspace-active #profile-form {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  touch-action: auto !important;
}

/* Keep horizontal scrolling local to genuinely wide data tables only. */
body.workspace-active .table-scroll,
body.workspace-active .table-wrap,
body.workspace-active .table-responsive,
body.workspace-active .history-table-wrap,
body.workspace-active .data-table-wrap,
body.workspace-active .table-overflow {
  width: 100%;
  max-width: 100%;
  overflow-x: auto !important;
  overflow-y: visible !important;
  -webkit-overflow-scrolling: touch;
}

body.workspace-active table {
  max-width: 100%;
}

/* A single, predictable navigation dock; it never becomes a page scroller. */
body.workspace-active #workspace-nav:not(.hidden),
body.workspace-active #workspace-nav.bottom-nav:not(.hidden) {
  box-sizing: border-box !important;
  position: fixed !important;
  left: 50% !important;
  right: auto !important;
  top: auto !important;
  bottom: max(8px, env(safe-area-inset-bottom, 0px)) !important;
  transform: translateX(-50%) !important;
  width: min(calc(100vw - 32px), 860px) !important;
  max-width: 860px !important;
  min-width: 0 !important;
  height: auto !important;
  max-height: 76px !important;
  margin: 0 !important;
  padding: 7px 10px !important;
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  justify-content: space-around !important;
  gap: 6px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  z-index: 2147482000 !important;
}

body.workspace-active #workspace-nav:not(.hidden) > button {
  box-sizing: border-box !important;
  flex: 1 1 0 !important;
  min-width: 64px !important;
  max-width: 220px !important;
  min-height: 48px !important;
  height: auto !important;
  white-space: normal !important;
  overflow-wrap: anywhere;
  touch-action: manipulation;
}

@media (max-width: 900px) {
  body.workspace-active main.shell,
  body.workspace-active .shell {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  body.workspace-active .dashboard-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  body.workspace-active .dashboard-sidebar {
    position: static !important;
    min-height: 0 !important;
  }
}

@media (max-width: 700px) {
  body.workspace-active main.shell,
  body.workspace-active .shell {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 12px 12px calc(112px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body.workspace-active .dashboard-layout {
    display: block;
  }

  body.workspace-active .dashboard-sidebar {
    position: static !important;
    min-height: 0 !important;
    margin-bottom: 14px;
  }

  body.workspace-active .metric-grid,
  body.workspace-active .headline-metrics,
  body.workspace-active .owner-stats,
  body.workspace-active .channel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.workspace-active .content-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  body.workspace-active .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  body.workspace-active .page-heading > *,
  body.workspace-active .panel-heading > * {
    min-width: 0;
    max-width: 100%;
  }
}

@media (max-width: 420px) {
  body.workspace-active main.shell,
  body.workspace-active .shell {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  body.workspace-active .metric-grid,
  body.workspace-active .headline-metrics {
    gap: 8px;
  }

  body.workspace-active .metric,
  body.workspace-active .panel {
    min-width: 0;
  }

  body.workspace-active #workspace-nav:not(.hidden) {
    width: calc(100vw - 16px) !important;
    padding-left: 5px !important;
    padding-right: 5px !important;
    gap: 3px !important;
  }

  body.workspace-active #workspace-nav:not(.hidden) > button {
    min-width: 58px !important;
    padding-left: 4px !important;
    padding-right: 4px !important;
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.workspace-active *,
  body.workspace-active *::before,
  body.workspace-active *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Final cascade reconciliation.
   responsive-auth.css contains older, more-specific 430px navigation rules.
   Override those rules here so the workspace dock matches the full responsive
   workspace width on laptops while remaining edge-safe on phones. */
body.workspace-active main.shell > #workspace-nav:not(.hidden),
body.workspace-active main.shell > #workspace-nav.bottom-nav:not(.hidden) {
  position: fixed !important;
  left: 50% !important;
  right: auto !important;
  top: auto !important;
  bottom: max(8px, env(safe-area-inset-bottom, 0px)) !important;
  transform: translateX(-50%) !important;
  box-sizing: border-box !important;
  width: min(calc(100vw - 32px), 860px) !important;
  max-width: 860px !important;
  min-width: 0 !important;
  margin: 0 !important;
  z-index: 2147482000 !important;
}

body.workspace-active main.shell > #workspace-nav:not(.hidden) > button,
body.workspace-active main.shell > #workspace-nav.bottom-nav:not(.hidden) > button {
  position: static !important;
  inset: auto !important;
  display: flex !important;
  flex: 1 1 0 !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 0 !important;
  max-width: none !important;
  white-space: normal !important;
  writing-mode: horizontal-tb !important;
  transform: none !important;
}

@media (max-width: 520px) {
  body.workspace-active main.shell > #workspace-nav:not(.hidden),
  body.workspace-active main.shell > #workspace-nav.bottom-nav:not(.hidden) {
    left: 50% !important;
    right: auto !important;
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    transform: translateX(-50%) !important;
  }
}


/* AURORA fixed-app / inner-page scrolling model (2026-11-19).
   Keep the browser viewport still. Each active workspace page owns its
   vertical scroll area, so long Shop > Profile and declaration content
   remains reachable without moving the app frame or navigation. */
html,
body.workspace-active {
  box-sizing: border-box !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  overscroll-behavior: none !important;
}

body.workspace-active {
  position: fixed !important;
  inset: 0 !important;
  display: block !important;
  touch-action: none !important;
}

body.workspace-active .topbar {
  display: none !important;
}

body.workspace-active .global-back-row {
  position: fixed !important;
  inset: 0 auto auto 0 !important;
  width: 100% !important;
  height: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  z-index: 2147482001 !important;
}

body.workspace-active .global-back-row .global-back-dock:not(.hidden) {
  position: fixed !important;
  top: max(8px, env(safe-area-inset-top, 0px)) !important;
  left: 10px !important;
  margin: 0 !important;
}

html body.workspace-active main.shell,
html body.workspace-active .shell {
  position: fixed !important;
  inset: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 1440px !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: 100% !important;
  margin: 0 auto !important;
  padding: max(10px, env(safe-area-inset-top, 0px)) 12px calc(88px + env(safe-area-inset-bottom, 0px)) !important;
  overflow: hidden !important;
  overscroll-behavior: none !important;
  contain: none !important;
  transform: none !important;
  touch-action: auto !important;
}

html body.workspace-active main.shell > :not(#workspace-nav) {
  box-sizing: border-box !important;
  min-width: 0 !important;
  max-width: 100% !important;
}

html body.workspace-active main.shell > section:not(.hidden),
html body.workspace-active main.shell > main:not(.hidden),
html body.workspace-active main.shell > .panel:not(.hidden) {
  flex: 1 1 0 !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: auto !important;
  max-height: none !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior-y: contain !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y !important;
  scrollbar-width: thin;
  padding-bottom: max(18px, env(safe-area-inset-bottom, 0px)) !important;
}

/* Shop is one inner scroll surface: tabs remain visible while all profile
   fields, shop details, photos and long declaration forms can be reached. */
html body.workspace-active main.shell > #shop-home:not(.hidden) {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 0 !important;
  min-height: 0 !important;
  height: auto !important;
  max-height: none !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior-y: contain !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y !important;
}

html body.workspace-active #shop-home > .shop-section-tabs {
  position: sticky !important;
  top: 0 !important;
  z-index: 30 !important;
  flex: 0 0 auto !important;
  max-width: 100% !important;
}

html body.workspace-active #shop-home form,
html body.workspace-active #shop-home .shop-profile,
html body.workspace-active #shop-home .shop-profile-content,
html body.workspace-active #shop-home .shop-profile-panel,
html body.workspace-active #shop-home .shop-details,
html body.workspace-active #shop-home .shop-details-panel,
html body.workspace-active #shop-home .shop-grid,
html body.workspace-active #shop-home .profile-grid {
  min-width: 0 !important;
  max-width: 100% !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  touch-action: auto !important;
}

html body.workspace-active #receipts-home:not(.hidden),
html body.workspace-active #subscription-home:not(.hidden),
html body.workspace-active #pos-view:not(.hidden),
html body.workspace-active #owner-home:not(.hidden),
html body.workspace-active #owner-dashboard-view:not(.hidden),
html body.workspace-active #customer-home:not(.hidden),
html body.workspace-active #public-lost-item-view:not(.hidden),
html body.workspace-active [data-workspace-page]:not(.hidden) {
  min-height: 0 !important;
  max-height: none !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior-y: contain !important;
  touch-action: pan-y !important;
}

html body.workspace-active #workspace-nav:not(.hidden),
html body.workspace-active main.shell > #workspace-nav:not(.hidden) {
  position: fixed !important;
  left: 50% !important;
  right: auto !important;
  top: auto !important;
  bottom: max(8px, env(safe-area-inset-bottom, 0px)) !important;
  transform: translateX(-50%) !important;
  box-sizing: border-box !important;
  width: min(calc(100vw - 16px), 860px) !important;
  max-width: 860px !important;
  min-width: 0 !important;
  height: auto !important;
  max-height: 76px !important;
  margin: 0 !important;
  padding: 6px 8px !important;
  display: flex !important;
  flex: 0 0 auto !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  justify-content: space-around !important;
  gap: 5px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  overscroll-behavior-x: contain !important;
  touch-action: pan-x !important;
  z-index: 2147482000 !important;
}

html body.workspace-active #workspace-nav:not(.hidden) > button {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  max-width: none !important;
  min-height: 46px !important;
  height: auto !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  touch-action: manipulation !important;
}

@media (min-width: 761px) {
  html body.workspace-active main.shell,
  html body.workspace-active .shell {
    left: 50% !important;
    right: auto !important;
    width: min(100vw, 1440px) !important;
    transform: translateX(-50%) !important;
    padding: 16px 24px 96px !important;
  }
}

@media (max-width: 420px) {
  html body.workspace-active main.shell,
  html body.workspace-active .shell {
    padding-left: 9px !important;
    padding-right: 9px !important;
  }
  html body.workspace-active #workspace-nav:not(.hidden) {
    width: calc(100vw - 12px) !important;
    gap: 2px !important;
    padding-left: 4px !important;
    padding-right: 4px !important;
  }
  html body.workspace-active #workspace-nav:not(.hidden) > button {
    font-size: 10px !important;
    padding-left: 2px !important;
    padding-right: 2px !important;
  }
}


/* Keep touch gestures available to the page's own scroll container. */
body.workspace-active { touch-action: pan-y !important; }
html body.workspace-active #shop-home > :not(.shop-section-tabs) {
  flex-shrink: 0 !important;
}
html body.workspace-active #shop-home > .shop-section-tabs {
  flex-shrink: 0 !important;
}


/* Native finger-swipe scrolling: no arrow controls or scrollbar interaction
   is required. The Shop section itself is the single scroll container. */
html body.workspace-active main.shell > #shop-home:not(.hidden) {
  flex: 1 1 0 !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow-y: scroll !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior-y: contain !important;
  touch-action: pan-y !important;
  scrollbar-width: none !important;
}
html body.workspace-active main.shell > #shop-home:not(.hidden)::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}
html body.workspace-active main.shell > #shop-home:not(.hidden) > * {
  touch-action: pan-y !important;
}
html body.workspace-active main.shell > #shop-home:not(.hidden) > .shop-section-tabs {
  position: sticky !important;
  top: 0 !important;
}


/* Phone-native scrolling for every Shop card.
   The Shop workspace is the single vertical scroll surface: users swipe
   anywhere on a card to move the page naturally. No nested scrollbars,
   arrow buttons, fixed-height form panels or scrollbar dragging. */
html body.workspace-active main.shell > #shop-home:not(.hidden),
html body.workspace-active main.shell > #shop-home:not(.hidden) * {
  touch-action: pan-y !important;
}
html body.workspace-active #shop-home > details,
html body.workspace-active #shop-home > .staff-team-card,
html body.workspace-active #shop-home > section,
html body.workspace-active #shop-home > .profile-card {
  flex: 0 0 auto !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
}
html body.workspace-active #shop-home details > :not(summary),
html body.workspace-active #shop-home .staff-team-card,
html body.workspace-active #shop-home .staff-invite-form,
html body.workspace-active #shop-home .staff-invitations-list,
html body.workspace-active #shop-home .profile-card-body,
html body.workspace-active #shop-home .repair-card-content,
html body.workspace-active #shop-home .loan-card-body,
html body.workspace-active #shop-home .shop-register-product-body,
html body.workspace-active #shop-home .shop-product-search-form,
html body.workspace-active #shop-home .shop-product-results {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
  -webkit-overflow-scrolling: auto !important;
  overscroll-behavior: auto !important;
}
html body.workspace-active #shop-home input,
html body.workspace-active #shop-home select,
html body.workspace-active #shop-home textarea,
html body.workspace-active #shop-home button,
html body.workspace-active #shop-home summary {
  touch-action: manipulation !important;
}
html body.workspace-active #shop-home:not(.hidden) {
  scrollbar-width: none !important;
}
html body.workspace-active #shop-home:not(.hidden)::-webkit-scrollbar {
  display: none !important;
}


/* Workspace-wide native mobile scrolling.
   Every active top-level workspace sector (Home, Receipts, Shop, POS,
   subscriptions, customer, flagged items, staff and admin views) scrolls
   by ordinary finger swipes. The app frame and bottom navigation stay put.
   Nested content expands naturally so users do not need to find tiny
   inner scrollbars or arrow controls. */
html body.workspace-active main.shell {
  overscroll-behavior: none !important;
  touch-action: pan-y !important;
}
html body.workspace-active main.shell > section:not(.hidden),
html body.workspace-active main.shell > main:not(.hidden),
html body.workspace-active main.shell > article:not(.hidden),
html body.workspace-active main.shell > .panel:not(.hidden) {
  flex: 1 1 0 !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: 0 !important;
  max-height: none !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior-y: contain !important;
  touch-action: pan-y !important;
  scrollbar-width: none !important;
}
html body.workspace-active main.shell > section:not(.hidden)::-webkit-scrollbar,
html body.workspace-active main.shell > main:not(.hidden)::-webkit-scrollbar,
html body.workspace-active main.shell > article:not(.hidden)::-webkit-scrollbar,
html body.workspace-active main.shell > .panel:not(.hidden)::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}
html body.workspace-active main.shell > section:not(.hidden) *,
html body.workspace-active main.shell > main:not(.hidden) *,
html body.workspace-active main.shell > article:not(.hidden) *,
html body.workspace-active main.shell > .panel:not(.hidden) * {
  touch-action: pan-y !important;
}
html body.workspace-active main.shell > #workspace-nav:not(.hidden),
html body.workspace-active main.shell > #workspace-nav:not(.hidden) * {
  touch-action: pan-x !important;
}
html body.workspace-active main.shell > section:not(.hidden) details,
html body.workspace-active main.shell > section:not(.hidden) form,
html body.workspace-active main.shell > section:not(.hidden) article,
html body.workspace-active main.shell > section:not(.hidden) .panel,
html body.workspace-active main.shell > section:not(.hidden) [role="list"],
html body.workspace-active main.shell > section:not(.hidden) [role="region"] {
  max-height: none !important;
}
html body.workspace-active main.shell > section:not(.hidden) form,
html body.workspace-active main.shell > section:not(.hidden) article,
html body.workspace-active main.shell > section:not(.hidden) .panel {
  overflow-y: visible !important;
  -webkit-overflow-scrolling: auto !important;
  overscroll-behavior: auto !important;
}
html body.workspace-active main.shell > section:not(.hidden) input,
html body.workspace-active main.shell > section:not(.hidden) select,
html body.workspace-active main.shell > section:not(.hidden) textarea,
html body.workspace-active main.shell > section:not(.hidden) button,
html body.workspace-active main.shell > section:not(.hidden) summary {
  touch-action: manipulation !important;
}

/* FINAL MOBILE SCROLL MODEL
   Use one normal finger-swipe scroll surface for each active workspace page.
   Long forms and cards expand naturally inside that page; no nested scroll
   boxes, fixed-height panels, scrollbar dragging or arrow controls. */
html body.workspace-active .shell > #receipts-home:not(.hidden),
html body.workspace-active .shell > #shop-lost-items-panel:not(.hidden) {
  display: block !important;
  box-sizing: border-box !important;
  flex: 1 1 0 !important;
  width: 100% !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior-y: contain !important;
  touch-action: pan-y !important;
  scrollbar-width: none !important;
  padding-bottom: calc(28px + env(safe-area-inset-bottom)) !important;
}
html body.workspace-active .shell > #receipts-home:not(.hidden)::-webkit-scrollbar,
html body.workspace-active .shell > #shop-lost-items-panel:not(.hidden)::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Declaration form and Flagged Items cards must never create their own
   scroll containers. Their full content belongs to the page above. */
html body.workspace-active #receipts-home #secondhand-panel,
html body.workspace-active #receipts-home #secondhand-form,
html body.workspace-active #receipts-home #secondhand-form fieldset,
html body.workspace-active #shop-lost-items-panel *,
html body.workspace-active #receipts-home #secondhand-panel > * {
  box-sizing: border-box !important;
  max-height: none !important;
  -webkit-overflow-scrolling: auto !important;
  overscroll-behavior: auto !important;
}
html body.workspace-active #receipts-home #secondhand-panel,
html body.workspace-active #receipts-home #secondhand-form,
html body.workspace-active #receipts-home #secondhand-form fieldset,
html body.workspace-active #shop-lost-items-panel .lost-item-checker,
html body.workspace-active #shop-lost-items-panel .lost-item-register,
html body.workspace-active #shop-lost-items-panel .lost-items-intro,
html body.workspace-active #shop-lost-items-panel .lost-items-list-head,
html body.workspace-active #shop-lost-items-panel #lost-items-list,
html body.workspace-active #shop-lost-items-panel .lost-item-row,
html body.workspace-active #shop-lost-items-panel .lost-item-report-details {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
}
html body.workspace-active #receipts-home #secondhand-panel {
  display: block !important;
  position: static !important;
  flex: 0 0 auto !important;
  width: 100% !important;
  padding-bottom: 24px !important;
  touch-action: pan-y !important;
}
html body.workspace-active #receipts-home #secondhand-form {
  overflow: visible !important;
  touch-action: pan-y !important;
}
html body.workspace-active #receipts-home #secondhand-panel *,
html body.workspace-active #shop-lost-items-panel * {
  touch-action: pan-y !important;
}
html body.workspace-active #receipts-home #secondhand-panel input,
html body.workspace-active #receipts-home #secondhand-panel select,
html body.workspace-active #receipts-home #secondhand-panel textarea,
html body.workspace-active #receipts-home #secondhand-panel button,
html body.workspace-active #shop-lost-items-panel input,
html body.workspace-active #shop-lost-items-panel select,
html body.workspace-active #shop-lost-items-panel textarea,
html body.workspace-active #shop-lost-items-panel button,
html body.workspace-active #shop-lost-items-panel summary {
  touch-action: manipulation !important;
}


/* Platform Admin is a separate control-room page, not an ordinary shop tab. */
html body.platform-admin-workspace #workspace-nav,
html body.platform-admin-workspace .topbar,
html body.platform-admin-workspace .global-back-row,
html body.platform-admin-workspace #pos-view,
html body.platform-admin-workspace #owner-home,
html body.platform-admin-workspace #customer-home,
html body.platform-admin-workspace #receipts-home,
html body.platform-admin-workspace #shop-home,
html body.platform-admin-workspace #subscription-home,
html body.platform-admin-workspace #profile-panel,
html body.platform-admin-workspace #staff-profile-panel {
  display: none !important;
}
html body.platform-admin-workspace main.shell {
  width: min(100% - 24px, 1120px) !important;
  max-width: 1120px !important;
  min-height: 100vh !important;
  margin: 18px auto !important;
  padding: 0 0 28px !important;
}
html body.platform-admin-workspace #platform-referral-admin:not(.hidden) {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 auto !important;
  padding: clamp(16px, 3vw, 30px) !important;
}
html body.platform-admin-workspace #platform-referral-admin .platform-admin-tabs {
  position: sticky;
  top: 0;
  z-index: 5;
}


/* Desktop workspace is intentionally a fixed quarter-screen column.
   Keep the app frame at exactly 25vw on PC; inner pages cannot widen it.
   Tablet and phone layouts remain governed by the existing breakpoints. */
@media (min-width: 761px) {
  html body.workspace-active main.shell,
  html body.workspace-active .shell {
    left: 50% !important;
    right: auto !important;
    width: 25vw !important;
    min-width: 25vw !important;
    max-width: 25vw !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    transform: translateX(-50%) !important;
    overflow-x: hidden !important;
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  html body.workspace-active main.shell > :not(#workspace-nav),
  html body.workspace-active main.shell > :not(#workspace-nav) * {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  html body.workspace-active main.shell > #workspace-nav:not(.hidden) {
    width: min(calc(25vw - 20px), 860px) !important;
    max-width: calc(25vw - 20px) !important;
  }
}


/* Final cross-device workspace sizing and navigation visibility.
   Phones and tablets use the full available viewport. Only true desktop
   widths use the narrow 25vw workspace. The navigation dock stays visible
   and spans a usable width independently of the narrow desktop content. */
@media (min-width: 1024px) {
  html body.workspace-active main.shell,
  html body.workspace-active .shell {
    left: 50% !important;
    right: auto !important;
    width: 25vw !important;
    min-width: 25vw !important;
    max-width: 25vw !important;
    margin: 0 !important;
    transform: translateX(-50%) !important;
    overflow-x: hidden !important;
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  html body.workspace-active main.shell > :not(#workspace-nav),
  html body.workspace-active main.shell > :not(#workspace-nav) * {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  html body.workspace-active main.shell > #workspace-nav:not(.hidden) {
    left: 50% !important;
    right: auto !important;
    width: calc(25vw - 28px) !important;
    max-width: calc(25vw - 28px) !important;
    min-width: 0 !important;
    transform: translateX(-50%) !important;
    z-index: 2147482000 !important;
  }
}

/* All phone sizes, portrait/landscape phones and tablets below desktop width. */
@media (max-width: 1023px) {
  html body.workspace-active main.shell,
  html body.workspace-active .shell {
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    min-width: 0 !important;
    max-width: 100vw !important;
    margin: 0 !important;
    transform: none !important;
    overflow-x: hidden !important;
    padding-left: max(9px, env(safe-area-inset-left, 0px)) !important;
    padding-right: max(9px, env(safe-area-inset-right, 0px)) !important;
  }

  html body.workspace-active main.shell > :not(#workspace-nav),
  html body.workspace-active main.shell > :not(#workspace-nav) * {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  html body.workspace-active main.shell > #workspace-nav:not(.hidden) {
    left: 50% !important;
    right: auto !important;
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    transform: translateX(-50%) !important;
    z-index: 2147482000 !important;
  }
}

/* Very narrow devices: keep all nav destinations tappable without clipping. */
@media (max-width: 360px) {
  html body.workspace-active main.shell > #workspace-nav:not(.hidden) {
    width: calc(100vw - 10px) !important;
    max-width: calc(100vw - 10px) !important;
    gap: 1px !important;
    padding-left: 3px !important;
    padding-right: 3px !important;
  }
  html body.workspace-active main.shell > #workspace-nav:not(.hidden) > button {
    min-width: 0 !important;
    padding-left: 1px !important;
    padding-right: 1px !important;
    font-size: clamp(9px, 2.7vw, 11px) !important;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  html body.workspace-active main.shell > #workspace-nav:not(.hidden) {
    bottom: max(4px, env(safe-area-inset-bottom, 0px)) !important;
    max-height: 58px !important;
    padding-top: 3px !important;
    padding-bottom: 3px !important;
  }
  html body.workspace-active main.shell > #workspace-nav:not(.hidden) > button {
    min-height: 38px !important;
  }
}


/* Desktop-only fixed-width workspace.
   Keep the existing mobile/tablet layout and outer page background untouched.
   On desktop the complete app frame remains centred at approximately 14 cm,
   regardless of how wide the browser window becomes. */
@media (min-width: 1024px) {
  html body.workspace-active main.shell,
  html body.workspace-active .shell {
    left: 50% !important;
    right: auto !important;
    width: 14cm !important;
    min-width: 0 !important;
    max-width: calc(100vw - 32px) !important;
    margin: 0 !important;
    padding: 16px 14px 96px !important;
    transform: translateX(-50%) !important;
    overflow-x: hidden !important;
  }

  html body.workspace-active main.shell > :not(#workspace-nav),
  html body.workspace-active main.shell > :not(#workspace-nav) * {
    box-sizing: border-box !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  html body.workspace-active main.shell > #workspace-nav:not(.hidden) {
    left: 50% !important;
    right: auto !important;
    width: calc(14cm - 28px) !important;
    max-width: calc(100vw - 60px) !important;
    min-width: 0 !important;
    transform: translateX(-50%) !important;
  }
}


/* DESKTOP CORRECTION — centred full-height workspace, normal page flow.
   Desktop gets a fixed 14cm width from the very top to the very bottom.
   Content keeps its natural sizing and order; the page scrolls normally
   inside the frame. The phone/tablet rules above are deliberately untouched. */
@media (min-width: 1024px) {
  html body.workspace-active main.shell,
  html body.workspace-active .shell {
    position: fixed !important;
    inset: 0 auto 0 50% !important;
    display: block !important;
    box-sizing: border-box !important;
    width: 14cm !important;
    min-width: 0 !important;
    max-width: calc(100vw - 32px) !important;
    height: 100vh !important;
    height: 100dvh !important;
    min-height: 100vh !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    padding: 0 14px 104px !important;
    transform: translateX(-50%) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior-y: contain !important;
    scrollbar-width: thin;
  }

  html body.workspace-active main.shell > section:not(.hidden),
  html body.workspace-active main.shell > main:not(.hidden),
  html body.workspace-active main.shell > article:not(.hidden),
  html body.workspace-active main.shell > .panel:not(.hidden),
  html body.workspace-active main.shell > [data-workspace-page]:not(.hidden) {
    display: block !important;
    position: relative !important;
    flex: none !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    margin-top: initial !important;
    overflow: visible !important;
    transform: none !important;
  }

  html body.workspace-active main.shell > #workspace-nav:not(.hidden) {
    position: fixed !important;
    left: 50% !important;
    right: auto !important;
    top: auto !important;
    bottom: 8px !important;
    width: calc(14cm - 28px) !important;
    max-width: calc(100vw - 60px) !important;
    min-width: 0 !important;
    height: auto !important;
    max-height: 76px !important;
    transform: translateX(-50%) !important;
    z-index: 2147482000 !important;
  }
}


/* Desktop readability and visibility pass.
   The 14 cm app frame is intentionally retained. Improve the usable content
   inside it instead of shrinking typography or clipping cards to make them fit.
   This block is desktop-only: existing phone and tablet presentation is intact. */
@media (min-width: 1024px) {
  html body.workspace-active main.shell,
  html body.workspace-active main.shell * {
    text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
  }

  html body.workspace-active main.shell {
    font-size: 15px !important;
    line-height: 1.5 !important;
    padding: 0 16px 112px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    scrollbar-gutter: stable;
  }

  html body.workspace-active main.shell :is(p, li, label, legend, summary, td, th, small, .small, .muted, .helper-text, .form-hint, .field-hint, .eyebrow, .subtitle, .description, .card-description, .stat-label, .metric-label) {
    font-size: 14px !important;
    line-height: 1.45 !important;
    overflow-wrap: anywhere !important;
  }

  html body.workspace-active main.shell :is(h1, h2, h3, h4, .page-title, .section-title, .panel-title, .card-title) {
    line-height: 1.25 !important;
    overflow-wrap: anywhere !important;
  }

  html body.workspace-active main.shell :is(input, select, textarea, button, .btn, .tab, .nav-link) {
    font-size: 14px !important;
    line-height: 1.35 !important;
  }

  html body.workspace-active main.shell :is(input, select, textarea) {
    min-height: 42px !important;
    padding: 9px 11px !important;
  }

  html body.workspace-active main.shell :is(button, .btn) {
    min-height: 40px;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  html body.workspace-active main.shell :is(.card, .panel, .metric, .stat-card, .profile-card, .shop-card, .receipt-card, .content-card, .form-card, details) {
    box-sizing: border-box !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    padding: 14px !important;
    overflow: visible !important;
  }

  html body.workspace-active main.shell :is(.grid, .card-grid, .metric-grid, .headline-metrics, .owner-stats, .channel-grid, .content-grid, .shop-grid, .profile-grid, .form-grid, .stats-grid) {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)) !important;
    gap: 12px !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  html body.workspace-active main.shell :is(.row, .flex-row, .form-row, .panel-heading, .card-heading, .page-heading) {
    min-width: 0 !important;
    max-width: 100% !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
  }

  html body.workspace-active main.shell :is(table, .data-table) {
    width: 100% !important;
    font-size: 13px !important;
  }

  html body.workspace-active main.shell :is(.table-scroll, .table-wrap, .table-responsive, .history-table-wrap, .data-table-wrap, .table-overflow) {
    overflow-x: auto !important;
    max-width: 100% !important;
  }

  html body.workspace-active main.shell img:not(.staff-profile-preview):not(.profile-avatar),
  html body.workspace-active main.shell canvas,
  html body.workspace-active main.shell svg {
    max-width: 100%;
  }

  html body.workspace-active main.shell :is(.qr-code, .qrcode, #invite-qr, #staff-invite-qr, .invite-qr img, .qr-container img) {
    width: auto !important;
    height: auto !important;
    max-width: 148px !important;
    max-height: 148px !important;
    object-fit: contain !important;
  }

  html body.workspace-active main.shell > #workspace-nav:not(.hidden) {
    width: calc(14cm - 32px) !important;
    max-width: calc(100vw - 48px) !important;
    min-height: 52px !important;
    padding: 7px 9px !important;
    gap: 6px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
  }

  html body.workspace-active main.shell > #workspace-nav:not(.hidden) > button {
    min-width: 64px !important;
    min-height: 44px !important;
    padding: 6px 5px !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
    overflow-wrap: anywhere !important;
  }

  html body.workspace-active main.shell :is(.hidden, [hidden]) {
    display: none !important;
  }
}


/* DESKTOP FINAL FIX — readable content, complete cards, no clipped fields.
   The 14 cm frame is retained. This block intentionally wins over older
   desktop rules above it; mobile/tablet breakpoints are not changed. */
@media (min-width: 1024px) {
  html body.workspace-active main.shell {
    width: 14cm !important;
    max-width: calc(100vw - 32px) !important;
    min-width: 0 !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    padding: 16px 16px 112px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    scrollbar-gutter: stable;
  }

  /* Let every active section grow to its real content height. */
  html body.workspace-active main.shell > :not(#workspace-nav) {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    box-sizing: border-box !important;
  }

  html body.workspace-active main.shell > section:not(.hidden),
  html body.workspace-active main.shell > main:not(.hidden),
  html body.workspace-active main.shell > article:not(.hidden),
  html body.workspace-active main.shell > .panel:not(.hidden),
  html body.workspace-active main.shell > [data-workspace-page]:not(.hidden) {
    display: block !important;
    position: relative !important;
    flex: none !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    transform: none !important;
  }

  /* Never allow desktop text to fall below a comfortable reading size. */
  html body.workspace-active main.shell :is(
    p, span, a, label, legend, li, summary, small, strong, b, em, i,
    td, th, caption, figcaption, dt, dd, output, time, blockquote,
    .muted, .helper-text, .form-hint, .field-hint, .eyebrow,
    .subtitle, .description, .card-description, .stat-label, .metric-label
  ) {
    font-size: max(14px, 1em) !important;
    line-height: 1.45 !important;
    overflow-wrap: anywhere !important;
  }

  html body.workspace-active main.shell :is(h1, h2, h3, h4, h5, h6) {
    line-height: 1.25 !important;
    overflow-wrap: anywhere !important;
  }

  html body.workspace-active main.shell :is(input, select, textarea, button, .btn) {
    font-size: max(14px, 1em) !important;
    line-height: 1.35 !important;
    box-sizing: border-box !important;
    max-width: 100% !important;
  }

  html body.workspace-active main.shell :is(input, select, textarea) {
    min-height: 44px !important;
    padding: 10px 12px !important;
  }

  html body.workspace-active main.shell :is(button, .btn) {
    min-height: 42px !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  /* Cards expand naturally; no fixed heights or hidden overflow. */
  html body.workspace-active main.shell :is(
    .card, .panel, .metric, .stat-card, .profile-card, .shop-card,
    .receipt-card, .content-card, .form-card, .staff-team-card,
    .repair-card, .loan-card, details, fieldset
  ) {
    box-sizing: border-box !important;
    width: 100%;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 14px !important;
    overflow: visible !important;
  }

  html body.workspace-active main.shell :is(
    .grid, .card-grid, .metric-grid, .headline-metrics, .owner-stats,
    .channel-grid, .content-grid, .shop-grid, .profile-grid,
    .form-grid, .stats-grid
  ) {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)) !important;
    gap: 12px !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  html body.workspace-active main.shell :is(
    .row, .flex-row, .form-row, .panel-heading, .card-heading, .page-heading
  ) {
    min-width: 0 !important;
    max-width: 100% !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
  }

  html body.workspace-active main.shell :is(
    .table-scroll, .table-wrap, .table-responsive, .history-table-wrap,
    .data-table-wrap, .table-overflow
  ) {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
  }

  html body.workspace-active main.shell table {
    max-width: none !important;
    width: 100% !important;
  }

  html body.workspace-active main.shell :is(
    .qr-code, .qrcode, #invite-qr, #staff-invite-qr,
    .invite-qr img, .qr-container img
  ) {
    width: auto !important;
    height: auto !important;
    max-width: 148px !important;
    max-height: 148px !important;
    object-fit: contain !important;
  }

  html body.workspace-active main.shell > #workspace-nav:not(.hidden) {
    width: calc(14cm - 32px) !important;
    max-width: calc(100vw - 48px) !important;
    min-height: 54px !important;
    max-height: 76px !important;
    padding: 7px 9px !important;
    gap: 6px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
  }

  html body.workspace-active main.shell > #workspace-nav:not(.hidden) > button {
    min-width: 0 !important;
    min-height: 44px !important;
    padding: 6px 5px !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
  }
}


/* DESKTOP WORKSPACE RECOVERY
   Older workspace rules fixed the body and assigned active pages height:0.
   That layout was only suitable for the old touch-scroll shell and leaves
   desktop pages blank. Restore normal document flow on computers/tablets.
   Phone rules (760px and below) are intentionally unchanged. */
@media (min-width: 761px) {
  html,
  html body.workspace-active {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 100% !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    padding: 0 !important;
    touch-action: auto !important;
  }

  html body.workspace-active {
    display: block !important;
  }

  html body.workspace-active main.shell,
  html body.workspace-active .shell {
    position: relative !important;
    inset: auto !important;
    display: block !important;
    width: min(14cm, calc(100vw - 32px)) !important;
    min-width: 0 !important;
    max-width: calc(100vw - 32px) !important;
    height: auto !important;
    min-height: 100vh !important;
    max-height: none !important;
    margin: 0 auto !important;
    padding: 18px 16px 100px !important;
    transform: none !important;
    overflow: visible !important;
    contain: none !important;
  }

  html body.workspace-active main.shell > :not(#workspace-nav) {
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
  }

  html body.workspace-active main.shell > section:not(.hidden),
  html body.workspace-active main.shell > main:not(.hidden),
  html body.workspace-active main.shell > article:not(.hidden),
  html body.workspace-active main.shell > .panel:not(.hidden),
  html body.workspace-active main.shell > [data-workspace-page]:not(.hidden) {
    display: block !important;
    position: relative !important;
    flex: none !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    transform: none !important;
  }

  html body.workspace-active main.shell > #workspace-nav:not(.hidden) {
    position: fixed !important;
    left: 50% !important;
    right: auto !important;
    top: auto !important;
    bottom: 10px !important;
    width: min(calc(14cm - 24px), calc(100vw - 40px)) !important;
    max-width: calc(100vw - 40px) !important;
    min-width: 0 !important;
    height: auto !important;
    max-height: none !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
    gap: 6px !important;
    padding: 8px !important;
    overflow: visible !important;
    transform: translateX(-50%) !important;
    z-index: 2147482000 !important;
  }

  html body.workspace-active main.shell > #workspace-nav:not(.hidden) > button {
    display: flex !important;
    flex: 1 1 0 !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 48px !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 6px 4px !important;
    font-size: 13px !important;
    line-height: 1.25 !important;
    white-space: normal !important;
  }
}


/* AURORA loan cards: clear visual distinction between items lent and borrowed. */
.loans-create-card,
.loans-list-section {
  border: 1px solid #dbe6f0;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(25, 55, 90, .07);
  overflow: hidden;
}
.loans-create-card { border-top: 4px solid #0e7490; }
.loans-create-card > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  cursor: pointer;
  list-style: none;
}
.loans-create-card > summary::before {
  content: "＋";
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  color: #fff;
  background: #0e7490;
  font-size: 25px;
  font-weight: 700;
}
.loans-create-card > summary::-webkit-details-marker { display:none; }
.loans-create-card > summary strong { display:block; color:#155e75; font-size:16px; }
.loans-create-card > summary small { display:block; margin-top:4px; color:#64748b; }
.loans-list-section { margin-top:18px; padding:15px; }
.loans-list-section[aria-labelledby="loans-lent-title"] {
  border-top: 4px solid #2563eb;
  background: linear-gradient(150deg,#eff6ff 0%,#fff 62%);
}
.loans-list-section[aria-labelledby="loans-borrowed-title"] {
  border-top: 4px solid #7c3aed;
  background: linear-gradient(150deg,#f5f3ff 0%,#fff 62%);
}
.loans-list-section[aria-labelledby="loans-lent-title"] .loans-section-heading h2 { color:#1d4ed8; }
.loans-list-section[aria-labelledby="loans-borrowed-title"] .loans-section-heading h2 { color:#6d28d9; }
.loans-section-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.loans-count { display:grid; place-items:center; min-width:34px; height:34px; padding:0 9px; border-radius:50px; font-weight:800; background:#dbeafe; color:#1d4ed8; }
.loans-list-section[aria-labelledby="loans-borrowed-title"] .loans-count { background:#ede9fe; color:#6d28d9; }
.loan-record-card {
  margin-top:12px;
  padding:15px;
  border:1px solid #dbe4ee;
  border-radius:16px;
  background:#fff;
  box-shadow:0 5px 16px rgba(15,23,42,.06);
}
.loan-record-card--lent { border-left:5px solid #3b82f6; }
.loan-record-card--borrowed { border-left:5px solid #8b5cf6; }
.loan-record-title-wrap { display:flex; align-items:center; gap:11px; min-width:0; }
.loan-record-symbol {
  display:grid;
  place-items:center;
  flex:0 0 42px;
  width:42px;
  height:42px;
  border-radius:13px;
  font-size:23px;
  font-weight:800;
}
.loan-record-card--lent .loan-record-symbol { color:#1d4ed8; background:#dbeafe; }
.loan-record-card--borrowed .loan-record-symbol { color:#6d28d9; background:#ede9fe; }
.loan-record-card--lent .loan-status { color:#1d4ed8; background:#eff6ff; }
.loan-record-card--borrowed .loan-status { color:#6d28d9; background:#f5f3ff; }
.loan-record-card.is-overdue { border-color:#fca5a5; border-left-color:#dc2626; background:#fffafa; }
.loan-record-card .loan-record-top { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.loan-record-card .loan-record-top h3 { margin:3px 0 0; overflow-wrap:anywhere; }
.loan-record-card .loan-status { display:inline-flex; align-items:center; justify-content:center; padding:6px 10px; border-radius:30px; font-size:12px; font-weight:800; text-align:center; }
.loan-record-facts { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin:12px 0; }
.loan-record-facts > span { padding:9px; border-radius:11px; background:#f1f5f9; color:#475569; font-size:12px; }
.loan-record-facts strong { display:block; margin-top:3px; color:#0f172a; font-size:14px; overflow-wrap:anywhere; }
.loan-record-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
@media (max-width:480px) {
  .loans-list-section { padding:12px; }
  .loan-record-card { padding:12px; }
  .loan-record-facts { gap:5px; }
  .loan-record-facts > span { padding:7px 5px; font-size:11px; }
  .loan-record-facts strong { font-size:13px; }
  .loan-record-symbol { flex-basis:36px; width:36px; height:36px; }
}


/* Goods on Repair — four clear workflow cards with balanced stage colours. */
.shop-goods-on-repair-card { border:1px solid #d8e4ee !important; border-radius:20px !important; background:#fff !important; box-shadow:0 12px 30px rgba(22,48,75,.08) !important; overflow:hidden !important; }
.shop-goods-on-repair-card > .repair-card-summary { display:flex !important; align-items:center !important; justify-content:space-between !important; gap:14px !important; padding:17px 18px !important; cursor:pointer !important; background:linear-gradient(110deg,#f0f7ff,#fff 68%) !important; border-bottom:1px solid #e3edf5 !important; }
.shop-goods-on-repair-card > .repair-card-summary strong { color:#153e63 !important; font-size:17px !important; }
.shop-goods-on-repair-card > .repair-card-summary small { display:block !important; margin-top:4px !important; color:#64748b !important; }
.repair-gold-mark { display:grid !important; place-items:center !important; flex:0 0 44px !important; width:44px !important; height:44px !important; border-radius:14px !important; color:#fff !important; background:#2563a6 !important; font-size:23px !important; }
.repair-card-content { padding:16px !important; }
.repair-card-heading { margin-bottom:15px !important; }
.repair-card-heading h2 { margin:5px 0 !important; color:#153e63 !important; }
.repair-card-heading p { margin:0 !important; color:#64748b !important; }
.repair-stage-tabs { display:grid !important; grid-template-columns:repeat(4,minmax(0,1fr)) !important; gap:9px !important; margin:16px 0 !important; }
.repair-stage-tab { display:flex !important; align-items:center !important; gap:9px !important; min-width:0 !important; min-height:76px !important; padding:10px !important; border:1px solid #dce5ef !important; border-radius:14px !important; background:#fff !important; color:#334155 !important; text-align:left !important; cursor:pointer !important; transition:transform .16s ease,box-shadow .16s ease,border-color .16s ease !important; }
.repair-stage-tab:hover { transform:translateY(-1px) !important; box-shadow:0 6px 15px rgba(15,35,60,.08) !important; }
.repair-stage-tab > span:last-child { display:grid !important; gap:3px !important; min-width:0 !important; }
.repair-stage-tab strong { display:block !important; font-size:13px !important; line-height:1.2 !important; overflow-wrap:anywhere !important; }
.repair-stage-tab small { display:block !important; color:#64748b !important; font-size:11px !important; line-height:1.2 !important; }
.repair-stage-icon { display:grid !important; place-items:center !important; flex:0 0 34px !important; width:34px !important; height:34px !important; border-radius:11px !important; font-size:18px !important; background:#f1f5f9 !important; }
.repair-stage-tab[data-repair-stage="receive"] .repair-stage-icon { background:#dceeff !important; }
.repair-stage-tab[data-repair-stage="ready"] .repair-stage-icon { background:#dcfce7 !important; }
.repair-stage-tab[data-repair-stage="service"] .repair-stage-icon { background:#f0e7ff !important; }
.repair-stage-tab[data-repair-stage="issue"] .repair-stage-icon { background:#ffedd5 !important; }
.repair-stage-tab[data-repair-stage="receive"].is-active { border-color:#3b82f6 !important; background:#eff6ff !important; box-shadow:inset 0 0 0 1px #3b82f6 !important; }
.repair-stage-tab[data-repair-stage="ready"].is-active { border-color:#22a06b !important; background:#ecfdf5 !important; box-shadow:inset 0 0 0 1px #22a06b !important; }
.repair-stage-tab[data-repair-stage="service"].is-active { border-color:#8b5cf6 !important; background:#f5f3ff !important; box-shadow:inset 0 0 0 1px #8b5cf6 !important; }
.repair-stage-tab[data-repair-stage="issue"].is-active { border-color:#ea8a21 !important; background:#fff7ed !important; box-shadow:inset 0 0 0 1px #ea8a21 !important; }
.repair-stage-panel[hidden] { display:none !important; }
.repair-stage-panel { padding:15px !important; border:1px solid #e3eaf2 !important; border-radius:16px !important; background:#fff !important; }
.repair-stage-intro { display:flex !important; align-items:center !important; gap:12px !important; margin-bottom:15px !important; padding:13px !important; border-radius:13px !important; }
.repair-stage-intro h3 { margin:0 0 3px !important; font-size:16px !important; }
.repair-stage-intro p { margin:0 !important; color:#526277 !important; font-size:13px !important; }
.repair-stage-large-icon { display:grid !important; place-items:center !important; flex:0 0 42px !important; width:42px !important; height:42px !important; border-radius:13px !important; font-size:22px !important; background:#fff !important; }
.repair-stage-intro--receive { background:#eff6ff !important; color:#1d4ed8 !important; }
.repair-stage-intro--ready { background:#ecfdf5 !important; color:#087443 !important; }
.repair-stage-intro--service { background:#f5f3ff !important; color:#6d28d9 !important; }
.repair-stage-intro--issue { background:#fff7ed !important; color:#a65308 !important; }
.repair-record-row { display:grid !important; grid-template-columns:minmax(0,1.3fr) minmax(180px,.7fr) !important; gap:13px !important; margin:11px 0 !important; padding:14px !important; border:1px solid #dce5ef !important; border-left:5px solid #3b82f6 !important; border-radius:13px !important; background:#fff !important; }
.repair-record-row--ready { border-left-color:#22a06b !important; }
.repair-record-row--service { border-left-color:#8b5cf6 !important; }
.repair-record-row--issue { border-left-color:#ea8a21 !important; }
.repair-record-main { min-width:0 !important; display:grid !important; gap:5px !important; }
.repair-record-card-head { display:flex !important; align-items:center !important; justify-content:space-between !important; gap:8px !important; }
.repair-record-card-head > strong { color:#172b45 !important; font-size:15px !important; }
.repair-record-main small { color:#64748b !important; font-size:12px !important; line-height:1.4 !important; overflow-wrap:anywhere !important; }
.repair-record-tools { display:grid !important; align-content:start !important; gap:8px !important; min-width:0 !important; }
.repair-record-tools select,.repair-record-tools textarea { width:100% !important; min-width:0 !important; border:1px solid #d7e1eb !important; border-radius:9px !important; padding:9px !important; background:#fff !important; }
.repair-payment-notice { display:grid !important; gap:5px !important; margin-bottom:13px !important; padding:12px 14px !important; border:1px solid #f4d5a9 !important; border-radius:12px !important; background:#fff8ed !important; color:#814b12 !important; font-size:12px !important; line-height:1.45 !important; }
.repair-payment-notice strong { font-size:13px !important; }
.repair-payment-pending { margin:0 !important; color:#8a571a !important; font-size:12px !important; }
.repair-stage-empty { margin:0 !important; padding:18px 12px !important; border:1px dashed #cbd5e1 !important; border-radius:12px !important; color:#64748b !important; text-align:center !important; background:#f8fafc !important; }
.repair-register-footer { display:flex !important; align-items:center !important; gap:10px !important; margin-top:14px !important; padding:11px 12px !important; border-radius:12px !important; background:#f4f7fb !important; }
.repair-register-footer > div { display:grid !important; flex:1 !important; gap:2px !important; }
.repair-register-footer strong { color:#334155 !important; font-size:12px !important; }
.repair-register-footer small { color:#64748b !important; font-size:11px !important; }
.repair-register-mark { color:#2563a6 !important; font-size:20px !important; }
@media(max-width:680px) {
  .repair-stage-tabs { grid-template-columns:repeat(2,minmax(0,1fr)) !important; gap:8px !important; }
  .repair-stage-tab { min-height:68px !important; padding:9px !important; }
  .repair-stage-tab strong { font-size:12px !important; }
  .repair-record-row { grid-template-columns:minmax(0,1fr) !important; }
}
@media(max-width:380px) {
  .repair-card-content { padding:10px !important; }
  .repair-stage-tab { gap:6px !important; padding:8px 6px !important; }
  .repair-stage-icon { flex-basis:30px !important; width:30px !important; height:30px !important; }
  .repair-stage-tab strong { font-size:11px !important; }
}

/* Repair pricing, collection and customer receipt controls. */
.repair-inline-field { display:grid !important; gap:5px !important; color:#475569 !important; font-size:12px !important; font-weight:650 !important; }
.repair-inline-field input,.repair-inline-field select { width:100% !important; min-width:0 !important; padding:9px 10px !important; border:1px solid #d7e1eb !important; border-radius:9px !important; background:#fff !important; color:#172b45 !important; }
.repair-payment-hint { color:#64748b !important; font-size:11px !important; line-height:1.4 !important; }
.repair-payment-receipt-no { color:#9a5a12 !important; overflow-wrap:anywhere !important; }
.repair-subheading { margin:14px 0 7px !important; color:#9a5a12 !important; font-size:13px !important; }
.customer-repair-payment { display:block !important; color:#087443 !important; font-weight:700 !important; }
.repair-record-row--issue-ready { border-left-color:#ea8a21 !important; }
.repair-mpesa-reference[hidden] { display:none !important; }


/* Desktop navigation: keep the complete five-button dock inside the
   agreed 14 cm workspace. Compact width is capped at 400px and centred
   on the same viewport axis as the fixed desktop workspace. */
@media (min-width: 1024px) {
  html body.workspace-active main.shell > #workspace-nav:not(.hidden) {
    position: fixed !important;
    left: 50% !important;
    right: auto !important;
    bottom: 10px !important;
    transform: translateX(-50%) !important;
    box-sizing: border-box !important;
    width: min(400px, calc(14cm - 32px)) !important;
    max-width: min(400px, calc(100vw - 64px)) !important;
    min-width: 0 !important;
    padding: 6px 8px !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
    align-items: stretch !important;
    gap: 4px !important;
    overflow: hidden !important;
  }

  html body.workspace-active main.shell > #workspace-nav:not(.hidden) > button {
    box-sizing: border-box !important;
    flex: 1 1 0 !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 46px !important;
    padding: 5px 2px !important;
    font-size: 12px !important;
    line-height: 1.15 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  html body.workspace-active main.shell > #workspace-nav:not(.hidden) > button .nav-icon {
    flex: 0 0 auto !important;
  }
}


/* FINAL DESKTOP DOCK OVERRIDE
   Match the dock to the full inner width of the 14 cm workspace.
   Include the bottom-nav class in the selector to beat older, more
   specific rules elsewhere in the responsive stylesheets. */
@media (min-width: 1024px) {
  html body.workspace-active main.shell > nav#workspace-nav.bottom-nav:not(.hidden) {
    position: fixed !important;
    inset: auto auto 10px 50% !important;
    transform: translateX(-50%) !important;
    box-sizing: border-box !important;
    width: calc(14cm - 32px) !important;
    max-width: calc(100vw - 64px) !important;
    min-width: 0 !important;
    display: flex !important;
    flex-flow: row nowrap !important;
    justify-content: stretch !important;
    align-items: stretch !important;
    gap: 4px !important;
    padding: 6px 8px !important;
    overflow: hidden !important;
  }

  html body.workspace-active main.shell > nav#workspace-nav.bottom-nav:not(.hidden) > button {
    position: static !important;
    inset: auto !important;
    display: flex !important;
    flex: 1 1 0% !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: none !important;
    box-sizing: border-box !important;
    justify-content: center !important;
    align-items: center !important;
    min-height: 48px !important;
    padding: 5px 2px !important;
    margin: 0 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    text-align: center !important;
  }

  html body.workspace-active main.shell > nav#workspace-nav.bottom-nav:not(.hidden) > button > span:not(.nav-icon) {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-wrap: anywhere !important;
    text-align: center !important;
  }
}


/* DESKTOP CLEANUP: one scrolling model, no workspace navigation dock.
   The dock is intentionally removed while the desktop workspace is rebuilt.
   Remove the competing fixed-height/hidden-overflow shell behaviour so the
   14 cm workspace and its content scroll naturally as one page. */
@media (min-width: 1024px) {
  html body.workspace-active {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 100vh !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    touch-action: pan-y !important;
    overscroll-behavior-y: auto !important;
    padding: 0 0 24px !important;
  }

  html body.workspace-active main.shell {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    transform: none !important;
    display: block !important;
    width: 14cm !important;
    max-width: calc(100vw - 32px) !important;
    height: auto !important;
    min-height: calc(100vh - 72px) !important;
    max-height: none !important;
    margin: 0 auto !important;
    padding: 16px 14px 28px !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }

  html body.workspace-active main.shell > section:not(.hidden),
  html body.workspace-active main.shell > main:not(.hidden),
  html body.workspace-active main.shell > article:not(.hidden),
  html body.workspace-active main.shell > .panel:not(.hidden) {
    position: relative !important;
    flex: none !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    overscroll-behavior: auto !important;
    box-sizing: border-box !important;
  }
}
