:root {
  --bg: #f3efe7;
  --bg-accent: radial-gradient(circle at top left, rgba(241, 165, 98, 0.35), transparent 32%), radial-gradient(circle at top right, rgba(35, 120, 115, 0.18), transparent 28%), #f3efe7;
  --panel: rgba(255, 252, 246, 0.85);
  --panel-border: rgba(72, 55, 39, 0.12);
  --ink: #2d241d;
  --muted: #786b5f;
  --teal: #1e6d68;
  --teal-soft: #d7efed;
  --amber: #c47a34;
  --amber-soft: #f8e0c5;
  --green: #2f7d50;
  --green-soft: #dcefe3;
  --rose: #a64c48;
  --rose-soft: #f6d9d7;
  --slate: #596069;
  --slate-soft: #dde2e8;
  --shadow: 0 20px 40px rgba(74, 55, 32, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg-accent);
}

.page-shell {
  width: min(1400px, calc(100% - 32px));
  margin: 24px auto 48px;
}

.hero,
.panel,
.stat-card {
  backdrop-filter: blur(16px);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
}

.hero {
  border-radius: 28px;
  padding: 28px;
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 24px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 800;
  color: var(--teal);
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: clamp(30px, 4vw, 54px);
  line-height: 1.02;
  max-width: 11ch;
}

h2 {
  font-size: 24px;
}

.hero-copy,
.sync-note,
.table-meta,
.sync-status,
.quick-filter-note {
  color: var(--muted);
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.primary-button,
.secondary-button,
.ghost-button,
.pagination button {
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
}

.primary-button {
  padding: 16px 22px;
  background: linear-gradient(135deg, #1d6b66, #285f8f);
  color: #fff;
  font-weight: 700;
}

.secondary-button,
.ghost-button {
  padding: 14px 18px;
  font-weight: 700;
}

.secondary-button {
  background: linear-gradient(135deg, #9e413d, #c47a34);
  color: #fff;
}

.ghost-button {
  background: rgba(41, 98, 94, 0.12);
  color: var(--teal);
}

.primary-button:disabled,
.secondary-button:disabled,
.ghost-button:disabled,
.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  border-radius: 24px;
  padding: 18px;
  min-height: 124px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.stat-card strong {
  font-size: 34px;
  line-height: 1;
}

.stat-ink { background: linear-gradient(180deg, rgba(255,252,246,0.92), rgba(241,232,220,0.92)); }
.stat-teal { background: linear-gradient(180deg, rgba(215,239,237,0.95), rgba(198,229,226,0.92)); }
.stat-amber { background: linear-gradient(180deg, rgba(248,224,197,0.95), rgba(244,212,177,0.92)); }
.stat-green { background: linear-gradient(180deg, rgba(220,239,227,0.95), rgba(205,232,214,0.92)); }
.stat-rose { background: linear-gradient(180deg, rgba(246,217,215,0.95), rgba(240,198,195,0.92)); }
.stat-slate { background: linear-gradient(180deg, rgba(221,226,232,0.95), rgba(208,214,222,0.92)); }

.panel {
  border-radius: 28px;
  padding: 24px;
  margin-bottom: 20px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.filter-heading {
  align-items: end;
}

.filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-layout {
  align-items: end;
  margin-bottom: 18px;
}

.filter-field {
  min-width: 240px;
  flex: 1 1 240px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-field-compact {
  flex: 0 0 220px;
}

.filter-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.quick-filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: -4px 0 18px;
}

.filter-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.quick-filter-button {
  border: 1px solid rgba(72, 55, 39, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
  padding: 12px 16px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.quick-filter-button.is-active {
  background: linear-gradient(135deg, #9e413d, #c47a34);
  border-color: transparent;
  color: #fff;
}

.filters input,
.filters select {
  min-width: 240px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(72, 55, 39, 0.12);
  background: rgba(255, 255, 255, 0.68);
  font: inherit;
  color: var(--ink);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-idle { background: var(--slate-soft); color: var(--slate); }
.status-running { background: var(--amber-soft); color: var(--amber); }
.status-matched { background: var(--green-soft); color: var(--green); }
.status-no_match { background: var(--rose-soft); color: var(--rose); }
.status-no_candidate { background: var(--slate-soft); color: var(--slate); }
.status-error { background: #3d2321; color: #fff; }

.table-wrap {
  overflow: auto;
  border-radius: 22px;
  border: 1px solid rgba(72, 55, 39, 0.08);
  background: rgba(255, 255, 255, 0.58);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1120px;
}

thead th {
  padding: 16px;
  text-align: left;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid rgba(72, 55, 39, 0.08);
}

tbody td {
  padding: 16px;
  vertical-align: top;
  border-bottom: 1px solid rgba(72, 55, 39, 0.06);
}

tbody tr:hover {
  background: rgba(255, 248, 240, 0.74);
}

.product-cell,
.code-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.product-cell strong {
  font-size: 14px;
  line-height: 1.45;
}

.product-cell span,
.code-stack span {
  color: var(--muted);
  font-size: 12px;
}

.code-cell {
  font-family: "IBM Plex Mono", "Cascadia Code", monospace;
  font-size: 13px;
}

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

.loading-cell {
  text-align: center;
  color: var(--muted);
  padding: 28px;
}

.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-top: 18px;
}

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

.pagination button {
  padding: 12px 16px;
  background: rgba(41, 98, 94, 0.12);
  color: var(--teal);
  font-weight: 700;
}

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

  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 16px, 100%);
    margin: 16px auto 32px;
  }

  .hero,
  .panel {
    border-radius: 22px;
    padding: 18px;
  }

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

  .filters,
  .filter-actions,
  .table-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .filters input,
  .filters select,
  .quick-filter-button,
  .secondary-button,
  .ghost-button {
    width: 100%;
    min-width: 0;
  }

  .filter-field,
  .filter-field-compact {
    flex-basis: 100%;
  }
}
