:root {
  --paper: #efece6;
  --panel: #f6f3ee;
  --ink: #161513;
  --muted: #6a655c;
  --line: #d6d0c6;
  --wall: #2a2824;
  --wall-2: #1f1d1a;
  --accent: #8a1f2b;
  --ok: #2c5a3c;
  --warn: #8a5a12;
  --err: #8a1f2b;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --sans: "IBM Plex Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --cond: "IBM Plex Sans Condensed", "IBM Plex Sans", Helvetica, Arial, sans-serif;
}

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

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--wall);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
}

button, input, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

.app {
  display: grid;
  grid-template-columns: minmax(320px, 400px) 1fr;
  min-height: 100vh;
}

.panel {
  background: var(--panel);
  border-right: 1px solid var(--line);
  max-height: 100vh;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px 12px;
}

.panel .actions {
  flex: none;
  position: static;
  padding: 14px 26px 20px;
  background: var(--panel);
  border-top: 1px solid var(--line);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 20px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--cond);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.04em;
  flex: none;
}

.brand h1 {
  margin: 0;
  font-family: var(--cond);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.tag {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.block {
  margin-bottom: 18px;
}

.block > label, .block label:first-child {
  display: block;
  font-family: var(--cond);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}

.hint {
  min-height: 1.3em;
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.hint.error { color: var(--err); }
.hint.warn { color: var(--warn); }
.hint.ok { color: var(--ok); }

.hint.caution {
  color: var(--muted);
  margin-top: 4px;
}

.vin-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

#vin {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--cond);
  font-weight: 500;
  font-size: 15px;
}

input[type="text"], input[type="number"], input:not([type]), select, #caption, #custom-name, #vin, #build-year {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px 12px;
  border-radius: 2px;
  outline: none;
}

input:focus, select:focus {
  border-color: var(--ink);
}

.btn {
  border: 1px solid var(--ink);
  background: transparent;
  padding: 10px 14px;
  border-radius: 2px;
  cursor: pointer;
  font-family: var(--cond);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.btn:hover { background: var(--ink); color: var(--paper); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.primary:hover { background: #000; }

.samples {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.chip {
  border: 1px solid var(--line);
  background: #fff;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--muted);
}

.chip:hover { border-color: var(--ink); color: var(--ink); }

#vehicle-card {
  background: #fff;
  border: 1px solid var(--line);
  padding: 12px 14px 10px;
}

#vehicle-card h2 {
  margin: 0 0 12px;
  font-family: var(--cond);
  font-size: 20px;
  letter-spacing: -0.02em;
}

.facts {
  display: grid;
  gap: 6px 16px;
  margin: 0;
}

.fact {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
  font-size: 13px;
}

.fact dt {
  margin: 0;
  color: var(--muted);
  font-family: var(--cond);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 11px;
  padding-top: 2px;
}

.fact dd { margin: 0; }

#vehicle-card .warn {
  margin: 10px 0 0;
  color: var(--warn);
  font-size: 12px;
}

.date-row {
  display: grid;
  grid-template-columns: 1fr 100px;
  gap: 8px;
}

.swatches {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}

.swatch {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  padding: 6px 8px;
  cursor: pointer;
  border-radius: 2px;
}

.swatch:hover, .swatch.is-active {
  border-color: var(--ink);
}

.swatch.is-active {
  outline: 1px solid var(--ink);
}

.swatch-chip {
  width: 22px;
  height: 22px;
  border-radius: 2px;
  border: 1px solid rgba(0,0,0,0.15);
  flex: none;
}

.swatch-name {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 12px;
  line-height: 1.25;
}

.custom-color {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 8px;
  align-items: center;
}

#custom-hex {
  width: 44px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
}

.layouts { display: grid; gap: 6px; }

.layout {
  display: grid;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px 12px;
  cursor: pointer;
  border-radius: 2px;
}

.layout:hover, .layout.is-active { border-color: var(--ink); }
.layout.is-active { outline: 1px solid var(--ink); }

.layout strong {
  font-family: var(--cond);
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.layout span {
  color: var(--muted);
  font-size: 12px;
}

.layout.is-legacy { opacity: 0.72; }
.legacy-label {
  margin: 12px 0 2px;
  font-family: var(--cond);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--sans);
  font-weight: 400;
  margin-bottom: 10px;
  cursor: pointer;
}

#caption { margin-top: 4px; }

.actions {
  display: grid;
  gap: 8px;
}

.stage {
  background:
    radial-gradient(ellipse at 50% 30%, #3a3732 0%, var(--wall-2) 70%);
  display: grid;
  place-items: center;
  padding: 40px 48px;
  min-height: 100vh;
}

.stage-inner {
  width: min(100%, 560px);
}

.poster-frame {
  background: #111;
  padding: 14px;
  box-shadow: var(--shadow);
}

#poster-wrap, #poster-wrap svg, #poster {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 18 / 24;
  background: #fff;
}

.stage-caption {
  margin: 16px 0 0;
  text-align: center;
  color: #b8b2a8;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--cond);
}

/* Printable poster view */
#print-toolbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

#print-toolbar[hidden] { display: none !important; }

.print-size {
  display: flex;
  gap: 8px;
  align-items: center;
  font-family: var(--cond);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

body.print-view .panel,
body.print-view .stage-caption { display: none; }

body.print-view .app {
  display: block;
  min-height: 100vh;
  background: #ddd9d2;
  padding: 72px 24px 32px;
}

body.print-view .stage {
  background: transparent;
  min-height: 0;
  padding: 0;
  display: grid;
  place-items: center;
}

body.print-view .stage-inner {
  width: min(calc(100vw - 48px), calc((100vh - 120px) * 18 / 24));
}

body.print-view[data-print-size="letter"] .stage-inner {
  width: min(calc(100vw - 48px), calc((100vh - 120px) * 8.5 / 11));
}

body.print-view .poster-frame {
  padding: 0;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
  background: none;
}

@media print {
  @page {
    size: 18in 24in;
    margin: 0;
  }

  body[data-print-size="letter"] {
    /* letter is close in aspect; scale the 18×24 art onto the page */
  }

  body[data-print-size="letter"] @page {
    /* handled below */
  }

  #print-toolbar, .panel, .stage-caption { display: none !important; }

  body, .app, .stage, .stage-inner, .poster-frame, #poster-wrap, #poster-wrap svg {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
  }

  body.print-view .app { padding: 0 !important; }

  #poster-wrap svg {
    width: 100% !important;
    height: 100vh !important;
    aspect-ratio: auto;
  }
}

@page poster {
  size: 18in 24in;
  margin: 0;
}

@page letter {
  size: letter portrait;
  margin: 0;
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .panel {
    max-height: none;
    height: auto;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .panel-body { overflow: visible; }
  .stage { min-height: 80vh; padding: 24px; }
  .stage-inner { width: min(100%, 420px); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

.gen-line {
  margin: -6px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.waitlist {
  background: var(--panel);
  border: 1px dashed var(--line);
  padding: 12px 14px;
  margin: 0 0 12px;
}
.waitlist strong {
  display: block;
  font-family: var(--cond);
  font-size: 15px;
  margin-bottom: 4px;
}
.waitlist p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.config-picks {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 12px;
}
.config-picks label {
  display: grid;
  grid-template-columns: 64px 1fr;
  align-items: center;
  gap: 8px;
  font-family: var(--cond);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}
.swatch-name {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.swatch-code, .swatch-excl {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
}
.swatch-excl { letter-spacing: 0.02em; text-transform: none; }

.stance-note {
  margin: 0 0 0 72px;
  font-size: 12px;
}
