:root {
  color-scheme: light;
  --ink: #10233b;
  --muted: #66798d;
  --line: #dce5ec;
  --paper: #ffffff;
  --wash: #f3f7fa;
  --blue: #1568dc;
  --blue-dark: #0d4faa;
  --teal: #16836f;
  --teal-soft: #e7f6f1;
  --yellow: #ffd84d;
  --shadow: 0 18px 50px rgba(16, 35, 59, 0.1);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--wash);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% -10%, rgba(21, 104, 220, 0.12), transparent 34rem),
    linear-gradient(180deg, #f9fbfd 0, var(--wash) 32rem);
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  z-index: 1000;
  top: 0;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(220px, 1fr);
  gap: 22px;
  align-items: center;
  min-height: 74px;
  padding: 12px clamp(18px, 4vw, 58px);
  border-bottom: 1px solid rgba(190, 204, 217, 0.8);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
}

.back-link {
  justify-self: start;
  color: var(--blue-dark);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.archive-label {
  color: #65778b;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
}

.bid-switcher {
  justify-self: end;
  width: min(100%, 330px);
  min-height: 42px;
  padding: 0 38px 0 14px;
  border: 1px solid #cbd7e1;
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
  font-weight: 750;
}

.page-shell {
  width: min(1460px, calc(100% - 36px));
  margin: 0 auto;
  padding: 36px 0 68px;
}

.loading-state,
.error-state {
  display: grid;
  min-height: 60vh;
  place-items: center;
  text-align: center;
}

.loading-card,
.error-card {
  width: min(520px, 100%);
  padding: 42px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.loader {
  width: 46px;
  height: 46px;
  margin: 0 auto 18px;
  border: 5px solid #dce9f6;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.dashboard[hidden],
.error-state[hidden],
.loading-state[hidden] {
  display: none;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) auto;
  gap: 30px;
  align-items: center;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.bid-logo-card {
  display: grid;
  width: 180px;
  height: 124px;
  place-items: center;
  overflow: hidden;
  padding: 14px;
  border: 1px solid #dce4eb;
  border-radius: 20px;
  background: var(--logo-background, #fff);
}

.bid-logo-card img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.bid-logo-card.is-inverted img {
  filter: invert(1);
}

.bid-logo-fallback {
  color: var(--blue-dark);
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.dashboard-hero h1 {
  max-width: 950px;
  margin: 0;
  font-size: clamp(30px, 4vw, 58px);
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.hero-meta {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.archive-period {
  min-width: 190px;
  padding: 18px;
  border-radius: 18px;
  background: #edf5ff;
  color: var(--blue-dark);
  text-align: right;
}

.archive-period strong,
.archive-period span {
  display: block;
}

.archive-period strong {
  margin-bottom: 5px;
  font-size: 18px;
}

.archive-period span {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.summary-card {
  min-height: 142px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--paper);
}

.summary-card .label {
  display: block;
  margin-bottom: 12px;
  color: #708195;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.summary-card strong {
  display: block;
  font-size: clamp(25px, 2.4vw, 38px);
  line-height: 1;
  letter-spacing: -0.04em;
}

.summary-card small {
  display: block;
  margin-top: 9px;
  color: var(--muted);
  line-height: 1.35;
}

.filter-panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
}

.filter-panel-header,
.section-heading {
  display: flex;
  gap: 18px;
  align-items: end;
  justify-content: space-between;
}

.filter-panel h2,
.section-heading h2,
.analysis-card h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.025em;
}

.filter-count,
.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(130px, 0.7fr)) minmax(210px, 1.3fr) minmax(160px, 0.8fr) minmax(210px, 1.2fr) auto;
  gap: 12px;
  margin-top: 18px;
}

.filter-field {
  display: grid;
  gap: 7px;
}

.filter-field label {
  color: #6a7c90;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.filter-field input,
.filter-field select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #cbd8e2;
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
}

.reset-button,
.load-more-button {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: var(--blue);
  font-weight: 850;
  cursor: pointer;
}

.reset-button {
  align-self: end;
}

.reset-button:hover,
.load-more-button:hover {
  background: var(--blue-dark);
}

.analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.8fr);
  gap: 20px;
  margin-top: 20px;
}

.analysis-card,
.map-card,
.records-card,
.archive-note {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
}

.analysis-card {
  min-width: 0;
  padding: 22px;
}

.trend-canvas-wrap {
  position: relative;
  height: 310px;
  margin-top: 18px;
}

#trend-canvas {
  width: 100%;
  height: 100%;
}

