:root {
  --bg: #f5efe5;
  --panel: rgba(255, 250, 242, 0.9);
  --panel-strong: #fffaf2;
  --middle-width: 195px;
  --handle-width: 16px;
  --ui-scale: 1;
  --ui-scale-inverse: 1;
  --text: #1f2a2e;
  --muted: #5f6d72;
  --line: rgba(35, 49, 52, 0.16);
  --accent: #bf5f2f;
  --accent-deep: #8c3e18;
  --profit: #0f7b5f;
  --today-outline: #2f9d57;
  --loss: #c03a3a;
  --insurance-bg: #fbe4df;
  --insurance-fg: #992c1c;
  --warning-bg: #fff3d7;
  --warning-fg: #8d5a00;
  --page-glow-left: rgba(191, 95, 47, 0.18);
  --page-glow-right: rgba(17, 86, 99, 0.16);
  --page-base-top: #f7efe4;
  --page-base-mid: #f4ede6;
  --page-base-bottom: #efe7db;
  --hero-bg: #ffffff;
  --hero-glow: rgba(191, 95, 47, 0.12);
  --eyebrow-bg: rgba(31, 42, 46, 0.06);
  --success: #1f9a52;
  --success-deep: #14703b;
  --success-hover: #25ab5c;
  --success-hover-deep: #187c41;
  --success-contrast: #f6fff8;
  --success-soft: rgba(15, 123, 95, 0.12);
  --success-soft-border: rgba(15, 123, 95, 0.18);
  --info: #115663;
  --info-soft: rgba(17, 86, 99, 0.08);
  --info-soft-border: rgba(17, 86, 99, 0.18);
  --badge-bg: rgba(31, 42, 46, 0.9);
  --badge-text: #fffaf2;
  --plate-bg: #ffd90a;
  --plate-bg-deep: #f4c900;
  --plate-border: rgba(17, 17, 17, 0.92);
  --plate-text: #111111;
  --modal-backdrop: rgba(22, 18, 13, 0.52);
  --surface-soft: rgba(255, 255, 255, 0.72);
  --surface-muted: rgba(255, 255, 255, 0.70);
  --surface-input: rgba(255, 255, 255, 0.88);
  --surface-border: rgba(31, 42, 46, 0.10);
  --input-line: rgba(31, 42, 46, 0.14);
  --toggle-line: rgba(31, 42, 46, 0.12);
  --focus-outline: rgba(191, 95, 47, 0.28);
  --focus-line: rgba(191, 95, 47, 0.48);
  --accent-soft: rgba(191, 95, 47, 0.12);
  --accent-soft-strong: rgba(191, 95, 47, 0.16);
  --accent-soft-border: rgba(191, 95, 47, 0.18);
  --accent-soft-border-strong: rgba(191, 95, 47, 0.30);
  --subtle-bg: rgba(31, 42, 46, 0.06);
  --subtle-bg-strong: rgba(31, 42, 46, 0.08);
  --error-bg: rgba(192, 58, 58, 0.10);
  --error-bg-soft: rgba(192, 58, 58, 0.09);
  --error-border: rgba(192, 58, 58, 0.18);
  --error-border-strong: rgba(192, 58, 58, 0.20);
  --error-text: #7e2222;
  --warning-border: rgba(141, 90, 0, 0.18);
  --accent-contrast: #fff7f0;
  --surface-highlight: rgba(255, 255, 255, 0.38);
  --resize-top: rgba(17, 86, 99, 0.35);
  --resize-bottom: rgba(191, 95, 47, 0.55);
  --resize-top-active: rgba(17, 86, 99, 0.55);
  --resize-bottom-active: rgba(191, 95, 47, 0.82);
  --resize-inner-line: rgba(255, 255, 255, 0.34);
  --resize-inner-line-active: rgba(255, 255, 255, 0.46);
  --success-shadow: rgba(20, 112, 59, 0.24);
  --accent-shadow: rgba(140, 62, 24, 0.24);
  --shadow-soft-color: rgba(43, 35, 25, 0.12);
  --shadow-medium-color: rgba(43, 35, 25, 0.18);
  --card-shadow-color: rgba(43, 35, 25, 0.08);
  --badge-shadow-color: rgba(22, 18, 13, 0.22);
  --tooltip-shadow-color: rgba(22, 18, 13, 0.26);
  --modal-shadow-color: rgba(22, 18, 13, 0.28);
  --today-outline-soft: rgba(47, 157, 87, 0.16);
  --thumb-base: #ebe2d6;
  --modal-surface-border: rgba(255, 255, 255, 0.42);
  --modal-surface-top: rgba(255, 250, 242, 0.98);
  --modal-surface-bottom: rgba(244, 236, 226, 0.96);
  --plate-highlight: rgba(255, 255, 255, 0.48);
  --plate-shadow: rgba(17, 17, 17, 0.08);
  --shadow: 0 20px 48px rgba(43, 35, 25, 0.12);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, var(--page-glow-left), transparent 28%),
    radial-gradient(circle at top right, var(--page-glow-right), transparent 30%),
    linear-gradient(180deg, var(--page-base-top) 0%, var(--page-base-mid) 42%, var(--page-base-bottom) 100%);
}

