/* START OF FILE style.css */
/* ==========================================================================
   1. General Body & Page Styles
   ========================================================================== */

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  background-color: #f0f2f5;
  color: #333;
  margin: 0;
  padding: 20px;
}

.app-footer {
  max-width: 1200px;
  margin: 28px auto 0;
  padding: 4px 0 0;
  text-align: center;
  font-size: 13px;
  color: #718096;
}
.app-footer p {
  margin: 0;
}
.app-footer a {
  color: #3182ce;
  text-decoration: none;
}
.app-footer a:hover,
.app-footer a:focus-visible {
  text-decoration: underline;
}
.footer-sep {
  margin: 0 0.45em;
  color: #cbd5e0;
}

.privacy-page {
  max-width: 720px;
  margin: 0 auto 20px;
}
.privacy-page .settings-back-btn {
  margin-bottom: 12px;
}
.privacy-doc {
  max-width: none;
  margin: 0;
  background: #ffffff;
  padding: 32px 40px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  line-height: 1.55;
}
.privacy-org {
  margin: 0;
  font-size: 0.85em;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #718096;
}
.privacy-doc h1 {
  margin: 8px 0 8px;
  font-size: 1.6em;
  color: #2d3748;
}
.privacy-meta {
  margin: 0 0 20px;
  font-size: 0.9em;
  color: #718096;
}
.privacy-summary {
  background: #ebf8ff;
  border: 1px solid #bee3f8;
  padding: 12px 14px;
  border-radius: 6px;
  margin: 0 0 20px;
}
.privacy-summary p {
  margin: 0;
  color: #2d3748;
}
.privacy-doc h2 {
  margin: 1.6em 0 0.5em;
  font-size: 1.15em;
  color: #2d3748;
}
.privacy-doc h3 {
  margin: 1.15em 0 0.4em;
  font-size: 1em;
  color: #4a5568;
}
.privacy-doc p,
.privacy-doc ul {
  margin: 0 0 0.85em;
}
.privacy-doc ul {
  padding-left: 1.25em;
}
.privacy-doc li {
  margin: 0 0 0.4em;
}
.privacy-doc a {
  color: #3182ce;
}
.privacy-doc address {
  font-style: normal;
  margin: 0 0 0.85em;
}
.privacy-table-wrap {
  overflow-x: auto;
  margin: 0 0 0.85em;
}
.privacy-doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95em;
}
.privacy-doc th,
.privacy-doc td {
  text-align: left;
  vertical-align: top;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
}
.privacy-doc th {
  background: #edf2f7;
  color: #4a5568;
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.privacy-doc code {
  font-size: 0.9em;
}
@media (max-width: 520px) {
  .privacy-doc {
    padding: 22px 18px;
  }
}

/* ==========================================================================
   2. Layout Containers & Views
   ========================================================================== */

.hidden {
  display: none !important;
}

header#app-header {
  max-width: 1200px;
  margin: 0 auto 20px auto;
  background: #ffffff;
  padding: 15px 0px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.header-content {
  display: flex;
  padding: 0px 25px;
  justify-content: space-between;
  align-items: center;
}
#header-user-display {
  font-weight: 600;
  color: #2d3748;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ==========================================================================
   Usage / plan badge (header)
   ========================================================================== */
.usage-badge {
  margin: 0;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.85em;
  font-weight: 600;
  color: #2d3748;
  background: #edf2f7;
  white-space: nowrap;
  line-height: 1.2;
}
.usage-badge--exceeded {
  color: #c53030;
  background: #fff5f5;
}
.usage-badge--manage {
  cursor: pointer;
}
.usage-badge--manage:hover {
  background: #e2e8f0;
}
.usage-badge--manage.usage-badge--exceeded:hover {
  background: #fed7d7;
}

.view-container {
  max-width: 400px;
  margin: 60px auto;
  background: #ffffff;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.view-container h1 {
  border-bottom: none;
  text-align: center;
  margin-bottom: 20px;
}

.settings-back-btn {
  display: inline-block;
  width: auto;
  margin: 0 0 12px 0;
  padding: 8px 14px;
}

.boot-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.boot-loading-text {
  margin: 0;
  font-size: 1.05em;
  font-weight: 600;
  color: #2d3748;
}

.boot-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e2e8f0;
  border-top-color: #4a5568;
  border-radius: 50%;
  animation: bootSpin 0.8s linear infinite;
}

