/* EDL DORIC — système visuel (repris de SEA DORIC) « console premium »
   Fond blanc, cartes à bord fin, un violet unique pour l'action, pastilles de tendance vert/rouge,
   orange réservé au budget. Police : Inter. */

:root {
  --bg: #F5F5F8;
  --card: #FFFFFF;
  --line: #ECECF1;
  --line-2: #E0E0E8;
  --ink: #1C1C24;
  --ink-2: #4A4A57;
  --muted: #8B8B99;
  --soft: #F6F6F9;

  --violet: #7357F6;
  --violet-600: #5F44E8;
  --violet-100: #EEEBFE;
  --violet-50: #F6F4FF;
  --violet-bar: #E4DEFD;

  --green: #1E9E61;  --green-bg: #E7F6EE;
  --red: #E0474C;    --red-bg: #FDEDEE;
  --amber: #C97A12;  --amber-bg: #FDF3E3;
  --orange: #F2894B;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --rail: 256px;
  --shadow: 0 1px 2px rgba(28, 28, 36, .04);
  --shadow-pop: 0 12px 40px rgba(28, 28, 36, .14);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
a { color: var(--violet); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 18px; height: 18px; flex: none; }

/* ============ Cadre ============ */

.app {
  display: grid; grid-template-columns: var(--rail) minmax(0, 1fr);
  min-height: 100vh; background: var(--card);
}
.app.collapsed { --rail: 76px; }

/* ---------- Barre latérale ---------- */

.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 18px;
  padding: 20px 16px; border-right: 1px solid var(--line); background: var(--card);
}
.side-head { display: flex; align-items: center; gap: 10px; padding: 2px 6px; }
.logo { width: 34px; height: 34px; flex: none; }
.brand-name { line-height: 1.2; min-width: 0; }
.brand-name b { display: block; font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.brand-name small { color: var(--muted); font-size: 12px; }
.collapse { margin-left: auto; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 6px; display: grid; place-items: center; }
.collapse:hover { background: var(--soft); color: var(--ink); }

.switcher {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--soft); color: var(--ink); cursor: pointer; text-align: left;
}
.switcher:hover { border-color: var(--line-2); background: #F1F1F6; }
.avatar {
  width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--violet), #9C86FF);
}
.avatar.dg { background: var(--ink); }
.avatar.lg { width: 38px; height: 38px; font-size: 13px; }
.switcher .txt { min-width: 0; flex: 1; }
.switcher .txt b { display: block; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switcher .txt small { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav button.navlink {
  position: relative; display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; border-radius: var(--r-sm); color: var(--ink-2); font-weight: 500;
  border: 0; background: none; width: 100%; text-align: left; cursor: pointer;
}
.nav a:hover { background: var(--soft); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--soft); color: var(--ink); font-weight: 600; }
.nav a[aria-current="page"]::before {
  content: ""; position: absolute; left: -16px; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: var(--violet);
}
.nav a[aria-current="page"] svg { color: var(--violet); }
.nav .count { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav .count.hot { color: #fff; background: var(--violet); border-radius: 99px; padding: 0 7px; font-weight: 600; }
.side-sep { height: 1px; background: var(--line); margin: 0 4px; }
.group-title {
  display: flex; align-items: center; gap: 8px; padding: 2px 10px; color: var(--muted); font-size: 13px; font-weight: 500;
}
.group-title .plus { margin-left: auto; display: flex; gap: 8px; }
.nav.sub a { padding-left: 14px; font-size: 13.5px; }

.budget-card { margin-top: auto; border: 1px solid var(--line); border-radius: var(--r); padding: 14px; background: var(--card); }
.budget-card .bc-top { display: flex; justify-content: space-between; font-weight: 600; font-size: 13px; }
.budget-card .bc-top span { color: var(--muted); font-weight: 500; font-size: 12px; }
.budget-card p { margin: 2px 0 10px; color: var(--muted); font-size: 12px; }
.ticks { height: 14px; border-radius: 3px; background: repeating-linear-gradient(90deg, var(--line-2) 0 2px, transparent 2px 5px); position: relative; overflow: hidden; }
.ticks i { position: absolute; inset: 0 auto 0 0; background: repeating-linear-gradient(90deg, var(--orange) 0 2px, transparent 2px 5px); }
.ticks.over i { background: repeating-linear-gradient(90deg, var(--red) 0 2px, transparent 2px 5px); }
.budget-card .btn { width: 100%; margin-top: 12px; justify-content: space-between; }
.side-foot { display: flex; flex-direction: column; gap: 2px; padding-top: 10px; border-top: 1px solid var(--line); }

.app.collapsed .brand-name, .app.collapsed .switcher .txt, .app.collapsed .switcher .chev,
.app.collapsed .nav .lbl, .app.collapsed .nav .count:not(.hot), .app.collapsed .group-title,
.app.collapsed .nav.sub, .app.collapsed .budget-card, .app.collapsed .side-foot .lbl, .app.collapsed .side-foot .chev { display: none; }
.app.collapsed .side-head { flex-direction: column; }
.app.collapsed .collapse { margin: 0; transform: rotate(180deg); }
.app.collapsed .nav a, .app.collapsed .side-foot a { justify-content: center; }
.app.collapsed .nav .count.hot { position: absolute; top: 2px; right: 6px; padding: 0 5px; font-size: 10px; }

/* ---------- En-tête ---------- */

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 28px;
  border-bottom: 1px solid var(--line); background: var(--card); position: sticky; top: 0; z-index: 6;
}
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--muted); min-width: 0; }
.crumbs b { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs svg { color: var(--ink); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.ask {
  display: flex; align-items: center; gap: 8px; width: 260px; height: 38px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--card); color: var(--muted);
}
.ask svg { color: var(--violet); }
.ask input { border: 0; outline: none; background: none; width: 100%; color: var(--ink); }
.ask:focus-within { border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-100); }
.icon-btn {
  position: relative; width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--card); color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { border-color: var(--line-2); color: var(--ink); }
