:root {
    --ink: #1a1a1a;
    --muted: #666;
    --accent: #b8321a;
    --bg: #fafafa;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.5;
}
.site-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 0.75rem 1rem;
    background: #fff;
    border-bottom: 1px solid #ddd;
}
.brand { font-weight: 700; font-size: 1.25rem; color: var(--accent); text-decoration: none; }
.site-header nav a { color: var(--ink); text-decoration: none; margin-right: 1rem; }
.site-main { max-width: 64rem; margin: 0 auto; padding: 1.5rem 1rem; }
.site-footer { padding: 1rem; color: var(--muted); font-size: 0.875rem; text-align: center; }
.site-footer .env { color: var(--accent); }

/* --- navigation & layout --- */
.site-nav { display: flex; align-items: center; gap: 1rem; margin-left: auto; }
.site-nav a { color: var(--ink); text-decoration: none; }
form.inline { display: inline; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; }
.button { display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 4px; padding: 0.6rem 1.1rem; font: inherit; cursor: pointer; text-decoration: none; }
.button.small { padding: 0.35rem 0.8rem; font-size: 0.9rem; }
.button:hover { filter: brightness(0.92); }
.muted { color: var(--muted); }
section { margin-top: 2rem; }

/* --- messages --- */
.banner { padding: 0.6rem 1rem; background: #fff6d6; border-bottom: 1px solid #e8d48a; font-size: 0.95rem; }
.flash { padding: 0.75rem 1rem; border-radius: 4px; margin-bottom: 1rem; }
.flash.success { background: #e3f5e6; border: 1px solid #a9d9b2; }
.flash.error   { background: #fbe4e1; border: 1px solid #efb0a7; }
.flash.info    { background: #e6f0fb; border: 1px solid #b3cdf0; }

/* --- forms --- */
.form-narrow { max-width: 28rem; }
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; margin-bottom: 0.25rem; }
.field input[type=text], .field input[type=email], .field input[type=password], .field input[type=tel], .field input[type=number] {
    width: 100%; padding: 0.55rem 0.7rem; border: 1px solid #bbb; border-radius: 4px; font: inherit;
}
.field.has-error input { border-color: var(--accent); }
.field .hint { display: block; color: var(--muted); margin-top: 0.25rem; }
.field .error { display: block; color: var(--accent); margin-top: 0.25rem; }
.field.checkbox label { font-weight: 400; }

/* --- stage 3: listings & catalogue --- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.table th, .table td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid #e3e3e3; vertical-align: top; }
.table .actions a, .table .actions form { margin-right: 0.6rem; }
.inline-details summary { cursor: pointer; color: var(--accent); }
.inline-form label { margin-right: 0.6rem; }
.inline-form input { padding: 0.3rem; }
.section-nav { display: flex; gap: 1rem; flex-wrap: wrap; margin: 1rem 0; }
.form-section { border-top: 1px solid #ddd; padding-top: 1rem; margin-top: 1.5rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 0 1.5rem; }
select, textarea { width: 100%; padding: 0.55rem 0.7rem; border: 1px solid #bbb; border-radius: 4px; font: inherit; background: #fff; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 0.25rem 1rem; margin: 0.4rem 0 0.6rem; }
.checks label { font-weight: 400; }
.button.primary { background: #1a6b3a; }
.button[disabled] { opacity: 0.5; cursor: not-allowed; }
.button-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.photo-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; }
.photo-slot { border: 1px dashed #bbb; border-radius: 6px; padding: 0.75rem; }
.photo-slot.filled { border-style: solid; border-color: #9c9; }
.photo-slot strong { display: block; margin-bottom: 0.5rem; }
.photo-slot img { max-width: 100%; height: auto; border-radius: 4px; display: block; }
.photo-slot figure { margin: 0 0 0.5rem; }
.photo-slot.extras { grid-column: 1 / -1; }
.photo-slot .thumbs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.5rem; }
.photo-slot .thumbs img { width: 8rem; }
.filters { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.filters select { width: auto; }
.car-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1rem; }
.car-card { background: #fff; border: 1px solid #e3e3e3; border-radius: 6px; overflow: hidden; }
.car-card a { color: inherit; text-decoration: none; display: block; }
.car-card img, .car-card .no-photo { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #eee; display: grid; place-items: center; color: var(--muted); }
.car-card-body { padding: 0.75rem; display: grid; gap: 0.2rem; }
.car-card .bid { font-weight: 600; margin-top: 0.3rem; }
.car-card .closes { color: var(--accent); font-size: 0.9rem; }
.car-page { display: grid; grid-template-columns: minmax(0, 2fr) minmax(16rem, 1fr); gap: 2rem; }
@media (max-width: 700px) { .car-page { grid-template-columns: 1fr; } }
.gallery img#gallery-main { width: 100%; height: auto; border-radius: 6px; }
.gallery .thumbs { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.5rem; }
.gallery .thumbs img { width: 5.5rem; height: 4rem; object-fit: cover; border-radius: 3px; }
.spec { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1.5rem; }
.spec dt { color: var(--muted); }
.spec dd { margin: 0; }
.tags { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tags li { background: #eee; border-radius: 999px; padding: 0.2rem 0.7rem; font-size: 0.9rem; }
.description { white-space: pre-line; }
.bid-box { background: #fff; border: 1px solid #ddd; border-radius: 6px; padding: 1rem; display: grid; gap: 0.5rem; }
.bid-box .current strong { font-size: 1.6rem; }
.bid-box .label { display: block; color: var(--muted); font-size: 0.9rem; }
.tag { display: inline-block; background: #eee; border-radius: 999px; padding: 0.15rem 0.6rem; font-size: 0.85rem; }
.tag.good { background: #e3f5e6; color: #1a6b3a; }
.side-block { margin-top: 1.25rem; }
.side-block h3 { margin: 0 0 0.25rem; font-size: 1rem; }

/* --- stage 4: live bidding --- */
.countdown-row { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.countdown { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.countdown.urgent { color: var(--accent); }
.you-highest { display: block; color: #1a6b3a; font-weight: 600; font-size: 0.9rem; }
.stepper { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }
.stepper .step { width: 2.6rem; height: 2.6rem; font-size: 1.4rem; border: 1px solid #bbb; background: #fff; border-radius: 4px; cursor: pointer; }
.stepper .step:disabled { opacity: 0.4; cursor: not-allowed; }
.stepper .amount { min-width: 6rem; text-align: center; font-size: 1.3rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.stepper .amount.flash-change { animation: flash-bg 0.8s ease-out; }
@keyframes flash-bg { from { background: #ffe8a3; } to { background: transparent; } }
.buy-now-btn { margin-top: 0.6rem; background: #1a4b8b; width: 100%; }
.bid-message { min-height: 1.2em; font-size: 0.95rem; }
.bid-message.ok { color: #1a6b3a; }
.bid-message.warn { color: var(--accent); }
.ended-note { font-weight: 600; }
button.link.small { font-size: 0.85rem; }

/* --- stage 5: after the auction --- */
.after-box { background: #fff; border: 1px solid #ddd; border-radius: 6px; padding: 1rem; margin-top: 1rem; }
.after-box h3 { margin-top: 0; }
.after-box h4 { margin: 0.5rem 0 0.25rem; }
.rounds { padding-left: 1.2rem; }
.rounds li { margin-bottom: 0.25rem; }
.dispute { border-top: 1px dashed #ccc; margin-top: 0.75rem; padding-top: 0.75rem; }
details summary { cursor: pointer; color: var(--accent); margin-top: 0.5rem; }

/* --- stage 8: admin --- */
.admin-nav { display: flex; gap: 1rem; flex-wrap: wrap; padding: 0.5rem 0.75rem; background: #eef; border-radius: 4px; margin-bottom: 1rem; }
.admin-nav a { text-decoration: none; color: var(--ink); font-weight: 600; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0.6rem; margin: 1rem 0; }
.stat { display: block; background: #fff; border: 1px solid #ddd; border-radius: 6px; padding: 0.7rem; text-decoration: none; color: var(--ink); }
.stat strong { display: block; font-size: 1.5rem; }
.stat.attention { border-color: var(--accent); }
.filters a.current { font-weight: 700; text-decoration: none; }
blockquote { border-left: 3px solid #ccc; margin: 0.5rem 0; padding-left: 0.75rem; color: #333; }
code { background: #eee; padding: 0.1rem 0.3rem; border-radius: 3px; font-size: 0.9rem; }

/* --- stage 9: content pages, mobile and accessibility --- */
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: 0.5rem; z-index: 10; }
.skip:focus { left: 0.5rem; top: 0.5rem; }
:focus-visible { outline: 3px solid #1a4b8b; outline-offset: 2px; }
.hero { padding: 1rem 0 0.5rem; }
.hero h1 { font-size: clamp(1.5rem, 4vw, 2.3rem); margin: 0 0 0.5rem; }
.lead { font-size: 1.1rem; max-width: 46rem; }
.link-plain { align-self: center; color: var(--accent); text-decoration: none; }
.three-up { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.three-up div { background: #fff; border: 1px solid #e3e3e3; border-radius: 6px; padding: 0.9rem; }
.three-up h3 { margin: 0 0 0.4rem; font-size: 1rem; }
.three-up p { margin: 0; color: #333; }
.steps li { margin-bottom: 0.6rem; }
.prose { max-width: 46rem; }
.prose h1 { margin-top: 0; }
.error-page { text-align: center; padding: 3rem 0; }
.hp { position: absolute; left: -9999px; }
.site-footer nav { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-bottom: 0.4rem; }
.site-footer nav a { color: var(--muted); }
.site-footer p { margin: 0; }

/* tables scroll sideways on narrow screens instead of breaking the layout */
.table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (min-width: 700px) { .table { display: table; } }

/* phone navigation: a checkbox-driven menu, no JavaScript needed */
.nav-toggle, .nav-button { display: none; }
@media (max-width: 700px) {
    .site-header { flex-wrap: wrap; }
    .nav-button { display: block; margin-left: auto; font-size: 1.5rem; cursor: pointer; padding: 0 0.4rem; }
    .site-nav { display: none; width: 100%; flex-direction: column; align-items: flex-start; gap: 0.6rem; padding-top: 0.6rem; margin-left: 0; }
    .nav-toggle:checked ~ .site-nav { display: flex; }
    .site-main { padding: 1rem 0.75rem; }
    .bid-box .current strong { font-size: 1.4rem; }
    .stepper { flex-wrap: wrap; }
    .stepper .button { width: 100%; }
    .grid-2 { grid-template-columns: 1fr; }
    .inline-form { display: flex; flex-direction: column; gap: 0.4rem; align-items: stretch; }
    .inline-form input, .inline-form select { width: 100%; }
    .page-head .button { width: 100%; text-align: center; }
    .stat-row { grid-template-columns: 1fr 1fr; }
}
[hidden] { display: none !important; }

/* --- stage 7: messages --- */
.thread { display: grid; gap: 0.6rem; margin: 1rem 0; max-width: 46rem; }
.msg { padding: 0.6rem 0.8rem; border-radius: 8px; background: #fff; border: 1px solid #e3e3e3; }
.msg.mine { background: #e6f0fb; border-color: #b3cdf0; margin-left: 2rem; }
.msg.theirs { margin-right: 2rem; }
.msg-meta { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.2rem; }
.msg-body { white-space: pre-line; }
