/* ═══════════════════════════════════════════════════════
   Lin's FB Seller — Premium Dark Theme v2.0
   Phase 5: Dashboard upgrade with table view,
   status badges, batch actions, price slider
   ═══════════════════════════════════════════════════════ */

:root {
  --bg-primary: #0f0f14;
  --bg-secondary: #16161e;
  --bg-card: #1c1c28;
  --bg-input: #22222e;
  --border: rgba(255, 255, 255, 0.06);
  --accent: #6c5ce7;
  --accent-glow: rgba(108, 92, 231, 0.2);
  --green: #00d68f;
  --green-glow: rgba(0, 214, 143, 0.12);
  --blue: #4fc3f7;
  --blue-glow: rgba(79, 195, 247, 0.12);
  --red: #ff6b6b;
  --orange: #ffa726;
  --orange-glow: rgba(255, 167, 38, 0.12);
  --yellow: #ffeb3b;
  --text-primary: #e8e8ea;
  --text-secondary: #8f8fa3;
  --text-muted: #555568;
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.2s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    "Inter",
    -apple-system,
    sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ─── Screens ─── */
.screen {
  display: none;
}
.screen.active {
  display: block;
}

/* ─── Auth Screen ─── */
.auth-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background:
    radial-gradient(
      ellipse at 20% 50%,
      rgba(108, 92, 231, 0.08),
      transparent 50%
    ),
    radial-gradient(
      ellipse at 80% 50%,
      rgba(0, 214, 143, 0.05),
      transparent 50%
    ),
    var(--bg-primary);
}

.auth-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.brand-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
  filter: drop-shadow(0 4px 20px rgba(108, 92, 231, 0.3));
}

.auth-brand h1 {
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-tagline {
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 300;
  margin-top: 0.25rem;
  letter-spacing: 0.5px;
}

.auth-form {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.input-group input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}

.input-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent), #5a4bd4);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(108, 92, 231, 0.3);
}

.btn-primary:disabled {
  opacity: 0.6;
  transform: none;
}

.btn-ghost {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  padding: 8px;
}

.btn-ghost:hover {
  color: var(--text-primary);
}

.btn-ghost-sm {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.btn-ghost-sm:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.error-msg {
  color: var(--red);
  font-size: 0.85rem;
  text-align: center;
  margin-top: 0.5rem;
  min-height: 1.2em;
}

/* ─── Top Bar ─── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 2rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.topbar-brand {
  font-weight: 700;
  font-size: 1.1rem;
}

.topbar-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-badge {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* ─── Stats Bar ─── */
.stats-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
}

.stat-item {
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  white-space: nowrap;
}

.badge-analyzed {
  background: var(--blue-glow);
  color: var(--blue);
}

.badge-listed {
  background: var(--orange-glow);
  color: var(--orange);
}

.badge-sold {
  background: var(--green-glow);
  color: var(--green);
}

.badge-revenue {
  background: rgba(255, 235, 59, 0.1);
  color: var(--yellow);
  font-weight: 600;
}

/* ─── Upload Zone ─── */
.upload-section {
  max-width: 720px;
  margin: 1.5rem auto;
  padding: 0 1.5rem;
}

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-secondary);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent);
  background: rgba(108, 92, 231, 0.04);
}

.upload-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.upload-content h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.upload-content p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ─── Context Input (T5.4 — D1 Mitigation) ─── */
.context-input-wrap {
  margin-top: 1rem;
}

.context-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.context-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.context-input::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

/* ─── Progress ─── */
.upload-progress {
  padding: 1.5rem 0;
}

.progress-bar {
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 3px;
  width: 0%;
  transition: width 0.4s ease;
}

.progress-text {
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-align: center;
}

/* ─── Controls Section ─── */
.controls-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.controls-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 600;
}

/* ─── View Toggle ─── */
.view-toggle {
  display: flex;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.view-btn {
  padding: 6px 12px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition);
}

.view-btn.active {
  background: var(--accent);
  color: white;
}

.view-btn:hover:not(.active) {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

/* ─── Batch Actions Bar ─── */
.batch-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
  animation: fadeIn 0.2s ease;
}

.btn-batch {
  padding: 5px 12px;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.btn-batch-post {
  background: var(--green-glow);
  color: var(--green);
}

.btn-batch-post:hover {
  background: var(--green);
  color: white;
}

.btn-batch-delete {
  background: rgba(255, 107, 107, 0.1);
  color: var(--red);
}

.btn-batch-delete:hover {
  background: var(--red);
  color: white;
}

/* ─── Items Grid ─── */
.items-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.5rem 1.5rem 2rem;
}

