:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --border: #e2e5eb;
  --text: #1a1f28;
  --text-muted: #667085;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-ink: #ffffff;
  --success: #167a45;
  --success-bg: #e6f4ea;
  --warn: #b06a12;
  --warn-bg: #fdf2e3;
  --danger: #c0392b;
  --danger-bg: #fbebe9;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(20, 24, 33, 0.05), 0 4px 12px rgba(20, 24, 33, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, "Noto Sans", Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0 0 8px; font-weight: 700; line-height: 1.25; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 12px; }
.muted { color: var(--text-muted); }

/* ---------- Layout shells ---------- */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.site-header .row {
  max-width: 1160px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { font-weight: 800; font-size: 1.2rem; color: var(--text); }
.site-nav { display: flex; gap: 20px; font-size: 14px; font-weight: 600; }
.site-nav a { color: var(--text-muted); }
.site-nav a:hover { color: var(--text); text-decoration: none; }

.container { max-width: 1160px; margin: 0 auto; padding: 28px 20px 60px; }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 20px; text-align: center; color: var(--text-muted); font-size: 13.5px;
}
.site-footer nav { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; margin-bottom: 10px; }

/* ---------- Admin shell ---------- */

.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 230px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border); padding: 18px 12px;
}
.admin-sidebar .brand { padding: 4px 10px 20px; display: block; }
.admin-sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.admin-sidebar a {
  color: var(--text-muted); font-weight: 600; font-size: 14px;
  padding: 9px 12px; border-radius: 6px;
}
.admin-sidebar a:hover { background: var(--bg); text-decoration: none; color: var(--text); }
.admin-sidebar a.active { background: var(--accent); color: var(--accent-ink); }
.admin-main { flex: 1; min-width: 0; }
.admin-topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 12px 24px; display: flex; align-items: center; justify-content: space-between;
}
.admin-content { padding: 24px; }
.role-pill {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase; background: #eef2ff; color: #4338ca;
  padding: 3px 9px; border-radius: 99px;
}

@media (max-width: 860px) {
  .admin-sidebar { display: none; }
  .site-nav { display: none; }
}

/* ---------- Mobile bottom nav (public site) ---------- */

.bottom-nav { display: none; }

@media (max-width: 860px) {
  body { padding-bottom: 64px; }

  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom, 0);
    box-shadow: 0 -2px 10px rgba(20, 24, 33, 0.06);
  }
  .bottom-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 8px 4px 7px; color: var(--text-muted); font-size: 11px; font-weight: 600;
  }
  .bottom-nav a:hover { text-decoration: none; }
  .bottom-nav a svg { width: 22px; height: 22px; }
  .bottom-nav a.active { color: var(--accent); }
}

/* ---------- Cards, grids ---------- */

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 700px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.kpi .label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.kpi .value { font-size: 1.4rem; font-weight: 800; margin-top: 2px; }

/* ---------- Forms ---------- */

label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
input, select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.field { margin-bottom: 14px; }
.field-row { display: flex; gap: 12px; }
.field-row > .field { flex: 1; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid transparent; border-radius: 6px; padding: 9px 16px;
  font-size: 14px; font-weight: 600; font-family: inherit;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; }
.btn-outline { background: #fff; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-outline { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn[disabled] { opacity: .55; cursor: default; }

.auth-shell { max-width: 380px; margin: 60px auto; }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); background: var(--bg); }
tbody tr:last-child td { border-bottom: none; }

/* ---------- Badges / alerts ---------- */

.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; }
.badge-live, .badge-approved  { background: var(--success-bg); color: var(--success); }
.badge-pending    { background: var(--warn-bg); color: var(--warn); }
.badge-rejected, .badge-expired { background: var(--danger-bg); color: var(--danger); }
.badge-draft, .badge-sold  { background: #eef0f3; color: var(--text-muted); }

.alert { padding: 10px 14px; border-radius: 6px; font-size: 14px; margin-bottom: 16px; }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-info { background: #eef2ff; color: #4338ca; }

/* ---------- Public bits ---------- */

.hero { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 32px; text-align: center; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--border); border-radius: 99px; padding: 6px 14px; font-size: 13.5px; font-weight: 600; background: #fff; }
.listing-card, .model-card {
  display: block; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; background: var(--surface); box-shadow: var(--shadow); position: relative;
}
.listing-card .price { font-size: 1.15rem; font-weight: 800; color: var(--accent); margin: 4px 0; }
.tools-grid .card h2 { margin-top: 0; }

.chip { cursor: pointer; }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip a { color: inherit; }
.chip a:hover { text-decoration: none; }

.badge-new { background: #eef2ff; color: #4338ca; position: absolute; top: 10px; right: 10px; }

/* ---------- Star ratings ---------- */

.stars { display: inline-flex; gap: 1px; color: #d8dce3; font-size: 15px; line-height: 1; }
.stars .filled { color: #f5a524; }
.rating-summary { display: flex; align-items: center; gap: 8px; margin: 4px 0 12px; }
.rating-summary .score { font-weight: 800; font-size: 1.1rem; }
.rating-summary .count { color: var(--text-muted); font-size: 13px; }
.review-item { border-bottom: 1px solid var(--border); padding: 12px 0; }
.review-item:last-child { border-bottom: none; }
.review-item .review-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.review-item .reviewer { font-weight: 700; }
.review-item .review-date { color: var(--text-muted); font-size: 12px; }
.star-input { display: flex; flex-direction: row-reverse; gap: 4px; justify-content: flex-end; font-size: 26px; }
.star-input input { display: none; }
.star-input label { width: auto; margin: 0; cursor: pointer; color: #d8dce3; }
.star-input input:checked ~ label,
.star-input label:hover,
.star-input label:hover ~ label { color: #f5a524; }

/* ---------- Image slider ---------- */

.slider { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: #000; }
.slider-track { display: flex; transition: transform .3s ease; }
.slider-track img { width: 100%; flex: 0 0 100%; height: 360px; object-fit: cover; }
.slider-btn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  background: rgba(0,0,0,.45); color: #fff; border: 0; border-radius: 50%;
  width: 36px; height: 36px; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.slider-btn:hover { background: rgba(0,0,0,.65); }
.slider-btn.prev { left: 10px; }
.slider-btn.next { right: 10px; }
.slider-dots { position: absolute; bottom: 10px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; z-index: 2; }
.slider-dots button {
  width: 8px; height: 8px; border-radius: 50%; border: 0; background: rgba(255,255,255,.55); cursor: pointer; padding: 0;
}
.slider-dots button.active { background: #fff; }
@media (max-width: 700px) {
  .slider-track img { height: 220px; }
}
