/* ==========================================================================
   AUTOMOTIVE INVENTORY IMPORTER — PORTABLE FRONTEND STYLESHEET
   --------------------------------------------------------------------------
   Theme-agnostic WordPress plugin styles. Everything is:
     • Scoped under the root container class .aii
     • Namespaced with the aii- prefix (no global selectors)
     • Driven by CSS custom properties that INHERIT the host theme's identity
       (fonts + accent) and FALL BACK to hardcoded, self-contained values.

   Lift this file straight into the plugin's stylesheet. The host theme can
   re-skin the whole plugin by overriding a handful of variables on .aii.
   ========================================================================== */


/* ==========================================================================
   1. DESIGN TOKENS  (light / default)
   --------------------------------------------------------------------------
   Token            | Controls                | Inherits from (theme)        | Fallback
   -----------------|-------------------------|------------------------------|---------
   --aii-font-base  | all body/UI text        | --wp--preset--font-family--* | Hanken Grotesk stack
   --aii-font-mono  | VIN / stock #           | (none)                       | mono stack
   --aii-color-accent| price, CTA, links      | --wp--preset--color--primary | #2563eb
   --aii-color-text | foreground text         | --wp--preset--color--fg      | #14181f
   --aii-color-bg   | page canvas             | --wp--preset--color--bg      | #f6f7f9
   ...full table documented in the showcase token panel.
   ========================================================================== */

