/* ===============================================================
   ENCLAVE — COMPONENTS
   Layout is written with logical properties (inline-start/end)
   so the RTL document mirrors correctly without a second stylesheet.
   =============================================================== */

/* ---------------------------------------------------------------
   Reset & base
--------------------------------------------------------------- */

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

* { margin: 0; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    /* `clip` rather than `hidden`: it contains decorative bleed without
       turning the root into a scroll container. */
    overflow-x: clip;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

body {
    /* vh first as the fallback: browsers older than Chrome 108 ignore the
       dvh line entirely. Matters for embedded in-game browsers. */
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--surface-page);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }

/* The UA rule for [hidden] is `display: none`, but any author `display`
   declaration beats it — so a class like `.auth-screen { display: grid }`
   silently defeats the hidden attribute. Restate it as the winner. */
[hidden] { display: none !important; }

button, input, select, textarea {
    font: inherit;
    color: inherit;
}

button { background: none; border: none; cursor: pointer; }

a { color: inherit; text-decoration: none; }

:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
}

::selection {
    background: var(--accent-veil);
    color: var(--text-primary);
}

/* Scrollbar tuned to the palette rather than left default */
* { scrollbar-width: thin; scrollbar-color: var(--ink-700) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: var(--ink-700);
    border-radius: var(--radius-pill);
    border: 3px solid var(--surface-page);
}
*::-webkit-scrollbar-thumb:hover { background: var(--ink-600); }

/* ---------------------------------------------------------------
   Typography primitives
--------------------------------------------------------------- */

.display {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-tight);
}

.eyebrow {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: 500;
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
    color: var(--text-muted);
}

.num {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.prose { max-width: 62ch; color: var(--text-secondary); }

.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* ---------------------------------------------------------------
   Layout
--------------------------------------------------------------- */

.shell {
    width: 100%;
    max-width: var(--page-max);
    margin-inline: auto;
    padding-inline: var(--page-pad);
}

.section { padding-block: var(--section-gap); }

.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-5);
    flex-wrap: wrap;
    margin-block-end: var(--space-6);
}

.section-head h2 {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 700;
    letter-spacing: var(--tracking-tight);
    line-height: var(--leading-tight);
}

.rule {
    height: 1px;
    background: var(--border-subtle);
    border: 0;
}

/* ---------------------------------------------------------------
   Navigation
--------------------------------------------------------------- */

.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    background: var(--nav-bg);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border-block-end: 1px solid transparent;
    transition: border-color var(--dur-normal) var(--ease-smooth),
                background-color var(--dur-normal) var(--ease-smooth);
}

.nav[data-scrolled='true'] {
    border-block-end-color: var(--border-subtle);
    background: hsl(var(--hue) 20% 6% / 0.9);
}

.nav-inner {
    width: 100%;
    max-width: var(--page-max);
    margin-inline: auto;
    padding-inline: var(--page-pad);
    display: flex;
    align-items: center;
    gap: var(--space-5);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    flex-shrink: 0;
}

.brand img { width: 34px; height: 34px; object-fit: contain; }

.brand-name {
    font-family: var(--font-display);
    font-size: 1.0625rem;
    font-weight: 700;
    letter-spacing: 0.18em;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-inline-start: var(--space-5);
    list-style: none;
    padding: 0;
}

.nav-link {
    position: relative;
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: color var(--dur-fast) var(--ease-sharp);
}

.nav-link:hover { color: var(--text-primary); }

/* Underline grows from the inline-start edge — mirrors in RTL for free */
.nav-link::after {
    content: '';
    position: absolute;
    inset-inline-start: var(--space-3);
    inset-inline-end: var(--space-3);
    bottom: 2px;
    height: 1px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: inline-start;
    transition: transform var(--dur-normal) var(--ease-smooth);
}

.nav-link:hover::after,
.nav-link[aria-current='true']::after { transform: scaleX(1); }
.nav-link[aria-current='true'] { color: var(--text-primary); }

.nav-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-inline-start: auto;
}

@media (max-width: 620px) {
    .nav-links { display: none; }
}

