/* ═══════════════════════════════════════════════════════════════
   AMURAZ DEMO — ENTERPRISE SAAS DESIGN SYSTEM
   Cobalt Blue × Slate · Dual Light/Dark · GPU micro-interactions
   ═══════════════════════════════════════════════════════════════ */

/* ── 1. CSS Custom Properties ─────────────────────────────────── */
:root {
  /* Backgrounds — Light */
  --bg-primary: #f8fafc;
  --bg-card: #ffffff;
  --bg-elevated: #ffffff;
  --bg-header: #f8fafc;
  --bg-input: #ffffff;
  --bg-hover: #f1f5f9;
  --bg-overlay: rgba(2, 6, 23, 0.55);

  /* Borders — Light */
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-focus: #2563eb;

  /* Text — Light */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverted: #ffffff;

  /* Accents — Cobalt Blue (primary actions) */
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-fg: #ffffff;
  --accent-subtle: #eff6ff;

  /* Accents — Cyan (save / secondary actions) */
  --cyan: #0891b2;
  --cyan-hover: #0e7490;
  --cyan-subtle: #e0f7fb;

  /* Semantic */
  --success: #166534;
  --success-bg: #dcfce7;
  --success-fg: #16a34a;
  --danger: #991b1b;
  --danger-bg: #fee2e2;
  --danger-fg: #dc2626;
  --warning-bg: #fefce8;
  --warning-fg: #ca8a04;

  /* Topbar */
  --topbar-bg: #0f172a;
  --topbar-border: #1e293b;
  --topbar-text: #f1f5f9;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, .07), 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-md: 0 4px 10px rgba(0, 0, 0, .08), 0 2px 4px rgba(0, 0, 0, .05);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, .10), 0 4px 8px rgba(0, 0, 0, .06);
  --shadow-xl: 0 24px 48px rgba(0, 0, 0, .14);

  /* Shape */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Transitions */
  --transition-fast: 100ms ease-out;
  --transition-base: 200ms ease-out;
  --transition-slow: 300ms ease-out;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Consolas', monospace;
}

/* Dark Mode — body.dark-mode (legacy compat) */
body.dark-mode {
  --bg-primary: #0f172a;
  --bg-card: #1e293b;
  --bg-elevated: #1e293b;
  --bg-header: #1e293b;
  --bg-input: #0f172a;
  --bg-hover: #334155;
  --bg-overlay: rgba(0, 0, 0, 0.75);

  --border: #334155;
  --border-strong: #475569;
  --border-focus: #3b82f6;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-subtle: rgba(59, 130, 246, 0.1);

  --cyan: #22d3ee;
  --cyan-hover: #38e0f8;
  --cyan-subtle: #0a2a32;

  --success-fg: #4ade80;
  --success-bg: #0a2e16;
  --danger-fg: #f87171;
  --danger-bg: #2e0a0a;
  --warning-bg: #1c1a0e;
  --warning-fg: #facc15;

  --topbar-bg: #020617;
  --topbar-border: #0f172a;
  --topbar-text: #f1f5f9;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, .35);
  --shadow-md: 0 4px 10px rgba(0, 0, 0, .4);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, .5);
  --shadow-xl: 0 24px 48px rgba(0, 0, 0, .6);
}

/* ── 2. Base Reset & Typography ───────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  font-weight: 600;
  color: var(--text-primary);
}

a {
  color: var(--cyan);
  text-decoration: none;
}

a:hover {
  color: var(--cyan-hover);
}

/* ── 3. Loading Overlay ───────────────────────────────────────── */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(37, 99, 235, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── 4. Topbar Layout (used by configuration.html + index.html fallback) */
.topbar {
  background: var(--topbar-bg);
  color: var(--topbar-text);
  border-bottom: 1px solid var(--topbar-border);
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 200;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 56px;
  max-width: 100%;
}

@media (min-width: 768px) {
  .topbar-inner {
    padding: 0 24px;
    height: 60px;
  }
}

@media (min-width: 1024px) {
  .topbar-inner {
    padding: 0 32px;
  }
}

.topbar-branding {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.topbar-branding .logo {
  height: 32px;
  width: auto;
  object-fit: contain;
  border-radius: var(--radius-xs);
}

@media (min-width: 768px) {
  .topbar-branding .logo {
    height: 36px;
  }
}

.topbar-branding h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--topbar-text);
  letter-spacing: -0.01em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── 4b. Topbar utility classes (auth.js injects .topbar-user-email) */
.topbar-user-email {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  font-weight: 500;
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Topbar button variant — used by Settings link & auth-injected elements */
.topbar-btn {
  height: 32px;
  font-size: 12px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--topbar-text);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  text-decoration: none;
}

.topbar-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: var(--topbar-text);
  border-color: rgba(255, 255, 255, 0.28);
}