.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.item-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border);
  position: relative;
}

.item-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  border-color: rgba(108, 92, 231, 0.3);
}

.item-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.item-card-select {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  padding: 4px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 6px;
  backdrop-filter: blur(4px);
}

.item-card-select input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}

.item-card-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--bg-input);
}

.item-card-body {
  padding: 1rem;
}

.item-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.item-card-name {
  font-weight: 600;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.item-card-brand {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.item-card-pricing {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.price-badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
}

.price-default {
  background: var(--green-glow);
  color: var(--green);
}

.price-range {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* ─── Status Badges (T5.2) ─── */
.status-badge {
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.status-analyzed {
  background: var(--blue-glow);
  color: var(--blue);
}

.status-listed {
  background: var(--orange-glow);
  color: var(--orange);
}

.status-sold {
  background: var(--green-glow);
  color: var(--green);
}

/* ─── Table View (T5.1) ─── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.items-table th {
  background: var(--bg-secondary);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}

.items-table th.sort-header {
  cursor: pointer;
  transition: var(--transition);
}

.items-table th.sort-header:hover {
  color: var(--text-primary);
}

.items-table th.sort-asc::after {
  content: " ↑";
  color: var(--accent);
}

.items-table th.sort-desc::after {
  content: " ↓";
  color: var(--accent);
}

.th-check {
  width: 40px;
}

.items-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.items-table tr {
  background: var(--bg-card);
  transition: var(--transition);
}

.items-table tr:hover {
  background: rgba(108, 92, 231, 0.06);
}

.items-table tr.selected {
  background: rgba(108, 92, 231, 0.1);
}

.items-table td input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.table-item-name {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-weight: 500;
}

.table-item-name:hover {
  color: var(--accent);
}

.table-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--bg-input);
  flex-shrink: 0;
}

.price-cell {
  font-weight: 600;
  color: var(--green);
}

.price-range-cell {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.8rem;
}

.table-actions {
  white-space: nowrap;
}

.btn-sm {
  padding: 4px 8px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.9rem;
  transition: var(--transition);
}

.btn-sm:hover {
  background: rgba(255, 255, 255, 0.08);
}

.btn-del:hover {
  background: rgba(255, 107, 107, 0.15);
}

/* ─── No Items ─── */
.no-items {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
}

/* ─── Modal ─── */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  padding: 2rem;
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: fadeIn 0.2s ease;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: var(--transition);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

/* Modal content styles */
.detail-header {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.detail-img {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--bg-input);
  flex-shrink: 0;
}

.detail-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.detail-info h2 {
  font-size: 1.3rem;
  font-weight: 700;
}

.detail-meta {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.detail-condition {
  display: inline-block;
  padding: 3px 10px;
  background: var(--bg-card);
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: capitalize;
  margin-top: 0.5rem;
}

/* Pricing grid */
.pricing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.pricing-box {
  padding: 0.75rem;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  text-align: center;
  border: 1px solid var(--border);
}

.pricing-box.default {
  border-color: rgba(0, 214, 143, 0.3);
}

.pricing-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.pricing-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.pricing-value.green {
  color: var(--green);
}

/* ─── Price Slider (T5.5) ─── */
.price-slider-container {
  margin: 1rem 0 1.5rem;
  padding: 1rem;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.price-slider-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.price-slider-label span {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--green);
}

.price-slider {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--bg-input);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.price-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #5a4bd4);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(108, 92, 231, 0.4);
  transition: var(--transition);
}

.price-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 16px rgba(108, 92, 231, 0.6);
}

.price-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #5a4bd4);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(108, 92, 231, 0.4);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Sources */
.sources-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.source-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--blue);
  font-size: 0.8rem;
  text-decoration: none;
  transition: var(--transition);
  text-transform: capitalize;
}

.source-link:hover {
  border-color: var(--blue);
  background: var(--blue-glow);
}

/* Listing preview */
.listing-preview {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin: 0.5rem 0;
}

.listing-preview h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.listing-preview p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.listing-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.listing-tag {
  padding: 3px 8px;
  background: var(--accent-glow);
  color: var(--accent);
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* ─── Detail Actions ─── */
.detail-actions {
  display: flex;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

/* ─── Copy Posting Flow UI ─── */
.copy-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 10px 14px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  border: 1px solid transparent;
  transition: var(--transition);
}

.copy-group:hover {
  border-color: rgba(108, 92, 231, 0.3);
  background: rgba(108, 92, 231, 0.05);
}

.copy-group h3,
.copy-group p,
.copy-group .listing-tags {
  margin: 0;
  flex: 1;
}

.copy-group .price-val {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--green);
  flex: 1;
}

.btn-copy-sm {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-copy-sm:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.approve-btn {
  background: linear-gradient(135deg, var(--green), #03a9f4);
  color: white;
  border: none;
  font-weight: 700;
}
.approve-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 214, 143, 0.3);
}

.btn-copy,
.btn-post-action,
.btn-fb-link {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  text-decoration: none;
  font-family: inherit;
}

.btn-copy {
  background: linear-gradient(135deg, var(--accent), #5a4bd4);
  color: white;
}

.btn-copy:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(108, 92, 231, 0.3);
}

.btn-post-action {
  background: var(--green-glow);
  color: var(--green);
  border: 1px solid rgba(0, 214, 143, 0.3);
}

.btn-post-action:hover {
  background: var(--green);
  color: white;
  transform: translateY(-1px);
}

.btn-post-action:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-fb-link {
  background: var(--blue-glow);
  color: var(--blue);
  border: 1px solid rgba(79, 195, 247, 0.3);
}

.btn-fb-link:hover {
  background: var(--blue);
  color: white;
}

.btn-delete {
  padding: 8px 16px;
  background: rgba(255, 107, 107, 0.1);
  color: var(--red);
  border: 1px solid rgba(255, 107, 107, 0.2);
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  margin-left: auto;
}

.btn-delete:hover {
  background: var(--red);
  color: white;
}

/* ─── Hidden / Utility ─── */
.hidden {
  display: none !important;
}

/* ─── Animations ─── */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.item-card {
  animation: fadeIn 0.3s ease;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.analyzing {
  animation: pulse 1.5s infinite;
}

/* ─── Pipeline Tracker ─── */
.pipeline-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
}

.pipeline-tracker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.pipeline-tracker::-webkit-scrollbar {
  display: none;
}

.pipeline-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
  position: relative;
  min-width: 60px;
}

