/* =====================================================================
   VIN Lookup — application stylesheet
   No build step, no framework, no external fonts (CSP allows 'self' only).

   Type: an interface sans for prose and a tabular monospace for every
   piece of vehicle data. VINs, part numbers, capacities and torque
   figures are codes, not words — setting them in mono with tabular
   figures makes them scannable and stops columns from dancing.
   ===================================================================== */

:root {
    /* Brand */
    --primary:      #2563EB;
    --primary-dark: #1D4ED8;
    --primary-soft: #EFF6FF;
    --dark:         #0F172A;
    --background:   #F8FAFC;
    --success:      #16A34A;
    --danger:       #DC2626;

    /* Derived neutrals */
    --surface:      #FFFFFF;
    --surface-2:    #F1F5F9;
    --border:       #E2E8F0;
    --border-strong:#CBD5E1;
    --text:         #0F172A;
    --text-muted:   #64748B;
    --text-faint:   #94A3B8;
    --warning:      #D97706;
    --warning-soft: #FFFBEB;
    --success-soft: #F0FDF4;
    --danger-soft:  #FEF2F2;

    /* Shape */
    --r-sm: 6px;
    --r:    10px;
    --r-lg: 16px;
    --r-full: 999px;

    /* Elevation — soft, never heavy */
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow:    0 1px 3px rgba(15, 23, 42, .08), 0 6px 16px -6px rgba(15, 23, 42, .10);
    --shadow-lg: 0 12px 40px -12px rgba(15, 23, 42, .25);

    /* Type */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --font-mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono",
                 "Roboto Mono", Menlo, Consolas, "Liberation Mono", monospace;

    --header-h: 64px;
    --sidebar-w: 244px;
}

/* ---------------------------------------------------------------- reset */

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    background: var(--background);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    margin: 0 0 .5rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
    font-weight: 650;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: .95rem; }

p { margin: 0 0 1rem; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

svg { flex-shrink: 0; }

hr { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }

code, .mono, .vin {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

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

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

/* --------------------------------------------------------------- layout */

.container {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 20px;
}
.container-narrow { max-width: 460px; }
.container-mid    { max-width: 820px; }

.page { padding: 32px 0 64px; }

.stack > * + * { margin-top: 1rem; }

.row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}
.row-between { justify-content: space-between; }
.spacer { flex: 1 1 auto; }

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

/* --------------------------------------------------------------- header */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--header-h);
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--border);
}
.site-header .container {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 20px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-weight: 700;
    font-size: 1.02rem;
    letter-spacing: -0.02em;
    color: var(--dark);
}
.brand:hover { text-decoration: none; }
.brand-mark {
    width: 30px; height: 30px;
    border-radius: 8px;
    background: var(--primary);
    display: grid; place-items: center;
    color: #fff;
}

.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav a {
    padding: 7px 12px;
    border-radius: var(--r-sm);
    color: var(--text-muted);
    font-weight: 500;
    font-size: .92rem;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { color: var(--primary); background: var(--primary-soft); }

.nav-toggle {
    display: none;
    margin-left: auto;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 7px;
    cursor: pointer;
    color: var(--text);
}

/* -------------------------------------------------------------- buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--r);
    border: 1px solid transparent;
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-weight: 600;
    font-size: .93rem;
    cursor: pointer;
    transition: background .15s ease, box-shadow .15s ease, transform .06s ease;
    white-space: nowrap;
    text-decoration: none;
}
.btn:hover { background: var(--primary-dark); color: #fff; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-loading { opacity: .6; pointer-events: none; }

.btn-lg    { padding: 14px 26px; font-size: 1rem; border-radius: var(--r); }
.btn-sm    { padding: 6px 12px; font-size: .85rem; border-radius: var(--r-sm); }
.btn-block { width: 100%; }

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-2); color: var(--text); }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #B91C1C; }

.btn-success { background: var(--success); }
.btn-success:hover { background: #15803D; }

.btn .spinner { display: none; }
.btn.is-loading .spinner { display: inline-block; }
.btn.is-loading .btn-label { opacity: .7; }

.spinner {
    width: 15px; height: 15px;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
.spinner-dark { border-color: rgba(15,23,42,.2); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- cards */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }
.card-head {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}
.card-head h2, .card-head h3 { margin: 0; }
.card-body { padding: 20px; }
.card-foot {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: 0 0 var(--r-lg) var(--r-lg);
}

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
}
.stat-label {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 6px;
}
.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}
.stat-sub { font-size: .82rem; color: var(--text-muted); margin-top: 4px; }
.stat-accent .stat-value { color: var(--primary); }