a {
  color: inherit;
}

.shell {
  width: calc(90vw * var(--ui-scale-inverse));
  max-width: calc((100vw - 24px) * var(--ui-scale-inverse));
  margin: 10px auto 22px;
  display: grid;
  gap: 18px;
  zoom: var(--ui-scale);
}

.shell-auth {
  width: min(calc(520px * var(--ui-scale-inverse)), calc(90vw * var(--ui-scale-inverse)));
  min-height: 100vh;
  align-content: center;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--hero-bg);
  box-shadow: var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -60px -70px auto;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, var(--hero-glow), transparent 68%);
  pointer-events: none;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--eyebrow-bg);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.hero-logo {
  width: clamp(108px, 12vw, 164px);
  height: auto;
  display: block;
  object-fit: contain;
  flex: 0 0 auto;
}

.hero h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.04em;
  flex: 0 0 auto;
}

.hero p {
  margin: 0;
  max-width: 900px;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.45;
}

.hero-summary {
  margin-left: 10px;
  max-width: 620px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.28;
  flex: 1 1 auto;
}

.hero-tools {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  min-width: 320px;
  margin-left: auto;
  justify-items: stretch;
  flex: 0 1 360px;
}

.hero-scale-control {
  position: relative;
  display: grid;
  gap: 5px;
  min-width: 0;
  margin-left: 0;
  justify-items: end;
  flex: 0 0 auto;
}

.hero-scale-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  justify-content: space-between;
}

.hero-scale-label,
.hero-scale-value {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero-scale-slider {
  width: 100%;
  min-height: auto;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  accent-color: var(--success);
}

.hero-scale-slider:hover {
  transform: none;
}

.hero-scale-slider:focus {
  outline-offset: 3px;
}

.hero-theme-control {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
  box-shadow: inset 0 1px 0 var(--surface-highlight);
}

.theme-mode-only {
  gap: 0;
  padding: 6px;
  min-width: 0;
}

.theme-mode-only .hero-theme-actions {
  justify-content: stretch;
}

.theme-mode-only .theme-button {
  width: 100%;
}

.hero-theme-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.hero-theme-actions-small {
  justify-content: space-between;
}

.theme-button {
  width: auto;
  min-height: 34px;
  padding: 6px 10px;
}

.theme-mode-button.active {
  border-color: var(--success-soft-border);
  background: linear-gradient(135deg, var(--success-soft), var(--accent-soft));
  color: var(--success);
  box-shadow: inset 0 1px 0 var(--surface-highlight);
}

.theme-code-label {
  display: grid;
  gap: 6px;
  font-size: 0.74rem;
  color: var(--muted);
}

.theme-code-input {
  min-height: 88px;
  resize: vertical;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.76rem;
  line-height: 1.4;
}

.theme-code-status {
  min-height: 1.3em;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.4;
}

.theme-code-status.error {
  color: var(--loss);
}

.theme-code-status.success {
  color: var(--profit);
}

.hero-auth {
  padding-bottom: 24px;
}

.auth-panel {
  max-width: 520px;
}

.auth-form {
  gap: 12px;
}

.auth-error {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--error-border-strong);
  background: var(--error-bg);
  color: var(--error-text);
  font-size: 0.92rem;
  line-height: 1.45;
}

