/* ============================================================
   VOLTIA — Design System v1.0
   Sombre par défaut (bureau) · clair thème "chantier" haute lisibilité
   ============================================================ */

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

:root {
  --bg: #080D1A;
  --bg-grad: radial-gradient(1200px 600px at 12% -8%, rgba(76,125,255,.16), transparent 60%),
             radial-gradient(900px 500px at 92% 0%, rgba(34,211,166,.10), transparent 55%);
  --surface: #0E1526;
  --surface-2: #131C31;
  --surface-3: #1A2440;
  --line: rgba(255,255,255,.075);
  --line-strong: rgba(255,255,255,.14);
  --text: #E9EEFB;
  --text-2: #AEB9D4;
  --muted: #74809E;
  --accent: #4C7DFF;
  --accent-soft: rgba(76,125,255,.14);
  --green: #22D3A6;
  --green-soft: rgba(34,211,166,.13);
  --amber: #F5A524;
  --amber-soft: rgba(245,165,36,.13);
  --red: #F2555A;
  --red-soft: rgba(242,85,90,.13);
  --violet: #9B7BFF;
  --violet-soft: rgba(155,123,255,.14);
  --shadow: 0 18px 46px -22px rgba(0,0,0,.85);
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar: 258px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
}

[data-theme='light'] {
  --bg: #F4F6FB;
  --bg-grad: radial-gradient(1100px 560px at 10% -10%, rgba(76,125,255,.10), transparent 60%),
             radial-gradient(800px 420px at 95% 0%, rgba(34,211,166,.09), transparent 55%);
  --surface: #FFFFFF;
  --surface-2: #F7F9FE;
  --surface-3: #EDF1FA;
  --line: rgba(16,30,60,.09);
  --line-strong: rgba(16,30,60,.16);
  --text: #0D1730;
  --text-2: #44527A;
  --muted: #6B7899;
  --accent: #2D5BFF;
  --accent-soft: rgba(45,91,255,.09);
  --green: #0E9F7E;
  --green-soft: rgba(14,159,126,.10);
  --amber: #C77A06;
  --amber-soft: rgba(199,122,6,.11);
  --red: #D93A3F;
  --red-soft: rgba(217,58,63,.10);
  --violet: #6D4AE0;
  --violet-soft: rgba(109,74,224,.10);
  --shadow: 0 16px 40px -26px rgba(13,23,48,.45);
}

/* Terrain : contraste renforcé + cibles tactiles */
[data-theme='field'] {
  --bg: #05080F;
  --surface: #0A0F1C;
  --surface-2: #101827;
  --surface-3: #16223A;
  --line: rgba(255,255,255,.16);
  --line-strong: rgba(255,255,255,.30);
  --text: #FFFFFF;
  --text-2: #D6DEFF;
  --muted: #9AA7C7;
  --accent: #6E97FF;
  --amber: #FFB733;
  --radius: 20px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: rgba(76,125,255,.35); }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 20px; border: 2px solid var(--bg); }

/* ============================================================
   APP SHELL
   ============================================================ */
.app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar);
  flex: 0 0 var(--sidebar);
  background: linear-gradient(180deg, rgba(14,21,38,.96), rgba(8,13,26,.99));
  border-right: 1px solid var(--line);
  padding: 18px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 40;
}
[data-theme='light'] .sidebar { background: linear-gradient(180deg, #fff, #F8FAFF); }

.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; flex: 0 0 38px;
  background: linear-gradient(145deg, #4C7DFF, #7B4DFF 55%, #22D3A6);
  display: grid; place-items: center;
  box-shadow: 0 8px 22px -8px rgba(76,125,255,.9), inset 0 1px 0 rgba(255,255,255,.35);
}
.brand-mark svg { width: 21px; height: 21px; }
.brand-name { font-size: 17px; font-weight: 800; letter-spacing: -.3px; line-height: 1.1; }
.brand-sub { font-size: 10.5px; color: var(--muted); letter-spacing: .07em; text-transform: uppercase; font-weight: 600; }
.brand-beta {
  margin-left: auto; align-self: flex-start;
  font-size: 9px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
  padding: 3px 6px; border-radius: 5px; white-space: nowrap;
  color: #fff; background: linear-gradient(135deg, #f59e0b, #ef4444);
  box-shadow: 0 4px 10px -4px rgba(239,68,68,.7);
}

.nav-group { margin-top: 12px; }
.nav-label {
  font-size: 10px; letter-spacing: .11em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; padding: 0 10px 7px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 10px;
  color: var(--text-2); font-weight: 550; font-size: 13.2px;
  transition: background .16s, color .16s;
  position: relative;
  margin-bottom: 1px;
}
.nav-item:hover { background: rgba(255,255,255,.045); color: var(--text); }
[data-theme='light'] .nav-item:hover { background: var(--surface-3); }
.nav-item.active { background: var(--accent-soft); color: var(--text); }
.nav-item.active::before {
  content: ''; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav-item .ico { width: 17px; height: 17px; flex: 0 0 17px; opacity: .9; }
.nav-item .count {
  margin-left: auto; font-size: 10.5px; font-weight: 700; padding: 1px 6px;
  border-radius: 20px; background: var(--red-soft); color: var(--red);
}
.nav-item .tag {
  margin-left: auto; font-size: 9px; font-weight: 800; letter-spacing: .06em;
  padding: 2px 5px; border-radius: 5px; background: var(--violet-soft); color: var(--violet);
}

.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.org-card {
  display: flex; align-items: center; gap: 9px; padding: 8px;
  border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line);
}
.org-avatar {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent-soft);
  color: var(--accent); display: grid; place-items: center; font-weight: 800; font-size: 12px;
}
.org-name { font-size: 12px; font-weight: 700; line-height: 1.2; }
.org-meta { font-size: 10px; color: var(--muted); }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 60px; flex: 0 0 60px;
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(14px);
  position: sticky; top: 0; z-index: 30;
}
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.breadcrumb strong { color: var(--text); font-weight: 650; }

