/* Navigation - Hamburger Menu */
.nav-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 0.6rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  flex-wrap: wrap;
}

.nav-brand {
  font-weight: 700;
  color: #fff;
  font-size: 1rem;
  margin-right: 0.5rem;
}

.nav-hamburger {
  display: none;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 1.3rem;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  margin-left: auto;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex: 1;
}

.nav-spacer { flex: 1; }

.nav-user-section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* The back office's accent, corners and button tiers come from theme.css's tokens (--primary,
   --primary-soft, --radius, --radius-sm, --success, --danger), which lib/theme.js repaints with the
   shop's own brand. Henry 2026-09-19 on /stock.html#binders: the nav, the sub-tab bar and the binder
   row each wrote their own literal cyan, radius and button colour, so they did not read as one
   product -- and a literal cannot follow a branded shop. Night values are unchanged where a token
   carries the same colour; color-mix() keeps each tint's old strength.
   tests/frontend/the-back-office-draws-from-one-token-set.test.js holds these rules to the tokens. */
.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.85rem;
  transition: all 0.3s;
  white-space: nowrap;
}

.nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.nav-link.active {
  color: var(--primary);
  background: var(--primary-soft);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#navUserInfo {
  color: #66bb6a;
  font-size: 0.8rem;
  display: none;
}

.nav-logout-btn {
  padding: 0.3rem 0.7rem;
  background: transparent;
  color: #aaa;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  font-size: 0.75rem;
  cursor: pointer;
}