/* ── 5. Action Bar — hide bulk buttons until JS shows them ───── */
#publish-selected,
#save-selected,
#delete-selected {
  display: none;
}

/* ── 6. Filter Bar — mobile bottom sheet ─────────────────────── */
.filter-sheet-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: 490;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.filter-sheet-backdrop.open {
  display: block;
  opacity: 1;
}

/* ── 7. Filter Group (labels + inputs inside filter bar) ─────── */
.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.filter-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.filter-group input[type="text"],
.filter-group input[type="number"],
.filter-group select {
  height: 34px;
  padding: 0 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.filter-group select {
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.filter-group input:focus,
.filter-group select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* ── 8. Advanced Filters Progressive Disclosure ───────────────── */
.advanced-filters {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  padding-top: 0;
  border-top: 0px solid var(--border);
  transition: max-height 280ms ease-out, opacity 220ms ease-out,
    padding-top 220ms ease-out, border-top-width 0ms;
}

.advanced-filters.open {
  max-height: 200px;
  opacity: 1;
  pointer-events: auto;
  padding-top: 10px;
  border-top-width: 1px;
}

#filters-toggle-btn.active {
  background: var(--bg-hover);
  border-color: var(--border-focus);
  color: var(--text-primary);
}

.filters-toggle-icon {
  font-size: 10px;
  line-height: 1;
  display: inline-block;
}

/* Mobile filter toggle button */
.filter-toggle-btn {
  display: none;
}

/* ── 9. Table ─────────────────────────────────────────────────── */
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 1100px;
}

thead {
  background: var(--bg-header);
  /* Removed sticky because it behaves incorrectly inside overflow-x-auto, breaking row 1 visibility */
  position: relative;
  z-index: 10;
}

th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-primary);
  vertical-align: middle;
}

/* Numbers right-aligned */
td[data-column="price"],
td[data-column="qty"],
th[data-column="price"],
th[data-column="qty"] {
  text-align: right;
}

tr:last-child td {
  border-bottom: none;
}

/* GPU-accelerated row hover */
tbody tr {
  transition: background var(--transition-fast);
}

tbody tr:hover {
  background: var(--bg-hover);
}

tbody tr.selected {
  background: var(--accent-subtle);
}

body.dark-mode tbody tr.selected {
  background: rgba(59, 130, 246, 0.08);
}

/* ── 10. Checkbox Column ──────────────────────────────────────── */
th:first-child,
td:first-child {
  text-align: center;
  width: 52px;
  vertical-align: middle;
  padding-top: 11px !important;
}

.row-number {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  display: block;
  text-align: center;
  margin-top: 2px;
  font-family: var(--font-mono);
}

.selection-counter {
  font-size: 10px;
  color: var(--accent);
  font-weight: 600;
  margin-top: 2px;
  white-space: nowrap;
}

input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* ── 11. SKU Column ───────────────────────────────────────────── */
.sku-column {
  width: 60px;
}

.sku-column input {
  width: 50px;
  font-size: 12px;
  font-family: var(--font-mono);
  padding: 3px 5px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
}

/* ── 12. Image Column ─────────────────────────────────────────── */
td img {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border);
  display: block;
  cursor: pointer;
  /* GPU-accelerated image hover */
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

td img:hover {
  transform: scale(1.06);
  box-shadow: var(--shadow-md);
}

/* ── 13. Field Sizing (table inline inputs) ───────────────────── */
#listings-table td [data-field="title"] {
  width: 380px;
  height: 46px;
  font-size: 13px;
}

#listings-table td [data-field="quantity"],
#listings-table td [data-field="startPrice"] {
  width: 60px;
  padding: 3px 6px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 13px;
}

#listings-table td [data-field="categoryId"] {
  width: 150px;
  padding: 3px 6px;
  font-size: 12px;
}

