:root {
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-2: #eef4f1;
  --ink: #1f2b2a;
  --muted: #64736e;
  --line: #d9e2dc;
  --green: #16745f;
  --green-dark: #0d4f43;
  --blue: #2f66b1;
  --amber: #aa6b16;
  --red: #ab3b3b;
  --teal-soft: #dcefeb;
  --blue-soft: #dfeaf8;
  --amber-soft: #f5ead8;
  --radius: 8px;
  --shadow: 0 16px 36px rgba(20, 39, 35, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #182a29;
  color: #f2fbf8;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand-block {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: center;
}

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

.brand-block span:not(.brand-mark) {
  color: #afc7c1;
  font-size: 0.84rem;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: var(--radius);
  background: #f2fbf8;
  color: #182a29;
  font-weight: 800;
}

.nav-stack {
  display: grid;
  gap: 8px;
}

.nav-button {
  width: 100%;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: #dcefeb;
  background: transparent;
  padding: 11px 12px;
  text-align: left;
}

.nav-button:hover,
.nav-button.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.16);
}

.side-panel {
  margin-top: auto;
  padding: 16px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.side-metric {
  padding: 14px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.side-metric:first-of-type {
  border-top: 0;
}

.side-metric strong {
  display: block;
  font-size: 1.7rem;
  line-height: 1;
}

.side-metric span {
  color: #b8d1ca;
  font-size: 0.82rem;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

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

.topbar h1,
.section-heading h2,
.dialog-panel h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(1.7rem, 2.2vw, 2.4rem);
  max-width: 850px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.primary-button,
.secondary-button {
  border-radius: var(--radius);
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid transparent;
  font-weight: 700;
}

.primary-button {
  background: var(--green);
  color: white;
}

.primary-button:hover {
  background: var(--green-dark);
}

.secondary-button {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

.secondary-button:hover {
  border-color: #b8c8c0;
}

.stretch {
  width: 100%;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar .eyebrow {
  color: #9ad7c7;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.metric-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.metric-tile span,
.metric-tile small {
  display: block;
  color: var(--muted);
}

.metric-tile strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 1.75rem;
}

.tab-panel {
  display: none;
}

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

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-heading h2 {
  font-size: 1.3rem;
}

.compact-copy {
  max-width: 520px;
  color: var(--muted);
  font-size: 0.92rem;
  text-align: right;
}

.filters-bar {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 11px;
  background: #fbfdfc;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.market-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
  gap: 14px;
  align-items: start;
}

.listing-column,
.rfq-list,
.supplier-grid,
.verification-grid {
  display: grid;
  gap: 12px;
}

.product-row,
.rfq-row,
.supplier-panel,
.verification-panel,
.detail-panel,
.rfq-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.product-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 14px;
  padding: 12px;
  text-align: left;
  color: inherit;
}

.product-row:hover,
.product-row.selected {
  border-color: var(--green);
}

.product-image {
  min-height: 120px;
  border-radius: 6px;
  background-size: 18px 18px, 100% 100%;
  background-position: 0 0, center;
  border: 1px solid var(--line);
}

.product-main {
  min-width: 0;
}

.product-title-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.product-title-line h3,
.rfq-row h3,
.supplier-panel h3,
.verification-panel h3,
.rfq-form h3 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0;
}

.product-title-line span {
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  background: var(--surface-2);
  color: #34504b;
  padding: 0 9px;
  font-size: 0.76rem;
  font-weight: 800;
}

.pill.green {
  background: var(--teal-soft);
  color: var(--green-dark);
}

.pill.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.pill.amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.spec-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.spec-box {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: #fbfdfc;
}

.spec-box span {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.spec-box strong {
  display: block;
  margin-top: 3px;
  font-size: 0.86rem;
}

.detail-panel {
  position: sticky;
  top: 20px;
  padding: 16px;
}

.detail-hero {
  height: 190px;
  background-size: 22px 22px, 100% 100%;
  background-position: 0 0, center;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  margin-bottom: 14px;
}

.visual-natural-pellet {
  background-image:
    radial-gradient(circle at 6px 6px, rgba(255, 255, 255, 0.9) 0 4px, transparent 5px),
    linear-gradient(135deg, #e9dfca, #fbf8ec 45%, #c9d6d0);
}

.visual-black-regrind {
  background-image:
    radial-gradient(circle at 5px 5px, rgba(255, 255, 255, 0.08) 0 4px, transparent 5px),
    linear-gradient(135deg, #1d2224, #3a4142 52%, #111516);
}

.visual-translucent-pellet {
  background-image:
    radial-gradient(circle at 7px 7px, rgba(255, 255, 255, 0.72) 0 4px, transparent 5px),
    linear-gradient(135deg, #e4eff1, #b9d4dc 45%, #f7fbfa);
}

.visual-clear-flake {
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, 0.72) 25%, transparent 25% 50%, rgba(255, 255, 255, 0.48) 50% 75%, transparent 75%),
    linear-gradient(135deg, #dcebf0, #a5d0df 55%, #f8fbfc);
}

.visual-white-powder {
  background-image:
    radial-gradient(circle at 4px 4px, rgba(135, 150, 145, 0.22) 0 2px, transparent 3px),
    linear-gradient(135deg, #ffffff, #eef1ed 55%, #d7ddd6);
}

.visual-black-compound {
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, 0.07) 25%, transparent 25% 50%, rgba(255, 255, 255, 0.05) 50% 75%, transparent 75%),
    linear-gradient(135deg, #181c20, #252b32 50%, #0b0f12);
}

.detail-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.detail-header h3 {
  margin: 0;
  font-size: 1.2rem;
}

.detail-section {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 12px;
}

.detail-section h4 {
  margin: 0 0 8px;
  font-size: 0.9rem;
}

.detail-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.detail-list li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 0.88rem;
}

.detail-list strong {
  color: var(--ink);
  text-align: right;
}

.document-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.document-chip {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 9px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  background: #fbfdfc;
}

.rfq-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1.2fr);
  gap: 14px;
  align-items: start;
}

.rfq-form,
.rfq-row,
.supplier-panel,
.verification-panel {
  padding: 16px;
}

.rfq-form {
  display: grid;
  gap: 12px;
}

.rfq-row {
  display: grid;
  gap: 10px;
}

.rfq-topline,
.supplier-topline,
.verification-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.rfq-meta,
.supplier-meta,
.verification-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rfq-summary,
.supplier-summary,
.verification-summary {
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

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

.supplier-panel {
  display: grid;
  gap: 12px;
}

.supplier-score {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.supplier-score div {
  background: #fbfdfc;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
}

.supplier-score span {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
}

.supplier-score strong {
  display: block;
  margin-top: 4px;
}

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

.verification-panel {
  display: grid;
  gap: 12px;
}

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: #e5ede9;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--blue));
}

.dialog-panel {
  width: min(720px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.dialog-panel::backdrop {
  background: rgba(12, 28, 26, 0.45);
}

.dialog-close {
  float: right;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  padding: 8px 10px;
}

.spec-guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.spec-guide-grid section {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.spec-guide-grid h3 {
  margin: 0 0 8px;
}

.spec-guide-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .nav-stack {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .side-panel {
    display: none;
  }

  .market-layout,
  .rfq-layout {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }

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

@media (max-width: 760px) {
  .workspace,
  .sidebar {
    padding: 18px;
  }

  .topbar,
  .section-heading,
  .rfq-topline,
  .supplier-topline,
  .verification-topline {
    display: grid;
  }

  .compact-copy {
    text-align: left;
  }

  .metrics-grid,
  .filters-bar,
  .spec-strip,
  .supplier-grid,
  .verification-grid,
  .spec-guide-grid {
    grid-template-columns: 1fr;
  }

  .nav-stack {
    grid-template-columns: 1fr 1fr;
  }

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