.nav-logout-btn:hover { color: #fff; border-color: rgba(255,255,255,0.4); }

/* User icon dropdown */
.user-menu-wrapper { position: relative; }

.user-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(102, 187, 106, 0.5);
  background: rgba(102, 187, 106, 0.1);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 0;
  justify-content: center;
  transition: all 0.3s;
}
.user-icon-btn:hover { border-color: #66bb6a; background: rgba(102, 187, 106, 0.2); }

.user-dropdown {
  display: none;
  position: absolute;
  top: 42px;
  right: 0;
  min-width: 180px;
  max-width: calc(100vw - 2rem);
  background: #1a1a2e;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 0.8rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  z-index: 1000;
}
.user-dropdown.show { display: block; }

.user-dropdown-name { color: #fff; font-weight: 600; font-size: 0.9rem; }
.user-dropdown-role { color: #4fc3f7; font-size: 0.75rem; text-transform: capitalize; margin-top: 0.2rem; }

.user-dropdown-item {
  display: block;
  width: 100%;
  padding: 0.5rem 0.6rem;
  background: transparent;
  border: none;
  color: #aaa;
  font-size: 0.85rem;
  cursor: pointer;
  text-align: left;
  border-radius: 5px;
  transition: all 0.2s;
}
.user-dropdown-item:hover { background: rgba(255,255,255,0.08); color: #fff; }

.nav-admin { /* visibility controlled by nav.js */ }

@media (max-width: 768px) {
  .nav-hamburger { display: block; font-size: 1.5rem; padding: 0.5rem; }
  .nav-menu { display: none; flex-direction: column; width: 100%; padding-top: 0.5rem; gap: 0.2rem; }
  .nav-menu.open { display: flex; }
  .nav-menu .nav-link { width: 100%; padding: 0.8rem 1rem; font-size: 0.95rem; border-radius: 8px; }
  .nav-menu .nav-link:active { background: rgba(255,255,255,0.1); }
  .nav-spacer { display: none; }
  .nav-user { width: 100%; padding: 0.5rem 0; border-top: 1px solid rgba(255,255,255,0.1); margin-top: 0.3rem; display: flex; justify-content: space-between; align-items: center; }
  /* These two become bottom sheets on a phone, which puts them under the cookie notice — the
     same defect as the storefront's cart drawer, and the reason the notice now publishes its own
     height. See public/lib/cookie-notice.js.
     Measured in system Chrome on a first visit, with nav.js's own markup (public/nav.js:190-205)
     against this stylesheet: at 375x812 the notice occupies 641..812, and BOTH of
     `.user-dropdown`'s controls sat inside it — Edit Profile at y=730 and **Logout** at y=761,
     `elementFromPoint` returning the notice for each. `.noti-panel` lost the last 4 of 8
     notification links (y=626 down to y=765), and its own scroll cannot reach them because its
     bottom is pinned to the bottom of the screen. Same at 320x640.
     `.noti-panel` scrolls, so padding inside it is scrollable-past; `.user-dropdown` does not, so
     the padding lifts its buttons. `var(…, 0px)` means a phone with no notice on it is unchanged.
     The `!important` on the second matches every other declaration in that rule — it is
     overriding an inline style — and is not needed on the first, which overrides nothing. */
  .user-dropdown { position: fixed; top: auto; bottom: 0; left: 0; right: 0; min-width: unset; border-radius: 12px 12px 0 0; padding: 1.2rem; padding-bottom: calc(1.2rem + var(--cookie-notice-height, 0px) + env(safe-area-inset-bottom, 0px)); max-width: 100vw; }
  .noti-panel { position: fixed !important; top: auto !important; bottom: 0 !important; left: 0 !important; right: 0 !important; width: 100% !important; max-width: 100vw !important; max-height: 60vh !important;max-height: 60dvh !important; padding-bottom: calc(var(--cookie-notice-height, 0px) + env(safe-area-inset-bottom, 0px)) !important; border-radius: 12px 12px 0 0 !important; margin-top: 0 !important; }
  .nav-noti-wrapper { position: static !important; }
}

/* Role Notice */
.role-notice {
  background: rgba(239, 83, 80, 0.1);
  border: 1px solid rgba(239, 83, 80, 0.3);
  border-radius: 10px;
  padding: 1.5rem;
  text-align: center;
  color: #ef5350;
}

.role-notice strong { color: #fff; }

/* Card Location */
.card-location {
  font-size: 0.75rem;
  color: #4fc3f7;
  margin-bottom: 0.3rem;
}

.card-unavailable {
  opacity: 0.5;
  border-color: rgba(239, 83, 80, 0.3) !important;
}

/* Order Page Styles */
.order-header-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 1.2rem 1.5rem;
  margin-bottom: 1.5rem;
}

.order-id {
  font-family: monospace;
  font-size: 0.85rem;
  color: #4fc3f7;
  margin-bottom: 0.5rem;
}

.order-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: #aaa;
}

.order-status-badge {
  padding: 0.2rem 0.7rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
}

.status-pending { background: rgba(255, 193, 7, 0.2); color: #ffc107; }
.status-completed { background: rgba(102, 187, 106, 0.2); color: #66bb6a; }
.status-rejected { background: rgba(239, 83, 80, 0.2); color: #ef5350; }

.order-location-group {
  margin-bottom: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 1rem;
}

.order-location-header {
  font-size: 0.9rem;
  color: #4fc3f7;
  font-weight: 600;
  margin-bottom: 0.8rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.order-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  flex-wrap: wrap;
}

.order-item-info { display: flex; align-items: center; gap: 0.6rem; flex: 1; }
.order-item-qty { font-weight: 600; color: #fff; min-width: 40px; }
.order-item-price { color: #66bb6a; font-weight: 600; min-width: 70px; }
.order-item-status { min-width: 80px; }
.order-item-actions { display: flex; gap: 0.3rem; }

.ois-badge { padding: 0.2rem 0.6rem; border-radius: 10px; font-size: 0.7rem; font-weight: 600; }
.ois-available { background: rgba(102, 187, 106, 0.2); color: #66bb6a; }
.ois-pending { background: rgba(255, 193, 7, 0.2); color: #ffc107; }
.ois-sold { background: rgba(79, 195, 247, 0.2); color: #4fc3f7; }
.ois-revoked { background: rgba(158, 158, 158, 0.2); color: #9e9e9e; }
.ois-insufficient, .ois-not_found { background: rgba(239, 83, 80, 0.2); color: #ef5350; }
.ois-failed { background: rgba(239, 83, 80, 0.3); color: #ef5350; }
.ois-pending { background: rgba(255, 193, 7, 0.2); color: #ffc107; }
.ois-completed { background: rgba(102, 187, 106, 0.2); color: #66bb6a; }
.ois-rejected { background: rgba(239, 83, 80, 0.2); color: #ef5350; }

.item-ok { }
.item-sold { opacity: 0.6; }
.item-revoked { opacity: 0.4; text-decoration: line-through; }
.item-warning { border-left: 3px solid #ef5350; padding-left: 0.8rem; }

.order-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.3rem;
  margin-bottom: 1.5rem;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.3rem;
  border-radius: var(--radius);
}

.tab {
  flex: 1;
  padding: 0.8rem 1rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.3s;
}

.tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.tab.active {
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Section Header */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

/* Buttons */
.primary-btn {
  padding: 0.6rem 1.4rem;
  background: #4fc3f7;
  color: #1a1a2e;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.primary-btn:hover {
  background: #81d4fa;
  transform: translateY(-1px);
}

.secondary-btn {
  padding: 0.6rem 1.4rem;
  background: transparent;
  color: #aaa;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s;
}

.secondary-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}

/* Form Card */
.form-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(79, 195, 247, 0.3);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.form-card h3 {
  color: #fff;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  color: #aaa;
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.6rem 1rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: #fff;
  font-size: 0.9rem;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #4fc3f7;
}

.form-group select option {
  background: #1a1a2e;
  color: #fff;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.form-actions {
  display: flex;
  gap: 0.8rem;
  margin-top: 1rem;
}

/* Toggle Switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  margin-top: 0.3rem;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 26px;
  cursor: pointer;
  transition: 0.3s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.3s;
}

.toggle input:checked + .toggle-slider {
  background: linear-gradient(135deg, #ffd700, #ff69b4);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

/* Merchant Grid */
.merchant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.merchant-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 1.2rem;
  transition: all 0.2s;
}

.merchant-card:hover {
  border-color: rgba(79, 195, 247, 0.3);
  background: rgba(255, 255, 255, 0.08);
}

.merchant-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.merchant-card h3 {
  color: #fff;
  font-size: 1.1rem;
  margin: 0;
}

.merchant-card .merchant-desc {
  color: #888;
  font-size: 0.85rem;
  margin-bottom: 0.8rem;
}

.merchant-card .merchant-stats {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: #aaa;
}

.merchant-card .merchant-stats span {
  padding: 0.2rem 0.6rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.merchant-delete-btn {
  background: transparent;
  border: none;
  color: #ef5350;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: background 0.3s;
}

.merchant-delete-btn:hover {
  background: rgba(239, 83, 80, 0.2);
}

/* Stock Filters */
.stock-filters {
  display: flex;
  gap: 0.8rem;
  margin-bottom: 1.5rem;
}

.stock-filters input {
  flex: 1;
  padding: 0.7rem 1rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #fff;
  font-size: 0.9rem;
}

.stock-filters input:focus {
  outline: none;
  border-color: #4fc3f7;
}

.stock-filters select {
  padding: 0.7rem 1rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #fff;
  font-size: 0.9rem;
  min-width: 180px;
}

.stock-filters select option {
  background: #1a1a2e;
}

/* Stock Table */
.stock-table-wrap {
  overflow-x: auto;
}

.stock-table {
  width: 100%;
  border-collapse: collapse;
}

.stock-table th {
  text-align: left;
  padding: 0.8rem 1rem;
  color: #888;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stock-table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}

.stock-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.stock-card-cell {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.stock-thumb {
  width: 36px;
  height: 50px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  cursor: zoom-in;
}

.stock-thumb.foil-shimmer-wrap {
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

/*
 * The thumbnail's place when the catalogue has no picture — and, for staff, the way to supply one.
 *
 * Same footprint as a real thumbnail so a row with no image is not a shorter row. It is a button
 * rather than a decoration because the fix for a missing picture is a photograph, and the person
 * holding the card is the one looking at this screen.
 */
.stock-thumb-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(255, 255, 255, 0.18);
  box-shadow: none;
  cursor: default;
  line-height: 1.1;
  text-align: center;
}

.stock-thumb-empty[role='button'] {
  cursor: pointer;
}

.stock-thumb-empty[role='button']:hover {
  border-color: rgba(79, 195, 247, 0.5);
  background: rgba(79, 195, 247, 0.08);
}

.stock-card-name {
  font-weight: 500;
  color: #fff;
}

.stock-card-set {
  font-size: 0.75rem;
  color: #888;
}

.stock-foil-badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  background: linear-gradient(135deg, #ffd700, #ff69b4);
  color: #1a1a2e;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  margin-left: 0.4rem;
}

.stock-merchant-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: rgba(79, 195, 247, 0.15);
  color: #4fc3f7;
  border-radius: 6px;
  font-size: 0.75rem;
}

.stock-price {
  color: #66bb6a;
  font-weight: 600;
}

.stock-qty {
  text-align: center;
}

/* Three action tiers, one geometry: .sell-btn (a sale, --success), .stock-manage-btn (changes a
   record -- rename, change owner, merge -- --primary), .stock-delete-btn (hides or removes,
   --danger). Same padding, corner, size and weight, so a row of mixed actions lines up. The danger
   tier stays unfilled at rest, as it always was: red text on its own red tint measured 3.84:1 on
   the binder row, where an inline style had filled it. Its label is --danger taken a quarter of
   the way to --text: bare --danger read 4.41:1 at 12.8px where body's gradient is bluest. */
.sell-btn {
  padding: 0.4rem 0.8rem;
  background: color-mix(in srgb, var(--success) 20%, transparent);
  color: var(--success);
  border: 1px solid color-mix(in srgb, var(--success) 40%, transparent);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.3s;
}

.sell-btn:hover {
  background: color-mix(in srgb, var(--success) 40%, transparent);
}

.stock-delete-btn {
  padding: 0.4rem 0.8rem;
  background: transparent;
  color: color-mix(in srgb, var(--danger) 75%, var(--text));
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.3s;
}

.stock-delete-btn:hover {
  background: color-mix(in srgb, var(--danger) 20%, transparent);
}

.stock-manage-btn {
  padding: 0.4rem 0.8rem;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: background 0.3s;
}

.stock-manage-btn:hover {
  background: color-mix(in srgb, var(--primary) 28%, transparent);
}

.stock-actions {
  display: flex;
  gap: 0.4rem;
}

/* Sales Summary */
.sales-summary {
  display: flex;
  gap: 1.5rem;
  padding: 1rem 1.5rem;
  background: rgba(102, 187, 106, 0.08);
  border: 1px solid rgba(102, 187, 106, 0.2);
  border-radius: 10px;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.sales-stat {
  display: flex;
  flex-direction: column;
}

.sales-stat-label {
  font-size: 0.75rem;
  color: #888;
  text-transform: uppercase;
}

.sales-stat-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: #66bb6a;
}

.sales-stat-value.profit {
  color: #66bb6a;
}

.sales-stat-value.loss {
  color: #ef5350;
}

/* Sale row date */
.sale-date {
  font-size: 0.8rem;
  color: #aaa;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #666;
}

.empty-state p {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.empty-state .empty-hint {
  font-size: 0.85rem;
  color: #555;
}

/* Add Stock Search Results */
/*
 * Tall enough to show a whole card, button included.
 *
 * This was 420px, and the Add button sat 15px below the fold on every card in the first row — so
 * adding anything meant a small scroll, every time. Henry, relaying it: "customer are complane are
 * just have many scroll every action".
 *
 * The 15px was not the interesting part. Tile height is driven by text — a card name, an optional
 * printing line, a set name — and CSS grid stretches every tile in a row to match the tallest one.
 * So a single result with a long printing ("San Francisco 2004 (Aeo Paquette) - Not Tournament
 * Legal", three lines) pushed the button below the fold on all seven cards beside it. Measured:
 * 402px with plain names, 456px once one card in the set had that line. A fixed pixel ceiling
 * cannot be right against a height that moves with whichever cards were searched for.
 *
 * So the text is capped at two lines each (below), which gives the tile a greatest possible height
 * — 484px at the widest column, where the picture is 224px and all three lines run to the cap.
 * This box is sized for that with room to spare, rather than to the millimetre: 470px left eight
 * pixels of clearance in the worst case, and eight pixels is the same bug again after any change
 * to a font.
 *
 * `max-height`, still, not `height`: a search whose results all have short names produces a
 * shorter row, and the box shrinks to it rather than holding open a band of empty space.
 */
.add-stock-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  max-height: 500px;
  overflow-y: auto;
  padding: 0.5rem 0;
}

/* MIRROR-EMPTY: the plain reason under "No cards found" when the price mirror is not configured. */
.add-stock-reason {
  grid-column: 1 / -1;
  margin: 0 auto;
  max-width: 36rem;
  padding: 0.6rem 0.9rem;
  text-align: center;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text, #e0e0e0);
  background: rgba(255, 193, 7, 0.12);
  border: 1px solid rgba(255, 193, 7, 0.45);
  border-radius: 8px;
}

/* Step Sections */
.step-section {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1.2rem 1.5rem;
  margin-bottom: 1rem;
  transition: opacity 0.3s;
}

.step-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.step-header h3 {
  color: #fff;
  font-size: 1rem;
  margin: 0;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: rgba(79, 195, 247, 0.2);
  color: #4fc3f7;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 700;
}

.step-body select {
  padding: 0.6rem 1rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #fff;
  font-size: 0.9rem;
  min-width: 220px;
}

.step-body select option {
  background: #1a1a2e;
}

.selected-merchant-label {
  margin-left: 1rem;
  color: #66bb6a;
  font-weight: 500;
}

.search-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.search-row input {
  flex: 1;
  padding: 0.7rem 1rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #fff;
  font-size: 0.9rem;
}

.search-row input:focus {
  outline: none;
  border-color: #4fc3f7;
}

.search-row select {
  padding: 0.7rem 1rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #fff;
  font-size: 0.9rem;
}

.search-row select option {
  background: #1a1a2e;
}

/* Pending List */
.pending-count {
  margin-left: auto;
  font-size: 0.85rem;
  color: #4fc3f7;
  background: rgba(79, 195, 247, 0.1);
  padding: 0.2rem 0.8rem;
  border-radius: 12px;
}

.pending-list {
  max-height: 350px;
  overflow-y: auto;
}

.pending-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.2s;
}

.pending-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.pending-item-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  min-width: 0;
}

.pending-thumb {
  width: 32px;
  height: 45px;
  object-fit: cover;
  border-radius: 3px;
}

.pending-item-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pending-item-set {
  font-size: 0.7rem;
  color: #888;
}

.pending-item-price {
  color: #66bb6a;
  font-weight: 600;
  font-size: 0.9rem;
  min-width: 60px;
}

.pending-item-qty {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.pending-item-qty button {
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pending-item-qty button:hover {
  background: rgba(255, 255, 255, 0.15);
}

.pending-item-qty span {
  min-width: 20px;
  text-align: center;
  font-weight: 500;
  color: #fff;
}

.pending-item-total {
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  min-width: 70px;
  text-align: right;
}

.pending-remove-btn {
  background: transparent;
  border: none;
  color: #ef5350;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.2rem 0.4rem;
}

.pending-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 0.5rem;
  /* The row gained a date field, and on a narrow screen four controls on one line push the
     Confirm button off the edge. */
  flex-wrap: wrap;
}

/* Marks the batch as a pre-order. Sized to sit level with the buttons beside it rather than
   standing taller than the row, which is the thing Henry keeps circling. */
.preorder-date {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #94a3b8;
  font-size: 0.8rem;
  white-space: nowrap;
}
.preorder-date input {
  padding: 0.4rem 0.6rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #fff;
  font-size: 0.82rem;
  line-height: 1.25;
}

.pending-total {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
}

.pending-total span:first-child {
  color: #aaa;
}

#pendingTotal {
  color: #66bb6a;
  font-weight: 700;
}

.confirm-btn {
  padding: 0.7rem 1.5rem;
  background: #66bb6a;
  color: #1a1a2e;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  margin-left: auto;
  transition: all 0.3s;
}

.confirm-btn:hover {
  background: #81c784;
  transform: translateY(-1px);
}

/*
 * One card per tile, and every tile the same shape.
 *
 * The Qty box and the Add button sat at a different height on every card, because everything
 * above them varies: a card with no picture lost the whole image block, a foil line appears on
 * some and not others, and a two-line set name pushes the rest down. The eye reads a row of
 * these as a row, so controls that do the same job have to be in the same place.
 *
 * Two rules do it. The picture keeps its space whether or not it loads (`.asc-img` below), and
 * the action rows are pushed to the bottom of the tile rather than following the text.
 */
.add-stock-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  transition: all 0.2s;
}

.add-stock-card:hover {
  border-color: rgba(79, 195, 247, 0.4);
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

.add-stock-card.foil-border {
  border-color: rgba(255, 215, 0, 0.3);
}

/*
 * The picture's space, reserved whether or not there is a picture.
 *
 * A trading card is 63×88mm, so the box is 5:7 and every image lands in the same footprint
 * regardless of what the source returns. Cards whose image the catalogue does not have — the
 * tcgplayer CDN answers 403 for a good number of Riftbound printings — used to collapse the
 * block entirely and shunt everything below them upward.
 */
.add-stock-card .asc-img {
  width: 100%;
  max-width: 160px;
  aspect-ratio: 5 / 7;
  margin-bottom: 0.6rem;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
}

.add-stock-card .asc-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

/* Said in words, so a blank frame is not mistaken for a card that failed to load this once. */
.add-stock-card .asc-noimg {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.5rem;
  text-align: center;
  color: #6b7280;
  font-size: 0.7rem;
  line-height: 1.3;
}

.add-stock-card .asc-noimg .asc-noimg-icon {
  font-size: 1.6rem;
  opacity: 0.5;
}

/*
 * Two lines each, and no more.
 *
 * These three lines are the whole reason a tile's height moved: a card name, an optional printing,
 * a set name, each of them one to three lines depending on what was searched for. Grid stretches
 * every tile in a row to the tallest, so one long printing among seven results pushed the Add
 * button below the fold on all seven — 402px a tile with plain names, 456px with one long one.
 *
 * Capped, the tile has a greatest possible height, and .add-stock-results is sized to it. Nothing
 * is lost: stock.js puts the full text in a title attribute on all three.
 *
 * `-webkit-line-clamp` is the unprefixed behaviour everywhere that matters — it is prefixed in
 * name only, and Firefox has supported it since 68. The `display: -webkit-box` it needs does not
 * disturb the tile's own column layout, which belongs to .add-stock-card.
 */
.add-stock-card .asc-name,
.add-stock-card .asc-variation,
.add-stock-card .asc-set {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.add-stock-card .asc-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  text-align: center;
  margin-bottom: 0.2rem;
}

/* Moved out of an inline style in stock.js so it can be capped with the other two. */
.add-stock-card .asc-variation {
  font-size: 0.75rem;
  color: #c9a0dc;
  text-align: center;
}

.add-stock-card .asc-set {
  font-size: 0.7rem;
  color: #888;
  text-align: center;
  margin-bottom: 0.4rem;
}

.add-stock-card .asc-price {
  font-size: 1.1rem;
  font-weight: 700;
  color: #66bb6a;
  margin-bottom: 0.6rem;
}

/*
 * Pushed to the bottom of the tile. `margin-top: auto` eats whatever space the text above did
 * not use, so the Qty box and the button below it sit on the same line across the whole row —
 * which is what a row of identical controls has to look like.
 */
.add-stock-card .asc-qty-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.4rem;
  margin-bottom: 0.5rem;
}

.add-stock-card .asc-qty-row label {
  font-size: 0.75rem;
  color: #aaa;
}

.add-stock-card .asc-qty-row input {
  width: 50px;
  padding: 0.3rem 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: #fff;
  font-size: 0.85rem;
  text-align: center;
}

.add-stock-card .asc-add-btn {
  width: 100%;
  padding: 0.5rem;
  background: #66bb6a;
  color: #1a1a2e;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.add-stock-card .asc-add-btn:hover {
  background: #81c784;
}

.add-stock-card .asc-add-btn.added {
  background: #4fc3f7;
}

/* Market Page Styles */
.market-results {
  margin-top: 1rem;
}

.card-ck-price {
  font-size: 0.8rem;
  margin-bottom: 0.4rem;
  color: #aaa;
}

.card-date {
  font-size: 0.7rem;
  color: #666;
  margin-bottom: 0.6rem;
}

.ck-live-price {
  color: #4fc3f7;
  font-weight: 600;
}

.ck-diff {
  font-size: 0.7rem;
  font-weight: 600;
  margin-left: 0.3rem;
}

.ck-diff.diff-up {
  color: #66bb6a;
}

.ck-diff.diff-down {
  color: #ef5350;
}

/* Cart price input */
.cart-price-input {
  width: 70px;
  padding: 0.3rem 0.4rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: #66bb6a;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
}

.cart-price-input:focus {
  outline: none;
  border-color: #4fc3f7;
}

.market-item-cost {
  font-size: 0.8rem;
  color: #aaa;
  min-width: 70px;
}

.market-item-sale-price {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 100px;
}

/* Confirm All button */
.confirm-all-btn {
  padding: 0.6rem 1.4rem;
  background: #66bb6a;
  color: #1a1a2e;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
}

.confirm-all-btn:hover {
  background: #81c784;
  transform: translateY(-1px);
}

/* Buyer row */
.buyer-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1rem;
  padding: 0.6rem 0;
}

.buyer-row label {
  color: #aaa;
  font-size: 0.9rem;
}

.buyer-row input {
  flex: 1;
  max-width: 300px;
  padding: 0.5rem 0.8rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: #fff;
  font-size: 0.9rem;
}

.buyer-row input:focus {
  outline: none;
  border-color: #4fc3f7;
}

/* Modal (shared) */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #1a1a2e;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 2rem;
  min-width: 380px;
  max-width: 90vw;
}

.modal-content h3 {
  color: #fff;
  margin-bottom: 1rem;
}

#buyCardInfo, #sellCardInfo {
  padding: 0.8rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  margin-bottom: 1rem;
}

/* Fee Config Card */
.fee-config-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 1.2rem 1.5rem;
  margin-bottom: 1.5rem;
}

.fee-config-card h3 {
  color: #fff;
  font-size: 1rem;
  margin-bottom: 0.8rem;
}

.fee-config-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.fee-config-row label {
  color: #aaa;
  font-size: 0.9rem;
}

.fee-config-row input {
  width: 80px;
  padding: 0.5rem 0.6rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: #fff;
  font-size: 0.9rem;
  text-align: center;
}

.fee-config-row input:focus {
  outline: none;
  border-color: #4fc3f7;
}

.fee-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.fee-save-status {
  font-size: 0.85rem;
  font-weight: 500;
}

/* Summary Content */
.summary-content {
  margin-top: 1rem;
}

.fee-banner {
  padding: 0.6rem 1rem;
  background: rgba(239, 83, 80, 0.1);
  border: 1px solid rgba(239, 83, 80, 0.2);
  border-radius: 8px;
  color: #ef5350;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.fee-banner strong {
  color: #fff;
}

.summary-month-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1.2rem 1.5rem;
  margin-bottom: 1.5rem;
}

.summary-month-header {
  margin-bottom: 1rem;
}

.summary-month-header h3 {
  color: #4fc3f7;
  font-size: 1.1rem;
  margin: 0 0 0.6rem 0;
}

.summary-month-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.smt-item {
  font-size: 0.85rem;
  color: #aaa;
  padding: 0.3rem 0.8rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
}

.smt-item strong {
  color: #fff;
}

.smt-fee {
  border: 1px solid rgba(239, 83, 80, 0.2);
}

.smt-net {
  border: 1px solid rgba(102, 187, 106, 0.2);
}

.summary-table td,
.summary-table th {
  font-size: 0.85rem;
}

.sale-details {
  padding: 0 0.5rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 6px;
}

.sale-details.hidden {
  display: none;
}

/* Date inputs in filters */
.stock-filters input[type="date"] {
  padding: 0.6rem 0.8rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #fff;
  font-size: 0.85rem;
}

.stock-filters input[type="date"]:focus {
  outline: none;
  border-color: #4fc3f7;
}

.stock-filters input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}

/* Responsive */
@media (max-width: 768px) {
  /*
   * A grid, so every tab fits the screen and reads in one line.
   *
   * `flex-wrap: wrap` on `flex: 1 1 0` items shares the row equally and then keeps going: at 375px
   * that put seven tabs into 331px at 51px each, with `Inventory Detail`, `📥 Binder Import` and
   * `⚠️ Item Problems` wrapping to two and three lines inside their own buttons, the longest word
   * of each spilling ~5px past the border into its neighbour — `overflow` is visible — and
   * `❌ Rejected` pushed onto a second row on its own at full width. Measured, not guessed.
   *
   * Henry asked for it to fit rather than scroll: "อยากให้มัน fit กับ screen ไม่ต้องเลื่อนไปมาให้ยุ่งยาก".
   *
   * `auto-fit` with a 110px floor lets the browser pick the column count from the width it
   * actually has — the widest label needs 110px including padding, so two columns on a 320–400px
   * phone and three from about 430px, with no breakpoint guessing at device sizes. The floor only
   * decides how many columns; the tracks are `1fr`, so each tab is 163px at 375px and the labels
   * have room to spare.
   */
  .tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.3rem;
  }

  .tab {
    padding: 0.5rem 0.8rem;
    font-size: 0.8rem;
    /* Grid items floor at min-content; without this a long label widens its own column. */
    min-width: 0;
    white-space: nowrap;
    /* Never again spill onto the neighbour: if a future label outgrows its track, it is cut. */
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .stock-filters {
    flex-direction: column;
    gap: 0.5rem;
  }

  .stock-filters input,
  .stock-filters select {
    width: 100%;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .form-card {
    padding: 1rem;
  }

  .sales-summary {
    flex-direction: column;
    gap: 0.8rem;
  }

  .nav-bar {
    flex-wrap: wrap;
    padding: 0.5rem 0.8rem;
  }

  .nav-brand {
    font-size: 0.9rem;
  }

  .stock-table {
    font-size: 0.75rem;
  }

  .stock-table th,
  .stock-table td {
    padding: 0.4rem 0.3rem;
  }

  .stock-thumb {
    width: 28px;
    height: 40px;
  }

  .stock-card-cell {
    gap: 0.3rem;
  }

  .stock-card-name {
    font-size: 0.75rem;
  }

  .section-header {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }

  .section-header button {
    width: 100%;
  }

  /* Add stock card grid */
  .add-stock-results {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
  }

  .add-stock-card {
    padding: 0.6rem;
  }

  .add-stock-card img {
    border-radius: 4px;
  }

  .asc-name {
    font-size: 0.75rem;
  }

  .asc-set {
    font-size: 0.65rem;
  }

  /* Pending list */
  .pending-item {
    flex-wrap: wrap;
    gap: 0.3rem;
    padding: 0.5rem;
  }

  .pending-item-info {
    width: 100%;
  }

  /* Summary */
  .summary-month-card {
    padding: 1rem;
  }

  .summary-month-totals {
    flex-direction: column;
    gap: 0.3rem;
  }

  .summary-table {
    font-size: 0.7rem;
  }

  /* Orders page */
  .order-group {
    padding: 0.8rem;
  }

  .order-item {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }

  /* Cart items */
  .market-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.8rem;
  }

  .market-item-info {
    width: 100%;
  }

  .market-item-qty {
    align-self: flex-end;
  }

  /* Confirm/Primary buttons full width on mobile */
  .confirm-btn,
  .confirm-all-btn {
    width: 100%;
  }

  /* POS page */
  .pos-layout {
    grid-template-columns: 1fr;
  }

  .pos-binder-box {
    padding: 0.8rem;
  }

  .pos-card-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
  }

  .pos-cart-row {
    flex-wrap: wrap;
    gap: 0.3rem;
  }

  .pos-summary-row {
    flex-wrap: wrap;
    gap: 0.3rem;
  }

  /* User menu dropdown */
  .user-dropdown {
    right: 0;
    min-width: 200px;
  }

  /* Search row stack on mobile */
  .search-row {
    flex-direction: column;
    gap: 0.5rem;
  }
  .search-row input,
  .search-row select,
  .search-row button {
    width: 100%;
  }

  /* Modal responsive */
  .modal-content {
    min-width: unset !important;
    width: calc(100vw - 2rem) !important;
    max-height: 90vh;max-height: 90dvh;
    overflow-y: auto;
  }

  /* Stage tracker smaller on mobile */
  .stage-step {
    min-width: 50px !important;
  }
  .stage-label {
    font-size: 0.6rem !important;
  }

  /* Fee/settings */
  .fee-config-row {
    flex-direction: column;
    gap: 0.5rem;
  }

  /* Pending actions stack */
  .pending-actions {
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
  }
}

/* Tablet (iPad) */
@media (min-width: 769px) and (max-width: 1024px) {
  .stock-table {
    font-size: 0.8rem;
  }

  .add-stock-results {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .pos-card-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .form-row {
    grid-template-columns: 1fr 1fr;
  }
}


/* ===================== RESPONSIVE ENHANCEMENTS ===================== */
@media (max-width: 480px) {
  .tabs { gap: 0.2rem; }
  .tabs .tab { font-size: 0.7rem; padding: 0.4rem 0.6rem; }
  /* The market strip (index.html, first button #tabSingles) carries a live count in its labels,
     "Singles (14984)", which the 110px auto-fit floor above was sized without: three columns of
     113px cut it to "Singles (14…". Two columns of ~170px give the label its room; the four
     buttons fall in a 2x2. Scoped to that strip so stock.html's sub-tab row is untouched. */
  .tabs:has(> #tabSingles) { grid-template-columns: repeat(2, 1fr); }
  .stock-table { font-size: 0.7rem; }
  .stock-table th, .stock-table td { padding: 0.4rem 0.3rem; }
  .stock-thumb { width: 30px; height: 42px; }
  .add-stock-results { grid-template-columns: repeat(2, 1fr); }
  .add-stock-card { padding: 0.5rem; }
  .step-section { padding: 0.8rem; }
  .step-header h3 { font-size: 0.9rem; }
  .search-row { flex-direction: column; gap: 0.4rem; }
  .search-row input, .search-row select, .search-row button { width: 100%; }
}

@media (min-width: 481px) and (max-width: 768px) {
  /* Two across here for the same reason the storefront has two — see the note on `.card-grid` in
   * style.css. This is the screen Henry photographed: an Add Stock result carries a quantity box
   * and an Add to List button under the picture, and at 541px three of them left the price
   * wrapping onto two lines. */
  .add-stock-results { grid-template-columns: repeat(2, 1fr); }
}

/* ═══ ONE IMPORT BUTTON PER SOURCE ═══
 *
 * Henry: "แยกเป็นปุ่มไปสิ ถ้าเอาของระบบที่ export เข้ามา import เข้าไปก็ต้องเข้าทางหลัก ส่วนอีกทาง
 * คือ architdeck ก็ให้ upload อีกปุ่ม". A bare <input type="file"> renders as the browser's own
 * grey "Choose File" with no room for a name, which is why he looked at this page and asked where
 * the ManaBox button was.
 *
 * The input still does the work — it is what opens the picker — so it is moved out of sight rather
 * than hidden with display:none, which would take it off the keyboard path with it.
 */
.file-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  padding: 0.6rem 0.9rem;
  min-height: 44px;
  justify-content: center;
  background: rgba(79, 195, 247, 0.12);
  border: 1px solid rgba(79, 195, 247, 0.4);
  border-radius: 6px;
  color: #4fc3f7;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.file-btn:hover,
.file-btn:focus-within {
  background: rgba(79, 195, 247, 0.22);
  border-color: #4fc3f7;
}

/* Not ready, and saying so. `pointer-events: none` is what actually stops the click reaching
   the <input> behind the label; the rest is so it does not look clickable in the first place. */
.file-btn.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
  color: #8fa3b0;
}

.file-btn-note {
  font-size: 0.68rem;
  font-weight: 400;
  color: #8fa3b0;
}

/* Off-screen, not display:none — a hidden input cannot be tabbed to, and :focus-within above is
 * what draws the focus ring on the label standing in for it. */
.file-btn + input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ═══ TABLES ON A PHONE ═══
 *
 * The staff screens emit 22 `.stock-table`s and exactly three of them sit inside
 * `.stock-table-wrap`, the container that scrolls. The other nineteen stretch the page instead:
 * Orders, Inventory, Reports, Payouts and Settings all push the whole document sideways on a
 * phone, so the shopkeeper drags the layout around to read a column.
 *
 * Fixed on the class rather than at nineteen call sites. A wrapper per table would be the same
 * change written nineteen times, and the twentieth table someone adds would arrive without one
 * — which is exactly how the first nineteen happened.
 *
 * `display: block` is what lets a table scroll itself; it is applied only under a coarse
 * pointer, so the desktop layout — where these tables are read most — is untouched.
 * `.stock-table-wrap` keeps working where it is already used: a scroll container around a
 * scrollable table is harmless.
 */
@media (hover: none) and (pointer: coarse) {
  .stock-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Without this a long card name wraps to five lines and the row becomes unreadable; with
       it the column keeps its width and the table scrolls, which is the point. */
    white-space: nowrap;
  }

  /* A form field under 16px makes iOS zoom the whole page on focus, and it does not zoom back.
     style.css carries this for the pages that load it; stock.css is loaded by the staff pages
     that carry the densest forms, and inherits nothing when it is the only sheet present. */
  /* The staff stylesheet carries its own floor rather than relying on style.css being
     loaded beside it. Every page that uses stock.css does load both today; a rule that is
     only correct because of what another file happens to include is a rule waiting to break. */
  button,
  .primary-btn,
  .secondary-btn,
  .sell-btn,
  .confirm-btn,
  .confirm-all-btn,
  .stock-delete-btn,
  .stock-manage-btn,
  .pending-remove-btn,
  .nav-link,
  .cat-tab {
    min-height: 44px;
  }

  .stock-table input,
  .stock-table select,
  .search-row input,
  .search-row select {
    font-size: 16px;
  }
}

/* ═══ GAME TAG ═══
 *
 * Which game a row of stock belongs to. Every staff list showed cards without saying — a shop
 * carrying two games read one undifferentiated list, and a filter had nothing to key on.
 *
 * Deliberately quiet: it sits beside a card name that people are scanning, so it reads as a
 * label rather than competing with the name. `data-game` on the element is what the filter
 * selects by, so filtering needs no refetch.
 */
.game-tag {
  display: inline-block;
  margin-left: 0.45rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: rgba(79, 195, 247, 0.14);
  border: 1px solid rgba(79, 195, 247, 0.3);
  color: #86ccf0;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  vertical-align: middle;
  white-space: nowrap;
}

/* Rows the game filter has excluded. A class rather than an inline style so the filter can be
   cleared by removing it, without having to remember what `display` each row started with. */
tr.game-filtered-out { display: none; }

/* A dropdown whose list failed to load (showLoaderFailure, public/stock/helpers.js): the sentence in
   the theme's own amber -- `--warning` is #a35200 by day and #ffa726 at night, both over 4.5 : 1 on
   the gradient's palest and darkest stops -- and a Retry with its own 44 px floor. Not under the
   coarse-pointer rule: a phone-width Chrome that reports a mouse measured 20 px on the note this
   copies (docs/cards/SEARCH-SHORT-FEED-NOTE-LOW-CONTRAST.md). */
.loader-failed {
  color: var(--warning);
  font-size: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.4rem;
}
/* Add-stock Import (#addPanelImport) prints the CSV header as one unbreakable <code> (416px); at 390 it pushed the page
   to 452px wide. Let it break anywhere rather than widen the page. */
#addPanelImport code {
  overflow-wrap: anywhere;
}
/* The export row is a no-wrap flex line; the location select kept its option width and squeezed
   "Download CSV" to 81px, so its label spilled 14px past the page at 390. The select gives way. */
#addPanelImport .step-body > select {
  min-width: 0;
  flex: 1 1 auto;
}
#addPanelImport .step-body > .primary-btn {
  flex-shrink: 0;
}
.loader-retry {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0 1rem;
  font-size: 0.85rem;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* CS_P2_CONSIGN_03 — the consignor-revoke queue above Inventory Detail. One card per request, the
   text left and the buttons right, wrapping under it on a phone; tokens only, so day and night
   both follow shell.css. */
.revoke-panel { margin: 0 0 1rem; padding: 0.75rem 1rem; border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent); border-radius: var(--radius-sm); background: var(--primary-soft); }
.revoke-panel .section-header h3 { margin: 0 0 0.5rem; font-size: 0.95rem; }
.revoke-list { display: flex; flex-direction: column; gap: 0.5rem; }
.revoke-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }
.revoke-what { flex: 1 1 12rem; min-width: 0; overflow-wrap: anywhere; }
.revoke-meta { font-size: 0.75rem; color: var(--text-muted, var(--text)); }
.revoke-set { font-size: 0.7rem; opacity: 0.75; }
.revoke-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