.category-list {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.category-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px 14px;
  align-items: center;
}

.category-name {
  overflow: hidden;
  font-size: 13px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-value {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.category-track {
  grid-column: 1 / -1;
  height: 7px;
  overflow: hidden;
  border-radius: 10px;
  background: #e9eff4;
}

.category-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), #4ca6f7);
}

.map-card,
.records-card {
  margin-top: 20px;
  overflow: hidden;
}

.map-card .section-heading,
.records-card .section-heading {
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}

#bid-map {
  height: min(60vh, 620px);
  min-height: 440px;
  background: #dce6ec;
}

.map-dot {
  width: 10px;
  height: 10px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 1px 5px rgba(16, 35, 59, 0.4);
}

.request-popup {
  max-width: 260px;
  line-height: 1.4;
}

.request-popup strong,
.request-popup span {
  display: block;
}

.request-popup span {
  margin-top: 4px;
  color: #52677a;
}

.request-popup a {
  display: inline-block;
  margin-top: 9px;
  color: var(--blue-dark);
  font-weight: 800;
}

.records-table-wrap {
  overflow-x: auto;
}

.records-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.records-table th,
.records-table td {
  padding: 15px 18px;
  border-bottom: 1px solid #e4ebf1;
  text-align: left;
  vertical-align: top;
}

.records-table th {
  color: #718195;
  background: #f7fafc;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.records-table td {
  color: #42576b;
  font-size: 13px;
  line-height: 1.4;
}

.records-table td strong {
  color: var(--ink);
}

.sr-link {
  color: var(--blue-dark);
  font-weight: 850;
  text-decoration: none;
}

.sr-link:hover {
  text-decoration: underline;
}

.status-pill {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 999px;
  color: #196c5c;
  background: var(--teal-soft);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.status-pill.is-open {
  color: #855b05;
  background: #fff3ce;
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 20px;
}

.empty-message {
  padding: 42px 20px;
  color: var(--muted);
  text-align: center;
}

.archive-note {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 15px;
  margin-top: 20px;
  padding: 22px;
  color: #52677a;
  font-size: 13px;
  line-height: 1.55;
}

.archive-note strong {
  color: var(--ink);
}

.note-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  color: var(--blue-dark);
  background: #e8f2ff;
  font-weight: 900;
}

@media (max-width: 1100px) {
  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

@media (max-width: 760px) {
  .topbar {
    position: relative;
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 12px 16px;
  }

  .archive-label {
    display: none;
  }

  .bid-switcher {
    width: 48px;
    color: transparent;
  }

  .page-shell {
    width: min(100% - 22px, 1460px);
    padding-top: 16px;
  }

  .dashboard-hero {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 16px;
    padding: 18px;
    border-radius: 23px;
  }

  .bid-logo-card {
    width: 96px;
    height: 86px;
    padding: 9px;
    border-radius: 15px;
  }

  .dashboard-hero h1 {
    font-size: clamp(28px, 8.4vw, 44px);
  }

  .archive-period {
    grid-column: 1 / -1;
    min-width: 0;
    text-align: left;
  }

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

  .summary-card {
    min-height: 126px;
    padding: 16px;
  }

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

  .filter-field.is-wide,
  .reset-button {
    grid-column: 1 / -1;
  }

  .filter-panel-header,
  .section-heading {
    align-items: start;
    flex-direction: column;
    gap: 5px;
  }

  .trend-canvas-wrap {
    height: 250px;
  }

  #bid-map {
    height: 58vh;
    min-height: 390px;
  }

  .records-table,
  .records-table tbody,
  .records-table tr,
  .records-table td {
    display: block;
    width: 100%;
  }

  .records-table thead {
    display: none;
  }

  .records-table tr {
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
  }

  .records-table td {
    padding: 3px 0;
    border: 0;
  }

  .records-table td::before {
    margin-right: 7px;
    color: #8090a0;
    content: attr(data-label) ":";
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
}

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

  .summary-card {
    min-height: 0;
  }

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

  .filter-field.is-wide,
  .reset-button {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .loader {
    animation-duration: 1.8s;
  }
}
