:root {
  --bg: #070b15;
  --bg-2: #0c1222;
  --panel: rgba(14, 20, 35, 0.72);
  --panel-strong: rgba(14, 20, 35, 0.94);
  --line: rgba(148, 163, 184, 0.16);
  --text: #f3f4f6;
  --muted: #98a2b3;
  --accent: #f97316;
  --accent-2: #22c55e;
  --danger: #fb7185;
  --shadow: 0 26px 70px rgba(0, 0, 0, 0.42);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 10% 10%, rgba(249, 115, 22, 0.16), transparent 22%),
    radial-gradient(circle at 90% 0%, rgba(96, 165, 250, 0.12), transparent 26%),
    radial-gradient(circle at 70% 100%, rgba(34, 197, 94, 0.08), transparent 24%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
  color: var(--text);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
}

body {
  padding: 32px 20px 60px;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(7, 11, 21, 0.02), rgba(7, 11, 21, 0.38)),
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.04), transparent 35%);
}

.app-shell {
  max-width: 1440px;
  margin: 0 auto;
}

.hero {
  display: grid;
  gap: 20px;
  grid-template-columns: 1.75fr 1fr;
  align-items: stretch;
  margin-bottom: 24px;
}

.hero,
.controls-panel,
.status-banner,
.summary-bar,
.empty-state,
.pagination-toolbar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.hero {
  padding: 30px;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  inset: auto -10% -55% auto;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(249, 115, 22, 0.16), transparent 70%);
  filter: blur(4px);
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 11px;
  color: #fdba74;
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(2.25rem, 4vw, 3.6rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  max-width: 10ch;
}

.hero-copy {
  margin: 0;
  color: var(--muted);
  max-width: 760px;
  line-height: 1.7;
  font-size: 1.02rem;
}

.hero-stats {
  display: grid;
  gap: 14px;
}

.stat-card {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  border-radius: 16px;
  padding: 16px 18px;
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.stat-card strong {
  font-size: 1.15rem;
}

.controls-panel {
  padding: 20px;
  display: grid;
  grid-template-columns: 1.35fr 1.55fr 1fr 1fr auto;
  gap: 14px;
  margin-bottom: 16px;
}

.field-group {
  display: grid;
  gap: 8px;
  align-content: start;
}

.field-group-large {
  min-width: 220px;
}

label {
  color: var(--muted);
  font-size: 0.84rem;
}

input,
select,
button {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
  background: rgba(15, 23, 42, 0.92);
}

input:focus,
select:focus,
button:focus {
  outline: 2px solid rgba(139, 92, 246, 0.45);
  outline-offset: 1px;
}

.field-group-toggle {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
}

.dashboard-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(10, 15, 28, 0.78));
  box-shadow: var(--shadow);
}

.dashboard-nav-meta {
  display: grid;
  gap: 4px;
}

.nav-kicker {
  color: #fdba74;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.nav-caption {
  color: var(--muted);
  font-size: 0.92rem;
}

.dashboard-nav-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
  min-width: min(100%, 520px);
}

.nav-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.68);
  color: var(--text);
  text-decoration: none;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.nav-card strong {
  font-size: 1rem;
}

.nav-card span {
  color: var(--muted);
  font-size: 0.88rem;
}

.nav-card:hover {
  transform: translateY(-1px);
  border-color: rgba(253, 186, 116, 0.28);
  background: rgba(15, 23, 42, 0.86);
}

.nav-card-primary {
  border-color: rgba(253, 186, 116, 0.28);
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.18), rgba(15, 23, 42, 0.78));
}

.loader-inline {
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 2px;
  color: var(--muted);
}

.product-stage {
  position: relative;
}

.content-loader {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(180deg, rgba(7, 11, 21, 0.24), rgba(7, 11, 21, 0.88));
  backdrop-filter: blur(8px);
  z-index: 50;
}

.content-loader-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.88);
  box-shadow: var(--shadow);
  width: min(100%, 420px);
}

.content-loader-card strong {
  display: block;
  margin-bottom: 4px;
}

.content-loader-card p {
  margin: 0;
  color: var(--muted);
}

.spinner {
  inline-size: 18px;
  block-size: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-top-color: #fdba74;
  animation: spin 0.85s linear infinite;
  flex: 0 0 auto;
}

