/* Final mobile fixes loaded after the main stylesheet. */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

html {
  background: #e30620;
}

body,
.app-shell {
  background: #f4f6f9;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: env(safe-area-inset-top);
  background: #e30620;
  pointer-events: none;
  z-index: 0;
}

.app-shell {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

.feed-tools {
  position: static !important;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 8px;
  margin: -6px 0 8px !important;
  padding: 5px;
  border: 1px solid rgba(168, 221, 185, 0.95);
  border-radius: 13px;
  background: #f2fbf5;
  box-shadow: 0 8px 18px rgba(18, 24, 38, 0.06);
}

.feed-tools .status-badge {
  min-height: 44px;
  justify-content: flex-start;
  padding: 9px 12px;
  border-color: transparent;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 750;
}

.feed-tools.is-stale,
.feed-tools.has-update {
  border-color: rgba(245, 158, 11, 0.52);
  background: #fffbeb;
}

.feed-tools.is-stale .status-badge,
.feed-tools.has-update .status-badge {
  background: #fff7d6;
  color: #92400e;
}

.feed-tools.is-stale .status-badge.loading::before,
.feed-tools.has-update .status-badge.loading::before {
  background: linear-gradient(90deg, #fde68a 0%, #facc15 100%);
}

.feed-tools.is-stale .btn-feed-retry:not(:disabled),
.feed-tools.has-update .btn-feed-retry:not(:disabled) {
  border-color: rgba(245, 158, 11, 0.55);
  background: #ffffff;
  animation: feedUpdateButtonPulse 1.45s ease-in-out infinite;
}

@keyframes feedUpdateButtonPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.22);
  }

  50% {
    box-shadow: 0 0 0 7px rgba(245, 158, 11, 0.12);
  }
}

#productSection.list-card {
  overflow: visible;
}

.bottom-panel.has-items {
  position: sticky !important;
  left: auto !important;
  bottom: calc(15px + env(safe-area-inset-bottom)) !important;
  z-index: 34;
  width: 100% !important;
  margin: 14px 0 0 !important;
  transform: none !important;
  box-sizing: border-box;
}

body.has-checkout-tray .app-shell {
  padding-bottom: 28px !important;
}

body.has-checkout-tray .cookie-floating-settings {
  display: grid;
}

.bottom-panel.has-items .btn-b2b[data-empty] {
  border-color: #e2e8f0;
  background: #e9eef5;
  color: #8b95a5;
  cursor: pointer;
}

.bottom-panel.has-items .b2b-button-icon {
  width: 36px;
  height: 30px;
  flex-basis: 36px;
  margin-right: 0;
}

.bottom-panel.has-items .b2b-button-icon svg {
  width: 23px;
  height: 23px;
  transform: translateX(-5px);
}

.bottom-panel.has-items .b2b-count-badge {
  right: -4px;
  bottom: -7px;
  min-width: 28px;
  height: 19px;
  padding-inline: 4px;
  border-width: 2px;
  font-size: 10px;
}

#exportCsvBtn {
  --icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 3v12' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'/%3E%3Cpath d='m7 10 5 5 5-5' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M5 19h14' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E") !important;
}

#importCsvBtn {
  --icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 15V3' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'/%3E%3Cpath d='m7 8 5-5 5 5' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M5 19h14' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E") !important;
}

#resetBtn {
  --icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21 12a9 9 0 1 1-2.64-6.36M21 4v6h-6' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
}

.bottom-panel.has-items .tools-actions .btn::before,
.bottom-panel.has-items .btn-reset::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  margin-right: 0;
  background-color: currentColor !important;
  background-image: none !important;
  mask: var(--icon) center / contain no-repeat !important;
  -webkit-mask: var(--icon) center / contain no-repeat !important;
}

