/* Classic Chasers Inventory — admin UI
   Brand colors from the Classic Chasers mockup. Not Fun Car Bids. */
:root {
  --ink: #16130f;
  --ink2: #2a2620;
  --paper: #faf7f2;
  --card: #fff;
  --line: #e6dfd3;
  --muted: #5f574b;
  --red: #b3141f;
  --red2: #8e0f18;
  --gold: #b08a4a;
  --gold-soft: #efe4ce;
  --success: #1f6b45;
  --warning: #8a5a12;
  --nav-w: 240px;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(22, 19, 15, 0.06);
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { color-scheme: light; }
body {
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: var(--red2); }
a:hover { color: var(--red); }
h1, h2, h3 { font-family: var(--display); font-weight: 650; letter-spacing: -0.02em; margin: 0 0 .4em; }
h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h2 { font-size: 1.25rem; }
code, .code-block { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: .86em; }
.skip-link {
  position: absolute; left: -999px; top: 8px;
}
.skip-link:focus { left: 8px; background: #fff; padding: 8px 12px; z-index: 20; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

.app { display: flex; min-height: 100vh; }
.sidenav {
  width: var(--nav-w);
  background: var(--ink);
  color: #f4eee4;
  padding: 1.25rem 1rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex-shrink: 0;
}
.brand { display: flex; gap: .8rem; align-items: center; color: inherit; text-decoration: none; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--red); color: #fff;
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 650; font-size: 1.05rem;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-family: var(--display); font-size: 1.05rem; }
.brand-text em { font-style: normal; color: #cbbfaa; font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; }
.sidenav nav { display: flex; flex-direction: column; gap: .25rem; }
.sidenav nav a {
  color: #f4eee4; text-decoration: none; padding: .7rem .8rem;
  border-radius: 10px; min-height: 44px; display: flex; align-items: center;
}
.sidenav nav a:hover, .sidenav nav a:focus-visible, .sidenav nav a.is-active {
  background: #2f2a24; color: #fff;
}
.sidenav nav a.is-active { box-shadow: inset 3px 0 0 var(--gold); }
.sidenav-note { margin-top: auto; color: #9c9183; font-size: .78rem; }

.shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: .75rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: rgba(250,247,242,.92);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 5;
}
.topbar-title { font-family: var(--display); font-weight: 650; flex: 1; }
.topbar-user { display: flex; align-items: center; gap: .75rem; color: var(--muted); font-size: .92rem; }
.nav-toggle { display: none; }
.main { padding: 1.5rem 1.75rem 3rem; max-width: 1240px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; color: var(--gold); font-weight: 600; margin: 0 0 .25rem; }
.lede { color: var(--muted); margin: 0; max-width: 60ch; }
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}
.stat-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 1.5rem; }
.stat-grid.compact { grid-template-columns: repeat(5, 1fr); }
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  text-decoration: none; color: inherit;
  box-shadow: var(--shadow);
  min-height: 88px;
}
.stat-label { display: block; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
.stat-value { font-family: var(--display); font-size: 2rem; font-weight: 650; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 1rem;
  border-radius: 999px; border: 1px solid var(--line);
  background: #fff; color: var(--ink);
  font: inherit; font-weight: 500;
  text-decoration: none; cursor: pointer;
}
.btn:hover, .btn:focus-visible { border-color: var(--ink); color: var(--ink); }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover, .btn-primary:focus-visible { background: var(--red2); border-color: var(--red2); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { min-height: 36px; padding: 0 .75rem; font-size: .9rem; }
.btn-block { width: 100%; }
.btn-danger { color: var(--red); border-color: #f0c9cc; }
.inline { display: inline; }

.flash { border-radius: 12px; padding: .85rem 1rem; margin-bottom: 1rem; }
.flash-success { background: #e8f6ee; color: var(--success); }
.flash-error { background: #fdecee; color: var(--red2); }

.badge {
  display: inline-block; padding: .15rem .5rem; border-radius: 999px;
  font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  background: var(--gold-soft); color: #6a5224;
}
.badge-active, .badge-success, .badge-dry_run { background: #e8f6ee; color: var(--success); }
.badge-sold, .badge-failed, .badge-error { background: #fdecee; color: var(--red2); }
.badge-hold, .badge-partial, .badge-needs_manual, .badge-warning { background: #fff3dd; color: var(--warning); }
.badge-draft, .badge-withdrawn, .badge-skipped { background: #eceae6; color: var(--muted); }
.badge-type-manual { background: #eceae6; color: var(--muted); }
.badge-type-csv, .badge-type-xml, .badge-type-api { background: #e8f1f6; color: #1d4f6e; }

.filters { display: flex; gap: .6rem; margin-bottom: 1rem; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { min-height: 44px; width: auto; flex: 1; min-width: 160px; }
input, select, textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .6rem .75rem;
}
input[readonly] { background: #f4f1ea; }
textarea { resize: vertical; }
label { display: flex; flex-direction: column; gap: .35rem; font-weight: 500; margin-bottom: .9rem; }
.hint { font-weight: 400; color: var(--muted); font-size: .84rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: .75rem; margin: 1rem 0 2rem; flex-wrap: wrap; }
.vin-actions { grid-column: 1 / -1; display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .7rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.plain-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .6rem; }
.code-block { background: #16130f; color: #f4eee4; padding: 1rem; border-radius: 12px; overflow: auto; font-size: .82rem; }

.vehicle-list { display: flex; flex-direction: column; gap: 10px; }
.vehicle-row {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  gap: 1rem; align-items: center;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .7rem 1rem;
  text-decoration: none; color: inherit;
  box-shadow: var(--shadow);
}
.vehicle-row, .vehicle-row:visited, .vehicle-row:hover { color: inherit; }
.vehicle-row:hover { border-color: #cfc4b1; }
.stat, .stat:visited, .stat:hover { color: inherit; text-decoration: none; }
.vehicle-thumb { width: 96px; height: 68px; border-radius: 10px; overflow: hidden; background: #ece6da; }
.vehicle-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-empty { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: .8rem; }
.vehicle-title { font-family: var(--display); font-weight: 650; font-size: 1.1rem; }
.vehicle-sub { color: var(--muted); font-size: .9rem; display: flex; gap: .7rem; flex-wrap: wrap; }
.stock { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink2); }
.vehicle-side { text-align: right; display: flex; flex-direction: column; gap: .35rem; align-items: flex-end; }
.price { font-family: var(--display); font-weight: 650; font-size: 1.15rem; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; list-style: none; padding: 0; }
.photo-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; position: relative; cursor: grab; }
.photo-card img { height: 120px; width: 100%; object-fit: cover; }
.photo-card .badge { position: absolute; top: 8px; left: 8px; }
.photo-actions { display: flex; gap: 4px; padding: 6px; flex-wrap: wrap; }
.upload-form { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.file-label input { margin-top: .35rem; }
.channels-table tr.is-enabled { background: #fbf8f1; }
.feed-cell code { word-break: break-all; }
.run-list { list-style: none; padding: 0; margin: 0; }
.run-list a { display: block; padding: .55rem .4rem; text-decoration: none; color: inherit; border-radius: 8px; }
.run-list li.is-active a { background: var(--gold-soft); }
.stack { display: flex; flex-direction: column; gap: .75rem; }

.login-body {
  min-height: 100vh;
  display: grid; place-items: center;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(176,138,74,.18), transparent 50%),
    var(--paper);
  padding: 1.5rem;
}
.login-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow);
}
.login-card h1 { font-size: 2.2rem; }


.sidenav nav a .nav-badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  min-height: 1.35rem;
  padding: 0 .4rem;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
}
.inquiries-table td { vertical-align: top; }
.inquiries-table tr.is-handled td { color: var(--muted); }
.inquiry-when { white-space: nowrap; }
.inquiry-message { max-width: 28rem; overflow-wrap: anywhere; white-space: pre-wrap; }
.inquiry-actions { display: flex; flex-direction: column; align-items: flex-start; gap: .4rem; }
.inquiry-actions .btn { min-height: 44px; }

@media (max-width: 960px) {
  .stat-grid, .stat-grid.compact, .grid-2, .form-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 800px) {
  .sidenav {
    position: fixed; inset: 0 auto 0 0; z-index: 20;
    transform: translateX(-105%);
    transition: transform .2s ease;
  }
  body.nav-open .sidenav { transform: none; }
  .nav-toggle { display: inline-flex; }
  .main { padding: 1rem; }
  .vehicle-row { grid-template-columns: 72px 1fr; }
  .vehicle-side { grid-column: 2; flex-direction: row; align-items: center; justify-content: space-between; }
  .stat-grid, .stat-grid.compact { grid-template-columns: 1fr 1fr; }
  .grid-2, .form-grid { grid-template-columns: 1fr; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .table-wrap table { min-width: 32rem; }
  .plain-list li { overflow-wrap: anywhere; }

  .nav-toggle {
    min-height: 44px; min-width: 44px;
    border: 1px solid var(--line); background: #fff;
    font-weight: 600;
  }
}
@media (max-width: 520px) {
  .topbar-user span { display: none; }
}