.auth-actions {
  justify-content: flex-end;
}

.auth-actions .primary {
  min-width: 180px;
}

.layout {
  display: grid;
  grid-template-columns:
    minmax(calc(180px * var(--ui-scale-inverse)), var(--middle-width))
    var(--handle-width)
    minmax(calc(640px * var(--ui-scale-inverse)), 1fr);
  gap: 18px;
  align-items: start;
}

.layout.hide-progress {
  grid-template-columns: 1fr;
}

.controls-shell,
.middle-shell,
.results-shell {
  min-width: 0;
}

.layout.hide-progress .middle-shell,
.layout.hide-progress .resize-handle {
  display: none;
}

.layout.hide-progress .results-shell {
  grid-column: 1 / -1;
}

.resize-handle {
  position: relative;
  align-self: stretch;
  width: var(--handle-width);
  min-height: 100%;
  cursor: col-resize;
  border-radius: 999px;
  background: transparent;
  touch-action: none;
}

.resize-handle::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 50%;
  width: 6px;
  transform: translateX(-50%);
  border-radius: 999px;
  background:
    linear-gradient(180deg, var(--resize-top), var(--resize-bottom));
  box-shadow:
    inset 0 0 0 1px var(--resize-inner-line),
    0 10px 24px var(--shadow-soft-color);
  transition: background 120ms ease, box-shadow 120ms ease, width 120ms ease;
}

.resize-handle:hover::before,
.resize-handle.active::before {
  width: 8px;
  background: linear-gradient(180deg, var(--resize-top-active), var(--resize-bottom-active));
  box-shadow:
    inset 0 0 0 1px var(--resize-inner-line-active),
    0 12px 28px var(--shadow-medium-color);
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel-inner {
  padding: 20px;
}

.controls-shell .panel-inner {
  padding: 12px 14px 14px;
}

.panel-title {
  margin: 0 0 16px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
  line-height: 1.1;
}

.panel-title-tight {
  margin-bottom: 0;
}

.panel-header {
  margin-bottom: 8px;
}

.search-form {
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  gap: 7px 8px;
  align-items: end;
}

.controls-shell .search-form > * {
  min-width: 0;
}

.controls-shell .search-form .field-make,
.controls-shell .search-form .field-model {
  grid-column: span 4;
}

.controls-shell .search-form .field-keywords {
  grid-column: span 4;
}

.controls-shell .search-form .field-damage {
  grid-column: span 2;
}

.controls-shell .search-form .year-pair {
  grid-column: span 6;
}

.controls-shell .search-form .price-pair,
.controls-shell .search-form .mileage-pair,
.controls-shell .search-form .field-location {
  grid-column: span 4;
}

.controls-shell .search-form .field-radius {
  grid-column: span 2;
}

.controls-shell .search-form .field-fuel {
  grid-column: span 2;
}

.controls-shell .search-form .search-actions {
  grid-column: 9 / -1;
  justify-self: stretch;
  width: 100%;
}

form {
  display: grid;
  gap: 14px;
}

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

label {
  display: grid;
  gap: 3px;
  font-size: 0.78rem;
  color: var(--muted);
}

.input-select-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(108px, 34%);
  gap: 6px;
}

input,
select,
button {
  width: 100%;
  border: 1px solid var(--input-line);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--text);
  background: var(--surface-input);
  font: inherit;
}

input:focus,
select:focus,
button:focus {
  outline: 2px solid var(--focus-outline);
  outline-offset: 1px;
  border-color: var(--focus-line);
}

button {
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.controls-shell input,
.controls-shell select,
.controls-shell button {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--input-line);
  border-radius: 10px;
  padding: 6px 9px;
  color: var(--text);
  background: var(--surface-input);
  font: inherit;
}

button:hover {
  transform: translateY(-1px);
}

.primary {
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: var(--accent-contrast);
  box-shadow: 0 14px 30px var(--accent-shadow);
  font-weight: 700;
}

.primary[disabled] {
  cursor: wait;
  transform: none;
  opacity: 0.72;
  box-shadow: none;
}

.subtle {
  background: var(--subtle-bg);
  color: var(--text);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border: 1px solid var(--toggle-line);
  border-radius: 10px;
  background: var(--surface-muted);
}

.toggle-row input {
  width: auto;
  margin: 0;
}

