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

:root {
  --navy:   #1a2e44;
  --teal:   #0d9488;
  --green:  #16a34a;
  --amber:  #d97706;
  --bg:     #f1f5f9;
  --card:   #ffffff;
  --border: #e2e8f0;
  --text:   #1e293b;
  --muted:  #64748b;
  --chip-bg: #e0f2fe;
  --chip-text: #0369a1;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Header ─────────────────────────────────────────────── */
header {
  background: var(--navy);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  height: 56px;
  gap: 0.75rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
  text-decoration: none;
}
.logo-icon {
  width: 28px; height: 28px;
  background: var(--teal);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
}
.logo-text {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.logo-sub {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-left: 0.5rem;
  font-weight: 400;
}

/* ── Filter bar ─────────────────────────────────────────── */
.filter-bar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.trade-pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pill {
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.pill:hover { border-color: var(--teal); color: var(--teal); }
.pill.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.filter-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
  min-width: 180px;
}
.filter-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.filter-group select, .filter-group input {
  padding: 0.5rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  background: var(--bg);
  color: var(--text);
  width: 100%;
}
.filter-group select:focus, .filter-group input:focus {
  outline: none;
  border-color: var(--teal);
}

.date-tabs {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
}
.date-tab {
  padding: 0.5rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 500;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.date-tab:not(:last-child) { border-right: 1.5px solid var(--border); }
.date-tab.active { background: var(--navy); color: #fff; }

.btn-search {
  padding: 0.55rem 1.5rem;
  background: var(--teal);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
  align-self: flex-end;
}
.btn-search:hover { background: #0b7a70; }
.btn-search:disabled { background: #94a3b8; cursor: default; }

/* ── Results ─────────────────────────────────────────────── */
.results-wrapper {
  max-width: 900px;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.results-count {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}
.results-count span { color: var(--text); }

.card-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ── Lead card ───────────────────────────────────────────── */
.lead-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.lead-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.07);
  border-color: #cbd5e1;
}

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

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  flex: 1;
}

.category-badge {
  flex-shrink: 0;
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: #fef3c7;
  color: #92400e;
  white-space: nowrap;
}

.card-ref {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

/* ── Detail rows ─────────────────────────────────────────── */
.card-details {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.detail-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 0.5rem;
  padding: 0.3rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  align-items: baseline;
}
.detail-row:first-child { border-top: none; }

.detail-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding-top: 0.05rem;
}

.detail-value {
  color: var(--text);
  line-height: 1.4;
}

.detail-section-heading {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--teal);
  padding: 0.6rem 0 0.15rem;
  border-top: 1px solid var(--border);
  margin-top: 0.1rem;
}

.detail-link {
  color: var(--teal);
  text-decoration: none;
  font-weight: 500;
}
.detail-link:hover { text-decoration: underline; }

.detail-contact {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.detail-contact-name {
  font-weight: 600;
  color: var(--text);
}

.val-teal  { color: var(--teal);  font-weight: 500; }
.val-amber { color: var(--amber); font-weight: 600; }
.val-muted { color: var(--muted); font-style: italic; }

/* ── Materials chips ─────────────────────────────────────── */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--chip-bg);
  color: var(--chip-text);
}

.detail-row--chips { align-items: flex-start; }

/* ── Empty / loading states ──────────────────────────────── */
.state-box {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}
.state-box p { margin-top: 0.5rem; font-size: 0.9rem; }
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 0.75rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 600px) {
  .filter-row { flex-direction: column; }
  .btn-search { width: 100%; }
  .logo-sub { display: none; }
}