.spinner-lg {
  inline-size: 28px;
  block-size: 28px;
  border-width: 3px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes progress-pulse {
  from {
    transform: scaleX(0.96);
    filter: brightness(0.98);
  }
  to {
    transform: scaleX(1);
    filter: brightness(1.12);
  }
}

@keyframes progress-shimmer {
  0% {
    transform: translateX(-40%);
  }
  100% {
    transform: translateX(40%);
  }
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.toggle input {
  inline-size: 18px;
  block-size: 18px;
  margin: 0;
}

.secondary-btn {
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.secondary-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(253, 186, 116, 0.42);
}

.primary-btn {
  cursor: pointer;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.92), rgba(245, 158, 11, 0.82));
  border-color: rgba(253, 186, 116, 0.38);
  font-weight: 700;
}

.primary-btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.status-banner,
.summary-bar,
.empty-state,
.pagination-toolbar {
  padding: 16px 18px;
  margin-bottom: 16px;
}

.status-banner {
  color: #dbeafe;
}

.status-banner.info {
  border-left: 4px solid #60a5fa;
}

.status-banner.success {
  border-left: 4px solid var(--accent-2);
}

.status-banner.error {
  border-left: 4px solid var(--danger);
}

.summary-bar {
  color: var(--muted);
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(253, 186, 116, 0.18);
  background: rgba(15, 23, 42, 0.65);
  color: #fde68a;
  font-size: 0.88rem;
}

.summary-bar strong {
  color: var(--text);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.section-heading h2 {
  margin: 0;
}

.s3-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.s3-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 0.8fr 0.8fr;
  gap: 12px;
  margin-top: 16px;
}

.s3-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

.s3-actions-inline {
  display: flex;
  gap: 8px;
}

.s3-jobs-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.s3-job-card {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  padding: 14px;
  background: rgba(15, 23, 42, 0.64);
}

.s3-job-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.s3-job-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.job-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.job-running { background: rgba(34, 197, 94, 0.16); color: #bbf7d0; }
.job-queued { background: rgba(59, 130, 246, 0.16); color: #bfdbfe; }
.job-cancel_requested, .job-cancelled { background: rgba(251, 191, 36, 0.16); color: #fde68a; }
.job-interrupted { background: rgba(251, 146, 60, 0.18); color: #fdba74; }
.job-completed { background: rgba(52, 211, 153, 0.16); color: #bbf7d0; }
.job-failed { background: rgba(244, 114, 182, 0.16); color: #f9a8d4; }

.s3-job-empty {
  color: var(--muted);
  padding: 10px 0;
}

.pagination-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  position: sticky;
  top: 14px;
  z-index: 20;
  background: rgba(10, 15, 28, 0.92);
}

.field-group-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.field-group-inline label {
  white-space: nowrap;
}

.pagination-meta {
  color: var(--muted);
}

.pagination-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#pageIndicator {
  color: var(--text);
  font-weight: 700;
}

.product-grid {
  display: grid;
  gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  align-items: start;
}

.product-card {
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.98), rgba(10, 15, 28, 0.98));
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 100%;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.product-card:hover {
  transform: translateY(-4px);
  border-color: rgba(253, 186, 116, 0.28);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.48);
}

.product-media-wrap {
  position: relative;
  aspect-ratio: 4 / 3;
  min-height: 220px;
  background:
    linear-gradient(135deg, rgba(249, 115, 22, 0.22), rgba(15, 23, 42, 0.86));
  overflow: hidden;
}

.product-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.carousel-btn,
.carousel-counter {
  position: absolute;
  z-index: 2;
}

.carousel-btn {
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.78);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.carousel-btn:hover {
  background: rgba(30, 41, 59, 0.95);
}

.carousel-btn-prev {
  left: 10px;
}

.carousel-btn-next {
  right: 10px;
}

.carousel-counter {
  left: 12px;
  bottom: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  font-size: 12px;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.image-fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  color: rgba(255, 255, 255, 0.75);
}

.product-media-wrap.no-image .image-fallback {
  display: flex;
}

.product-media-wrap.no-image .product-media {
  display: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.badge-source {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(15, 23, 42, 0.82);
  z-index: 2;
}

.badge-category {
  color: #ffd7a8;
  background: rgba(255, 255, 255, 0.03);
}

.product-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-topline {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}

.product-price {
  font-weight: 700;
  font-size: 1rem;
  color: #fdba74;
}

.product-title {
  margin: 0;
  font-size: 1.03rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-identity {
  margin: -4px 0 0;
  color: #fdba74;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: "SFMono-Regular", "Consolas", "Liberation Mono", monospace;
}

.product-description {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.95rem;
  min-height: 4.5em;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-sync-strip {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) repeat(2, minmax(70px, 92px));
  gap: 10px;
  align-items: stretch;
}

.sync-pill,
.sync-kpi {
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(15, 23, 42, 0.62);
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.sync-pill.is-full {
  color: #d1fae5;
  border-color: rgba(16, 185, 129, 0.24);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.22), rgba(34, 197, 94, 0.12));
}

.sync-pill.is-partial {
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.24);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(249, 115, 22, 0.1));
}

.sync-pill.is-source {
  color: #bfdbfe;
  border-color: rgba(59, 130, 246, 0.22);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.18), rgba(14, 165, 233, 0.1));
}