@keyframes bootSpin {
  to {
    transform: rotate(360deg);
  }
}
.view-container p {
  color: #718096;
  font-size: 0.9em;
  text-align: center;
  margin-bottom: 20px;
}

.layout-container {
  display: flex;
  flex-direction: column;
  gap: 25px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}
.scan-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 25px;
  align-items: stretch;
  width: 100%;
}
.main-content {
  min-width: 0;
  background: #ffffff;
  padding: 25px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
}
.sidebar {
  position: relative;
  min-width: 0;
  min-height: 0;
}

/* ==========================================================================
   3. Auth Tabs & Settings UI Improvements
   ========================================================================== */

.auth-tabs {
  display: flex;
  border-bottom: 2px solid #edf2f7;
  margin-bottom: 20px;
}
.auth-tab {
  flex: 1;
  background: none;
  color: #718096;
  padding: 12px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 0.2s;
}
.auth-tab:hover {
  color: #2d3748;
  background-color: #f7fafc;
}
.auth-tab.active {
  color: #3182ce;
  border-bottom: 2px solid #3182ce;
  margin-bottom: -2px;
}

.info-box {
  background: #ebf8ff;
  border: 1px solid #bee3f8;
  padding: 12px;
  border-radius: 6px;
  margin-top: 10px;
  margin-bottom: 10px;
}
.info-box small {
  color: #2b6cb0;
  display: block;
  margin-bottom: 8px;
}

/* ==========================================================================
   4. Form Elements & Buttons
   ========================================================================== */

.form-container {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.input-wrapper {
  position: relative;
  display: flex;
  width: 100%;
  align-items: stretch;
}
.input-wrapper.search-wrapper {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.sku-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sku-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sku-row-inputs {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.sku-input-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.sku-row .sku-input-col .input-wrapper {
  width: 100%;
  flex: none;
}
.sku-row .input-wrapper {
  flex: 1;
  min-width: 0;
  width: auto;
}
.sku-row.is-sku-highlight .sku-input {
  border-color: #3182ce;
  background-color: #ebf8ff;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.2);
}
.add-more-sku-btn {
  width: auto;
  flex: 0 0 auto;
}
.sku-row .sku-input {
  flex: 1;
  min-width: 0;
}
.sku-qty-input {
  flex: 0 0 72px;
  width: 72px;
  min-width: 72px;
  height: 46px;
  text-align: center;
  padding-left: 8px;
  padding-right: 8px;
  box-sizing: border-box;
}
.sku-row-inputs .mode-toggle,
.sku-remove-btn {
  flex: 0 0 46px;
  height: 46px;
  padding: 0;
  margin-top: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #edf2f7;
  border: 1px solid #cbd5e0;
  color: #4a5568;
  cursor: pointer;
  width: auto;
  box-sizing: border-box;
}
.sku-remove-btn:hover {
  background-color: #fed7d7;
  border-color: #fc8181;
  color: #c53030;
}
.sku-remove-btn svg {
  width: 20px;
  height: 20px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-group label {
  font-size: 14px;
  font-weight: 600;
  color: #2d3748;
}
.field-group .required {
  color: #e53e3e;
}
.field-error {
  font-size: 13px;
  color: #e53e3e;
  line-height: 1.2;
}
.field-error:empty {
  display: none;
}
.field-hint {
  font-size: 12px;
  color: #718096;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
button {
  padding: 12px;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  font-size: 16px;
  transition: all 0.2s;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="datetime-local"] {
  width: 100%;
  box-sizing: border-box;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="datetime-local"]:focus {
  border-color: #4a5568;
  outline: none;
  box-shadow: 0 0 0 3px rgba(74, 85, 104, 0.1);
}
input:disabled {
  background: #edf2f7;
  color: #a0aec0;
  cursor: not-allowed;
  pointer-events: none;
}
.expiry-input-wrap {
  position: relative;
}
#order-expiry {
  cursor: pointer;
  color-scheme: light;
}
#order-expiry.is-empty {
  color: transparent;
}
#order-expiry.is-empty::-webkit-datetime-edit {
  visibility: hidden;
}
.expiry-placeholder {
  display: none;
  position: absolute;
  left: 12px;
  right: 40px;
  top: 0;
  bottom: 0;
  align-items: center;
  color: #a0aec0;
  font-size: 16px;
  pointer-events: none;
}
#order-expiry.is-empty ~ .expiry-placeholder {
  display: flex;
}
#order-expiry::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 1;
}
input.invalid {
  border-color: #e53e3e;
}
input.invalid:focus {
  box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.15);
}

