/* Sections MDT (tableau de bord, recherche, profils, rapports, mandats, code pénal, admin) */

.rail { overflow-y: auto; }
.tab i { font-size: 19px; width: 22px; text-align: center; }
.rail-sep { height: 1px; margin: 6px 8px; background: var(--line); flex-shrink: 0; }

.view.page { display: block; overflow-y: auto; padding: 24px 28px 40px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-family: var(--cond); font-size: 30px; font-weight: 700; letter-spacing: .02em; }
.page-head .sub { font-size: 14px; color: var(--muted); }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.cols-main { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.card { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; }
.card-head h2, .card-head h3 { margin: 0; font-family: var(--cond); font-size: 18px; font-weight: 700; letter-spacing: .04em; }
.card-head .push { margin-left: auto; }
.card-count { font-family: var(--mono); font-size: 13px; color: var(--muted); }

.item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); text-align: left; color: inherit; }
button.item:hover { border-color: #2a3a4a; }
.item .grow { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item .title { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .meta { font-size: 13px; color: var(--muted); }
.item .side { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; border: 1px solid var(--line-on); font-size: 12px; font-weight: 600; color: var(--text-2); background: #16202a; white-space: nowrap; }
.chip.amber { color: #f5c77e; border-color: #6b4a17; background: #1c150b; }
.chip.red { color: #ffb3b3; border-color: #7a2e2e; background: #2a1414; }
.chip.green { color: #a8dcc3; border-color: #1f5f3f; background: #0f1d17; }
.chip.blue { color: var(--blue-soft); border-color: #27415c; background: #0f1c2a; }
.chip.gray { color: var(--muted); }
.chip button { border: 0; background: none; color: inherit; padding: 0; font-size: 14px; line-height: 1; }

.btn-danger { height: 34px; padding: 0 12px; border: 1px solid #7a2e2e; border-radius: 8px; background: #2a1414; color: #ffd9d9; font-size: 13px; font-weight: 600; }
.btn-danger:hover { background: #3a1a1a; }
.btn-sm { height: 30px !important; padding: 0 10px !important; font-size: 12px !important; }

.notice { padding: 12px 14px; border-radius: 10px; border: 1px solid #27415c; background: #0f1c2a; display: flex; flex-direction: column; gap: 6px; }
.notice.blocking { border-color: #6b4a17; background: #1c150b; }
.notice strong { font-size: 15px; }
.notice p { margin: 0; font-size: 14px; color: var(--text-2); white-space: pre-wrap; line-height: 1.45; }
.notice .meta { font-size: 12px; color: var(--muted); }

.stat { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); display: flex; flex-direction: column; gap: 4px; }
.stat b { font-family: var(--mono); font-size: 28px; }
.stat span { font-size: 13px; color: var(--muted); }

/* formulaires */
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form .wide { grid-column: 1 / -1; }
.form label, .field-block { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.form input, .form select, .form textarea, .input { padding: 10px 12px; border: 1px solid #2a3947; border-radius: 8px; background: var(--card); color: var(--text); font-size: 15px; }
.form input, .form select, .input { height: 42px; }
.form textarea { resize: vertical; line-height: 1.45; }
.checkbox { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px; color: var(--text-2) !important; font-size: 14px !important; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--blue); }

.search-bar { display: flex; gap: 10px; margin-bottom: 20px; }
.search-bar input { flex-grow: 1; height: 50px; padding: 0 16px; border: 1px solid #2a3947; border-radius: 10px; background: var(--card); color: var(--text); font-size: 17px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filters .input { min-width: 180px; }

/* profil */
.profile-head { display: flex; gap: 20px; align-items: flex-start; }
.mugshot { width: 150px; height: 180px; flex-shrink: 0; border-radius: 12px; border: 1px solid var(--line); background: var(--card); object-fit: cover; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 42px; }
.id-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; flex-grow: 1; }

/* rapport */
.editor { width: 100%; min-height: 420px; padding: 16px; border: 1px solid #2a3947; border-radius: 10px; background: var(--card); color: var(--text); font-size: 15px; line-height: 1.55; resize: vertical; font-family: 'Barlow', sans-serif; }
.editor[readonly] { opacity: .85; }
.title-input { flex-grow: 1; min-width: 280px; height: 48px; padding: 0 14px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--text); font-family: var(--cond); font-size: 28px; font-weight: 700; }
.title-input:hover, .title-input:focus { border-color: #2a3947; background: var(--card); }
.suspect { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); display: flex; flex-direction: column; gap: 8px; }
.charge-line { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 6px 8px; border-radius: 6px; background: #0e151c; }
.charge-line .grow { flex-grow: 1; min-width: 0; }
.charge-line.done { opacity: .7; }
.totals { font-family: var(--mono); font-size: 13px; color: var(--text-2); }
.save-state { font-size: 13px; color: var(--muted); }
.save-state.dirty { color: #f5c77e; }

/* tableaux */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid #16202a; vertical-align: top; }
.table tr:hover td { background: #111a22; }
.table .mono { font-family: var(--mono); }
.group-title { margin: 18px 0 6px; font-family: var(--cond); font-size: 18px; font-weight: 700; letter-spacing: .04em; color: var(--blue-soft); }

/* admin */
.perm-group { display: flex; flex-direction: column; gap: 6px; }
.perm-group h4 { margin: 8px 0 2px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.mapping-row { display: flex; gap: 8px; align-items: center; }
.mapping-row .input { height: 36px; }
.role-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }

/* sélecteur de personne */
.picker { position: relative; }
.picker-results { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); max-height: 260px; overflow-y: auto; border: 1px solid var(--line-on); border-radius: 10px; background: var(--panel); box-shadow: 0 10px 30px #0008; }
.picker-results button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 8px 12px; border: 0; background: none; text-align: left; }
.picker-results button:hover, .picker-results button:focus-visible { background: var(--card-on); }

/* modale générique */
dialog.mdw-modal { width: 620px; }
dialog.mdw-modal .modal-body { display: flex; flex-direction: column; gap: 14px; }

/* avis bloquant */
.blocking-overlay { position: fixed; inset: 0; z-index: 1800; display: flex; align-items: center; justify-content: center; background: #000c; padding: 16px; }
.blocking-card { width: 560px; max-width: 100%; padding: 24px; border-radius: 14px; border: 1px solid #6b4a17; background: #15110b; display: flex; flex-direction: column; gap: 14px; }
.blocking-card h2 { font-size: 24px; color: #f5c77e; }
.blocking-card p { margin: 0; white-space: pre-wrap; line-height: 1.5; color: var(--text); }

@media (max-width: 1200px) {
  .cols-main, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .id-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .grid-2, .form { grid-template-columns: minmax(0, 1fr); }
  .profile-head { flex-direction: column; }
  .view.page { padding: 16px; }
}

/* connexion */
.login-card { display: flex; flex-direction: column; gap: 14px; width: 440px; max-width: calc(100vw - 32px); }
.login-card .item[disabled] { opacity: .5; cursor: not-allowed; }
.btn-discord { display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 48px; border-radius: 10px; background: #5865f2; color: #fff !important; font-size: 16px; font-weight: 700; text-decoration: none; }
.btn-discord:hover { background: #4752c4; }
.login-error { margin: 0; padding: 10px 12px; border-radius: 8px; border: 1px solid #7a2e2e; background: #2a1414; color: #ffd9d9; }
.meta .btn-sm { height: 30px; }

/* images */
.dropzone { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 64px; padding: 12px; border: 1px dashed #35506b; border-radius: 10px; background: #0e1822; color: var(--muted); font-size: 13px; text-align: center; cursor: pointer; }
.dropzone:hover, .dropzone.over { border-color: #7cc0ff; color: var(--text); background: #102235; }
.dropzone i { font-size: 18px; }
.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.gallery figure { margin: 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.gallery figcaption { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }
.gallery figcaption span { flex-grow: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb { padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--card); aspect-ratio: 4 / 3; cursor: zoom-in; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
dialog.lightbox { width: auto; max-width: calc(100vw - 48px); }
dialog.lightbox img { display: block; max-width: calc(100vw - 96px); max-height: calc(100vh - 160px); margin: 0 auto 12px; border-radius: 8px; }

/* en-tête : logo, notifications */
.brand-logo { display: flex; align-items: center; }
.brand-logo-img { width: 34px; height: 34px; object-fit: contain; border-radius: 6px; }
.notif-wrap { position: relative; }
.notif-btn { position: relative; width: 38px; height: 34px; border: 1px solid #27415c; border-radius: 8px; background: #0f1c2a; color: var(--blue-soft); }
.notif-btn .badge { top: -6px; right: -6px; }
.notif-panel { position: absolute; z-index: 1600; right: 0; top: calc(100% + 8px); width: 380px; max-height: 480px; overflow-y: auto; padding: 8px; border: 1px solid var(--line-on); border-radius: 12px; background: var(--panel); box-shadow: 0 16px 40px #000a; display: flex; flex-direction: column; gap: 4px; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 8px; }
.notif-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; text-align: left; color: var(--text); }
.notif-item:hover { background: var(--card-on); }
.notif-item.unread { background: #13263a; }
.notif-item .title { font-weight: 600; font-size: 14px; }
.notif-item .meta { font-size: 13px; color: var(--text-2); }

/* listes : élément sélectionné */
.item.on { border-color: var(--line-on); background: var(--card-on); }

/* éditeur : onglets du panneau latéral, commentaires, versions */
.side-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.side-tab { flex-grow: 1; height: 36px; border: 1px solid #27415c; border-radius: 8px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; }
.side-tab.on { background: #13263a; color: var(--text); border-color: #2f5a85; }
.count-pill { display: inline-flex; min-width: 20px; height: 20px; padding: 0 6px; align-items: center; justify-content: center; border-radius: 10px; background: #27415c; font-size: 11px; }
.comment { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); display: flex; flex-direction: column; gap: 8px; }
.comment.resolved { opacity: .6; }
.comment-quote { padding: 6px 10px; border: 0; border-left: 3px solid #f0a33a; border-radius: 4px; background: #1c150b; color: #f5c77e; font-size: 13px; text-align: left; font-style: italic; cursor: pointer; }
.comment-body { display: flex; flex-direction: column; gap: 4px; padding-top: 6px; border-top: 1px solid #16202a; }
.comment-body:first-of-type { border-top: 0; padding-top: 0; }
.comment-body p { margin: 0; font-size: 14px; line-height: 1.45; white-space: pre-wrap; }
.version-preview { max-height: 60vh; overflow-y: auto; border-radius: 8px; background: #fff; color: #1f2328; }
.version-preview .ql-editor { padding: 24px 32px; font-family: 'Barlow', Arial, sans-serif; font-size: 15px; line-height: 1.55; }
.version-preview.ql-container.ql-snow { border: 0; }

/* code pénal */
.penal-heading { margin-bottom: 24px; }
.penal-heading-title { margin: 0 0 4px; font-family: var(--cond); font-size: 22px; letter-spacing: .03em; color: var(--text); border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.penal-cat-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.penal-cat-head .group-title { margin-right: 4px; }

/* administration */
.logo-preview { width: 72px; height: 72px; object-fit: contain; border-radius: 8px; background: var(--card); border: 1px solid var(--line); }
.logo-preview.small { width: 40px; height: 40px; }

/* effectifs */
.table-wrap { overflow-x: auto; }
.roster-table tr.clickable { cursor: pointer; }
.roster-state { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #3a4450; }
.roster-state.online { background: #4aa3ff; }
.roster-state.duty { background: var(--green); box-shadow: 0 0 0 3px #3ecf8e33; }

/* ---------- bilan EMS ---------- */
.bilan-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.bilan-body { position: sticky; top: 0; }
.body3d-card { gap: 10px; }
.body3d { position: relative; height: 520px; border: 1px solid var(--line); border-radius: 10px; background: radial-gradient(ellipse at 50% 35%, #1a2733 0%, #0d141b 75%); overflow: hidden; }
.body3d-canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.body3d-canvas:active { cursor: grabbing; }
.body3d .empty { height: 100%; display: flex; align-items: center; justify-content: center; text-align: center; padding: 20px; }
.body3d-tip { position: absolute; pointer-events: none; padding: 4px 8px; border-radius: 6px; background: #0b1015e6; border: 1px solid var(--line-on); font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; }
.body3d-views { flex-wrap: wrap; }
.abcde { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.abcde-col { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.abcde-col h4 { margin: 0; font-family: var(--cond); font-size: 16px; letter-spacing: .04em; color: var(--blue-soft); }
.abcde-col .input { font-size: 14px; height: 38px; }
.with-unit { display: flex; align-items: center; gap: 6px; }
.with-unit .input { flex: 1; min-width: 0; }
.with-unit span { font-size: 12px; color: var(--muted); min-width: 38px; }
.gcs-total { font-family: var(--mono, 'IBM Plex Mono', monospace); font-size: 22px; color: var(--text); }
.gcs-total.red { color: #ff8a8a; } .gcs-total.amber { color: #f5c77e; } .gcs-total.green { color: #a8dcc3; }
.vital-alert { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 8px; border: 1px solid; font-size: 14px; font-weight: 600; }
.vital-alert.red { color: #ffb3b3; border-color: #7a2e2e; background: #2a1414; }
.vital-alert.amber { color: #f5c77e; border-color: #6b4a17; background: #1c150b; }
.vital-alert.ok { color: #a8dcc3; border-color: #1f5f3f; background: #0f1d17; }
.lesion-row { display: grid; grid-template-columns: 140px minmax(0, 1.2fr) 110px minmax(0, 1.5fr) auto; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.lesion-row .input { height: 36px; font-size: 14px; }
.gestes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 14px; }
.surv-table td { padding: 4px; }
.triage-row { display: flex; flex-wrap: wrap; gap: 8px; }
.triage { flex: 1; min-width: 130px; height: 42px; border-radius: 8px; border: 1px solid var(--line-on); background: var(--card); color: var(--text-2); font-weight: 700; }
.triage.on.red { background: #7a1f1f; border-color: #ff6b6b; color: #fff; }
.triage.on.amber { background: #6b4a17; border-color: #f0a33a; color: #fff; }
.triage.on.green { background: #1f5f3f; border-color: #4fc38a; color: #fff; }
.triage.on.gray { background: #2a333c; border-color: #8a96a3; color: #fff; }
.print-only { display: none; }
@media (max-width: 1100px) {
  .bilan-layout { grid-template-columns: minmax(0, 1fr); }
  .bilan-body { position: static; order: -1; }
  .body3d { height: 400px; }
  .lesion-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .lesion-row > strong { grid-column: 1 / -1; }
}
@media print {
  #view-bilan .print-only { display: flex; flex-direction: column; gap: 4px; }
  #view-bilan .page-head, #view-bilan .body3d-views, #view-bilan .body3d-card .muted, #view-bilan button { display: none !important; }
  #view-bilan .bilan-layout { grid-template-columns: 1fr; }
  #view-bilan .bilan-body { position: static; }
}

/* ---------- statistiques ---------- */
.stat-periods { width: auto; }
.stat-periods button { padding: 0 14px; white-space: nowrap; }
.stat-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat-value { font-family: var(--cond); font-size: 32px; line-height: 1.1; }
.stat-chart { display: flex; flex-direction: column; gap: 4px; }
.stat-bars { width: 100%; height: 160px; }
.stat-axis { display: flex; }
.stat-axis span { flex: 1; font-size: 10px; color: var(--muted); text-align: center; white-space: nowrap; overflow: visible; }
.stat-grid { align-items: start; }
.stat-rank { display: flex; flex-direction: column; gap: 6px; }
.stat-rank + .stat-rank { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.stat-rank-row { display: grid; grid-template-columns: minmax(0, 140px) minmax(0, 1fr) 36px; align-items: center; gap: 8px; font-size: 13px; }
.stat-rank-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.stat-rank-bar { height: 10px; border-radius: 5px; background: var(--card); overflow: hidden; }
.stat-rank-bar i { display: block; height: 100%; border-radius: 5px; }
.stat-rank-row b { font-family: var(--mono); font-size: 12px; text-align: right; }
.stat-heat { height: 380px; border-radius: 10px; overflow: hidden; background: #0a1a26; }

/* ---------- amendes ---------- */
.fine-modal { min-width: 0; }
.fine-modal .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fine-modal .input { width: 100%; }
.fine-code .grow, .fine-row .grow { flex: 1; min-width: 0; }
.fine-codes { display: flex; flex-direction: column; max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.fine-code { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; color: inherit; }
.fine-code:last-child { border-bottom: 0; }
.fine-code:hover, .fine-code:focus-visible { background: var(--card-on); }
.fine-sub { margin: 6px 0 0; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.fine-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px; background: var(--card); }
.fine-count { display: flex; align-items: center; gap: 6px; }
.fine-count .btn-sm { min-width: 30px; padding: 0 8px; }
.fine-total { display: flex; align-items: baseline; gap: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.fine-total > span:first-child { text-transform: uppercase; letter-spacing: .06em; font-size: 12px; color: var(--muted); }
.fine-total-value { font-size: 24px; }

/* ---------- dossier de conduite ---------- */
.drv-box { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.drv-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.drv-projection { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border-radius: 8px; border-left: 3px solid var(--line-on); background: var(--card); font-size: 13px; }
.drv-projection.green { border-left-color: #3ecf8e; } .drv-projection.amber { border-left-color: #f0a33a; } .drv-projection.red { border-left-color: #ff6b6b; background: #2a1214; }
.drv-windows { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
.drv-window { display: flex; flex-direction: column; padding: 6px 10px; border-radius: 8px; background: var(--card); }
.drv-window.over { background: #2a1214; }
.drv-pts { min-width: 30px; color: #f0a33a; }