.search {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 0 10px; height: 34px; width: 280px;
  color: var(--muted); font-size: 12.5px;
}
.search input {
  border: 0; background: transparent; color: var(--text); outline: none;
  font-size: 12.5px; width: 100%; font-family: inherit;
}
.search kbd {
  font-family: var(--mono); font-size: 9.5px; padding: 2px 5px; border-radius: 4px;
  border: 1px solid var(--line-strong); color: var(--muted);
}

.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text-2);
  display: grid; place-items: center; position: relative; transition: .16s;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); background: var(--surface-3); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn .dot {
  position: absolute; top: 7px; right: 8px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px var(--surface-2);
}

.user-chip {
  display: flex; align-items: center; gap: 8px; padding: 3px 9px 3px 3px;
  border-radius: 30px; border: 1px solid var(--line); background: var(--surface-2);
  cursor: pointer;
}
.user-avatar {
  width: 27px; height: 27px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(140deg, #4C7DFF, #9B7BFF); color: #fff;
  font-size: 11px; font-weight: 800;
}
.user-chip .nm { font-size: 12px; font-weight: 650; line-height: 1.15; }
.user-chip .rl { font-size: 9.5px; color: var(--muted); }

.content { padding: 22px 26px 60px; max-width: 1560px; width: 100%; margin: 0 auto; }

/* ============================================================
   TYPO / UTILS
   ============================================================ */
h1, h2, h3, h4 { margin: 0; letter-spacing: -.02em; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title { font-size: 23px; font-weight: 780; letter-spacing: -.035em; line-height: 1.15; }
.page-sub { color: var(--muted); font-size: 12.8px; margin-top: 5px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 13px; border-radius: 9px;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text);
  font-size: 12.6px; font-weight: 620; transition: .15s; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: var(--line-strong); }
.btn svg { width: 14px; height: 14px; }
.btn-primary {
  background: linear-gradient(180deg, #5A88FF, #3C6BF0);
  border-color: rgba(255,255,255,.16); color: #fff;
  box-shadow: 0 8px 20px -10px rgba(76,125,255,.95), inset 0 1px 0 rgba(255,255,255,.22);
}
.btn-primary:hover { background: linear-gradient(180deg, #6A94FF, #4A76F5); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { height: 28px; padding: 0 9px; font-size: 11.5px; border-radius: 7px; }
.btn-danger { background: var(--red-soft); border-color: rgba(242,85,90,.28); color: var(--red); }
.btn-ai {
  background: linear-gradient(120deg, rgba(76,125,255,.22), rgba(155,123,255,.22));
  border-color: rgba(123,123,355,.35); color: #B9C9FF;
}
[data-theme='light'] .btn-ai { color: #3B4C8F; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.6px; font-weight: 700; letter-spacing: .02em;
  padding: 3px 8px; border-radius: 20px; border: 1px solid transparent; white-space: nowrap;
}
.chip .bullet { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.chip-red { background: var(--red-soft); color: var(--red); border-color: rgba(242,85,90,.22); }
.chip-amber { background: var(--amber-soft); color: var(--amber); border-color: rgba(245,165,36,.22); }
.chip-green { background: var(--green-soft); color: var(--green); border-color: rgba(34,211,166,.22); }
.chip-blue { background: var(--accent-soft); color: var(--accent); border-color: rgba(76,125,255,.24); }
.chip-violet { background: var(--violet-soft); color: var(--violet); border-color: rgba(155,123,255,.24); }
.chip-grey { background: var(--surface-3); color: var(--text-2); border-color: var(--line); }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.tiny { font-size: 10.5px; }
.sm { font-size: 12px; }
.strong { font-weight: 700; }
.right { margin-left: auto; }
.flex { display: flex; align-items: center; gap: 10px; }
.grid { display: grid; gap: 14px; }

/* ============================================================
   KPI
   ============================================================ */
.kpi-row { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 12px; margin-bottom: 16px; }
.kpi-row-2 { grid-template-columns: repeat(2, minmax(0,1fr)); max-width: 720px; }
.kpi {
  position: relative; overflow: hidden; padding: 15px 15px 13px;
  border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.kpi::after {
  content: ''; position: absolute; inset: 0 0 auto auto; width: 120px; height: 120px;
  border-radius: 50%; filter: blur(38px); opacity: .30; transform: translate(34%, -46%);
  background: var(--kpi-glow, var(--accent));
}
.kpi-label { font-size: 10.6px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 25px; font-weight: 790; letter-spacing: -.045em; margin-top: 7px; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.kpi-foot { display: flex; align-items: center; gap: 6px; margin-top: 9px; font-size: 11px; color: var(--muted); }
.delta { font-weight: 750; display: inline-flex; align-items: center; gap: 3px; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }
.spark { display: flex; align-items: flex-end; gap: 2px; height: 22px; margin-top: 10px; }
.spark i { flex: 1; border-radius: 2px 2px 0 0; background: var(--kpi-glow, var(--accent)); opacity: .55; }
.spark i:last-child { opacity: 1; }

/* ============================================================
   DASHBOARD GRID
   ============================================================ */
.dash { display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 17px; border-bottom: 1px solid var(--line);
}
.panel-title { font-size: 13.6px; font-weight: 720; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.panel-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.panel-body { padding: 16px 17px; }

/* ============================================================
   COPILOTE IA
   ============================================================ */
.copilot {
  position: relative;
  border-radius: var(--radius);
  padding: 1px;
  background: linear-gradient(140deg, rgba(76,125,255,.55), rgba(155,123,255,.30) 42%, rgba(34,211,166,.42));
  box-shadow: 0 22px 60px -30px rgba(76,125,255,.75);
}
.copilot-inner {
  border-radius: calc(var(--radius) - 1px);
  background: linear-gradient(170deg, #101B34 0%, var(--surface) 46%);
  overflow: hidden;
}
[data-theme='light'] .copilot-inner { background: linear-gradient(170deg, #F2F5FF, #fff 46%); }

.copilot-head {
  display: flex; align-items: center; gap: 12px; padding: 15px 17px 13px;
  border-bottom: 1px solid var(--line);
}
.ai-orb {
  width: 36px; height: 36px; flex: 0 0 36px; border-radius: 11px; position: relative;
  background: radial-gradient(circle at 32% 26%, #9BC1FF, #4C7DFF 42%, #6B3BF5 88%);
  display: grid; place-items: center;
  box-shadow: 0 0 0 1px rgba(255,255,255,.18), 0 10px 26px -10px rgba(107,59,245,.95);
}
.ai-orb svg { width: 18px; height: 18px; color: #fff; }
.ai-orb::after {
  content: ''; position: absolute; inset: -4px; border-radius: 15px;
  border: 1px solid rgba(76,125,255,.35); animation: pulse 2.6s ease-out infinite;
}
@keyframes pulse { 0% { opacity: .8; transform: scale(.94); } 70%,100% { opacity: 0; transform: scale(1.14); } }

.copilot-title { font-size: 14px; font-weight: 760; letter-spacing: -.02em; display: flex; align-items: center; gap: 7px; }
.ai-badge {
  font-size: 8.8px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 4px; background: linear-gradient(120deg, rgba(76,125,255,.3), rgba(155,123,255,.3));
  color: #C3D2FF; border: 1px solid rgba(123,123,255,.3);
}
[data-theme='light'] .ai-badge { color: #4A3FB0; }
.copilot-sub { font-size: 11.4px; color: var(--muted); margin-top: 1px; }

.scan-state { margin-left: auto; display: flex; align-items: center; gap: 7px; font-size: 10.8px; color: var(--muted); }
.scan-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(34,211,166,.16); animation: blink 2s infinite; }
@keyframes blink { 50% { opacity: .35; } }

.insight-list { display: flex; flex-direction: column; }

.insight {
  display: grid; grid-template-columns: 3px 1fr; gap: 0;
  border-bottom: 1px solid var(--line);
  transition: background .16s;
}
.insight:last-child { border-bottom: 0; }
.insight:hover { background: rgba(255,255,255,.017); }
[data-theme='light'] .insight:hover { background: #FAFBFF; }
.insight-rail { background: var(--muted); opacity: .35; }
.insight.sev-critique .insight-rail { background: var(--red); opacity: 1; }
.insight.sev-haute .insight-rail { background: var(--amber); opacity: 1; }
.insight.sev-moyenne .insight-rail { background: var(--accent); opacity: 1; }
.insight-inner { padding: 13px 16px 14px; min-width: 0; }

.insight-top { display: flex; align-items: flex-start; gap: 10px; }
.insight-ref {
  font-family: var(--mono); font-size: 9.5px; color: var(--muted);
  padding: 2px 5px; border: 1px solid var(--line); border-radius: 5px; flex: 0 0 auto; margin-top: 1px;
}
.insight-title { font-size: 13.2px; font-weight: 700; letter-spacing: -.012em; line-height: 1.32; }
.insight-sum { font-size: 12.1px; color: var(--text-2); margin-top: 5px; line-height: 1.48; }
.insight-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 9px; }

.impact {
  display: inline-flex; align-items: center; gap: 4px; font-size: 10.6px; font-weight: 700;
  padding: 2px 7px; border-radius: 6px; background: var(--surface-3); color: var(--text-2);
  border: 1px solid var(--line);
}
.impact.money { color: var(--amber); background: var(--amber-soft); border-color: rgba(245,165,36,.2); }
.impact.days { color: var(--red); background: var(--red-soft); border-color: rgba(242,85,90,.2); }
.impact.ok { color: var(--green); background: var(--green-soft); border-color: rgba(34,211,166,.2); }

.insight-actions { display: flex; align-items: center; gap: 7px; margin-top: 11px; flex-wrap: wrap; }
.insight-signals {
  margin-top: 10px; padding: 9px 11px; border-radius: 9px;
  background: var(--surface-2); border: 1px dashed var(--line-strong);
  font-size: 11.2px; color: var(--text-2); display: none;
}
.insight-signals.open { display: block; }
.insight-signals .sig-h { font-size: 9.6px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 750; margin-bottom: 5px; }
.insight-signals ul { margin: 0; padding-left: 15px; }
.insight-signals li { margin: 2px 0; }
.insight-signals li::marker { color: var(--accent); }

.insight.done { opacity: .48; }
.insight.done .insight-title { text-decoration: line-through; text-decoration-thickness: 1px; }

.copilot-foot {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px;
  border-top: 1px solid var(--line); background: rgba(76,125,255,.045);
  font-size: 11.2px; color: var(--muted);
}

/* ============================================================
   TABLES
   ============================================================ */
.table { width: 100%; border-collapse: collapse; font-size: 12.4px; }
.table th {
  text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-weight: 750; padding: 9px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: rgba(255,255,255,.02); }
[data-theme='light'] .table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 11.6px; }

/* ---------- Progress ---------- */
.bar { height: 6px; border-radius: 20px; background: var(--surface-3); overflow: hidden; position: relative; }
.bar > span { display: block; height: 100%; border-radius: 20px; background: linear-gradient(90deg, #4C7DFF, #22D3A6); }
.bar.warn > span { background: linear-gradient(90deg, #F5A524, #F2555A); }
.bar-row { display: flex; align-items: center; gap: 8px; }
.bar-row .bar { flex: 1; min-width: 54px; }
.bar-row .pct { font-size: 10.6px; font-weight: 750; color: var(--text-2); font-family: var(--mono); width: 32px; text-align: right; }

/* ============================================================
   GANTT
   ============================================================ */
.gantt { padding: 4px 0 2px; }
.gantt-row { display: grid; grid-template-columns: 168px 1fr; align-items: center; gap: 10px; padding: 5px 0; }
.gantt-name { font-size: 11.4px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt-track { position: relative; height: 16px; border-radius: 5px; background: repeating-linear-gradient(90deg, transparent, transparent calc(20% - 1px), var(--line) calc(20% - 1px), var(--line) 20%); }
.gantt-bar {
  position: absolute; top: 3px; height: 10px; border-radius: 4px;
  background: var(--accent); box-shadow: 0 0 12px -2px currentColor;
}
.gantt-legend { display: flex; gap: 14px; font-size: 10.6px; color: var(--muted); padding: 10px 0 0; flex-wrap: wrap; }
.gantt-legend i { width: 8px; height: 8px; border-radius: 3px; display: inline-block; margin-right: 5px; }

/* ============================================================
   DONUT / CHART
   ============================================================ */
.donut-wrap { display: flex; align-items: center; gap: 14px; }
.donut-legend { display: flex; flex-direction: column; gap: 7px; font-size: 11.4px; }
.donut-legend .lg { display: flex; align-items: center; gap: 7px; color: var(--text-2); }
.donut-legend i { width: 8px; height: 8px; border-radius: 2px; }
.donut-legend b { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--text); }

/* ============================================================
   DEADLINES / TIMELINE
   ============================================================ */
.tl { display: flex; flex-direction: column; }
.tl-item { display: grid; grid-template-columns: 46px 1fr; gap: 11px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.tl-item:last-child { border-bottom: 0; }
.tl-date { text-align: center; }
.tl-date .d { font-size: 15px; font-weight: 780; line-height: 1; font-variant-numeric: tabular-nums; }
.tl-date .m { font-size: 9px; text-transform: uppercase; color: var(--muted); letter-spacing: .08em; font-weight: 700; }
.tl-body { min-width: 0; }
.tl-title { font-size: 12.2px; font-weight: 620; line-height: 1.35; }
.tl-meta { font-size: 10.8px; color: var(--muted); margin-top: 3px; display: flex; align-items: center; gap: 6px; }
.tl-item.late .tl-date .d { color: var(--red); }

/* ============================================================
   MODAL / TOAST
   ============================================================ */
.overlay {
  position: fixed; inset: 0; background: rgba(3,7,18,.72); backdrop-filter: blur(6px);
  display: none; place-items: center; z-index: 100; padding: 24px;
}
.overlay.open { display: grid; }
.modal {
  width: min(720px, 100%); max-height: 88vh; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 18px; box-shadow: 0 40px 100px -30px #000;
  display: flex; flex-direction: column; animation: pop .2s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.modal-title { font-size: 14.5px; font-weight: 740; }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 13px 18px; border-top: 1px solid var(--line); background: var(--surface-2); }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 10.6px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 750; margin-bottom: 5px; }
.input, .textarea {
  width: 100%; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 9px; padding: 9px 11px; color: var(--text); font-family: inherit; font-size: 12.6px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus { border-color: rgba(76,125,255,.55); box-shadow: 0 0 0 3px rgba(76,125,255,.14); }
.textarea { resize: vertical; min-height: 190px; line-height: 1.6; font-size: 12.8px; }
.ai-note {
  display: flex; gap: 9px; padding: 10px 12px; border-radius: 10px;
  background: var(--accent-soft); border: 1px solid rgba(76,125,255,.22);
  font-size: 11.5px; color: var(--text-2); margin-bottom: 13px; line-height: 1.5;
}

.toast-wrap { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 9px; z-index: 200; }
.toast {
  display: flex; align-items: flex-start; gap: 10px; min-width: 290px; max-width: 380px;
  padding: 12px 14px; border-radius: 12px; background: var(--surface-2);
  border: 1px solid var(--line-strong); box-shadow: 0 20px 50px -20px #000;
  animation: slideIn .24s ease-out;
}
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } }
.toast .ti { width: 18px; height: 18px; flex: 0 0 18px; margin-top: 1px; }
.toast.ok .ti { color: var(--green); }
.toast.err .ti { color: var(--red); }
.toast .tt { font-size: 12.4px; font-weight: 700; }
.toast .ts { font-size: 11.2px; color: var(--muted); margin-top: 2px; }

/* ============================================================
   MISC / PAGES SECONDAIRES
   ============================================================ */
.hero-strip {
  display: flex; align-items: center; gap: 18px; padding: 16px 18px; margin-bottom: 14px;
  border-radius: var(--radius); border: 1px solid var(--line);
  background: linear-gradient(100deg, rgba(76,125,255,.10), transparent 60%), var(--surface);
}
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.stat-line { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 12.2px; }
.stat-line:last-child { border-bottom: 0; }
.stat-line b { font-family: var(--mono); font-size: 12px; }

.mini-note { font-size: 11px; color: var(--muted); line-height: 1.5; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }

.pill-filter { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  font-size: 11.4px; font-weight: 620; padding: 5px 11px; border-radius: 20px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2);
}
.pill.active { background: var(--accent-soft); border-color: rgba(76,125,255,.35); color: var(--accent); }

.empty { padding: 30px; text-align: center; color: var(--muted); font-size: 12.4px; }

/* terrain / PWA */
.offline-banner {
  display: none; align-items: center; gap: 8px; padding: 8px 14px;
  background: var(--amber-soft); border: 1px solid rgba(245,165,36,.3);
  color: var(--amber); font-size: 11.6px; font-weight: 650; border-radius: 9px; margin-bottom: 12px;
}
body.is-offline .offline-banner { display: flex; }
.touch-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.touch-btn {
  min-height: 86px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); display: flex; flex-direction: column;
  align-items: flex-start; justify-content: center; gap: 5px; padding: 13px; font-weight: 650; font-size: 12.6px;
}
.touch-btn svg { width: 20px; height: 20px; color: var(--accent); }
.touch-btn:active { transform: scale(.985); }

@media (max-width: 1280px) {
  .kpi-row { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .dash { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-102%);
    transition: transform .22s ease; box-shadow: 20px 0 60px rgba(0,0,0,.6);
  }
  .sidebar.open { transform: none; }
  .content { padding: 16px 14px 70px; }
  .kpi-row { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .search { display: none; }
  .page-title { font-size: 20px; }
  .topbar { padding: 0 14px; }
}
@media (max-width: 560px) {
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .kpi-value { font-size: 21px; }
  .gantt-row { grid-template-columns: 108px 1fr; }
}

/* ============================================================
   MATRICE DE SUIVI (portage SuiviChantier v4 / Excel I LIGHT)
   ============================================================ */
.mx-kpis {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px; margin-bottom: 14px;
}
.mx-bats {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 11px 14px; margin-bottom: 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface);
}
.mx-bats-title {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.4px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted);
}
.mx-bats-list { display: flex; gap: 6px; flex-wrap: wrap; }
.mx-bats-add, .mx-bats form { display: flex; gap: 6px; align-items: center; }
.mx-bats-add .input, .mx-bats form .input { height: 30px; font-size: 11.6px; min-width: 96px; }
.mx-bats form { margin-left: auto; }

.mx-block {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); overflow: hidden; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.mx-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--mx-accent) 16%, transparent), transparent 65%);
  border-bottom: 1px solid var(--line);
  border-left: 3px solid var(--mx-accent);
}
.mx-title {
  font-size: 12.4px; font-weight: 780; letter-spacing: .075em; text-transform: uppercase;
  color: var(--text);
}
.mx-sub { font-size: 11.2px; color: var(--muted); margin-top: 3px; }

.mx-scroll { overflow-x: auto; }
.mx-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 11.6px; }
.mx-table th {
  font-weight: 680; color: var(--text-2);
  border-bottom: 1px solid var(--line); border-right: 1px solid var(--line);
  padding: 6px 4px; background: var(--surface-2);
}
.mx-corner {
  text-align: left; padding: 8px 12px !important; min-width: 232px;
  position: sticky; left: 0; z-index: 3;
  background: var(--surface-2) !important;
}
.mx-corner-eche { min-width: 92px; left: 232px; z-index: 3; }
.mx-corner-act { min-width: 34px; font-size: 10px; }
.mx-bat {
  text-align: center; font-size: 11px; letter-spacing: .05em;
  background: color-mix(in srgb, var(--mx-accent) 12%, var(--surface-2)) !important;
  color: var(--text);
  padding: 6px 4px !important;
  border-left: 2px solid color-mix(in srgb, var(--mx-accent) 32%, transparent);
}
.mx-subhead { min-width: 34px; padding: 2px !important; }
.mx-vertical {
  display: inline-block; writing-mode: vertical-rl; transform: rotate(180deg);
  font-size: 9.6px; font-weight: 700; letter-spacing: .045em; padding: 5px 1px;
  white-space: nowrap;
}
.mx-vertical.mx-amber { color: var(--amber); }
.mx-vertical.mx-green { color: var(--green); }
.mx-vertical.mx-red { color: var(--red); }
.mx-vertical.mx-blue { color: var(--accent); }

.mx-table td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.mx-table tbody tr:hover td { background: rgba(255,255,255,.022); }
[data-theme='light'] .mx-table tbody tr:hover td { background: #F7F9FE; }

.mx-label {
  position: sticky; left: 0; z-index: 2;
  background: var(--surface); padding: 7px 12px;
  font-size: 11.4px; font-weight: 600; color: var(--text);
  max-width: 232px; min-width: 232px;
}
.mx-label span { display: inline; }
.mx-custom { color: var(--violet); font-style: italic; }
.mx-tag {
  display: inline-block; margin-left: 6px; padding: 1px 5px; border-radius: 4px;
  font-size: 8.6px; font-style: normal; font-weight: 700; text-transform: uppercase;
  background: var(--violet-soft); color: var(--violet); border: 1px solid rgba(155,123,255,.28);
}

.mx-echeance {
  padding: 2px 4px; text-align: center; position: sticky; left: 232px; z-index: 2;
  background: var(--surface);
}
.mx-echeance.mx-late { background: var(--red-soft); }
.mx-echeance.mx-soon { background: var(--amber-soft); }
.mx-echeance.mx-ok { background: var(--surface-2); }
.mx-date {
  width: 92px; border: 0; background: transparent; color: var(--text-2);
  font-family: var(--mono); font-size: 10.2px; text-align: center; padding: 3px 0;
  outline: none;
}
.mx-date::-webkit-calendar-picker-indicator { opacity: .35; cursor: pointer; }
.mx-date:focus { background: var(--surface-3); border-radius: 4px; }

.mx-cell {
  text-align: center; cursor: pointer; padding: 0;
  height: 30px; min-width: 34px; color: transparent;
  font-size: 12px; font-weight: 800; user-select: none;
  transition: background .12s ease, color .12s ease;
}
.mx-cell:hover { background: var(--surface-3); }
.mx-cell.mx-on { color: #06111F; }
.mx-amber { background: var(--amber); color: #1B1200 !important; }
.mx-green { background: var(--green); color: #04140F !important; }
.mx-blue  { background: #6FA8FF; color: #05122B !important; }
.mx-red   { background: var(--red); color: #FFF !important; }
[data-theme='field'] .mx-cell { height: 40px; min-width: 40px; font-size: 15px; }

.mx-act { width: 34px; text-align: center; padding: 0; }
.mx-del {
  width: 20px; height: 20px; border-radius: 5px; border: 1px solid transparent;
  background: transparent; color: var(--muted); display: inline-grid; place-items: center;
}
.mx-del:hover { background: var(--red-soft); border-color: rgba(242,85,90,.3); color: var(--red); }
.mx-empty { padding: 26px; text-align: center; color: var(--muted); font-size: 11.8px; }

.mx-add {
  display: flex; gap: 8px; padding: 11px 14px; align-items: center;
  border-top: 1px solid var(--line); background: var(--surface-2);
}
.mx-add .input { height: 32px; font-size: 11.8px; flex: 1; }
.mx-add-date { max-width: 140px; flex: 0 0 140px !important; }

.mx-legend {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 10px 14px; border: 1px dashed var(--line); border-radius: var(--radius-sm);
  font-size: 10.8px; color: var(--muted); margin-bottom: 14px;
}
.mx-legend strong { color: var(--text-2); font-size: 10.4px; text-transform: uppercase; letter-spacing: .07em; }
.mx-chip {
  padding: 2px 8px; border-radius: 5px; font-weight: 700; font-size: 10.2px;
  border: 1px solid transparent;
}
.mx-chip.mx-amber { background: var(--amber); color: #1B1200; }
.mx-chip.mx-green { background: var(--green); color: #04140F; }
.mx-chip.mx-blue  { background: #6FA8FF; color: #05122B; }
.mx-chip.mx-red   { background: var(--red); color: #FFF; }
.mx-chip.mx-late  { background: var(--red-soft); color: var(--red); border-color: rgba(242,85,90,.3); }
.mx-chip.mx-soon  { background: var(--amber-soft); color: var(--amber); border-color: rgba(245,165,36,.3); }
.mx-sep { width: 1px; height: 14px; background: var(--line-strong); }

.mx-rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.mx-rules div { display: flex; flex-direction: column; gap: 5px; }
.mx-rules b { font-size: 11.6px; color: var(--text); }
.mx-rules span { font-size: 11.4px; color: var(--muted); line-height: 1.55; }

/* Matrice dans la fiche chantier / dashboard */
.mx-mini { display: flex; gap: 14px; align-items: center; }
.mx-mini-col { flex: 1; min-width: 0; }
.mx-mini-lbl { display: flex; justify-content: space-between; font-size: 10.6px; color: var(--muted); margin-bottom: 4px; }
.mx-mini-lbl b { font-family: var(--mono); color: var(--text-2); }

@media (max-width: 1280px) {
  .mx-kpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 900px) {
  .mx-corner { min-width: 150px; }
  .mx-label { min-width: 150px; max-width: 150px; font-size: 10.6px; }
  .mx-corner-eche { left: 150px; min-width: 78px; }
  .mx-echeance { left: 150px; }
  .mx-date { width: 78px; font-size: 9.4px; }
  .mx-kpis { grid-template-columns: 1fr 1fr; }
  .mx-bats form { margin-left: 0; }
}

/* Vue d'ensemble des matrices */
.mx-index {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.mx-card {
  display: flex; flex-direction: column; gap: 11px;
  padding: 15px 16px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface);
  color: inherit; text-decoration: none;
  transition: border-color .14s ease, transform .14s ease, background .14s ease;
}
.mx-card:hover {
  border-color: rgba(76,125,255,.42); background: var(--surface-2); transform: translateY(-1px);
}
.mx-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.mx-card-title { font-size: 13px; font-weight: 680; letter-spacing: -.01em; line-height: 1.3; }
.mx-card-meta { display: flex; gap: 5px; flex-wrap: wrap; }
.mx-card-meta .chip { display: inline-flex; align-items: center; gap: 3px; font-size: 9.6px; }
.mx-card-bars { display: flex; flex-direction: column; gap: 8px; }
.mx-card-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 9px; border-top: 1px dashed var(--line);
}
.mx-card-link {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.2px; font-weight: 680; color: var(--accent);
}

/* ------------------------------------------------------------
   Onglets de fiche (chantier detail : Matrice / Suivi)
   ------------------------------------------------------------ */
.tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin: 4px 0 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 13px;
  font-size: 12.4px;
  font-weight: 620;
  color: var(--muted);
  white-space: nowrap;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: color .15s ease, background .15s ease;
}
.tab:hover { color: var(--text-2); background: var(--surface-2); }
.tab.active { color: var(--text); background: var(--surface-2); }
.tab.active::after {
  content: '';
  position: absolute;
  left: 8px; right: 8px; bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.tab svg { opacity: .8; }
.tab.active svg { opacity: 1; color: var(--accent); }
.tab-link { margin-left: auto; color: var(--accent); }
.tab-link:hover { color: var(--accent); background: var(--accent-soft); }

[data-theme='field'] .tab { padding: 13px 16px; font-size: 14px; }

/* ------------------------------------------------------------
   Barre de tri des échéances (matrice)
   ------------------------------------------------------------ */
.mx-tri {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 9px 12px;
  margin: 12px 0 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.mx-tri-lbl {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.2px;
  font-weight: 680;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 2px;
}
.mx-tri-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  font-size: 11.8px;
  font-weight: 620;
  color: var(--text-2);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  transition: background .14s ease, color .14s ease, border-color .14s ease;
}
.mx-tri-btn:hover { color: var(--text); border-color: var(--accent); }
.mx-tri-btn.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
[data-theme='light'] .mx-tri-btn.active { color: #fff; }
.mx-tri-note { margin-left: auto; }

[data-theme='field'] .mx-tri { padding: 12px 14px; }
[data-theme='field'] .mx-tri-btn { padding: 10px 14px; font-size: 13.4px; }

@media (max-width: 640px) {
  .mx-tri-note { margin-left: 0; width: 100%; }
}

/* ------------------------------------------------------------
   Chiffrage Appel d'offre — planning de production (Gantt)
   ------------------------------------------------------------ */
.ao-gantt { --ao-name-w: 210px; padding: 2px 0 0; }

.ao-gantt-head {
  display: grid;
  grid-template-columns: var(--ao-name-w) 1fr;
  gap: 10px;
  align-items: end;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}
.ao-gantt-corner {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.ao-gantt-scale { display: flex; }
.ao-week-lbl {
  flex: 1;
  font-size: 9.4px;
  font-family: var(--mono);
  color: var(--muted);
  border-left: 1px solid var(--line);
  padding-left: 4px;
  white-space: nowrap;
  overflow: hidden;
}

.ao-gantt-body { position: relative; }
.ao-today-line {
  position: absolute;
  top: 0; bottom: 14px;
  width: 1px;
  background: var(--red);
  opacity: .6;
  z-index: 2;
  pointer-events: none;
}
.ao-today-lbl {
  position: absolute;
  top: -2px; left: 3px;
  font-size: 8.6px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--red);
  white-space: nowrap;
}

.ao-gantt-group {
  padding: 7px 0 9px;
  border-bottom: 1px dashed var(--line);
}
.ao-gantt-group:last-child { border-bottom: 0; }

.ao-gantt-row {
  display: grid;
  grid-template-columns: var(--ao-name-w) 1fr;
  gap: 10px;
  align-items: center;
  padding: 2.5px 0;
}
.ao-gantt-row-head { padding-bottom: 4px; }

.ao-gantt-name {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  font-size: 11.6px;
  overflow: hidden;
}
.ao-name-obj {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
  color: var(--text);
}
.ao-gantt-name-etape {
  padding-left: 10px;
  font-size: 10.8px;
  color: var(--text-2);
}
.ao-gantt-name-etape span:first-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ao-etape-h { margin-left: auto; color: var(--muted); font-size: 9.4px; flex: 0 0 auto; }

.ao-gantt-track {
  position: relative;
  height: 15px;
  border-radius: 5px;
  background: repeating-linear-gradient(90deg, transparent, transparent calc(14.28% - 1px), var(--line) calc(14.28% - 1px), var(--line) 14.28%);
}
.ao-gantt-track-head { background: transparent; height: 16px; display: flex; align-items: center; }
.ao-jauge-lbl { font-size: 10px; font-weight: 650; }

.ao-gantt-bar {
  position: absolute;
  top: 3px;
  height: 9px;
  border-radius: 4px;
  overflow: hidden;
  min-width: 4px;
}
.ao-gantt-fill {
  display: block;
  height: 100%;
  background: rgba(255, 255, 255, .55);
}

.ao-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 11px 0 0;
  font-size: 10.6px;
  color: var(--muted);
}
.ao-legend i { width: 8px; height: 8px; border-radius: 3px; display: inline-block; margin-right: 5px; }
.ao-sep { width: 1px; height: 12px; background: var(--line-strong); }

/* Charge par chiffreur */
.ao-charge { display: flex; flex-direction: column; gap: 3px; }
.ao-charge-row {
  display: grid;
  grid-template-columns: 1fr repeat(6, minmax(0, 34px)) 52px;
  gap: 3px;
  align-items: center;
}
.ao-charge-head { margin-bottom: 3px; }
.ao-charge-wk {
  font-size: 8.8px;
  font-family: var(--mono);
  color: var(--muted);
  text-align: center;
}
.ao-charge-name {
  font-size: 11.2px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ao-charge-cell {
  height: 22px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  font-size: 9.6px;
  font-family: var(--mono);
  font-weight: 700;
  color: #fff;
}
[data-theme='light'] .ao-charge-cell { color: #0D1730; }
.ao-charge-tot { font-size: 10.6px; text-align: right; font-weight: 700; }
.ao-charge-head .ao-charge-tot {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  font-weight: 700;
}

/* Modèle d'étapes */
.ao-modele-row {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px dashed var(--line);
}
.ao-modele-row:last-of-type { border-bottom: 0; }
.ao-modele-num { font-size: 9.6px; color: var(--muted); }
.ao-modele-lbl { font-size: 11.6px; font-weight: 600; display: flex; align-items: center; }
.ao-modele-part { font-size: 10.4px; color: var(--accent); }

/* Formulaires */
.ao-statut-form { display: flex; gap: 4px; align-items: center; }
.ao-select { height: 28px; font-size: 11px; padding: 0 6px; min-width: 118px; }

.ao-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.ao-form-grid label { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ao-form-grid label > span {
  font-size: 10.2px;
  font-weight: 650;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--muted);
}
.ao-form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 13px;
  flex-wrap: wrap;
}

/* Bandeau d'archive */
.archive-banner {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 13px 15px;
  margin-bottom: 14px;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-2);
}
.archive-banner b { display: block; font-size: 12.4px; color: var(--text); margin-bottom: 3px; }
.archive-banner span { font-size: 11.6px; line-height: 1.5; }

@media (max-width: 1100px) {
  .ao-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .ao-gantt { --ao-name-w: 124px; }
  .ao-gantt-name-etape { font-size: 9.6px; }
  .ao-etape-h { display: none; }
  .ao-charge-row { grid-template-columns: 1fr repeat(3, minmax(0, 30px)) 46px; }
  .ao-charge-row > .ao-charge-cell:nth-child(n + 5):not(.ao-charge-tot) { display: none; }
}

@media (max-width: 620px) {
  .ao-form-grid { grid-template-columns: 1fr; }
  .ao-gantt { --ao-name-w: 92px; }
}

/* ============================================================
   Board de production — Études & Appels d'offre (modèle Notion)
   ============================================================ */
.pl-filters {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
  margin: 4px 0 12px;
}
.pl-filters .pill-filter:last-child { margin-left: auto; }
.pl-count {
  display: inline-block; min-width: 16px; padding: 0 5px; margin-left: 3px;
  border-radius: 20px; background: var(--surface-3); color: var(--muted);
  font-size: 9.6px; font-weight: 700; text-align: center;
}
.pill.active .pl-count { background: rgba(76,125,255,.22); color: var(--accent); }

.pl-board { overflow: hidden; }
.pl-table { min-width: 1080px; }
.pl-table th {
  font-size: 9.8px; text-transform: uppercase; letter-spacing: .055em;
  color: var(--muted); font-weight: 700; padding: 9px 12px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.pl-th-nom { width: 32%; min-width: 300px; }

/* en-tête de groupe */
.pl-group { border-top: 1px solid var(--line); }
.pl-group-head td {
  padding: 7px 12px !important;
  background: var(--surface-2);
  position: sticky; top: 0; z-index: 2;
}
.pl-group-inner { display: flex; align-items: center; gap: 7px; }
.pl-group-inner .ti { color: var(--muted); }
.pl-group-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.pl-group-name { font-size: 11.4px; font-weight: 700; }
.pl-group-n {
  font-size: 9.6px; font-weight: 700; color: var(--muted);
  background: var(--surface-3); border-radius: 20px; padding: 1px 6px;
}

/* lignes */
.pl-row td {
  padding: 9px 12px; border-bottom: 1px solid var(--line);
  vertical-align: middle; font-size: 12px;
}
.pl-row:hover td { background: rgba(255,255,255,.022); }
[data-theme='light'] .pl-row:hover td { background: rgba(16,30,60,.018); }

.pl-td-nom { max-width: 380px; }
.pl-nom { display: flex; align-items: flex-start; gap: 6px; font-weight: 600; line-height: 1.35; }
.pl-folder { color: var(--muted); flex: 0 0 auto; margin-top: 2px; }
.pl-link { margin-top: 2px; }

.pl-prop { display: inline-flex; align-items: center; gap: 5px; font-size: 11.2px; font-weight: 650; white-space: nowrap; }
.pl-dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; }

/* équipe */
.pl-team-wrap { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pl-team { display: flex; gap: 3px; }
.pl-av-form { display: inline; }
.pl-av {
  width: 21px; height: 21px; border-radius: 50%; border: 1px solid var(--line-strong);
  background: var(--surface-3); color: var(--text-2);
  font-size: 8.4px; font-weight: 700; letter-spacing: .02em;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0;
}
.pl-av:hover { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.pl-av-lg {
  width: 28px; height: 28px; font-size: 10px; cursor: default;
  background: var(--accent-soft); border-color: rgba(76,125,255,.3); color: var(--accent);
}
.pl-av-lg:hover { background: var(--accent-soft); border-color: rgba(76,125,255,.3); color: var(--accent); }
.pl-add { display: inline; }

/* selects inline */
.pl-inline { display: inline; }
.pl-select {
  font-size: 10.8px; font-weight: 640; font-family: inherit;
  padding: 3px 5px; border-radius: 7px; max-width: 155px;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--text-2); cursor: pointer;
}
.pl-select:hover { border-color: var(--line-strong); }
.pl-select-sm { max-width: 34px; text-align: center; padding: 3px 2px; }
.pl-select-sm:focus { max-width: 150px; text-align: left; }

/* dead line */
.pl-deadline { display: flex; align-items: baseline; gap: 5px; white-space: nowrap; }
.pl-deadline .mono { font-size: 11px; }
.pl-j { font-size: 9.4px; font-weight: 700; }

.pl-cat { font-size: 9.2px; white-space: nowrap; }
.pl-date { white-space: nowrap; font-size: 10.4px; }

/* charge */
.pl-charge { display: flex; flex-direction: column; gap: 10px; }
.pl-charge-row { display: flex; align-items: center; gap: 9px; }
.pl-charge-main { flex: 1; min-width: 0; }
.pl-charge-name {
  font-size: 11.6px; font-weight: 620; margin-bottom: 4px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.pl-tag-red {
  font-size: 8.8px; font-weight: 700; padding: 1px 5px; border-radius: 20px;
  background: var(--red-soft); color: var(--red);
}
.pl-charge-bar {
  height: 5px; border-radius: 20px; background: var(--surface-3); overflow: hidden;
}
.pl-charge-bar > span { display: block; height: 100%; border-radius: 20px; }
.pl-charge-n { font-size: 12px; font-weight: 700; color: var(--text-2); min-width: 20px; text-align: right; }

@media (max-width: 900px) {
  .pl-filters .pill-filter:last-child { margin-left: 0; }
  .pl-table { min-width: 900px; }
}

/* ============================================================
   AUTHENTIFICATION — connexion / première mise en service
   ============================================================ */
.auth-body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
.auth-body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none;
  background: var(--bg-grad);
}
.auth-wrap {
  position: relative; min-height: 100vh;
  display: grid; grid-template-columns: 1.05fr .95fr;
}
.auth-wrap-simple { grid-template-columns: 1fr; place-items: center; padding: 24px; }

/* Panneau de gauche (marque) */
.auth-aside {
  padding: 46px 48px; display: flex; flex-direction: column; justify-content: center;
  border-right: 1px solid var(--line); position: relative; overflow: hidden;
}
.auth-aside::after {
  content: ''; position: absolute; width: 520px; height: 520px; right: -180px; bottom: -220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(76,125,255,.20), transparent 68%);
}
.auth-mark {
  width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center;
  background: linear-gradient(140deg, #4C7DFF, #9B7BFF);
  box-shadow: 0 16px 40px -18px rgba(76,125,255,.95); margin-bottom: 20px;
}
.auth-mark svg { width: 27px; height: 27px; }
.auth-aside-title { font-size: 40px; font-weight: 800; letter-spacing: -.045em; margin: 0; }
.auth-aside-sub { color: var(--muted); font-size: 13.5px; margin: 6px 0 26px; }
.auth-aside-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 13px; max-width: 380px; }
.auth-aside-list li {
  display: flex; align-items: flex-start; gap: 10px; font-size: 12.8px; color: var(--text-2); line-height: 1.5;
}
.auth-aside-list li svg { color: var(--accent); flex: none; margin-top: 2px; }
.auth-aside-foot {
  margin-top: 34px; font-size: 10.6px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); font-weight: 700;
}

/* Panneau de droite (formulaire) */
.auth-panel { display: grid; place-items: center; padding: 40px 28px; }
.auth-card {
  width: 100%; max-width: 392px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: 28px 26px; box-shadow: var(--shadow);
}
.auth-head { margin-bottom: 18px; }
.auth-title { font-size: 21px; font-weight: 760; letter-spacing: -.025em; margin: 0 0 5px; }
.auth-desc { font-size: 12.4px; color: var(--muted); line-height: 1.55; margin: 0; }
.auth-card .field { margin-bottom: 13px; }
.auth-card .field label {
  display: block; font-size: 10.4px; text-transform: uppercase; letter-spacing: .085em;
  color: var(--muted); font-weight: 750; margin-bottom: 6px;
}
.auth-card .input { height: 40px; font-size: 13.2px; }
.auth-pw { position: relative; }
.auth-pw .input { padding-right: 40px; }
.auth-eye {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent;
  color: var(--muted); display: grid; place-items: center; cursor: pointer;
}
.auth-eye:hover { background: var(--surface-3); color: var(--text); }
.auth-check {
  display: flex; align-items: center; gap: 8px; margin: 4px 0 16px;
  font-size: 12.2px; color: var(--text-2); cursor: pointer;
}
.auth-check input { width: 15px; height: 15px; accent-color: #4C7DFF; cursor: pointer; }
.auth-submit { width: 100%; height: 42px; font-size: 13.4px; font-weight: 680; }
.auth-help, .auth-legal, .auth-hint {
  font-size: 11.4px; line-height: 1.6; color: var(--muted); margin: 16px 0 0;
}
.auth-hint { margin: 2px 0 16px; }
.auth-legal { border-top: 1px solid var(--line); padding-top: 14px; font-size: 10.8px; }
.auth-alert {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 10px 12px; border-radius: 10px; margin-bottom: 15px;
  background: var(--red-soft); border: 1px solid rgba(242,85,90,.28);
  color: var(--red); font-size: 12.2px; font-weight: 600; line-height: 1.45;
}
.auth-alert svg { flex: none; margin-top: 1px; }
.auth-alert-ok { background: var(--green-soft); border-color: rgba(34,211,166,.28); color: var(--green); }

/* Bouton de déconnexion dans la barre supérieure */
.logout-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px;
  border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text-2); font-size: 11.4px; font-weight: 620; cursor: pointer;
}
.logout-btn:hover { color: var(--red); border-color: rgba(242,85,90,.32); background: var(--red-soft); }
.logout-btn svg { width: 13px; height: 13px; }

@media (max-width: 900px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-panel { padding: 26px 18px; min-height: 100vh; align-content: center; }
}