.sync-pill.is-empty {
  color: #cbd5e1;
  opacity: 0.78;
}

.sync-kpi {
  padding: 8px 10px;
  text-align: center;
}

.sync-kpi span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 4px;
}

.sync-kpi strong {
  display: block;
  font-size: 1rem;
}

.product-meta {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(88px, 120px) 1fr;
  gap: 6px 10px;
  font-size: 0.82rem;
}

.product-meta dt {
  color: var(--muted);
}

.product-meta dd {
  margin: 0;
  color: var(--text);
  overflow-wrap: anywhere;
}

.product-actions {
  margin-top: auto;
  padding-top: 6px;
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.product-inspect-btn,
.product-source-link {
  border-radius: 12px;
  border: 1px solid rgba(253, 186, 116, 0.2);
  color: white;
  transition: transform 120ms ease, filter 120ms ease, border-color 120ms ease, background 120ms ease;
}

.product-inspect-btn {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  font-weight: 700;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.24), rgba(34, 197, 94, 0.14));
}

.product-source-link {
  flex: 0 0 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: rgba(15, 23, 42, 0.92);
  font-size: 1.1rem;
}

.product-inspect-btn:hover,
.product-source-link:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.product-source-link.disabled,
.product-source-link[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
}

.product-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 70;
}

.product-modal-backdrop.is-open {
  display: flex;
}

.product-modal {
  width: min(1320px, 100%);
  height: min(88vh, 980px);
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.98));
  border: 1px solid rgba(196, 181, 253, 0.18);
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

.product-modal-sidebar,
.product-modal-main {
  min-width: 0;
  min-height: 0;
  padding: 22px;
}

.product-modal-sidebar {
  display: grid;
  align-content: start;
  gap: 16px;
  border-right: 1px solid rgba(148, 163, 184, 0.12);
  overflow: auto;
}

.product-modal-main {
  overflow: auto;
}

.product-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.product-modal-head h2 {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.1;
}

.product-modal-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.product-modal-meta {
  display: grid;
  gap: 10px;
}

.product-modal-meta-card {
  padding: 14px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.product-modal-meta-card span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.product-modal-meta-card strong {
  display: block;
  font-size: 0.95rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.product-modal-sync {
  display: grid;
  gap: 12px;
}

.product-modal-sync-panel {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(15, 23, 42, 0.68);
  display: grid;
  gap: 12px;
}

.product-modal-sync-panel.is-full {
  border-color: rgba(16, 185, 129, 0.24);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.12), rgba(15, 23, 42, 0.82));
}

.product-modal-sync-panel.is-partial {
  border-color: rgba(245, 158, 11, 0.24);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.12), rgba(15, 23, 42, 0.82));
}

.product-modal-sync-panel.is-source {
  border-color: rgba(59, 130, 246, 0.22);
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.12), rgba(15, 23, 42, 0.82));
}

.product-modal-sync-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.product-modal-sync-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.product-modal-sync-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.product-modal-status {
  padding: 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.14), rgba(59, 130, 246, 0.12));
  border: 1px solid rgba(148, 163, 184, 0.12);
  color: var(--muted);
  line-height: 1.6;
}

.product-modal-json-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.product-json-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.product-json-head {
  display: grid;
  gap: 4px;
}

.product-json-head .eyebrow {
  margin-bottom: 0;
}

.product-json-content {
  margin: 0;
  min-height: 100%;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(15, 23, 42, 0.78);
  color: #dbeafe;
  box-shadow: var(--shadow);
  font-family: "SFMono-Regular", "Consolas", "Liberation Mono", monospace;
  font-size: 0.8rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
  max-height: min(72vh, 820px);
}

.hidden {
  display: none !important;
}

.intro-note,
.empty-state {
  text-align: center;
}

.intro-note {
  margin-bottom: 16px;
  color: var(--muted);
}

.intro-note p {
  margin: 0;
}

