@charset "UTF-8";

/* ─── Variables ─────────────────────────────────────── */
:root {
  --noir:    #000000;
  --blanc:   #ffffff;
  --gris-l:  #f5f5f5;
  --gris-m:  #e0e0e0;
  --gris-t:  #888888;
  --vert:    #93E6B4;
  --bleu:    #1687CC;
  --rouge:   #e05555;
  --orange:  #f5a623;
  --selection: rgba(146, 230, 180, 0.35);
  --font-ui: soleil, sans-serif;
  --font-bask: baskerville-urw, serif;
  --radius: 3px;
  --shadow: 0 1px 4px rgba(0,0,0,0.08);
}

::selection { background: var(--selection); }

/* ─── Reset minimal ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 15px;
  color: var(--noir);
  background: var(--blanc);
  min-height: 100vh;
}

/* ─── Typographie ───────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-ui);
  font-weight: 300;
  margin: 0;
}
h1 { font-size: 1.7em; letter-spacing: -0.01em; }
h2 { font-size: 1.2em; font-weight: 400; }
h3 { font-size: 1em; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; }

.logo {
  font-family: var(--font-bask);
  font-weight: 400;
  font-style: normal;
  font-size: 1.5em;
  letter-spacing: 0.02em;
}

/* texte saisi par l'utilisateur */
.user-text, input, textarea, select {
  font-family: var(--font-bask);
  font-weight: 400;
}

p { line-height: 1.6; margin: 0 0 0.8em; }
a { color: var(--bleu); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Layout global ─────────────────────────────────── */
.app-wrap {
  display: block;
  min-height: 100vh;
}

/* ─── Sidebar ───────────────────────────────────────── */
.sidebar {
  background: var(--noir);
  color: var(--blanc);
  display: flex;
  flex-direction: column;
  padding: 0;
  position: fixed;
  top: 0; left: 0;
  width: 220px;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-header {
  padding: 28px 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header .logo {
  color: var(--blanc);
  display: block;
  font-size: 1.3em;
}

.sidebar-header .app-subtitle {
  font-family: var(--font-ui);
  font-size: 0.7em;
  font-weight: 300;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 4px;
}

.sidebar nav { flex: 1; padding: 16px 0; }

.nav-section {
  padding: 12px 24px 4px;
  font-size: 0.65em;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.3);
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 24px;
  color: rgba(255,255,255,0.75);
  font-size: 0.9em;
  font-weight: 400;
  transition: color 0.15s, background 0.15s;
}
.sidebar nav a:hover,
.sidebar nav a.active {
  color: var(--blanc);
  background: rgba(255,255,255,0.08);
  text-decoration: none;
}
.sidebar nav a.active { border-left: 2px solid var(--vert); }
.sidebar nav a svg { width: 16px; height: 16px; opacity: 0.7; flex-shrink: 0; }
.sidebar nav a:hover svg, .sidebar nav a.active svg { opacity: 1; }

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.8em;
  color: rgba(255,255,255,0.4);
}
.sidebar-footer a { color: rgba(255,255,255,0.5); font-size: 0.9em; }
.sidebar-footer a:hover { color: var(--blanc); }

/* ─── Contenu principal ─────────────────────────────── */
.main-content {
  margin-left: 220px;
  padding: 40px 48px;
  min-height: 100vh;
}

.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--gris-m);
}

.page-header h1 { font-size: 1.6em; font-weight: 300; }
.breadcrumb {
  font-size: 0.8em;
  color: var(--gris-t);
  margin-bottom: 6px;
}
.breadcrumb a { color: var(--gris-t); }
.breadcrumb span { margin: 0 6px; }

/* ─── Cartes ─────────────────────────────────────────── */
.card {
  background: var(--blanc);
  border: 1px solid var(--gris-m);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 0.75em;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gris-t);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gris-m);
}