.pipeline-stage:hover {
  background: rgba(108, 92, 231, 0.08);
}

.pipeline-stage.active {
  background: var(--accent-glow);
  box-shadow: 0 0 12px rgba(108, 92, 231, 0.2);
}

.pipeline-stage.has-items {
  border-bottom: 2px solid var(--accent);
}

.stage-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.stage-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.pipeline-stage.active .stage-label {
  color: var(--accent);
}

.stage-count {
  font-size: 0.6rem;
  font-weight: 700;
  background: var(--bg-card);
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.pipeline-stage.active .stage-count {
  background: var(--accent);
  color: white;
}

.pipeline-stage.has-items .stage-count {
  background: var(--green);
  color: white;
}

.pipeline-arrow {
  color: var(--text-muted);
  font-size: 0.75rem;
  flex-shrink: 0;
  padding: 0 0.15rem;
  opacity: 0.5;
}

/* ─── Scheduling Section ─── */
.schedule-section {
  max-width: 1200px;
  margin: 1rem auto;
  padding: 0 1.5rem;
}

.schedule-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.schedule-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.schedule-tabs {
  display: flex;
  gap: 0.5rem;
}

.schedule-tab {
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.schedule-tab.active {
  background: var(--accent-glow);
  color: var(--accent);
  border-color: var(--accent);
}

.schedule-tab:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05);
}

.schedule-panel {
  min-height: 60px;
}

.schedule-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}

.schedule-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  gap: 0.75rem;
  transition: var(--transition);
}

.schedule-card:hover {
  border-color: rgba(108, 92, 231, 0.3);
}

.schedule-card-img {
  width: 50px;
  height: 50px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--bg-input);
  flex-shrink: 0;
}

.schedule-card-info {
  flex: 1;
  min-width: 0;
}