/* ---------------------------------------------------------------
   Buttons
--------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 44px;                 /* touch target floor */
    padding: 0 var(--space-5);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
    transition: background-color var(--dur-fast) var(--ease-sharp),
                border-color var(--dur-fast) var(--ease-sharp),
                color var(--dur-fast) var(--ease-sharp),
                transform var(--dur-fast) var(--ease-sharp);
}

/* Tactile press instead of a glow */
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

.btn-primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-fg);
}
.btn-primary:hover { background: var(--btn-primary-bg-hover); }

.btn-ghost {
    border: 1px solid var(--btn-ghost-border);
    color: var(--btn-ghost-fg);
}
.btn-ghost:hover { background: var(--btn-ghost-bg-hover); border-color: var(--border-accent); }

.btn-quiet { color: var(--text-secondary); padding-inline: var(--space-3); }
.btn-quiet:hover { color: var(--text-primary); background: var(--surface-hover); }

.btn-danger { border: 1px solid hsl(2 58% 60% / 0.35); color: var(--negative); }
.btn-danger:hover { background: hsl(2 58% 60% / 0.12); border-color: var(--negative); }

.btn-sm { min-height: 36px; padding-inline: var(--space-3); font-size: var(--text-xs); }
.btn-block { width: 100%; }

.btn-icon {
    min-height: 40px;
    width: 40px;
    padding: 0;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}
.btn-icon:hover { color: var(--text-primary); background: var(--surface-hover); }
.btn-icon[aria-pressed='true'] {
    color: var(--accent);
    border-color: var(--border-accent);
    background: var(--accent-wash);
}

.icon { width: 18px; height: 18px; stroke-width: 1.6; flex-shrink: 0; }
.icon-sm { width: 15px; height: 15px; }

/* ---------------------------------------------------------------
   Hero — asymmetric split, never centred
--------------------------------------------------------------- */

.hero {
    position: relative;
    /* Contains the ambient glow below — without this it widens the
       document and produces a horizontal scrollbar. */
    overflow: clip;
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
    align-items: center;
    gap: clamp(2rem, 5vw, 5rem);
    /* No bottom padding: the catalogue section supplies its own top gap,
       and stacking both left a dead band under the fold. */
    padding-block: clamp(2.5rem, 6vw, 5rem) 0;
}

/* A single soft field of brand light, well below the content.
   This replaces the old stack of neon glow shadows. */
.hero::before {
    content: '';
    position: absolute;
    inset-block-start: -20%;
    inset-inline-end: -10%;
    width: min(70vw, 720px);
    aspect-ratio: 1;
    background: radial-gradient(circle, var(--accent-wash) 0%, transparent 68%);
    pointer-events: none;
    z-index: -1;
}

.hero-copy { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-5); }

.hero-title {
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: var(--tracking-tight);
    text-wrap: balance;
}

.hero-desc { font-size: var(--text-md); color: var(--text-secondary); max-width: 46ch; }

.hero-meta {
    display: flex;
    gap: var(--space-6);
    padding-block-start: var(--space-4);
    border-block-start: 1px solid var(--border-subtle);
    width: 100%;
}

.hero-meta div { display: flex; flex-direction: column; gap: 2px; }
.hero-meta dt { font-size: var(--text-xs); color: var(--text-muted); letter-spacing: var(--tracking-wide); text-transform: uppercase; }
.hero-meta dd { font-family: var(--font-mono); font-size: var(--text-md); font-weight: 500; }

/* Featured vehicle plate */
.hero-feature {
    position: relative;
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: var(--surface-raised);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-xl);
}

.hero-feature-media {
    position: relative;
    aspect-ratio: 16 / 11;
    overflow: hidden;
    background: var(--surface-inset);
}

.hero-feature-media img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform var(--dur-slow) var(--ease-smooth);
}

.hero-feature:hover .hero-feature-media img { transform: scale(1.04); }

.hero-feature-media::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, hsl(var(--hue) 20% 6% / 0.92) 0%, transparent 55%);
}

.hero-feature-body {
    position: absolute;
    inset-block-end: 0;
    inset-inline: 0;
    padding: var(--space-5);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-4);
}

.hero-feature-name {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 600;
    letter-spacing: var(--tracking-tight);
}

.hero-feature-price {
    font-family: var(--font-mono);
    font-size: var(--text-lg);
    font-weight: 500;
    color: var(--accent-strong);
    white-space: nowrap;
}

