:root {
  --primary: hsl(198 60% 45%);
  --primary-dark: hsl(198 60% 34%);
  --primary-soft: hsl(198 61% 95%);
  --accent: hsl(49 100% 55%);
  --ink: hsl(0 0% 8%);
  --muted: hsl(0 0% 42%);
  --line: hsl(0 0% 88%);
  --surface: #fff;
  --canvas: hsl(210 20% 97%);
  --danger: #b42318;
  --success: #067647;
  --warning: #b54708;
  --radius: 16px;
  --shadow: 0 14px 40px rgba(0, 0, 0, .08);
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--canvas); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at 15% 15%, rgba(45,146,184,.13), transparent 30%), radial-gradient(circle at 85% 80%, rgba(255,221,26,.12), transparent 28%), #f6f8fa; }
.login-card { width: min(440px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 24px; padding: 38px; box-shadow: var(--shadow); }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 32px; }
.login-brand img { width: 72px; height: 72px; object-fit: contain; }
.login-brand strong { display: block; font-size: 1.12rem; }
.login-brand span { color: var(--muted); font-size: .9rem; }
.login-card h1 { margin: 0 0 8px; font-size: 1.8rem; }
.login-card > p { margin: 0 0 26px; color: var(--muted); }

.field { display: grid; gap: 7px; }
.field + .field { margin-top: 16px; }
.field label, .field-label { font-size: .84rem; font-weight: 700; color: #353535; }
.input, .select { width: 100%; min-height: 46px; border: 1px solid #d5d9dd; border-radius: 10px; background: #fff; padding: 10px 12px; outline: none; transition: .15s ease; }
.input:focus, .select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(45,146,184,.12); }
.input[disabled] { background: #f1f3f5; color: #777; }
.help { color: var(--muted); font-size: .78rem; line-height: 1.45; }
.error-text { color: var(--danger); margin-top: 12px; font-size: .88rem; }

.btn { min-height: 42px; border-radius: 10px; border: 1px solid transparent; padding: 9px 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 750; transition: .15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: wait; transform: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-dark { background: #111; color: #fff; }
.btn-light { background: #fff; border-color: var(--line); color: #222; }
.btn-danger { background: #fff; border-color: #f0b7b2; color: var(--danger); }
.btn-full { width: 100%; margin-top: 22px; }
.btn-icon { width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); background: #fff; border-radius: 9px; }

.app-shell { min-height: 100vh; }
.topbar { height: 76px; padding: 0 28px; background: #111; color: #fff; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20; }
.topbar-brand { display: flex; align-items: center; gap: 12px; }
.topbar-brand-button { border: 0; padding: 0; background: transparent; color: inherit; text-align: left; font: inherit; cursor: pointer; }
.topbar-brand-button:hover { opacity: .9; }
.topbar-brand-button:focus-visible { outline: 2px solid #fff; outline-offset: 5px; border-radius: 6px; }
.topbar-brand img { width: 54px; height: 54px; object-fit: contain; filter: invert(1); }
.topbar-brand strong { font-size: 1rem; }
.topbar-brand span { display: block; color: #b8b8b8; font-size: .77rem; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-user { color: #ddd; font-size: .86rem; }

.main { width: min(1260px, calc(100% - 40px)); margin: 0 auto; padding: 34px 0 60px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.page-head h1 { margin: 0; font-size: clamp(1.65rem, 3vw, 2.15rem); }
.page-head p { margin: 6px 0 0; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.stat span { color: var(--muted); font-size: .8rem; }
.stat strong { display: block; margin-top: 4px; font-size: 1.5rem; }
.toolbar { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; gap: 12px; margin-bottom: 16px; }
.toolbar .input { flex: 1; }
.toolbar .select { width: 190px; }

.vehicle-list { display: grid; gap: 12px; }
.vehicle-row { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: grid; grid-template-columns: 118px minmax(0, 1fr) auto; gap: 16px; align-items: center; }
.vehicle-thumb { width: 118px; aspect-ratio: 4/3; border-radius: 10px; background: #eceff1; object-fit: cover; }
.vehicle-info { min-width: 0; }
.vehicle-title { margin: 0 0 6px; font-size: 1.03rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vehicle-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); font-size: .83rem; }
.vehicle-price { margin-top: 8px; font-weight: 800; font-size: 1rem; }
.vehicle-actions { display: flex; gap: 8px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.badge { padding: 4px 8px; border-radius: 999px; font-size: .7rem; font-weight: 800; background: #eef2f4; }
.badge.available { color: var(--success); background: #ecfdf3; }
.badge.reserved { color: var(--warning); background: #fff7ed; }
.badge.sold { color: var(--danger); background: #fef3f2; }
.badge.featured { color: #6c5700; background: #fff8c4; }
.empty { background: #fff; border: 1px dashed #cdd3d8; border-radius: 16px; padding: 50px 22px; text-align: center; color: var(--muted); }

.editor-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 4px 16px rgba(0,0,0,.025); overflow: hidden; }
.editor-nav { display: flex; gap: 0; border-bottom: 1px solid var(--line); overflow-x: auto; background: #fbfcfd; }
.editor-tab { border: 0; background: transparent; padding: 15px 18px; font-weight: 750; color: #60666c; border-bottom: 3px solid transparent; white-space: nowrap; }
.editor-tab.active { color: var(--primary-dark); border-color: var(--primary); background: #fff; }
.editor-body { padding: 26px; }
.section { display: none; }
.section.active { display: block; }
.section h2 { margin: 0 0 6px; font-size: 1.2rem; }
.section-intro { margin: 0 0 22px; color: var(--muted); font-size: .88rem; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.form-grid .field + .field { margin-top: 0; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.switch-row { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 18px; }
.switch { display: flex; align-items: center; gap: 9px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; }
.switch input { width: 18px; height: 18px; accent-color: var(--primary); }

.equipment-tools { display: flex; gap: 10px; margin-bottom: 16px; }
.equipment-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.equipment { display: flex; align-items: center; gap: 9px; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font-size: .84rem; }
.equipment:hover { border-color: #b8c0c7; }
.equipment input { accent-color: var(--primary); width: 17px; height: 17px; flex: 0 0 auto; }

.photo-guidance { margin: 0 0 18px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: #f7fafb; }
.photo-guidance strong { display: block; margin-bottom: 8px; font-size: .9rem; }
.photo-guidance p { margin: 5px 0; color: var(--muted); font-size: .82rem; line-height: 1.5; }
.upload-zone { border: 2px dashed #bfc7cd; border-radius: 16px; padding: 30px; text-align: center; background: #fafcfd; transition: .15s; }
.upload-zone.dragover { border-color: var(--primary); background: var(--primary-soft); }
.upload-zone strong { display: block; margin-bottom: 4px; }
.upload-zone p { color: var(--muted); margin: 0 0 14px; font-size: .85rem; }
.gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 18px; }
.photo-card { position: relative; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #f3f5f6; user-select: none; }
.photo-card.dragging { opacity: .45; }
.photo-card img, .photo-fallback { width: 100%; aspect-ratio: 4/3; display: grid; place-items: center; object-fit: cover; background: #e7ebee; }
.photo-fallback { color: #626b72; font-weight: 800; font-size: .75rem; }
.photo-main { position: absolute; left: 8px; top: 8px; background: var(--accent); color: #2b2500; border-radius: 999px; padding: 4px 8px; font-size: .68rem; font-weight: 900; }
.photo-new { position: absolute; right: 8px; top: 8px; background: #fff; border-radius: 999px; padding: 4px 8px; font-size: .65rem; font-weight: 800; }
.photo-controls { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1px; background: var(--line); }
.photo-controls button { border: 0; min-height: 34px; background: #fff; }
.photo-controls button:hover { background: #f3f6f8; }
.photo-name { padding: 8px 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .7rem; background: #fff; color: var(--muted); }

.editor-actions { display: flex; justify-content: space-between; gap: 12px; padding: 18px 26px; border-top: 1px solid var(--line); background: #fbfcfd; position: sticky; bottom: 0; }
.editor-actions > div { display: flex; gap: 10px; }

.toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: grid; gap: 10px; }
.toast { width: min(360px, calc(100vw - 40px)); padding: 13px 15px; border-radius: 12px; background: #111; color: #fff; box-shadow: var(--shadow); font-size: .88rem; animation: toastIn .2s ease; }
.toast.success { background: #075d41; }
.toast.error { background: #8f1d15; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
.loader { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: spin .65s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .form-grid, .equipment-grid { grid-template-columns: repeat(2, 1fr); }
  .span-3 { grid-column: span 2; }
  .gallery { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 680px) {
  .topbar { padding: 0 16px; }
  .topbar-user { display: none; }
  .main { width: min(100% - 24px, 1260px); padding-top: 22px; }
  .page-head { flex-direction: column; }
  .page-head .btn { width: 100%; }
  .toolbar { flex-direction: column; }
  .toolbar .select { width: 100%; }
  .vehicle-row { grid-template-columns: 92px 1fr; }
  .vehicle-thumb { width: 92px; }
  .vehicle-actions { grid-column: 1 / -1; }
  .vehicle-actions .btn { flex: 1; }
  .form-grid, .equipment-grid { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: auto; }
  .editor-body { padding: 18px; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .editor-actions { padding: 14px 18px; flex-direction: column-reverse; }
  .editor-actions > div, .editor-actions .btn { width: 100%; }
  .editor-actions > div .btn { flex: 1; }
}