/* Hidden traps for password managers; real secret stays type=text so Chrome won't autofill */
.autofill-trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.masked-secret {
  -webkit-text-security: disc;
}

button {
  background-color: #4a5568;
  color: white;
  cursor: pointer;
  border: none;
  font-weight: 600;
  width: 100%;
}
.form-container > button[type="submit"] {
  margin-top: 0;
}
button:hover {
  background-color: #2d3748;
}
button:disabled {
  background-color: #a0aec0;
  cursor: not-allowed;
}

button.secondary-btn,
a.secondary-btn {
  background-color: #edf2f7;
  color: #4a5568;
  width: auto;
  font-size: 14px;
  padding: 8px 16px;
  margin-top: 0;
}
a.secondary-btn {
  display: inline-block;
  text-decoration: none;
  font-family: inherit;
  font-weight: 600;
  border-radius: 6px;
  line-height: inherit;
  box-sizing: border-box;
}
button.secondary-btn:hover,
a.secondary-btn:hover,
a.secondary-btn:focus-visible {
  background-color: #e2e8f0;
}

button.danger-btn {
  background-color: #fff5f5;
  color: #c53030;
  border: 1px solid #feb2b2;
  width: 100%;
  font-size: 14px;
  padding: 12px;
  margin-top: 8px;
}
button.danger-btn:hover {
  background-color: #fed7d7;
}

.password-wrapper input {
  padding-right: 44px;
}
.password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #718096;
  cursor: pointer;
  box-shadow: none;
}
.password-toggle:hover {
  background: transparent;
  color: #2d3748;
}
.password-toggle svg {
  width: 20px;
  height: 20px;
}

.mode-toggle {
  flex: 0 0 46px;
  padding: 0;
  margin-top: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #edf2f7;
  border: 1px solid #cbd5e0;
  color: #4a5568;
  cursor: pointer;
  width: auto;
  box-sizing: border-box;
}
.mode-toggle svg {
  width: 24px;
  height: 24px;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.mode-toggle:hover {
  background-color: #e2e8f0;
  border-color: #a0aec0;
}
.mode-toggle.active {
  background-color: #3182ce;
  border-color: #3182ce;
  color: white;
}
.mode-toggle.active:hover {
  background-color: #2c5282;
}
.mode-toggle.active svg {
  transform: rotate(135deg);
}
input.create-mode-active {
  border-color: #3182ce;
  background-color: #ebf8ff;
}
input.create-mode-active:focus {
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.2);
}

/* ==========================================================================
   5. Inventory Status & Notifications
   ========================================================================== */