@media (max-width: 430px) {
  .hero {
    min-height: 322px !important;
    padding: max(18px, calc(16px + env(safe-area-inset-top))) 16px 205px !important;
  }

  .hero-top {
    width: 100% !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    column-gap: 7px !important;
  }

  .brand {
    min-width: 0 !important;
    gap: 8px !important;
  }

  .brand-logo {
    width: 50px !important;
    height: 50px !important;
    flex-basis: 50px !important;
  }

  .hero h1,
  .brand-copy h1 {
    max-width: 128px !important;
    font-size: 21px !important;
    line-height: 1.02 !important;
  }

  .hero-actions {
    max-width: 122px !important;
    gap: 6px !important;
  }

  .language-select {
    width: 78px !important;
    min-width: 78px !important;
    height: 42px !important;
    padding-left: 8px !important;
    padding-right: 23px !important;
    background-position: right 9px center !important;
    font-size: 14px !important;
  }

  .header-info-btn {
    width: 38px !important;
    height: 42px !important;
    flex-basis: 38px !important;
  }

  .header-info-btn svg {
    width: 21px !important;
    height: 21px !important;
  }

  .hero-subtitle.hero-subtitle {
    width: 100% !important;
    max-width: 100% !important;
    justify-content: space-between;
    gap: 4px;
    margin: 11px 0 0 !important;
    padding: 7px;
    border-radius: 10px;
    box-sizing: border-box;
    font-size: 9px !important;
  }

  .hero-flow-step {
    flex: 1 1 0;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    white-space: nowrap;
  }

  .hero-flow-step span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hero-flow-icon,
  .hero-flow-icon svg {
    width: 11px;
    height: 11px;
  }

  .stack {
    width: 100% !important;
    max-width: 100vw !important;
    gap: 11px !important;
    margin-top: -198px !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
    box-sizing: border-box !important;
  }

  .scanner-card,
  .list-card,
  .feed-tools,
  .bottom-panel.has-items {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .scanner-wrap,
  .manual-toggle,
  .manual-entry {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }

  .manual-toggle {
    min-width: 0 !important;
  }

  .feed-tools {
    grid-template-columns: minmax(0, 1fr) 44px !important;
    margin-top: -4px !important;
    margin-bottom: 7px !important;
  }

  .feed-tools .status-badge {
    min-height: 42px;
    padding: 8px 10px;
    font-size: 13px;
  }

  .feed-tools .btn-feed-retry {
    width: 44px !important;
    min-width: 44px !important;
    min-height: 42px;
    padding: 0 !important;
    font-size: 0 !important;
  }

  .feed-tools .feed-retry-label,
  .feed-tools .feed-update-badge {
    display: none !important;
  }

  #productSection.list-card {
    padding-top: 18px !important;
  }

  .list-header {
    margin-bottom: 15px !important;
  }

  .bottom-panel.has-items {
    bottom: calc(15px + env(safe-area-inset-bottom)) !important;
    padding: 10px !important;
    box-shadow: 0 14px 34px rgba(18, 24, 38, 0.18);
  }

  .bottom-panel.has-items .btn-b2b {
    min-height: 56px;
  }
}

