@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@500;600;700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --bg:#0F1620; --surface:#172230; --surface2:#1E2C3D; --border:#2A3B4F;
  --text:#EAF0F5; --text-muted:#8598AC;
  --orange:#F2762E; --teal:#22B8A8; --green:#4ADE80; --red:#F0554A; --yellow:#F2C94C;
}
* { box-sizing: border-box; }
html, body { margin:0; padding:0; }
body.app-root { background: var(--bg); color: var(--text); font-family: 'Inter', sans-serif; min-height:100vh; }
.font-display { font-family: 'Oswald', sans-serif; letter-spacing: 0.02em; }
.font-mono { font-family: 'IBM Plex Mono', monospace; }
.text-xs { font-size: 12px; }
.text-muted { color: var(--text-muted); }
a { color: inherit; }

/* ---- Layout ---- */
#app-shell { display: flex; min-height: 100vh; }
.main-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.content-area { padding: 24px; flex: 1; overflow-y: auto; }
.mobile-top { display: none; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
@media (max-width: 900px) {
  .mobile-top { display: flex; }
  .content-area { padding: 16px; }
}

/* ---- Sidebar ---- */
.sidebar { width: 260px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar-header { padding: 20px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); }
.logo-mark { width: 36px; height: 36px; border-radius: 8px; background: var(--orange); display: flex; align-items: center; justify-content: center; color: #0F1620; flex-shrink: 0; }
.logo-mark.logo-img { width: 46px; height: 46px; background: #fff; padding: 3px; }
.logo-mark.logo-img img { width: 100%; height: 100%; object-fit: contain; }
.sidebar-nav { flex: 1; padding: 12px; overflow-y: auto; }
.nav-btn { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; margin-bottom: 4px; font-size: 14px; border: none; cursor: pointer; text-align: left; background: transparent; color: var(--text-muted); font-family: inherit; }
.nav-btn:hover { color: var(--text); }
.nav-btn.active { background: var(--orange); color: #0F1620; font-weight: 700; }
.nav-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-footer { padding: 14px 20px; font-size: 12px; color: var(--text-muted); border-top: 1px solid var(--border); }

@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 30; }
  .sidebar-overlay.show { display: block; }
}

/* ---- Cards / tables ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.p-3 { padding: 12px; } .p-4 { padding: 16px; } .p-6 { padding: 24px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; padding: 12px; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-family: 'Oswald', sans-serif; border-bottom: 1px solid var(--border); }
td { padding: 12px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }

/* ---- Badges / tags ---- */
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }

/* ---- Forms ---- */
.input-base { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; color: var(--text); margin-top: 4px; font-size: 14px; outline: none; font-family: inherit; }
.input-base:focus { border-color: var(--orange); }
.field-label { font-size: 12px; color: var(--text-muted); display: block; margin-top: 10px; }
textarea.input-base { resize: vertical; }

/* ---- Buttons ---- */
.btn-primary { background: var(--orange); color: #0F1620; font-weight: 700; padding: 8px 16px; border-radius: 8px; font-size: 14px; border: none; cursor: pointer; display:inline-flex; align-items:center; gap:6px; font-family: inherit; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); padding: 8px 16px; border-radius: 8px; font-size: 14px; cursor: pointer; font-family: inherit; }
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }
.icon-btn { background: transparent; border: none; cursor: pointer; padding: 4px; color: var(--text-muted); display:inline-flex; }
.icon-btn:hover { color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }

/* ---- Section header ---- */
.section-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section-title { font-size: 24px; display: flex; align-items: center; gap: 8px; margin: 0; }
.section-title svg { width: 22px; height: 22px; color: var(--orange); }
.section-subtitle { font-size: 13px; color: var(--text-muted); margin: 4px 0 0; }
.section-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 10px; top: 10px; width: 16px; height: 16px; color: var(--text-muted); }
.search-input { padding-left: 32px !important; width: 220px; margin-top: 0 !important; }

/* ---- KPI grid ---- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
@media (max-width: 900px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
.kpi-card { display: flex; align-items: center; gap: 12px; padding: 16px; }
.kpi-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kpi-value { font-family: 'Oswald', sans-serif; font-size: 24px; line-height: 1.1; }
.kpi-label { font-size: 12px; color: var(--text-muted); }

.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
@media (max-width: 900px) { .charts-grid { grid-template-columns: 1fr; } }

/* ---- Modal ---- */
.modal-overlay { position: fixed; inset: 0; background: rgba(6,10,15,0.7); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; padding: 24px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-header h3 { margin: 0; font-size: 18px; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .modal-grid { grid-template-columns: 1fr; } }
.modal-grid .full { grid-column: 1 / -1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ---- Autocomplétion ville ---- */
.city-dropdown { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; margin-top: 2px; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; max-height: 190px; overflow-y: auto; box-shadow: 0 8px 20px rgba(0,0,0,0.4); }
.city-dropdown-item { padding: 8px 12px; font-size: 13px; cursor: pointer; color: var(--text); }
.city-dropdown-item:hover, .city-dropdown-item.active { background: var(--border); }
.city-dropdown-empty { padding: 8px 12px; font-size: 12px; color: var(--text-muted); }

/* ---- Route tracking ---- */
.route-card { padding: 16px; margin-bottom: 16px; }
.route-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.route-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.route-track { position: relative; height: 36px; }
.route-line-bg { position: absolute; top: 16px; left: 0; right: 0; height: 4px; border-radius: 2px; background: var(--border); }
.route-line-fill { position: absolute; top: 16px; left: 0; height: 4px; border-radius: 2px; transition: width 1s linear; }
.route-truck { position: absolute; top: 2px; transform: translateX(-50%); transition: left 1s linear; }
.route-truck svg { width: 28px; height: 28px; }
.route-bottom { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-top: 8px; flex-wrap: wrap; gap: 4px; }

/* ---- Login screen ---- */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { width: 100%; max-width: 380px; padding: 32px; }
.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.login-error { color: var(--red); font-size: 13px; margin-top: 10px; min-height: 16px; }

/* ---- Comms history ---- */
.comm-msg { max-width: 320px; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.flex { display: flex; } .flex-wrap { flex-wrap: wrap; } .items-center { align-items: center; }
.justify-between { justify-content: space-between; } .gap-2 { gap: 8px; }

/* ---- Visionneuse plein écran (clic pour agrandir une photo, ex: Archive) ---- */
.lightbox-overlay {
  position: fixed; inset: 0; background: rgba(6, 10, 16, 0.92);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; cursor: zoom-out; padding: 24px;
}
.lightbox-img {
  max-width: 100%; max-height: 100%; border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}