.compact-toggle {
  min-height: 34px;
}

.damage-toggle-field {
  display: grid;
  gap: 3px;
}

.filter-mode-button {
  min-height: 34px;
  padding: 6px 9px;
  border-radius: 10px;
  border: 1px solid var(--input-line);
  background: var(--surface-input);
  color: var(--text);
  font-weight: 700;
  text-align: left;
}

.filter-mode-button.active {
  border-color: var(--accent-soft-border-strong);
  background: linear-gradient(135deg, var(--accent-soft-strong), var(--accent-soft));
  color: var(--accent-deep);
}

.hint {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.search-actions {
  display: flex;
  width: 100%;
  justify-content: flex-end;
  align-items: center;
  margin-top: 0;
  gap: 8px;
  flex-wrap: nowrap;
}

.search-actions .primary,
.search-actions .subtle {
  flex: 0 0 auto;
  width: auto;
}

.search-actions .primary {
  min-width: 110px;
  order: 2;
}

.search-actions #search-button {
  background: linear-gradient(135deg, var(--success), var(--success-deep));
  color: var(--success-contrast);
  box-shadow: 0 12px 26px var(--success-shadow);
}

.search-actions #search-button:hover {
  background: linear-gradient(135deg, var(--success-hover), var(--success-hover-deep));
}

.search-actions #search-button:focus {
  border-color: var(--success-soft-border);
}

.search-actions .subtle {
  min-width: 96px;
  order: 1;
}

.quick-link-panel .panel-inner {
  padding: 10px 12px;
}

.quick-link-inner {
  display: flex;
}

.nav-link-button {
  width: 100%;
  flex: 1 1 auto;
}

.stats-nav-link {
  flex: 0 0 auto;
  width: auto;
}

.stats-filter-form {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 8px 10px;
  align-items: end;
}

.stats-filter-form .field-make,
.stats-filter-form .field-model {
  grid-column: span 3;
}

.stats-filter-form .field-year,
.stats-filter-form .field-mileage {
  grid-column: span 2;
}

.stats-filter-form .field-days {
  grid-column: span 1;
}

.stats-actions {
  display: flex;
  grid-column: span 1;
  justify-content: flex-end;
  width: 100%;
}

.stats-range-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.stats-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
  gap: 18px;
  align-items: start;
}

.stats-chart-shell {
  position: relative;
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-soft);
  padding: 16px;
}

#stats-chart {
  min-height: 320px;
}

.stats-empty,
.stats-empty-cell {
  color: var(--muted);
  text-align: center;
}

.stats-empty {
  display: grid;
  place-items: center;
  min-height: 300px;
  font-size: 0.95rem;
}

.stats-empty-cell {
  padding: 28px 14px;
}

.stats-chart-svg {
  width: 100%;
  height: 320px;
  display: block;
}

.stats-grid-line {
  stroke: var(--line);
  stroke-width: 1;
}

.stats-axis-line {
  stroke: var(--surface-border);
  stroke-width: 1.2;
}

.stats-line-path {
  fill: none;
  stroke: var(--success);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stats-line-point {
  fill: var(--hero-bg);
  stroke: var(--success);
  stroke-width: 2;
}

.stats-axis-text,
.stats-tooltip-text {
  fill: var(--muted);
  font-size: 12px;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

.stats-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stats-summary-card {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 18px;
  background: var(--surface-soft);
  border: 1px solid var(--surface-border);
}

.stats-summary-label {
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stats-summary-value {
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.25;
}

.stats-table-wrap {
  overflow: auto;
  border: 1px solid var(--surface-border);
  border-radius: 20px;
  background: var(--surface-soft);
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.stats-table th,
.stats-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--surface-border);
  text-align: left;
  vertical-align: top;
}

.stats-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-strong);
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stats-table tbody tr:last-child td {
  border-bottom: none;
}

.stats-table-title {
  min-width: 280px;
}

.stats-table-link {
  white-space: nowrap;
}

.stats-table-link a {
  color: var(--info);
  font-weight: 700;
  text-decoration: none;
}

.stats-table-link a:hover {
  text-decoration: underline;
}

.middle-shell,
.results-shell {
  display: grid;
  gap: 16px;
  align-content: start;
}

.middle-shell .panel-inner {
  padding: 16px 12px;
}

.topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.summary {
  font-size: 1rem;
  color: var(--muted);
}

.results-scan-summary {
  margin: 2px 0 14px;
  line-height: 1.55;
}

.results-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(220px, 0.72fr);
  gap: 12px;
  margin: 2px 0 8px;
}