/* Desktop must stay in the original phone-app width inside Mikado Tools. */
@media (min-width: 701px) {
  html {
    background: #f4f6f9 !important;
  }

  body::before {
    content: none !important;
    display: none !important;
  }

  .app-shell {
    width: 100% !important;
    max-width: 610px !important;
    margin: 0 auto !important;
    overflow-x: visible !important;
    background: transparent !important;
  }

  .hero {
    min-height: 368px !important;
    padding: 42px 30px 238px !important;
    border-radius: 0 0 16px 16px !important;
  }

  .hero-top {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    row-gap: 12px !important;
    column-gap: 12px !important;
    align-items: flex-start !important;
  }

  .hero-subtitle.hero-subtitle {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    max-width: 100% !important;
    justify-content: space-between !important;
    gap: 8px !important;
    margin: 0 !important;
    padding: 7px 10px !important;
    border-radius: 10px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .hero-flow-step {
    flex: 1 1 0 !important;
    justify-content: center !important;
    min-width: 0 !important;
  }

  .hero-flow-step span:last-child {
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .stack {
    width: auto !important;
    max-width: none !important;
    gap: 26px !important;
    margin-top: -232px !important;
    padding: 0 28px !important;
    box-sizing: border-box !important;
  }

  .scanner-card,
  .list-card,
  .feed-tools {
    width: auto !important;
    max-width: none !important;
    box-sizing: border-box !important;
  }

  .scanner-wrap,
  .manual-toggle,
  .manual-entry {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .feed-tools {
    margin: -10px 0 12px !important;
  }

  .bottom-panel.has-items {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

/* Empty-cart guidance and tighter catalog/order pairing. */
.product-list.empty {
  cursor: pointer;
}

.btn-camera-start.empty-guide-flash,
.manual-toggle.empty-guide-flash {
  animation: emptyGuideFlash 1.05s ease-out !important;
}

@keyframes emptyGuideFlash {
  0% {
    box-shadow: inset 0 0 0 999px rgba(227, 6, 32, 0), 0 0 0 0 rgba(227, 6, 32, 0);
  }

  18% {
    box-shadow: inset 0 0 0 999px rgba(227, 6, 32, 0.16), 0 0 0 6px rgba(227, 6, 32, 0.18);
  }

  48% {
    box-shadow: inset 0 0 0 999px rgba(227, 6, 32, 0.10), 0 0 0 10px rgba(227, 6, 32, 0.10);
  }

  100% {
    box-shadow: inset 0 0 0 999px rgba(227, 6, 32, 0), 0 0 0 0 rgba(227, 6, 32, 0);
  }
}

.feed-tools.feed-tools {
  min-height: 35px !important;
  grid-template-columns: minmax(0, 1fr) 42px !important;
  gap: 4px !important;
  margin-bottom: -11px !important;
  padding: 3px !important;
  border-radius: 12px 12px 0 0 !important;
  box-shadow: 0 4px 12px rgba(18, 24, 38, 0.05) !important;
}

.feed-tools.has-update,
.feed-tools.is-stale {
  grid-template-columns: minmax(0, 1fr) 104px !important;
}

.feed-tools .status-badge.status-badge {
  min-width: 0 !important;
  min-height: 28px !important;
  padding: 4px 8px !important;
  border-radius: 8px 0 0 0 !important;
  font-size: 11px !important;
  line-height: 1.1 !important;
  overflow: hidden !important;
}

.feed-tools .status-badge::after {
  font-size: 11px !important;
}

.feed-tools .status-badge.success::before,
.feed-tools .status-badge.error::before {
  width: 18px !important;
  height: 18px !important;
  font-size: 12px !important;
}

.feed-tools .btn-feed-retry.btn-feed-retry {
  position: relative !important;
  min-height: 28px !important;
  width: 42px !important;
  min-width: 42px !important;
  max-width: 42px !important;
  padding: 0 !important;
  border-radius: 8px 8px 0 0 !important;
  overflow: hidden !important;
  font-size: 0 !important;
  justify-content: center !important;
}

.feed-tools.has-update .btn-feed-retry.btn-feed-retry,
.feed-tools.is-stale .btn-feed-retry.btn-feed-retry {
  width: 104px !important;
  min-width: 104px !important;
  max-width: 104px !important;
  justify-content: flex-start !important;
}

.feed-tools .btn-feed-retry::before {
  width: 16px !important;
  height: 16px !important;
  margin: 0 !important;
}

.feed-tools.has-update .btn-feed-retry::before,
.feed-tools.is-stale .btn-feed-retry::before {
  position: absolute !important;
  left: 9px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
}

.feed-tools .feed-retry-label {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}

.feed-tools .feed-update-badge {
  position: absolute !important;
  display: inline-flex !important;
  top: 50% !important;
  right: 6px !important;
  transform: translateY(-50%) !important;
  min-width: 0 !important;
  max-width: 70px !important;
  min-height: 20px !important;
  padding: 3px 7px !important;
  overflow: hidden !important;
  font-size: 9px !important;
  line-height: 1 !important;
  text-overflow: ellipsis !important;
}

#productSection.list-card {
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
}

.product-list.empty.has-empty-action::before,
.product-list.empty.has-empty-action::after {
  content: none !important;
  display: none !important;
}

.product-list.empty.has-empty-action {
  cursor: default;
}

.empty-list-action {
  display: grid;
  width: 100%;
  min-height: 114px;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  padding: 20px 24px 20px 38px;
  border: 1.5px dashed #d8dee8;
  border-radius: 12px;
  background: #ffffff;
  color: #828a99;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}

.empty-list-action__icon {
  display: block;
  width: 58px;
  height: 58px;
  border-radius: 999px;
  background:
    repeating-linear-gradient(90deg, #9ca3af 0 3px, transparent 3px 7px) center / 30px 27px no-repeat,
    #f1f2f4;
}

.empty-list-action:focus-visible {
  outline: 3px solid rgba(227, 6, 32, 0.22);
  outline-offset: 3px;
}

.empty-list-action:active {
  border-color: rgba(227, 6, 32, 0.34);
  background: #fff7f8;
}

.scanner-card .scanner-wrap .camera-actions .btn-camera-start.empty-guide-flash,
.scanner-card .scanner-wrap .camera-actions .btn-camera-stop.empty-guide-flash,
.scanner-card .manual-toggle.empty-guide-flash {
  animation: emptyGuideFlash 1.05s ease-out !important;
}

.hero-top.hero-top {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  row-gap: 12px !important;
  column-gap: 10px !important;
  align-items: center !important;
}

.hero-subtitle.hero-subtitle {
  grid-column: 1 / -1 !important;
  width: 100% !important;
  max-width: 100% !important;
  justify-content: space-between !important;
  gap: 6px !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

.hero-flow-step {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  justify-content: center !important;
}

.hero-flow-step span:last-child {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.scanner-card:not(:has(.scanner-wrap.active)):not(:has(.manual-toggle.open)) .scanner-wrap:not(.active) .btn-camera-start.empty-guide-flash,
.scanner-card:not(:has(.scanner-wrap.active)):not(:has(.manual-toggle.open)) .scanner-wrap:not(.active) .btn-camera-stop.empty-guide-flash,
.scanner-card:not(:has(.scanner-wrap.active)):not(:has(.manual-toggle.open)) .manual-toggle.empty-guide-flash {
  animation: emptyGuideFlash 1.05s ease-out !important;
}

@media (min-width: 701px) {
  .feed-tools.feed-tools {
    margin-bottom: -26px !important;
  }
}

/* Admin settings lives above the scanner hero when the user is authorized. */
.admin-topbar {
  position: relative;
  z-index: 6;
  display: flex;
  justify-content: flex-end;
  width: 100%;
  padding: 8px 16px 6px;
  box-sizing: border-box;
  background: linear-gradient(160deg, #f0142f 0%, #cc001a 100%);
}

.admin-topbar + .hero {
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
}

.admin-topbar .app-settings-link.app-settings-link {
  width: auto !important;
  min-width: 0 !important;
  min-height: 44px !important;
  padding: 0 14px !important;
  gap: 8px !important;
  border: 1px solid rgba(255, 255, 255, 0.34) !important;
  border-radius: 12px !important;
  background: rgba(255, 255, 255, 0.16) !important;
  color: #ffffff !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  box-shadow: 0 8px 18px rgba(68, 0, 12, 0.12) !important;
  backdrop-filter: blur(12px);
}

.admin-topbar .app-settings-link.app-settings-link span {
  position: static !important;
  width: auto !important;
  height: auto !important;
  overflow: visible !important;
  clip: auto !important;
  white-space: nowrap !important;
}

.admin-topbar .app-settings-link.app-settings-link svg {
  width: 18px !important;
  height: 18px !important;
  flex: 0 0 18px !important;
}

@media (max-width: 430px) {
  .admin-topbar {
    padding: max(7px, env(safe-area-inset-top)) 16px 6px !important;
  }

  .admin-topbar + .hero {
    min-height: 268px !important;
    padding-top: 10px !important;
  }

  .scanner-wrap:not(.active) .camera-actions .btn-camera-start,
  .scanner-wrap:not(.active) .camera-actions .btn-camera-stop {
    padding-left: 108px !important;
    padding-right: 58px !important;
  }

  .btn-camera-start .action-subtitle,
  .btn-camera-stop .action-subtitle {
    font-size: 15px !important;
    line-height: 1.13 !important;
  }
}

@media (min-width: 431px) and (max-width: 700px) {
  .admin-topbar + .hero {
    min-height: 312px !important;
    padding-top: 14px !important;
  }
}

@media (min-width: 701px) {
  .admin-topbar {
    max-width: 610px !important;
    margin: 0 auto !important;
    padding: 10px 28px 8px !important;
  }

  .admin-topbar + .hero {
    min-height: 312px !important;
    padding-top: 16px !important;
  }
}
