/* CHDR scan theme v1 - charge apres le <style> inline de chaque page scan/* */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Noto+Sans+Arabic:wght@400;500;600;700&display=swap');
:root { --brand: #1D7FBF; --brand-dark: #166A9F; --green: #15803D; --green-dark: #166534; --red: #B91C1C; --gray: #78716C; --gray-light: #E7E5E4; --bg: #FAFAF9; --card: #ffffff; --text: #1C1917; }
body { font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; }
[dir="rtl"] body, body[dir="rtl"], html[lang="ar"] body { font-family: 'Noto Sans Arabic', 'Inter', system-ui, sans-serif; }
.info-grid .val, .manual-entry input, .header-row .user, .status-bar, td, .plate, .mono { font-family: 'Inter', system-ui, sans-serif; }
[dir="rtl"] .info-grid .val { font-family: 'Inter', 'Noto Sans Arabic', system-ui, sans-serif; }

/* Header : un seul bleu, boutons arrondis */
.app-header { box-shadow: none; }
.header-row { padding: 10px 16px; }
.header-row h1 { font-weight: 600; font-size: 16px; }
.header-row .user { opacity: .85; }
.lang-btn, .logout-btn { border-radius: 999px; padding: 6px 12px; background: rgba(255,255,255,.16); }
.logout-btn { background: #ffffff; color: var(--brand); }
.chdr-printer select, .header-actions select { border-radius: 999px; }

/* Onglets : 56 px, icone + texte, actif sur fond clair */
.nav-tabs { background: #ffffff; border-bottom: 1px solid var(--gray-light); }
.nav-tabs a { color: #44403C; opacity: 1; height: 56px; padding: 0 8px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 15px; font-weight: 500; border-bottom: 3px solid transparent; }
.nav-tabs a::before { content: ''; width: 20px; height: 20px; flex: none; background: currentColor; -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat; }
.nav-tabs a[href$="/scan"] { --ico: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='1.8' stroke='black'><path stroke-linecap='round' stroke-linejoin='round' d='M3.75 4.875c0-.621.504-1.125 1.125-1.125h4.5c.621 0 1.125.504 1.125 1.125v4.5c0 .621-.504 1.125-1.125 1.125h-4.5A1.125 1.125 0 0 1 3.75 9.375v-4.5ZM3.75 14.625c0-.621.504-1.125 1.125-1.125h4.5c.621 0 1.125.504 1.125 1.125v4.5c0 .621-.504 1.125-1.125 1.125h-4.5a1.125 1.125 0 0 1-1.125-1.125v-4.5ZM13.5 4.875c0-.621.504-1.125 1.125-1.125h4.5c.621 0 1.125.504 1.125 1.125v4.5c0 .621-.504 1.125-1.125 1.125h-4.5A1.125 1.125 0 0 1 13.5 9.375v-4.5ZM13.5 13.5h3v3h-3zM18 18h2.25v2.25H18zM13.5 18h2.25v2.25H13.5zM18 13.5h2.25v2.25H18z'/></svg>"); }
.nav-tabs a[href$="/scan/vehicle"] { --ico: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='1.8' stroke='black'><path stroke-linecap='round' stroke-linejoin='round' d='M8.25 18.75a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m3 0h6m-9 0H3.375a1.125 1.125 0 0 1-1.125-1.125V14.25m17.25 4.5a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m3 0h1.125c.621 0 1.129-.504 1.09-1.124a17.902 17.902 0 0 0-3.213-9.193 2.056 2.056 0 0 0-1.58-.86H14.25M16.5 18.75h-2.25m0-11.177v-.958c0-.568-.422-1.048-.987-1.106a48.554 48.554 0 0 0-10.026 0 1.106 1.106 0 0 0-.987 1.106v7.635m12-6.677v6.677m0 4.5v-4.5m0 0h-12'/></svg>"); }
.nav-tabs a[href$="/scan/today"] { --ico: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='1.8' stroke='black'><path stroke-linecap='round' stroke-linejoin='round' d='M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5'/></svg>"); }
.nav-tabs a[href$="/scan/logs"] { --ico: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='1.8' stroke='black'><path stroke-linecap='round' stroke-linejoin='round' d='M8.25 6.75h12M8.25 12h12m-12 5.25h12M3.75 6.75h.007v.008H3.75V6.75Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0ZM3.75 12h.007v.008H3.75V12Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm-.375 5.25h.007v.008H3.75v-.008Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z'/></svg>"); }
.nav-tabs a.active { color: var(--brand-dark); background: #EAF4FB; border-bottom-color: var(--brand); }
@media (max-width: 480px) { .nav-tabs a { font-size: 13px; gap: 6px; } .nav-tabs a::before { width: 18px; height: 18px; } }

/* Cartes : bordure, pas d'ombre */
.scanner-card, .manual-entry, .result-card, .card { border: 1px solid var(--gray-light); border-radius: 12px; box-shadow: none; }
.status-bar { border-top: 1px solid var(--gray-light); }
.manual-entry input, .flag-select, .flag-note textarea { border-radius: 8px; border-color: #D6D3D1; }
.btn { border-radius: 10px; font-weight: 600; }
.btn-primary { background: var(--brand); } .btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: #ffffff; color: var(--text); border: 1px solid #D6D3D1; }
.btn-danger { background: #ffffff; color: var(--red); border: 1px solid #D6D3D1; }
.btn-warning { background: #ffffff; color: #B45309; border: 1px solid #D6D3D1; }
.btn-outline { background: #ffffff; color: var(--green); border: 2px solid var(--green); }
.btn-outline svg { width: 20px; height: 20px; vertical-align: -4px; }
.result-header { padding: 18px 16px; }
.result-header .title { font-weight: 600; }
.info-grid .lbl { font-weight: 500; font-size: 11.5px; text-transform: none; }
.printed-hint { background: #FFF7ED; border-color: #C9793B; color: #7C2D12; display: flex; align-items: center; justify-content: center; gap: 6px; }
.printed-hint svg { width: 16px; height: 16px; }

/* Desktop / tablette paysage : camera a gauche, resultat a droite */
.container:has(.scanner-card) { max-width: 520px; }
@media (min-width: 900px) {
  .container:has(.scanner-card) { max-width: 1040px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
  .warning-banner { grid-column: 1; grid-row: 1; margin: 0; }
  .scanner-card { grid-column: 1; grid-row: 2; margin: 0; }
  .manual-entry { grid-column: 1; grid-row: 3; margin: 0; }
  #result-area { grid-column: 2; grid-row: 1 / span 3; }
  .result-card { margin: 0; }
  .qr-reader { aspect-ratio: 4 / 3; }
}

/* v2 : correction vehicule a la guerite */
.chdr-veh-edit { margin-top: 10px; }
.chdr-veh-toggle { width: auto; min-height: 40px; padding: 8px 14px; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.chdr-veh-toggle svg { width: 18px; height: 18px; }
#chdr-veh-form { margin-top: 10px; padding: 12px; border: 1px solid var(--gray-light); border-radius: 10px; background: #FAFAF9; }
#chdr-veh-form input { width: 100%; padding: 12px 14px; border: 1px solid #D6D3D1; border-radius: 8px; font-size: 16px; font-family: inherit; margin-bottom: 8px; background: #fff; }
#chdr-veh-form input:focus { border-color: var(--brand); outline: none; }
#chdr-veh-plate { font-family: 'Inter', ui-monospace, monospace; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; direction: ltr; text-align: left; }
.chdr-veh-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* v3 : today (arrivees / departs) - grille du scanner limitee a la page scan */

/* v4 : commentaire gardien + refus avec motif */
.chdr-comment { margin: 4px 0 12px; }
.chdr-c-lbl { display: block; font-size: 12px; color: var(--gray); margin-bottom: 4px; font-weight: 500; }
.chdr-c-lbl.chdr-req { color: var(--red); font-weight: 600; margin-top: 10px; }
#chdr-comment { width: 100%; padding: 10px 12px; border: 1px solid #D6D3D1; border-radius: 8px; font-size: 16px; font-family: inherit; resize: vertical; min-height: 56px; background: #fff; }
#chdr-comment:focus { outline: none; border-color: var(--brand); }
.chdr-c-cnt { font-size: 11px; color: var(--gray); text-align: end; margin-top: 2px; font-family: 'Inter', system-ui, sans-serif; }
#chdr-reason-box .flag-select { border-color: var(--red); margin-bottom: 4px; }