@media (max-width: 900px) {
    .hero { grid-template-columns: 1fr; gap: var(--space-6); }
    .hero-meta { gap: var(--space-5); }
}

/* ---------------------------------------------------------------
   Badges & pills
--------------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    background: hsl(var(--hue) 20% 100% / 0.08);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    backdrop-filter: blur(8px);
}

.badge-accent {
    background: var(--accent-wash);
    color: var(--accent-strong);
    border-color: var(--border-accent);
}

.badge-positive { color: var(--positive); border-color: hsl(152 42% 52% / 0.35); background: hsl(152 42% 52% / 0.1); }
.badge-caution  { color: var(--caution);  border-color: hsl(38 62% 58% / 0.35);  background: hsl(38 62% 58% / 0.1); }
.badge-negative { color: var(--negative); border-color: hsl(2 58% 60% / 0.35);   background: hsl(2 58% 60% / 0.1); }

/* ---------------------------------------------------------------
   Catalogue toolbar
--------------------------------------------------------------- */

.toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(130px, 0.8fr));
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--surface-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    margin-block-end: var(--space-6);
}

.search {
    position: relative;
    display: flex;
    align-items: center;
}

.search .icon {
    position: absolute;
    inset-inline-start: var(--space-3);
    color: var(--text-muted);
    pointer-events: none;
}

.search input { padding-inline-start: calc(var(--space-3) * 2 + 18px); }

/* Second toolbar row: price ceiling, availability toggle, reset */
.toolbar-row {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: var(--space-5);
    flex-wrap: wrap;
    padding-block-start: var(--space-3);
    border-block-start: 1px solid var(--border-subtle);
}

.range-field {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex: 1;
    min-width: 260px;
}
.range-field label {
    font-size: var(--text-xs);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
}
.range-field input[type='range'] {
    flex: 1;
    min-width: 90px;
    accent-color: var(--accent);
    cursor: pointer;
}
.range-field output {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    min-width: 8ch;
    text-align: end;
}

.toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
}
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.toggle:hover { color: var(--text-primary); }

@media (max-width: 860px) {
    .toolbar { grid-template-columns: 1fr 1fr; }
    .search { grid-column: 1 / -1; }
    .range-field { min-width: 100%; }
}

/* ---------------------------------------------------------------
   Form fields
--------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: var(--space-2); }

.field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
}

.label {
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--text-muted);
}

.input,
.select,
.textarea {
    width: 100%;
    min-height: 44px;
    padding: var(--space-2) var(--space-3);
    background: var(--field-bg);
    border: 1px solid var(--field-border);
    border-radius: var(--field-radius);
    color: var(--field-fg);
    font-size: var(--text-base);
    transition: border-color var(--dur-fast) var(--ease-sharp),
                background-color var(--dur-fast) var(--ease-sharp);
}

.input::placeholder, .textarea::placeholder { color: var(--text-muted); }

.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }

.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface-raised);
}

.textarea { min-height: 88px; resize: vertical; line-height: var(--leading-snug); }

.select {
    appearance: none;
    padding-inline-end: var(--space-6);
    background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
                      linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}
/* Attribute selector rather than :dir(), which needs Chrome 120+. Embedded
   in-game browsers run older Chromium and would render these arrows wrong. */
[dir='rtl'] .select { background-position: left 13px center, left 18px center; }
[dir='ltr'] .select { background-position: right 18px center, right 13px center; }

.field-error {
    font-size: var(--text-xs);
    color: var(--negative);
    min-height: 1em;
}

.checkbox-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-4);
    background: var(--surface-inset);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color var(--dur-fast) var(--ease-sharp);
}
.checkbox-row:hover { border-color: var(--border-strong); }
.checkbox-row input { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.checkbox-title { font-weight: 600; font-size: var(--text-base); }
.checkbox-note { font-size: var(--text-sm); color: var(--text-muted); }

/* File drop zone */
.dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-6) var(--space-4);
    background: var(--surface-inset);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: center;
    color: var(--text-secondary);
    transition: border-color var(--dur-fast) var(--ease-sharp),
                background-color var(--dur-fast) var(--ease-sharp);
}
.dropzone:hover, .dropzone[data-dragging='true'] {
    border-color: var(--accent);
    background: var(--accent-wash);
}
.dropzone[data-filled='true'] { border-style: solid; border-color: var(--positive); }
.dropzone .icon { width: 24px; height: 24px; color: var(--text-muted); }
.dropzone-hint { font-size: var(--text-sm); }
.dropzone-status { font-size: var(--text-sm); color: var(--positive); font-family: var(--font-mono); }

