﻿/* Engine: Car History admin portal. Graphite and ember, Space Grotesk headings, Inter body. */
:root {
    --graphite: #14161A;
    --graphite-2: #1E2127;
    --graphite-3: #2A2E36;
    --ember: #FF6A2B;
    --ember-deep: #C2410C;
    --ember-soft: #FFF1EA;
    --paper: #F4F2EE;
    --surface: #FFFFFF;
    --ink: #16181D;
    --ink-soft: #3B4049;
    --muted: #6B7079;
    --line: #E3E0DA;
    --line-soft: #EEECE7;
    --good: #1F7A4D;
    --good-bg: #E6F4EC;
    --bad: #B42318;
    --bad-bg: #FDECEA;
    --info: #2457C5;
    --info-bg: #E9EFFC;
    --muted-bg: #EFEEEA;
    --warn: #A15C07;
    --warn-bg: #FDF1E0;
    --font: "Inter", "Segoe UI", system-ui, sans-serif;
    --font-head: "Space Grotesk", "Inter", "Segoe UI", sans-serif;
    --r: 10px;
    --r-lg: 16px;
    --side: 250px;
    --shadow: 0 1px 2px rgba(20, 22, 26, .06), 0 8px 24px -16px rgba(20, 22, 26, .25);
    --focus: 0 0 0 3px var(--surface), 0 0 0 5px var(--ember);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 15px/1.55 var(--font); color: var(--ink); background: var(--paper); }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; letter-spacing: -.02em; line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: 1.85rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 1em; }