.icon-btn .badge-n {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px;
  background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff;
}

.subbar { display: flex; align-items: center; gap: 10px; padding: 14px 28px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.fresh { display: inline-flex; align-items: center; gap: 6px; color: var(--green); font-weight: 500; }
.subbar .acts { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

.content { padding: 24px 28px 64px; background: var(--card); flex: 1; }

/* ============ Composants ============ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px;
  padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--card);
  font-weight: 500; color: var(--ink-2); cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--line-2); color: var(--ink); }
.btn.primary { background: var(--violet); border-color: var(--violet); color: #fff; box-shadow: 0 1px 2px rgba(95, 68, 232, .35), inset 0 1px 0 rgba(255,255,255,.15); }
.btn.primary:hover { background: var(--violet-600); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.success { background: var(--green); border-color: var(--green); color: #fff; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn .spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.split { display: inline-flex; }
.split .btn:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.split .btn:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; border-left: 1px solid rgba(255,255,255,.25); padding: 0 10px; }

.seg { display: inline-flex; padding: 3px; background: var(--soft); border: 1px solid var(--line); border-radius: var(--r-sm); gap: 2px; }
.seg button { border: 0; background: none; padding: 4px 12px; border-radius: 6px; font-size: 12.5px; color: var(--muted); cursor: pointer; font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(28,28,36,.08); font-weight: 600; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; font-size: 14.5px; font-weight: 600; }
.card-head .end { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.kebab { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 7px; display: grid; place-items: center; background: var(--card); color: var(--ink-2); cursor: pointer; }

.chip { display: inline-flex; align-items: center; gap: 2px; font-size: 11.5px; font-weight: 600; padding: 1px 6px; border-radius: 5px; font-variant-numeric: tabular-nums; }
.chip.up { color: var(--green); background: var(--green-bg); }
.chip.down { color: var(--red); background: var(--red-bg); }
.chip.flat { color: var(--muted); background: var(--soft); }

.pill { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.pill.ENABLED::before, .pill.published::before, .pill.validated::before, .pill.applied::before, .pill.ok::before { background: var(--green); }
.pill.PAUSED::before, .pill.draft::before, .pill.pending::before { background: var(--amber); }
.pill.rejected::before, .pill.failed::before, .pill.ko::before { background: var(--red); }

.tag {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 7px; font-size: 13px; background: var(--card); color: var(--ink-2);
}
button.tag { cursor: pointer; }
button.tag[aria-pressed="true"] { border-color: #D6CFFD; background: var(--violet-50); color: var(--violet-600); }
button.tag[aria-pressed="false"] { color: var(--muted); text-decoration: line-through; background: var(--soft); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

.link-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 220px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 6px;
  color: var(--violet); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- Formulaires ---------- */

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; height: 40px; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 0 12px; background: var(--card);
}
.textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.select { padding-right: 28px; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-100); }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.span-2 { grid-column: span 2; } .span-4 { grid-column: 1 / -1; }