#listings-table td [data-field="conditionId"] {
  width: 90px;
  padding: 3px 6px;
  font-size: 12px;
}

#listings-table td [data-field="shippingProfileId"] {
  width: 180px;
  padding: 3px 6px;
  font-size: 12px;
}

#listings-table input,
#listings-table select,
#listings-table textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  outline: none;
  padding: 4px 8px;
  min-height: 28px;
  box-sizing: border-box;
  font-family: var(--font-sans);
  font-size: 13px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

#listings-table input:focus,
#listings-table select:focus,
#listings-table textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

/* ── 14. Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
  height: 36px;
  cursor: pointer;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  letter-spacing: 0.01em;
  white-space: nowrap;
  /* GPU-accelerated button press */
  transition: background var(--transition-fast), box-shadow var(--transition-fast),
    transform var(--transition-fast), opacity var(--transition-fast);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

/* Tactile depress micro-interaction */
.btn:active {
  transform: scale(0.97);
  transition-duration: 80ms;
}

.btn:disabled {
  background: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.6;
}

.btn:disabled:active {
  transform: none;
}

/* Publish — Cobalt Blue (primary) */
.btn-publish {
  background: var(--accent);
  color: var(--accent-fg);
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.35);
}

.btn-publish:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.45);
}

/* Save — Cyan */
.btn-save {
  background: var(--cyan);
  color: #fff;
  box-shadow: 0 1px 3px rgba(8, 145, 178, 0.35);
}

.btn-save:hover:not(:disabled) {
  background: var(--cyan-hover);
  box-shadow: 0 2px 8px rgba(8, 145, 178, 0.45);
}

/* Delete — Danger */
.btn-delete {
  background: var(--danger-fg);
  color: #fff;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.3);
}

.btn-delete:hover:not(:disabled) {
  background: #b91c1c;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4);
}

/* Process / Upload — Purple */
.btn-process {
  background: #7c3aed;
  color: #fff;
  box-shadow: 0 1px 3px rgba(124, 58, 237, 0.35);
}

.btn-process:hover:not(:disabled) {
  background: #6d28d9;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.45);
}

/* Settings — Subtle */
.btn-settings {
  background: rgba(255, 255, 255, 0.08);
  color: var(--topbar-text);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: none;
}

.btn-settings:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.28);
}

/* Secondary — Neutral */
.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* Auction — Brushed Brass (#e5ad28) ─ 5.2:1 contrast on slate-900 */
.btn-auction {
  background: #e5ad28;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(229, 173, 40, 0.35);
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.btn-auction:hover:not(:disabled) {
  background: #d4a017;
  box-shadow: 0 2px 8px rgba(229, 173, 40, 0.50);
}

/* Schedule Batch — Outlined Brass */
.btn-schedule-batch {
  background: transparent;
  color: #e5ad28;
  border: 1.5px solid rgba(229, 173, 40, 0.4);
  box-shadow: none;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-fast), border-color var(--transition-fast),
    color var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-schedule-batch:hover:not(:disabled) {
  background: rgba(229, 173, 40, 0.10);
  border-color: #e5ad28;
  box-shadow: 0 0 0 3px rgba(229, 173, 40, 0.12);
}

/* ── Auction Config Slide-Over Panel ─────────────────────────── */
.auction-config-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 92vw;
  height: 100vh;
  background: #0f172a;
  border-left: 1px solid #1e293b;
  z-index: 10002;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.5);
}

.auction-config-panel.open {
  transform: translateX(0);
}

.auction-config-panel .panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #1e293b;
  flex-shrink: 0;
}

.auction-config-panel .panel-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 10px;
}

.auction-config-panel .panel-header h3 .accent-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e5ad28;
  flex-shrink: 0;
}