a { color: var(--ember-deep); }
a:hover { color: var(--ink); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
code, .mono { font-family: Consolas, "Cascadia Mono", monospace; font-size: .92em; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Shell ---------- */
.shell { min-height: 100vh; }
.side { background: var(--graphite); color: rgba(255, 255, 255, .72); display: flex; flex-direction: column; }
@media (min-width: 1000px) {
    .shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); }
    .side { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
}
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 22px 18px; color: #fff; text-decoration: none; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--ember); color: var(--graphite); font-size: 1.05rem; }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 1.3rem; letter-spacing: -.01em; line-height: 1; }
.brand-name small { display: block; font: 500 .72rem/1.4 var(--font); letter-spacing: .02em; color: rgba(255, 255, 255, .5); margin-top: 3px; }
.brand:hover { color: #fff; }
.nav { padding: 6px 12px 24px; }
.nav-group { margin-top: 14px; }
.nav-label { display: block; padding: 0 12px 6px; font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: rgba(255, 255, 255, .38); }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 8px; color: rgba(255, 255, 255, .78); text-decoration: none; font-weight: 500; font-size: .94rem; }
.nav a i { width: 18px; text-align: center; color: rgba(255, 255, 255, .45); }
.nav a:hover { background: var(--graphite-2); color: #fff; }
.nav a.is-active { background: var(--graphite-3); color: #fff; box-shadow: inset 3px 0 0 var(--ember); }
.nav a.is-active i { color: var(--ember); }
.side-foot { margin-top: auto; padding: 16px 22px 22px; border-top: 1px solid var(--graphite-3); font-size: .88rem; }
.side-foot strong { display: block; color: #fff; font-weight: 600; }
.side-foot a { color: rgba(255, 255, 255, .6); }
.side-foot a:hover { color: #fff; }
@media (max-width: 999px) {
    .nav { display: flex; flex-wrap: wrap; gap: 4px; padding-top: 0; }
    .nav-group { display: contents; }
    .nav-label { display: none; }
    .side-foot { display: flex; justify-content: space-between; gap: 12px; }
}

.main { padding: 28px 24px 64px; }
@media (min-width: 1000px) { .main { padding: 36px 44px 72px; } }
.main-inner { max-width: 1320px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 24px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.crumb { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; margin-bottom: 8px; text-decoration: none; color: var(--muted); }
.crumb:hover { color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Cards, tiles ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px 24px; box-shadow: var(--shadow); margin-bottom: 20px; }
.card > h2 { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-note { color: var(--muted); font-size: .9rem; }
.cols { display: grid; gap: 20px; }
@media (min-width: 1100px) { .cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols--wide-left { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } }
.cols > .card { margin-bottom: 0; }
.stack > * + * { margin-top: 20px; }

.tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin-bottom: 22px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--shadow); text-decoration: none; color: inherit; display: block; }
a.tile:hover { border-color: var(--ink-soft); color: inherit; }
.tile-label { display: block; color: var(--muted); font-size: .86rem; font-weight: 500; }
.tile-value { display: block; font-family: var(--font-head); font-weight: 600; font-size: 1.85rem; letter-spacing: -.02em; line-height: 1.2; margin-top: 6px; color: var(--ink); }
.tile-sub { display: block; color: var(--muted); font-size: .84rem; margin-top: 2px; }
.tile--alert { border-color: var(--bad); }
.tile--alert .tile-label { color: var(--bad); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.grid { width: 100%; border-collapse: collapse; font-size: .93rem; }
.grid th { text-align: left; font-weight: 600; font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid td { padding: 11px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.grid tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover td { background: #FBFAF8; }
.grid .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.grid td small { display: block; color: var(--muted); font-size: .84rem; }
.empty { color: var(--muted); margin: 6px 0; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; color: var(--muted); font-size: .9rem; }
.pager-count { color: var(--muted); font-size: .88rem; margin: 14px 0 0; }

.fields { display: grid; gap: 2px 24px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); margin: 0; }
.fields div { padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.fields dt { color: var(--muted); font-size: .82rem; }
.fields dd { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere; }

/* ---------- Pills, flash ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.pill--good { background: var(--good-bg); color: var(--good); }
.pill--bad { background: var(--bad-bg); color: var(--bad); }
.pill--info { background: var(--info-bg); color: var(--info); }
.pill--muted { background: var(--muted-bg); color: var(--ink-soft); }
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 13px 16px; border-radius: var(--r); margin-bottom: 20px; font-weight: 500; }
.flash i { margin-top: 3px; }
.flash--ok { background: var(--good-bg); color: #145238; }
.flash--error { background: var(--bad-bg); color: #8A1A12; }
.flash--warn { background: var(--warn-bg); color: #6E3F05; }
.flash--info { background: var(--info-bg); color: #193F8F; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 16px 20px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.form .full { grid-column: 1 / -1; }
.field label, .field .label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.field small { display: block; color: var(--muted); font-size: .84rem; margin-top: 5px; line-height: 1.4; }
.input, select.input, textarea.input {
    width: 100%; font: inherit; color: var(--ink); background: var(--surface);
    border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
}
textarea.input { min-height: 120px; resize: vertical; }
.input:focus { border-color: var(--ember); box-shadow: 0 0 0 3px rgba(255, 106, 43, .18); outline: none; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--ember-deep); }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 20px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 18px; }
.filters .field { min-width: 180px; }
.filters .field label { font-size: .82rem; color: var(--muted); }
.field-error { color: var(--bad); font-weight: 600; font-size: .9rem; margin-top: 6px; display: block; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font: 600 .94rem/1 var(--font); padding: 11px 18px; border-radius: 8px; border: 0;
    cursor: pointer; text-decoration: none; white-space: nowrap; transition: background-color .15s ease;
}
.btn-primary { background: var(--graphite); color: #fff; }
.btn-primary:hover { background: var(--graphite-3); color: #fff; }
.btn-ember { background: var(--ember); color: var(--graphite); }
.btn-ember:hover { background: #FF8350; color: var(--graphite); }
.btn-quiet { background: rgba(20, 22, 26, .06); color: var(--ink); }
.btn-quiet:hover { background: rgba(20, 22, 26, .12); color: var(--ink); }
.btn-danger { background: var(--bad-bg); color: var(--bad); }
.btn-danger:hover { background: #F9D5D1; color: var(--bad); }
.btn-small { padding: 7px 12px; font-size: .86rem; }
.btn-block { width: 100%; }

/* ---------- Media ---------- */
.media-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.media { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.media img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: var(--muted-bg); }
.media-body { padding: 10px 12px 12px; font-size: .88rem; }
.media-body strong { display: block; overflow-wrap: anywhere; }
.media-body span { color: var(--muted); }
.media-body .actions { margin-top: 8px; }
.preview { max-width: 100%; border-radius: var(--r); border: 1px solid var(--line); background: var(--muted-bg); display: block; }
.preview--car { max-width: 360px; background: #fff; }
.hero-slot { display: grid; gap: 16px; grid-template-columns: 220px minmax(0, 1fr); align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.hero-slot:last-child { border-bottom: 0; }
.hero-slot img { width: 220px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: var(--muted-bg); }
@media (max-width: 640px) { .hero-slot { grid-template-columns: 1fr; } }
.hero-slot--share img { aspect-ratio: 1.91 / 1; }
.preview--share { aspect-ratio: 1.91 / 1; object-fit: cover; }

pre.json { background: var(--graphite); color: #E8E6E1; padding: 16px; border-radius: var(--r); max-height: 480px; overflow: auto; font-size: .82rem; line-height: 1.5; }
details > summary { cursor: pointer; font-weight: 600; padding: 6px 0; }

/* ---------- Sign-in ---------- */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px;
    background: radial-gradient(1200px 600px at 85% -10%, rgba(255, 106, 43, .22), transparent 60%), var(--graphite); }
.gate-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 20px; padding: 34px 32px; box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .6); }
.gate-card .brand { padding: 0 0 22px; color: var(--ink); }
.gate-card .brand-name small { color: var(--muted); }
.gate-card h1 { font-size: 1.45rem; }
.gate-card .field { margin-bottom: 14px; }
.gate-note { color: var(--muted); font-size: .9rem; }
.qr { display: grid; place-items: center; padding: 14px; border: 1px solid var(--line); border-radius: var(--r); margin: 6px 0 14px; background: #fff; }
.secret { display: block; text-align: center; letter-spacing: .12em; font-size: .95rem; padding: 10px; background: var(--muted-bg); border-radius: 8px; overflow-wrap: anywhere; }
.code-input { font-family: var(--font-head); font-size: 1.6rem; letter-spacing: .4em; text-align: center; }

/* ---------- Editor ---------- */
.editor-wrap .tox-tinymce { border-radius: var(--r) !important; border-color: var(--line) !important; }

/* ---------- Collapsible side menu (html.side-collapsed, remembered in localStorage by engine.js) ---------- */
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-right: 12px; }
.side-toggle { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: rgba(255, 255, 255, .5); cursor: pointer; display: grid; place-items: center; }
.side-toggle:hover { background: var(--graphite-2); color: #fff; }
.side-foot { display: grid; gap: 4px; padding: 12px 12px 18px; }
.side-foot-link { display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 8px; color: rgba(255, 255, 255, .7); text-decoration: none; }
.side-foot-link:hover { background: var(--graphite-2); color: #fff; }
.side-foot-link i { width: 18px; text-align: center; color: rgba(255, 255, 255, .45); }
.side-foot-link strong { display: block; color: #fff; font-weight: 600; line-height: 1.3; }
@media (max-width: 999px) {
    .side-toggle { display: none; }
    .side-foot { display: flex; flex-wrap: wrap; }
}
@media (min-width: 1000px) {
    .shell { transition: grid-template-columns .2s ease; }
    html.side-collapsed .shell { grid-template-columns: 72px minmax(0, 1fr); }
    html.side-collapsed .side-top { flex-direction: column; padding: 18px 0 8px; gap: 10px; }
    html.side-collapsed .brand { padding: 0; }
    html.side-collapsed .brand-name,
    html.side-collapsed .nav-label,
    html.side-collapsed .nav-text { display: none; }
    html.side-collapsed .nav { padding: 4px 10px 20px; }
    html.side-collapsed .nav-group { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--graphite-3); }
    html.side-collapsed .nav-group:first-child { border-top: 0; padding-top: 0; }
    html.side-collapsed .nav a, html.side-collapsed .side-foot-link { justify-content: center; padding: 10px 0; }
    html.side-collapsed .nav a i, html.side-collapsed .side-foot-link i { width: auto; font-size: 1.05rem; }
    html.side-collapsed .side-toggle i { transform: rotate(180deg); }
    /* Content uses the full width when the menu is collapsed */
    html.side-collapsed .main-inner { max-width: none; }
}
@media (prefers-reduced-motion: reduce) { .shell { transition: none; } }

/* Thin, quiet scrollbar on the side menu */
.side { scrollbar-width: thin; scrollbar-color: var(--graphite-3) transparent; }
.side::-webkit-scrollbar { width: 6px; }
.side::-webkit-scrollbar-track { background: transparent; }
.side::-webkit-scrollbar-thumb { background: var(--graphite-3); border-radius: 3px; }
.side::-webkit-scrollbar-thumb:hover { background: #3A3F49; }

/* Keep the product name on one line */
.brand { flex: 1 1 auto; min-width: 0; }
.brand-name { white-space: nowrap; }

.library-head { font-size: 1rem; margin: 22px 0 10px; }
.library-head:first-of-type { margin-top: 4px; }
.muted { color: var(--muted); font-weight: 400; }
.prompt-box { margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--muted-bg); }
.prompt-box h3 { font-size: .95rem; margin: 0 0 6px; }
.prompt-box p { margin: 0; font-size: .9rem; line-height: 1.55; white-space: pre-wrap; user-select: all; }
.slot-fields { display: grid; gap: 12px; }
@media (min-width: 900px) { .slot-fields { grid-template-columns: 1fr 1fr; } }
.message-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
/* Count of items waiting (e.g. new messages), beside the nav label or on the icon when collapsed */
.nav a { position: relative; }
.nav-count { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--ember); color: var(--graphite); font-size: .75rem; font-weight: 700; line-height: 1.5; text-align: center; }
@media (min-width: 1000px) {
    html.side-collapsed .nav-count { position: absolute; top: 3px; right: 8px; min-width: 16px; padding: 0 4px; font-size: .62rem; }
}
/* Support tickets (Message.aspx): the conversation and reply box */
.cols--wide-left { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); align-items: start; }
.thread { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 14px; }
.thread-msg { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; width: min(90%, 720px); }
.thread-msg--staff { justify-self: end; background: #FFF4EE; border-color: #F6D2BF; }
.thread-meta { margin: 0 0 6px; color: var(--muted); font-size: .85rem; }
.thread-meta strong { color: var(--ink, #1c1f23); }
.thread-body { line-height: 1.55; overflow-wrap: anywhere; }
.thread-files { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.thread-files a { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: .88rem; text-decoration: none; }
.reply-card .input { width: 100%; }
.warn-text { color: var(--ember-deep); font-weight: 600; }