/* --------------------------------------------------------------- badges */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: var(--r-full);
    font-size: .76rem;
    font-weight: 600;
    letter-spacing: .01em;
    background: var(--surface-2);
    color: var(--text-muted);
    white-space: nowrap;
}
.badge-success { background: var(--success-soft); color: #15803D; }
.badge-danger  { background: var(--danger-soft);  color: #B91C1C; }
.badge-warning { background: var(--warning-soft); color: #B45309; }
.badge-info    { background: var(--primary-soft); color: var(--primary-dark); }
.badge-muted   { background: var(--surface-2);    color: var(--text-muted); }

/* ---------------------------------------------------------------- forms */

.field { margin-bottom: 16px; }
.field label {
    display: block;
    font-size: .87rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}
.field .hint { font-size: .82rem; color: var(--text-muted); margin-top: 6px; }
.field .error { font-size: .82rem; color: var(--danger); margin-top: 6px; }

.input, .select, .textarea {
    width: 100%;
    padding: 11px 13px;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}
.input[aria-invalid="true"] { border-color: var(--danger); }
.input::placeholder { color: var(--text-faint); }

.checkbox { display: flex; gap: 9px; align-items: flex-start; font-size: .9rem; }
.checkbox input { margin-top: 3px; }

/* ------------------------------------------------- the VIN input, signature

   A VIN is exactly 17 characters. Rather than a generic text box, the
   field is set in wide-tracked monospace with a live 17-slot counter, so
   you can see at a glance whether the number you typed is complete.     */

.vin-field { position: relative; }

.vin-input {
    width: 100%;
    padding: 18px 16px 18px 16px;
    font-family: var(--font-mono);
    font-size: clamp(1rem, 3.6vw, 1.35rem);
    font-weight: 600;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--dark);
    background: var(--surface);
    border: 2px solid var(--border-strong);
    border-radius: var(--r);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.vin-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .13);
}
.vin-input::placeholder { color: var(--text-faint); letter-spacing: .16em; font-weight: 500; }
.vin-input.is-complete { border-color: var(--success); }
.vin-input.is-invalid  { border-color: var(--danger); }

.vin-meter {
    display: flex;
    gap: 3px;
    margin-top: 10px;
    align-items: center;
}
.vin-tick {
    flex: 1 1 0;
    height: 3px;
    border-radius: 2px;
    background: var(--border);
    transition: background .12s ease;
}
.vin-tick.on { background: var(--primary); }
.vin-count {
    font-family: var(--font-mono);
    font-size: .8rem;
    color: var(--text-muted);
    margin-left: 10px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.vin-count.complete { color: var(--success); font-weight: 600; }

/* ----------------------------------------------------------------- hero */

.hero {
    padding: 72px 0 56px;
    background:
        radial-gradient(900px 380px at 50% -140px, rgba(37, 99, 235, .12), transparent 70%),
        var(--background);
    text-align: center;
}
.hero h1 {
    font-size: clamp(2rem, 6vw, 3.1rem);
    letter-spacing: -0.035em;
    margin-bottom: 14px;
}
.hero p.lead {
    font-size: clamp(1rem, 2.4vw, 1.12rem);
    color: var(--text-muted);
    max-width: 560px;
    margin: 0 auto 30px;
}
.hero-form {
    max-width: 560px;
    margin: 0 auto;
    text-align: left;
}
.price-tag {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 13px;
    border-radius: var(--r-full);
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: .84rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 20px;
}
.price-tag strong { color: var(--dark); }

.feature {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 20px;
}
.feature-icon {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary);
    display: grid; place-items: center;
    margin-bottom: 12px;
}
.feature h3 { font-size: 1rem; margin-bottom: 4px; }
.feature p { font-size: .88rem; color: var(--text-muted); margin: 0; }
.feature.is-unavailable { opacity: .62; }
.feature.is-unavailable .feature-icon { background: var(--surface-2); color: var(--text-faint); }

.section-title {
    text-align: center;
    margin-bottom: 28px;
}
.section-title p { color: var(--text-muted); margin: 0; }
.eyebrow {
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

/* --------------------------------------------------------------- tables */

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
table.table {
    width: 100%;
    border-collapse: collapse;
    font-size: .89rem;
}
table.table th {
    text-align: left;
    padding: 11px 14px;
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    background: var(--surface-2);
}
table.table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
table.table tbody tr:last-child td { border-bottom: 0; }
table.table tbody tr:hover { background: var(--surface-2); }
table.table td.num, table.table th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
}

/* ----------------------------------------------------------- spec lists */

.spec-section { margin-bottom: 20px; }
.spec-section > h3 {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 1rem;
    margin-bottom: 0;
}

.spec-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 0;
}
.spec {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    min-width: 0;
}
.spec-label {
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 3px;
}
.spec-value {
    font-family: var(--font-mono);
    font-size: .95rem;
    font-weight: 600;
    color: var(--dark);
    word-break: break-word;
    font-variant-numeric: tabular-nums;
}
.na {
    color: var(--text-faint);
    font-weight: 500;
    font-style: normal;
    font-family: var(--font-sans);
    font-size: .88rem;
}