.aii {
  /* ---- Typography: INHERIT theme fonts, fall back to a branded grotesk ---- */
  --aii-font-base: var(--wp--preset--font-family--body,
                   var(--wp--preset--font-family--base,
                   'Hanken Grotesk', system-ui, -apple-system, Segoe UI, Roboto, sans-serif));
  --aii-font-heading: var(--wp--preset--font-family--heading, var(--aii-font-base));
  --aii-font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Fluid type scale — relative units so it tracks the host root size */
  --aii-fs-display: clamp(1.75rem, 1.2rem + 2.4cqi, 2.5rem);   /* price hero    */
  --aii-fs-price:   clamp(1.375rem, 1.05rem + 1.4cqi, 1.75rem);/* card price    */
  --aii-fs-h1:      clamp(1.375rem, 1.1rem + 1.1cqi, 1.75rem); /* page title    */
  --aii-fs-h2:      clamp(1.125rem, 1rem + 0.6cqi, 1.3125rem); /* section title */
  --aii-fs-title:   1.0625rem;                                  /* card title    */
  --aii-fs-body:    0.9375rem;                                  /* body          */
  --aii-fs-sm:      0.8125rem;                                  /* secondary     */
  --aii-fs-spec:    0.78125rem;                                 /* spec pills    */
  --aii-fs-xs:      0.6875rem;                                  /* badges/labels */
  --aii-lh-tight: 1.15;
  --aii-lh-snug: 1.32;
  --aii-lh-base: 1.55;
  --aii-fw-regular: 450;
  --aii-fw-medium: 550;
  --aii-fw-semibold: 650;
  --aii-fw-bold: 760;

  /* ---- Color: structural neutrals own the surfaces, accent inherits ------- */
  --aii-color-bg:        var(--wp--preset--color--background, #f5f6f8);
  --aii-color-surface:   #ffffff;
  --aii-color-surface-2: #f3f4f6;   /* alt rows, soft fills      */
  --aii-color-surface-3: #e9ebef;   /* placeholders, skeletons   */
  --aii-color-text:      var(--wp--preset--color--foreground, var(--wp--preset--color--contrast, #14181f));
  --aii-color-text-muted:#5a6271;
  --aii-color-text-subtle:#878e9c;
  --aii-color-border:    color-mix(in srgb, var(--aii-color-text) 13%, transparent);
  --aii-color-border-strong: color-mix(in srgb, var(--aii-color-text) 24%, transparent);

  --aii-color-accent:    var(--wp--preset--color--primary,
                         var(--wp--preset--color--accent,
                         var(--wp--preset--color--link, #2563eb)));
  --aii-color-accent-hover: color-mix(in srgb, var(--aii-color-accent) 84%, #000);
  --aii-color-accent-contrast: #ffffff;            /* text on accent */
  --aii-color-accent-soft: color-mix(in srgb, var(--aii-color-accent) 12%, var(--aii-color-surface));
  --aii-color-accent-ring: color-mix(in srgb, var(--aii-color-accent) 40%, transparent);

  --aii-color-price: var(--aii-color-text);        /* price = strongest neutral */

  /* Status / condition system */
  --aii-color-new:       #15803d;
  --aii-color-new-soft:  #e7f6ec;
  --aii-color-used:      #475467;
  --aii-color-used-soft: #eef0f4;
  --aii-color-certified: #1d63d8;
  --aii-color-certified-soft:#e8f0fe;
  --aii-color-sold:      #b42318;
  --aii-color-sold-soft: #fdeceb;
  --aii-color-success:   #15803d;
  --aii-color-success-soft:#e7f6ec;
  --aii-color-danger:    #d92d20;
  --aii-color-danger-soft:#fdeceb;
  --aii-color-warning:   #b54708;

  /* Pro / upsell — premium amber, kept distinct from the accent */
  --aii-color-pro:       #92590b;
  --aii-color-pro-ink:   #6f4406;
  --aii-color-pro-soft:  #fbf2dd;
  --aii-color-pro-border:#e7c878;

  /* ---- Radius ------------------------------------------------------------- */
  --aii-radius-sm: 7px;
  --aii-radius-md: 11px;
  --aii-radius-lg: 16px;
  --aii-radius-pill: 999px;

  /* ---- Elevation ---------------------------------------------------------- */
  --aii-shadow-xs: 0 1px 2px rgba(16,24,40,.06);
  --aii-shadow-card: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --aii-shadow-card-hover: 0 6px 16px rgba(16,24,40,.12), 0 2px 6px rgba(16,24,40,.08);
  --aii-shadow-pop: 0 12px 34px rgba(16,24,40,.18), 0 4px 12px rgba(16,24,40,.10);
  --aii-shadow-drawer: -8px 0 32px rgba(16,24,40,.22);

  /* ---- Spacing scale (4px base) ------------------------------------------- */
  --aii-space-1: 4px;
  --aii-space-2: 8px;
  --aii-space-3: 12px;
  --aii-space-4: 16px;
  --aii-space-5: 20px;
  --aii-space-6: 24px;
  --aii-space-7: 32px;
  --aii-space-8: 40px;
  --aii-space-9: 48px;
  --aii-space-10: 64px;

  /* ---- Motion ------------------------------------------------------------- */
  --aii-ease: cubic-bezier(.2, .6, .2, 1);
  --aii-transition-fast: 120ms var(--aii-ease);
  --aii-transition-base: 200ms var(--aii-ease);
  --aii-transition-slow: 320ms var(--aii-ease);

  /* ---- Layout ------------------------------------------------------------- */
  --aii-card-min: 270px;          /* min card width before the grid reflows  */
  --aii-maxw: 1280px;

  /* root behaviour */
  color: var(--aii-color-text);
  background: transparent;
  font-family: var(--aii-font-base);
  font-size: var(--aii-fs-body);
  line-height: var(--aii-lh-base);
  font-weight: var(--aii-fw-regular);
}

/* ==========================================================================
   2. DARK THEME TOKENS
   --------------------------------------------------------------------------
   Applied explicitly via [data-theme="dark"] and automatically under a dark
   host theme via prefers-color-scheme. Surfaces are DERIVED from tokens — we
   never assume a white page background.
   ========================================================================== */

.aii[data-theme="dark"] {
  --aii-color-bg:        var(--wp--preset--color--background, #0e1116);
  --aii-color-surface:   #161b22;
  --aii-color-surface-2: #1c222b;
  --aii-color-surface-3: #283039;
  --aii-color-text:      var(--wp--preset--color--foreground, #e7ebf1);
  --aii-color-text-muted:#9aa4b2;
  --aii-color-text-subtle:#727d8c;
  --aii-color-border:    color-mix(in srgb, #ffffff 14%, transparent);
  --aii-color-border-strong: color-mix(in srgb, #ffffff 26%, transparent);
  --aii-color-accent:    var(--wp--preset--color--primary,
                         var(--wp--preset--color--accent, #5b9cff));
  --aii-color-accent-hover: color-mix(in srgb, var(--aii-color-accent) 82%, #fff);
  --aii-color-accent-soft: color-mix(in srgb, var(--aii-color-accent) 20%, var(--aii-color-surface));

  --aii-color-new-soft:  color-mix(in srgb, var(--aii-color-new) 26%, #0e1116);
  --aii-color-used:      #9aa4b2;
  --aii-color-used-soft: #232a33;
  --aii-color-certified: #6aa3ff;
  --aii-color-certified-soft: color-mix(in srgb, #6aa3ff 22%, #0e1116);
  --aii-color-sold:      #ff7a6e;
  --aii-color-sold-soft: color-mix(in srgb, #ff7a6e 18%, #0e1116);
  --aii-color-success:   #4ade80;
  --aii-color-success-soft: color-mix(in srgb, #4ade80 20%, #0e1116);
  --aii-color-danger:    #ff6b5e;
  --aii-color-danger-soft: color-mix(in srgb, #ff6b5e 16%, #0e1116);

  --aii-color-pro:       #f0c25b;
  --aii-color-pro-ink:   #f3cd74;
  --aii-color-pro-soft:  color-mix(in srgb, #f0c25b 16%, #0e1116);
  --aii-color-pro-border:color-mix(in srgb, #f0c25b 40%, transparent);

  --aii-shadow-xs: 0 1px 2px rgba(0,0,0,.4);
  --aii-shadow-card: 0 1px 2px rgba(0,0,0,.45), 0 2px 6px rgba(0,0,0,.4);
  --aii-shadow-card-hover: 0 8px 22px rgba(0,0,0,.55);
  --aii-shadow-pop: 0 14px 40px rgba(0,0,0,.6);
  --aii-shadow-drawer: -8px 0 36px rgba(0,0,0,.6);
}

/* Auto dark when the host theme is dark and no explicit override is set */
@media (prefers-color-scheme: dark) {
  .aii:not([data-theme="light"]):not([data-theme="dark"]) {
    --aii-color-bg:        var(--wp--preset--color--background, #0e1116);
    --aii-color-surface:   #161b22;
    --aii-color-surface-2: #1c222b;
    --aii-color-surface-3: #283039;
    --aii-color-text:      var(--wp--preset--color--foreground, #e7ebf1);
    --aii-color-text-muted:#9aa4b2;
    --aii-color-text-subtle:#727d8c;
    --aii-color-border:    color-mix(in srgb, #ffffff 14%, transparent);
    --aii-color-border-strong: color-mix(in srgb, #ffffff 26%, transparent);
    --aii-color-accent-soft: color-mix(in srgb, var(--aii-color-accent) 20%, #161b22);
  }
}


/* ==========================================================================
   3. DEFENSIVE RESET / BASE  (scoped to .aii ONLY)
   --------------------------------------------------------------------------
   Neutralises inherited host-theme styles so components render predictably,
   without leaking any rule outside .aii.
   ========================================================================== */

.aii, .aii *, .aii *::before, .aii *::after { box-sizing: border-box; }

.aii {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.aii :where(h1, h2, h3, h4, p, ul, ol, li, figure, dl, dd) { margin: 0; padding: 0; }
.aii :where(ul, ol) { list-style: none; }
.aii :where(img, svg, video) { display: block; max-width: 100%; }
.aii :where(button) {
  font: inherit; color: inherit; letter-spacing: inherit;
  margin: 0; padding: 0; border: 0; background: none; cursor: pointer;
  -webkit-appearance: none; appearance: none;
}
.aii :where(input, select, textarea) {
  font: inherit; color: inherit; margin: 0;
}
.aii :where(a) { color: inherit; text-decoration: none; }
.aii :where(table) { border-collapse: collapse; width: 100%; }

/* One global, consistent focus ring for everything inside .aii */
.aii :where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--aii-color-accent);
  outline-offset: 2px;
  border-radius: var(--aii-radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  .aii, .aii * {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}


/* ==========================================================================
   4. PRIMITIVES — badges, buttons, pills, fields
   ========================================================================== */

/* ---- Badges ------------------------------------------------------------- */
.aii-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--aii-fs-xs); font-weight: var(--aii-fw-bold);
  letter-spacing: .04em; text-transform: uppercase;
  line-height: 1; padding: 5px 9px; border-radius: var(--aii-radius-sm);
  white-space: nowrap;
}
.aii-badge--new       { color: var(--aii-color-new);       background: var(--aii-color-new-soft); }
.aii-badge--used      { color: var(--aii-color-used);      background: var(--aii-color-used-soft); }
.aii-badge--certified { color: var(--aii-color-certified); background: var(--aii-color-certified-soft); }
.aii-badge--sold      { color: #fff; background: var(--aii-color-sold); }
.aii-badge--location  {
  color: var(--aii-color-text-muted); background: var(--aii-color-surface);
  border: 1px solid var(--aii-color-border); text-transform: none;
  letter-spacing: 0; font-weight: var(--aii-fw-semibold);
}
.aii-badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Pro badge — one consistent premium marker token */
.aii-badge--pro {
  color: var(--aii-color-pro-ink); background: var(--aii-color-pro-soft);
  border: 1px solid var(--aii-color-pro-border);
}
.aii-badge--pro::before {
  content: ""; width: 0; height: 0; margin-right: 1px;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-bottom: 7px solid currentColor;
}

/* ---- Buttons ------------------------------------------------------------ */
.aii-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-size: var(--aii-fs-body); font-weight: var(--aii-fw-semibold);
  line-height: 1; padding: 11px 18px; border-radius: var(--aii-radius-md);
  border: 1px solid transparent; cursor: pointer;
  transition: background var(--aii-transition-fast), border-color var(--aii-transition-fast),
              transform var(--aii-transition-fast), box-shadow var(--aii-transition-fast), color var(--aii-transition-fast);
  user-select: none; text-align: center;
}
.aii-btn:active { transform: translateY(1px); }
.aii-btn[disabled], .aii-btn.is-disabled { cursor: not-allowed; opacity: .5; transform: none; }

.aii-btn--primary {
  background: var(--aii-color-accent); color: var(--aii-color-accent-contrast);
  box-shadow: var(--aii-shadow-xs);
}
.aii-btn--primary:hover { background: var(--aii-color-accent-hover); }
.aii-btn--secondary {
  background: var(--aii-color-surface); color: var(--aii-color-text);
  border-color: var(--aii-color-border-strong);
}
.aii-btn--secondary:hover { background: var(--aii-color-surface-2); border-color: var(--aii-color-text-subtle); }
.aii-btn--ghost { background: transparent; color: var(--aii-color-accent); padding-inline: 10px; }
.aii-btn--ghost:hover { background: var(--aii-color-accent-soft); }
.aii-btn--block { width: 100%; }
.aii-btn--sm { padding: 8px 13px; font-size: var(--aii-fs-sm); border-radius: var(--aii-radius-sm); }
.aii-btn--lg { padding: 14px 22px; font-size: var(--aii-fs-title); }

/* ---- Spec pills --------------------------------------------------------- */
.aii-spec {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--aii-fs-spec); font-weight: var(--aii-fw-medium);
  color: var(--aii-color-text-muted);
  padding: 4px 9px 4px 7px; border-radius: var(--aii-radius-pill);
  background: var(--aii-color-surface-2); white-space: nowrap;
}
.aii-spec__ic { width: 14px; height: 14px; color: var(--aii-color-text-subtle); flex: none; }

/* ---- Form fields -------------------------------------------------------- */
.aii-field { display: flex; flex-direction: column; gap: 6px; }
.aii-label {
  font-size: var(--aii-fs-sm); font-weight: var(--aii-fw-semibold);
  color: var(--aii-color-text); display: flex; align-items: center; gap: 6px;
}
.aii-label__req { color: var(--aii-color-danger); }
.aii-input, .aii-select, .aii-textarea {
  width: 100%; font-family: inherit; font-size: var(--aii-fs-body);
  color: var(--aii-color-text); background: var(--aii-color-surface);
  border: 1px solid var(--aii-color-border-strong); border-radius: var(--aii-radius-md);
  padding: 10px 12px; transition: border-color var(--aii-transition-fast), box-shadow var(--aii-transition-fast);
}
.aii-input::placeholder, .aii-textarea::placeholder { color: var(--aii-color-text-subtle); }
.aii-textarea { min-height: 96px; resize: vertical; line-height: var(--aii-lh-snug); }
.aii-select {
  -webkit-appearance: none; appearance: none; cursor: pointer; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23878e9c' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
}
.aii-input:focus, .aii-select:focus, .aii-textarea:focus {
  outline: none; border-color: var(--aii-color-accent);
  box-shadow: 0 0 0 3px var(--aii-color-accent-ring);
}
.aii-input:disabled, .aii-select:disabled {
  background: var(--aii-color-surface-2); color: var(--aii-color-text-subtle); cursor: not-allowed;
}
.aii-field.is-error .aii-input,
.aii-field.is-error .aii-select,
.aii-field.is-error .aii-textarea { border-color: var(--aii-color-danger); }
.aii-field.is-error .aii-input:focus,
.aii-field.is-error .aii-textarea:focus { box-shadow: 0 0 0 3px var(--aii-color-danger-soft); }
.aii-field__error {
  display: none; align-items: center; gap: 5px;
  font-size: var(--aii-fs-sm); color: var(--aii-color-danger); font-weight: var(--aii-fw-medium);
}
.aii-field.is-error .aii-field__error { display: flex; }

/* Input with leading icon (search) */
.aii-input-icon { position: relative; }
.aii-input-icon .aii-input { padding-left: 38px; }
.aii-input-icon__ic {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--aii-color-text-subtle); pointer-events: none;
}

/* Checkbox */
.aii-check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.aii-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.aii-check__box {
  flex: none; width: 20px; height: 20px; margin-top: 1px; border-radius: 6px;
  border: 1.5px solid var(--aii-color-border-strong); background: var(--aii-color-surface);
  display: grid; place-items: center; transition: all var(--aii-transition-fast);
}
.aii-check__box svg { width: 12px; height: 12px; color: #fff; opacity: 0; transform: scale(.6); transition: all var(--aii-transition-fast); }
.aii-check input:checked + .aii-check__box { background: var(--aii-color-accent); border-color: var(--aii-color-accent); }
.aii-check input:checked + .aii-check__box svg { opacity: 1; transform: scale(1); }
.aii-check input:focus-visible + .aii-check__box { outline: 2px solid var(--aii-color-accent); outline-offset: 2px; }
.aii-check__text { font-size: var(--aii-fs-body); color: var(--aii-color-text); line-height: var(--aii-lh-snug); }
.aii-check__text small { display: block; color: var(--aii-color-text-muted); font-size: var(--aii-fs-sm); }


/* ==========================================================================
   5. MEDIA PLACEHOLDER  (no-photo state — always branded, never broken)
   ========================================================================== */
.aii-photo {
  position: relative; aspect-ratio: 4 / 3; overflow: hidden;
  background: var(--aii-color-surface-3); isolation: isolate;
}
.aii-photo--demo {                /* stand-in for a real vehicle photo (--g varies the tint) */
  --g-hue: calc(202deg + var(--g, 0) * 38deg);
  background:
    radial-gradient(120% 90% at 78% 116%, hsl(var(--g-hue) 24% 38% / .55), transparent 62%),
    linear-gradient(150deg, hsl(var(--g-hue) 22% 86%), hsl(var(--g-hue) 16% 74%) 58%, hsl(var(--g-hue) 14% 64%));
}
.aii[data-theme="dark"] .aii-photo--demo {
  background:
    radial-gradient(120% 90% at 78% 116%, hsl(var(--g-hue) 30% 30% / .7), transparent 62%),
    linear-gradient(150deg, hsl(var(--g-hue) 18% 34%), hsl(var(--g-hue) 16% 26%) 58%, hsl(var(--g-hue) 14% 20%));
}
.aii-photo--demo::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,.14), transparent 36%),
    linear-gradient(0deg, rgba(0,0,0,.16), transparent 40%);
}
/* Faint vehicle silhouette so a demo slot reads as 'photo', not a broken image */
.aii-car-watermark {
  position: absolute; inset: 0; z-index: 1; opacity: .26;
  background: center 62% / 64% no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 54' fill='none' stroke='%23ffffff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 38l5-16a7 7 0 0 1 6.6-4.8h44.8A7 7 0 0 1 76 19l9 6 22 4a6 6 0 0 1 5 6v3H12a4 4 0 0 1-4-4Z'/%3E%3Ccircle cx='34' cy='40' r='7'/%3E%3Ccircle cx='90' cy='40' r='7'/%3E%3C/svg%3E");
}
.aii[data-theme="dark"] .aii-car-watermark { opacity: .2; }
.aii-photo__placeholder {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; color: var(--aii-color-text-subtle);
}
.aii-photo__placeholder svg { width: 40px; height: 40px; opacity: .55; }
.aii-photo__placeholder span { font-size: var(--aii-fs-sm); font-weight: var(--aii-fw-medium); }
.aii-photo__count {
  position: absolute; right: 10px; bottom: 10px; z-index: 2;
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--aii-fs-xs); font-weight: var(--aii-fw-semibold); color: #fff;
  background: rgba(16,24,40,.66); backdrop-filter: blur(3px);
  padding: 4px 8px; border-radius: var(--aii-radius-pill);
}
.aii-photo__count svg { width: 12px; height: 12px; }


/* ==========================================================================
   6. CARD GRID  (container-query driven — fluid 1→3+ columns)
   ========================================================================== */
.aii-grid {
  container-type: inline-size;
  display: grid; gap: var(--aii-space-5);
  grid-template-columns: repeat(auto-fill, minmax(min(var(--aii-card-min), 100%), 1fr));
}

.aii-card {
  display: flex; flex-direction: column;
  background: var(--aii-color-surface); border: 1px solid var(--aii-color-border);
  border-radius: var(--aii-radius-lg); overflow: hidden;
  box-shadow: var(--aii-shadow-card);
  transition: transform var(--aii-transition-base), box-shadow var(--aii-transition-base), border-color var(--aii-transition-base);
}
.aii-card:hover { transform: translateY(-3px); box-shadow: var(--aii-shadow-card-hover); border-color: var(--aii-color-border-strong); }
.aii-card:focus-within { border-color: var(--aii-color-accent); }
.aii-card__media { position: relative; }
.aii-card__badges { position: absolute; top: 10px; left: 10px; z-index: 2; display: flex; gap: 6px; flex-wrap: wrap; }
.aii-card__fav {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--aii-color-surface); color: var(--aii-color-text-muted);
  box-shadow: var(--aii-shadow-xs); transition: color var(--aii-transition-fast), transform var(--aii-transition-fast);
}
.aii-card__fav:hover { color: var(--aii-color-sold); transform: scale(1.08); }
.aii-card__fav svg { width: 17px; height: 17px; }

.aii-card__body { display: flex; flex-direction: column; gap: var(--aii-space-3); padding: var(--aii-space-4); flex: 1; }
.aii-card__pricerow { display: flex; align-items: baseline; justify-content: space-between; gap: var(--aii-space-3); }
.aii-card__price {
  font-family: var(--aii-font-heading); font-size: var(--aii-fs-price);
  font-weight: var(--aii-fw-bold); color: var(--aii-color-price);
  letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1;
}
.aii-card__price small { font-size: var(--aii-fs-sm); font-weight: var(--aii-fw-medium); color: var(--aii-color-text-subtle); }
.aii-card__msrp { font-size: var(--aii-fs-sm); color: var(--aii-color-text-subtle); text-decoration: line-through; font-variant-numeric: tabular-nums; }
.aii-card__title {
  font-family: var(--aii-font-heading); font-size: var(--aii-fs-title);
  font-weight: var(--aii-fw-semibold); color: var(--aii-color-text); line-height: var(--aii-lh-snug);
  text-wrap: balance;
}
.aii-card__title a:hover { color: var(--aii-color-accent); }
.aii-card__trim { font-size: var(--aii-fs-sm); color: var(--aii-color-text-muted); font-weight: var(--aii-fw-regular); }
.aii-card__specs { display: flex; flex-wrap: wrap; gap: 6px; }
.aii-card__meta {
  display: flex; align-items: center; justify-content: space-between; gap: var(--aii-space-3);
  margin-top: auto; padding-top: var(--aii-space-3); border-top: 1px solid var(--aii-color-border);
}
.aii-card__loc { display: inline-flex; align-items: center; gap: 5px; font-size: var(--aii-fs-sm); color: var(--aii-color-text-muted); min-width: 0; }
.aii-card__loc svg { width: 13px; height: 13px; flex: none; }
.aii-card__loc span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aii-card__cta { font-size: var(--aii-fs-sm); font-weight: var(--aii-fw-semibold); color: var(--aii-color-accent); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.aii-card__cta svg { width: 14px; height: 14px; transition: transform var(--aii-transition-fast); }
.aii-card:hover .aii-card__cta svg { transform: translateX(2px); }

/* Sold / status overlay variant */
.aii-card--sold .aii-card__media::after {
  content: ""; position: absolute; inset: 0; background: rgba(16,24,40,.45); z-index: 1;
}
.aii-card--sold .aii-card__price { color: var(--aii-color-text-subtle); }

/* Horizontal card variant (variant B) */
.aii-card--row { flex-direction: row; }
.aii-card--row .aii-card__media { flex: 0 0 42%; }
.aii-card--row .aii-photo { aspect-ratio: auto; height: 100%; min-height: 170px; }
@container (max-width: 460px) {
  .aii-card--row { flex-direction: column; }
  .aii-card--row .aii-photo { aspect-ratio: 4/3; height: auto; }
}


/* ==========================================================================
   7. FREE SEARCH BAR
   ========================================================================== */
.aii-searchbar {
  display: grid; gap: var(--aii-space-3); align-items: end;
  grid-template-columns: 1fr; padding: var(--aii-space-4);
  background: var(--aii-color-surface); border: 1px solid var(--aii-color-border);
  border-radius: var(--aii-radius-lg); box-shadow: var(--aii-shadow-card);
  container-type: inline-size;
}
@container (min-width: 720px) {
  .aii-searchbar { grid-template-columns: 2fr 1fr 1fr 1fr auto; }
}
.aii-searchbar__submit { align-self: end; }
.aii-applied { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: var(--aii-space-3); }
.aii-applied__label { font-size: var(--aii-fs-sm); color: var(--aii-color-text-muted); font-weight: var(--aii-fw-medium); }


/* ==========================================================================
   8. CHIPS  (removable multi-select tags)
   ========================================================================== */
.aii-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: var(--aii-fs-sm); font-weight: var(--aii-fw-medium); color: var(--aii-color-text);
  background: var(--aii-color-accent-soft); border: 1px solid color-mix(in srgb, var(--aii-color-accent) 22%, transparent);
  padding: 5px 7px 5px 11px; border-radius: var(--aii-radius-pill);
}
.aii-chip__x {
  display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  color: var(--aii-color-text-muted); background: color-mix(in srgb, var(--aii-color-text) 8%, transparent);
  transition: background var(--aii-transition-fast), color var(--aii-transition-fast);
}
.aii-chip__x:hover { background: var(--aii-color-accent); color: #fff; }
.aii-chip__x svg { width: 9px; height: 9px; }
.aii-chip--clear { background: transparent; border: 1px dashed var(--aii-color-border-strong); color: var(--aii-color-text-muted); padding: 5px 12px; }
.aii-chip--clear:hover { border-color: var(--aii-color-danger); color: var(--aii-color-danger); }


/* ==========================================================================
   9. PRO FILTERS  (sidebar + range slider + mileage)
   ========================================================================== */
.aii-filters {
  background: var(--aii-color-surface); border: 1px solid var(--aii-color-border);
  border-radius: var(--aii-radius-lg); box-shadow: var(--aii-shadow-card);
  overflow: hidden;
}
.aii-filters__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--aii-space-4) var(--aii-space-5); border-bottom: 1px solid var(--aii-color-border);
}
.aii-filters__title { font-size: var(--aii-fs-h2); font-weight: var(--aii-fw-bold); font-family: var(--aii-font-heading); }
.aii-filters__body { display: flex; flex-direction: column; }
.aii-fgroup { padding: var(--aii-space-4) var(--aii-space-5); border-bottom: 1px solid var(--aii-color-border); }
.aii-fgroup:last-child { border-bottom: 0; }
.aii-fgroup__label { font-size: var(--aii-fs-sm); font-weight: var(--aii-fw-bold); text-transform: uppercase; letter-spacing: .05em; color: var(--aii-color-text-muted); margin-bottom: var(--aii-space-3); display: block; }
.aii-fgroup__chips { display: flex; flex-wrap: wrap; gap: 7px; }

/* Option toggle (multi-select pills inside filter groups) */
.aii-opt {
  font-size: var(--aii-fs-sm); font-weight: var(--aii-fw-medium); color: var(--aii-color-text-muted);
  background: var(--aii-color-surface-2); border: 1px solid transparent;
  padding: 6px 12px; border-radius: var(--aii-radius-pill); transition: all var(--aii-transition-fast);
}
.aii-opt:hover { color: var(--aii-color-text); border-color: var(--aii-color-border-strong); }
.aii-opt.is-active { color: var(--aii-color-accent); background: var(--aii-color-accent-soft); border-color: color-mix(in srgb, var(--aii-color-accent) 30%, transparent); }

/* Dual range slider */
.aii-range { padding-top: 4px; }
.aii-range__track { position: relative; height: 30px; display: flex; align-items: center; }
.aii-range__rail { position: absolute; inset-inline: 0; height: 5px; border-radius: 999px; background: var(--aii-color-surface-3); }
.aii-range__fill { position: absolute; height: 5px; border-radius: 999px; background: var(--aii-color-accent); }
.aii-range input[type="range"] {
  position: absolute; inset-inline: 0; width: 100%; margin: 0; background: none;
  pointer-events: none; -webkit-appearance: none; appearance: none; height: 30px;
}
.aii-range input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; pointer-events: auto;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--aii-color-surface); border: 2px solid var(--aii-color-accent);
  box-shadow: var(--aii-shadow-xs); cursor: grab; margin-top: 0;
}
.aii-range input[type="range"]::-webkit-slider-thumb:active { cursor: grabbing; box-shadow: 0 0 0 6px var(--aii-color-accent-ring); }
.aii-range input[type="range"]::-moz-range-thumb {
  pointer-events: auto; width: 20px; height: 20px; border-radius: 50%;
  background: var(--aii-color-surface); border: 2px solid var(--aii-color-accent); cursor: grab;
}
.aii-range input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--aii-color-accent-ring); }
.aii-range__inputs { display: flex; align-items: center; gap: 10px; margin-top: var(--aii-space-3); }
.aii-range__inputs .aii-input { padding: 8px 10px; font-variant-numeric: tabular-nums; }
.aii-range__sep { color: var(--aii-color-text-subtle); }


/* ==========================================================================
   10. MOBILE FILTER DRAWER (off-canvas)
   ========================================================================== */
.aii-drawer { position: fixed; inset: 0; z-index: 60; display: none; }
.aii-drawer.is-open { display: block; }
.aii-drawer__scrim {
  position: absolute; inset: 0; background: rgba(16,24,40,.5);
  opacity: 0; transition: opacity var(--aii-transition-base);
}
.aii-drawer.is-open .aii-drawer__scrim { opacity: 1; }
.aii-drawer__panel {
  position: absolute; top: 0; right: 0; height: 100%; width: min(420px, 88vw);
  background: var(--aii-color-bg); box-shadow: var(--aii-shadow-drawer);
  display: flex; flex-direction: column; transform: translateX(100%);
  transition: transform var(--aii-transition-slow);
}
.aii-drawer.is-open .aii-drawer__panel { transform: translateX(0); }
.aii-drawer__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--aii-space-4) var(--aii-space-5);
  border-bottom: 1px solid var(--aii-color-border); background: var(--aii-color-surface);
}
.aii-drawer__title { font-family: var(--aii-font-heading); font-size: var(--aii-fs-h2); font-weight: var(--aii-fw-bold); }
.aii-drawer__close { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--aii-color-text-muted); background: var(--aii-color-surface-2); }
.aii-drawer__close:hover { background: var(--aii-color-surface-3); }
.aii-drawer__close svg { width: 16px; height: 16px; }
.aii-drawer__body { flex: 1; overflow-y: auto; padding: 0; }
.aii-drawer__body .aii-fgroup { background: var(--aii-color-surface); margin-bottom: var(--aii-space-3); border-radius: var(--aii-radius-md); border: 1px solid var(--aii-color-border); }
.aii-drawer__body { padding: var(--aii-space-4); display: flex; flex-direction: column; }
.aii-drawer__foot {
  display: flex; gap: var(--aii-space-3); padding: var(--aii-space-4) var(--aii-space-5);
  border-top: 1px solid var(--aii-color-border); background: var(--aii-color-surface);
}
.aii-drawer__foot .aii-btn { flex: 1; }
.aii-drawer__count { font-size: var(--aii-fs-sm); color: var(--aii-color-text-muted); }
.aii-drawer__count b { color: var(--aii-color-text); font-weight: var(--aii-fw-bold); }


/* ==========================================================================
   11. RESULTS / LOADING STATES
   ========================================================================== */
.aii-resultbar { display: flex; align-items: center; justify-content: space-between; gap: var(--aii-space-3); flex-wrap: wrap; margin-bottom: var(--aii-space-4); }
.aii-resultbar__count { font-size: var(--aii-fs-body); color: var(--aii-color-text-muted); }
.aii-resultbar__count b { color: var(--aii-color-text); font-weight: var(--aii-fw-bold); }
.aii-resultbar__sort { display: flex; align-items: center; gap: 8px; }

.aii-skeleton { position: relative; overflow: hidden; background: var(--aii-color-surface-3); border-radius: var(--aii-radius-sm); }
.aii-skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--aii-color-surface) 55%, transparent), transparent);
  transform: translateX(-100%); animation: aii-shimmer 1.4s infinite;
}
@keyframes aii-shimmer { 100% { transform: translateX(100%); } }
.aii-skel-card { border: 1px solid var(--aii-color-border); border-radius: var(--aii-radius-lg); overflow: hidden; background: var(--aii-color-surface); }
.aii-skel-card__media { aspect-ratio: 4/3; }
.aii-skel-card__body { padding: var(--aii-space-4); display: flex; flex-direction: column; gap: 10px; }
.aii-skel-line { height: 12px; border-radius: 999px; }
.aii-is-loading { position: relative; }


/* ==========================================================================
   12. VEHICLE DETAIL PAGE
   ========================================================================== */
.aii-detail { container-type: inline-size; }
.aii-detail__top { display: grid; gap: var(--aii-space-6); grid-template-columns: 1fr; }
@container (min-width: 880px) { .aii-detail__top { grid-template-columns: 1.45fr 1fr; align-items: start; } }

.aii-breadcrumb { display: flex; align-items: center; gap: 7px; font-size: var(--aii-fs-sm); color: var(--aii-color-text-subtle); margin-bottom: var(--aii-space-4); flex-wrap: wrap; }
.aii-breadcrumb a:hover { color: var(--aii-color-accent); }
.aii-breadcrumb svg { width: 12px; height: 12px; }

/* Gallery */
.aii-gallery { display: flex; flex-direction: column; gap: var(--aii-space-3); }
.aii-gallery__main { position: relative; border-radius: var(--aii-radius-lg); overflow: hidden; border: 1px solid var(--aii-color-border); }
.aii-gallery__main .aii-photo { aspect-ratio: 16/10; cursor: zoom-in; }
.aii-gallery__nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--aii-color-surface); color: var(--aii-color-text); box-shadow: var(--aii-shadow-pop);
  transition: transform var(--aii-transition-fast);
}
.aii-gallery__nav:hover { transform: translateY(-50%) scale(1.06); }
.aii-gallery__nav--prev { left: 12px; } .aii-gallery__nav--next { right: 12px; }
.aii-gallery__nav svg { width: 18px; height: 18px; }
.aii-gallery__thumbs { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--aii-space-2); }
.aii-thumb { border-radius: var(--aii-radius-md); overflow: hidden; border: 2px solid transparent; transition: border-color var(--aii-transition-fast); }
.aii-thumb .aii-photo { aspect-ratio: 4/3; }
.aii-thumb.is-active { border-color: var(--aii-color-accent); }
.aii-thumb:hover { border-color: var(--aii-color-border-strong); }
.aii-thumb--more { position: relative; display: grid; place-items: center; background: var(--aii-color-surface-2); aspect-ratio: 4/3; font-weight: var(--aii-fw-bold); color: var(--aii-color-text-muted); font-size: var(--aii-fs-sm); }

/* Lightbox */
.aii-lightbox { position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center; padding: var(--aii-space-5); }
.aii-lightbox.is-open { display: flex; }
.aii-lightbox__scrim { position: absolute; inset: 0; background: rgba(8,11,16,.88); animation: aii-fade var(--aii-transition-base); }
@keyframes aii-fade { from { opacity: 0; } to { opacity: 1; } }
.aii-lightbox__stage { position: relative; z-index: 2; width: min(1040px, 100%); display: flex; flex-direction: column; gap: var(--aii-space-4); }
.aii-lightbox__frame { border-radius: var(--aii-radius-lg); overflow: hidden; box-shadow: var(--aii-shadow-pop); }
.aii-lightbox__frame .aii-photo { aspect-ratio: 16/10; }
.aii-lightbox__bar { display: flex; align-items: center; justify-content: space-between; color: #e7ebf1; }
.aii-lightbox__count { font-size: var(--aii-fs-sm); font-variant-numeric: tabular-nums; }
.aii-lightbox__close, .aii-lightbox__nav {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.1); color: #fff; transition: background var(--aii-transition-fast);
}
.aii-lightbox__close:hover, .aii-lightbox__nav:hover { background: rgba(255,255,255,.22); }
.aii-lightbox__close { position: absolute; top: -54px; right: 0; }
.aii-lightbox__nav svg, .aii-lightbox__close svg { width: 20px; height: 20px; }
.aii-lightbox__thumbs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.aii-lightbox__thumbs .aii-thumb { width: 64px; flex: none; }

/* Price block + summary */
.aii-summary { display: flex; flex-direction: column; gap: var(--aii-space-4); }
.aii-summary__head { display: flex; flex-direction: column; gap: var(--aii-space-3); }
.aii-summary__badges { display: flex; gap: 7px; flex-wrap: wrap; }
.aii-summary__title { font-family: var(--aii-font-heading); font-size: var(--aii-fs-h1); font-weight: var(--aii-fw-bold); line-height: var(--aii-lh-tight); letter-spacing: -.01em; text-wrap: balance; }
.aii-summary__trim { font-size: var(--aii-fs-body); color: var(--aii-color-text-muted); }
.aii-priceblock {
  display: flex; flex-direction: column; gap: 4px;
  padding: var(--aii-space-5); background: var(--aii-color-surface);
  border: 1px solid var(--aii-color-border); border-radius: var(--aii-radius-lg);
}
.aii-priceblock__row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--aii-space-3); }
.aii-priceblock__price { font-family: var(--aii-font-heading); font-size: var(--aii-fs-display); font-weight: var(--aii-fw-bold); letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.aii-priceblock__msrp { font-size: var(--aii-fs-body); color: var(--aii-color-text-subtle); text-decoration: line-through; }
.aii-priceblock__note { font-size: var(--aii-fs-sm); color: var(--aii-color-text-muted); }
.aii-priceblock__cta { display: flex; flex-direction: column; gap: 8px; margin-top: var(--aii-space-4); }
.aii-keyfacts { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--aii-space-2); }
.aii-keyfact { display: flex; align-items: center; gap: 9px; padding: var(--aii-space-3); background: var(--aii-color-surface-2); border-radius: var(--aii-radius-md); }
.aii-keyfact svg { width: 18px; height: 18px; color: var(--aii-color-accent); flex: none; }
.aii-keyfact__v { font-weight: var(--aii-fw-bold); font-size: var(--aii-fs-body); line-height: 1.1; }
.aii-keyfact__k { font-size: var(--aii-fs-xs); color: var(--aii-color-text-muted); text-transform: uppercase; letter-spacing: .04em; }

/* Specs table */
.aii-section { margin-top: var(--aii-space-8); }
.aii-section__title { font-family: var(--aii-font-heading); font-size: var(--aii-fs-h2); font-weight: var(--aii-fw-bold); margin-bottom: var(--aii-space-4); display: flex; align-items: center; gap: 10px; }
.aii-specs-table { container-type: inline-size; border: 1px solid var(--aii-color-border); border-radius: var(--aii-radius-lg); overflow: hidden; }
.aii-specs-grid { display: grid; grid-template-columns: 1fr; }
@container (min-width: 620px) { .aii-specs-grid { grid-template-columns: 1fr 1fr; } }
.aii-specrow { display: flex; align-items: center; gap: 10px; padding: 11px var(--aii-space-4); }
.aii-specrow:nth-child(odd) { background: var(--aii-color-surface); }
.aii-specrow:nth-child(even) { background: var(--aii-color-surface-2); }
@container (min-width: 620px) {
  .aii-specrow:nth-child(4n+1), .aii-specrow:nth-child(4n) { background: var(--aii-color-surface); }
  .aii-specrow:nth-child(4n+2), .aii-specrow:nth-child(4n+3) { background: var(--aii-color-surface-2); }
}
.aii-specrow__ic { width: 18px; height: 18px; color: var(--aii-color-text-subtle); flex: none; }
.aii-specrow__k { font-size: var(--aii-fs-sm); color: var(--aii-color-text-muted); flex: none; min-width: 116px; }
.aii-specrow__v { font-size: var(--aii-fs-body); color: var(--aii-color-text); font-weight: var(--aii-fw-medium); margin-left: auto; text-align: right; font-variant-numeric: tabular-nums; }
.aii-specrow__v.is-mono { font-family: var(--aii-font-mono); font-size: var(--aii-fs-sm); letter-spacing: -.01em; }

.aii-description { font-size: var(--aii-fs-body); line-height: var(--aii-lh-base); color: var(--aii-color-text-muted); max-width: 70ch; }
.aii-description p + p { margin-top: var(--aii-space-3); }


/* ==========================================================================
   13. PRO LEAD FORM
   ========================================================================== */
.aii-leadform { background: var(--aii-color-surface); border: 1px solid var(--aii-color-border); border-radius: var(--aii-radius-lg); box-shadow: var(--aii-shadow-card); overflow: hidden; }
.aii-leadform__context {
  display: flex; align-items: center; gap: var(--aii-space-3);
  padding: var(--aii-space-4); background: var(--aii-color-accent-soft);
  border-bottom: 1px solid var(--aii-color-border);
}
.aii-leadform__thumb { width: 56px; height: 44px; border-radius: var(--aii-radius-sm); overflow: hidden; flex: none; border: 1px solid var(--aii-color-border); }
.aii-leadform__ctx-title { font-weight: var(--aii-fw-semibold); font-size: var(--aii-fs-body); line-height: 1.2; }
.aii-leadform__ctx-stock { font-size: var(--aii-fs-sm); color: var(--aii-color-text-muted); font-family: var(--aii-font-mono); }
.aii-leadform__body { padding: var(--aii-space-5); display: flex; flex-direction: column; gap: var(--aii-space-4); }
.aii-leadform__row { display: grid; gap: var(--aii-space-4); grid-template-columns: 1fr; }
@container (min-width: 480px) { .aii-leadform__row { grid-template-columns: 1fr 1fr; } }
.aii-leadform__success { display: none; flex-direction: column; align-items: center; text-align: center; gap: var(--aii-space-3); padding: var(--aii-space-8) var(--aii-space-5); }
.aii-leadform.is-success .aii-leadform__body { display: none; }
.aii-leadform.is-success .aii-leadform__success { display: flex; }
.aii-leadform__check { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--aii-color-success-soft); color: var(--aii-color-success); }
.aii-leadform__check svg { width: 28px; height: 28px; }
.aii-leadform__success h4 { font-family: var(--aii-font-heading); font-size: var(--aii-fs-h2); font-weight: var(--aii-fw-bold); }
.aii-leadform__success p { color: var(--aii-color-text-muted); font-size: var(--aii-fs-body); max-width: 36ch; }


/* ==========================================================================
   14. MULTI-LOCATION
   ========================================================================== */
.aii-locswitch { display: flex; flex-wrap: wrap; gap: 8px; }
.aii-locswitch__btn {
  display: inline-flex; align-items: center; gap: 8px; font-size: var(--aii-fs-sm); font-weight: var(--aii-fw-medium);
  color: var(--aii-color-text-muted); background: var(--aii-color-surface);
  border: 1px solid var(--aii-color-border); padding: 8px 14px; border-radius: var(--aii-radius-pill);
  transition: all var(--aii-transition-fast);
}
.aii-locswitch__btn:hover { border-color: var(--aii-color-border-strong); color: var(--aii-color-text); }
.aii-locswitch__btn.is-active { background: var(--aii-color-accent); color: var(--aii-color-accent-contrast); border-color: var(--aii-color-accent); }
.aii-locswitch__btn .aii-pin { width: 13px; height: 13px; }
.aii-locswitch__count { font-size: var(--aii-fs-xs); padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, currentColor 16%, transparent); font-weight: var(--aii-fw-bold); }