.auction-config-panel .panel-close {
  width: 32px;
  height: 32px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 50%;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.auction-config-panel .panel-close:hover {
  background: rgba(229, 173, 40, 0.12);
  color: #e5ad28;
}

.auction-config-panel .panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.auction-config-panel .panel-footer {
  padding: 16px 24px;
  border-top: 1px solid #1e293b;
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.auction-config-panel .panel-footer .btn {
  flex: 1;
  height: 42px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
}

/* ── Auction Config Form Elements ─────────────────────────────── */
.auction-config-panel .form-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auction-config-panel .form-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #e5ad28;
  margin: 0;
}

.auction-config-panel input[type="date"],
.auction-config-panel input[type="time"] {
  width: 100%;
  padding: 10px 14px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 20px;
  font-size: 14px;
  color: #f1f5f9;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.auction-config-panel input[type="date"]:focus,
.auction-config-panel input[type="time"]:focus {
  border-color: #e5ad28;
  box-shadow: 0 0 0 3px rgba(229, 173, 40, 0.15);
}

/* ── Segmented Duration Control ───────────────────────────────── */
.duration-segmented {
  display: flex;
  gap: 0;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid #334155;
  background: #1e293b;
}

.duration-segmented input[type="radio"] {
  display: none;
}

.duration-segmented label {
  flex: 1;
  text-align: center;
  padding: 10px 0;
  font-size: 13px;
  font-weight: 700;
  color: #94a3b8;
  cursor: pointer;
  transition: all 200ms ease-out;
  user-select: none;
  border-right: 1px solid #334155;
}

.duration-segmented label:last-of-type {
  border-right: none;
}

.duration-segmented input[type="radio"]:checked + label {
  background: #e5ad28;
  color: #0f172a;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

/* ── Auction Dynamic Summary ──────────────────────────────────── */
.auction-summary {
  background: rgba(229, 173, 40, 0.06);
  border: 1px solid rgba(229, 173, 40, 0.18);
  border-radius: 20px;
  padding: 16px 20px;
  text-align: center;
}

.auction-summary .summary-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  margin-bottom: 6px;
}

.auction-summary .summary-value {
  font-size: 15px;
  font-weight: 700;
  color: #e5ad28;
}

/* ── Auction Config Backdrop ──────────────────────────────────── */
.auction-config-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 10001;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease-out;
}

.auction-config-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* ── Batch Scheduling Modal — Overridden by .batch-scheduler-content ── */

.batch-time-summary {
  background: rgba(229, 173, 40, 0.06);
  border: 1px solid rgba(229, 173, 40, 0.18);
  border-radius: 20px;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.batch-time-summary .time-block {
  flex: 1;
  text-align: center;
}

.batch-time-summary .time-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  margin-bottom: 4px;
}

.batch-time-summary .time-value {
  font-size: 14px;
  font-weight: 700;
  color: #f1f5f9;
}

.batch-time-summary .time-divider {
  width: 1px;
  background: rgba(229, 173, 40, 0.25);
  align-self: stretch;
}

/* ── Auction Progress Toast ───────────────────────────────────── */
.auction-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 20px;
  padding: 20px;
  z-index: 20000;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.6);
  transform: translateY(120%);
  opacity: 0;
  transition: transform 400ms cubic-bezier(0.16, 1, 0.3, 1),
    opacity 300ms ease-out;
}

.auction-toast.show {
  transform: translateY(0);
  opacity: 1;
}

.auction-toast .toast-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.auction-toast .toast-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(229, 173, 40, 0.12);
  color: #e5ad28;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.auction-toast .toast-title {
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
}

