:root {
    --primary: #d32f2f;
    --primary-dark: #a02020;
    --dark: #1e293b;
    --gray: #64748b;
    --border: #e2e8f0;
    --bg: #f8fafc;
    --success: #16a34a;
    --warning: #d97706;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--dark);
}
.topbar {
    background: var(--dark);
    color: white;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar a { color: white; text-decoration: none; }
.user-badge a { color: #cbd5e1; margin-left: 8px; }
.container { max-width: 640px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.3rem; margin: 8px 0 16px; }
h1 small { font-weight: 400; color: var(--gray); font-size: 0.9rem; display: block; }

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { background: white; padding: 32px 24px; border-radius: 16px; box-shadow: 0 4px 24px rgba(0,0,0,.08); width: 90%; max-width: 360px; text-align: center; }
.login-box h1 { font-size: 1.5rem; margin-bottom: 4px; }
.subtitle { color: var(--gray); margin-bottom: 24px; }
.login-box form { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.login-box label { font-size: 0.85rem; color: var(--gray); margin-top: 8px; }
input, textarea {
    padding: 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 1rem; width: 100%;
}
button { cursor: pointer; }
.btn-primary, .login-box button[type=submit] {
    background: var(--primary); color: white; border: none; padding: 14px; border-radius: 10px;
    font-size: 1rem; font-weight: 600; margin-top: 16px;
}
.btn-primary:disabled { background: #f3a3a3; }
.btn-secondary { background: white; border: 1px solid var(--border); padding: 14px; border-radius: 10px; font-size: 1rem; }
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 0.9rem; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef3c7; color: #92400e; }

/* Liste véhicules */
.vehicule-list { display: grid; gap: 12px; }
.vehicule-card {
    background: white; border-radius: 14px; padding: 16px; text-decoration: none; color: var(--dark);
    box-shadow: 0 1px 4px rgba(0,0,0,.06); position: relative;
}
.vehicule-card .immat { font-size: 1.2rem; font-weight: 700; }
.vehicule-card .modele { color: var(--gray); font-size: 0.9rem; }
.vehicule-card.is-reparation { opacity: 0.7; }
.badge { display: inline-block; font-size: 0.75rem; padding: 3px 8px; border-radius: 6px; margin-top: 6px; }
.badge-warning { background: #fef3c7; color: #92400e; }

/* Contrôle */
.hint { font-size: 0.85rem; color: var(--gray); margin-bottom: 12px; }
.vue-tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; }
.vue-tab {
    flex: none; background: white; border: 1px solid var(--border); padding: 8px 14px;
    border-radius: 20px; font-size: 0.85rem; white-space: nowrap;
}
.vue-tab.active { background: var(--dark); color: white; border-color: var(--dark); }
.vue-panel { display: none; }
.vue-panel.active { display: block; }
.silhouette-wrap { position: relative; background: white; border-radius: 14px; padding: 12px; touch-action: manipulation; }
.silhouette-svg { width: 100%; height: auto; display: block; }
.silhouette-visual { width: 100%; height: auto; display: block; border-radius: 8px; }
.silhouette-svg.flipped { transform: scaleX(-1); }
.points-overlay { position: absolute; inset: 12px; }
.point-marker {
    position: absolute; width: 26px; height: 26px; margin-left: -13px; margin-top: -13px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-weight: 700; color: white; font-size: 0.9rem; cursor: pointer;
}
.point-marker.existant { background: var(--warning); }
.point-marker.nouveau { background: var(--primary); }

.actions { margin: 24px 0; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal.hidden { display: none; }
.modal-content { background: white; border-radius: 16px; padding: 20px; width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto; }
.modal-content h2 { margin-top: 0; font-size: 1.1rem; }
.camera-zone { background: #000; border-radius: 10px; overflow: hidden; margin-bottom: 12px; min-height: 200px; display: flex; align-items: center; justify-content: center; }
.camera-zone video, .camera-zone img { width: 100%; display: block; }
.hidden { display: none !important; }
#btn-take-photo { width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--border); background: white; margin-bottom: 10px; font-size: 0.95rem; }
.modal-actions { display: flex; gap: 10px; margin-top: 12px; }
.modal-actions button { flex: 1; margin-top: 0; }

/* Popup info point existant */
.point-info { position: absolute; background: white; border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,.2); padding: 12px; z-index: 50; width: 220px; font-size: 0.85rem; }
.point-info img { width: 100%; border-radius: 6px; margin-bottom: 6px; }
.point-info .meta { color: var(--gray); font-size: 0.75rem; margin-top: 4px; }

/* Admin */
.admin-table { width: 100%; border-collapse: collapse; background: white; border-radius: 10px; overflow: hidden; }
.admin-table th, .admin-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.admin-table th { background: #f1f5f9; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.status-normal { background: var(--success); }
.status-reparation { background: var(--warning); }

.admin-nav { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.admin-nav a {
    background: white; border: 1px solid var(--border); padding: 10px 16px; border-radius: 10px;
    text-decoration: none; color: var(--dark); font-size: 0.9rem; font-weight: 500;
}
.form-card { background: white; border-radius: 14px; padding: 18px; margin-bottom: 20px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.form-card h2 { margin-top: 0; font-size: 1.05rem; }
.form-card label { display: block; font-size: 0.85rem; color: var(--gray); margin-top: 10px; margin-bottom: 4px; }
.alert-success { background: #dcfce7; color: #166534; }
.link-btn {
    background: none; border: none; color: var(--primary); text-decoration: underline;
    font-size: 0.85rem; padding: 4px 6px; cursor: pointer;
}
h2 { font-size: 1.1rem; margin: 24px 0 10px; }

.photos-vehicule { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.photo-slot { background: white; border-radius: 12px; padding: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.photo-slot-label { font-size: 0.8rem; font-weight: 600; margin-bottom: 6px; }
.photo-slot-preview { aspect-ratio: 4/3; background: var(--bg); border-radius: 8px; overflow: hidden; display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.photo-slot-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-slot-empty { color: var(--gray); font-size: 0.75rem; }
.photo-slot-input { display: none; }
.photo-slot-btn { width: 100%; padding: 8px; font-size: 0.8rem; margin-top: 0; }

/* Responsive mobile */
.admin-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 10px; }
@media (max-width: 480px) {
    .container { padding: 12px; }
    .admin-table th, .admin-table td { padding: 8px; font-size: 0.8rem; }
    .modal-content { padding: 16px; }
    .vue-tab { padding: 7px 12px; font-size: 0.8rem; }
    .form-card { padding: 14px; }
    .topbar { padding: 10px 12px; font-size: 0.9rem; }
    .photos-vehicule { grid-template-columns: repeat(2, 1fr); }
}