.schedule-card-title {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.schedule-card-detail {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

.schedule-card-time {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 500;
  margin-top: 0.25rem;
}

.schedule-empty {
  color: var(--text-muted);
  text-align: center;
  padding: 2rem 0;
  font-size: 0.95rem;
}

/* ─── Image Comparison (Strict Rules) ─── */
.image-comparison {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  overflow-x: auto;
}

.img-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  min-width: 140px;
}

.comp-img {
  width: 140px;
  height: 140px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.img-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 12px;
}

/* ─── Toast Notifications ─── */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, var(--accent), #5a4bd4);
  box-shadow: 0 8px 24px rgba(108, 92, 231, 0.3);
  animation: slideIn 0.3s ease-out;
  opacity: 1;
  transition: opacity 0.3s;
}

.toast.success {
  background: linear-gradient(135deg, var(--green), #03a9f4);
  box-shadow: 0 8px 24px rgba(0, 214, 143, 0.3);
}

.toast.error {
  background: linear-gradient(135deg, #ff4444, #cc0000);
  box-shadow: 0 8px 24px rgba(255, 68, 68, 0.3);
}

.toast.fade-out {
  opacity: 0;
}

@keyframes slideIn {
  from {
    transform: translateX(100px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ─── Mobile Responsiveness ─── */
@media (max-width: 768px) {
  .topbar {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .topbar-center {
    order: 3;
    width: 100%;
    justify-content: flex-start;
  }

  .stats-bar {
    flex-wrap: wrap;
    font-size: 0.7rem;
    gap: 0.4rem;
  }

  .upload-section {
    padding: 0 1rem;
  }

  .controls-section {
    padding: 0.75rem 1rem;
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
  }

  .items-section {
    padding: 0.5rem 1rem 2rem;
  }

  .items-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }

  .detail-header {
    flex-direction: column;
    gap: 1rem;
  }

  .detail-img {
    width: 100%;
    height: 200px;
  }

  .pricing-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .detail-actions {
    flex-direction: column;
  }

  .btn-delete {
    margin-left: 0;
  }

  .batch-bar {
    flex-wrap: wrap;
    font-size: 0.8rem;
  }

  /* Hide table view on mobile — grid only */
  .table-wrap {
    display: none !important;
  }

  .view-toggle {
    display: none;
  }
}

/* ─── Responsive: iPhone / Small Mobile (480px) ─── */
@media (max-width: 480px) {
  body {
    padding-bottom: 70px; /* space for bottom nav */
    -webkit-overflow-scrolling: touch;
  }

  /* Compact top bar */
  .topbar {
    padding: 0.5rem 0.75rem;
    gap: 0.25rem;
  }

  .topbar-logo {
    font-size: 1rem;
  }

  .topbar-right {
    gap: 0.5rem;
  }

  .topbar-right .btn-ghost-sm {
    font-size: 0.7rem;
    padding: 4px 8px;
  }

  /* Stats bar — horizontal scroll on mobile */
  .stats-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 0.5rem;
    padding-bottom: 4px;
  }
  .stats-bar::-webkit-scrollbar {
    display: none;
  }

  .stat-badge {
    flex-shrink: 0;
    font-size: 0.65rem;
    padding: 4px 8px;
    min-width: max-content;
  }

  /* Full-width upload zone with touch targets */
  .upload-section {
    padding: 0 0.75rem;
    margin: 1rem auto;
  }

  .upload-zone {
    padding: 2rem 1rem;
    min-height: 120px; /* easy to tap */
  }

  .upload-zone p {
    font-size: 0.9rem;
  }

  .context-input {
    font-size: 16px; /* prevents iOS zoom on input focus */
    padding: 12px;
  }

  /* Single column grid — full width cards */
  .items-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .item-card {
    border-radius: var(--radius-sm);
  }

  .item-card-img {
    height: 180px;
  }

  .item-card-body {
    padding: 0.75rem;
  }

  .item-card-name {
    font-size: 0.95rem;
  }

  /* Touch-friendly buttons (44px min tap target per Apple HIG) */
  .btn-primary,
  .btn-copy,
  .btn-post-action,
  .btn-delete,
  .btn-fb-link {
    min-height: 44px;
    font-size: 0.9rem;
    padding: 10px 16px;
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  /* Modal — full screen on mobile */
  .modal {
    padding: 0;
    align-items: flex-end;
  }

  .modal-content {
    max-width: 100%;
    max-height: 95vh;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 1.5rem 1rem;
  }

  .modal-close {
    top: 0.75rem;
    right: 0.75rem;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .detail-img {
    height: 160px;
    border-radius: var(--radius-sm);
  }

  .detail-info h2 {
    font-size: 1.1rem;
  }

  .pricing-value {
    font-size: 1.3rem;
  }

  /* Auth screen — mobile optimized */
  .auth-container {
    padding: 1.5rem 1rem;
  }

  .brand-title {
    font-size: 1.5rem;
  }

  .auth-form {
    max-width: 100%;
  }

  .auth-form input {
    font-size: 16px; /* prevents iOS zoom */
    min-height: 44px;
  }

  .btn-primary {
    min-height: 48px;
    font-size: 1rem;
  }

  /* Controls */
  .controls-section {
    padding: 0.5rem 0.75rem;
  }

  .search-input {
    font-size: 16px;
    min-height: 40px;
  }

  /* Price slider — larger thumb for touch */
  .price-slider::-webkit-slider-thumb {
    width: 28px;
    height: 28px;
  }
  .price-slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
  }

  /* Sources — stack vertically */
  .sources-list {
    flex-direction: column;
  }

  .source-link {
    min-height: 44px;
    justify-content: center;
  }

  /* Pipeline — compact for mobile */
  .pipeline-section {
    padding: 0.5rem 0.5rem;
  }

  .pipeline-tracker {
    padding: 0.5rem;
    gap: 0;
    justify-content: flex-start;
  }

  .pipeline-stage {
    padding: 0.35rem 0.4rem;
    min-width: 48px;
  }

  .stage-icon {
    font-size: 1rem;
  }

  .stage-label {
    font-size: 0.55rem;
  }

  .stage-count {
    font-size: 0.5rem;
    padding: 0 4px;
  }

  .pipeline-arrow {
    font-size: 0.6rem;
    padding: 0 0.1rem;
  }

  /* Schedule — stack on mobile */
  .schedule-section {
    padding: 0 0.75rem;
  }

  .schedule-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .schedule-list {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════════════════════
   v3.0 — Dashboard Tabs, Analytics, Profit, A/B Tests
   ═══════════════════════════════════════════════════════ */

/* ─── Dashboard Tabs ─── */
.dashboard-tabs {
  display: flex;
  gap: 0;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.dash-tab {
  padding: 12px 20px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  min-height: 44px;
}

.dash-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.dash-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* ─── Tab Panels ─── */
.tab-panel {
  display: block;
}

.tab-panel.hidden {
  display: none;
}

/* ─── Small Primary Button ─── */
.btn-primary-sm {
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--accent), #5a4bd4);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary-sm:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(108, 92, 231, 0.3);
}

/* ─── Analytics Section ─── */
.analytics-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

.analytics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.analytics-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
}

.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: var(--transition);
}

.chart-card:hover {
  border-color: rgba(108, 92, 231, 0.2);
}

.chart-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.chart-wide {
  grid-column: 1 / -1;
}

/* ─── Profit Tracker ─── */
.profit-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

.profit-section h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.profit-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.profit-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  transition: var(--transition);
}

.profit-card:hover {
  border-color: rgba(108, 92, 231, 0.2);
  transform: translateY(-2px);
}

.profit-card-highlight {
  background: linear-gradient(
    135deg,
    rgba(0, 214, 143, 0.08),
    rgba(108, 92, 231, 0.08)
  );
  border-color: rgba(0, 214, 143, 0.2);
}

.profit-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.profit-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.profit-lists {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.profit-list-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.profit-list-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.profit-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.profit-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.profit-item-name {
  color: var(--text-primary);
  font-weight: 500;
}

.profit-item-value {
  font-weight: 600;
}

.profit-item-value.positive {
  color: var(--green);
}

.profit-item-value.negative {
  color: var(--red);
}

.profit-roi-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.profit-roi-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.profit-roi {
  overflow-x: auto;
}

.roi-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.roi-table th {
  background: var(--bg-secondary);
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.roi-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.roi-table tr:hover {
  background: rgba(108, 92, 231, 0.04);
}

/* ─── A/B Testing ─── */
.ab-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

.ab-section h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.ab-results {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.ab-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.ab-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.ab-item-name {
  font-size: 1.1rem;
  font-weight: 600;
}

.ab-winner-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--green-glow);
  color: var(--green);
}

.ab-variants {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.ab-variant-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

.ab-variant-card.winner {
  border-color: var(--green);
  background: rgba(0, 214, 143, 0.04);
}

.ab-variant-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.ab-variant-title {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.ab-variant-stats {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.ab-variant-stat span {
  font-weight: 600;
  color: var(--text-primary);
}

/* ─── Cross-Post Platforms ─── */
.platform-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.platform-check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.85rem;
}

.platform-check:hover {
  border-color: var(--accent);
}

.platform-check input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.platform-check.active {
  border-color: var(--green);
  background: var(--green-glow);
}

.cross-post-results {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.cross-post-platform {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.cross-post-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.cross-post-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-copy-sm,
.btn-open-sm {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.btn-copy-sm {
  background: var(--accent-glow);
  color: var(--accent);
}

.btn-copy-sm:hover {
  background: var(--accent);
  color: white;
}

.btn-open-sm {
  background: var(--blue-glow);
  color: var(--blue);
}

.btn-open-sm:hover {
  background: var(--blue);
  color: white;
}

/* ─── v3.0 Detail Sections ─── */
.detail-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.detail-section h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.cost-input-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.cost-input {
  width: 120px;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.cost-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-save-cost {
  padding: 8px 16px;
  background: var(--green-glow);
  color: var(--green);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.btn-save-cost:hover {
  background: var(--green);
  color: white;
}

.margin-badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
}

.margin-good {
  background: var(--green-glow);
  color: var(--green);
}

.margin-low {
  background: rgba(255, 107, 107, 0.12);
  color: var(--red);
}

/* ─── Mark Sold Form ─── */
.mark-sold-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  margin-top: 0.75rem;
}

.mark-sold-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.mark-sold-field label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.mark-sold-field input,
.mark-sold-field select {
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
}

.mark-sold-field input:focus,
.mark-sold-field select:focus {
  border-color: var(--accent);
}

.btn-mark-sold {
  padding: 8px 16px;
  background: var(--green);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.btn-mark-sold:hover {
  box-shadow: 0 4px 16px rgba(0, 214, 143, 0.3);
}

/* ─── v3.0 Responsive ─── */
@media (max-width: 768px) {
  .dashboard-tabs {
    padding: 0 1rem;
  }

  .dash-tab {
    padding: 10px 14px;
    font-size: 0.8rem;
  }

  .chart-grid {
    grid-template-columns: 1fr;
  }

  .profit-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .profit-lists {
    grid-template-columns: 1fr;
  }

  .ab-variants {
    grid-template-columns: 1fr;
  }

  .analytics-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
}

@media (max-width: 480px) {
  .profit-cards {
    grid-template-columns: 1fr;
  }
}

/* ─── v3.0: Editable Listing Fields ─── */
.edit-group {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 10px 14px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  border: 1px solid transparent;
  transition: var(--transition);
}

.edit-group:hover {
  border-color: rgba(108, 92, 231, 0.3);
  background: rgba(108, 92, 231, 0.05);
}

.edit-group:focus-within {
  border-color: var(--accent);
  background: rgba(108, 92, 231, 0.08);
}

.edit-field-wrap {
  flex: 1;
  position: relative;
}

.edit-field-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.edit-field-label .pencil {
  opacity: 0.5;
  font-size: 0.7rem;
}

.edit-input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  padding: 2px 0;
  outline: none;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
  transition: var(--transition);
}

.edit-input:hover {
  border-bottom-color: rgba(108, 92, 231, 0.4);
}

.edit-input:focus {
  border-bottom-color: var(--accent);
  border-bottom-style: solid;
}

.edit-textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 2px 0;
  outline: none;
  resize: vertical;
  min-height: 60px;
  line-height: 1.5;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
  transition: var(--transition);
}

.edit-textarea:hover {
  border-bottom-color: rgba(108, 92, 231, 0.4);
}

.edit-textarea:focus {
  border-bottom-color: var(--accent);
  border-bottom-style: solid;
}

.edit-saved-indicator {
  font-size: 0.7rem;
  color: var(--green);
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.3s;
  position: absolute;
  right: 0;
  top: 0;
}

.edit-saved-indicator.show {
  opacity: 1;
}

.edit-tags-input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--accent);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 2px 0;
  outline: none;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
  transition: var(--transition);
}

.edit-tags-input:hover {
  border-bottom-color: rgba(108, 92, 231, 0.4);
}

.edit-tags-input:focus {
  border-bottom-color: var(--accent);
  border-bottom-style: solid;
}

.edit-hint {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 6px;
  opacity: 0;
  transition: opacity 0.2s;
}

.edit-group:focus-within .edit-hint {
  opacity: 1;
}

/* ═══════════════════════════════════════════════════════
   Seller Context Panel & Multi-Photo Gallery (v3.1)
   ═══════════════════════════════════════════════════════ */

/* ─── Workspace Two-Column Layout ─── */
.workspace-section {
  max-width: 1200px;
  margin: 1.5rem auto 0;
  padding: 0 1.5rem;
}

.workspace-layout {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.workspace-left {
  flex: 0 0 35%;
  min-width: 0;
}

.workspace-right {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Compact upload zone when inside workspace */
.upload-zone-compact {
  min-height: 140px;
  padding: 1.25rem;
}

.upload-zone-compact h3 {
  font-size: 1rem;
  margin: 0.5rem 0 0.25rem;
}

.upload-zone-compact p {
  font-size: 0.8rem;
}

.upload-zone-compact .upload-icon {
  font-size: 1.8rem;
}

/* Toggle pill checkboxes */
.context-toggles-row {
  gap: 0.5rem !important;
}

.toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 50px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.8rem;
  color: var(--text-muted);
  user-select: none;
}

.toggle-pill:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
}

.toggle-pill:has(.context-check:checked) {
  border-color: var(--accent);
  background: rgba(110, 86, 207, 0.12);
  color: var(--text-primary);
}

.toggle-pill .context-check {
  width: 14px;
  height: 14px;
}

/* ─── Seller Context Panel ─── */
.seller-context-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  padding: 1rem 1.25rem;
}

/* Single main textarea with floating mic */
.context-main-input {
  position: relative;
  margin-bottom: 1rem;
}

.context-main-textarea {
  width: 100%;
  padding: 14px 50px 14px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
  resize: vertical;
  min-height: 100px;
  line-height: 1.5;
}

.context-main-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.context-main-textarea::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.mic-btn-float {
  position: absolute;
  top: 8px;
  right: 8px;
}

.mic-hint {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: right;
  opacity: 0.7;
}

/* Options row: two columns */
.context-options-row {
  display: flex;
  gap: 1.25rem;
}

.context-options-left {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-shrink: 0;
  min-width: 140px;
}

.context-options-right {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* Inline price */
.price-inline {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.price-inline label {
  font-size: 1rem;
}

.context-price-sm {
  padding: 6px 10px !important;
  font-size: 0.82rem !important;
  max-width: 130px;
}

/* Shipping toggle */
.shipping-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.shipping-toggle:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
}

.shipping-toggle:has(.context-check:checked) {
  border-color: var(--accent);
  background: rgba(110, 86, 207, 0.1);
  color: var(--text-primary);
}

.shipping-label {
  font-weight: 500;
}

.shipping-detail {
  padding: 0.4rem 0 0.4rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* Ship row: toggle + GPS inline */
.ship-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.ship-row .shipping-toggle {
  flex-shrink: 0;
}

.ship-gps-inline {
  flex: 1;
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.btn-walmart-sm {
  padding: 5px 8px;
  background: rgba(0, 113, 206, 0.12);
  border: 1px solid rgba(0, 113, 206, 0.3);
  border-radius: var(--radius-sm);
  color: #5cb8ff;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-walmart-sm:hover {
  background: rgba(0, 113, 206, 0.25);
  border-color: rgba(0, 113, 206, 0.5);
}

/* GPS row */
.gps-row {
  display: flex;
  gap: 0.35rem;
}

.gps-input {
  flex: 1;
  padding: 6px 10px !important;
  font-size: 0.78rem !important;
}

.btn-gps {
  padding: 6px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition);
}

.btn-gps:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--accent);
}

.btn-walmart {
  padding: 5px 10px;
  background: rgba(0, 113, 206, 0.12);
  border: 1px solid rgba(0, 113, 206, 0.3);
  border-radius: var(--radius-sm);
  color: #5cb8ff;
  font-size: 0.78rem;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}

.btn-walmart:hover {
  background: rgba(0, 113, 206, 0.2);
  border-color: rgba(0, 113, 206, 0.5);
}

.gps-hint {
  font-size: 0.65rem;
  color: var(--text-muted);
  opacity: 0.7;
  line-height: 1.3;
}

.seller-context-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.seller-context-header:hover {
  background: rgba(255, 255, 255, 0.02);
}

.seller-context-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.seller-context-hint {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
}

.seller-context-toggle {
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: transform 0.3s ease;
}

.seller-context-panel.collapsed .seller-context-toggle {
  transform: rotate(-90deg);
}

.seller-context-body {
  padding: 0 1.25rem 1.25rem;
  overflow: hidden;
  max-height: 500px;
  transition:
    max-height 0.3s ease,
    padding 0.3s ease;
}

.seller-context-panel.collapsed .seller-context-body {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.seller-context-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.context-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.context-field label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.context-field-row {
  display: flex;
  gap: 1rem;
}

.context-field-half {
  flex: 1;
  min-width: 0;
}

.context-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
  resize: vertical;
  min-height: 48px;
}

.context-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.context-textarea::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.context-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238f8fa3' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.context-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.context-check {
  margin-right: 0.35rem;
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  vertical-align: text-bottom;
  cursor: pointer;
}

/* ─── Multi-Photo Gallery ─── */
.photo-gallery {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 1rem;
  animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.photo-gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.photo-gallery-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.photo-gallery-actions {
  display: flex;
  gap: 0.5rem;
}

.photo-items {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

/* Custom scrollbar for photo-items */
.photo-items::-webkit-scrollbar {
  width: 4px;
}
.photo-items::-webkit-scrollbar-track {
  background: transparent;
}
.photo-items::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.photo-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.photo-item:hover {
  border-color: rgba(108, 92, 231, 0.25);
}

.photo-item-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  background: var(--bg-input);
}

.photo-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.photo-item-name {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photo-item-context {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.82rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
  resize: none;
  min-height: 52px;
}

.photo-item-context:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.photo-item-context::placeholder {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.78rem;
}

.photo-item-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: var(--transition);
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 0.25rem;
}

.photo-item-remove:hover {
  color: var(--red);
  background: rgba(255, 107, 107, 0.1);
}

.btn-analyze-all {
  margin-top: 1rem;
  width: 100%;
  padding: 14px;
  font-size: 1rem;
  font-weight: 600;
}

@media (max-width: 768px) {
  .context-field-row {
    flex-direction: column;
    gap: 0.75rem;
  }
  .photo-item {
    flex-wrap: wrap;
  }
  .photo-item-thumb {
    width: 60px;
    height: 60px;
  }
  .workspace-layout {
    flex-direction: column;
  }
}

/* ═══════════════════════════════════════════════════════
   N1: MFG Label Badge & Warning (v3.2)
   ═══════════════════════════════════════════════════════ */

.photo-item-label-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: rgba(255, 167, 38, 0.15);
  color: var(--orange);
  border: 1px solid rgba(255, 167, 38, 0.25);
}

.mfg-warning-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 167, 38, 0.08);
  border: 1px solid rgba(255, 167, 38, 0.2);
  border-radius: var(--radius-sm);
  color: var(--orange);
  font-size: 0.82rem;
  margin-bottom: 0.75rem;
  animation: fadeIn 0.3s ease;
}

.mfg-warning-banner .warning-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.mfg-warning-banner .warning-text {
  flex: 1;
}

/* ═══════════════════════════════════════════════════════
   N2: Voice Input / Mic Buttons (v3.2)
   ═══════════════════════════════════════════════════════ */

.input-with-mic {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  position: relative;
}

.input-with-mic .context-textarea,
.input-with-mic .context-input,
.input-with-mic .photo-item-context {
  flex: 1;
  min-width: 0;
}

.mic-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.mic-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: var(--accent);
}

.mic-btn.recording {
  background: rgba(255, 107, 107, 0.15);
  color: var(--red);
  border-color: var(--red);
  animation: micPulse 1.2s ease infinite;
}

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.3); }
  50% { box-shadow: 0 0 0 6px rgba(255, 107, 107, 0); }
}

.mic-unsupported {
  display: none !important;
}

/* ═══════════════════════════════════════════════════════
   N3: Camera / Photo Attachment Buttons (v3.2)
   ═══════════════════════════════════════════════════════ */

.cam-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.cam-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: var(--blue);
}

.cam-btn.has-photo {
  background: rgba(79, 195, 247, 0.12);
  color: var(--blue);
  border-color: var(--blue);
}

.attached-photo-preview {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.attached-photo-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.attached-photo-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: var(--transition);
}

.attached-photo-remove:hover {
  color: var(--red);
  background: rgba(255, 107, 107, 0.1);
}
