/* ============================================================
   DIAPOLO Admin — design system
   Ambiance : service premium, sombre profond + accent doré.
   ============================================================ */
:root {
  --bg: #f5f6f9;
  --panel: #ffffff;
  --ink: #14192b;
  --ink-2: #4a5268;
  --ink-3: #8b93a7;
  --line: #e4e7ef;
  --navy: #0f1729;
  --navy-2: #1b2740;
  --gold: #e8b34b;
  --gold-ink: #7a5410;
  --accent: #2a5bd7;
  --accent-soft: #e8eeff;
  --green: #1d9e6f;  --green-soft: #e2f6ee;
  --red: #d84a4a;    --red-soft: #fdeaea;
  --orange: #e08a2e; --orange-soft: #fdf1e0;
  --violet: #7c5cd6; --violet-soft: #efeafd;
  --teal: #148a95;   --teal-soft: #e0f4f6;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 41, .05), 0 4px 16px rgba(15, 23, 41, .06);
  --shadow-lg: 0 8px 40px rgba(15, 23, 41, .18);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 14px; -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 14px; }

/* ---------- Login ---------- */
.login-screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 700px at 70% -10%, #24345c 0%, var(--navy) 55%, #0a0f1d 100%); }
.login-card { width: 360px; background: var(--panel); border-radius: 18px; padding: 38px 34px; box-shadow: var(--shadow-lg); text-align: center; }
.login-card h1 { letter-spacing: .35em; margin: 14px 0 2px; font-weight: 800; }
.login-sub { color: var(--ink-3); margin-bottom: 26px; font-size: 13px; }
.login-card form { text-align: left; display: grid; gap: 14px; }
.login-card label { font-size: 12px; color: var(--ink-2); font-weight: 600; display: grid; gap: 6px; }
.login-error { color: var(--red); font-size: 13px; text-align: center; }
.brand-mark { width: 54px; height: 54px; margin: 0 auto; border-radius: 14px; background: var(--navy);
  color: var(--gold); font: 700 30px Georgia, serif; display: flex; align-items: center; justify-content: center; }