.aii-loccard { display: grid; gap: 0; grid-template-columns: 1fr; background: var(--aii-color-surface); border: 1px solid var(--aii-color-border); border-radius: var(--aii-radius-lg); overflow: hidden; box-shadow: var(--aii-shadow-card); container-type: inline-size; }
.aii-loccard__grid { display: grid; grid-template-columns: 1fr; }
@container (min-width: 640px) { .aii-loccard__grid { grid-template-columns: 1.3fr 1fr; } }
.aii-loccard__info { padding: var(--aii-space-5); display: flex; flex-direction: column; gap: var(--aii-space-3); }
.aii-loccard__name { font-family: var(--aii-font-heading); font-size: var(--aii-fs-h2); font-weight: var(--aii-fw-bold); }
.aii-locrow { display: flex; align-items: flex-start; gap: 10px; font-size: var(--aii-fs-body); color: var(--aii-color-text-muted); }
.aii-locrow svg { width: 16px; height: 16px; color: var(--aii-color-accent); flex: none; margin-top: 2px; }
.aii-locrow b { color: var(--aii-color-text); font-weight: var(--aii-fw-semibold); }
.aii-loccard__map { position: relative; min-height: 200px; background: var(--aii-color-surface-2); }
.aii-loccard__map .aii-map { position: absolute; inset: 0; }
.aii-hours { display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; font-size: var(--aii-fs-sm); }
.aii-hours dt { color: var(--aii-color-text-muted); }
.aii-hours dd { text-align: right; color: var(--aii-color-text); font-variant-numeric: tabular-nums; }
.aii-hours .is-open { color: var(--aii-color-success); font-weight: var(--aii-fw-semibold); }