.results-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
  flex: 0 0 auto;
}

.toolbar-toggle-button,
.action-link-small {
  width: auto;
  min-height: 34px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  line-height: 1;
  white-space: nowrap;
  flex: 0 0 auto;
}

.toolbar-toggle-button {
  min-width: 118px;
  color: var(--text);
}

.toolbar-toggle-button.active {
  border-color: var(--accent-soft-border-strong);
  background: linear-gradient(135deg, var(--accent-soft-strong), var(--accent-soft));
  color: var(--accent-deep);
}

.toolbar-toggle-button:disabled {
  opacity: 0.62;
  cursor: default;
  transform: none;
  box-shadow: none;
}

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

.results-order {
  align-self: end;
}

.results-summary {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--subtle-bg);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.status-pill.running {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.status-pill.completed {
  background: var(--success-soft);
  color: var(--profit);
}

.status-pill.failed {
  background: var(--error-bg);
  color: var(--loss);
}

.progress-grid,
.notice-list {
  display: grid;
  gap: 10px;
}

.result-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}

.progress-card {
  padding: 10px 11px;
  border-radius: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.progress-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 0.84rem;
}

.progress-name {
  font-weight: 700;
}

.track,
.profit-track {
  width: 100%;
  border-radius: 999px;
  overflow: hidden;
  background: var(--subtle-bg-strong);
}

.track {
  height: 10px;
}

.fill,
.profit-fill {
  height: 100%;
  border-radius: 999px;
}

.fill {
  background: linear-gradient(90deg, var(--info), var(--accent));
  transition: width 220ms ease;
}

.progress-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.notice {
  padding: 13px 14px;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.5;
  border: 1px solid transparent;
}

.notice.alert {
  background: var(--success-soft);
  border-color: var(--success-soft-border);
}

.notice.warning {
  background: var(--warning-bg);
  color: var(--warning-fg);
  border-color: var(--warning-border);
}

.notice.error {
  background: var(--error-bg-soft);
  color: var(--error-text);
  border-color: var(--error-border);
}

.result-card {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel-strong);
  box-shadow: 0 18px 44px var(--card-shadow-color);
  align-content: start;
}

.result-card.listed-today {
  border-color: var(--today-outline);
  box-shadow:
    0 0 0 3px var(--today-outline-soft),
    0 18px 44px var(--card-shadow-color);
}

.thumb {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  background:
    linear-gradient(135deg, var(--page-glow-right), var(--page-glow-left)),
    var(--thumb-base);
  aspect-ratio: 16 / 10;
  min-height: 0;
}

.thumb-badge-stack {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: grid;
  gap: 8px;
  max-width: calc(100% - 20px);
}

.thumb-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 18px var(--badge-shadow-color);
}

.thumb-category-badge {
  background: var(--badge-bg);
  color: var(--badge-text);
}

.thumb-badge-new {
  background: var(--success);
  color: var(--success-contrast);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  padding: 12px;
  font-size: 0.95rem;
}

.tile-contact-block {
  display: grid;
  gap: 8px;
}

.tile-tag-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tile-tag {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning-fg);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
}

.tile-tag-advisory {
  border-color: var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning-fg);
}

.tile-phone,
.tile-email {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--info-soft-border);
  background: var(--info-soft);
  color: var(--info);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.35;
  text-decoration: none;
}

.tile-email {
  border-color: var(--accent-soft-border);
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 0.84rem;
  word-break: break-word;
}

.modal-phone {
  margin: 0;
}

.modal-contact-block {
  margin: 14px 24px 0;
}

.modal-email {
  margin: 0;
}

.result-meta {
  display: flex;
  gap: 10px;
  align-items: start;
  justify-content: space-between;
  flex-wrap: wrap;
}

.tile-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.platform-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--info-soft);
  color: var(--info);
  font-size: 0.78rem;
  font-weight: 700;
}

.result-title {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.3;
}