.sidebar-product {
  position: absolute;
  inset: 0;
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  overflow: hidden;
  container-type: inline-size;
}
.sidebar-product.is-empty .sidebar-product-list {
  display: none;
}
.sidebar-product:not(.is-empty) .sidebar-product-empty {
  display: none;
}
.sidebar-product-empty {
  color: #718096;
  font-weight: 500;
  text-align: center;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 12px;
}
.sidebar-product-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.sidebar-product-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
  padding-bottom: 12px;
  border-bottom: 1px solid #e2e8f0;
}
.sidebar-product-item:last-child {
  padding-bottom: 0;
  border-bottom: none;
}
.sidebar-product-item-image {
  display: block;
  width: 100%;
  max-height: 240px;
  max-height: 70cqi;
  height: auto;
  object-fit: contain;
  object-position: center;
  box-sizing: border-box;
  padding: 8px;
  border-radius: 6px;
  background: #edf2f7;
}
/* One product: fill leftover panel height so a 1200px layout doesn't leave a gap */
.sidebar-product-list:has(> :only-child) .sidebar-product-item {
  flex: 1;
  min-height: 0;
}
.sidebar-product-list:has(> :only-child) .sidebar-product-item-image {
  flex: 1 1 0;
  height: 0;
  max-height: none;
}
.sidebar-product-item-image.is-empty,
.history-detail-image.is-empty {
  display: none;
}
.sidebar-product-item-price {
  font-size: 0.8em;
  font-weight: 500;
  line-height: 1.3;
  color: #2d3748;
}
.sidebar-product-item-price:empty {
  display: none;
}
.sidebar-product-item-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-product-item-title {
  font-size: 0.85em;
  font-weight: 600;
  color: #2d3748;
  line-height: 1.3;
}
.sidebar-product-item-sku {
  font-size: 0.85em;
  color: #718096;
  font-family: monospace;
}
.sidebar-product-item-status {
  font-size: 0.75em;
  font-weight: 600;
  color: #4a5568;
  line-height: 1.35;
}
.sidebar-product-item-status.error {
  color: #c53030;
}

.notification-box {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 15px 25px;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  transition:
    top 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    opacity 0.5s;
  opacity: 1;
}
.notification-box.hidden {
  top: -100px;
  opacity: 0;
}
.notification-box.error {
  background-color: #e53e3e;
}
.notification-box.success {
  background-color: #48bb78;
}
.notification-box.warning {
  background-color: #dd6b20;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: transparent;
  padding: 16px;
}
.modal-overlay::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(45, 55, 72, 0.45);
}
/* Confirm can stack on other dialogs (e.g. Undo over history detail). */
#confirm-dialog {
  z-index: 1200;
}
.modal-dialog {
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  max-width: 400px;
  width: 100%;
  margin: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
}
body.modal-open {
  overflow: hidden;
}
.modal-dialog h3 {
  margin: 0 0 10px;
  color: #2d3748;
  font-size: 1.15rem;
}
.modal-dialog p {
  margin: 0 0 20px;
  color: #718096;
  font-size: 0.95em;
  line-height: 1.45;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}