/* Map placeholder grid */
.aii-map { background:
  linear-gradient(0deg, var(--aii-color-border) 1px, transparent 1px) 0 0 / 100% 28px,
  linear-gradient(90deg, var(--aii-color-border) 1px, transparent 1px) 0 0 / 28px 100%,
  var(--aii-color-surface-2); display: grid; place-items: center; }
.aii-map__pin { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--aii-color-accent); }
.aii-map__pin svg { width: 30px; height: 30px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.25)); }
.aii-map__pin span { font-size: var(--aii-fs-xs); background: var(--aii-color-surface); padding: 2px 8px; border-radius: 999px; color: var(--aii-color-text-muted); box-shadow: var(--aii-shadow-xs); }


/* ==========================================================================
   15. EMPTY STATE
   ========================================================================== */
.aii-empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: var(--aii-space-4); padding: var(--aii-space-10) var(--aii-space-5);
  background: var(--aii-color-surface); border: 1px dashed var(--aii-color-border-strong);
  border-radius: var(--aii-radius-lg);
}
.aii-empty__ic { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--aii-color-surface-2); color: var(--aii-color-text-subtle); }
.aii-empty__ic svg { width: 30px; height: 30px; }
.aii-empty__title { font-family: var(--aii-font-heading); font-size: var(--aii-fs-h2); font-weight: var(--aii-fw-bold); }
.aii-empty__text { font-size: var(--aii-fs-body); color: var(--aii-color-text-muted); max-width: 44ch; }
.aii-empty__actions { display: flex; gap: var(--aii-space-3); flex-wrap: wrap; justify-content: center; margin-top: var(--aii-space-2); }