/* "or" rule between the upload zone and the paste-a-link field */
.or-divider {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-block: var(--space-3);
    color: var(--text-muted);
    font-size: var(--text-xs);
}
.or-divider::before,
.or-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-subtle);
}

.receipt-preview {
    margin-block-start: var(--space-3);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    max-height: 180px;
    object-fit: contain;
    background: var(--surface-inset);
    width: 100%;
}

/* ---------------------------------------------------------------
   Vehicle grid & cards
--------------------------------------------------------------- */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-5);
}

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

.card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    overflow: hidden;
    transition: transform var(--dur-normal) var(--ease-smooth),
                border-color var(--dur-normal) var(--ease-smooth),
                box-shadow var(--dur-normal) var(--ease-smooth);
}

.card:hover {
    transform: translateY(-4px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-lg);
}

.card-media {
    position: relative;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    background: var(--surface-inset);
    cursor: pointer;
}

.card-media img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform var(--dur-slow) var(--ease-smooth), opacity var(--dur-normal) var(--ease-smooth);
}

.card:hover .card-media img { transform: scale(1.05); }

.card-media-tags {
    position: absolute;
    inset-block-start: var(--space-3);
    inset-inline-start: var(--space-3);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    max-width: calc(100% - var(--space-6));
}

.card-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5) var(--space-5);
    flex: 1;
}

.card-brand {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--text-muted);
}

.card-name {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 600;
    letter-spacing: var(--tracking-tight);
    line-height: var(--leading-snug);
    cursor: pointer;
    transition: color var(--dur-fast) var(--ease-sharp);
}
.card-name:hover { color: var(--accent-strong); }

/* Spec strip — border-divided rather than boxed, keeps density down */
.card-specs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2);
    padding-block: var(--space-3);
    border-block: 1px solid var(--border-subtle);
}

.spec { display: flex; flex-direction: column; gap: 2px; }
.spec-label { font-size: 0.6875rem; letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--text-muted); }
.spec-value { font-family: var(--font-mono); font-size: var(--text-sm); font-weight: 500; }

.card-foot {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-3);
    margin-block-start: auto;
}

.price-stack { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.price-label { font-size: 0.6875rem; letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--text-muted); }
.price {
    font-family: var(--font-mono);
    font-size: var(--text-md);
    font-weight: 600;
    letter-spacing: -0.02em;
}
.price-was {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-decoration: line-through;
}

.card-actions { display: flex; gap: var(--space-2); flex-shrink: 0; }

/* Stock meter — communicates scarcity without shouting */
.stock {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.stock-head {
    display: flex;
    justify-content: space-between;
    font-size: var(--text-xs);
    color: var(--text-muted);
}
.stock-count { font-family: var(--font-mono); color: var(--text-secondary); }
.stock-track {
    height: 3px;
    background: hsl(var(--hue) 20% 100% / 0.08);
    border-radius: var(--radius-pill);
    overflow: hidden;
}
.stock-fill {
    height: 100%;
    background: var(--accent);
    border-radius: inherit;
    transform-origin: inline-start;
    transition: transform var(--dur-slow) var(--ease-smooth);
}
.stock-fill[data-level='low'] { background: var(--caution); }
.stock-fill[data-level='out'] { background: var(--negative); }

.sold-out-veil {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: hsl(var(--hue) 25% 5% / 0.72);
    backdrop-filter: blur(2px);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
    color: var(--text-secondary);
}

/* ---------------------------------------------------------------
   Empty & loading states
--------------------------------------------------------------- */

.empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-9) var(--space-5);
    text-align: center;
    border: 1px dashed var(--border-subtle);
    border-radius: var(--radius-lg);
    color: var(--text-muted);
}
.empty .icon { width: 32px; height: 32px; }
.empty h3 { font-family: var(--font-display); font-size: var(--text-lg); color: var(--text-secondary); font-weight: 600; }