.modal-actions button {
  width: auto;
  padding: 10px 18px;
  font-size: 14px;
  margin: 0;
}
.modal-actions #btn-confirm-ok {
  background-color: #e53e3e;
}
.modal-actions #btn-confirm-ok:hover {
  background-color: #c53030;
}
.modal-actions #btn-upgrade-ok {
  background-color: #3182ce;
}
.modal-actions #btn-upgrade-ok:hover {
  background-color: #2b6cb0;
}
.modal-actions #btn-upgrade-ok:disabled {
  background-color: #a0aec0;
  cursor: not-allowed;
}
.modal-actions .upgrade-cancel-plan {
  margin-right: auto;
  color: #c53030;
  border-color: #feb2b2;
}
.modal-actions .upgrade-cancel-plan:hover {
  background: #fff5f5;
  color: #9b2c2c;
}
.upgrade-dialog {
  max-width: 440px;
}
.upgrade-plan-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 20px;
}
.upgrade-plan-option {
  display: block;
  padding: 16px;
  border: 1px solid #cbd5e0;
  border-radius: 8px;
  background: #fff;
}
.upgrade-plan-option.is-selected {
  border-color: #3182ce;
  background: #f7fafc;
}
.upgrade-plan-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.upgrade-plan-price {
  color: #1a202c;
  font-size: 1.15rem;
  font-weight: 700;
}
.upgrade-plan-blurb {
  color: #718096;
  font-size: 0.9rem;
  margin: 2px 0 10px;
}
.upgrade-plan-perks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.upgrade-plan-perks li {
  color: #2d3748;
  font-size: 0.9rem;
  padding-left: 1.15em;
  position: relative;
}
.upgrade-plan-perks li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: #38a169;
  font-weight: 700;
}
.upgrade-dialog-note {
  margin: 0 0 16px;
  color: #4a5568;
  font-size: 0.9rem;
  line-height: 1.4;
}
#form-create-customer {
  margin-bottom: 0;
}
#form-create-customer .modal-actions {
  margin-top: 4px;
}
.autocomplete-create {
  color: #3182ce;
  font-weight: 600;
  border-top: 1px solid #bee3f8;
  background: #ebf8ff;
}
.autocomplete-create:hover {
  background-color: #bee3f8 !important;
}
.autocomplete-active.autocomplete-create {
  background-color: #3182ce !important;
  color: #fff;
}
.autocomplete-empty {
  color: #718096;
  cursor: default;
  font-weight: 500;
  justify-content: center;
}
.autocomplete-items .autocomplete-empty:hover,
.autocomplete-active.autocomplete-empty {
  background-color: transparent !important;
  color: #718096;
}

/* ==========================================================================
   6. Autocomplete List
   ========================================================================== */
.autocomplete-items {
  position: absolute;
  z-index: 99;
  width: 100%;
  left: 0;
  top: 100%;
  margin-top: 4px;
  background-color: white;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  max-height: 300px;
  overflow-y: auto;
}
.autocomplete-items div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px;
  cursor: pointer;
  border-bottom: 1px solid #edf2f7;
}
.autocomplete-items div:last-child {
  border-bottom: none;
}
.autocomplete-items div:hover {
  background-color: #f7fafc;
}
.autocomplete-active {
  background-color: #4a5568 !important;
  color: #ffffff;
}
.autocomplete-active .autocomplete-order-id,
.autocomplete-active .autocomplete-email {
  color: #e2e8f0;
}
.autocomplete-order-id {
  font-weight: 600;
  white-space: nowrap;
  color: #4a5568;
}
.autocomplete-order-id--customer {
  color: #3182ce;
}
.autocomplete-active .autocomplete-order-id--customer {
  color: #ffffff;
}
.autocomplete-name {
  flex-grow: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.autocomplete-email {
  color: #718096;
  font-size: 0.9em;
  white-space: nowrap;
}
.autocomplete-count {
  background-color: #edf2f7;
  color: #4a5568;
  font-size: 0.85em;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  white-space: nowrap;
  margin-left: auto;
}
.autocomplete-fb-name {
  background-color: #ebf8ff;
  color: #2b6cb0;
  font-size: 0.8em;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
.autocomplete-active .autocomplete-fb-name {
  background-color: rgba(255, 255, 255, 0.18);
  color: #e2e8f0;
}

/* ==========================================================================
   7. Sidebar & History
   ========================================================================== */
.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}
.history-header h2 {
  margin: 0;
}
.history-header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.session-select-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #4a5568;
  margin: 0;
}
#session-select {
  min-width: 160px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
}
#btn-clear-history:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.history-search {
  width: 100%;
  margin-bottom: 10px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.history-search:focus {
  border-color: #90cdf4;
  background: #ebf8ff;
  outline: none;
}
#form-save-session .modal-actions {
  margin-top: 8px;
}
.history-container {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  background: #ffffff;
  padding: 25px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
}
#history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
#history-list li {
  background: #f7fafc;
  border-radius: 6px;
  padding: 10px;
  border: 1px solid #e2e8f0;
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  align-items: center;
  box-sizing: border-box;
  min-width: 36rem;
}
#history-list li.history-item {
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
#history-list li.history-item:hover,
#history-list li.history-item:focus-visible {
  border-color: #90cdf4;
  background: #ebf8ff;
  outline: none;
}
#history-list li input {
  background-color: #fff;
  border: 1px solid #e2e8f0;
  padding: 8px;
  text-align: left;
  font-size: 14px;
  border-radius: 4px;
  pointer-events: none;
  flex-shrink: 0;
  white-space: nowrap;
}
#history-list li.history-empty {
  justify-content: center;
  color: #718096;
  font-size: 14px;
  border-style: dashed;
  cursor: default;
  min-width: 0;
  width: 100%;
}
.history-pagination {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.history-pagination[hidden] {
  display: none;
}
.history-page-btn {
  flex-shrink: 0;
  width: auto;
  min-width: 26px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #edf2f7;
  color: #4a5568;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.history-page-btn:hover:not(:disabled):not(.is-current) {
  background: #e2e8f0;
}
.history-page-btn:focus-visible {
  outline: 2px solid #90cdf4;
  outline-offset: 1px;
}
.history-page-btn.is-current {
  background: #4a5568;
  border-color: #4a5568;
  color: #fff;
  cursor: default;
}
.history-page-btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.history-page-ellipsis {
  padding: 0 4px;
  color: #718096;
}
.download-dropdown {
  position: relative;
  display: inline-block;
}
.download-dropdown[hidden] {
  display: none;
}
.download-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  z-index: 20;
  min-width: 100%;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}
