/* Lot Observer — Analytics
 * Loaded only by the analytics view. Inherits the app's tokens from styles.css.
 * Generous vertical rhythm is deliberate: every block gets room to be one idea. */

.analytics { max-width: 1180px; margin: 0 auto; padding: 20px 16px 80px; }

/* ── header + tabs ────────────────────────────────── */
.ac-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ac-top-id span { display: block; color: var(--sent-blue); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.ac-top-id b { display: block; margin-top: 4px; color: var(--text); font-size: 25px; font-weight: 700; letter-spacing: -.02em; }
.ac-top-id i { display: block; margin-top: 3px; color: var(--text-2); font-size: 13px; font-style: normal; font-variant-numeric: tabular-nums; }

/* Every control group here uses the app's chip language (see .chip in
   styles.css): white pill at rest, quiet gray once selected. */
.ac-range { display: flex; gap: 6px; }
.ac-range button { padding: 6px 15px; font-size: 13px; }

/* The row's margin lives on the wrapper, not the scroller: a margin on the
   scroller collapses through the wrapper and drags the arrow out of the row. */
.ac-tabs-wrap { position: relative; margin: 22px 0 6px; }
.ac-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.ac-tabs::-webkit-scrollbar { display: none; }
.ac-tabs button { padding: 9px 17px; font-size: 14px; }

/* Phone-only "there's more this way" nudge on the tab strip. The strip scrolls
   under a fade, and the chevron is hidden the moment you reach the end. */
.ac-tabs-more { position: absolute; top: 0; bottom: 0; right: 0; display: none;
  align-items: center; justify-content: flex-end; width: 54px;
  padding-right: 3px; pointer-events: none; opacity: 0;
  transition: opacity .18s ease;
  background: linear-gradient(to right, transparent, var(--bg) 62%); }
.ac-tabs-more::after { content: ""; width: 8px; height: 8px;
  border-top: 2px solid var(--text-3); border-right: 2px solid var(--text-3);
  border-radius: 1px; transform: rotate(45deg); }
@media (max-width: 819px) {
  .ac-tabs-more { display: flex; }
  .ac-tabs-wrap.has-more .ac-tabs-more { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .ac-tabs-more { transition: none; } }

/* ── section header ───────────────────────────────── */
.ac-head { padding: 30px 2px 6px; }
.ac-head h1 { color: var(--text); font-size: 27px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.ac-head p { max-width: 66ch; margin-top: 7px; color: var(--text-2); font-size: 14px; line-height: 1.5; }
.ac-note { margin-top: 10px !important; padding: 9px 13px; border-radius: 9px; background: var(--border-soft); color: var(--text-2) !important; font-size: 13px !important; }

/* ── stat strip ───────────────────────────────────── */
.ac-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 10px; margin-top: 22px; }
.ac-stat { padding: 15px 16px; border: 1px solid var(--border-soft); border-radius: 14px; background: #FFFFFF; }
.ac-stat span { display: block; color: var(--text-3); font-size: 11px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
.ac-stat strong { display: block; margin-top: 6px; color: var(--text); font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.1; }
.ac-stat small { display: block; margin-top: 4px; color: var(--text-3); font-size: 12px; line-height: 1.35; }
/* A stat that names one vehicle is a button that opens it. */
.ac-stat--link { display: block; width: 100%; text-align: left; font: inherit; cursor: pointer; }
.ac-stat--link small { color: var(--text-2); font-weight: 600; }
.ac-stat--link:active { background: var(--hover); }
.ac-stat--blue { border-color: color-mix(in srgb, var(--sent-blue) 40%, transparent); }
.ac-stat--blue strong { color: var(--sent-blue); }
.ac-stat--amber strong { color: #C97A09; }

/* ── panels ───────────────────────────────────────── */
.ac-panel { margin-top: 26px; border: 1px solid var(--border-soft); border-radius: 16px; background: #FFFFFF; overflow: hidden; }
.ac-panel-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--border-soft); }
.ac-panel-head h2 { color: var(--text); font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.ac-panel-head p { max-width: 62ch; margin-top: 4px; color: var(--text-3); font-size: 13px; line-height: 1.45; }
.ac-two { display: grid; gap: 0 18px; }
.ac-two .ac-panel--compact { margin-top: 18px; }

/* ── controls ─────────────────────────────────────── */
/* Every tab uses the main list's language: a summary of what's applied on the
   left, then Filters and Sort on the right, in that order. */
.ac-filterbar { display: flex; align-items: center; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.ac-filterbar-sum { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; color: var(--text-3); font-size: 13px; }
.ac-filterbar .metabtn { flex-shrink: 0; }

/* Shared chip behaviour for the range, tab and segment groups. */
.ac-range button, .ac-tabs button {
  flex: 0 0 auto; border: 1px solid var(--border-soft); border-radius: var(--r-pill);
  background: #FFFFFF; color: var(--text-2); font-weight: 600; white-space: nowrap;
  cursor: pointer; transition: background .12s ease;
}
.ac-range button:active, .ac-tabs button:active { background: var(--hover); }
.ac-range button.active, .ac-tabs button.active {
  background: var(--hover); color: var(--text); border-color: var(--border);
}
.ac-range button.active:active, .ac-tabs button.active:active { background: var(--active); }

@media (hover: hover) and (pointer: fine) {
  .ac-range button, .ac-tabs button, .ac-row, .ac-card, .ac-stat--link {
    transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease;
  }
  .ac-stat--link:hover { background: var(--hover); border-color: var(--border); }
  .ac-range button:hover, .ac-tabs button:hover {
    background: var(--hover); border-color: var(--border);
  }
  .ac-row:hover { background: var(--hover); }
  .ac-card:hover { border-color: var(--border); box-shadow: 0 10px 30px rgba(15,23,42,.10); }
}

@media (prefers-reduced-motion: reduce) {
  .ac-range button, .ac-tabs button,
  .ac-row, .ac-card, .ac-stat--link { transition: none !important; }
}

/* ── charts ───────────────────────────────────────── */
.ac-chart { padding: 18px 14px 14px; }
.ac-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.ac-grid { stroke: var(--border-soft); stroke-width: 1; }
.ac-ytick, .ac-xtick { fill: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.ac-ytick { text-anchor: end; }
.ac-xtick { text-anchor: middle; }
.ac-line { fill: none; stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.ac-key { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 14px 6px 2px; }
.ac-key span { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 12px; }
.ac-key i { width: 9px; height: 9px; border-radius: 50%; }
.ac-key b { color: var(--text); font-variant-numeric: tabular-nums; }

.ac-bars { padding: 16px 20px 20px; display: grid; gap: 11px; }
.ac-bar { display: grid; grid-template-columns: minmax(78px, 152px) 1fr auto; align-items: center; gap: 12px; }
.ac-bar-label { color: var(--text-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-bar-track { height: 9px; border-radius: var(--r-pill); background: var(--border-soft); overflow: hidden; }
.ac-bar-track i { display: block; height: 100%; border-radius: var(--r-pill); }
.ac-bar-value { display: flex; align-items: baseline; gap: 6px; }
.ac-bar-value b { color: var(--text); font-size: 14px; font-variant-numeric: tabular-nums; }
.ac-bar-value small { color: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }

/* ── vehicle rows ─────────────────────────────────── */
.ac-list { display: grid; }
.ac-list .ac-row + .ac-row { border-top: 1px solid var(--border-soft); }
.ac-list--flush { margin-top: 18px; border: 1px solid var(--border-soft); border-radius: 16px; background: #FFFFFF; overflow: hidden; }
.ac-row { display: grid; grid-template-columns: 74px 1fr auto; align-items: center; gap: 13px; width: 100%; padding: 12px 16px; border: 0; background: transparent; text-align: left; cursor: pointer; font: inherit; }
.ac-row:active { background: var(--border-soft); }
.ac-row-photo { position: relative; width: 74px; height: 54px; border-radius: 9px; background: var(--border-soft); overflow: hidden; }
.ac-row-photo img { width: 100%; height: 100%; object-fit: cover; }
.ac-row-noimg { display: block; width: 100%; height: 100%; background: var(--border-soft); }
.ac-row-sold { position: absolute; left: 4px; bottom: 4px; padding: 2px 6px; border-radius: 5px; background: #F05A47; color: #fff; font-size: 9px; font-weight: 800; letter-spacing: .06em; }
.ac-row-main { min-width: 0; }
.ac-row-main strong { display: block; color: var(--text); font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-row-trim { display: block; margin-top: 1px; color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-row-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.ac-tag { padding: 2px 7px; border-radius: var(--r-pill); background: var(--border-soft); color: var(--text-3); font-size: 10.5px; font-style: normal; font-weight: 600; white-space: nowrap; }
.ac-tag--new { background: color-mix(in srgb, var(--sent-blue) 15%, transparent); color: var(--sent-blue); }
.ac-tag--used { background: color-mix(in srgb, #F05A47 15%, transparent); color: #C8412F; }
.ac-tag--in_transit { background: color-mix(in srgb, #F59E0B 18%, transparent); color: #A56A05; }
/* "Possible" — qualifies on our clock, but the desk should confirm it. */
.ac-tag--maybe { background: color-mix(in srgb, #F59E0B 22%, transparent); color: #8A5A05; }
.ac-row-value { text-align: right; white-space: nowrap; }
.ac-row-value b { display: block; color: var(--text); font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ac-row-value small { display: block; margin-top: 1px; color: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.ac-drop { color: #C8412F !important; }
.ac-ladder s { color: var(--text-3); text-decoration: line-through; }

/* ── sold archive cards ───────────────────────────── */
.ac-archive { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-top: 20px; }
.ac-card { display: block; width: 100%; padding: 0; border: 1px solid var(--border-soft); border-radius: 15px; background: #FFFFFF; overflow: hidden; text-align: left; cursor: pointer; font: inherit; }
.ac-card:active { transform: scale(.99); }
.ac-card-photo { position: relative; display: block; aspect-ratio: 4 / 3; background: var(--border-soft); }
.ac-card-photo img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.72) brightness(.94); }
.ac-card-sold { position: absolute; top: 9px; left: 9px; padding: 5px 11px; border-radius: 7px; background: #F05A47; color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .09em; box-shadow: 0 2px 8px rgba(0,0,0,.28); }
.ac-card-body { display: block; padding: 12px 13px 14px; }
.ac-card-body strong { display: block; color: var(--text); font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-card-body > small { display: block; margin-top: 1px; color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-card-price { display: block; margin-top: 7px; color: var(--text); font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ac-card-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.ac-card-meta i { padding: 2px 7px; border-radius: var(--r-pill); background: var(--border-soft); color: var(--text-3); font-size: 10.5px; font-style: normal; font-weight: 600; }

/* ── table ────────────────────────────────────────── */
.ac-table { overflow-x: auto; }
.ac-table-head, .ac-table-row { display: grid; grid-template-columns: minmax(120px, 1.6fr) repeat(5, minmax(64px, .7fr)); gap: 10px; padding: 11px 20px; align-items: center; }
.ac-table-head { color: var(--text-3); font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.ac-table-row { border-top: 1px solid var(--border-soft); color: var(--text-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.ac-table-row span:first-child { color: var(--text); font-weight: 600; }
.ac-table-row b { color: var(--text); }

.ac-empty { padding: 34px 20px; color: var(--text-3); font-size: 13.5px; text-align: center; }

@media (min-width: 820px) {
  .analytics { padding: 26px 28px 96px; }
  .ac-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ac-head { padding-top: 34px; }
  .ac-archive { grid-template-columns: repeat(auto-fill, minmax(252px, 1fr)); }
}