/* ─── Grilles de stats (dashboard) ──────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--gris-l);
  border: 1px solid var(--gris-m);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.stat-card .stat-value {
  font-size: 2.2em;
  font-weight: 300;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card .stat-label {
  font-size: 0.75em;
  color: var(--gris-t);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ─── Tableaux ───────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
}
table.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-weight: 500;
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gris-t);
  border-bottom: 2px solid var(--gris-m);
  background: var(--blanc);
}
table.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gris-m);
  vertical-align: middle;
}
table.data-table tbody tr:hover { background: var(--gris-l); }
table.data-table td.actions { white-space: nowrap; text-align: right; }

/* ─── Formulaires ────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 32px;
}
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-grid.cols-1 { grid-template-columns: 1fr; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.span-2 { grid-column: span 2; }
.form-group.span-3 { grid-column: span 3; }
.form-group.span-full { grid-column: 1 / -1; }

label {
  font-size: 0.78em;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gris-t);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
input[type="tel"],
select,
textarea {
  font-family: var(--font-bask);
  font-size: 0.95em;
  padding: 9px 12px;
  border: 1px solid var(--gris-m);
  border-radius: var(--radius);
  background: var(--blanc);
  color: var(--noir);
  width: 100%;
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--noir);
}
textarea { resize: vertical; min-height: 90px; }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23888' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-hint { font-size: 0.78em; color: var(--gris-t); margin-top: 2px; }

/* ─── Boutons ────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  font-family: var(--font-ui);
  font-size: 0.85em;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }

.btn-primary { background: var(--noir); color: var(--blanc); border-color: var(--noir); }
.btn-primary:hover { background: #222; text-decoration: none; color: var(--blanc); }

.btn-outline { background: transparent; color: var(--noir); border-color: var(--gris-m); }
.btn-outline:hover { border-color: var(--noir); text-decoration: none; }

.btn-ghost { background: transparent; color: var(--gris-t); border-color: transparent; }
.btn-ghost:hover { color: var(--noir); text-decoration: none; }

.btn-danger { background: var(--rouge); color: var(--blanc); border-color: var(--rouge); }
.btn-danger:hover { background: #c94040; text-decoration: none; color: var(--blanc); }

.btn-green { background: var(--vert); color: var(--noir); border-color: var(--vert); }
.btn-green:hover { background: #7ed8a0; text-decoration: none; }

.btn-sm { padding: 6px 14px; font-size: 0.8em; }
.btn-lg { padding: 12px 28px; font-size: 1em; }

.btn-group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ─── Badges / statuts ───────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72em;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}
.badge-draft  { background: var(--gris-m); color: var(--gris-t); }
.badge-open   { background: #fff3cd; color: #856404; }
.badge-active { background: #d1ecf1; color: #0c5460; }
.badge-done   { background: #d4edda; color: #155724; }
.badge-signed { background: #d0e8d0; color: #1a5c1a; }
.badge-sent   { background: #cce5ff; color: #004085; }
.badge-urgent { background: #f8d7da; color: #721c24; }

/* ─── Messages flash ─────────────────────────────────── */
.flash {
  padding: 12px 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.flash-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.flash-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.flash-info    { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ─── Page de login ──────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gris-l);
}
.login-box {
  background: var(--blanc);
  border: 1px solid var(--gris-m);
  border-radius: var(--radius);
  padding: 48px 52px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}
.login-box .logo {
  display: block;
  text-align: center;
  font-size: 1.8em;
  margin-bottom: 8px;
}
.login-box .login-subtitle {
  text-align: center;
  font-size: 0.78em;
  color: var(--gris-t);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 36px;
}
.login-box .form-group { margin-bottom: 16px; }
.login-box .btn { width: 100%; justify-content: center; margin-top: 8px; }