/* ==========================================================================
   16. LAYOUT HELPERS (Pro 2-col archive: sidebar + results)
   ========================================================================== */
.aii-archive { container-type: inline-size; }
.aii-archive__layout { display: grid; gap: var(--aii-space-6); grid-template-columns: 1fr; }
@container (min-width: 900px) { .aii-archive__layout { grid-template-columns: 286px 1fr; align-items: start; } }
.aii-archive__sidebar { position: sticky; top: var(--aii-space-4); }
.aii-stack { display: flex; flex-direction: column; gap: var(--aii-space-5); }


/* ==========================================================================
   17. PLUGIN PRODUCTION ADDITIONS  (not in the design showcase)
   --------------------------------------------------------------------------
   The showcase renders photos as CSS gradient stand-ins (.aii-photo--demo).
   In the plugin, .aii-photo holds a real <img> (and a link to the detail
   page). These additive, .aii-scoped rules make a real photo cover-fit the
   media box the same way the demo gradient fills it. No tokens or existing
   selectors are modified.
   ========================================================================== */
.aii-photo > a { position: absolute; inset: 0; z-index: 1; display: block; }
.aii-photo img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}

/* Archive page wrapper — gives the grid a self-contained max width + padding
   so it reads as intentional on a full-bleed (block-theme) layout, while still
   sitting comfortably inside a classic theme's constrained content column. */