.auction-toast .toast-subtitle {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

.auction-toast .toast-progress-track {
  width: 100%;
  height: 6px;
  background: #1e293b;
  border-radius: 3px;
  overflow: hidden;
}

.auction-toast .toast-progress-bar {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #e5ad28, #f0c541);
  width: 0%;
  transition: width 400ms ease-out;
}

/* ── Timezone Select ──────────────────────────────────────────── */
.auction-tz-select {
  width: 100%;
  padding: 10px 14px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 20px;
  font-size: 13px;
  color: #f1f5f9;
  font-family: var(--font-sans);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23e5ad28' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.auction-tz-select:focus {
  border-color: #e5ad28;
  box-shadow: 0 0 0 3px rgba(229, 173, 40, 0.15);
}

.auction-tz-select optgroup {
  font-weight: 700;
  color: #94a3b8;
  font-size: 11px;
}

.auction-tz-select option {
  background: #1e293b;
  color: #f1f5f9;
  padding: 8px;
}

/* ── Batch Scheduler — Large Modal ────────────────────────────── */
.batch-scheduler-content {
  max-width: 900px !important;
  width: 92% !important;
  max-height: 90vh !important;
  background: #0f172a !important;
  border-color: #1e293b !important;
  border-radius: 20px !important;
  padding: 24px !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}

.batch-scheduler-body {
  display: flex;
  gap: 24px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.batch-config-col {
  width: 360px;
  flex-shrink: 0;
  overflow-y: auto;
  padding-right: 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.batch-config-col input[type="date"],
.batch-config-col input[type="time"] {
  width: 100%;
  padding: 10px 14px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 20px;
  font-size: 14px;
  color: #f1f5f9;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.batch-config-col input[type="date"]:focus,
.batch-config-col input[type="time"]:focus {
  border-color: #e5ad28;
  box-shadow: 0 0 0 3px rgba(229, 173, 40, 0.15);
}

.batch-config-col input[type="number"]:focus {
  border-color: #e5ad28 !important;
  box-shadow: 0 0 0 3px rgba(229, 173, 40, 0.15) !important;
}

.batch-listings-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ── Batch Listing Pool (scrollable) ──────────────────────────── */
.batch-listing-pool {
  flex: 1;
  overflow-y: auto;
  border: 1px solid #1e293b;
  border-radius: 16px;
  background: #0c1120;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 200px;
}

.batch-listing-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 14px;
  transition: border-color 150ms ease-out, background 150ms ease-out;
  flex-shrink: 0;
}

.batch-listing-card:hover {
  border-color: rgba(229, 173, 40, 0.3);
  background: #1a2540;
}

.batch-listing-card .blc-thumb {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #334155;
  overflow: hidden;
  flex-shrink: 0;
}

.batch-listing-card .blc-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.batch-listing-card .blc-info {
  flex: 1;
  min-width: 0;
}

.batch-listing-card .blc-title {
  font-size: 12px;
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.batch-listing-card .blc-meta {
  font-size: 10px;
  color: #64748b;
  margin-top: 1px;
  display: flex;
  gap: 8px;
}

.batch-listing-card .blc-time {
  font-size: 11px;
  font-weight: 700;
  color: #e5ad28;
  white-space: nowrap;
  flex-shrink: 0;
}

.batch-listing-card .blc-remove {
  width: 24px;
  height: 24px;
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #475569;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 150ms ease-out;
  flex-shrink: 0;
}

.batch-listing-card .blc-remove:hover {
  background: rgba(220, 38, 38, 0.12);
  border-color: rgba(220, 38, 38, 0.3);
  color: #f87171;
}

/* Responsive for smaller screens */
@media (max-width: 768px) {
  .batch-scheduler-body {
    flex-direction: column;
  }
  .batch-config-col {
    width: 100%;
    padding-right: 0;
  }
}

/* Custom upload button (JS-injected .custom-upload-btn) */
.custom-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 16px;
  height: auto;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1.5px solid var(--border-strong);
  transition: background 150ms ease-out, color 150ms ease-out,
    border-color 150ms ease-out, transform 100ms ease-out;
}

.custom-upload-btn:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.custom-upload-btn:active {
  transform: scale(0.97);
}

body.dark-mode .custom-upload-btn {
  background: #1e293b;
  color: #8b949e;
  border-color: #334155;
}

body.dark-mode .custom-upload-btn:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.custom-upload-btn.has-icon {
  padding-left: 12px;
}

.custom-upload-btn span {
  white-space: nowrap;
}

/* ── 15. Action Menu (Three-dots dropdown) ────────────────────── */
td.actions {
  position: relative;
  text-align: center;
  vertical-align: middle;
}

.action-menu {
  position: relative;
  display: inline-block;
}

.action-menu-btn {
  background: none;
  border: 1px solid transparent;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: background var(--transition-fast), border-color var(--transition-fast),
    color var(--transition-fast);
  line-height: 1;
}

.action-menu-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border);
  color: var(--text-primary);
}

.action-dropdown {
  display: none;
  position: fixed;
  background: var(--bg-elevated);
  min-width: 150px;
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  z-index: 10000;
  overflow: hidden;
  text-align: left;
  animation: dropdownIn var(--transition-base) ease-out;
}

.action-dropdown.show {
  display: block;
}

@keyframes dropdownIn {
  from {
    opacity: 0;
    transform: translateY(-5px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.action-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: background var(--transition-fast), color var(--transition-fast);
  width: 100%;
  box-sizing: border-box;
  border: none;
  background: none;
}

.action-dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.action-dropdown-item.delete {
  color: var(--danger-fg);
}

.action-dropdown-item.delete:hover {
  background: var(--danger-bg);
}

/* ── 16. Note Indicator ───────────────────────────────────────── */
.note-indicator {
  cursor: pointer;
  font-size: 14px;
  margin-left: 4px;
  vertical-align: middle;
  opacity: 0.7;
  transition: opacity var(--transition-fast);
}

.note-indicator:hover {
  opacity: 1;
}

/* ── 17. Hover Previews ───────────────────────────────────────── */
#image-hover-preview {
  position: fixed;
  pointer-events: none;
  display: none;
  z-index: 9999;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 4px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

#image-hover-preview img {
  max-width: 280px;
  max-height: 280px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  display: block;
}

#note-hover-preview {
  position: fixed;
  pointer-events: none;
  display: none;
  z-index: 9999;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-width: 280px;
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.5;
}

/* ── 18. Lightbox ─────────────────────────────────────────────── */
#image-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.93);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 10000;
}