.brand-mark.small { width: 34px; height: 34px; font-size: 19px; border-radius: 9px; margin: 0; background: linear-gradient(140deg, #223154, var(--navy)); }

/* ---------- Layout ---------- */
.app { display: flex; height: 100vh; }
.sidebar { width: 212px; flex: 0 0 212px; background: var(--navy); color: #cdd5e4; display: flex; flex-direction: column; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; }
.brand-name { letter-spacing: .28em; font-weight: 800; color: #fff; font-size: 14px; }
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 8px; overflow-y: auto; }
.sidebar-nav a { display: flex; align-items: center; gap: 10px; color: #aeb8cc; padding: 9px 12px; border-radius: 9px; font-weight: 500; }
.sidebar-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar-nav a.active { background: rgba(232, 179, 75, .14); color: var(--gold); }
.nav-ico { width: 18px; text-align: center; opacity: .9; }
.sidebar-footer { padding: 12px 14px; display: flex; align-items: center; gap: 9px; border-top: 1px solid rgba(255, 255, 255, .08); }
.me-name { flex: 1; font-size: 12px; color: #9aa5bb; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sync-dot { width: 9px; height: 9px; border-radius: 50%; background: #4a5268; transition: background .3s; }
.sync-dot.on { background: var(--green); box-shadow: 0 0 8px rgba(29, 158, 111, .8); }
.main { flex: 1; overflow-y: auto; padding: 26px 30px 60px; }

/* ---------- Composants ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--ink-3); font-size: 13px; margin-top: 3px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 16px 18px; }
.grid { display: grid; gap: 14px; }
.cols-2 { grid-template-columns: 1fr 1fr; } .cols-3 { grid-template-columns: repeat(3, 1fr); } .cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .cols-4 { grid-template-columns: 1fr 1fr; } .cols-3 { grid-template-columns: 1fr; } .cols-2 { grid-template-columns: 1fr; } }

.btn { border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 8px 14px; border-radius: 9px;
  font: 600 13px var(--font); cursor: pointer; transition: filter .12s, transform .05s; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { filter: brightness(.97); } .btn:active { transform: translateY(1px); }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--navy); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn-block { width: 100%; justify-content: center; padding: 11px; }
.btn-ghost { background: none; border: none; color: inherit; cursor: pointer; font-size: 15px; opacity: .75; }
.btn-ghost:hover { opacity: 1; }
.btn[disabled] { opacity: .5; cursor: default; }

input, select, textarea { font: 400 13.5px var(--font); color: var(--ink); background: #fbfcfe; border: 1px solid var(--line);
  border-radius: 9px; padding: 9px 11px; width: 100%; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 70px; }
.field { display: grid; gap: 5px; font-size: 12px; color: var(--ink-2); font-weight: 600; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.chip.gray { background: #eef0f5; color: var(--ink-2); }
.chip.blue { background: var(--accent-soft); color: var(--accent); }
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.red { background: var(--red-soft); color: var(--red); }
.chip.orange { background: var(--orange-soft); color: var(--orange); }
.chip.violet { background: var(--violet-soft); color: var(--violet); }
.chip.teal { background: var(--teal-soft); color: var(--teal); }
.chip.gold { background: #fdf3dd; color: var(--gold-ink); }

.stat-card { padding: 14px 16px; display: grid; gap: 2px; }
.stat-card .num { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.stat-card .lbl { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.stat-card.warn .num { color: var(--orange); }
.stat-card.bad .num { color: var(--red); }
.stat-card.good .num { color: var(--green); }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; color: var(--ink-3); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 9px 10px; border-bottom: 1px solid #f0f2f7; vertical-align: middle; }
.table tr:hover td { background: #f8f9fc; }
.table .row-click { cursor: pointer; }

.empty { text-align: center; color: var(--ink-3); padding: 34px 10px; font-size: 13px; }
.muted { color: var(--ink-3); } .small { font-size: 12px; } .bold { font-weight: 700; }
.mt { margin-top: 14px; } .mb { margin-bottom: 14px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spread { justify-content: space-between; }

/* ---------- Skeletons / toasts / modale ---------- */
.skeleton { background: linear-gradient(90deg, #eceef4 25%, #f6f7fa 50%, #eceef4 75%); background-size: 200% 100%;
  animation: shimmer 1.1s infinite; border-radius: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton.block { height: 120px; margin-bottom: 14px; }
.toast-root { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 300; }
.toast { background: var(--navy); color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg);
  font-size: 13px; max-width: 340px; animation: slideIn .18s ease; }
.toast.err { background: var(--red); }
.toast.gold { background: var(--gold); color: var(--navy); font-weight: 600; }
@keyframes slideIn { from { transform: translateY(8px); opacity: 0; } }
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 15, 29, .55); display: flex; align-items: flex-start;
  justify-content: center; padding: 6vh 16px; z-index: 200; overflow-y: auto; }
.modal { background: var(--panel); border-radius: 16px; width: 640px; max-width: 100%; box-shadow: var(--shadow-lg); animation: pop .16s ease; }
.modal.wide { width: 860px; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 18px 20px 22px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ---------- Dashboard ---------- */
.next-meeting-hero { background: linear-gradient(135deg, var(--navy) 0%, #23325a 100%); color: #fff; border-radius: 16px;
  padding: 20px 22px; display: flex; justify-content: space-between; gap: 16px; align-items: center; flex-wrap: wrap; }
.next-meeting-hero .when { color: var(--gold); font-weight: 800; font-size: 15px; }
.next-meeting-hero h2 { font-size: 19px; margin: 4px 0 2px; }
.next-meeting-hero .where { color: #aeb8cc; font-size: 13px; }
.suggestion { border-left: 3px solid var(--gold); padding: 10px 12px; background: #fffdf7; border-radius: 0 10px 10px 0; }
.suggestion .why { color: var(--ink-3); font-size: 12px; margin-top: 3px; }
.alert-line { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 9px; font-size: 13px; }
.alert-line.warn { background: var(--orange-soft); color: #8a5a12; }
.alert-line.bad { background: var(--red-soft); color: #8f2626; }

/* ---------- Planning (semaine) ---------- */
.week-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.week-grid { display: grid; grid-template-columns: 52px repeat(7, 1fr); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; background: var(--panel); box-shadow: var(--shadow); }
.wg-corner, .wg-day-head { background: #f8f9fc; border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: center;
  font-size: 12px; font-weight: 700; color: var(--ink-2); }
.wg-day-head.today { color: var(--accent); }
.wg-hours { position: relative; border-right: 1px solid var(--line); }
.wg-hour { height: 44px; font-size: 10.5px; color: var(--ink-3); text-align: right; padding-right: 6px; transform: translateY(-6px); }
.wg-day { position: relative; border-right: 1px solid #f0f2f7; min-height: 616px; }
.wg-slot-line { position: absolute; left: 0; right: 0; height: 1px; background: #f2f4f8; }
.wg-event { position: absolute; left: 4px; right: 4px; border-radius: 8px; padding: 5px 7px; font-size: 11.5px; cursor: grab;
  color: #fff; overflow: hidden; box-shadow: 0 1px 4px rgba(15, 23, 41, .25); user-select: none; z-index: 2; }
.wg-event.dragging { opacity: .75; cursor: grabbing; z-index: 10; box-shadow: var(--shadow-lg); }
.wg-event .t { font-weight: 700; }
.wg-event small { opacity: .85; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }

/* ---------- Kanban CRM ---------- */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 14px; align-items: flex-start; }
.kb-col { min-width: 240px; width: 240px; background: #eef0f5; border-radius: 12px; padding: 10px; flex: 0 0 auto; }
.kb-col.drag-over { outline: 2px dashed var(--accent); }
.kb-col h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); padding: 2px 4px 8px; display: flex; justify-content: space-between; }
.kb-card { background: var(--panel); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow); cursor: grab; border: 1px solid var(--line); }
.kb-card:active { cursor: grabbing; }
.kb-card .who { font-weight: 700; font-size: 13px; }
.kb-card .co { color: var(--ink-2); font-size: 12px; }
.kb-card .meta { display: flex; gap: 5px; margin-top: 7px; flex-wrap: wrap; }
.view-switch { display: inline-flex; background: #eef0f5; border-radius: 9px; padding: 3px; gap: 2px; }
.view-switch button { border: none; background: none; padding: 6px 12px; border-radius: 7px; font: 600 12.5px var(--font); color: var(--ink-2); cursor: pointer; }
.view-switch button.active { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- Fiche / brief ---------- */
.brief-section { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.brief-section h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin-bottom: 6px; }
.brief-section pre { white-space: pre-wrap; font: 13px/1.55 var(--font); }
.src-tag { font-size: 10.5px; padding: 2px 7px; border-radius: 10px; background: #eef0f5; color: var(--ink-2); margin-right: 5px; }
.src-tag.ok { background: var(--green-soft); color: var(--green); }
.src-tag.ia { background: var(--violet-soft); color: var(--violet); }
.src-tag.warn { background: var(--orange-soft); color: var(--orange); }
.note-line { border-left: 3px solid var(--line); padding: 6px 10px; margin-bottom: 8px; }
.note-line .meta { font-size: 11px; color: var(--ink-3); }
.timeline-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f0f2f7; font-size: 13px; }
.timeline-item .ts { color: var(--ink-3); font-size: 11.5px; width: 118px; flex: 0 0 118px; }

/* ---------- Carte ---------- */
.map-wrap { position: relative; height: calc(100vh - 150px); min-height: 460px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
#admin-map, #mini-map { position: absolute; inset: 0; }
.mini-map-wrap { position: relative; height: 260px; border-radius: 10px; overflow: hidden; }
.map-legend { position: absolute; z-index: 500; bottom: 12px; left: 12px; background: rgba(255,255,255,.94); border-radius: 10px;
  padding: 9px 12px; font-size: 12px; box-shadow: var(--shadow); display: grid; gap: 4px; }
.map-controls { position: absolute; z-index: 500; top: 12px; right: 12px; background: rgba(255,255,255,.96); border-radius: 10px;
  padding: 8px 10px; box-shadow: var(--shadow); display: grid; gap: 6px; font-size: 12.5px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.leaflet-div-icon { background: none; border: none; }
.pin { width: 26px; height: 26px; border-radius: 50% 50% 50% 4px; transform: rotate(-45deg); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.35); border: 2px solid #fff; }
.pin span { transform: rotate(45deg); color: #fff; font-size: 11px; font-weight: 800; }

/* ---------- Divers ---------- */
.filters-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters-bar input[type="search"] { width: 220px; }
.filters-bar select { width: auto; }
.stars { color: var(--gold); letter-spacing: 1px; }
.csv-map-table td { padding: 4px 8px; }
.progress-thin { height: 5px; border-radius: 3px; background: #eef0f5; overflow: hidden; }
.progress-thin > div { height: 100%; background: var(--gold); }
.free-slot { background: var(--green-soft); color: var(--green); border-radius: 8px; padding: 6px 10px; font-size: 12.5px; font-weight: 600; }
.conflict { background: var(--red-soft); color: #8f2626; border-radius: 8px; padding: 6px 10px; font-size: 12.5px; }
code.inline { background: #eef0f5; border-radius: 5px; padding: 1px 6px; font-size: 12px; }

/* ---------- Billets & documents (fiche RDV) ---------- */
.doc-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 7px; background: #fbfcfe; }
.doc-link { flex: 1; text-decoration: none; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-link:hover { color: var(--accent); }
.doc-del { color: var(--red); font-size: 15px; }
.doc-add input[type=file] { font-size: 12.5px; }
.ticket-badge { font-size: 13px; }

/* ---------- Cloche + badge demandes du voyageur ---------- */
.bell-btn { position: relative; background: none; border: none; cursor: pointer; font-size: 17px; padding: 4px; line-height: 1; opacity: .8; }
.bell-btn:hover { opacity: 1; }
.bell-btn.has-new { animation: bell-wiggle 1.4s ease-in-out infinite; }
@keyframes bell-wiggle { 0%,92%,100% { transform: rotate(0); } 94% { transform: rotate(-12deg); } 96% { transform: rotate(10deg); } 98% { transform: rotate(-6deg); } }
.req-badge { position: absolute; top: -3px; right: -4px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }

/* ---------- Panneau des demandes ---------- */
.req-item { border: 1px solid var(--line); border-left-width: 3px; border-radius: 10px; padding: 11px 13px; margin-bottom: 10px; }
.req-item.new { border-left-color: var(--orange); background: #fffaf2; }
.req-item.seen { border-left-color: var(--accent); }
.req-item.done { border-left-color: var(--green); opacity: .72; }
.req-msg { margin: 7px 0 9px; font-size: 14px; white-space: pre-wrap; }
.alert-line.gold { background: #fdf3dd; color: var(--gold-ink); }