.aii-archive-page { max-width: var(--aii-maxw); margin-inline: auto; padding: var(--aii-space-7) var(--aii-space-4); }
.aii-archive-page .pagination { margin-top: var(--aii-space-7); }

/* Detail-page icon sizing. The showcase sized these contexts with inline
   width/height attributes; production <use> icons carry none, so size them
   here (the shipped sheet already sizes spec/keyfact/gallery-nav icons). */
.aii-section__title svg { width: 20px; height: 20px; color: var(--aii-color-accent); flex: none; }
.aii-badge svg { width: 12px; height: 12px; flex: none; }
.aii-btn svg { width: 17px; height: 17px; flex: none; }
.aii-field__error svg { width: 13px; height: 13px; flex: none; }
.aii-check__box svg { width: 12px; height: 12px; }

/* Pro lead form rendered inline in the price-block CTA slot: drop the card
   chrome so it blends into the summary instead of nesting card-in-card. */
.aii-leadform--inline { border: 0; box-shadow: none; background: transparent; overflow: visible; }
.aii-leadform--inline .aii-leadform__body { padding: 0; }
.aii-leadform__heading { font-family: var(--aii-font-heading); font-weight: var(--aii-fw-bold); font-size: var(--aii-fs-h2); }
.aii-leadform__fineprint { font-size: var(--aii-fs-sm); color: var(--aii-color-text-subtle); text-align: center; margin: 0; }