#image-lightbox.active {
  display: flex;
}

#image-lightbox img {
  max-height: 80vh;
  max-width: 90vw;
  object-fit: contain;
  border-radius: var(--radius-md);
}

#lightbox-gallery {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  max-width: 90%;
  max-height: 88vh;
  overflow-x: auto;
  padding: 12px;
}

#lightbox-gallery img {
  max-height: 80vh;
  width: auto;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

#lightbox-close,
#lightbox-prev,
#lightbox-next {
  position: absolute;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: background var(--transition-base), transform var(--transition-fast);
  font-size: 20px;
  line-height: 1;
  padding: 10px 14px;
}

#lightbox-close:hover,
#lightbox-prev:hover,
#lightbox-next:hover {
  background: rgba(255, 255, 255, 0.22);
}

#lightbox-close:active,
#lightbox-prev:active,
#lightbox-next:active {
  transform: scale(0.95);
}

#lightbox-close {
  top: 16px;
  right: 20px;
  font-size: 22px;
}

#lightbox-prev {
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
}

#lightbox-prev:hover {
  transform: translateY(-50%) scale(1.05);
}

#lightbox-next {
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

#lightbox-next:hover {
  transform: translateY(-50%) scale(1.05);
}

/* ── 19. Modals ───────────────────────────────────────────────── */
.modal {
  display: none;
  position: fixed;
  z-index: 10001;
  inset: 0;
  padding-left: 256px; /* offset for sidebar so content centers in visible area */
  background: var(--bg-overlay);
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: modalBackdropIn var(--transition-base) ease-out;
}

.modal.open,
.modal[style*="flex"] {
  display: flex;
}

/* Remove sidebar offset when sidebar is collapsed */
html:has(#app-sidebar.sidebar-collapsed) .modal {
  padding-left: 0;
}

@keyframes modalBackdropIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-content {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 580px;
  max-width: 90%;
  min-width: 360px;
  min-height: 300px;
  padding: 24px;
  box-shadow: var(--shadow-xl);
  position: relative;
  max-height: 88vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  resize: both;
  /* GPU-accelerated modal entrance */
  animation: modalContentIn var(--transition-slow) ease-out;
}

@keyframes modalContentIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 16px;
  font-weight: 400;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  transition: background var(--transition-fast), color var(--transition-fast);
  float: none;
}

.modal-close:hover {
  background: var(--danger-bg);
  color: var(--danger-fg);
  border-color: var(--danger-fg);
}

.modal-content h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  padding-right: 36px;
}

.modal-content p {
  color: var(--text-muted);
  font-size: 13px;
}

/* ── 20. Form Elements (Modal) ────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea,
.form-group select,
#batch-size-select,
#sort-files {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-sans);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  box-sizing: border-box;
}

.form-group textarea,
#note-text {
  resize: vertical;
  min-height: 96px;
  line-height: 1.5;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
#batch-size-select:focus,
#sort-files:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-group select,
#batch-size-select,
#sort-files {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

.form-help {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── 21. Upload Zone ──────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 28px 20px;
  text-align: center;
  background: var(--bg-primary);
  cursor: pointer;
  transition: border-color var(--transition-base), background var(--transition-base);
  position: relative;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-zone-icon {
  font-size: 36px;
  margin-bottom: 8px;
  line-height: 1;
}

.upload-zone-text h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.upload-zone-text p {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

.upload-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 44px;
  margin-top: 16px;
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-sans);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
  transition: background var(--transition-fast), transform var(--transition-fast),
    box-shadow var(--transition-fast);
}

.upload-button:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.upload-button:active:not(:disabled) {
  transform: scale(0.98);
}

.upload-button:disabled {
  background: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
  box-shadow: none;
}

.sort-controls {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.sort-controls label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.status-message {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  display: none;
}

.status-message.success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-fg);
}

.status-message.error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-fg);
}

/* ── 22. Customize Table Modal ────────────────────────────────── */
.customize-lists-wrapper {
  display: flex;
  gap: 20px;
  align-items: stretch;
  margin-top: 12px;
}

