:root {
  color-scheme: light;
  --ink:         #14110f;
  --page:        #ffffff;
  --surface:     #ffffff;
  --text:        #17130f;
  --text-2:      #5c5650;
  --muted:       #8a8479;
  --grid:        #ececea;
  --border:      #e7e4e0;
  --panel:       #f6f5f3;
  --orange:      #ff4a12;
  --orange-dark: #e5400c;
  --blue:        #2954ff;
  --blue-dark:   #1f42d6;
  --good:        #17a34a;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

.ticker {
  background: var(--ink);
  color: #ffffff;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 9px 12px;
}

.topbar {
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 24px;
}
.logo { height: 40px; width: auto; justify-self: end; }

.search {
  justify-self: center;
  width: min(420px, 46vw);
  position: relative;
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  translate: 0 -50%;
  width: 17px;
  height: 17px;
  color: var(--muted);
  pointer-events: none;
}
.search input {
  width: 100%;
  padding: 11px 16px 11px 40px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
}
.search input::placeholder { color: var(--muted); }
.search input:focus {
  outline: none;
  border-color: var(--blue);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(41, 84, 255, 0.12);
}

.refresh-btn {
  justify-self: start;
  border: none;
  background: var(--blue);
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  border-radius: 10px;
  padding: 11px 22px;
  cursor: pointer;
}
.refresh-btn:hover { background: var(--blue-dark); }
.refresh-btn:disabled { opacity: 0.6; cursor: default; }

.wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

.hero {
  text-align: center;
  padding: 48px 12px 30px;
}
.hero h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 46px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.08;
  color: var(--text);
}
.hero .subtitle {
  margin: 14px 0 0;
  color: var(--text-2);
  font-size: 15px;
}

.error-banner {
  display: none;
  margin-bottom: 14px;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(208,59,59,0.1);
  color: #b3261e;
  font-size: 13px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(20,17,15,0.04);
}

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.status-left { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.status-right { color: var(--text-2); }
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--good);
  flex: none;
}
.dot.stale { background: #f0a70a; }
.dot.error { background: #d03b3b; }

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
}
thead th {
  text-align: left;
  font-size: 14px;
  color: #ffffff;
  font-weight: 700;
  background: var(--orange);
  padding: 13px 20px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
thead th:hover { background: var(--orange-dark); }
thead th .arrow { margin-left: 4px; opacity: 0.85; }
thead th.col-rank { cursor: default; text-align: center; width: 84px; }
.label-short { display: none; }

tbody tr { border-bottom: 1px solid var(--grid); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #fff6f2; }
td { padding: 14px 20px; vertical-align: middle; }

.col-rank { text-align: center; width: 84px; }
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--panel);
  color: var(--text-2);
  font-weight: 800;
  font-size: 14px;
}
.rank-badge.top { background: var(--orange); color: #ffffff; }
.top-label {
  margin-top: 2px;
  font-size: 11px;
  font-weight: 700;
  color: var(--orange);
}

td.col-name { font-weight: 700; color: var(--text); font-size: 15px; }

td.col-rfqs { font-variant-numeric: tabular-nums; font-size: 15px; color: var(--text); }

.col-value { min-width: 180px; }
.value-cell { display: flex; flex-direction: column; gap: 6px; }
.value-num {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}
.value-bar-track {
  height: 6px;
  border-radius: 4px;
  background: var(--grid);
  overflow: hidden;
}
.value-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--orange);
}

.empty {
  padding: 40px 14px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 640px) {
  .topbar-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    row-gap: 12px;
  }
  .logo { justify-self: initial; }
  .refresh-btn { justify-self: initial; }
  .search { order: 3; width: 100%; }

  table { table-layout: fixed; min-width: 0; }
  thead th, td { padding: 10px 8px; }
  .label-full { display: none; }
  .label-short { display: inline; }

  thead th.col-rank, td.col-rank { width: 26px; padding-right: 2px; }
  thead th.col-name, td.col-name { width: 120px; }
  thead th.col-rfqs, td.col-rfqs { width: 52px; }
  thead th.col-value, td.col-value { min-width: 0; }

  .rank-badge {
    width: auto;
    height: auto;
    border-radius: 0;
    background: none;
    padding: 0;
    font-size: 14px;
  }
  .rank-badge.top { background: none; color: var(--orange); }

  td.col-name { font-size: 13.5px; }
  td.col-rfqs { font-size: 13.5px; }
  .value-num { font-size: 13.5px; }
  .top-label { font-size: 10px; }
}