/* Invisible bridge on the wrapper (menu has overflow:hidden, which would clip it) keeps hover alive across the gap. */
.download-dropdown:hover::after,
.download-dropdown:focus-within::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 6px;
}
.download-menu.hidden {
  display: none;
}
.download-dropdown:hover .download-menu,
.download-dropdown:focus-within .download-menu {
  display: flex !important;
}
.download-menu-item {
  width: 100%;
  background: #fff;
  color: #2d3748;
  border: none;
  border-radius: 0;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.download-menu-item:hover {
  background: #ebf8ff;
}
.modal-actions #btn-history-detail-undo {
  width: auto;
  margin-top: 0;
  padding: 10px 18px;
}
.history-detail-dialog {
  max-width: 560px;
}
.scan-log-dialog {
  max-width: 720px;
}
#scan-log-list {
  list-style: none;
  margin: 12px 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  max-height: 60vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transition: opacity 0.15s ease;
}
#scan-log-list.is-loading {
  opacity: 0.5;
  pointer-events: none;
}
.scan-log-dialog .modal-actions {
  margin-top: 8px;
}
.scan-log-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.scan-log-dialog-header h3 {
  margin: 0;
}
.scan-log-close-icon {
  width: auto;
  background: none;
  border: none;
  color: #718096;
  font-size: 24px;
  line-height: 1;
  padding: 0 0 4px;
  cursor: pointer;
}
.scan-log-close-icon:hover {
  background: none;
  color: #2d3748;
}
#scan-log-list li.scan-log-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f7fafc;
  border-radius: 8px;
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  box-sizing: border-box;
}
.scan-log-row-main {
  flex: 1 1 auto;
  min-width: 0;
}
.scan-log-row-title-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}
.scan-log-sku {
  font-weight: 700;
  font-size: 14px;
  color: #2d3748;
}
.scan-log-title {
  font-size: 14px;
  color: #2d3748;
}
.scan-log-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 4px;
  font-size: 12px;
  color: #718096;
}
.scan-log-row-status {
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
#scan-log-list li.history-empty {
  justify-content: center;
  color: #718096;
  font-size: 14px;
  border-style: dashed;
  cursor: default;
  min-width: 0;
  width: 100%;
  display: flex;
  background: #f7fafc;
  border-radius: 6px;
  padding: 10px;
  border: 1px solid #e2e8f0;
  box-sizing: border-box;
}
.scan-log-outcome {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.scan-log-outcome--found {
  color: #38a169;
}
.scan-log-outcome--not_found {
  color: #c53030;
}
.scan-log-outcome--error {
  color: #c53030;
}
.scan-log-added-pill {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  padding: 4px 10px;
  border-radius: 999px;
  color: #c53030;
  background: #fff5f5;
}
.scan-log-added-pill.is-added {
  color: #fff;
  background: #38a169;
}
.history-detail-image {
  display: block;
  width: min(250px, 100%);
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  background: #e2e8f0;
  margin: 0 auto 16px;
}
.history-detail-list {
  margin: 0 0 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.history-detail-list > div {
  display: grid;
  grid-template-columns: 9.5em minmax(0, 1fr);
  gap: 8px 12px;
  align-items: baseline;
}
.history-detail-list dt {
  margin: 0;
  font-size: 0.85em;
  font-weight: 600;
  color: #718096;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.history-detail-list dd {
  margin: 0;
  color: #2d3748;
  font-size: 0.95em;
  word-break: break-word;
  overflow-wrap: anywhere;
}
#history-detail-shipping {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 420px) {
  .modal-overlay {
    padding: 12px;
  }
  .modal-dialog {
    padding: 16px;
  }
  .history-detail-list > div {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .history-detail-dialog .modal-actions {
    flex-direction: column-reverse;
  }
  .history-detail-dialog .modal-actions button {
    width: 100%;
  }
}
#history-list li input.history-sku {
  flex: 1.2 0 9em;
}
#history-list li input.history-quantity {
  flex: 0 0 4.5em;
  text-align: center;
}
#history-list li input.history-customer {
  flex: 1.6 0 10em;
}
#history-list li input.history-expiry {
  flex: 1 0 20em;
  font-size: 12px;
  color: #718096;
  text-align: left;
}
#history-list li input.history-expiry.is-expired {
  color: #9b2c2c;
  background: #fff5f5;
  border-color: #feb2b2;
  font-weight: 600;
}
.history-new-marker {
  flex: 0 0 1.1em;
  font-weight: 700;
  color: #c05621;
  text-align: center;
  line-height: 1;
}
.history-new-marker--empty {
  visibility: hidden;
}
.history-created {
  border-color: #fbd38d;
  background: #fffaf0;
}
.history-detail-status-expired {
  color: #9b2c2c;
  font-weight: 700;
}