.empty-state h2 {
  margin: 0 0 8px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .controls-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-nav-links {
    grid-template-columns: 1fr;
    min-width: min(100%, 360px);
  }

  .product-modal {
    grid-template-columns: 1fr;
    height: min(92vh, 1100px);
  }

  .product-modal-sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  }

  .product-modal-json-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  body {
    padding: 18px 12px 40px;
  }

  .hero,
  .controls-panel,
  .status-banner,
  .summary-bar,
  .empty-state,
  .pagination-toolbar,
  .dashboard-nav {
    border-radius: 18px;
  }

  .controls-panel {
    grid-template-columns: 1fr;
  }

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

  .product-sync-strip {
    grid-template-columns: 1fr;
  }

  .summary-bar,
  .pagination-toolbar {
    align-items: flex-start;
  }

  .content-loader {
    padding-top: 44px;
  }

  .content-loader-card {
    width: min(100%, 420px);
  }

  .product-actions {
    gap: 8px;
  }

  .product-source-link {
    flex-basis: 42px;
  }

  .product-modal-backdrop {
    padding: 10px;
  }

  .product-modal-sidebar,
  .product-modal-main {
    padding: 16px;
  }

  .product-json-content {
    max-height: none;
    min-height: 320px;
  }
}

/* --- S3 control page styles --- */
.auth-gate {
  max-width: 720px;
  margin: 0 auto 18px;
  padding: 22px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.auth-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.auth-row input {
  flex: 1 1 260px;
}

.s3-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.s3-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 0.8fr 0.8fr;
  gap: 12px;
  margin-top: 16px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-group label {
  font-size: 0.88rem;
  color: var(--muted);
}

.s3-actions,
.s3-actions-inline {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.s3-actions {
  margin-top: 14px;
}

.s3-jobs-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.s3-job-card {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  padding: 14px;
  background: rgba(15, 23, 42, 0.64);
  cursor: pointer;
}

.s3-job-card.is-selected {
  border-color: rgba(196, 181, 253, 0.45);
  box-shadow: 0 0 0 1px rgba(196, 181, 253, 0.18) inset;
}

.s3-job-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.s3-job-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.job-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.job-running { background: rgba(34, 197, 94, 0.16); color: #bbf7d0; }
.job-queued { background: rgba(59, 130, 246, 0.16); color: #bfdbfe; }
.job-cancel_requested, .job-cancelled { background: rgba(251, 191, 36, 0.16); color: #fde68a; }
.job-interrupted { background: rgba(251, 146, 60, 0.18); color: #fdba74; }
.job-completed { background: rgba(52, 211, 153, 0.16); color: #bbf7d0; }
.job-failed { background: rgba(244, 114, 182, 0.16); color: #f9a8d4; }

.s3-job-empty { color: var(--muted); padding: 10px 0; }

.s3-job-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 80;
}

.s3-job-modal-backdrop.is-open {
  display: flex;
}

.s3-job-modal {
  width: min(1120px, 100%);
  height: min(88vh, 1000px);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.05fr 1.4fr;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.98));
  border: 1px solid rgba(196, 181, 253, 0.18);
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

.s3-job-modal-sidebar,
.s3-job-modal-main {
  padding: 20px;
  min-height: 0;
  min-width: 0;
}

.s3-job-modal-sidebar {
  border-right: 1px solid rgba(148, 163, 184, 0.12);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.s3-job-modal-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.s3-job-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.s3-job-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.s3-job-kpi {
  padding: 12px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.s3-job-kpi span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.s3-job-kpi strong {
  font-size: 1.1rem;
}

.s3-job-details-page {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.s3-job-progress-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 10px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.78), rgba(10, 15, 28, 0.92));
  box-shadow: var(--shadow);
}

.s3-job-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.s3-job-progress-hero {
  min-width: min(100%, 280px);
  display: grid;
  gap: 8px;
}

.s3-job-progress-meter {
  position: relative;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.s3-job-progress-meter-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.95), rgba(56, 189, 248, 0.95), rgba(244, 114, 182, 0.88));
  box-shadow: 0 0 18px rgba(244, 114, 182, 0.22);
}

.s3-job-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.86rem;
}

.s3-job-progress-track {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  gap: 10px;
}

.s3-job-progress-item {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(15, 23, 42, 0.68);
  overflow: hidden;
}

.s3-job-progress-item.is-running {
  border-color: rgba(96, 165, 250, 0.28);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.72), rgba(14, 20, 35, 0.96));
}

.s3-job-progress-item.is-pending {
  border-style: dashed;
  opacity: 0.92;
}

.s3-job-progress-panel.is-loading .s3-job-progress-item,
.s3-job-progress-item.is-pending {
  position: relative;
}

.s3-job-progress-panel.is-loading .s3-job-progress-item::after,
.s3-job-progress-item.is-pending::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.03) 50%, transparent 100%);
  animation: progress-shimmer 1.7s linear infinite;
}