.customize-column {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.customize-column h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.customize-column p {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.customize-list-container {
  flex: 1;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  list-style: none;
  padding: 0 !important;
  margin: 0;
}

.customize-list-item {
  display: flex;
  align-items: center;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-fast);
  cursor: pointer;
  user-select: none;
  background: var(--bg-card);
}

.customize-list-item:last-child {
  border-bottom: none;
}

.customize-list-item:hover {
  background: var(--bg-hover);
}

.customize-list-item label {
  display: flex;
  align-items: center;
  width: 100%;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
}

.customize-list-item input[type="checkbox"] {
  margin-right: 10px;
}

.customize-list-item.draggable {
  cursor: grab;
}

.customize-list-item.draggable:active {
  cursor: grabbing;
}

.grip-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  margin-right: 8px;
  color: var(--border-strong);
  font-size: 16px;
  user-select: none;
}

.customize-list-item:hover .grip-handle {
  color: var(--text-muted);
}

.customize-list-item.disabled {
  opacity: 0.45;
}

/* ── 23. Action Bar (Modal Footer) ───────────────────────────── */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  gap: 8px;
}

/* ── 24. Trial Banner ─────────────────────────────────────────── */
#trial-banner {
  background: var(--warning-bg) !important;
  color: var(--warning-fg) !important;
  border-bottom: 1px solid var(--warning-fg) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
}

/* ── 24b. Create Listing Nav Button Reset ────────────────────── */
/* bg-transparent & border-0 are not in any static HTML, so Tailwind
   CDN never generates those rules. Set them explicitly so the button
   doesn't fall back to browser-default white button styling in dark mode. */
#create-listing-nav button {
  background: transparent;
  border: none;
}

/* ── 25. Dark Mode Explicit Overrides ────────────────────────── */
body.dark-mode .filter-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}

body.dark-mode .filter-group input[type="text"],
body.dark-mode .filter-group input[type="number"] {
  background-image: none;
}

body.dark-mode .form-group select,
body.dark-mode #batch-size-select,
body.dark-mode #sort-files {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* Inline-style overrides for dark mode compatibility */
body.dark-mode [style*="background:#f5f6fa"],
body.dark-mode [style*="background: #f5f6fa"] {
  background: var(--bg-primary) !important;
}

body.dark-mode [style*="color:#666"],
body.dark-mode [style*="color: #666"] {
  color: var(--text-muted) !important;
}

