:root {
  --bg: #070b11;
  --panel: #101923;
  --panel-2: #141f2c;
  --line: #26374b;
  --text: #f5f7fa;
  --muted: #9aa8b9;
  --orange: #ff7a00;
  --orange-2: #ff9d2e;
  --blue: #67aaff;
  --green: #49d992;
  --amber: #ffd05b;
  --bad: #ff6b78;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  color: var(--text);
  background: radial-gradient(circle at 50% 0, #172536 0, var(--bg) 42%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell {
  width: min(100%, 430px);
  height: 100dvh;
  max-height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 14px 0;
  overflow: hidden;
  background: linear-gradient(180deg, #0c141e, #0a1119);
}
.topbar {
  flex: 0 0 auto;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 0 6px;
}
.brand-lockup { display: flex; align-items: center; }
.back-button {
  border: 1px solid #30445c;
  border-radius: 8px;
  background: #111c29;
  color: #e9eef5;
  padding: 8px 10px;
  font-size: 11px;
  cursor: pointer;
}
.back-button[hidden] { display: none; }
.back-button:hover, .back-button:focus-visible { border-color: var(--orange); outline: none; }
.eyebrow {
  margin: 0 0 7px;
  color: #d4dce6;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .14em;
}
.screen { display: none; }
.screen.active {
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 18px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.hero-card {
  min-height: clamp(470px, calc(100dvh - 120px), 555px);
  position: relative;
  overflow: hidden;
  border: 1px solid #223348;
  border-radius: 16px;
  background: linear-gradient(180deg, #111c2a, #0b131e);
  box-shadow: 0 18px 42px #0008;
}
.hero-card::before {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0;
  background: linear-gradient(90deg, rgba(5,10,17,.82) 0%, rgba(5,10,17,.42) 45%, rgba(5,10,17,0) 75%), linear-gradient(180deg, rgba(7,13,22,.12) 0%, rgba(7,13,22,.03) 38%, rgba(7,13,22,.36) 76%, rgba(7,13,22,.72) 100%);
  pointer-events: none;
}
.hero-card::after {
  content: "";
  position: absolute;
  right: -42%;
  bottom: 88px;
  left: 18%;
  height: 2px;
  background: var(--orange);
  box-shadow: 0 0 18px #ff7900aa;
  transform: rotate(-33deg);
  pointer-events: none;
}
.hero-copy { position: relative; z-index: 2; padding: 27px 20px 0; }
.hero-copy h2 {
  margin: 0;
  font-size: clamp(26px, 7vw, 34px);
  line-height: .99;
  letter-spacing: -.065em;
  font-weight: 900;
}
.hero-copy h2 span { color: #e7ebf2; }
.hero-copy p:last-child {
  max-width: 210px;
  margin: 15px 0 0;
  color: #aeb9c8;
  font-size: 11px;
  line-height: 1.4;
}
.hero-car {
  position: absolute;
  z-index: 1;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
  mix-blend-mode: normal;
  opacity: .92;
  filter: saturate(.9) contrast(1.1);
}
.hero-actions {
  position: absolute;
  z-index: 3;
  right: 18px;
  bottom: 18px;
  left: 18px;
  display: grid;
  gap: 8px;
}
.wide { width: 100%; }
.primary, .secondary {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 10px 14px;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}
.primary { color: #18110b; background: linear-gradient(180deg, var(--orange-2), var(--orange)); box-shadow: 0 7px 16px #ff790038; }
.secondary { color: #e7edf5; background: #0e151f; border-color: #2a3a4e; }
.primary:active, .secondary:active, .quick-card:active { transform: translateY(1px); }

.quick-grid { display: grid; gap: 8px; margin-top: 10px; }
.quick-card {
  width: 100%;
  min-height: 57px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid #213247;
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  text-align: left;
  background: linear-gradient(180deg, #121e2b, #0f1823);
  cursor: pointer;
}
.quick-card b { margin-left: auto; color: #8d9aae; font-size: 22px; font-weight: 400; }
.quick-text { display: grid; gap: 3px; }
.quick-text strong { font-size: 12px; }
.quick-text small { color: var(--muted); font-size: 9px; }
.quick-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; }
.ui-icon, .nav-icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-icon { width: 19px; height: 19px; stroke-width: 1.8; }
.quick-icon.blue { color: var(--blue); background: #65a9ff18; }
.quick-icon.orange { color: var(--orange); background: #ff7a0018; }
.quick-icon.amber { color: var(--amber); background: #ffd05b18; }
.quick-icon.green { color: var(--green); background: #49d99218; }

.bottom-nav {
  flex: 0 0 auto;
  width: calc(100% + 28px);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  margin: 0 -14px;
  padding: 10px 8px calc(9px + env(safe-area-inset-bottom));
  border-top: 1px solid #263446;
  background: #0a1018f5;
  backdrop-filter: blur(14px);
}
.bottom-nav button {
  display: grid;
  justify-items: center;
  gap: 4px;
  border: 0;
  color: #7e8b9d;
  background: transparent;
  font-size: 17px;
  cursor: pointer;
}
.bottom-nav button span { font-size: 8px; }
.bottom-nav button.active { color: var(--orange); }

.section-heading { display: flex; align-items: center; justify-content: space-between; margin: 7px 2px 12px; }
.section-heading h2 { margin: 0; font-size: 23px; letter-spacing: -.04em; }
.icon-button { min-width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; color: #dce4ee; background: var(--panel); font-size: 10px; cursor: pointer; }
.hint { margin: 0 2px 12px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.remote-listing { display: grid; gap: 6px; padding: 14px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.remote-listing-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.remote-listing-top strong { max-width: 70%; color: var(--text); font-size: 13px; line-height: 1.35; }
.form-card, .results-card, .status-card, .listing-card { border: 1px solid var(--line); border-radius: 13px; background: var(--panel); box-shadow: 0 9px 23px #0003; }
.form-card { display: grid; gap: 10px; padding: 13px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
label { display: grid; gap: 5px; color: #bec9d7; font-size: 10px; font-weight: 650; }
input { width: 100%; border: 1px solid #2a3a4f; border-radius: 8px; padding: 10px; color: var(--text); background: #0b121c; font-size: 13px; outline: none; }
input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px #ff79001c; }
textarea { width: 100%; resize: vertical; border: 1px solid #2a3a4f; border-radius: 8px; padding: 10px; color: var(--text); background: #0b121c; font-size: 12px; outline: none; }
textarea:focus { border-color: var(--orange); }
.note-editor { display: grid; gap: 8px; margin: 10px 0; }
.note-editor[hidden] { display: none; }
.message { margin: 0; color: var(--green); font-size: 10px; }
.results-card { display: grid; gap: 0; margin-top: 10px; padding: 13px; }
.result-line { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #243142; color: #aeb9c8; font-size: 11px; }
.result-line:last-child { border-bottom: 0; }
.result-line strong { color: #f4f7fb; font-size: 13px; }
.result-line.total strong, .result-line.total span { color: var(--orange-2); font-weight: 800; }

.feed-toolbar { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 10px; }
.feed-count { color: var(--muted); font-size: 10px; }
.filter-chip { border: 1px solid #33465e; border-radius: 7px; padding: 7px 9px; color: #dce4ee; background: #121c28; font-size: 10px; cursor: pointer; }
.car-mark { position: relative; display: block; width: 48px; height: 22px; border: 2px solid var(--orange); border-radius: 12px 14px 5px 5px; transform: skewX(-12deg); }
.car-mark::before, .car-mark::after { content: ""; position: absolute; bottom: -7px; width: 7px; height: 7px; border: 2px solid var(--orange); border-radius: 50%; background: #0d151f; }
.car-mark::before { left: 5px; }
.car-mark::after { right: 5px; }
.empty-card .car-mark { margin: 0 auto; border-color: var(--amber); }
.empty-card .car-mark::before, .empty-card .car-mark::after { border-color: var(--amber); }
.listing-photo .car-mark { transform: scale(2); }
.empty-card { margin-bottom: 18px; padding: 23px 16px; border: 1px dashed #35465b; border-radius: 13px; text-align: center; background: #0d151f; }
.empty-icon { font-size: 30px; opacity: .85; }
.empty-card h3 { margin: 9px 0 6px; font-size: 15px; }
.empty-card p { max-width: 310px; margin: 0 auto 14px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.demo-preview { display: none !important; }
.demo-label { margin: 0 2px 8px; color: #68778a; }
.listing-card { max-width: 620px; overflow: hidden; padding: 0; }
.listing-photo { height: 170px; display: grid; place-items: center; background: linear-gradient(135deg, #1b2737, #0a0f17); font-size: 56px; }
.listing-body { padding: 14px; }
.pipeline { display: flex; gap: 5px; overflow-x: auto; margin: 13px 0 7px; padding-bottom: 4px; scrollbar-width: thin; }
.stage { flex: 0 0 auto; border: 1px solid #30445a; border-radius: 7px; padding: 7px 8px; color: #aeb9c8; background: #0d1621; font-size: 9px; cursor: pointer; white-space: nowrap; }
.stage.active { border-color: var(--orange); color: #1a1108; background: var(--orange); }
.listing-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.listing-actions .secondary { min-height: 35px; padding: 8px; font-size: 10px; }

.listing-body h3 { margin: 4px 0; font-size: 18px; line-height: 1.1; }
.price { margin: 8px 0; color: var(--orange-2); font-size: 21px; font-weight: 850; }
.muted { color: var(--muted); font-size: 11px; }
.small { line-height: 1.45; }
.signal-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.signal-row span { border: 1px solid #ff617044; border-radius: 5px; padding: 5px 7px; color: #ffc1c7; background: #ff617012; font-size: 9px; }
.freshness { border-radius: 6px; padding: 5px 7px; font-size: 9px; font-weight: 800; }
.freshness.fresh { color: var(--green); border: 1px solid #49d99255; background: #49d99212; }
.freshness.aging { color: var(--amber); border: 1px solid #ffd05b55; background: #ffd05b12; }
.freshness.old { color: var(--muted); border: 1px solid #6b7b8d55; background: #6b7b8d12; }
.listing-time { margin: 8px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.demo-badge { border: 1px solid #ffc44d55; border-radius: 5px; padding: 5px 7px; color: var(--amber); background: #ffc44d12; font-size: 9px; font-weight: 800; }
.status-card { display: grid; gap: 0; padding: 13px; }
.status-item { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid #243142; font-size: 11px; }
.status-item:last-child { border-bottom: 0; }
.status-item span { color: var(--muted); }
.status-item strong { text-align: right; font-size: 11px; }
.calculator-card { margin-bottom: 10px; }

.remote-listing { overflow: hidden; border: 1px solid #2b3b50; border-radius: 13px; background: #101a26; box-shadow: 0 8px 20px #0003; }
.remote-photo { position: relative; min-height: 145px; display: grid; place-items: center; overflow: hidden; background: linear-gradient(135deg, #1b2a3a, #0b1119); }
.remote-photo.has-image { background: #0b1119; }
.remote-photo img { width: 100%; height: 220px; display: block; object-fit: contain; object-position: center; background: #0b1119; }
.remote-photo.is-fallback { grid-template-columns: 1fr; gap: 14px; align-content: center; color: #78899e; }
.remote-photo .car-mark { transform: scale(1.6); opacity: .75; }
.photo-placeholder { color: #718197; font-size: 10px; }
.remote-listing-body { padding: 13px; }
.remote-listing-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.remote-type { color: #8fa2b8; font-size: 9px; font-weight: 800; letter-spacing: .08em; }
.remote-listing h3 { margin: 9px 0 0; color: #f2f5f9; font-size: 16px; line-height: 1.2; }
.remote-listing .price { margin: 8px 0 5px; }
.remote-meta, .remote-facts { margin: 0; color: #c1ccd9; font-size: 11px; line-height: 1.45; }
.remote-facts { margin-top: 5px; color: #8fa1b5; }
.remote-signals { display: flex; flex-wrap: wrap; gap: 5px; margin: 11px 0 2px; }
.remote-signals span { padding: 5px 7px; border: 1px solid #efaa4d66; border-radius: 5px; color: #ffd28a; background: #efaa4d12; font-size: 9px; }
.remote-times { display: grid; gap: 3px; margin: 12px 0 2px; color: #7f91a6; font-size: 9px; line-height: 1.35; }
.remote-listing .listing-actions { margin-bottom: 0; }
.secondary:disabled { cursor: not-allowed; opacity: .45; }

.remote-workflow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.remote-workflow label { display: grid; gap: 4px; color: #8fa1b5; font-size: 9px; }
.remote-workflow select { width: 100%; min-height: 35px; border: 1px solid #2a3a4f; border-radius: 8px; padding: 7px; color: #dfe7f0; background: #0b121c; font-size: 10px; }
.remote-workflow select:focus { border-color: var(--orange); outline: none; }

.range-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; margin-top: 5px; }
input[type="range"] { width: 100%; height: 5px; padding: 0; accent-color: var(--orange); border: 0; background: #243448; cursor: pointer; }
.range-line output { min-width: 66px; color: var(--orange-2); font-size: 10px; font-variant-numeric: tabular-nums; text-align: right; }

.remote-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin: 12px 0; }
.remote-detail { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 7px; border: 1px solid #223348; border-radius: 8px; background: #0d1621; }
.remote-detail svg { flex: 0 0 17px; width: 17px; height: 17px; fill: none; stroke: #8ea5bd; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.remote-detail span { min-width: 0; display: grid; gap: 2px; }
.remote-detail small { color: #71849a; font-size: 8px; }
.remote-detail strong { overflow: hidden; color: #dce5ef; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.remote-condition { margin: 5px 0; color: #c5d0dc; font-size: 10px; }
.old-price { margin: -5px 0 8px; color: #7d8d9e; font-size: 10px; text-decoration: line-through; }

.compact-actions { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) 36px; gap: 6px; margin-top: 10px; }
.mini-action { min-height: 32px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid #2c4056; border-radius: 7px; padding: 7px 6px; color: #dce5ef; background: #0d1621; font-size: 9px; font-weight: 750; text-decoration: none; cursor: pointer; }
.mini-action:hover, .mini-action:focus-visible { border-color: var(--orange); outline: none; }
.icon-action { width: 37px; height: 35px; display: grid; place-items: center; border: 1px solid #2c4056; border-radius: 8px; color: #8b9caf; background: #0d1621; cursor: pointer; }
.icon-action svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.icon-action.is-favorite { color: var(--amber); border-color: #ffd05b77; background: #ffd05b12; }
.remote-note { margin-top: 10px; border-top: 1px solid #25364a; padding-top: 8px; }
.remote-note summary { color: #9eafc1; font-size: 10px; cursor: pointer; }
.remote-note textarea { min-height: 52px; margin-top: 8px; font-size: 10px; }
.remote-note .mini-action { width: 100%; margin-top: 6px; }

@media (min-width: 700px) {
  body { padding: 24px; }
  .app-shell { width: min(100%, 1120px); padding: 0 32px 24px; border: 1px solid #263547; border-radius: 22px; box-shadow: 0 25px 70px #0008; }
  .topbar { min-height: 72px; }
  .screen#start.active { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(310px, .75fr); gap: 18px; align-items: start; }
  .screen#start .hero-card { min-height: clamp(430px, calc(100dvh - 170px), 620px); }
  .screen#start .quick-grid { margin-top: 0; }
  .screen:not(#start) { max-width: 820px; margin: 0 auto; }
  .bottom-nav { width: calc(100% + 64px); margin: 0 -32px; }
  .hero-car { height: 100%; }
}

@media (max-width: 380px) {
  .field-row { grid-template-columns: 1fr; }
  .hero-copy { padding-left: 16px; }
  .hero-copy h2 { font-size: 25px; }
  .hero-actions { right: 14px; left: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