.s3-job-progress-item-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.s3-job-progress-index {
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  color: #cbd5e1;
}

.s3-job-progress-title {
  font-size: 0.94rem;
  line-height: 1.35;
}

.s3-job-progress-subtitle,
.s3-job-progress-footer {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.s3-job-progress-bar {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.12);
}

.s3-job-progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.9), rgba(59, 130, 246, 0.9));
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.16);
}

.s3-job-progress-item.is-running .s3-job-progress-bar span {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.9), rgba(244, 114, 182, 0.85));
  animation: progress-pulse 1.2s ease-in-out infinite alternate;
}

.s3-job-progress-item.is-pending .s3-job-progress-bar span {
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.38), rgba(148, 163, 184, 0.56));
}

.s3-job-progress-item.is-success .s3-job-progress-bar span {
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.95), rgba(59, 130, 246, 0.86));
}

.s3-job-progress-item.is-warning .s3-job-progress-bar span {
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.95), rgba(245, 158, 11, 0.9));
}

.s3-job-progress-item.is-error .s3-job-progress-bar span {
  background: linear-gradient(90deg, rgba(244, 114, 182, 0.95), rgba(251, 146, 60, 0.9));
}

.s3-job-details-list {
  display: grid;
  gap: 12px;
  overflow: visible;
}

.s3-job-item {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(15, 23, 42, 0.68);
}

.s3-job-item.is-success {
  border-color: rgba(34, 197, 94, 0.18);
}

.s3-job-item.is-warning {
  border-color: rgba(251, 191, 36, 0.22);
  background: linear-gradient(180deg, rgba(36, 26, 9, 0.72), rgba(15, 23, 42, 0.68));
}

.s3-job-item.is-error {
  border-color: rgba(244, 114, 182, 0.34);
  background: linear-gradient(180deg, rgba(76, 10, 50, 0.84), rgba(15, 23, 42, 0.7));
  box-shadow: 0 0 0 1px rgba(244, 114, 182, 0.12) inset;
}

.s3-job-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.s3-job-item-title {
  font-weight: 700;
}

.s3-job-item-meta {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.s3-job-item-progress {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.s3-job-item-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.95), rgba(59, 130, 246, 0.9));
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.16);
}

.s3-job-item-progress.is-error span {
  background: linear-gradient(90deg, rgba(244, 114, 182, 0.95), rgba(251, 146, 60, 0.9));
}

.s3-job-item-progress.is-warning span {
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.95), rgba(245, 158, 11, 0.9));
}

.s3-job-item-progress.is-success span {
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.95), rgba(59, 130, 246, 0.85));
}

.s3-job-item-progress.is-running span {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.95), rgba(244, 114, 182, 0.85));
  animation: progress-pulse 1.2s ease-in-out infinite alternate;
}

.s3-job-item-progress.is-pending span {
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.3), rgba(148, 163, 184, 0.5));
}

.s3-job-item-alert {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.s3-job-item-alert.is-success {
  background: rgba(34, 197, 94, 0.14);
  color: #bbf7d0;
}

.s3-job-item-alert.is-warning {
  background: rgba(251, 191, 36, 0.14);
  color: #fde68a;
}

.s3-job-item-alert.is-error {
  background: rgba(244, 114, 182, 0.18);
  color: #fbcfe8;
}

.s3-job-item-message {
  margin-top: 10px;
  color: #dbeafe;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.s3-job-item-message.is-warning {
  color: #fde68a;
}

.s3-job-item-message.is-error {
  color: #fbcfe8;
  padding: 10px 12px;
  background: rgba(244, 114, 182, 0.12);
  border: 1px solid rgba(244, 114, 182, 0.18);
  border-radius: 12px;
}

.s3-job-empty-details {
  color: var(--muted);
}

@media (max-width: 1100px) {
  .s3-job-modal {
    grid-template-columns: 1fr;
    height: min(90vh, 1000px);
  }

  .s3-job-modal-sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  }
}

@media (max-width: 720px) {
  .s3-grid {
    grid-template-columns: 1fr;
  }

  .s3-job-kpis {
    grid-template-columns: 1fr;
  }

  .s3-job-item-meta {
    grid-template-columns: 1fr;
  }

  .s3-job-modal {
    height: min(92vh, 1000px);
  }
}