/* ============ Bureau ============ */

.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { padding: 16px 18px; }
.kpi .k-head { display: flex; align-items: center; gap: 10px; font-weight: 500; color: var(--ink-2); }
.k-icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); border: 1px solid var(--line); color: var(--ink); }
.k-icon svg { width: 16px; height: 16px; }
.info { margin-left: auto; color: var(--muted); display: grid; place-items: center; cursor: help; }
.kpi .k-body { display: flex; align-items: baseline; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.kpi .val { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi .vs { margin-left: auto; color: var(--muted); font-size: 12.5px; }

.row-2 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); margin-top: 16px; }
.row-3 { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) minmax(0, 1fr); margin-top: 16px; }

.big { display: flex; align-items: baseline; gap: 8px; margin: -6px 0 6px; }
.big b { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.big span { color: var(--muted); font-size: 13px; }
.chart { width: 100%; height: auto; display: block; }
.chart text { font: 11px var(--font); fill: var(--muted); }

.dg-card { display: flex; flex-direction: column; }
.dg-who { display: flex; align-items: center; gap: 10px; }
.dg-who b { display: block; font-size: 13.5px; }
.dg-who small { color: var(--muted); font-size: 12px; }
.dg-verdict { margin: 16px 0 10px; font-size: 19px; line-height: 1.35; font-weight: 600; letter-spacing: -0.015em; text-wrap: pretty; }
.dg-summary { margin: 0 0 16px; color: var(--ink-2); font-size: 13px; }
.next { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.next-item { background: var(--soft); border-radius: 10px; padding: 12px; }
.next-item .t { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; font-size: 13px; }
.next-item .t span { color: var(--muted); font-weight: 500; font-size: 12px; white-space: nowrap; }
.next-item .b { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.next-item .b .btn { margin-left: auto; }

.decisions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.decision { display: grid; grid-template-columns: 4px 1fr; gap: 0 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.decision:first-child { border-top: 0; padding-top: 0; }
.decision .bar { border-radius: 2px; background: var(--line-2); }
.decision.p1 .bar { background: var(--red); }
.decision.p2 .bar { background: var(--amber); }
.decision h4 { margin: 0; font-size: 13.5px; font-weight: 600; }
.decision p { margin: 3px 0 0; color: var(--ink-2); font-size: 13px; }
.decision .impact { color: var(--green); font-weight: 600; font-size: 12.5px; margin-top: 6px; }
.decision .foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.decision .what { font-size: 12px; padding: 3px 8px; border-radius: 6px; background: var(--violet-50); color: var(--violet-600); font-weight: 500; }
.decision .foot .acts { margin-left: auto; display: flex; gap: 6px; }
.decision.done { opacity: .6; }
.decision .err { margin-top: 8px; color: var(--red); font-size: 12.5px; }

.bars-list { display: flex; flex-direction: column; gap: 14px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) 46%; gap: 12px; align-items: center; font-size: 13px; }
.bar-row .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.bar-row .track { height: 12px; border-radius: 4px; background: var(--soft); position: relative; overflow: hidden; }
.bar-row .track i { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: repeating-linear-gradient(115deg, #8F79FA 0 6px, #A492FB 6px 9px); }
.bar-row .track i.waste { background: repeating-linear-gradient(115deg, #EF7D80 0 6px, #F49B9D 6px 9px); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin: -4px 0 14px; }
.legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; background: #8F79FA; }
.legend span.w::before { background: #EF7D80; }

.rank { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.rank li { display: grid; grid-template-columns: 18px 1fr auto; gap: 10px; align-items: center; padding: 9px 0; font-size: 13px; border-top: 1px solid var(--line); }
.rank li:first-child { border-top: 0; }
.rank .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.rank .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 8px; }
.rank .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.dot-st { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--muted); }
.dot-st.ENABLED { background: var(--green); } .dot-st.PAUSED { background: var(--amber); }

/* ============ Tableaux ============ */

.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .end { margin-left: auto; display: flex; gap: 10px; }
.search-in { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--muted); }
.search-in input { border: 0; outline: 0; background: none; width: 200px; color: var(--ink); }
.table-card { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 13px; padding: 12px 16px;
  background: var(--soft); border-bottom: 1px solid var(--line); white-space: nowrap;
}
thead th .sort { display: inline-flex; vertical-align: -3px; margin-left: 6px; color: #B9B9C6; }
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #FBFBFD; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cbox { width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--line-2); accent-color: var(--violet); }
.ent { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.ent .mk { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--violet-600); background: var(--violet-100); flex: none; }
.red { color: var(--red); }
.green { color: var(--green, #1E8E3E); font-weight: 600; }
.web-grid { margin-top: 16px; }
.web-grid table { font-size: 13px; }
.web-grid .table-card { margin-top: 12px; }
@media (max-width: 900px) { .web-grid { grid-template-columns: minmax(0, 1fr) !important; } }

.pager { display: flex; align-items: center; gap: 6px; padding: 14px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pager button { min-width: 30px; height: 30px; padding: 0 8px; border-radius: 7px; border: 1px solid var(--line); background: var(--card); cursor: pointer; color: var(--ink-2); font-size: 13px; }
.pager button.ghost { border-color: transparent; color: var(--muted); }
.pager button[aria-current="page"] { background: var(--violet); border-color: var(--violet); color: #fff; font-weight: 600; }
.pager .show { margin-left: auto; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.pager .show select { height: 30px; border: 1px solid var(--line); border-radius: 7px; padding: 0 8px; background: var(--card); }

/* ============ États ============ */

.empty { text-align: center; padding: 56px 20px; }
.empty .em-icon { width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--violet-50); color: var(--violet); }
.empty h2 { margin: 0 0 6px; font-size: 17px; font-weight: 650; }
.empty p { margin: 0 auto 18px; color: var(--muted); max-width: 48ch; }
.skeleton { display: grid; gap: 16px; }
.sk { height: 110px; border-radius: var(--r); background: linear-gradient(90deg, var(--soft) 25%, #EFEFF4 50%, var(--soft) 75%); background-size: 200% 100%; animation: sh 1.3s infinite linear; }
@keyframes sh { to { background-position: -200% 0; } }
.inline-load { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 10px 0; }
.inline-load .spin { width: 14px; height: 14px; border: 2px solid var(--violet); border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); opacity: 0; z-index: 60;
  display: flex; align-items: center; gap: 8px; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px;
  font-weight: 500; box-shadow: var(--shadow-pop); transition: opacity .2s, transform .2s; pointer-events: none; max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--red); }

dialog { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; width: min(440px, calc(100vw - 32px)); box-shadow: var(--shadow-pop); }
dialog::backdrop { background: rgba(28, 28, 36, .4); backdrop-filter: blur(2px); }
dialog h2 { margin: 0 0 6px; font-size: 17px; font-weight: 650; }
dialog p { margin: 0 0 20px; color: var(--ink-2); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ============ Connexion ============ */

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(1200px 600px at 80% -10%, #E9E4FE 0, transparent 60%), radial-gradient(800px 500px at -10% 110%, #FDE9DC 0, transparent 55%), var(--bg); }
.login-card { width: min(420px, 100%); padding: 32px; }
.login-card .side-head { padding: 0; margin-bottom: 26px; }
.login-card h1 { margin: 0 0 6px; font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.login-card p { margin: 0 0 22px; color: var(--muted); }
.login-card .btn { width: 100%; margin-top: 16px; height: 42px; }
.login-card .foot { margin-top: 18px; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }

/* ============ Responsive ============ */

@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row-3 { grid-template-columns: 1fr 1fr; }
  .row-3 > :first-child { grid-column: 1 / -1; }
  .ask { width: 200px; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: fixed; inset: auto 0 0 0; height: auto; z-index: 20; flex-direction: row; padding: 6px 8px;
    border-right: 0; border-top: 1px solid var(--line); overflow: visible;
  }
  .side > :not(.nav.primary) { display: none; }
  .nav.primary { flex-direction: row; width: 100%; justify-content: space-around; }
  .nav.primary a { flex-direction: column; gap: 2px; font-size: 10.5px; padding: 6px 4px; }
  .nav.primary a[aria-current="page"]::before { display: none; }
  .nav.primary .lbl { font-size: 10.5px; }
  .nav.primary .count:not(.hot) { display: none; }
  .nav.primary .count.hot { position: absolute; top: 0; right: 4px; font-size: 10px; padding: 0 5px; }
  .main { padding-bottom: 64px; }
  .top { padding: 0 16px; }
  .ask, .top-right .hide-m { display: none; }
  .subbar, .content { padding-left: 16px; padding-right: 16px; }
  .kpis, .row-2, .row-3, .plan-top, .brief, .ads, .chat-wrap { grid-template-columns: 1fr; }
  .row-3 > :first-child { grid-column: auto; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .sticky { margin: 20px -16px -64px; padding: 12px 16px; bottom: 58px; }
  .kpi .val { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 860px) { .nav.primary .m-only { display: flex !important; } }

.mini { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }
.mini div + div { border-left: 1px solid var(--line); padding-left: 16px; }
.mini dt { color: var(--muted); font-size: 12px; }
.mini dd { margin: 2px 0 0; font-weight: 650; font-size: 16px; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
@media (max-width: 860px) { .mini { grid-template-columns: 1fr 1fr; row-gap: 12px; } .mini div:nth-child(3) { border-left: 0; padding-left: 0; } }

.lbl-s { display: none; }
@media (max-width: 860px) {
  .nav.primary .lbl { display: none; }
  .nav.primary .lbl-s { display: block; font-size: 10.5px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi { padding: 14px; }
  .kpi .vs { display: none; }
  .kpi .k-head .info { display: none; }
}
.big b, .chip { white-space: nowrap; }
@media (max-width: 860px) { .card-head .end > .muted { display: none; } .big span { flex-basis: 100%; } }


/* ======================================================================
   EDL DORIC — composants propres aux états des lieux
   ====================================================================== */

:root { --amber-soft: #FFF6DE; --green-soft: #EEF9F2; }
.row-2 { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi .k-head { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.kpi .val { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi .big { margin: 12px 0 0; }
.kpi .vs { margin-left: auto; color: var(--muted); font-size: 12.5px; }
.h1 { font-size: 15px; font-weight: 600; color: var(--ink); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.hstack { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.end { margin-left: auto; }
.small { font-size: 12.5px; }
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--soft); color: var(--ink-2); white-space: nowrap; }
.badge.v { background: var(--violet-100); color: var(--violet-600); }
.badge.g { background: var(--green-bg); color: var(--green); }
.badge.a { background: var(--amber-bg); color: var(--amber); }
.badge.r { background: var(--red-bg); color: var(--red); }
.type-ic { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.type-ic svg { width: 16px; height: 16px; color: var(--muted); }
tr.click { cursor: pointer; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -8px 0 18px; overflow-x: auto; }
.tabs a { padding: 10px 12px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--violet); font-weight: 600; }
.tabs a .n { margin-left: 6px; font-size: 12px; color: var(--muted); }

/* Calendrier */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.cal-head b { flex: 1; text-align: center; font-weight: 600; text-transform: capitalize; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; gap: 4px 0; font-size: 13px; }
.cal .dow { color: var(--muted); font-size: 12px; padding-bottom: 4px; }
.cal button { border: 0; background: none; height: 34px; width: 34px; margin: auto; border-radius: 50%; cursor: pointer; color: var(--ink); position: relative; font-variant-numeric: tabular-nums; }
.cal button.out { color: #C5C5D0; }
.cal button.today { background: var(--violet); color: #fff; font-weight: 600; }
.cal button.has::after { content: ""; position: absolute; bottom: 3px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--orange); }
.cal button.today.has::after { background: #fff; }
.events { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.event { background: var(--soft); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; border: 0; text-align: left; width: 100%; color: var(--ink); }
.event b { font-weight: 600; font-size: 13px; }
.event span { color: var(--muted); font-size: 12px; }

/* Barres empilées (activité mensuelle) */
.bars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; align-items: end; gap: 10px; height: 220px; padding-top: 8px; }
.bar { display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; height: 100%; gap: 2px; position: relative; }
.bar i { display: block; border-radius: 5px 5px 2px 2px; min-height: 0; }
.bar i.e { background: var(--violet); }
.bar i.s { background: #D9D2FC; }
.bar i.z { background: var(--soft); height: 6px; }
.bar small { position: absolute; bottom: -22px; left: 0; right: 0; text-align: center; color: var(--muted); font-size: 11.5px; text-transform: capitalize; }
.bars-wrap { padding-bottom: 26px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.prog { display: flex; flex-direction: column; gap: 12px; }
.prog .pr { display: grid; grid-template-columns: 90px 1fr 40px; gap: 10px; align-items: center; font-size: 13px; }
.prog .track { height: 10px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.prog .track i { display: block; height: 100%; border-radius: 99px; background: repeating-linear-gradient(-45deg, #A898FA 0 6px, #B9ACFB 6px 12px); }

/* Fiche (bien, contact) */
.sheet { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; margin: 0; font-size: 13.5px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; }

/* ---------- Éditeur d'état des lieux ---------- */

.ed { display: grid; grid-template-columns: 290px minmax(0, 1fr); min-height: calc(100vh - 64px); }
.ed-nav { border-right: 1px solid var(--line); background: #FBFBFD; position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto; padding: 8px 0 24px; }
.ed-nav h4 { margin: 14px 16px 6px; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.ed-nav a, .ed-nav button.add { display: flex; align-items: center; gap: 10px; padding: 9px 16px; color: var(--ink-2); font-weight: 500; border: 0; background: none; width: 100%; text-align: left; cursor: pointer; font-size: 13.5px; }
.ed-nav a:hover { background: var(--soft); }
.ed-nav a[aria-current="page"] { background: var(--violet-50); color: var(--violet-600); box-shadow: inset 3px 0 0 var(--violet); }
.ed-nav a small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.ed-nav a .chev { margin-left: auto; color: #B9B9C6; }
.ed-nav button.add { color: var(--violet); }
.dot { width: 18px; height: 18px; flex: none; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; background: var(--card); }
.dot.done { background: var(--green); border-color: var(--green); color: #fff; }
.dot.part { border-color: var(--amber); background: conic-gradient(var(--amber) var(--p, 50%), transparent 0); }
.dot svg { width: 11px; height: 11px; }
.ed-main { padding: 20px 28px 120px; min-width: 0; background: var(--bg); }
.ed-inner { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.ed-title { display: flex; align-items: center; gap: 12px; padding: 14px 18px; }
.ed-title h2 { margin: 0; font-size: 17px; font-weight: 650; flex: 1; min-width: 0; }
.ed-title input { font: inherit; font-size: 17px; font-weight: 650; border: 0; outline: 0; background: none; width: 100%; }
.ai-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.ai { background: var(--violet-50); border-color: #DDD5FD; color: var(--violet-600); }
.btn.ai:hover { background: var(--violet-100); }
.cat-title { font-weight: 600; font-size: 13.5px; color: var(--ink-2); margin: 6px 2px -6px; }

.el { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); display: grid; grid-template-columns: 170px minmax(0, 1fr); overflow: hidden; }
.el.changed { border-color: #F3D9A4; box-shadow: 0 0 0 3px var(--amber-soft); }
.el-name { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; border-right: 1px solid var(--line); min-width: 0; }
.el-name input { font: inherit; font-weight: 600; border: 0; outline: 0; background: none; padding: 0; width: 100%; }
.el-name .el-acts { display: flex; gap: 4px; margin-top: auto; }
.el-body { min-width: 0; }
.states { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.states button { border: 0; border-left: 1px solid var(--line); background: var(--card); padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; font-size: 12px; color: var(--ink-2); min-height: 58px; line-height: 1.2; text-align: center; }
.states button:first-child { border-left: 0; }
.states button svg { width: 18px; height: 18px; }
.states button:hover { background: var(--soft); }
.states button[aria-pressed="true"][data-v="neuf"], .states button[aria-pressed="true"][data-v="bon"] { background: var(--green-bg); color: var(--green); font-weight: 600; }
.states button[aria-pressed="true"][data-v="moyen"] { background: var(--amber-bg); color: var(--amber); font-weight: 600; }
.states button[aria-pressed="true"][data-v="mauvais"], .states button[aria-pressed="true"][data-v="manquant"] { background: var(--red-bg); color: var(--red); font-weight: 600; }
.states button .was { font-size: 10px; font-weight: 600; color: var(--violet-600); background: var(--violet-100); border-radius: 4px; padding: 0 4px; }
.el-fields { display: grid; grid-template-columns: 1fr 1fr; }
.el-fields > * { border-top: 1px solid var(--line); }
.el-fields > :nth-child(-n+2) { border-top: 0; }
.el-fields > :nth-child(odd) { border-right: 1px solid var(--line); }
.el-fields .wide { grid-column: 1 / -1; border-right: 0 !important; }
.fx { display: flex; align-items: center; gap: 8px; padding: 0 12px; min-height: 40px; color: var(--muted); }
.fx svg { width: 15px; height: 15px; flex: none; }
.fx input, .fx select, .fx textarea { border: 0; outline: 0; background: none; font: inherit; color: var(--ink); width: 100%; min-width: 0; padding: 10px 0; }
.fx textarea { resize: vertical; min-height: 40px; }
.fx select { appearance: none; cursor: pointer; }
.fx select:invalid, .fx select option[value=""] { color: var(--muted); }
.degs { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px; align-items: center; }
.degs button { height: 26px; padding: 0 9px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); font-size: 12px; color: var(--ink-2); cursor: pointer; }
.degs button[aria-pressed="true"] { background: var(--red-bg); border-color: #F6C9CB; color: var(--red); font-weight: 600; }
.entry-line { padding: 6px 12px; background: var(--violet-50); color: var(--violet-600); font-size: 12px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.entry-line b { font-weight: 600; }

.photos { display: flex; gap: 8px; padding: 10px 12px; overflow-x: auto; align-items: center; }
.photos .ph { position: relative; width: 74px; height: 74px; flex: none; border-radius: 9px; overflow: hidden; background: var(--soft); border: 1px solid var(--line); }
.photos .ph img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.photos .ph .x { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(28,28,36,.65); color: #fff; display: grid; place-items: center; cursor: pointer; }
.photos .ph .x svg { width: 12px; height: 12px; }
.photos .ph.pending::after { content: ""; position: absolute; inset: auto 4px 4px auto; width: 10px; height: 10px; border-radius: 50%; background: var(--amber); border: 2px solid #fff; }
.photos .ph.entry { opacity: .75; }
.photos .ph.entry::before { content: "Entrée"; position: absolute; left: 3px; bottom: 3px; font-size: 9.5px; font-weight: 700; color: #fff; background: rgba(95,68,232,.85); border-radius: 4px; padding: 0 4px; z-index: 1; }
.cam { width: 74px; height: 74px; flex: none; border-radius: 9px; border: 1.5px dashed var(--line-2); background: var(--card); color: var(--violet); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; font-size: 11px; font-weight: 600; }
.cam svg { width: 22px; height: 22px; }
.cam input { display: none; }

.lib-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; max-height: 50vh; overflow-y: auto; padding: 2px; }
.lib-pick label { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: 13px; }
.lib-pick label:has(input:checked) { border-color: #D6CFFD; background: var(--violet-50); color: var(--violet-600); font-weight: 600; }
dialog.wide { width: min(760px, calc(100vw - 24px)); }
dialog .dlg-body { max-height: 70vh; overflow-y: auto; margin: 0 -4px 16px; padding: 0 4px; }

/* Dictée */
.mic { width: 64px; height: 64px; border-radius: 50%; border: 0; background: var(--violet); color: #fff; display: grid; place-items: center; cursor: pointer; margin: 6px auto; box-shadow: 0 6px 20px rgba(115,87,246,.35); }
.mic svg { width: 28px; height: 28px; }
.mic.on { background: var(--red); animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(224,71,76,.45); } 100% { box-shadow: 0 0 0 18px rgba(224,71,76,0); } }

/* Signatures */
.sig-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.sig { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.sig canvas { width: 100%; height: 180px; border: 1.5px dashed var(--line-2); border-radius: 10px; background: #fff; touch-action: none; cursor: crosshair; }
.sig img { width: 100%; height: 180px; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.legal { font-size: 13px; color: var(--ink-2); background: var(--soft); border-radius: 10px; padding: 12px 14px; }

/* Barre d'action fixe de l'éditeur */
.ed-bar { position: fixed; left: calc(var(--rail) + 290px); right: 0; bottom: 0; z-index: 10; display: flex; align-items: center; gap: 10px; padding: 12px 28px; background: rgba(255,255,255,.95); backdrop-filter: blur(8px); border-top: 1px solid var(--line); }
.app.collapsed .ed-bar { left: calc(76px + 290px); }
.sync { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; }
.sync::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.sync.pending::before { background: var(--amber); }
.sync.offline::before { background: var(--red); }

.viewer { width: 100%; height: calc(100vh - 190px); min-height: 520px; border: 1px solid var(--line); border-radius: var(--r); background: var(--soft); }
.diff-tbl td.hl { background: var(--amber-soft); font-weight: 600; }
.lightbox { position: fixed; inset: 0; background: rgba(15,15,20,.92); z-index: 80; display: grid; place-items: center; padding: 16px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.offline-banner { background: var(--amber-bg); color: #7A4A08; text-align: center; font-size: 13px; padding: 6px 12px; font-weight: 500; }

/* Choix au démarrage d'un EDL */
.choice { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.choice label { display: flex; flex-direction: column; gap: 4px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 13px; }
.choice label b { font-size: 13.5px; }
.choice label span { color: var(--muted); font-size: 12px; }
.choice label:has(input:checked) { border-color: var(--violet); background: var(--violet-50); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }

@media (max-width: 1180px) {
  .sheet { grid-template-columns: 1fr; }
  .ed { grid-template-columns: 240px minmax(0, 1fr); }
  .ed-bar { left: calc(var(--rail) + 240px); }
  .app.collapsed .ed-bar { left: calc(76px + 240px); }
}
@media (max-width: 860px) {
  .row-2, .row-3, .sig-grid, .choice { grid-template-columns: 1fr; }
  .ed { grid-template-columns: 1fr; }
  .ed.has-section .ed-nav { display: none; }
  .ed:not(.has-section) .ed-main { display: none; }
  .ed-nav { position: static; height: auto; border-right: 0; background: var(--card); padding-bottom: 90px; }
  .ed-nav a, .ed-nav button.add { padding: 12px 16px; font-size: 14.5px; border-bottom: 1px solid var(--line); }
  .ed-main { padding: 12px 10px 150px; }
  .ed-bar { left: 0; bottom: 58px; padding: 10px 12px; }
  .app.collapsed .ed-bar { left: 0; }
  .el { grid-template-columns: 1fr; }
  .el-name { border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; align-items: center; padding: 10px 12px; }
  .el-name .el-acts { margin: 0 0 0 auto; }
  .states button { min-height: 54px; font-size: 10.5px; padding: 6px 2px; }
  .fx { padding: 0 10px; min-height: 42px; font-size: 14px; }
  .dl { grid-template-columns: 110px 1fr; }
  .viewer { height: 70vh; }
  .hide-m { display: none !important; }
  .bars { gap: 4px; }
  .bar small { font-size: 10px; }
  .content { padding-top: 16px; }
  .toolbar .search-in { flex: 1; } .toolbar .search-in input { width: 100%; }
  .top .crumbs { font-size: 14px; }
}
@media (min-width: 861px) { .m-only-flex { display: none !important; } }