.notice {
    padding: 12px 15px;
    border-radius: var(--r);
    font-size: .88rem;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-muted);
}
.notice-info    { background: var(--primary-soft); border-color: #BFDBFE; color: #1E40AF; }
.notice-warning { background: var(--warning-soft); border-color: #FDE68A; color: #92400E; }
.notice-danger  { background: var(--danger-soft);  border-color: #FECACA; color: #991B1B; }
.notice-success { background: var(--success-soft); border-color: #BBF7D0; color: #166534; }

/* ---------------------------------------------------------- search card */

.search-card {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow .15s ease, border-color .15s ease;
}
.search-card:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }
.search-card .thumb {
    width: 116px;
    height: 84px;
    flex: 0 0 116px;
    border-radius: var(--r);
    background: var(--surface-2);
    overflow: hidden;
    display: grid;
    place-items: center;
}
.search-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.search-card .meta { min-width: 0; flex: 1; }
.search-card h3 { font-size: 1.02rem; margin-bottom: 2px; }
.search-card .sub { font-size: .86rem; color: var(--text-muted); margin-bottom: 8px; }
.search-card .vin {
    font-size: .82rem;
    letter-spacing: .06em;
    color: var(--text-muted);
    word-break: break-all;
}

/* ------------------------------------------------------- empty & states */

.empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}
.empty-icon {
    width: 52px; height: 52px;
    margin: 0 auto 14px;
    border-radius: 14px;
    background: var(--surface-2);
    color: var(--text-faint);
    display: grid; place-items: center;
}
.empty h3 { color: var(--text); margin-bottom: 6px; }
.empty p { max-width: 380px; margin: 0 auto 18px; font-size: .92rem; }

.skeleton {
    background: linear-gradient(90deg, var(--surface-2) 25%, #E9EEF5 37%, var(--surface-2) 63%);
    background-size: 400% 100%;
    animation: shimmer 1.3s ease infinite;
    border-radius: var(--r-sm);
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.skeleton-line { height: 12px; margin-bottom: 10px; }
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-40 { width: 40%; }
.skeleton-block { height: 88px; }

.processing {
    text-align: center;
    padding: 56px 24px;
}
.processing .spinner {
    width: 34px; height: 34px;
    border-width: 3px;
    margin: 0 auto 18px;
}

/* --------------------------------------------------------------- toasts */

.toast-stack {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(380px, calc(100vw - 32px));
}
.toast {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 13px 15px;
    border-radius: var(--r);
    background: var(--dark);
    color: #fff;
    font-size: .89rem;
    box-shadow: var(--shadow-lg);
    animation: toast-in .2s ease;
}
.toast-success { background: var(--success); }
.toast-error   { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast button {
    background: none; border: 0; color: inherit;
    opacity: .7; cursor: pointer; padding: 0; margin-left: auto; font-size: 1rem;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* --------------------------------------------------------------- modals */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    display: grid;
    place-items: center;
    padding: 20px;
    z-index: 150;
    animation: fade .15s ease;
}
.modal-backdrop[hidden] { display: none; }
.modal {
    background: var(--surface);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    overflow: auto;
}
@keyframes fade { from { opacity: 0; } }

/* -------------------------------------------------------------- sidebar */

.app-shell { display: flex; min-height: calc(100vh - var(--header-h)); }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 18px 12px;
    position: sticky;
    top: var(--header-h);
    height: calc(100vh - var(--header-h));
    overflow-y: auto;
}
.sidebar-group + .sidebar-group { margin-top: 18px; }
.sidebar-title {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--text-faint);
    font-weight: 700;
    padding: 0 10px;
    margin-bottom: 6px;
}
.sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    border-radius: var(--r-sm);
    color: var(--text-muted);
    font-size: .9rem;
    font-weight: 500;
    margin-bottom: 2px;
}
.sidebar a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidebar a.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.sidebar a.active svg { color: var(--primary); }

.app-main { flex: 1 1 auto; min-width: 0; padding: 26px 24px 64px; }

.page-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}
.page-head h1 { font-size: 1.5rem; margin: 0; }
.page-head .sub { color: var(--text-muted); font-size: .92rem; margin: 4px 0 0; }

/* ----------------------------------------------------------- pagination */

.pagination { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pagination a, .pagination span {
    padding: 6px 11px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: .86rem;
    color: var(--text-muted);
}
.pagination a:hover { background: var(--surface-2); text-decoration: none; }
.pagination .current { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

/* --------------------------------------------------------------- filter */

.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 18px;
}
.filters .field { margin: 0; min-width: 150px; }
.filters .input, .filters .select { padding: 8px 11px; font-size: .88rem; }

/* ---------------------------------------------------------------- misc */

.muted { color: var(--text-muted); }
.small { font-size: .85rem; }
.tiny  { font-size: .78rem; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }

.divider-list > * + * { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 14px; }

.kv { display: flex; justify-content: space-between; gap: 16px; font-size: .9rem; padding: 7px 0; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; font-weight: 600; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.bar {
    height: 8px;
    border-radius: 4px;
    background: var(--surface-2);
    overflow: hidden;
}
.bar span { display: block; height: 100%; background: var(--primary); }

.chart {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 140px;
    padding-top: 8px;
}
.chart-col { flex: 1 1 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; min-width: 0; }
.chart-col .seg { border-radius: 2px 2px 0 0; background: var(--primary); min-height: 1px; }
.chart-col .seg.err { background: var(--danger); border-radius: 0 0 2px 2px; }
.chart-labels { display: flex; gap: 3px; margin-top: 6px; }
.chart-labels span {
    flex: 1 1 0; text-align: center;
    font-size: .62rem; color: var(--text-faint);
    overflow: hidden; white-space: nowrap;
}

.footer {
    border-top: 1px solid var(--border);
    padding: 26px 0;
    color: var(--text-muted);
    font-size: .87rem;
    background: var(--surface);
}
.footer .container { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.footer a { color: var(--text-muted); }

/* ----------------------------------------------------------- responsive */

@media (max-width: 1000px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

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

    .nav-toggle { display: inline-flex; }
    .nav {
        display: none;
        position: absolute;
        top: var(--header-h);
        left: 0; right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        padding: 10px 16px 16px;
        box-shadow: var(--shadow);
    }
    .nav.open { display: flex; }
    .nav .btn { margin-top: 8px; }

    .app-shell { display: block; }
    .sidebar {
        position: static;
        width: auto;
        height: auto;
        display: flex;
        gap: 4px;
        overflow-x: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border);
        padding: 10px 12px;
    }
    .sidebar-group { display: flex; gap: 4px; margin: 0 !important; }
    .sidebar-title { display: none; }
    .sidebar a { margin: 0; white-space: nowrap; }
    .app-main { padding: 20px 16px 56px; }

    .spec { border-right: 0; }

    .search-card { flex-direction: column; }
    .search-card .thumb { width: 100%; flex: none; height: 160px; }
}

@media (max-width: 520px) {
    .grid-4 { grid-template-columns: 1fr; }
    .hero { padding: 44px 0 36px; }
    .page { padding: 22px 0 48px; }
    .card-pad, .card-body { padding: 16px; }
    .toast-stack { left: 16px; right: 16px; max-width: none; }
    .btn-lg { padding: 13px 20px; }
}

@media print {
    .site-header, .sidebar, .footer, .btn, .toast-stack { display: none !important; }
    body { background: #fff; }
    .card { box-shadow: none; border-color: #ccc; }
}