/* Skeletons match real card geometry rather than being spinners */
.skeleton {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    overflow: hidden;
}
.skeleton-media { aspect-ratio: 3 / 2; }
.skeleton-body { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); }
.skeleton-line { height: 12px; border-radius: var(--radius-sm); }
.skeleton-media, .skeleton-line {
    background: linear-gradient(90deg,
        hsl(var(--hue) 14% 14%) 0%,
        hsl(var(--hue) 14% 19%) 50%,
        hsl(var(--hue) 14% 14%) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.4s var(--ease-sharp) infinite;
}
@keyframes shimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
    .skeleton-media, .skeleton-line { animation: none; }
}

/* ---------------------------------------------------------------
   Modals
--------------------------------------------------------------- */

.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: var(--space-4);
    background: var(--modal-scrim);
    backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    /* visibility flips instantly on open so the panel is focusable right
       away, and is delayed on close so the fade-out is still visible.
       Transitioning it symmetrically leaves the dialog unfocusable for
       the length of the animation. */
    transition: opacity var(--dur-normal) var(--ease-smooth),
                visibility 0s linear var(--dur-normal);
}

.modal[data-open='true'] {
    opacity: 1;
    visibility: visible;
    transition: opacity var(--dur-normal) var(--ease-smooth),
                visibility 0s linear 0s;
}

.modal-panel {
    position: relative;
    width: 100%;
    max-width: 680px;
    max-height: min(88vh, 900px);
    max-height: min(88dvh, 900px);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--modal-bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: var(--space-6);
    transform: translateY(12px) scale(0.985);
    transition: transform var(--dur-normal) var(--ease-smooth);
}

.modal[data-open='true'] .modal-panel { transform: translateY(0) scale(1); }

.modal-panel-wide { max-width: 1080px; }
.modal-panel-narrow { max-width: 420px; }

.modal-close {
    position: absolute;
    inset-block-start: var(--space-4);
    inset-inline-end: var(--space-4);
    width: 36px; height: 36px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    background: var(--surface-inset);
    border: 1px solid var(--border-subtle);
    transition: color var(--dur-fast) var(--ease-sharp), background-color var(--dur-fast) var(--ease-sharp);
    z-index: 2;
}
.modal-close:hover { color: var(--text-primary); background: var(--surface-hover); }

.modal-title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 700;
    letter-spacing: var(--tracking-tight);
    padding-inline-end: var(--space-7);
}

.modal-sub { color: var(--text-secondary); font-size: var(--text-sm); margin-block-start: var(--space-2); }

.modal-body { margin-block-start: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); }

.modal-foot {
    display: flex;
    gap: var(--space-3);
    margin-block-start: var(--space-5);
    padding-block-start: var(--space-5);
    border-block-start: 1px solid var(--border-subtle);
}

/* ---------------------------------------------------------------
   Vehicle detail
--------------------------------------------------------------- */

.detail {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: var(--space-6);
}

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

.gallery-main {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: var(--radius-lg);
    background: var(--surface-inset);
}

.gallery-thumbs { display: flex; gap: var(--space-2); margin-block-start: var(--space-3); flex-wrap: wrap; }

.gallery-thumb {
    width: 76px;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    opacity: 0.55;
    transition: opacity var(--dur-fast) var(--ease-sharp), border-color var(--dur-fast) var(--ease-sharp);
}
.gallery-thumb:hover { opacity: 0.85; }
.gallery-thumb[aria-selected='true'] { opacity: 1; border-color: var(--accent); }

.detail-price {
    font-family: var(--font-mono);
    font-size: var(--text-xl);
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* Spec table — rows separated by rules, no boxes */
.specs { width: 100%; border-collapse: collapse; }
.specs th, .specs td {
    padding-block: var(--space-3);
    border-block-end: 1px solid var(--border-subtle);
    text-align: start;
    vertical-align: top;
}
.specs th {
    font-size: var(--text-xs);
    font-weight: 500;
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--text-muted);
    width: 42%;
}
.specs td { font-family: var(--font-mono); font-size: var(--text-sm); }
.specs tr:last-child th, .specs tr:last-child td { border-block-end: none; }

/* ---------------------------------------------------------------
   Compare
--------------------------------------------------------------- */

