:root {
  color-scheme: light;
  --bg: #f1f4f7;
  --surface: #ffffff;
  --surface-soft: #f6f8fa;
  --ink: #17212b;
  --muted: #657180;
  --line: #dfe5eb;
  --line-strong: #c7d0d9;
  --navy: #102a43;
  --navy-soft: #e7eef5;
  --blue: #2367a8;
  --blue-soft: #e9f2fb;
  --green: #1f7a50;
  --green-soft: #e7f4ed;
  --amber: #936000;
  --amber-soft: #fff4d7;
  --red: #a13c38;
  --red-soft: #fbecea;
  --shadow: 0 10px 28px rgba(16, 42, 67, 0.08);
  --radius: 16px;
  font-family:
    -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(180deg, var(--navy) 0 148px, transparent 148px),
    var(--bg);
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.lock-screen {
  min-height: 100svh;
  padding: max(28px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  color: #fff;
  background:
    radial-gradient(circle at 85% 0%, rgba(116, 183, 245, 0.38), transparent 38%),
    linear-gradient(160deg, #173d61 0%, #0c2134 58%, #081724 100%);
}

.unlock-card {
  width: min(100%, 390px);
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  background: rgba(12, 33, 52, 0.78);
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(16px);
}

.unlock-card h1 {
  margin-top: 4px;
}

.unlock-copy {
  margin-top: 12px;
  color: #c7d8e7;
  font-size: 13px;
  line-height: 1.65;
}

.unlock-form {
  margin-top: 20px;
}

.unlock-form label {
  display: block;
  margin-bottom: 7px;
  color: #dfeaf3;
  font-size: 12px;
}

.unlock-form input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 11px;
  outline: 0;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  font-size: 16px;
  letter-spacing: 0.04em;
}

.unlock-form input:focus {
  border-color: #78b9f2;
  box-shadow: 0 0 0 3px rgba(120, 185, 242, 0.2);
}

.unlock-form input::placeholder {
  color: #91a7b9;
}

.unlock-form button {
  width: 100%;
  min-height: 50px;
  margin-top: 12px;
  border: 0;
  border-radius: 11px;
  color: #0d263b;
  background: #cfe7fb;
  font-weight: 650;
  cursor: pointer;
}

.unlock-form button:disabled {
  opacity: 0.58;
  cursor: wait;
}

.unlock-error {
  margin-top: 10px;
  color: #ffbbb7;
  font-size: 12px;
}

.unlock-note {
  margin-top: 16px;
  color: #8fa7ba;
  font-size: 11px;
}

.app-header {
  color: #fff;
  padding: max(20px, env(safe-area-inset-top)) 18px 78px;
  background:
    radial-gradient(circle at 85% -20%, rgba(116, 183, 245, 0.38), transparent 45%),
    var(--navy);
}

.header-inner {
  width: min(100%, 820px);
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 6px;
  color: #b9d7ef;
  font-size: 12px;
  letter-spacing: 0.08em;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.as-of {
  min-width: 88px;
  padding-top: 3px;
  text-align: right;
  font-size: 12px;
  color: #c6d8e8;
}

.as-of strong {
  display: block;
  margin-top: 3px;
  color: #fff;
  font-size: 16px;
}

.page-shell {
  width: min(100%, 820px);
  margin: -56px auto 0;
  padding: 0 14px max(34px, env(safe-area-inset-bottom));
}

.intro,
.deal-insight,
.search-panel,
.results-section,
.method {
  border: 1px solid rgba(199, 208, 217, 0.78);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.intro {
  padding: 18px;
}

.intro-copy h2 {
  font-size: 18px;
  line-height: 1.35;
}

.intro-copy p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.stat-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.stat {
  min-width: 0;
  padding: 11px 10px;
  border-radius: 12px;
  background: var(--surface-soft);
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.stat strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.deal-insight {
  margin-top: 12px;
  padding: 16px;
}

.deal-insight-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel-kicker {
  margin-bottom: 4px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 650;
}

.deal-insight-heading h2 {
  font-size: 17px;
  line-height: 1.4;
}

.deal-insight-heading > span {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 11px;
}

.deal-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 13px;
}

.deal-stat {
  min-width: 0;
  padding: 10px;
  border-radius: 10px;
  background: var(--surface-soft);
}

.deal-stat span {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.deal-stat strong {
  display: block;
  margin-top: 4px;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.deal-rules {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.deal-rules p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.deal-rules strong {
  color: var(--ink);
  font-weight: 650;
}

.deal-sample-note {
  margin-top: 9px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.search-panel {
  margin-top: 12px;
  padding: 16px;
}

.search-label,
.filter-heading > span {
  font-size: 13px;
  font-weight: 650;
}

.search-box {
  position: relative;
  margin-top: 8px;
}

.search-box input {
  width: 100%;
  min-height: 50px;
  padding: 0 74px 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  outline: 0;
  color: var(--ink);
  background: var(--surface);
  font-size: 16px;
}

.search-box input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(35, 103, 168, 0.14);
}

.search-box input::placeholder {
  color: #919aa4;
}

.clear-search {
  position: absolute;
  top: 7px;
  right: 7px;
  min-width: 54px;
  min-height: 36px;
  border: 0;
  border-radius: 9px;
  color: var(--blue);
  background: var(--blue-soft);
  cursor: pointer;
}

.search-hint {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.filter-hint {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.filter-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
}

.text-button {
  min-height: 36px;
  padding: 0 8px;
  border: 0;
  color: var(--blue);
  background: transparent;
  cursor: pointer;
}

.band-filters {
  display: flex;
  gap: 8px;
  margin: 7px -16px 0;
  padding: 2px 16px 3px;
  overflow-x: auto;
  scrollbar-width: none;
}

.band-filters::-webkit-scrollbar {
  display: none;
}

.band-button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: var(--surface-soft);
  cursor: pointer;
  white-space: nowrap;
}

.band-button strong {
  margin-left: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.band-button[aria-pressed="true"] {
  border-color: var(--navy);
  color: #fff;
  background: var(--navy);
}

.band-button[aria-pressed="true"] strong {
  color: #d9e7f3;
}

.results-section {
  margin-top: 12px;
  padding: 17px 14px 16px;
  box-shadow: none;
}

.results-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px 10px;
}

.results-heading h2 {
  font-size: 17px;
}

.results-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.sort-note {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 11px;
}

.results-list {
  display: grid;
  gap: 10px;
}

.car-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  min-width: 0;
}

.card-title h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.card-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.price-band {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 8px;
  color: var(--navy);
  background: var(--navy-soft);
  font-size: 11px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.source-id-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-soft);
}

.source-id-label {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
}

.source-id-value {
  min-width: 0;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
  user-select: all;
}

.copy-id-button {
  flex: 0 0 auto;
  min-width: 86px;
  min-height: 34px;
  margin-left: auto;
  border: 0;
  border-radius: 8px;
  color: var(--blue);
  background: var(--blue-soft);
  cursor: pointer;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 11px;
}

.tag.status-reply,
.tag.status-agreed {
  color: var(--green);
  background: var(--green-soft);
}

.tag.status-pending {
  color: var(--amber);
  background: var(--amber-soft);
}

.tag.status-rejected {
  color: var(--red);
  background: var(--red-soft);
}

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

.deal-row {
  margin-top: 13px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.deal-cell {
  min-width: 0;
  padding: 9px 8px;
  border-radius: 10px;
  background: var(--surface-soft);
}

.deal-cell span {
  display: block;
  min-height: 26px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  white-space: normal;
}

.deal-cell strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deal-cell.diff-reached strong {
  color: var(--green);
}

.deal-cell.diff-near strong {
  color: var(--amber);
}

.deal-cell.diff-far strong {
  color: var(--red);
}

.gap-box {
  margin-top: 10px;
  padding: 10px 11px;
  border-radius: 11px;
  background: var(--blue-soft);
}

.gap-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 650;
}

.gap-line strong {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.gap-track {
  height: 6px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(35, 103, 168, 0.13);
}

.gap-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.gap-box.no-bid {
  color: var(--muted);
  background: var(--surface-soft);
}

.gap-box.no-bid .gap-line {
  color: var(--muted);
}

.detail-toggle {
  width: 100%;
  min-height: 42px;
  margin-top: 9px;
  border: 0;
  border-radius: 10px;
  color: var(--blue);
  background: transparent;
  cursor: pointer;
}

.card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.card-actions .detail-toggle,
.copy-message {
  width: 100%;
  min-height: 42px;
  margin-top: 0;
  border-radius: 10px;
  cursor: pointer;
}

.copy-message {
  border: 1px solid var(--navy);
  color: #fff;
  background: var(--navy);
}

.card-actions .detail-toggle {
  border: 1px solid var(--line-strong);
  color: var(--blue);
  background: var(--surface);
}

.card-details {
  margin-top: 3px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 14px;
}

.detail-item span {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.detail-item strong {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 550;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.status-summary {
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.empty-state {
  padding: 36px 16px;
  text-align: center;
}

.empty-state strong {
  font-size: 15px;
}

.empty-state p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.load-more {
  width: 100%;
  min-height: 46px;
  margin-top: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
}

.method {
  margin-top: 12px;
  padding: 16px;
  box-shadow: none;
}

.method h2 {
  font-size: 14px;
}

.method p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

@media (min-width: 680px) {
  .app-header {
    padding-bottom: 92px;
  }

  .page-shell {
    padding-left: 20px;
    padding-right: 20px;
  }

  .intro {
    padding: 22px;
  }

  .stat strong {
    font-size: 24px;
  }

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

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

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #111820;
    --surface: #19232d;
    --surface-soft: #202c37;
    --ink: #edf3f8;
    --muted: #aab7c3;
    --line: #30404d;
    --line-strong: #425462;
    --navy: #0c2134;
    --navy-soft: #263d50;
    --blue: #78b9f2;
    --blue-soft: #21394d;
    --green: #83d5aa;
    --green-soft: #213c31;
    --amber: #f3c66d;
    --amber-soft: #40351f;
    --red: #f0a39e;
    --red-soft: #432c2d;
    --shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
  }

  body {
    background:
      linear-gradient(180deg, var(--navy) 0 148px, transparent 148px),
      var(--bg);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .car-card {
    animation: rise 180ms ease-out both;
  }

  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(4px);
    }
  }
}

@media (forced-colors: active) {
  .band-button,
  .car-card,
  .search-box input {
    border: 1px solid ButtonText;
  }
}
