:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1a1d21;
  --muted: #667085;
  --line: #e2e5ea;
  --accent: #1f6feb;
  --accent-ink: #ffffff;
  --danger: #c0392b;
  --ok-bg: #e6f6ec;
  --ok-ink: #1e7a3c;
  --err-bg: #fdebea;
  --err-ink: #a52a1d;
  --radius: 10px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
}

main.narrow { max-width: 760px; margin: 0 auto; padding: 24px 16px 80px; }
main.full   { max-width: 1100px; margin: 0 auto; padding: 24px 16px 80px; }

h1 { font-size: 1.5rem; margin: 0.2em 0 0.6em; }
h2 { font-size: 1.05rem; margin: 1.2em 0 0.5em; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
code { background: #eef0f3; padding: 2px 6px; border-radius: 4px; font-size: 0.85em; }

/* ── Nav ── */
.topnav {
  display: flex; align-items: center; justify-content: space-between;
  background: #101418; color: #fff; padding: 10px 16px; flex-wrap: wrap; gap: 8px;
}
.topnav .brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.05rem; }
.topnav .brand span { color: #7ab3ff; font-weight: 400; }
.topnav .links { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.topnav .links a { color: #cfd6dd; text-decoration: none; }
.topnav .links a:hover { color: #fff; }
.linklike { background: none; border: 0; color: #8b97a3; cursor: pointer; font: inherit; padding: 0; }
.linklike:hover { color: #fff; }

/* ── Cards / layout ── */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; margin: 14px 0;
}
.auth-card { max-width: 400px; margin: 8vh auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .two-col { grid-template-columns: 1fr; } }

/* ── Forms ── */
label { display: block; margin: 10px 0; font-weight: 600; font-size: 0.9rem; }
label.check { font-weight: 400; }
input:not([type=checkbox]), textarea, select {
  display: block; width: 100%; margin-top: 4px;
  padding: 10px 12px; font: inherit;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
textarea { resize: vertical; }

.btn {
  display: inline-block; padding: 9px 16px; font: inherit; font-weight: 600;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
  cursor: pointer; text-decoration: none; text-align: center;
}
.btn:hover { border-color: #b9c0c9; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #175bc4; }
.btn.danger { color: var(--danger); border-color: #e5b6b0; }
.btn.danger:hover { background: var(--err-bg); }
.btn.small { padding: 5px 10px; font-size: 0.85rem; }
.btn.big { padding: 12px 26px; font-size: 1.05rem; }
.btn.wide { width: 100%; margin-top: 10px; }
.btn:disabled { opacity: 0.55; cursor: default; }
form.inline { display: inline; }

.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); margin: 16px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.flash { padding: 10px 14px; border-radius: 8px; margin: 10px 0; }
.flash.error { background: var(--err-bg); color: var(--err-ink); }
.flash.ok { background: var(--ok-bg); color: var(--ok-ink); }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.03em; vertical-align: middle;
}
.badge.muted { background: #98a2ad; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.disabled-row td { opacity: 0.5; }

.qr-wrap { text-align: center; margin: 14px 0; }
.qr-wrap img { border: 1px solid var(--line); border-radius: 8px; }

/* ── Dashboard grid ── */
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.vcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.vcard.sold { opacity: 0.75; }
.vthumb { display: block; position: relative; aspect-ratio: 4/3; background: #dde1e6; }
.vthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vthumb .noimg { width: 100%; height: 100%; }
.sold-badge {
  position: absolute; top: 8px; left: 8px; background: #101418; color: #fff;
  font-size: 0.7rem; font-weight: 700; padding: 3px 8px; border-radius: 4px;
}
.vbody { padding: 10px 12px 12px; }
.vtitle { font-weight: 700; color: var(--ink); text-decoration: none; display: block; }
.vmeta { color: var(--muted); font-size: 0.85rem; margin: 2px 0 8px; }
.vactions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Add/edit listing ── */
.vin-row { display: flex; gap: 10px; align-items: flex-end; }
.vin-row .grow { flex: 1; }
.vin-alt { margin-top: 8px; display: flex; align-items: center; gap: 10px; }
.filebtn {
  display: inline-block; padding: 8px 14px; border: 1px dashed var(--line);
  border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 0.9rem; margin: 0;
}
.filebtn:hover { border-color: var(--accent); color: var(--accent); }
.vin-card { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: #f0f6ff; border: 1px solid #cfe3ff; border-radius: 8px; margin-top: 12px; }

.dropzone {
  border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 22px; text-align: center; color: var(--muted);
  display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
}
.dropzone.over { border-color: var(--accent); background: #f0f6ff; }

.photo-list { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; padding: 0; margin: 12px 0; }
.photo-item {
  position: relative; width: 130px; aspect-ratio: 4/3; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--line); cursor: grab; background: #eef0f3;
}
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.photo-item.dragging { opacity: 0.4; }
.photo-item.new::after {
  content: "NEW"; position: absolute; bottom: 4px; left: 4px;
  background: var(--accent); color: #fff; font-size: 0.6rem; font-weight: 700;
  padding: 2px 5px; border-radius: 3px;
}
.photo-item:first-child::before {
  content: "COVER"; position: absolute; top: 4px; left: 4px; z-index: 1;
  background: #101418; color: #fff; font-size: 0.6rem; font-weight: 700;
  padding: 2px 5px; border-radius: 3px;
}
.remove-photo {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px;
  border: 0; border-radius: 50%; background: rgba(0,0,0,0.6); color: #fff;
  font-size: 14px; line-height: 1; cursor: pointer;
}
.remove-photo:hover { background: var(--danger); }

.publish-row { display: flex; align-items: center; gap: 14px; margin-top: 18px; flex-wrap: wrap; }
.danger-zone { border-color: #e5b6b0; }
.danger-zone form { margin-right: 8px; }