.compare-dock {
    position: fixed;
    inset-block-end: var(--space-4);
    inset-inline: var(--space-4);
    max-width: 720px;
    margin-inline: auto;
    z-index: 90;
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
    background: var(--surface-overlay);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    transform: translateY(calc(100% + var(--space-6)));
    opacity: 0;
    visibility: hidden;
    transition: transform var(--dur-normal) var(--ease-smooth),
                opacity var(--dur-normal) var(--ease-smooth),
                visibility 0s linear var(--dur-normal);
}

.compare-dock[data-open='true'] {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    transition: transform var(--dur-normal) var(--ease-smooth),
                opacity var(--dur-normal) var(--ease-smooth),
                visibility 0s linear 0s;
}

.compare-chips { display: flex; gap: var(--space-2); flex: 1; overflow-x: auto; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 6px 6px 6px 12px;
    background: var(--surface-inset);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    font-size: var(--text-xs);
    white-space: nowrap;
}
.chip button {
    display: grid; place-items: center;
    width: 20px; height: 20px;
    border-radius: 50%;
    color: var(--text-muted);
    transition: color var(--dur-fast) var(--ease-sharp), background-color var(--dur-fast) var(--ease-sharp);
}
.chip button:hover { color: var(--text-primary); background: var(--surface-hover); }

.compare-table { width: 100%; border-collapse: collapse; }
.compare-table th, .compare-table td {
    padding: var(--space-3);
    border-block-end: 1px solid var(--border-subtle);
    text-align: center;
}
.compare-table th:first-child, .compare-table td:first-child {
    text-align: start;
    font-size: var(--text-xs);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 500;
}
.compare-table td { font-family: var(--font-mono); font-size: var(--text-sm); }
.compare-head-img {
    width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-block-end: var(--space-2);
}

/* ---------------------------------------------------------------
   Invoice
--------------------------------------------------------------- */

.invoice {
    background: var(--surface-inset);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
}

.invoice-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    padding-block-end: var(--space-4);
    border-block-end: 1px dashed var(--border-strong);
}

.invoice-brand { display: flex; align-items: center; gap: var(--space-3); }
.invoice-brand img { width: 34px; height: 34px; object-fit: contain; }
.invoice-no { font-family: var(--font-mono); font-size: var(--text-md); color: var(--accent-strong); }
.invoice-date { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); }

.invoice-rows { width: 100%; border-collapse: collapse; margin-block: var(--space-4); }
.invoice-rows th, .invoice-rows td { padding-block: var(--space-2); text-align: start; }
.invoice-rows th { font-size: var(--text-xs); color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: var(--tracking-wide); }
.invoice-rows td { font-family: var(--font-mono); font-size: var(--text-sm); text-align: end; }

.invoice-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding-block-start: var(--space-4);
    border-block-start: 1px solid var(--border-strong);
}
.invoice-total-value { font-family: var(--font-mono); font-size: var(--text-xl); font-weight: 600; color: var(--accent-strong); }

.notice {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--accent-wash);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    line-height: var(--leading-snug);
}
.notice .icon { color: var(--accent-strong); margin-block-start: 2px; }

/* ---------------------------------------------------------------
   Admin
--------------------------------------------------------------- */

.admin-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
    padding-inline-end: var(--space-7);
}

.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--space-3);
    margin-block: var(--space-5);
}

.stat {
    padding: var(--space-4);
    background: var(--surface-inset);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}
.stat-value {
    font-family: var(--font-mono);
    font-size: var(--text-lg);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.stat-label { font-size: var(--text-xs); letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--text-muted); margin-block-start: 2px; }

.tabs {
    display: flex;
    gap: var(--space-1);
    border-block-end: 1px solid var(--border-subtle);
    margin-block-end: var(--space-5);
    overflow-x: auto;
}

.tab {
    position: relative;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
    transition: color var(--dur-fast) var(--ease-sharp);
}
.tab:hover { color: var(--text-secondary); }
.tab[aria-selected='true'] { color: var(--text-primary); }
.tab::after {
    content: '';
    position: absolute;
    inset-inline: var(--space-3);
    bottom: -1px;
    height: 2px;
    background: var(--accent);
    transform: scaleX(0);
    transition: transform var(--dur-normal) var(--ease-smooth);
}
.tab[aria-selected='true']::after { transform: scaleX(1); }