/* Establish a container on the archive page so sibling components (the search
   bar, empty state) respond to the page width — the shipped @container rules
   need a sized ancestor. */
.aii-archive-page { container-type: inline-size; }

/* Search bar + active-filter chips, spaced off the results grid below. */
.aii-archive__filters { margin-bottom: var(--aii-space-6); }

/* Pro upsell card (free build, shown to admins only) — premium-amber tokens,
   kept distinct from the marketplace accent so it reads as an upsell. */
.aii-upsell {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--aii-space-4);
  background: var(--aii-color-pro-soft); border: 1px solid var(--aii-color-pro-border);
  border-radius: var(--aii-radius-lg); padding: var(--aii-space-5); margin-bottom: var(--aii-space-6);
}
.aii-upsell__main { flex: 1 1 300px; min-width: 0; }
.aii-upsell__title { display: flex; align-items: center; gap: 8px; font-family: var(--aii-font-heading); font-weight: var(--aii-fw-bold); font-size: var(--aii-fs-h2); color: var(--aii-color-pro-ink); }
.aii-upsell__text { font-size: var(--aii-fs-sm); color: var(--aii-color-text-muted); margin-top: 4px; }
.aii-btn--pro { background: var(--aii-color-pro); color: #fff; }
.aii-btn--pro:hover { background: color-mix(in srgb, var(--aii-color-pro) 88%, #000); }

/* Pro advanced filter: results column must be allowed to shrink so the grid
   doesn't overflow; the sidebar shows on desktop, a drawer button on mobile. */
.aii-archive__results { min-width: 0; }
.aii-archive__drawerbtn { display: none; }
@container (max-width: 899px) {
  .aii-archive__sidebar { display: none; }
  .aii-archive__drawerbtn { display: inline-flex; }
}

/* Free search bar with the kept price Min/Max field: widen the grid to fit
   keyword + make + year + condition + price + submit. */
@container (min-width: 720px) {
  .aii-searchbar--free { grid-template-columns: 1.8fr 1fr 1fr 1fr 1.4fr auto; }
}
.aii-searchbar__price { display: flex; align-items: center; gap: 6px; }
.aii-searchbar__price .aii-input { min-width: 0; padding-inline: 10px; }
.aii-searchbar__price-sep { color: var(--aii-color-text-subtle); flex: none; }