.badge-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge.insurance {
  background: var(--insurance-bg);
  color: var(--insurance-fg);
}

.tooltip-badge {
  position: relative;
  cursor: help;
}

.tooltip-badge::before,
.tooltip-badge::after {
  position: absolute;
  left: 50%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 20;
}

.tooltip-badge::before {
  content: attr(data-tooltip);
  bottom: calc(100% + 12px);
  width: min(280px, 70vw);
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--badge-bg);
  box-shadow: 0 16px 34px var(--tooltip-shadow-color);
  color: var(--badge-text);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.45;
  text-transform: none;
  letter-spacing: normal;
  text-align: left;
  transform: translate(-50%, 6px);
  white-space: normal;
}

.tooltip-badge::after {
  content: "";
  bottom: calc(100% + 4px);
  width: 10px;
  height: 10px;
  background: var(--badge-bg);
  transform: translate(-50%, 6px) rotate(45deg);
}

.tooltip-badge:hover::before,
.tooltip-badge:hover::after,
.tooltip-badge:focus-visible::before,
.tooltip-badge:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.badge.new {
  background: var(--success-soft);
  color: var(--profit);
}

.meta-line,
.body-copy,
.support-line {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.body-copy {
  color: var(--text);
}

.tile-price {
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 42px;
  padding: 6px 14px;
  border: 2px solid var(--plate-border);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--plate-bg) 0%, var(--plate-bg-deep) 100%);
  color: var(--plate-text);
  font-size: 1.22rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  box-shadow:
    inset 0 1px 0 var(--plate-highlight),
    0 8px 18px var(--plate-shadow);
}

.tile-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.tile-age {
  margin: 0;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 5px 10px;
  border: 1px solid var(--info-soft-border);
  border-radius: 999px;
  background: var(--info-soft);
  color: var(--info);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.tile-profit {
  margin: 0;
  color: var(--profit);
  font-size: 0.92rem;
  font-weight: 700;
}

.tile-profit.negative {
  color: var(--loss);
}

.tile-excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 4.35em;
}

.profit-stack {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.profit-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.profit-track {
  width: min(180px, 100%);
  height: 14px;
}

.profit-value {
  font-weight: 700;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--subtle-bg);
  text-decoration: none;
  font-weight: 700;
  flex: 1 1 0;
}

.results-header-actions .action-link {
  flex: 0 0 auto;
}

.empty {
  padding: 28px;
  border-radius: 18px;
  background: var(--surface-muted);
  border: 1px dashed var(--line);
  color: var(--muted);
  text-align: center;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 22px;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--modal-backdrop);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(calc(980px * var(--ui-scale-inverse)), calc((100vw - 40px) * var(--ui-scale-inverse)));
  max-height: calc((100vh - 40px) * var(--ui-scale-inverse));
  overflow: auto;
  padding-top: 74px;
  border-radius: 28px;
  border: 1px solid var(--modal-surface-border);
  background: linear-gradient(180deg, var(--modal-surface-top), var(--modal-surface-bottom));
  box-shadow: 0 30px 80px var(--modal-shadow-color);
  zoom: var(--ui-scale);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  margin: 0;
  width: auto;
  min-width: 96px;
  z-index: 2;
  flex: 0 0 auto;
}

.modal-media {
  margin: 0 24px;
  border-radius: 22px;
  overflow: hidden;
  background:
    linear-gradient(135deg, var(--page-glow-right), var(--page-glow-left)),
    var(--bg);
  aspect-ratio: 16 / 8;
}

.modal-media .thumb {
  height: 100%;
  aspect-ratio: auto;
  border-radius: 0;
}

.modal-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.modal-media .thumb-placeholder {
  position: static;
  height: 100%;
}

.modal-content {
  padding: 24px;
  display: grid;
  gap: 14px;
}

.modal-title-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  flex-wrap: wrap;
}

.modal-title {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.6rem, 2vw, 2.3rem);
  line-height: 1.08;
}

.modal-value {
  font-size: 1.45rem;
  font-weight: 700;
  white-space: nowrap;
}