.table-wrap { overflow-x: auto; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); }

.table { width: 100%; border-collapse: collapse; min-width: 640px; }
.table th {
    padding: var(--space-3);
    text-align: start;
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--surface-inset);
    border-block-end: 1px solid var(--border-subtle);
    white-space: nowrap;
}
.table td {
    padding: var(--space-3);
    border-block-end: 1px solid var(--border-subtle);
    font-size: var(--text-sm);
    vertical-align: middle;
}
.table tbody tr { transition: background-color var(--dur-fast) var(--ease-sharp); }
.table tbody tr:hover { background: var(--surface-hover); }
.table tbody tr:last-child td { border-block-end: none; }

.table-thumb { width: 56px; aspect-ratio: 3/2; object-fit: cover; border-radius: var(--radius-sm); background: var(--surface-inset); }
.table-actions { display: flex; gap: var(--space-2); }

.panel {
    padding: var(--space-5);
    background: var(--surface-inset);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}
.panel + .panel { margin-block-start: var(--space-4); }
.panel h3 { font-family: var(--font-display); font-size: var(--text-md); font-weight: 600; margin-block-end: var(--space-2); }
.panel p { font-size: var(--text-sm); color: var(--text-muted); margin-block-end: var(--space-4); }

/* ---------------------------------------------------------------
   Admin sign-in screen (admin.html only)
--------------------------------------------------------------- */

.auth-screen {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: var(--space-5);
}

.auth-card {
    width: 100%;
    max-width: 380px;
    padding: var(--space-7) var(--space-6);
    background: var(--surface-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    text-align: center;
}

.auth-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
    margin-inline: auto;
    margin-block-end: var(--space-4);
}

.auth-title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 700;
    letter-spacing: var(--tracking-tight);
}

.auth-sub {
    color: var(--text-muted);
    font-size: var(--text-sm);
    margin-block: var(--space-2) var(--space-6);
}

.auth-card .field { text-align: start; }

.auth-back {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    margin-block-start: var(--space-6);
    font-size: var(--text-sm);
    color: var(--text-muted);
    transition: color var(--dur-fast) var(--ease-sharp);
}
.auth-back:hover { color: var(--text-secondary); }

/* ---------------------------------------------------------------
   Toasts
--------------------------------------------------------------- */

.toasts {
    position: fixed;
    inset-block-start: calc(var(--nav-height) + var(--space-3));
    inset-inline-end: var(--space-4);
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    pointer-events: none;
    max-width: min(360px, calc(100vw - var(--space-8)));
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--surface-overlay);
    border: 1px solid var(--border-strong);
    border-inline-start: 2px solid var(--accent);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: var(--text-sm);
    line-height: var(--leading-snug);
    animation: toast-in var(--dur-normal) var(--ease-smooth);
}

.toast[data-tone='success'] { border-inline-start-color: var(--positive); }
.toast[data-tone='error']   { border-inline-start-color: var(--negative); }
.toast .icon { margin-block-start: 1px; color: var(--text-muted); }
.toast[data-tone='success'] .icon { color: var(--positive); }
.toast[data-tone='error'] .icon { color: var(--negative); }
.toast[data-leaving='true'] { animation: toast-out var(--dur-normal) var(--ease-sharp) forwards; }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
    to { opacity: 0; transform: translateY(-8px); }
}

/* ---------------------------------------------------------------
   Footer
--------------------------------------------------------------- */

.footer {
    padding-block: var(--space-7) var(--space-6);
    border-block-start: 1px solid var(--border-subtle);
    margin-block-start: var(--section-gap);
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-5);
    flex-wrap: wrap;
}

.footer small { color: var(--text-muted); font-size: var(--text-xs); }

/* ---------------------------------------------------------------
   Scroll reveal
   Elements start shifted and fade in when observed. The transform is
   the only animated property besides opacity.
--------------------------------------------------------------- */

[data-reveal] {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity var(--dur-slow) var(--ease-smooth),
                transform var(--dur-slow) var(--ease-smooth);
    transition-delay: var(--reveal-delay, 0ms);
}

[data-reveal='shown'] { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
    [data-reveal] { opacity: 1; transform: none; transition: none; }
}