/* (usage badge styles live under header) */
/* END OF FILE style.css */

/* Find Product search-mode toggle */
.find-product-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}
.find-product-header label {
  margin-bottom: 0;
}
.search-mode-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  padding: 3px;
  gap: 2px;
  background-color: #edf2f7;
  border-radius: 8px;
}
.search-mode-btn {
  width: auto;
  margin: 0;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #4a5568;
  background-color: transparent;
  border: none;
  border-radius: 6px;
  box-shadow: none;
  cursor: pointer;
}
.search-mode-btn:hover {
  background-color: #e2e8f0;
}
.search-mode-btn.is-active,
.search-mode-btn.is-active:hover {
  color: #ffffff;
  background-color: #4a5568;
}
.autocomplete-product-img {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  object-fit: cover;
  border-radius: 4px;
}
.sku-source-badge {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: #4a5568;
  background-color: #edf2f7;
  border-radius: 999px;
  pointer-events: none;
}
.sku-source-badge[hidden],
.sku-unpicked-msg[hidden] {
  display: none;
}
.sku-row .sku-input {
  padding-right: 64px;
}
.sku-row .sku-input.is-unpicked,
.sku-row.is-sku-highlight .sku-input.is-unpicked {
  border-color: #dd6b20;
  background-color: #fffaf0;
  box-shadow: 0 0 0 3px rgba(221, 107, 32, 0.2);
}
.sku-unpicked-msg {
  align-self: flex-start;
  font-size: 12px;
  color: #c05621;
}