/* ─── Section remarques ──────────────────────────────── */
.remarque-item {
  border: 1px solid var(--gris-m);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 12px;
  position: relative;
  background: var(--blanc);
}
.remarque-item:hover { border-color: #bbb; }
.remarque-num {
  font-size: 0.7em;
  font-weight: 500;
  color: var(--gris-t);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.remarque-desc {
  font-family: var(--font-bask);
  font-size: 0.95em;
  line-height: 1.5;
}
.remarque-meta {
  display: flex;
  gap: 20px;
  margin-top: 10px;
  font-size: 0.8em;
  color: var(--gris-t);
  flex-wrap: wrap;
}
.remarque-actions {
  position: absolute;
  top: 12px; right: 14px;
  display: flex;
  gap: 6px;
}

/* ─── Upload photos ──────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--gris-m);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--noir);
  background: var(--gris-l);
}
.upload-zone p {
  margin: 0;
  color: var(--gris-t);
  font-size: 0.9em;
}
.upload-zone input[type="file"] { display: none; }

.photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.photo-thumb {
  position: relative;
  aspect-ratio: 4/3;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--gris-m);
  cursor: pointer;
}
.photo-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.photo-thumb .photo-remove {
  position: absolute;
  top: 4px; right: 4px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 22px; height: 22px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}
.photo-thumb:hover .photo-remove { opacity: 1; }

/* ─── Zone de signature ──────────────────────────────── */
.signature-block {
  border: 1px solid var(--gris-m);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  background: var(--gris-l);
}
.signature-block h4 {
  font-size: 0.8em;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gris-t);
  margin-bottom: 4px;
}
.signature-block .sig-name {
  font-family: var(--font-bask);
  font-size: 0.95em;
  margin-bottom: 12px;
}
.sig-canvas-wrap {
  background: var(--blanc);
  border: 1px solid var(--gris-m);
  border-radius: var(--radius);
  overflow: hidden;
  touch-action: none;
}
canvas.sig-canvas {
  display: block;
  width: 100%;
  height: 150px;
  cursor: crosshair;
}
.sig-actions { display: flex; gap: 8px; margin-top: 8px; }

/* ─── Checklist ──────────────────────────────────────── */
.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gris-m);
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item label { font-size: 0.9em; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--noir); cursor: pointer; flex: 1; }
.checklist-radio-group { display: flex; gap: 6px; flex-shrink: 0; }
.cl-radio { display: none; }
.cl-label {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid var(--gris-m);
  border-radius: 20px;
  font-size: 0.72em;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.cl-radio[value="ok"]:checked + .cl-label  { background: #d4edda; border-color: #28a745; color: #155724; }
.cl-radio[value="nok"]:checked + .cl-label { background: #f8d7da; border-color: #dc3545; color: #721c24; }
.cl-radio[value="na"]:checked + .cl-label  { background: var(--gris-m); border-color: #aaa; color: var(--gris-t); }

/* ─── Onglets ────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--gris-m);
  margin-bottom: 28px;
}
.tab-btn {
  padding: 10px 20px;
  font-family: var(--font-ui);
  font-size: 0.85em;
  font-weight: 500;
  color: var(--gris-t);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn.active { color: var(--noir); border-bottom-color: var(--noir); }
.tab-btn:hover:not(.active) { color: var(--noir); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ─── Modale ─────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--blanc);
  border-radius: var(--radius);
  padding: 32px 36px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(12px);
  transition: transform 0.2s;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.4em;
  cursor: pointer;
  color: var(--gris-t);
  line-height: 1;
  padding: 0;
}
.modal-close:hover { color: var(--noir); }

/* ─── Utilitaires ────────────────────────────────────── */
.text-muted { color: var(--gris-t); }
.text-small { font-size: 0.82em; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.divider { border: none; border-top: 1px solid var(--gris-m); margin: 24px 0; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

/* ─── Impression / PDF ───────────────────────────────── */
@media print {
  .sidebar, .btn, .tab-btn, .page-header .btn-group { display: none !important; }
  .main-content { margin-left: 0; padding: 0; }
  body { font-size: 12pt; }
}
