/* Quality Cars Kenya — admin panel */
:root {
  --brand: #4b1c9c;
  --brand-hover: #3a1380;
  --brand-soft: #f5f1fc;
  --brand-line: #e3d9f5;
  --ink: #17131f;
  --ink-2: #464152;
  --muted: #7a7584;
  --line: #e9e7ee;
  --line-2: #f2f1f5;
  --bg: #f8f8fa;
  --card: #ffffff;
  --green: #128c4a;
  --green-soft: #eaf7ef;
  --amber: #b45309;
  --amber-soft: #fff4e5;
  --red: #c0262d;
  --red-soft: #fdeeee;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(23, 19, 31, .04), 0 12px 32px rgba(23, 19, 31, .08);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.55; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
img { display: block; max-width: 100%; }
.icon { width: 18px; height: 18px; flex: none; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 24px 16px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 28px; }
.brand svg { width: 36px; height: 36px; }
.brand .logo-img { height: 44px; width: auto; display: block; }
.login .brand .logo-img { height: 72px; }
.brand strong { display: block; font-size: 15px; letter-spacing: -0.01em; }
.brand span { display: block; font-size: 12px; color: var(--muted); }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--ink-2); font-weight: 500; }
.nav a:hover { background: var(--line-2); color: var(--ink); }
.nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav .count { margin-left: auto; background: var(--brand); color: #fff; font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 1px 8px; }
.sidebar-foot { margin-top: auto; display: grid; gap: 2px; border-top: 1px solid var(--line); padding-top: 16px; }
.sidebar-foot .who { padding: 4px 12px 10px; font-size: 13px; color: var(--muted); }

.main { min-width: 0; padding: 32px 40px 64px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.topbar h1 { font-size: 26px; }
.topbar p { color: var(--muted); margin-top: 4px; }
.topbar .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.mobile-bar { display: none; }
.sidebar-back { display: none; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent; font-weight: 600; font-size: 14.5px; white-space: nowrap; transition: background-color .15s, border-color .15s, color .15s; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-outline { background: #fff; border-color: var(--line); }
.btn-outline:hover { border-color: var(--ink); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #a11d23; }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--line-2); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.icon-btn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid transparent; background: transparent; display: inline-grid; place-items: center; color: var(--ink-2); }
.icon-btn:hover { background: var(--line-2); color: var(--ink); }
.icon-btn.danger:hover { background: var(--red-soft); color: var(--red); }

/* ---------- Cards / stats ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.card-pad { padding: 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 16px; letter-spacing: -0.01em; }
.card-head a { font-size: 14px; font-weight: 600; color: var(--brand); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat { padding: 20px 22px; }
.stat small { display: block; font-size: 13px; color: var(--muted); font-weight: 500; }
.stat strong { display: block; font-size: 28px; letter-spacing: -0.03em; margin-top: 6px; }
.stat span { font-size: 13px; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 14px 24px; border-bottom: 1px solid var(--line-2); }
.list-row:last-child { border-bottom: 0; }
.list-row img { width: 64px; height: 48px; object-fit: cover; border-radius: 8px; background: var(--line-2); flex: none; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--ink); font-size: 17px; margin-bottom: 6px; }
.empty .btn { margin-top: 16px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-available { background: var(--green-soft); color: var(--green); }
.badge-reserved { background: var(--amber-soft); color: var(--amber); }
.badge-sold { background: var(--line-2); color: var(--ink-2); }
.badge-new { background: var(--brand-soft); color: var(--brand); }

/* ---------- Table ---------- */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.toolbar .search { position: relative; flex: 1; min-width: 220px; }
.toolbar .search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.toolbar .search .input { padding-left: 38px; }
.seg { display: inline-flex; background: var(--line-2); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 13.5px; color: var(--muted); }
.seg button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 14px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfcfd; }
.car-cell { display: flex; align-items: center; gap: 14px; min-width: 260px; }
.car-cell img { width: 76px; height: 56px; border-radius: 8px; object-fit: cover; background: var(--line-2); flex: none; }
.car-cell strong { display: block; font-weight: 600; }
.car-cell span { font-size: 13px; color: var(--muted); }
.price { font-weight: 700; white-space: nowrap; }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; }
.status-select { height: 32px; border: 1px solid var(--line); border-radius: 8px; padding: 0 28px 0 10px; font-size: 13px; font-weight: 600; appearance: none; -webkit-appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237a7584' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center; cursor: pointer; }
.status-select.available { color: var(--green); }
.status-select.reserved { color: var(--amber); }
.status-select.sold { color: var(--ink-2); }
.star { border: 0; background: none; padding: 4px; color: #cfcbd6; display: inline-grid; border-radius: 6px; }
.star:hover { background: var(--line-2); }
.star.on { color: #e3a008; }
.star .icon { width: 20px; height: 20px; }

/* ---------- Forms ---------- */
.input { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 14.5px; outline: 0; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea.input { height: auto; min-height: 140px; padding: 10px 12px; resize: vertical; line-height: 1.55; }
select.input { appearance: none; -webkit-appearance: none; padding-right: 34px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237a7584' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center; cursor: pointer; }
.input.invalid { border-color: var(--red); }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 46px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); display: grid; place-items: center; }
.pw-toggle:hover { background: var(--line-2); color: var(--ink); }
.pw-toggle[aria-pressed="true"] { color: var(--brand); }
.pw-wrap input::-ms-reveal, .pw-wrap input::-ms-clear { display: none; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 20px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: 1 / -1; }
.fld { display: grid; gap: 6px; align-content: start; }
.fld > span { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.fld > span em { color: var(--red); font-style: normal; }
.fld small { font-size: 12.5px; color: var(--muted); }
.prefix { position: relative; }
.prefix b { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--muted); font-weight: 600; }
.prefix .input { padding-left: 46px; }
.suffix { position: relative; }
.suffix b { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--muted); font-weight: 600; }
.suffix .input { padding-right: 40px; }
.toggle { display: flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 500; }
.toggle input { appearance: none; -webkit-appearance: none; width: 40px; height: 24px; border-radius: 999px; background: #d9d6df; position: relative; margin: 0; transition: background-color .15s; cursor: pointer; flex: none; }
.toggle input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle input:checked { background: var(--brand); }
.toggle input:checked::after { transform: translateX(16px); }
.toggle small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 400; }

.editor { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.editor .side { position: sticky; top: 24px; display: grid; gap: 24px; }
.section-card + .section-card { margin-top: 24px; }
.section-card h2 { font-size: 16px; margin-bottom: 4px; }
.section-card .hint { color: var(--muted); font-size: 13.5px; margin-bottom: 20px; }
.form-error { background: var(--red-soft); color: var(--red); padding: 12px 14px; border-radius: 10px; font-size: 14px; font-weight: 500; }
.form-ok { background: var(--green-soft); color: var(--green); padding: 12px 14px; border-radius: 10px; font-size: 14px; font-weight: 500; }

/* Photo manager */
.dropzone { border: 2px dashed #d7d3de; border-radius: 14px; padding: 32px 20px; text-align: center; background: #fcfcfd; cursor: pointer; transition: border-color .15s, background-color .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: var(--brand-soft); }
.dropzone .dz-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; margin: 0 auto 12px; }
.dropzone .dz-icon .icon { width: 22px; height: 22px; }
.dropzone strong { display: block; font-size: 15px; }
.dropzone span { font-size: 13.5px; color: var(--muted); }
.dropzone u { color: var(--brand); text-decoration: none; font-weight: 600; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 16px; }
.photo { position: relative; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: var(--line-2); border: 1px solid var(--line); cursor: grab; }
.photo img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.photo.dragging { opacity: .4; }
.photo.drop-target { outline: 2px solid var(--brand); outline-offset: 2px; }
.photo .cover { position: absolute; left: 8px; top: 8px; background: var(--brand); color: #fff; font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.photo .tools { position: absolute; right: 6px; top: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.photo:hover .tools, .photo:focus-within .tools { opacity: 1; }
.photo .tools button { width: 30px; height: 30px; border: 0; border-radius: 8px; background: rgba(255,255,255,.95); display: grid; place-items: center; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.photo .tools button:hover { color: var(--brand); }
.photo .tools button.del:hover { color: var(--red); }
.photo .tools .icon { width: 16px; height: 16px; }
.photo.uploading { display: grid; place-items: center; cursor: default; }
.photo.uploading .bar { position: absolute; left: 12px; right: 12px; bottom: 12px; height: 6px; border-radius: 999px; background: #fff; overflow: hidden; }
.photo.uploading .bar i { display: block; height: 100%; background: var(--brand); width: 0; transition: width .2s; }
.photo.uploading span { font-size: 13px; color: var(--muted); font-weight: 600; }
.url-row { display: flex; gap: 8px; margin-top: 16px; }
.photo-tip { font-size: 13px; color: var(--muted); margin-top: 12px; }

/* Features */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 16px; }
.check { display: flex; align-items: center; gap: 10px; padding: 6px 0; cursor: pointer; font-size: 14.5px; }
.check input { appearance: none; -webkit-appearance: none; width: 18px; height: 18px; border: 1.5px solid #c9c5d1; border-radius: 5px; margin: 0; flex: none; display: grid; place-items: center; cursor: pointer; }
.check input:checked { background: var(--brand); border-color: var(--brand); }
.check input:checked::after { content: ''; width: 9px; height: 5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translate(1px, -1px); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tag { display: inline-flex; align-items: center; gap: 6px; background: var(--brand-soft); color: var(--brand); border-radius: 999px; padding: 5px 6px 5px 12px; font-size: 13.5px; font-weight: 600; }
.tag button { border: 0; background: none; color: inherit; display: grid; place-items: center; padding: 2px; border-radius: 50%; }
.tag button:hover { background: var(--brand-line); }
.tag .icon { width: 14px; height: 14px; }

.preview-card { overflow: hidden; }
.preview-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--line-2); }
.preview-card .body { padding: 16px 18px 18px; }
.preview-card .body small { color: var(--muted); font-size: 12.5px; }
.preview-card .body h3 { font-size: 16px; margin-top: 2px; }
.preview-card .body .p { font-size: 20px; font-weight: 800; margin-top: 10px; letter-spacing: -0.02em; }

.save-bar { position: sticky; bottom: 0; z-index: 5; margin: 24px -40px -64px; padding: 16px 40px; background: rgba(255,255,255,.96); backdrop-filter: blur(8px); border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; align-items: center; }
.save-bar .msg { margin-right: auto; font-size: 14px; color: var(--muted); }

/* Inquiries */
.inq { padding: 20px 24px; border-bottom: 1px solid var(--line-2); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 24px; }
.inq:last-child { border-bottom: 0; }
.inq.unread { background: #fdfcff; box-shadow: inset 3px 0 0 var(--brand); }
.inq-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inq-head strong { font-size: 15.5px; }
.inq-meta { font-size: 13.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 4px; }
.inq-meta a:hover { color: var(--brand); }
.inq-car { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--brand); margin-top: 10px; }
.inq-msg { margin-top: 10px; color: var(--ink-2); white-space: pre-line; font-size: 14.5px; max-width: 760px; }
.inq-actions { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #fff; }
.login { width: 100%; max-width: 400px; }
.login .brand { padding: 0 0 36px; justify-content: center; }
.login h1 { font-size: 26px; text-align: center; }
.login > p { color: var(--muted); text-align: center; margin: 8px 0 28px; }
.login form { display: grid; gap: 16px; }
.login .btn { height: 48px; }
.login .foot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 28px; }

/* Toasts & modal */
#toasts { position: fixed; right: 24px; bottom: 24px; z-index: 200; display: grid; gap: 10px; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 10px; font-size: 14px; font-weight: 500; box-shadow: var(--shadow); display: flex; align-items: center; gap: 10px; animation: toast-in .2s ease; max-width: 380px; }
.toast.err { background: var(--red); }
.toast .icon { width: 18px; height: 18px; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
.modal-back { position: fixed; inset: 0; z-index: 150; background: rgba(23, 19, 31, .45); display: grid; place-items: center; padding: 24px; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { background: #fff; border-radius: 16px; padding: 28px; width: 100%; max-width: 420px; box-shadow: var(--shadow); }
.modal h3 { font-size: 18px; margin-bottom: 8px; }
.modal p { color: var(--ink-2); }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

.loading { padding: 64px; display: grid; place-items: center; color: var(--muted); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsive ---------- */
.tabbar, .m-price, .dropzone .dz-touch { display: none; }
.mobile-bar-actions { display: flex; gap: 4px; }

@media (max-width: 1200px) {
  .editor { grid-template-columns: minmax(0, 1fr); }
  .editor .side { position: static; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1000px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid .span-2 { grid-column: 1 / -1; }
}

/* Touch screens have no hover, so photo buttons are always visible */
@media (hover: none) {
  .photo { cursor: default; }
  .photo .tools { opacity: 1; }
  .dropzone .dz-mouse { display: none; }
  .dropzone .dz-touch { display: block; }
}

/* ---------- Phones & small tablets ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 100; transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .sidebar-back.open { display: block; position: fixed; inset: 0; z-index: 90; background: rgba(23, 19, 31, .35); }
  .mobile-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
    background: rgba(255, 255, 255, .97); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
  }
  .mobile-bar .brand { padding: 0; }
  .mobile-bar .brand svg { width: 32px; height: 32px; }
  .mobile-bar .brand .logo-img { height: 38px; }

  /* Bottom tab bar */
  .tabbar {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: rgba(255, 255, 255, .97); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; min-height: 52px; padding: 4px 0; font-size: 11px; font-weight: 600; color: var(--muted); -webkit-tap-highlight-color: transparent; }
  .tabbar a .icon { width: 23px; height: 23px; }
  .tabbar a.active { color: var(--brand); }
  .tabbar .tab-add b { width: 42px; height: 34px; border-radius: 12px; background: var(--brand); color: #fff; display: grid; place-items: center; }
  .tabbar .tab-add b .icon { width: 22px; height: 22px; }
  .tabbar .tab-add { color: var(--brand); }
  .tabbar .count { position: absolute; top: 2px; left: calc(50% + 5px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: 10.5px; font-style: normal; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; box-sizing: content-box; }
  body.is-editor .tabbar { display: none; }

  .main { padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); }
  body.is-editor .main { padding-bottom: 0; }
  .hide-m { display: none !important; }

  /* Comfortable tap targets; 16px text stops iPhones zooming in on inputs */
  .input, select.input { height: 48px; font-size: 16px; }
  textarea.input { font-size: 16px; }
  .btn { height: 46px; }
  .btn-sm { height: 40px; }
  .icon-btn { width: 42px; height: 42px; }
  .check { padding: 9px 0; font-size: 15px; }
  .check input { width: 22px; height: 22px; }
  .toggle input { width: 46px; height: 28px; }
  .toggle input::after { width: 22px; height: 22px; }
  .toggle input:checked::after { transform: translateX(18px); }

  .topbar { margin-bottom: 20px; gap: 12px; }
  .topbar h1 { font-size: 24px; }
  .topbar .actions { width: 100%; }
  .topbar .actions .btn { flex: 1; }
  .card-pad { padding: 20px 18px; }
  .card-head { padding: 16px 18px; }
  .list-row { padding: 12px 18px; }

  /* Cars table becomes a list of cards */
  .toolbar { padding: 14px 16px; }
  .toolbar .search { min-width: 100%; }
  .seg { width: 100%; }
  .seg button { flex: 1; padding: 9px 6px; }
  .table-wrap { overflow: visible; }
  .car-table, .car-table tbody { display: block; }
  .car-table thead { display: none; }
  .car-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "car car car" "status star actions"; gap: 12px 6px; align-items: center; padding: 16px; border-bottom: 1px solid var(--line-2); }
  .car-table tr:last-child { border-bottom: 0; }
  .car-table td { display: block; padding: 0; border: 0; }
  .car-table td:nth-child(1) { grid-area: car; }
  .car-table td:nth-child(2), .car-table td:nth-child(3), .car-table td:nth-child(6) { display: none; }
  .car-table td:nth-child(4) { grid-area: status; }
  .car-table td:nth-child(5) { grid-area: star; }
  .car-table td:nth-child(7) { grid-area: actions; }
  .car-table td[colspan] { grid-column: 1 / -1; }
  .car-cell { min-width: 0; align-items: flex-start; }
  .car-cell img { width: 96px; height: 72px; border-radius: 10px; }
  .car-cell strong { line-height: 1.35; }
  .car-cell .m-price { display: block; font-size: 15px; font-weight: 800; color: var(--ink); margin: 2px 0; }
  .status-select { width: 100%; height: 42px; font-size: 14px; }
  .star { width: 42px; height: 42px; place-items: center; }
  .star .icon { width: 22px; height: 22px; }

  /* Car editor */
  .editor .side { grid-template-columns: minmax(0, 1fr); }
  .section-card + .section-card { margin-top: 16px; }
  .dropzone { padding: 22px 16px; }
  .dropzone .dz-mouse { display: none; }
  .dropzone .dz-touch { display: block; }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .photo .tools { right: 5px; top: 5px; }
  .photo .tools button { width: 32px; height: 32px; }
  .url-row .input { min-width: 0; }
  .feature-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .save-bar {
    margin: 24px -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    flex-wrap: wrap; gap: 10px;
  }
  .save-bar .msg { flex-basis: 100%; margin: 0; }
  .save-bar .msg:empty { display: none; }
  .save-bar .btn { flex: 1; height: 48px; }

  /* Inquiries */
  .inq { grid-template-columns: minmax(0, 1fr); padding: 18px; }
  .inq-actions { justify-content: flex-start; }
  .inq-actions .btn { flex: 1; }

  /* Feedback */
  #toasts { left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); }
  body.is-editor #toasts { bottom: calc(96px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }
  .modal-back { align-items: end; padding: 0; }
  .modal { max-width: none; border-radius: 20px 20px 0 0; padding: 24px 20px calc(20px + env(safe-area-inset-bottom)); }
  .modal .actions .btn { flex: 1; height: 48px; }

  /* Settings */
  form.section-card > div > .btn-primary { flex: 1; }
}

@media (max-width: 560px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid > div:empty { display: none; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 16px; }
  .stat strong { font-size: 22px; }
  .hide-sm { display: none; }
  .login .brand { padding-bottom: 28px; }
}