.modal-meta {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.modal-section {
  display: grid;
  gap: 8px;
  padding-top: 2px;
}

.modal-section-title {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.modal-copy {
  margin: 0;
  color: var(--text);
  line-height: 1.7;
}

body.layout-resizing,
body.layout-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

@media (max-width: 1320px) {
  .layout {
    grid-template-columns:
      minmax(calc(190px * var(--ui-scale-inverse)), calc(240px * var(--ui-scale-inverse)))
      var(--handle-width)
      minmax(0, 1fr);
  }

  .search-form {
    grid-template-columns: repeat(10, minmax(0, 1fr));
  }

  .controls-shell .search-form .field-make,
  .controls-shell .search-form .field-model,
  .controls-shell .search-form .field-keywords,
  .controls-shell .search-form .field-damage {
    grid-column: span 3;
  }

  .controls-shell .search-form .year-pair {
    grid-column: span 4;
  }

  .controls-shell .search-form .price-pair,
  .controls-shell .search-form .mileage-pair,
  .controls-shell .search-form .field-location {
    grid-column: span 3;
  }

  .controls-shell .search-form .field-radius {
    grid-column: span 2;
  }

  .controls-shell .search-form .field-fuel {
    grid-column: span 2;
  }

  .controls-shell .search-form .search-actions {
    grid-column: 8 / -1;
  }
}

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

  .resize-handle {
    display: none;
  }

  .search-form {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .controls-shell .search-form .field-make,
  .controls-shell .search-form .field-model,
  .controls-shell .search-form .field-keywords,
  .controls-shell .search-form .field-damage {
    grid-column: span 2;
  }

  .controls-shell .search-form .year-pair,
  .controls-shell .search-form .price-pair,
  .controls-shell .search-form .mileage-pair,
  .controls-shell .search-form .field-radius,
  .controls-shell .search-form .field-fuel {
    grid-column: span 2;
  }

  .controls-shell .search-form .field-location {
    grid-column: span 2;
  }

  .controls-shell .search-form .search-actions {
    grid-column: 1 / -1;
  }

  .results-shell {
    grid-column: auto;
  }

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

  .stats-filter-form {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .stats-filter-form .field-make,
  .stats-filter-form .field-model {
    grid-column: span 2;
  }

   .stats-filter-form .field-year,
   .stats-filter-form .field-mileage {
     grid-column: span 2;
   }

  .stats-filter-form .field-days {
    grid-column: span 1;
  }

  .stats-actions {
    grid-column: span 1;
  }
}

@media (max-width: 760px) {
  .shell {
    width: calc(90vw * var(--ui-scale-inverse));
    max-width: calc((100vw - 12px) * var(--ui-scale-inverse));
    margin: 10px auto 24px;
  }

  .hero-heading {
    flex-wrap: wrap;
    gap: 10px;
  }

  .hero-summary {
    margin-left: 0;
    flex-basis: 100%;
    max-width: none;
  }

  .hero-scale-control {
    flex-basis: 100%;
    min-width: 0;
    margin-left: 0;
    justify-items: stretch;
  }

  .hero,
  .panel-inner {
    padding: 18px;
  }

  .search-form {
    grid-template-columns: 1fr;
    gap: 8px;
  }

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

  .stats-filter-form {
    grid-template-columns: 1fr;
  }

  .stats-filter-form > * {
    grid-column: auto !important;
  }

  .stats-range-grid {
    grid-template-columns: 1fr;
  }

  .stats-actions {
    justify-content: stretch;
  }

  .stats-actions .primary {
    width: 100%;
  }

  .stats-summary-grid {
    grid-template-columns: 1fr;
  }

  .input-select-pair {
    grid-template-columns: 1fr;
  }

  .controls-shell .search-form > * {
    grid-column: auto !important;
  }

  .search-actions {
    justify-content: stretch;
  }

  .search-actions .primary,
  .search-actions .subtle {
    width: 100%;
  }

  .results-toolbar {
    grid-template-columns: 1fr;
  }

  .results-header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .modal-overlay {
    padding: 10px;
  }

  .modal-card {
    width: calc((100vw - 20px) * var(--ui-scale-inverse));
    max-height: calc((100vh - 20px) * var(--ui-scale-inverse));
  }

  .modal-media,
  .modal-content {
    margin: 0;
    padding-left: 16px;
    padding-right: 16px;
  }

  .modal-content {
    padding-bottom: 18px;
  }

  .thumb {
    min-height: 200px;
  }
}