/* ── 26. Mobile Filter Bottom Sheet ──────────────────────────── */
@media (max-width: 767px) {

  /* Filter bar morphs into fixed bottom sheet */
  .filter-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 495;
    background: var(--bg-elevated);
    border: none;
    border-top: 2px solid var(--border-strong);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 20px 20px 32px;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: translateY(110%);
    transition: transform var(--transition-slow);
  }

  .filter-bar.sheet-open {
    transform: translateY(0);
  }

  .filter-bar::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: var(--border-strong);
    border-radius: 2px;
    margin: 0 auto 8px;
  }

  .filter-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    width: 100%;
  }

  .filter-group input[type="text"],
  .filter-group input[type="number"],
  .filter-group select {
    width: 100%;
  }

  /* Mobile filter toggle button visible on small screens */
  .filter-toggle-btn {
    display: inline-flex;
  }

  /* Advanced filters always expanded inside bottom sheet */
  .advanced-filters {
    max-height: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    padding-top: 10px;
    border-top-width: 1px;
    overflow: visible !important;
  }

  /* Hide the desktop Filters toggle button on mobile */
  #filters-toggle-btn {
    display: none;
  }

  /* Modal full-screen on mobile */
  .modal {
    padding-left: 0;
  }
  .modal-content {
    width: 100%;
    max-width: 100%;
    min-width: unset;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 92vh;
    margin: 0;
    resize: none;
    animation: modalSlideUp var(--transition-slow) ease-out;
  }

  @keyframes modalSlideUp {
    from {
      transform: translateY(20px);
      opacity: 0;
    }

    to {
      transform: translateY(0);
      opacity: 1;
    }
  }

  /* ── Mobile Table-to-Card Pattern ──────────────────────────── */

  #listings-table {
    display: block;
    width: 100%;
    min-width: 0;
  }

  #listings-table thead {
    display: none;
  }

  #listings-table tbody {
    display: block;
    width: 100%;
  }

  #listings-table tbody tr {
    display: block;
    margin-bottom: 16px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: relative;
  }

  #listings-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    min-height: 44px;
    width: 100%;
  }

  #listings-table tbody td:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  #listings-table tbody td:has(.select-row) {
    justify-content: flex-start;
    gap: 16px;
    border-bottom: 1px solid var(--border);
  }

  /* Mobile faux-headers via pseudo-elements */
  #listings-table tbody td::before {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 13px;
    margin-right: 16px;
    flex-shrink: 0;
  }

  #listings-table tbody td:has([data-field="sku"])::before {
    content: "SKU:";
  }

  #listings-table tbody td:has(img)::before {
    content: "Image:";
  }

  #listings-table tbody td:has([data-field="title"])::before {
    content: "Title:";
  }

  #listings-table tbody td:has([data-field="description"])::before {
    content: "Description:";
  }

  #listings-table tbody td:has([data-field="categoryId"])::before {
    content: "Category:";
  }

  #listings-table tbody td:has([data-field="storeCategoryId"])::before {
    content: "Store Category:";
  }

  #listings-table tbody td:has([data-field="conditionId"])::before {
    content: "Condition:";
  }

  #listings-table tbody td:has([data-field="shippingProfileId"])::before {
    content: "Shipping Profile:";
  }

  #listings-table tbody td:has([data-field="startPrice"])::before {
    content: "Price (£):";
  }

  #listings-table tbody td:has([data-field="quantity"])::before {
    content: "Qty:";
  }

  #listings-table tbody td.actions::before {
    content: "Actions:";
  }

  /* Touch Targets & Accessibility Enhancements */
  .btn,
  button,
  input[type="checkbox"],
  input[type="text"],
  input[type="number"],
  select,
  textarea,
  .action-menu-btn {
    min-height: 44px;
    min-width: 44px;
  }

  /* Reset select and input heights on mobile since inline might override */
  #listings-table tbody td input,
  #listings-table tbody td select {
    height: auto;
  }

  #listings-table td [data-field] {
    width: auto;
    flex-grow: 1;
    max-width: 60%;
    margin-left: auto;
    text-align: right;
  }

  #listings-table td [data-field="description"],
  #listings-table td [data-field="title"] {
    max-width: 100%;
    width: 100%;
  }

  .field-with-counter {
    width: 100%;
    text-align: right;
  }

  /* Fixed Bulk Action bar on mobile */
  .action-buttons {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    box-shadow: 0 -10px 20px rgba(0, 0, 0, 0.1);
    justify-content: space-around;
    text-align: center;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  body.dark-mode .action-buttons {
    background: var(--bg-header);
    box-shadow: 0 -10px 20px rgba(0, 0, 0, 0.5);
  }

  /* Prevent main body content from being hidden by the fixed bottom bar */
  body {
    padding-bottom: 96px;
    /* 24 * 4px */
  }

  /* Make Filters toggle button highly visible and float above the bulk action bar */
  #filter-toggle-btn {
    background: var(--accent) !important;
    color: #ffffff !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-focus);
    z-index: 480 !important;
    bottom: 80px !important;
    /* Above the bulk action bar */
  }
}

/* ── Sidebar Collapse — GPU-accelerated transform ────────────── */
#app-sidebar {
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}
#app-sidebar.sidebar-collapsed {
  transform: translateX(-256px);
}
#main-content {
  transition: margin-left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
#main-content.sidebar-collapsed {
  margin-left: 0;
}
#sidebar-collapse-btn svg {
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
#app-sidebar.sidebar-collapsed #sidebar-collapse-btn svg {
  transform: rotate(180deg);
}