:root {
--navy: #142850;
--navy-light: #1e3a6e;
--orange: #EC6431;
--orange-light: #f47d52;
--bg: #f0ede8;
--surface: #ffffff;
--surface2: #f7f5f2;
--border: #e2ddd8;
--text: #1a1714;
--text2: #6b6560;
--text3: #a09a94;
--green: #2d6a4f;
--green-bg: #d8f3dc;
--red: #c1121f;
--red-bg: #fde8e8;
--amber: #9a6100;
--amber-bg: #fef3c7;
--blue-bg: #dbeafe;
--blue: #1d4ed8;
--radius: 10px;
--radius-sm: 6px;
--shadow: 0 1px 4px rgba(20,40,80,0.08);
--shadow-md: 0 4px 16px rgba(20,40,80,0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { overflow-y: auto !important; }

body {
font-family: 'DM Sans', sans-serif;
background: var(--bg);
color: var(--text);
font-size: 14px;
line-height: 1.5;
min-height: 100vh;
overflow-y: auto !important;
}

/* SIDEBAR */
.layout { display: flex; min-height: 100vh; }

.sidebar {
width: 220px;
background: var(--navy);
display: flex;
flex-direction: column;
flex-shrink: 0;
position: fixed;
top: 0; left: 0; bottom: 0;
z-index: 10;
overflow-y: auto;
}

.sidebar-logo {
padding: 24px 20px 16px;
border-bottom: 1px solid rgba(255,255,255,0.08);
}

.logo-badge {
display: inline-block;
background: var(--orange);
color: #fff;
font-size: 11px;
font-weight: 600;
letter-spacing: 1.5px;
padding: 3px 8px;
border-radius: 4px;
margin-bottom: 6px;
text-transform: uppercase;
}

.logo-title {
color: #fff;
font-size: 16px;
font-weight: 600;
line-height: 1.2;
}

.logo-sub {
color: rgba(255,255,255,0.45);
font-size: 11px;
margin-top: 2px;
}

.nav { padding: 16px 12px; flex: 1; }

.nav-label {
font-size: 10px;
font-weight: 600;
letter-spacing: 1.2px;
text-transform: uppercase;
color: rgba(255,255,255,0.3);
padding: 0 8px;
margin: 16px 0 6px;
}

.nav-item {
display: flex;
align-items: center;
gap: 10px;
padding: 9px 12px;
border-radius: var(--radius-sm);
color: rgba(255,255,255,0.6);
cursor: pointer;
font-size: 13px;
font-weight: 400;
transition: all 0.15s;
margin-bottom: 2px;
border: none;
background: none;
width: 100%;
text-align: left;
}

.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: var(--orange); color: #fff; font-weight: 500; }

.nav-icon { font-size: 15px; width: 18px; text-align: center; }

.sidebar-footer {
padding: 16px 20px;
border-top: 1px solid rgba(255,255,255,0.08);
color: rgba(255,255,255,0.3);
font-size: 11px;
flex-shrink: 0;
}

/* MAIN */
.main { margin-left: 220px; padding: 28px 32px; flex: 1; }

.page-header {
display: flex;
align-items: flex-start;
justify-content: space-between;
margin-bottom: 24px;
}

.page-title { font-size: 22px; font-weight: 600; color: var(--text); }
.page-sub { font-size: 13px; color: var(--text2); margin-top: 2px; }

/* CARDS STATS */
.stats-row {
display: grid;
grid-template-columns: repeat(5, 1fr);
gap: 12px;
margin-bottom: 24px;
}

.stat-card {
background: var(--surface);
border-radius: var(--radius);
padding: 16px;
box-shadow: var(--shadow);
border: 1px solid var(--border);
}

.stat-val { font-size: 24px; font-weight: 600; color: var(--text); font-family: 'DM Mono', monospace; }
.stat-lbl { font-size: 11px; color: var(--text2); margin-top: 4px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-accent { width: 28px; height: 3px; border-radius: 2px; margin-bottom: 10px; }

/* TABLE CARD */
.table-card {
background: var(--surface);
border-radius: var(--radius);
box-shadow: var(--shadow);
border: 1px solid var(--border);
overflow: hidden;
}

.table-toolbar {
display: flex;
align-items: center;
gap: 10px;
padding: 14px 16px;
border-bottom: 1px solid var(--border);
flex-wrap: wrap;
}

.table-title { font-size: 13px; font-weight: 600; color: var(--text); flex: 1; }

table { width: 100%; border-collapse: collapse; }
th {
text-align: left;
padding: 10px 14px;
font-size: 11px;
font-weight: 600;
color: var(--text2);
text-transform: uppercase;
letter-spacing: 0.5px;
background: var(--surface2);
border-bottom: 1px solid var(--border);
white-space: nowrap;
}
td {
padding: 11px 14px;
border-bottom: 1px solid var(--border);
font-size: 13px;
vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

/* BADGES */
.badge {
display: inline-flex;
align-items: center;
gap: 4px;
font-size: 11px;
font-weight: 500;
padding: 3px 9px;
border-radius: 20px;
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-purple { background: #ede9fe; color: #6d28d9; }
.badge-gray { background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }

/* CHECK ICONS */
.chk-yes { color: var(--green); font-size: 16px; }
.chk-no { color: var(--border); font-size: 16px; }

/* AVATAR */
.avatar {
width: 30px; height: 30px;
border-radius: 50%;
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 11px;
font-weight: 600;
flex-shrink: 0;
}

/* BUTTONS */
.btn {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 8px 14px;
border-radius: var(--radius-sm);
font-size: 13px;
font-weight: 500;
cursor: pointer;
border: 1px solid var(--border);
background: var(--surface);
color: var(--text);
transition: all 0.15s;
font-family: 'DM Sans', sans-serif;
white-space: nowrap;
}
.btn:hover { background: var(--surface2); }
.btn-primary { background: var(--orange); color: #fff; border-color: var(--orange); }
.btn-primary:hover { background: var(--orange-light); border-color: var(--orange-light); }
.btn-navy { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-navy:hover { background: var(--navy-light); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-danger { color: var(--red); border-color: #fca5a5; }
.btn-danger:hover { background: var(--red-bg); }

/* FORM INPUTS */
input, select, textarea {
font-family: 'DM Sans', sans-serif;
font-size: 13px;
padding: 8px 12px;
border: 1px solid var(--border);
border-radius: var(--radius-sm);
background: var(--surface);
color: var(--text);
width: 100%;
outline: none;
transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--orange); }
label { font-size: 12px; font-weight: 500; color: var(--text2); display: block; margin-bottom: 5px; }

.form-row { margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* MODAL */
.modal-overlay {
display: none;
position: fixed;
inset: 0;
background: rgba(20,40,80,0.45);
z-index: 100;
align-items: center;
justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
background: var(--surface);
border-radius: var(--radius);
padding: 24px;
width: 580px;
max-width: 95vw;
max-height: 90vh;
overflow-y: auto;
box-shadow: var(--shadow-md);
border: 1px solid var(--border);
}
.modal-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 20px;
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; cursor: pointer; font-size: 18px; color: var(--text2); padding: 4px; }
.modal-close:hover { color: var(--text); }

.section-box {
background: var(--surface2);
border: 1px solid var(--border);
border-radius: var(--radius-sm);
padding: 14px;
margin: 14px 0;
}
.section-box-title { font-size: 12px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }

.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.check-item {
display: flex;
align-items: center;
gap: 8px;
font-size: 13px;
cursor: pointer;
padding: 6px 8px;
border-radius: var(--radius-sm);
transition: background 0.1s;
}
.check-item:hover { background: var(--border); }
.check-item input[type=checkbox] { width: 15px; height: 15px; cursor: pointer; accent-color: var(--orange); flex-shrink: 0; }

.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }

/* PANES */
.pane { display: none; }
.pane.active { display: block; }

/* TARIFS */
.formateur-tarif-block { margin-bottom: 20px; }
.formateur-tarif-header {
display: flex;
align-items: center;
gap: 10px;
padding: 12px 16px;
background: var(--navy);
border-radius: var(--radius) var(--radius) 0 0;
}
.formateur-tarif-header .name { color: #fff; font-weight: 600; font-size: 13px; }
.formateur-tarif-body {
border: 1px solid var(--border);
border-top: none;
border-radius: 0 0 var(--radius) var(--radius);
overflow: hidden;
}

/* EMPTY STATE */
.empty { text-align: center; padding: 48px; color: var(--text2); }
.empty-icon { font-size: 32px; margin-bottom: 8px; }
.empty-text { font-size: 14px; }

/* FILTER ROW */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters select, .filters input { width: auto; min-width: 140px; }

/* MARGE POS/NEG */
.marge-pos { color: var(--green); font-weight: 600; font-family: 'DM Mono', monospace; font-size: 12px; }
.marge-neg { color: var(--red); font-weight: 600; font-family: 'DM Mono', monospace; font-size: 12px; }
.mono { font-family: 'DM Mono', monospace; font-size: 12px; }

/* ACTIONS COL */
.actions { display: flex; gap: 4px; justify-content: flex-end; }

/* NOTIFICATION */
.notif {
position: fixed;
bottom: 24px;
right: 24px;
background: var(--navy);
color: #fff;
padding: 12px 18px;
border-radius: var(--radius-sm);
font-size: 13px;
font-weight: 500;
box-shadow: var(--shadow-md);
z-index: 200;
opacity: 0;
transform: translateY(8px);
transition: all 0.25s;
pointer-events: none;
}
.notif.show { opacity: 1; transform: translateY(0); }

.dep-shape {
fill: #eef2f7;
stroke: #8a9db8;
stroke-width: 0.8;
cursor: pointer;
transition: fill 0.15s;
}
.dep-shape:hover { fill: #d0dff0; }
.dep-shape.selected { fill: #142850; stroke: #EC6431; stroke-width: 1.5; }
.dep-shape.has-formateurs { fill: #fde8d0; }
.dep-shape.has-formateurs-2 { fill: #f4a261; }
.dep-shape.has-formateurs-3 { fill: #EC6431; }
.idf-dep { stroke-width: 0.4; }

.carte-zoom-controls {
position: absolute;
top: 8px;
right: 8px;
display: flex;
flex-direction: column;
gap: 4px;
z-index: 10;
}
.carte-zoom-btn {
width: 28px;
height: 28px;
border-radius: 6px;
border: 1px solid var(--border);
background: white;
color: var(--navy);
font-size: 16px;
font-weight: bold;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 1px 4px rgba(0,0,0,0.15);
line-height: 1;
user-select: none;
}
.carte-zoom-btn:hover { background: var(--surface2); }
#carte-container { position: relative; }
#carte-svg-wrap {
overflow: hidden;
width: 100%;
cursor: grab;
}
#carte-svg-wrap:active { cursor: grabbing; }
#carte-svg-wrap svg {
transform-origin: 0 0;
transition: transform 0.05s;
}

/* RESPONSIVE MOBILE */
@media (max-width: 768px) {
.sidebar { display: none !important; }
.main { margin-left: 0 !important; padding: 12px 10px !important; padding-bottom: 75px !important; overflow-y: auto !important; }
#mobile-nav { display: flex !important; }
.table-card { overflow-x: auto !important; }
table { font-size: 12px !important; min-width: 480px !important; }
th, td { padding: 6px 8px !important; }
.page-header { flex-direction: column !important; gap: 8px !important; align-items: flex-start !important; }
.grid2, .grid3 { grid-template-columns: 1fr !important; }
.btn { padding: 10px 14px !important; }
.btn-primary { padding: 12px 16px !important; }
.modal-overlay { align-items: flex-end !important; padding: 0 !important; }
.modal { width: 100% !important; max-width: 100% !important; max-height: 92vh !important; overflow-y: auto !important; border-radius: 16px 16px 0 0 !important; margin: 0 !important; }
.table-toolbar { flex-direction: column !important; gap: 6px !important; }
.table-toolbar select, .table-toolbar input { width: 100% !important; }
input, select, textarea { font-size: 16px !important; }
}
@media (min-width: 769px) { #mobile-nav { display: none !important; } }

#mobile-nav {
display: none; position: fixed; bottom: 0; left: 0; right: 0;
background: var(--navy); border-top: 1px solid rgba(255,255,255,0.12);
z-index: 9999; overflow-x: auto; -webkit-overflow-scrolling: touch;
height: 62px; align-items: center; padding: 0 2px;
}
#mobile-nav button {
display: flex; flex-direction: column; align-items: center; justify-content: center;
min-width: 56px; height: 58px; padding: 4px 6px;
background: none; border: none; color: rgba(255,255,255,0.6);
font-size: 9px; cursor: pointer; flex-shrink: 0; border-radius: 8px; gap: 2px;
}
#mobile-nav button.active { background: var(--orange); color: #fff; }
#mobile-nav button span.ico { font-size: 19px; line-height: 1; }
#mobile-nav button span.lbl { font-size: 8px; white-space: nowrap; }
