/* ==========================================================================
   Rmoved · plateforme HeraHub
   Design system : minimal, dense, sans-serif. Inspiré de Linear / Pipedrive
   sur une palette inspirée de rmoved.ch (blanc, encres, sans accent coloré).
   ========================================================================== */

:root {
  --bg: #ffffff;
  --canvas: #fafaf9;
  --panel: #ffffff;
  --panel-2: #f6f6f4;
  --hover: #f1f1ee;
  --line: #e7e7e2;
  --line-strong: #d8d8d2;
  --ink: #1a1a1a;
  --ink-2: #404040;
  --ink-3: #737373;
  --ink-4: #a3a3a3;
  --ink-disabled: #d4d4d4;

  /* Marque Rmoved : violet/aubergine + gris */
  --brand: #7b2a85;
  --brand-strong: #5d1f64;
  --brand-soft: #f3e6f5;
  --brand-tint: #faf3fb;
  --brand-grey: #6e6e6e;

  --accent: var(--brand);
  --accent-2: var(--brand-strong);
  --ring: rgba(123, 42, 133, 0.18);

  --ok: #137a3a;
  --ok-bg: #e6f3eb;
  --warn: #b1640c;
  --warn-bg: #fbf1de;
  --danger: #b6201c;
  --danger-bg: #fbe7e6;
  --info: #1d4ed8;
  --info-bg: #e3eafd;
  --violet: var(--brand);
  --violet-bg: var(--brand-soft);

  --r-sm: 4px;
  --r: 6px;
  --r-md: 8px;
  --r-lg: 10px;

  --shadow-sm: 0 1px 2px rgba(13,13,12,.04);
  --shadow: 0 2px 6px rgba(13,13,12,.06), 0 0 0 1px var(--line);
  --shadow-pop: 0 8px 32px rgba(13,13,12,.12), 0 0 0 1px var(--line);

  --topbar-h: 52px;
  --side-w: 232px;
  --side-w-collapsed: 56px;

  --t-fast: 120ms cubic-bezier(.2,.8,.2,1);
  --t: 180ms cubic-bezier(.2,.8,.2,1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; background: var(--canvas); color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--ink); }
button { font-family: inherit; cursor: pointer; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; line-height: 1.2; letter-spacing: -0.02em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
h4 { font-size: .9rem; }

::selection { background: var(--ink); color: #fff; }

/* === Icons (Lucide) ===================================================== */
.icon { width: 16px; height: 16px; stroke-width: 1.75; flex-shrink: 0; }
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 20px; height: 20px; }
.icon-xl { width: 32px; height: 32px; stroke-width: 1.5; }

/* === App shell ========================================================== */
.app {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas:
    "side top"
    "side main";
  height: 100vh;
}
.app[data-collapsed="true"] { grid-template-columns: var(--side-w-collapsed) 1fr; }

/* --- Topbar --- */
.topbar {
  grid-area: top;
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1rem 0 1.25rem;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.topbar-search {
  flex: 1; max-width: 480px; position: relative;
}
.topbar-search input {
  width: 100%; height: 32px; padding: 0 .75rem 0 2rem;
  background: var(--panel-2); border: 1px solid transparent;
  border-radius: var(--r); font-size: .85rem; color: var(--ink);
  transition: var(--t-fast);
}
.topbar-search input::placeholder { color: var(--ink-4); }
.topbar-search input:focus {
  outline: none; background: var(--bg); border-color: var(--line-strong);
  box-shadow: 0 0 0 3px var(--ring);
}
.topbar-search .icon-search {
  position: absolute; left: .55rem; top: 50%; transform: translateY(-50%);
  color: var(--ink-3);
}
.topbar-search kbd {
  position: absolute; right: .5rem; top: 50%; transform: translateY(-50%);
  font-size: .7rem; padding: 1px 5px; background: var(--bg); color: var(--ink-3);
  border: 1px solid var(--line); border-radius: var(--r-sm); font-family: inherit;
}

.topbar-actions { display: flex; align-items: center; gap: .35rem; margin-left: auto; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; background: transparent;
  border: 1px solid transparent; color: var(--ink-2);
  border-radius: var(--r); transition: var(--t-fast); position: relative;
}
.icon-btn:hover { background: var(--panel-2); color: var(--ink); }
.icon-btn .dot {
  position: absolute; top: 6px; right: 7px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--danger);
  border: 1.5px solid var(--bg);
}

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--ink); color: #fff;
  font-size: .72rem; font-weight: 600; letter-spacing: 0;
}
.avatar-lg { width: 36px; height: 36px; font-size: .82rem; }

.user-menu-btn {
  display: flex; align-items: center; gap: .5rem; padding: .25rem .35rem .25rem .25rem;
  background: transparent; border: 1px solid transparent; border-radius: var(--r);
  color: var(--ink-2); font-size: .82rem;
}
.user-menu-btn:hover { background: var(--panel-2); color: var(--ink); }
.user-menu-btn .name { font-weight: 500; }

/* --- Sidebar --- */
.sidebar {
  grid-area: side;
  background: var(--canvas);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.sidebar-head {
  display: flex; align-items: center; gap: .65rem;
  padding: 0 .85rem; height: var(--topbar-h);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.brand {
  display: flex; align-items: center; gap: .55rem;
  font-weight: 600; font-size: .95rem; letter-spacing: -.01em;
  color: var(--ink); text-decoration: none;
}
.brand-mark {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.brand-mark img { width: 100%; height: auto; display: block; }
.brand-text { line-height: 1.05; }
.brand-text small {
  display: block; font-size: .62rem; color: var(--ink-3);
  letter-spacing: .08em; text-transform: uppercase; font-weight: 500;
  margin-top: 1px;
}
.collapse-btn {
  margin-left: auto; width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; background: transparent;
  border-radius: var(--r-sm); color: var(--ink-3);
}
.collapse-btn:hover { background: var(--panel-2); color: var(--ink); }

.app[data-collapsed="true"] .brand span,
.app[data-collapsed="true"] .nav a span,
.app[data-collapsed="true"] .nav-section,
.app[data-collapsed="true"] .nav a .badge,
.app[data-collapsed="true"] .sidebar-foot { display: none; }
/* Connexion (gestion des utilisateurs) */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--panel-2, #f5f2f7); font-family: Inter, sans-serif; margin: 0; }
.login-card { background: var(--bg, #fff); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 18px 50px rgba(20,16,22,.12); padding: 2rem 2.2rem; width: min(380px, 92vw); }
.login-brand { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.1rem; }
.login-brand img { width: 38px; height: 38px; }
.login-brand strong { display: block; font-size: 1.05rem; }
.login-brand small { color: var(--muted); font-size: .72rem; }
.login-card h1 { font-size: 1.15rem; margin: 0 0 .8rem; }
.login-card label { display: block; font-size: .8rem; color: var(--brand-grey); margin-bottom: .7rem; }
.login-card input { display: block; width: 100%; box-sizing: border-box; margin-top: .25rem;
  border: 1px solid var(--line); border-radius: 8px; padding: .55rem .65rem; font: inherit; }
.login-card input:focus { border-color: var(--brand); outline: none; }
.login-card .btn { width: 100%; justify-content: center; margin-top: .3rem; }
.login-err { background: #fbe4e1; color: #a5352a; border-radius: 8px; padding: .5rem .7rem;
  font-size: .8rem; margin-bottom: .8rem; }
.login-foot { color: var(--muted); font-size: .72rem; margin: 1rem 0 0; }
/* Gestionnaire d'utilisateurs */
.usr-wrap { overflow-x: auto; }
.usr-tbl { width: 100%; border-collapse: collapse; }
.usr-tbl th, .usr-tbl td { border-bottom: 1px solid var(--line); padding: .45rem .55rem; text-align: left; vertical-align: middle; }
.usr-tbl thead th { background: var(--brand-soft); color: var(--brand-strong); font-size: .7rem; text-transform: uppercase; letter-spacing: .03em; }
.usr-tbl tr.is-off { opacity: .55; }
.usr-nom { white-space: nowrap; }
.usr-role, .usr-input { border: 1px solid var(--line); border-radius: 8px; padding: .35rem .45rem; font: inherit; font-size: .82rem; width: 100%; box-sizing: border-box; min-width: 9rem; }
.usr-actif { text-align: center; }
.usr-save { white-space: nowrap; }
.menu-logout { display: flex; align-items: center; gap: .55rem; width: 100%; border: 0; background: none;
  cursor: pointer; font: inherit; color: inherit; padding: .45rem .75rem; text-align: left; }
.menu-logout:hover { background: var(--brand-soft); }
.role-switch { display: flex; align-items: center; gap: .5rem; margin: .2rem .6rem .5rem; padding: .4rem .6rem;
  border-radius: 8px; font-size: .78rem; color: var(--brand-grey); text-decoration: none; border: 1px solid var(--line); }
.role-switch:hover { border-color: var(--brand); color: var(--brand-strong); }
.role-switch.is-phases { background: var(--brand-soft); color: var(--brand-strong); border-color: var(--brand); }
.app[data-collapsed="true"] .role-switch { display: none; }
.app[data-collapsed="true"] .sidebar-head { justify-content: center; padding: 0; }
.app[data-collapsed="true"] .nav a { justify-content: center; padding: 0; height: 36px; }

.nav {
  flex: 1; overflow-y: auto; padding: .75rem .5rem;
}
.nav-section {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--ink-4); padding: .85rem .85rem .35rem;
  font-weight: 500;
}
.nav a {
  display: flex; align-items: center; gap: .65rem;
  padding: .42rem .75rem; margin-bottom: 1px;
  border-radius: var(--r); color: var(--ink-2);
  font-size: .85rem; line-height: 1.2; font-weight: 500;
  transition: var(--t-fast); position: relative;
}
.nav a:hover { background: var(--panel-2); color: var(--ink); }
.nav a.active { background: var(--brand); color: #fff; }
.nav a .icon { color: inherit; opacity: .85; }
.nav a.active .icon { opacity: 1; }
.nav a .badge {
  margin-left: auto; font-size: .68rem; padding: 1px 5px;
  background: var(--panel-2); color: var(--ink-2); border-radius: 99px;
  font-weight: 500;
}
.nav a.active .badge { background: rgba(255,255,255,.16); color: #fff; }
.nav a .badge.danger { background: var(--danger); color: #fff; }

.sidebar-foot {
  border-top: 1px solid var(--line); padding: .65rem .75rem;
  display: flex; align-items: center; gap: .55rem;
  background: var(--canvas);
}
.sidebar-foot .info { font-size: .75rem; line-height: 1.2; }
.sidebar-foot .info strong { display: block; font-weight: 600; color: var(--ink); }
.sidebar-foot .info span { color: var(--ink-3); }

/* --- Main content --- */
.main { grid-area: main; overflow-y: auto; background: var(--canvas); }

.page-header {
  background: var(--bg); border-bottom: 1px solid var(--line);
  padding: 1.1rem 1.5rem .9rem;
}
.page-header .breadcrumb {
  display: flex; align-items: center; gap: .35rem;
  color: var(--ink-3); font-size: .78rem; margin-bottom: .35rem;
}
.page-header .breadcrumb a:hover { color: var(--ink); }
.page-header .breadcrumb .icon { width: 12px; height: 12px; opacity: .6; }
.page-header .title-row { display: flex; align-items: center; gap: .85rem; }
.page-header h1 { font-size: 1.25rem; font-weight: 600; }
.page-header .actions { margin-left: auto; display: flex; gap: .4rem; }

.toolbar {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  padding: .65rem 1.5rem; background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.tabs {
  display: flex; align-items: center; gap: .25rem;
  background: var(--panel-2); padding: 2px; border-radius: var(--r);
}
.tabs a, .tabs button {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .28rem .65rem; font-size: .82rem; color: var(--ink-2);
  background: transparent; border: 0; border-radius: var(--r-sm); font-weight: 500;
  transition: var(--t-fast);
}
.tabs a:hover, .tabs button:hover { color: var(--ink); }
.tabs a.active, .tabs button.active {
  background: var(--bg); color: var(--ink); box-shadow: var(--shadow-sm);
}

.content { padding: 1.5rem; }
.content.flush { padding: 0; }

/* === Buttons & form ==================================================== */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  height: 30px; padding: 0 .8rem;
  background: var(--brand); color: #fff;
  border: 1px solid var(--brand); border-radius: var(--r);
  font-size: .82rem; font-weight: 500;
  transition: var(--t-fast);
}
.btn:hover { background: var(--brand-strong); border-color: var(--brand-strong); color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:disabled:hover { background: var(--brand); border-color: var(--brand); }
.btn.secondary {
  background: var(--bg); color: var(--ink);
  border-color: var(--line-strong);
}
.btn.secondary:hover { background: var(--panel-2); border-color: var(--ink-3); color: var(--ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--panel-2); color: var(--ink); }
.btn.sm { height: 26px; font-size: .78rem; padding: 0 .65rem; }

input[type="text"], input[type="search"], input[type="email"],
input[type="date"], input[type="number"], input[type="time"],
input[type="tel"], input[type="url"], input[type="password"],
input[type="datetime-local"], input[type="month"],
textarea, select {
  width: 100%; height: 32px; padding: 0 .65rem;
  background: var(--bg); border: 1px solid var(--line-strong);
  border-radius: var(--r); font-family: inherit; font-size: .85rem;
  color: var(--ink); transition: var(--t-fast);
}
/* Inputs date/heure : finition aubergine cohérente (l'indicateur natif paraissait « HTML pur »). */
input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"] {
  appearance: none; -webkit-appearance: none; line-height: normal;
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator {
  cursor: pointer; opacity: .55; padding: 0 .1rem;
  filter: invert(18%) sepia(38%) saturate(2200%) hue-rotate(268deg) brightness(70%);
  transition: var(--t-fast);
}
input[type="date"]:hover::-webkit-calendar-picker-indicator,
input[type="time"]:hover::-webkit-calendar-picker-indicator,
input[type="datetime-local"]:hover::-webkit-calendar-picker-indicator,
input[type="month"]:hover::-webkit-calendar-picker-indicator { opacity: 1; }
/* placeholder « jj.mm.aaaa » natif un peu plus discret */
input[type="date"]::-webkit-datetime-edit,
input[type="time"]::-webkit-datetime-edit { color: var(--ink); }
input[type="date"]:invalid::-webkit-datetime-edit,
input[type="time"]:invalid::-webkit-datetime-edit { color: var(--ink-3); }
textarea { padding: .5rem .65rem; height: auto; min-height: 80px; }
select { padding-right: 1.75rem; appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236e6e6a' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat; background-position: right .55rem center; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--ink-3); box-shadow: 0 0 0 3px var(--ring);
}

.field-inline { display: flex; align-items: center; gap: .35rem; }
.field-inline label { font-size: .78rem; color: var(--ink-3); }

/* === Card / panel ====================================================== */
.card {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r-md); overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: .5rem;
  padding: .85rem 1rem; border-bottom: 1px solid var(--line);
}
.card-head h3 { font-size: .92rem; font-weight: 600; }
.card-head .actions { margin-left: auto; }
.card-body { padding: 1rem; }
.card-body.flush { padding: 0; }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.cols-3-2 { display: grid; grid-template-columns: 3fr 2fr; gap: 1rem; }
.cols-2-3 { display: grid; grid-template-columns: 2fr 3fr; gap: 1rem; }

@media (max-width: 1100px) { .cols-2, .cols-3-2, .cols-2-3 { grid-template-columns: 1fr; } }

/* === KPI card ========================================================== */
.kpi {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 1rem 1.1rem;
  display: flex; flex-direction: column; gap: .35rem;
}
.kpi .label {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--ink-3); font-weight: 500;
}
.kpi .value {
  font-size: 1.65rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.1;
}
.kpi .sub {
  font-size: .76rem; color: var(--ink-3);
  display: flex; align-items: center; gap: .35rem;
}
.kpi .delta { font-weight: 500; }
.kpi .delta.up { color: var(--ok); }
.kpi .delta.down { color: var(--danger); }
.kpi .spark { margin-top: .25rem; height: 24px; }

/* === Table ============================================================= */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .85rem; }
.tbl th, .tbl td {
  padding: .55rem .85rem; text-align: left; vertical-align: middle;
  border-bottom: 1px solid var(--line);
}
.tbl th {
  background: var(--panel-2); color: var(--ink-3);
  font-size: .72rem; text-transform: uppercase; letter-spacing: .08em;
  font-weight: 500; padding: .5rem .85rem;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1;
}
.tbl tbody tr { transition: background var(--t-fast); }
.tbl tbody tr:hover { background: var(--panel-2); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td.mono, .tbl th.mono {
  font-family: ui-monospace, "JetBrains Mono", Menlo, monospace; font-size: .8rem;
}
.tbl tr.row-link { cursor: pointer; }
.tbl tr.row-link a { color: inherit; }

.row-actions { display: flex; gap: .15rem; opacity: 0; transition: var(--t-fast); }
.tbl tbody tr:hover .row-actions { opacity: 1; }

/* === Badge ============================================================= */
.badge {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: 1px 8px; font-size: .72rem; font-weight: 500;
  border-radius: 99px; line-height: 1.5;
  background: var(--panel-2); color: var(--ink-2);
  border: 1px solid var(--line);
}
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.badge.info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.badge.violet { background: var(--violet-bg); color: var(--violet); border-color: transparent; }
.badge.solid { background: var(--ink); color: #fff; border-color: transparent; }
.badge .dot {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}

/* === Progress ========================================================== */
.bar { display: block; width: 100%; height: 4px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--ink); border-radius: 99px; transition: width var(--t); }
.bar.ok > span { background: var(--ok); }
.bar.warn > span { background: var(--warn); }
.bar.danger > span { background: var(--danger); }
.bar-mini { width: 60px; }

/* === Avatars ========================================================== */
.avatar-set { display: inline-flex; }
.avatar-set .avatar {
  border: 2px solid var(--bg); margin-left: -8px; width: 24px; height: 24px;
  font-size: .65rem;
}
.avatar-set .avatar:first-child { margin-left: 0; }

/* === Kanban ============================================================ */
.kanban {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem;
  overflow-x: auto; padding-bottom: .5rem;
}
.kanban-col {
  background: var(--canvas); border: 1px solid var(--line);
  border-radius: var(--r-md); display: flex; flex-direction: column;
  min-height: 60vh;
}
.kanban-col-head {
  padding: .65rem .85rem; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: .5rem;
}
.kanban-col-head h4 { font-size: .82rem; font-weight: 600; }
.kanban-col-head .count {
  background: var(--panel-2); color: var(--ink-2);
  padding: 0 6px; border-radius: 99px; font-size: .7rem; font-weight: 500;
  margin-left: .25rem;
}
.kanban-col-body { padding: .65rem; flex: 1; overflow-y: auto; }
.kanban-card {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r); padding: .75rem; margin-bottom: .5rem;
  transition: var(--t-fast); cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.kanban-card:hover { border-color: var(--ink-3); transform: translateY(-1px); box-shadow: 0 3px 8px rgba(13,13,12,.06), 0 0 0 1px var(--line); }
.kanban-card .top {
  display: flex; align-items: flex-start; gap: .5rem; margin-bottom: .35rem;
}
.kanban-card .top strong {
  font-size: .82rem; line-height: 1.3; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.kanban-card .meta {
  display: flex; flex-wrap: wrap; gap: .35rem; font-size: .72rem; color: var(--ink-3);
  margin: .35rem 0;
}
.kanban-card .meta-row {
  display: flex; align-items: center; gap: .5rem;
  margin-top: .5rem; padding-top: .5rem; border-top: 1px solid var(--line);
  font-size: .72rem; color: var(--ink-3);
}

/* === Activity feed ====================================================== */
.activity { display: flex; flex-direction: column; }
.activity-item {
  display: flex; align-items: flex-start; gap: .65rem;
  padding: .65rem 1rem; border-bottom: 1px solid var(--line);
  font-size: .82rem;
}
.activity-item:last-child { border-bottom: 0; }
.activity-item .ico {
  width: 28px; height: 28px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel-2); color: var(--ink-2); border-radius: var(--r);
}
.activity-item .body { flex: 1; min-width: 0; }
.activity-item .body .text { color: var(--ink); }
.activity-item .body .meta { color: var(--ink-3); font-size: .74rem; margin-top: 1px; }
.activity-item time { color: var(--ink-3); font-size: .72rem; flex-shrink: 0; }

/* === 3-pane mail ======================================================= */
.mail {
  display: grid;
  grid-template-columns: 220px 360px 1fr;
  height: calc(100vh - var(--topbar-h));
}
.mail-folders {
  background: var(--canvas); border-right: 1px solid var(--line);
  padding: .75rem .5rem; overflow-y: auto;
}
.mail-folders h4 {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--ink-4); padding: .5rem .85rem; font-weight: 500;
}
.mail-folder {
  display: flex; align-items: center; gap: .5rem;
  padding: .35rem .75rem; border-radius: var(--r); color: var(--ink-2);
  font-size: .85rem; cursor: pointer;
}
.mail-folder:hover { background: var(--panel-2); color: var(--ink); }
.mail-folder.active { background: var(--brand); color: #fff; }
.mail-folder .count { margin-left: auto; font-size: .72rem; color: var(--ink-3); }
.mail-folder.active .count { color: rgba(255,255,255,.7); }

.mail-list { background: var(--bg); border-right: 1px solid var(--line); overflow-y: auto; }
.mail-row {
  display: block; padding: .75rem 1rem; border-bottom: 1px solid var(--line);
  cursor: pointer; transition: var(--t-fast);
}
.mail-row:hover { background: var(--panel-2); }
.mail-row.active { background: var(--brand-tint); border-left: 3px solid var(--brand); padding-left: calc(1rem - 3px); }
.mail-row .from { display: flex; align-items: center; gap: .35rem; font-size: .82rem; }
.mail-row .from strong { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-row .from time { color: var(--ink-3); font-size: .72rem; }
.mail-row .subject { font-size: .85rem; margin-top: .15rem; color: var(--ink); font-weight: 500; }
.mail-row .preview { font-size: .78rem; color: var(--ink-3); margin-top: .15rem;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.mail-row .tags { margin-top: .35rem; display: flex; gap: .25rem; }

.mail-view { background: var(--bg); overflow-y: auto; }
.mail-view-head {
  padding: 1rem 1.5rem; border-bottom: 1px solid var(--line);
}
.mail-view-head h2 { font-size: 1rem; margin-bottom: .35rem; }
.mail-view-meta {
  display: flex; align-items: center; gap: .5rem; font-size: .82rem; color: var(--ink-3);
}
.mail-view-body {
  padding: 1.5rem; font-size: .9rem; line-height: 1.7;
}
/* C3 — métadonnée e-mail réelle (pas de faux corps) */
.mail-meta-real { display: grid; grid-template-columns: 9rem 1fr; gap: .4rem .9rem; margin: 0 0 1.1rem; }
.mail-meta-real dt { color: var(--ink-3); font-size: .82rem; }
.mail-meta-real dd { margin: 0; color: var(--ink); font-size: .88rem; }
.mail-body-todo {
  display: flex; gap: .5rem; align-items: flex-start;
  padding: .85rem 1rem; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--r-md); color: var(--ink-2); font-size: .85rem; line-height: 1.5;
}
.mail-body-todo svg { flex-shrink: 0; margin-top: .1rem; color: var(--ink-3); }
.mail-attachments {
  display: flex; flex-wrap: wrap; gap: .5rem; padding: 0 1.5rem 1.5rem;
}
.mail-att {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .5rem .75rem; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--panel-2); font-size: .82rem;
}

/* === Chat ============================================================== */
.chat {
  display: grid; grid-template-columns: 240px 1fr;
  height: calc(100vh - var(--topbar-h));
}
.chat-side {
  background: var(--canvas); border-right: 1px solid var(--line);
  padding: .75rem; overflow-y: auto;
}
.chat-side h4 {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--ink-4); padding: .5rem .35rem; font-weight: 500;
}
.chat-suggestion {
  display: block; width: 100%; text-align: left;
  padding: .55rem .65rem; margin-bottom: .25rem;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r);
  font-size: .8rem; color: var(--ink-2); transition: var(--t-fast); cursor: pointer;
}
.chat-suggestion:hover { background: var(--panel-2); color: var(--ink); border-color: var(--line-strong); }

.chat-main { display: flex; flex-direction: column; background: var(--bg); }
.chat-main-head {
  display: flex; align-items: center; gap: .65rem;
  padding: .85rem 1.25rem; border-bottom: 1px solid var(--line);
}
.chat-main-head .avatar { background: var(--violet-bg); color: var(--violet); }
.chat-msgs { flex: 1; overflow-y: auto; padding: 1.5rem; max-width: 800px; margin: 0 auto; width: 100%; }
.chat-msg { display: flex; gap: .75rem; margin-bottom: 1.25rem; }
.chat-msg .av {
  width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 600;
}
.chat-msg.user .av { background: var(--ink); color: #fff; }
.chat-msg.bot .av { background: var(--violet-bg); color: var(--violet); }
.chat-msg .content { flex: 1; min-width: 0; }
.chat-msg .content .who { font-weight: 600; font-size: .82rem; margin-bottom: .25rem; }
.chat-msg .content .text { font-size: .9rem; line-height: 1.65; color: var(--ink); }
.chat-msg .source {
  margin-top: .65rem; padding: .4rem .6rem; background: var(--panel-2);
  border-left: 2px solid var(--violet); font-size: .76rem; color: var(--ink-3);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.chat-input-wrap {
  padding: 1rem 1.5rem 1.5rem; max-width: 800px; margin: 0 auto; width: 100%;
}
.chat-input {
  display: flex; align-items: flex-end; gap: .5rem;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--bg); padding: .55rem .65rem; box-shadow: var(--shadow-sm);
  transition: var(--t-fast);
}
.chat-input:focus-within { border-color: var(--ink-3); box-shadow: 0 0 0 3px var(--ring); }
.chat-input textarea {
  flex: 1; border: 0; padding: .25rem; resize: none; min-height: 24px; max-height: 200px;
  background: transparent; outline: none; font-size: .9rem;
}
.chat-input button {
  height: 30px; width: 30px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--ink); color: #fff; border: 0; border-radius: var(--r);
}
.chat-input button:disabled { opacity: .35; cursor: not-allowed; }

.chat-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 2rem; color: var(--ink-3);
}
.chat-empty .ico {
  width: 56px; height: 56px; border-radius: 50%; background: var(--violet-bg); color: var(--violet);
  display: inline-flex; align-items: center; justify-content: center; margin-bottom: 1rem;
}
.chat-empty h2 { color: var(--ink); margin-bottom: .35rem; }
.chat-empty p { font-size: .9rem; max-width: 42ch; }
.chat-empty .chips { margin-top: 1.5rem; display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }
.chat-empty .chips button {
  border: 1px solid var(--line-strong); background: var(--bg); padding: .45rem .8rem;
  border-radius: var(--r); font-size: .82rem; color: var(--ink-2); cursor: pointer;
}
.chat-empty .chips button:hover { background: var(--panel-2); color: var(--ink); }

/* === Map fake ========================================================== */
.map-shell { display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - var(--topbar-h) - 60px); }
.map-list { background: var(--bg); border-right: 1px solid var(--line); overflow-y: auto; }
.map-list a {
  display: block; padding: .65rem 1rem; border-bottom: 1px solid var(--line);
  font-size: .82rem;
}
.map-list a:hover { background: var(--panel-2); }
.map-canvas {
  position: relative; background:
    linear-gradient(0deg, var(--panel-2) 1px, transparent 1px) 0 0/40px 40px,
    linear-gradient(90deg, var(--panel-2) 1px, transparent 1px) 0 0/40px 40px,
    var(--canvas);
}
.map-pin {
  position: absolute; width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ink); color: #fff; border-radius: 50% 50% 50% 0;
  transform: translate(-50%, -100%) rotate(-45deg);
  font-size: .65rem; font-weight: 600; cursor: pointer;
  box-shadow: 0 4px 8px rgba(0,0,0,.15);
}
.map-pin:hover { background: var(--accent-2); transform: translate(-50%, -100%) rotate(-45deg) scale(1.1); }

/* === Detail page tabs ==================================================*/
.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 1.5rem; }
@media (max-width: 1100px) { .detail-grid { grid-template-columns: 1fr; } }

.tablist { display: flex; gap: 0; border-bottom: 1px solid var(--line); }
.tablist a, .tablist button {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .65rem .85rem; font-size: .85rem; color: var(--ink-3);
  background: transparent; border: 0; border-bottom: 2px solid transparent;
  font-weight: 500; cursor: pointer;
}
.tablist a:hover, .tablist button:hover { color: var(--ink); }
.tablist a.active, .tablist button.active { color: var(--brand); border-bottom-color: var(--brand); }
.tablist .badge { margin-left: .25rem; }

/* === Aside info card =================================================== */
.aside-card {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 1rem 1.1rem; margin-bottom: 1rem;
}
.aside-card h4 {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--ink-3); margin-bottom: .55rem; font-weight: 500;
}
.fact-line {
  display: flex; align-items: center; justify-content: space-between;
  padding: .25rem 0; font-size: .85rem;
}
.fact-line .k { color: var(--ink-3); }
.fact-line .v { font-weight: 500; }

/* === Chips ============================================================ */
.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .25rem .55rem; background: var(--panel-2);
  border-radius: var(--r); font-size: .76rem; color: var(--ink-2);
  border: 1px solid var(--line);
}
.chip-close {
  margin-left: .15rem; padding: 1px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}

/* === Empty / utility ================================================== */
.empty {
  padding: 3rem 2rem; text-align: center; color: var(--ink-3); font-size: .9rem;
}
.empty .icon-xl { color: var(--ink-4); margin-bottom: .65rem; }

.hr { height: 1px; background: var(--line); margin: 1rem 0; border: 0; }
.muted { color: var(--ink-3); }
.tiny { font-size: .76rem; }
.mono { font-family: ui-monospace, "JetBrains Mono", Menlo, monospace; font-size: .82rem; }
.no-wrap { white-space: nowrap; }
.right { text-align: right; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }

/* === Charts (inline SVG) =============================================== */
.chart-y-grid line { stroke: var(--line); stroke-dasharray: 2 4; }
.chart-bar { fill: var(--ink); transition: fill var(--t-fast); }
.chart-bar:hover { fill: var(--accent-2); }
.chart-line { fill: none; stroke: var(--ink); stroke-width: 2; }
.chart-area { fill: rgba(13,13,12,.06); }
.chart-axis text { font-size: 10px; fill: var(--ink-3); }

/* === Donut ============================================================ */
.donut { width: 120px; height: 120px; }
.donut-bg { stroke: var(--panel-2); }
.donut-fg { stroke: var(--ink); stroke-linecap: round; transition: stroke-dashoffset var(--t); }

/* === Tooltips & popovers (Alpine) ====================================== */
[x-cloak] { display: none !important; }

/* === Dropdown menu ==================================================== */
.menu {
  position: absolute; right: 0; top: 100%; margin-top: 4px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-pop); min-width: 220px; padding: .35rem; z-index: 50;
}
.menu a, .menu button {
  display: flex; align-items: center; gap: .55rem; width: 100%;
  padding: .45rem .55rem; border-radius: var(--r-sm);
  font-size: .85rem; color: var(--ink-2); background: transparent; border: 0;
  text-align: left;
}
.menu a:hover, .menu button:hover { background: var(--panel-2); color: var(--ink); }
.menu hr { margin: .35rem 0; border: 0; border-top: 1px solid var(--line); }
.menu .meta { padding: .35rem .55rem; font-size: .76rem; color: var(--ink-3); }

/* === Source badges (integrations) ====================================== */
:root {
  --src-outlook: #0078D4;
  --src-tipee: #16A34A;
  --src-archicad: #EA580C;
  --src-bcn: #1F2937;
  --src-artlogiciel: #6B7280;
  --src-ai: #7B2A85;
  --src-audio: #DC2626;
}

.source-badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: 2px 8px; border-radius: 12px;
  font-size: 11px; font-weight: 500; line-height: 1.55;
  border: 1px solid transparent;
  white-space: nowrap;
}
.source-badge .icon { width: 12px; height: 12px; stroke-width: 2; }
.source-badge__label { font-weight: 500; }
.source-badge__extra { color: var(--ink-3); font-weight: 400; margin-left: 1px; }
.source-badge--sm { padding: 1px 6px; font-size: 10px; }
.source-badge--sm .icon { width: 10px; height: 10px; }

.source-badge--outlook    { background: rgba(0,120,212,.10);   color: var(--src-outlook); }
.source-badge--tipee      { background: rgba(22,163,74,.10);   color: var(--src-tipee); }
.source-badge--archicad   { background: rgba(234,88,12,.10);   color: var(--src-archicad); }
.source-badge--bcn        { background: rgba(31,41,55,.08);    color: var(--src-bcn); }
.source-badge--artlogiciel{ background: rgba(107,114,128,.10); color: var(--src-artlogiciel); }
.source-badge--ai         { background: rgba(123,42,133,.10);  color: var(--src-ai); }
.source-badge--audio      { background: rgba(220,38,38,.10);   color: var(--src-audio); }

.source-badge--outlook .source-badge__extra,
.source-badge--tipee .source-badge__extra,
.source-badge--archicad .source-badge__extra,
.source-badge--bcn .source-badge__extra,
.source-badge--artlogiciel .source-badge__extra,
.source-badge--ai .source-badge__extra,
.source-badge--audio .source-badge__extra { color: var(--ink-3); }

/* === Sélecteur d'univers (topbar) =======================================
   Dropdown entre "Rmoved entreprise" et "Projets / chantiers".
   État stocké côté serveur via middleware (session Django + param ?u=).
======================================================================= */
.univers-selector {
  position: relative;
  flex-shrink: 0;
  margin-right: .5rem;
}
.univers-btn {
  display: inline-flex; align-items: center; gap: .5rem;
  height: 36px; padding: 0 .65rem 0 .5rem;
  background: var(--brand-tint);
  border: 1px solid rgba(123,42,133,.18);
  border-radius: var(--r);
  font-family: inherit; font-size: .82rem; font-weight: 500;
  color: var(--ink); cursor: pointer;
  transition: var(--t-fast);
  min-width: 220px; max-width: 240px;
}
.univers-btn:hover { background: var(--brand-soft); border-color: rgba(123,42,133,.3); }
.univers-btn-icon {
  width: 22px; height: 22px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff;
  border-radius: 5px;
}
.univers-btn-label { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.univers-btn > .icon { color: var(--ink-3); flex-shrink: 0; }

.univers-menu {
  position: absolute; top: calc(100% + 6px); left: 0;
  width: 340px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-pop);
  padding: .35rem; z-index: 60;
}
.univers-option {
  display: flex; align-items: center; gap: .65rem;
  padding: .65rem .55rem; border-radius: var(--r-sm);
  color: var(--ink-2); text-decoration: none;
  transition: var(--t-fast);
}
.univers-option:hover { background: var(--brand-soft); color: var(--ink); }
.univers-option.is-active { background: var(--brand-soft); }
.univers-option-check {
  width: 18px; height: 18px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--brand);
}
.univers-option-icon {
  width: 32px; height: 32px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand);
  border-radius: var(--r-sm);
}
.univers-option.is-active .univers-option-icon { background: var(--brand); color: #fff; }
.univers-option-body { flex: 1; min-width: 0; line-height: 1.25; }
.univers-option-body strong { display: block; font-size: .88rem; color: var(--ink); font-weight: 600; }
.univers-option-body span { display: block; font-size: .72rem; color: var(--ink-3); margin-top: 1px; }

@media (max-width: 1024px) {
  .univers-selector { display: inline-block; flex-shrink: 0; margin-right: .35rem; }
  .univers-btn {
    min-width: 0; width: 36px; height: 36px; padding: 0;
    justify-content: center; gap: 0;
  }
  .univers-btn-label { display: none; }
  .univers-btn > .icon { display: none; }
  .univers-menu {
    left: 0; right: auto;
    width: calc(100vw - 1rem); max-width: 360px;
  }
}

/* Très petits écrans : réduire les paddings du topbar pour ne pas tronquer le sélecteur */
@media (max-width: 480px) {
  .topbar { padding: 0 .5rem; gap: .35rem; }
  .topbar-search kbd { display: none; }
  .topbar-search input { padding-right: .5rem; }
}

/* === Nav items "à venir" (Priorité 2) === */
.nav a.is-soon {
  color: var(--ink-3) !important;
  cursor: not-allowed;
}
.nav a.is-soon .icon:not(.nav-status .icon) { opacity: .55; }
.nav a.is-soon:hover { background: var(--panel-2); color: var(--ink-3); }
.nav-status[data-status="soon"] {
  background: linear-gradient(135deg, #e5e7eb, #d1d5db);
  color: #4b5563;
  box-shadow: none;
  text-transform: none;
  font-size: 8px;
  padding: 1px 5px;
  letter-spacing: .04em;
}
.nav a.active .nav-status[data-status="soon"] {
  background: rgba(255,255,255,.16); color: #fff;
}

/* === Nav status pills (demo / live) ====================================
   Pour distinguer ce qui est encore en démo de ce qui est vraiment branché.
   Pour passer un item en "live", changer data-status="demo" → "live".
======================================================================= */
.nav-status {
  margin-left: auto;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 1px 6px; height: 16px;
  font-size: 9px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; border-radius: 99px;
  flex-shrink: 0; line-height: 1;
}
.nav-status[data-status="demo"] {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #78350f;
  box-shadow: 0 1px 2px rgba(245,158,11,.25);
}
.nav-status[data-status="live"] {
  background: linear-gradient(135deg, #34d399, #10b981);
  color: #064e3b;
  box-shadow: 0 1px 2px rgba(16,185,129,.25);
}
.nav a.active .nav-status[data-status="demo"] {
  background: rgba(255,255,255,.18); color: #fff;
  box-shadow: none;
}
.nav a.active .nav-status[data-status="live"] {
  background: rgba(255,255,255,.22); color: #fff;
  box-shadow: none;
}
/* Quand le sidebar est collapsé, le pill devient un mini-dot */
.app[data-collapsed="true"] .nav-status {
  position: absolute; right: 6px; top: 6px;
  padding: 0; height: 8px; width: 8px;
  text-indent: -9999px; overflow: hidden;
  border-radius: 50%;
}
.nav a { position: relative; }

/* Si l'item a aussi un badge de compteur, on les sépare */
.nav a .badge + .nav-status,
.nav a .nav-status + .badge {
  margin-left: .25rem;
}

/* Bandeau "mode démo" tout en bas du sidebar */
.demo-banner {
  margin: 0; padding: .65rem .85rem;
  background: linear-gradient(135deg, #fef3c7, #fed7aa);
  color: #78350f;
  font-size: .72rem; font-weight: 500; line-height: 1.4;
  border-top: 1px solid rgba(245,158,11,.25);
  display: flex; gap: .55rem; align-items: flex-start;
}
.demo-banner .icon {
  flex-shrink: 0; color: #b45309;
  margin-top: 1px;
}
.demo-banner strong { color: #78350f; }
.app[data-collapsed="true"] .demo-banner { display: none; }

/* === Status pills (topbar live integrations) ============================ */
.status-pills {
  display: flex; align-items: center; gap: .5rem;
  padding-right: .5rem; margin-right: .25rem;
  border-right: 1px solid var(--line);
}
.status-pill {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: 2px 8px; border-radius: 99px;
  font-size: 11px; font-weight: 500;
  color: var(--ink-3); background: var(--panel-2);
  white-space: nowrap;
}
.status-pill .pulse-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: #16A34A;
  animation: pulse-dot 2s cubic-bezier(.4,0,.6,1) infinite;
}
@keyframes pulse-dot {
  0%,100% { opacity: 1; box-shadow: 0 0 0 0 rgba(22,163,74,.4); }
  50%     { opacity: .4; box-shadow: 0 0 0 4px rgba(22,163,74,0); }
}
.status-pill-collapsed { display: none; }
.topbar-sync {
  font-size: 11px; color: var(--ink-3); margin: 0 .5rem 0 0;
  white-space: nowrap;
}
@media (max-width: 1024px) {
  .status-pill { display: none; }
  .status-pill-collapsed { display: inline-flex; }
  .topbar-sync { display: none; }
}

/* === Notifications dropdown (rich) ====================================== */
.notif-menu { width: 360px; padding: .25rem; }
.notif-head {
  padding: .65rem .65rem .5rem;
  display: flex; align-items: center; justify-content: space-between;
  font-size: .82rem; font-weight: 600;
}
.notif-head .muted { font-size: .72rem; font-weight: 500; }
.notif-item {
  display: flex; gap: .65rem; padding: .65rem;
  border-radius: var(--r-sm); align-items: flex-start;
  text-decoration: none; color: inherit;
}
.notif-item + .notif-item { border-top: 1px solid var(--line); border-radius: 0; }
.notif-item:hover { background: var(--panel-2); }
.notif-icon {
  width: 30px; height: 30px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
}
.notif-icon--red    { background: var(--danger-bg); color: var(--danger); }
.notif-icon--orange { background: var(--warn-bg);   color: var(--warn); }
.notif-icon--green  { background: var(--ok-bg);     color: var(--ok); }
.notif-icon--blue   { background: var(--info-bg);   color: var(--info); }
.notif-icon--violet { background: var(--brand-soft); color: var(--brand); }
.notif-body { flex: 1; min-width: 0; }
.notif-title {
  font-size: .82rem; font-weight: 600; line-height: 1.3;
  color: var(--ink);
}
.notif-sub {
  font-size: .76rem; color: var(--ink-3); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notif-time {
  font-size: .7rem; color: var(--ink-4); margin-top: 2px;
}

/* === Sources connectées card =========================================== */
.sources-list { display: flex; flex-direction: column; gap: .55rem; }
.source-line {
  display: flex; align-items: center; gap: .65rem;
  font-size: .82rem; color: var(--ink-2);
}
.source-line .src-ico {
  width: 26px; height: 26px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm); background: var(--panel-2);
}
.source-line .src-ico--outlook    { background: rgba(0,120,212,.10);   color: var(--src-outlook); }
.source-line .src-ico--tipee      { background: rgba(22,163,74,.10);   color: var(--src-tipee); }
.source-line .src-ico--archicad   { background: rgba(234,88,12,.10);   color: var(--src-archicad); }
.source-line .src-ico--bcn        { background: rgba(31,41,55,.08);    color: var(--src-bcn); }
.source-line .src-ico--ai         { background: rgba(123,42,133,.10);  color: var(--src-ai); }
.source-line .src-ico--brand      { background: transparent; padding: 0; color: var(--src-outlook); }
.source-line .src-ico--brand .icon { width: 22px; height: 22px; border-radius: 5px; }
.source-line .src-name { flex: 1; }
.source-line .src-info { color: var(--ink-3); font-size: .78rem; }

/* === Holding selector (Phase 7 teaser) ================================= */
.holding-selector {
  position: relative; padding: .5rem;
  border-bottom: 1px solid var(--line);
  background: var(--canvas);
}
.holding-btn {
  display: flex; align-items: center; gap: .5rem; width: 100%;
  padding: .5rem .65rem; background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--r);
  font-family: inherit; text-align: left; cursor: pointer;
  transition: var(--t-fast); color: var(--ink);
}
.holding-btn:hover { border-color: var(--ink-3); }
.holding-btn .body { flex: 1; min-width: 0; }
.holding-btn .name {
  font-size: .82rem; font-weight: 600; line-height: 1.2;
  color: var(--brand);
}
.holding-btn .sub {
  font-size: .72rem; color: var(--ink-3); line-height: 1.2; margin-top: 1px;
}
.holding-btn .icon-toggle { color: var(--ink-3); flex-shrink: 0; }

.holding-menu {
  position: absolute; top: 100%; left: .5rem; right: .5rem;
  margin-top: 4px; padding: 0; z-index: 60;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-pop);
  overflow: hidden;
}
.holding-menu-head {
  padding: .65rem .8rem; background: var(--brand);
  color: #fff; font-size: .78rem; font-weight: 600;
}
.holding-menu-head .sub {
  font-size: .68rem; opacity: .8; margin-top: 1px; font-weight: 400;
}
.holding-item {
  display: flex; align-items: center; gap: .55rem;
  padding: .6rem .8rem; font-size: .82rem;
  border-bottom: 1px solid var(--line);
}
.holding-item:last-of-type { border-bottom: 0; }
.holding-item .ind {
  width: 16px; height: 16px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.holding-item.is-active .ind { color: var(--ok); }
.holding-item.is-disabled { color: var(--ink-4); cursor: default; }
.holding-item.is-disabled .ind { color: var(--ink-disabled); }
.holding-item .body { flex: 1; }
.holding-item .name { font-weight: 500; }
.holding-item .where { font-size: .72rem; color: var(--ink-3); }
.holding-item.is-active .where { color: var(--ok); font-weight: 500; }
.holding-item.is-disabled .where { color: var(--ink-4); font-style: italic; }

.holding-foot {
  padding: .55rem .8rem; background: var(--brand-soft);
  color: var(--brand); font-size: .8rem; font-weight: 600;
  display: flex; align-items: center; gap: .5rem; cursor: pointer;
  border-top: 1px solid var(--line);
}
.holding-foot:hover { background: var(--brand-tint); }

@media (max-width: 900px) {
  .holding-selector { display: none; }
}

/* === Mini integration icons inside table rows =========================== */
.row-src {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  margin-left: .35rem; vertical-align: middle;
}
.row-src .icon { width: 11px; height: 11px; stroke-width: 2; }
.row-src--bcn { background: rgba(31,41,55,.08); color: var(--src-bcn); }
.row-src--outlook { background: rgba(0,120,212,.10); color: var(--src-outlook); }
.row-src--brand { background: transparent; color: var(--src-outlook); }
.row-src--brand .icon { width: 14px; height: 14px; border-radius: 3px; }

/* Brand icon inside the small notification circle (notif-icon--blue) — keep
   the round container but let the brand tile sit centred without competing. */
.notif-icon--blue .icon { width: 18px; height: 18px; border-radius: 4px; }

/* Brand outlook badge in the source-badge component: render at slightly
   larger size and with a tiny rounded box so the white "O" stays readable. */
.source-badge--outlook .icon { width: 14px; height: 14px; border-radius: 3px; }
.source-badge--outlook { padding-left: 4px; }

/* === Drag & drop (SortableJS) ========================================== */
.kanban-col-body { min-height: 80px; }
.kanban-card { cursor: grab; user-select: none; -webkit-user-drag: element; }
.kanban-card:active { cursor: grabbing; }
.kanban-card a { -webkit-user-drag: none; user-drag: none; }

.sortable-ghost {
  opacity: .35;
  background: var(--brand-soft) !important;
  border: 1px dashed var(--brand) !important;
}
.sortable-chosen { box-shadow: 0 8px 24px rgba(13,13,12,.18); }
.sortable-drag {
  cursor: grabbing !important;
  transform: rotate(1.5deg);
  box-shadow: 0 16px 32px rgba(13,13,12,.22) !important;
  opacity: 1 !important;
}
.kanban-col.is-drop-target {
  background: var(--brand-tint);
  outline: 2px dashed var(--brand);
  outline-offset: -3px;
}

.kanban-card .drag-handle {
  position: absolute; top: .5rem; right: .5rem;
  color: var(--ink-4); opacity: 0; transition: opacity var(--t-fast);
  pointer-events: none;
}
.kanban-card:hover .drag-handle { opacity: 1; }
.kanban-card { position: relative; }

/* === Tarea A1: Fiche client ============================================ */
.avatar-lg {
  width: 48px; height: 48px; font-size: 1rem; flex-shrink: 0;
  background: var(--brand); color: #fff;
}
.avatar-primary { background: var(--brand); color: #fff; }

.ai-banner {
  display: flex; gap: .85rem; padding: 1rem 1.1rem;
  background: var(--brand-soft); border: 1px solid rgba(123,42,133,.15);
  border-radius: var(--r-md); margin-bottom: 1rem;
}
.ai-banner .ai-icon {
  width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff;
}
.ai-banner .ai-title {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .1em;
  font-weight: 600; color: var(--brand-strong); margin-bottom: .25rem;
}
.ai-banner .ai-text {
  font-size: .9rem; color: var(--ink); line-height: 1.55;
}
.ai-banner .ai-tag {
  background: #fff; border: 1px solid rgba(123,42,133,.25);
  color: var(--brand-strong); font-weight: 500;
}

.dot-sentiment {
  display: inline-block; width: 7px; height: 7px;
  border-radius: 50%; margin-left: .35rem; vertical-align: middle;
}
.dot-positif { background: var(--ok); }
.dot-negatif { background: var(--danger); }
.dot-neutre  { background: var(--ink-4); }

.person-row {
  display: flex; align-items: center; gap: .65rem;
  padding: .55rem 0; border-bottom: 1px solid var(--line);
}
.person-row:last-child { border-bottom: 0; }
.person-row .body { flex: 1; min-width: 0; }

.doc-card {
  padding: 1rem; transition: var(--t-fast); cursor: pointer;
  display: flex; flex-direction: column; gap: .25rem;
}
.doc-card:hover { border-color: var(--ink-3); transform: translateY(-1px); }
.doc-card .doc-icon {
  width: 36px; height: 36px; border-radius: var(--r-sm);
  background: var(--brand-soft); color: var(--brand);
  display: inline-flex; align-items: center; justify-content: center;
}

/* === Plans & documents — toolbar et sections par catégorie ============== */
.doc-toolbar {
  display: flex; flex-wrap: wrap; gap: .4rem;
  margin-bottom: 1.25rem;
  padding: .35rem; background: var(--panel-2); border-radius: var(--r-md);
  border: 1px solid var(--line);
}
.doc-tab {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .75rem; border: 1px solid transparent; background: transparent;
  border-radius: var(--r-sm); font-size: .82rem; font-weight: 500;
  color: var(--ink-2); cursor: pointer; transition: var(--t-fast);
}
.doc-tab:hover { background: var(--panel); color: var(--ink); }
.doc-tab.active {
  background: var(--panel); color: var(--ink); font-weight: 600;
  border-color: var(--line); box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.doc-tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.25rem; height: 1.1rem; padding: 0 .35rem;
  background: var(--panel-2); color: var(--ink-3);
  border-radius: 999px; font-size: .7rem; font-weight: 600;
}
.doc-tab.active .doc-tab-count { background: var(--brand-soft); color: var(--brand-strong); }

.doc-section { margin-bottom: 1.5rem; }
.doc-section-head {
  display: flex; align-items: center; gap: .55rem;
  margin: 0 0 .75rem; padding: .15rem 0;
}
.doc-section-head h3 {
  margin: 0; font-size: .92rem; font-weight: 600; letter-spacing: -.005em;
}
.doc-section-head .muted { margin-left: auto; }
.doc-section-icon {
  width: 26px; height: 26px; border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center;
}

/* Couleurs par catégorie (icône + bord) */
.cat-archi  .doc-section-icon, .cat-archi  .doc-card .doc-icon { background: rgba(234,88,12,.10); color: #ea580c; }
.cat-ing    .doc-section-icon, .cat-ing    .doc-card .doc-icon { background: rgba(59,130,246,.10); color: #2563eb; }
.cat-tech   .doc-section-icon, .cat-tech   .doc-card .doc-icon { background: rgba(168,88,173,.10); color: #a458ad; }
.cat-admin  .doc-section-icon, .cat-admin  .doc-card .doc-icon { background: rgba(100,116,139,.12); color: #475569; }
.cat-devis  .doc-section-icon, .cat-devis  .doc-card .doc-icon { background: var(--brand-soft);     color: var(--brand); }
.cat-photo  .doc-section-icon, .cat-photo  .doc-card .doc-icon { background: rgba(22,163,74,.10);   color: #16a34a; }

.doc-toolbar .doc-tab.cat-archi.active { box-shadow: inset 0 -2px 0 #ea580c; }
.doc-toolbar .doc-tab.cat-ing.active   { box-shadow: inset 0 -2px 0 #2563eb; }
.doc-toolbar .doc-tab.cat-tech.active  { box-shadow: inset 0 -2px 0 #a458ad; }
.doc-toolbar .doc-tab.cat-admin.active { box-shadow: inset 0 -2px 0 #475569; }
.doc-toolbar .doc-tab.cat-devis.active { box-shadow: inset 0 -2px 0 var(--brand); }
.doc-toolbar .doc-tab.cat-photo.active { box-shadow: inset 0 -2px 0 #16a34a; }

.doc-card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .5rem;
}
.doc-versions {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .15rem .45rem; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-strong);
  font-size: .7rem; font-weight: 600;
}
.doc-name {
  font-weight: 600; font-size: .9rem; line-height: 1.3;
  margin-bottom: .15rem; color: var(--ink);
}
.doc-meta { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.doc-author {
  display: inline-flex; align-items: center; gap: .3rem; margin-top: .15rem;
}
.doc-history-toggle {
  display: inline-flex; align-items: center; gap: .25rem;
  margin-top: .55rem; padding: .25rem .5rem;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); font-size: .72rem; color: var(--ink-2);
  cursor: pointer; transition: var(--t-fast);
  align-self: flex-start;
}
.doc-history-toggle:hover { background: var(--panel); color: var(--ink); }
.doc-history-toggle.open svg { transform: rotate(180deg); }
.doc-history-toggle svg { transition: transform .15s; }
.doc-history {
  list-style: none; margin: .55rem 0 0; padding: .35rem .5rem;
  background: var(--panel-2); border-radius: var(--r-sm); border: 1px solid var(--line);
}
.doc-history-row {
  display: flex; align-items: center; gap: .5rem;
  padding: .3rem .15rem; border-bottom: 1px dashed var(--line);
  font-size: .76rem;
}
.doc-history-row:last-child { border-bottom: 0; }
.doc-history-row .icon-btn { margin-left: auto; }

.doc-card-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto; padding-top: .65rem;
}

.badge.outline {
  background: transparent; border: 1px solid var(--line); color: var(--ink-2);
  font-weight: 600;
}

.activity-item .ico-email { background: rgba(0,120,212,.10); color: var(--src-outlook); }
.activity-item .ico-call { background: rgba(22,163,74,.10); color: var(--src-tipee); }
.activity-item .ico-meeting { background: var(--brand-soft); color: var(--brand); }
.activity-item .ico-note { background: var(--panel-2); color: var(--ink-3); }

/* === Tarea A3: Heures multi-vista ====================================== */
.cal-grid {
  display: grid; grid-template-columns: 50px repeat(7, 1fr);
  border-top: 1px solid var(--line);
}
.cal-hours-col {
  border-right: 1px solid var(--line); background: var(--panel-2);
  display: flex; flex-direction: column;
  padding-top: 32px; /* aligne avec le head des jours */
}
.cal-hour-tick {
  flex: 1; padding: 0 .35rem; font-size: .7rem; color: var(--ink-3);
  border-bottom: 1px dashed var(--line); min-height: 50px;
}
.cal-hour-tick:last-child { border-bottom: 0; }
.cal-day {
  border-right: 1px solid var(--line); position: relative;
  display: flex; flex-direction: column;
}
.cal-day:last-child { border-right: 0; }
.cal-day-head {
  padding: .5rem .65rem; font-size: .82rem; border-bottom: 1px solid var(--line);
  background: var(--bg); display: flex; flex-direction: column; gap: 1px;
}
.cal-day-head.weekend { background: var(--panel-2); color: var(--ink-3); }
.cal-day-head .muted { font-size: .72rem; color: var(--ink-3); }
.cal-day-body {
  position: relative; flex: 1; min-height: 550px;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 49px, var(--line) 49px, var(--line) 50px);
}
.cal-block {
  position: absolute; left: 4px; right: 4px;
  padding: .35rem .5rem; border-radius: var(--r-sm); color: #fff;
  font-size: .72rem; line-height: 1.25;
  box-shadow: 0 1px 2px rgba(0,0,0,.1); cursor: pointer;
  display: flex; flex-direction: column; gap: 1px;
  overflow: hidden; transition: transform var(--t-fast);
}
.cal-block:hover { transform: scale(1.02); z-index: 5; }
.cal-block strong { font-weight: 700; font-size: .72rem; }
.cal-block-h { font-size: .68rem; opacity: .85; }
.cal-block-desc { font-size: .68rem; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Heatmap */
.heatmap-wrap {
  display: flex; flex-direction: column; gap: 4px;
}
.heatmap-labels {
  display: grid; grid-template-columns: 60px repeat(7, 1fr); gap: 4px;
  padding-left: 0; text-align: center;
}
.heatmap-row {
  display: grid; grid-template-columns: 60px repeat(7, 1fr); gap: 4px; align-items: center;
}
.heatmap-week-label { padding-left: .5rem; }
.heatmap-cell {
  aspect-ratio: 1.4 / 1; min-height: 36px;
  border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 600; cursor: pointer;
  transition: transform var(--t-fast);
  background: var(--panel-2); color: var(--ink-3);
}
.heatmap-cell:hover { transform: scale(1.06); }
.heatmap-cell[data-h="none"] { background: var(--panel-2); color: var(--ink-disabled); }
.heatmap-cell[data-h="low"]  { background: #fef3c7; color: #92400e; }
.heatmap-cell[data-h="mid"]  { background: #bbf7d0; color: #14532d; }
.heatmap-cell[data-h="high"] { background: #fed7aa; color: #7c2d12; }
.heatmap-cell[data-h="over"] { background: #fecaca; color: #7f1d1d; }
.hm-key { display:inline-block; width:14px; height:14px; border-radius:3px; }
.hm-key[data-h="none"] { background: var(--panel-2); }
.hm-key[data-h="low"]  { background: #fef3c7; }
.hm-key[data-h="mid"]  { background: #bbf7d0; }
.hm-key[data-h="high"] { background: #fed7aa; }
.hm-key[data-h="over"] { background: #fecaca; }

/* Capacity grid */
.cap-grid { width: 100%; border-collapse: separate; border-spacing: 4px; }
.cap-grid th { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); padding: .35rem; text-align: center; font-weight: 500; }
.cap-grid th:first-child { text-align: left; padding-left: 0; }
.cap-grid td { padding: .35rem; }
.cap-grid td:first-child { padding-left: 0; }
.cap-cell {
  text-align: center; padding: .55rem .35rem; border-radius: var(--r-sm);
  font-size: .78rem; cursor: pointer; transition: transform var(--t-fast);
}
.cap-cell:hover { transform: scale(1.04); }
.cap-cell[data-load="low"]  { background: #d1fae5; color: #065f46; }
.cap-cell[data-load="mid"]  { background: #fef9c3; color: #713f12; }
.cap-cell[data-load="high"] { background: #fed7aa; color: #7c2d12; }
.cap-cell[data-load="over"] { background: #fecaca; color: #7f1d1d; font-weight: 700; }
.cap-key { display:inline-block; width:14px; height:14px; border-radius:3px; }
.cap-key[data-load="low"]  { background: #d1fae5; }
.cap-key[data-load="mid"]  { background: #fef9c3; }
.cap-key[data-load="high"] { background: #fed7aa; }
.cap-key[data-load="over"] { background: #fecaca; }

/* === Tarea B1: Appels d'offres ========================================= */
.ao-score {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; padding: 2px 6px;
  font-size: .75rem; font-weight: 700; border-radius: var(--r-sm);
}
.ao-score[data-score="high"] { background: var(--ok-bg); color: var(--ok); }
.ao-score[data-score="mid"]  { background: var(--warn-bg); color: var(--warn); }
.ao-score[data-score="low"]  { background: var(--panel-2); color: var(--ink-3); }

/* === Tarea B2: Procédures =============================================== */
.proc-cat-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .45rem 1rem; font-size: .82rem; color: var(--ink-2); cursor: pointer;
  transition: background var(--t-fast);
}
.proc-cat-item:hover { background: var(--panel-2); color: var(--ink); }
.proc-cat-item.active { background: var(--brand-soft); color: var(--brand-strong); font-weight: 600; }
.proc-cat-item .count {
  margin-left: auto; font-size: .72rem; color: var(--ink-3);
  background: var(--panel-2); padding: 0 6px; border-radius: 99px;
}
.proc-cat-item.active .count { background: var(--brand); color: #fff; }

/* === Tarea A4: Chart.js === */
.chart-legend-swatch {
  display: inline-block; width: 12px; height: 6px; border-radius: 2px; margin-right: .35rem;
  vertical-align: middle;
}

/* === Dashboard charts — couche partagée (tooltip externe, toggles, donut-legend, drills) === */
/* (1) Tooltip externe partagé aubergine */
.chart-tip {
  position: absolute; pointer-events: none; z-index: 20;
  background: var(--ink); color: #fff;
  border: 1px solid rgba(255,255,255,.06); border-radius: var(--r-md);
  box-shadow: var(--shadow-pop);
  padding: .55rem .65rem; font-size: .76rem; line-height: 1.35; min-width: 150px;
  opacity: 0; transition: opacity .12s, transform .12s; transform: translateY(2px);
}
.chart-tip.is-on { opacity: 1; transform: none; }
.chart-tip__title { font-weight: 600; margin-bottom: .3rem; }
.chart-tip__row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.chart-tip__row .k { display: flex; align-items: center; gap: .4rem; color: var(--ink-4); }
.chart-tip__sw { width: 8px; height: 8px; border-radius: 2px; flex: 0 0 auto; }
.chart-tip__v { font-variant-numeric: tabular-nums; font-weight: 600; }
.chart-tip__cta {
  margin-top: .4rem; padding-top: .35rem; border-top: 1px solid rgba(255,255,255,.1);
  color: var(--brand-soft); font-size: .72rem;
}
.chart-tip__badge {
  display: inline-block; margin-top: .35rem; padding: 0 6px; border-radius: 99px;
  background: var(--brand-soft); color: var(--brand-strong); font-size: .68rem; font-weight: 600;
}

/* (2) Wrapper d'ancrage + leyenda-toggle */
.chart-wrap { position: relative; }
.chart-legend-toggle { cursor: pointer; user-select: none; transition: opacity .15s; }
.chart-legend-toggle.is-off { opacity: .4; }
.chart-legend-toggle.is-off .chart-legend-swatch { filter: grayscale(1); }

/* (3) Mini-leyenda cliquable des donuts */
.donut-legend {
  display: flex; flex-direction: column; gap: .3rem;
  margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--line);
}
.donut-legend a {
  display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: .55rem;
  font-size: .82rem; color: var(--ink-2); text-decoration: none;
  padding: .15rem .25rem; border-radius: var(--r-sm);
}
.donut-legend a:hover { background: var(--panel-2); color: var(--ink); }
.donut-legend .dl-dot { width: 10px; height: 10px; border-radius: 3px; }
.donut-legend .dl-val { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

/* (4) .repart-item cliquable (conserve son grid 4 colonnes) */
.repart-item { cursor: default; }
.repart-item.is-linked { cursor: pointer; border-radius: var(--r-sm); transition: background .12s; }
.repart-item.is-linked:hover,
.repart-item.is-linked-hot { background: var(--panel-2); }
.repart-item a.repart-link { display: contents; text-decoration: none; color: inherit; }

/* (5) Filet d'univers (signal sobre, nuances --brand / --brand-strong) */
.universe-fil { border-top: 3px solid var(--brand); margin: -1px 0 1rem; }
.universe-fil--chantiers { border-top-color: var(--brand-strong); }

/* (6) Ruban honnête pour données démo / estimation */
.data-ribbon {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .68rem; color: var(--ink-4); background: var(--panel-2);
  border-radius: 99px; padding: 1px 8px;
}

/* Liens de drill du pied de carte #ch1 (phases) */
.card-body a:hover .num,
.card-body > div > div > a:hover { color: var(--brand-strong); }

/* === PV detail premium : distribution + objections + audit log ========= */
.pv-stats-bar {
  display: flex; align-items: stretch; gap: 1.25rem;
  padding: 1rem 1.25rem;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r-md);
  flex-wrap: wrap;
}
.pv-stat {
  display: flex; flex-direction: column; gap: 2px;
  flex: 1; min-width: 110px;
}
.pv-stat-value {
  font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; line-height: 1;
  color: var(--ink);
}
.pv-stat-value.muted { color: var(--ink-3); font-weight: 600; }
.pv-stat-label {
  font-size: .72rem; color: var(--ink-3); font-weight: 500;
  display: inline-flex; align-items: center; gap: .25rem;
}
.pv-stat-bar {
  display: block; height: 4px; margin-top: .35rem;
  background: var(--panel-2); border-radius: 99px; overflow: hidden;
}
.pv-stat-bar > span {
  display: block; height: 100%; border-radius: 99px;
  transition: width 600ms cubic-bezier(.2,.8,.2,1);
}
.pv-stat-sep {
  width: 1px; background: var(--line); align-self: stretch;
}
.pv-public-link { margin-top: .35rem; }

/* Distribution / destinataires */
.dest-row {
  display: grid;
  grid-template-columns: 36px 1fr 360px auto;
  gap: 1rem; align-items: center;
  padding: .75rem 1.25rem; border-bottom: 1px solid var(--line);
  transition: background var(--t-fast);
}
.dest-row:last-child { border-bottom: 0; }
.dest-row:hover { background: var(--panel-2); }
.dest-row[data-statut="refuse"] { background: rgba(182,32,28,.04); }
.dest-row[data-statut="signe"]  { background: rgba(19,122,58,.03); }

.dest-avatar { font-size: .72rem; }
.dest-avatar[data-statut="signe"]  { background: var(--ok); }
.dest-avatar[data-statut="lu"]     { background: var(--info); }
.dest-avatar[data-statut="refuse"] { background: var(--danger); }
.dest-avatar[data-statut="envoye"] { background: var(--ink-3); }

.dest-main { min-width: 0; }

.dest-timeline {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 0; position: relative;
}
.dest-timeline::before {
  content: ""; position: absolute;
  left: 14px; right: 14px; top: 13px;
  height: 2px; background: var(--line); z-index: 0;
}
.dest-step {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; gap: 2px; align-items: center;
}
.dest-step-dot {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--line);
  color: var(--ink-4);
  display: inline-flex; align-items: center; justify-content: center;
}
.dest-step-text {
  text-align: center; font-size: .7rem; line-height: 1.2;
  color: var(--ink-3); font-weight: 500;
}
.dest-step-text small { font-size: .65rem; color: var(--ink-4); display: block; }
.dest-step.is-done .dest-step-dot {
  background: var(--ok); border-color: var(--ok); color: #fff;
}
.dest-step.is-done .dest-step-text { color: var(--ok); }
.dest-step.is-rejected .dest-step-dot {
  background: var(--danger); border-color: var(--danger); color: #fff;
}
.dest-step.is-rejected .dest-step-text { color: var(--danger); }

.dest-actions { display: flex; gap: .25rem; }

@media (max-width: 1100px) {
  .dest-row { grid-template-columns: 36px 1fr; }
  .dest-timeline { grid-column: 1 / -1; margin-top: .5rem; }
  .dest-actions { grid-column: 1 / -1; justify-content: flex-end; }
}

/* Objections */
.obj-card { border-left: 3px solid var(--danger); }
.obj-card[data-statut="traite"] { border-left-color: var(--ok); }
.obj-card[data-statut="rejete"] { border-left-color: var(--ink-3); }
.obj-msg {
  background: var(--panel-2); padding: .75rem .85rem;
  border-radius: var(--r-sm); font-size: .9rem; line-height: 1.55;
  color: var(--ink); border-left: 2px solid var(--danger);
}
.obj-reponse {
  margin-top: .85rem; padding: .75rem .85rem;
  background: var(--brand-soft); border-radius: var(--r-sm);
  border-left: 2px solid var(--brand);
  font-size: .9rem; line-height: 1.55;
}
.obj-reply-form {
  margin-top: .85rem;
  border-top: 1px solid var(--line); padding-top: .85rem;
}

/* Audit log */
.audit-log { list-style: none; margin: 0; padding: 0; }
.audit-item {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 1rem; padding: .85rem 1.25rem;
  border-bottom: 1px solid var(--line);
  align-items: flex-start;
  position: relative;
}
.audit-item:last-child { border-bottom: 0; }
.audit-item:not(:last-child)::before {
  content: ""; position: absolute;
  left: 33px; top: 38px; bottom: 0;
  width: 2px; background: var(--line); z-index: 0;
}
.audit-dot {
  width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  position: relative; z-index: 1;
  background: var(--panel-2); color: var(--ink-3);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--line);
}
.audit-dot[data-color="green"]  { background: var(--ok-bg);     color: var(--ok); }
.audit-dot[data-color="red"]    { background: var(--danger-bg); color: var(--danger); }
.audit-dot[data-color="blue"]   { background: var(--info-bg);   color: var(--info); }
.audit-dot[data-color="violet"] { background: var(--brand-soft); color: var(--brand); }
.audit-dot[data-color="orange"] { background: var(--warn-bg);   color: var(--warn); }
.audit-body { min-width: 0; }
.audit-title { font-size: .9rem; font-weight: 500; line-height: 1.3; color: var(--ink); }
.audit-sub { margin-top: 2px; }


/* === Gantt v3 — refonte premium =========================================
   Beau, lisible, moderne. Une seule barre par phase avec fill = avancement.
   Compatible avec le slide-in panel existant.
======================================================================== */
.ganttv3 {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.ganttv3-toolbar {
  display: flex; align-items: center; gap: .85rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(to bottom, #ffffff, var(--canvas));
}
.ganttv3-icon-square {
  width: 36px; height: 36px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand-soft), var(--brand-tint));
  color: var(--brand);
  flex-shrink: 0;
}

.ganttv3-legend {
  display: flex; gap: 1.25rem; flex-wrap: wrap;
  padding: .55rem 1.25rem; background: var(--canvas);
  font-size: .76rem; color: var(--ink-3); border-bottom: 1px solid var(--line);
}
.ganttv3-leg-dot {
  display: inline-block; width: 14px; height: 6px; border-radius: 99px;
  margin-right: .35rem; vertical-align: middle;
}
.ganttv3-leg-dot[data-statut="atteint"]  { background: linear-gradient(90deg, #16a34a, #15803d); }
.ganttv3-leg-dot[data-statut="en_cours"] { background: linear-gradient(90deg, var(--brand), var(--brand-strong)); }
.ganttv3-leg-dot[data-statut="en_retard"]{ background: linear-gradient(90deg, #dc2626, #991b1b); }
.ganttv3-leg-dot[data-statut="a_venir"]  {
  background: repeating-linear-gradient(45deg, var(--ink-disabled) 0 4px, var(--bg) 4px 8px);
  border: 1px solid var(--line-strong);
}
.ganttv3-leg-flag {
  display: inline-block; width: 14px; height: 14px; border-radius: 50%;
  background: var(--brand); color: #fff; vertical-align: middle;
  margin-right: .35rem;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(123,42,133,.25);
}
.ganttv3-leg-today {
  display: inline-block; width: 2px; height: 14px;
  background: var(--brand); vertical-align: middle;
  margin-right: .35rem;
}

/* === Frame : header + body, partagent un même grid de 240px + 1fr === */
.ganttv3-frame { position: relative; }

.ganttv3-head {
  display: grid; grid-template-columns: 240px 1fr;
  background: linear-gradient(to bottom, var(--bg), var(--panel-2));
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.ganttv3-head-corner {
  display: flex; align-items: center; padding: 0 1.25rem;
  height: 48px;
  border-right: 1px solid var(--line);
  font-size: .68rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--ink-3); font-weight: 600;
}
.ganttv3-head-axis {
  position: relative; height: 48px;
}
.ganttv3-month {
  position: absolute; top: 0; bottom: 0;
  display: flex; align-items: center;
  padding-left: 10px;
  font-size: .7rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-3); font-weight: 600;
  white-space: nowrap;
}
.ganttv3-month::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 1px; background: var(--line-strong);
}
.ganttv3-today-flag {
  position: absolute; top: 4px;
  transform: translateX(-50%);
  z-index: 4; pointer-events: none;
}
.ganttv3-today-flag span {
  display: inline-block;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  color: #fff; font-size: .68rem; font-weight: 700;
  padding: 3px 10px; border-radius: 99px;
  letter-spacing: .04em;
  box-shadow: 0 4px 12px rgba(123,42,133,.4),
              0 0 0 3px rgba(123,42,133,.12);
  white-space: nowrap;
  text-transform: uppercase;
}
.ganttv3-today-flag::after {
  content: ""; position: absolute; left: 50%; bottom: -7px;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid var(--brand-strong);
}

/* === Body === */
.ganttv3-body { position: relative; background: var(--bg); }

/* Grid lines + today line, overlay pure */
.ganttv3-vlines {
  position: absolute; left: 240px; right: 0; top: 0; bottom: 0;
  pointer-events: none; z-index: 0;
}
.ganttv3-vline {
  position: absolute; top: 0; bottom: 0;
  width: 1px; background: var(--line);
  opacity: .6;
}
.ganttv3-today-line {
  position: absolute; top: 0; bottom: 0;
  width: 2px; background: linear-gradient(to bottom, var(--brand), var(--brand-strong));
  opacity: .9;
  box-shadow: 0 0 0 4px rgba(123,42,133,.06);
  z-index: 2;
}

/* Phase rows */
.ganttv3-row {
  display: grid; grid-template-columns: 240px 1fr;
  height: 68px;
  border-bottom: 1px solid var(--line);
  position: relative;
  cursor: pointer;
  transition: background var(--t-fast);
}
.ganttv3-row:last-child { border-bottom: 0; }
.ganttv3-row:nth-child(even) { background: rgba(0,0,0,.012); }
.ganttv3-row:hover {
  background: var(--brand-tint);
  z-index: 3;
}
.ganttv3-row.is-selected {
  background: var(--brand-soft);
  box-shadow: inset 3px 0 0 var(--brand);
}

.ganttv3-label {
  display: flex; align-items: center; gap: 12px;
  padding: 0 1rem;
  border-right: 1px solid var(--line);
  background: inherit;
  position: sticky; left: 0; z-index: 1;
  min-width: 0;
}
.ganttv3-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform var(--t-fast);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.ganttv3-icon[data-statut="atteint"]  {
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  color: #15803d;
}
.ganttv3-icon[data-statut="en_cours"] {
  background: linear-gradient(135deg, var(--brand-soft), #e0bef0);
  color: var(--brand);
}
.ganttv3-icon[data-statut="en_retard"]{
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  color: var(--danger);
}
.ganttv3-icon[data-statut="a_venir"]  {
  background: linear-gradient(135deg, var(--panel-2), #e7e7e2);
  color: var(--ink-3);
}
.ganttv3-row:hover .ganttv3-icon { transform: scale(1.06); }

.ganttv3-label-text {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.ganttv3-label-text strong {
  font-size: .9rem; line-height: 1.2; color: var(--ink); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: -.005em;
}
.ganttv3-label-text span {
  font-size: .72rem; color: var(--ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.ganttv3-pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 28px; height: 24px; padding: 0 8px;
  font-size: .7rem; font-weight: 700; border-radius: 99px;
  flex-shrink: 0;
}
.ganttv3-pill .icon { width: 12px; height: 12px; }
.ganttv3-pill[data-statut="atteint"]  { background: var(--ok-bg); color: var(--ok); }
.ganttv3-pill[data-statut="en_cours"] { background: var(--brand-soft); color: var(--brand); }
.ganttv3-pill[data-statut="en_retard"]{ background: var(--danger-bg); color: var(--danger); }
.ganttv3-pill[data-statut="a_venir"]  { background: var(--panel-2); color: var(--ink-3); }

.ganttv3-track {
  position: relative; height: 100%;
}

/* Bar */
.ganttv3-bar {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  height: 36px;
  border-radius: 18px;
  overflow: hidden;
  z-index: 1;
  cursor: pointer;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}

/* Background of bar = light status-tinted color */
.ganttv3-bar[data-statut="atteint"]  {
  background: linear-gradient(180deg, #ecfdf5, #d1fae5);
  border: 1px solid rgba(22,163,74,.25);
}
.ganttv3-bar[data-statut="en_cours"] {
  background: linear-gradient(180deg, var(--brand-tint), var(--brand-soft));
  border: 1px solid rgba(123,42,133,.22);
}
.ganttv3-bar[data-statut="en_retard"]{
  background: linear-gradient(180deg, #fef2f2, #fee2e2);
  border: 1px solid rgba(220,38,38,.25);
}
.ganttv3-bar[data-statut="a_venir"]  {
  background:
    repeating-linear-gradient(45deg,
      rgba(0,0,0,.025) 0 6px,
      rgba(0,0,0,0)   6px 12px),
    var(--panel-2);
  border: 1px dashed var(--line-strong);
}

.ganttv3-bar:hover {
  transform: translateY(calc(-50% - 2px));
  box-shadow: 0 6px 18px rgba(123,42,133,.20),
              0 0 0 1px rgba(123,42,133,.15);
}

/* Fill = avancement (overlay rempli) */
.ganttv3-fill {
  position: absolute; top: 0; left: 0; bottom: 0;
  border-radius: 17px;
  z-index: 0;
  transition: width 600ms cubic-bezier(.2,.8,.2,1);
}
.ganttv3-fill[data-statut="atteint"]  {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}
.ganttv3-fill[data-statut="en_cours"] {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%);
}
.ganttv3-fill[data-statut="en_retard"]{
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
}
.ganttv3-fill[data-statut="a_venir"]  { background: transparent; }

/* Bar content (name + percent) */
.ganttv3-bar-content {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 .85rem;
  z-index: 1; pointer-events: none;
}
.ganttv3-bar-name {
  font-size: .78rem; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0,0,0,.25);
  letter-spacing: -.005em;
  flex: 1; min-width: 0;
  /* Use mix-blend-mode trick: text appears white on filled, dark on empty */
}
.ganttv3-bar[data-statut="a_venir"] .ganttv3-bar-name {
  color: var(--ink-3); text-shadow: none;
}
/* For partially filled in_cours bars, the name might overflow the fill.
   Use a clip-path technique: the text is duplicated, one masked to the fill. */

.ganttv3-bar-pct {
  font-size: .7rem; font-weight: 700; color: #fff;
  background: rgba(0,0,0,.18);
  padding: 2px 8px; border-radius: 99px;
  letter-spacing: .02em;
  text-shadow: 0 1px 2px rgba(0,0,0,.2);
  flex-shrink: 0;
}
.ganttv3-bar[data-statut="a_venir"] .ganttv3-bar-pct {
  background: var(--bg); color: var(--ink-3); border: 1px solid var(--line);
  text-shadow: none;
}

/* Drift badge (retard/avance) */
.ganttv3-drift {
  position: absolute; top: 50%;
  transform: translate(8px, -50%);
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fff; font-size: .68rem; font-weight: 700;
  border-radius: 99px; z-index: 3;
  box-shadow: 0 4px 10px rgba(220,38,38,.3),
              0 0 0 2px #fff;
  letter-spacing: .03em;
  white-space: nowrap;
}
.ganttv3-drift.is-early {
  background: linear-gradient(135deg, #16a34a, #15803d);
  box-shadow: 0 4px 10px rgba(22,163,74,.3), 0 0 0 2px #fff;
}

/* Milestone flag */
.ganttv3-flag {
  position: absolute; top: 50%;
  transform: translate(-50%, -50%);
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff;
  border-radius: 50%;
  z-index: 4;
  cursor: pointer;
  transition: transform var(--t-fast);
  box-shadow: 0 2px 6px rgba(0,0,0,.2),
              0 0 0 3px #fff,
              0 0 0 4px rgba(123,42,133,.25);
}
.ganttv3-flag .icon { width: 13px; height: 13px; stroke-width: 2.5; }
.ganttv3-flag[data-status="atteint"]  {
  background: linear-gradient(135deg, #16a34a, #15803d);
  box-shadow: 0 2px 6px rgba(0,0,0,.2), 0 0 0 3px #fff, 0 0 0 4px rgba(22,163,74,.25);
}
.ganttv3-flag[data-status="en_retard"]{
  background: linear-gradient(135deg, #dc2626, #991b1b);
  box-shadow: 0 2px 6px rgba(0,0,0,.2), 0 0 0 3px #fff, 0 0 0 4px rgba(220,38,38,.25);
}
.ganttv3-flag[data-status="en_cours"] {
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
}
.ganttv3-flag[data-status="a_venir"]  {
  background: #fff; color: var(--brand);
  box-shadow: 0 2px 6px rgba(0,0,0,.1), 0 0 0 2px var(--brand);
}
.ganttv3-flag:hover { transform: translate(-50%, -50%) scale(1.18); }

/* Mobile */
@media (max-width: 1100px) {
  .ganttv3-head, .ganttv3-row { grid-template-columns: 180px 1fr; }
  .ganttv3-vlines { left: 180px; }
  .ganttv3-icon { width: 30px; height: 30px; }
  .ganttv3-bar { height: 30px; border-radius: 15px; }
  .ganttv3-bar-name { font-size: .72rem; }
}
@media (max-width: 700px) {
  .ganttv3-head, .ganttv3-row { grid-template-columns: 130px 1fr; }
  .ganttv3-vlines { left: 130px; }
  .ganttv3-pill { display: none; }
}

/* === Slide-in panel détail phase ======================================== */
.gantt-panel {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(13,13,12,.18); backdrop-filter: blur(2px);
  display: flex; justify-content: flex-end;
}
.gantt-panel-card {
  width: 420px; max-width: 100vw; height: 100vh; overflow-y: auto;
  background: var(--bg); border-left: 1px solid var(--line);
  box-shadow: -10px 0 30px rgba(13,13,12,.12);
  display: flex; flex-direction: column;
}
@keyframes gp-slide-in {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}
.gantt-panel-card { animation: gp-slide-in 240ms cubic-bezier(.2,.8,.2,1); }

.gantt-panel-head {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--line);
  display: flex; gap: .85rem; align-items: flex-start;
}
.gantt-panel-eyebrow {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--ink-3); font-weight: 500;
}
.gantt-panel-body {
  padding: 1.25rem; flex: 1;
  display: flex; flex-direction: column; gap: 1.25rem;
}
.gantt-panel-section {}
.gantt-panel-label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--ink-3); font-weight: 600; margin-bottom: .65rem;
}

.gantt-cal-row {
  display: flex; align-items: stretch; gap: .65rem;
}
.gantt-cal-block {
  flex: 1; padding: .65rem .75rem;
  background: var(--panel-2); border-radius: var(--r-sm);
  font-size: .82rem;
}
.gantt-cal-arrow {
  display: flex; align-items: center; color: var(--ink-3);
}

.g-risk {
  display: flex; gap: .55rem; padding: .55rem .65rem;
  background: var(--panel-2); border-radius: var(--r-sm);
  margin-bottom: .5rem; font-size: .82rem;
}
.g-risk:last-child { margin-bottom: 0; }
.g-risk-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-top: 6px; flex-shrink: 0;
}

@media (max-width: 900px) {
  .gantt-pro-head, .gantt-pro-row { grid-template-columns: 140px 1fr; }
  .gantt-pro-label { padding: 0 .5rem; }
  .gantt-pro-icon { width: 24px; height: 24px; }
  .gantt-panel-card { width: 100vw; }
}

/* === Module 2a : PV — codes T/I/D + chapitres ========================== */
.pv-code {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 6px;
  font-weight: 700; font-size: .72rem; flex-shrink: 0;
}
.pv-code--T { background: var(--brand-soft); color: var(--brand); }       /* Tâche */
.pv-code--I { background: var(--panel-2); color: var(--ink-3); }          /* Information */
.pv-code--D { background: var(--ok-bg); color: var(--ok); }               /* Décision */
.pv-chap { border-bottom: 1px solid var(--line); }
.pv-chap:last-child { border-bottom: 0; }
.pv-chap-head {
  padding: .5rem 1rem; background: var(--panel-2);
  font-size: .72rem; text-transform: uppercase; letter-spacing: .08em;
  font-weight: 600; color: var(--ink-2);
}
.pv-chap-head.cluster { display: flex; align-items: center; }

/* === Module 2b-1 : PV — participants (badges présence + responsive) ==== */
.pv-pres {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 6px;
  font-weight: 700; font-size: .72rem; flex-shrink: 0;
}
.pv-pres--P { background: var(--ok-bg); color: var(--ok); }         /* Présent */
.pv-pres--E { background: var(--warn-bg); color: var(--warn); }     /* Excusé */
.pv-pres--A { background: var(--danger-bg); color: var(--danger); } /* Absent */
.pv-pres--none { background: var(--panel-2); color: var(--ink-4); } /* Non renseigné */

/* Tableau participants : cartes empilées sur mobile */
@media (max-width: 700px) {
  .pv-part-tbl thead { display: none; }
  .pv-part-tbl, .pv-part-tbl tbody, .pv-part-tbl tr, .pv-part-tbl td { display: block; width: 100%; }
  .pv-part-tbl tr {
    border: 1px solid var(--line); border-radius: 8px;
    margin: .5rem 1rem; padding: .35rem .65rem; background: var(--bg);
  }
  .pv-part-tbl td {
    border: 0 !important; padding: .25rem 0;
    display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  }
  .pv-part-tbl td[data-label]::before {
    content: attr(data-label); font-weight: 600; color: var(--ink-3);
    font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  }
  .pv-part-tbl td[data-label=""]::before { content: none; }
  .pv-part-tbl td .row-actions { margin-left: auto; }
}

/* === Module 2c-1 : import IA d'un PV (upload + revue) ================== */
.import-drop {
  display: flex; align-items: center; justify-content: center; text-align: center;
  border: 2px dashed var(--line); border-radius: var(--r-md);
  padding: 2.5rem 1rem; cursor: pointer; color: var(--ink-3);
  transition: border-color .15s, background .15s;
}
.import-drop:hover { border-color: var(--brand); background: var(--brand-tint); }
.import-drop.is-drag { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-strong); }
.ro-field {
  padding: .5rem .65rem; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); min-height: 2.1rem; font-size: .9rem;
}
.spin { animation: rmv-spin 1s linear infinite; transform-origin: center; }
@keyframes rmv-spin { to { transform: rotate(360deg); } }

/* === Module 2c-2 : revue d'import éditable ============================= */
.pv-edit-tbl td, .pv-edit-tbl th { padding: 3px 5px; vertical-align: middle; }
.pv-edit-tbl input, .pv-edit-tbl select { width: 100%; min-width: 5rem; padding: 3px 6px; font-size: .82rem; }
.pv-edit-ligne { padding: .5rem 1rem; border-bottom: 1px solid var(--line); }
.pv-edit-ligne:last-child { border-bottom: 0; }
.pv-edit-ligne-meta { display: flex; gap: .4rem; align-items: center; margin-bottom: .35rem; flex-wrap: wrap; }
.pv-edit-ligne-meta select, .pv-edit-ligne-meta input { padding: 3px 6px; font-size: .82rem; }
.pv-edit-ligne-meta .sel-code { width: 3rem; font-weight: 700; }
.pv-edit-ligne-meta .sel-chap { width: 3rem; }
.pv-edit-ligne-meta .in-soustitre { flex: 1 1 12rem; min-width: 8rem; font-weight: 600; }
.pv-edit-ligne-meta .in-resp { flex: 1 1 8rem; min-width: 6rem; }
.pv-edit-ligne-meta .in-delai { flex: 0 1 7rem; min-width: 5rem; }
.pv-edit-ligne .in-libelle { width: 100%; font-size: .85rem; resize: vertical; }
.field-error { border-color: var(--danger) !important; box-shadow: 0 0 0 2px rgba(192,57,43,.12); }
.imp-row-warn { box-shadow: inset 3px 0 0 var(--warn); background: var(--warn-bg); }
.imp-warn { color: var(--warn); display: inline-flex; align-items: center; }

/* === Module 2c-3 : déversement lignes T → Actions =================== */
.pv-gen-bar {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  padding: .55rem 1rem; background: var(--brand-tint);
  border-bottom: 1px solid var(--line);
}
.gen-item {
  display: flex; gap: .65rem; align-items: flex-start;
  padding: .65rem 1rem; border-bottom: 1px solid var(--line); cursor: pointer;
}
.gen-item:last-child { border-bottom: 0; }
.gen-item:hover { background: var(--brand-tint); }
.gen-item input[type=checkbox] { margin-top: .2rem; flex-shrink: 0; width: 16px; height: 16px; }
.gen-item--done { opacity: .55; cursor: default; }
.gen-item--done:hover { background: transparent; }
.gen-item-body { flex: 1; min-width: 0; }
.gen-item-title { font-size: .9rem; margin-bottom: .2rem; }
.gen-item-meta { display: flex; flex-wrap: wrap; gap: .15rem 1.25rem; font-size: .78rem; color: var(--ink-3); }
.gen-item-meta > span { display: inline-flex; align-items: center; gap: .25rem; }
.badge.brand { background: var(--brand-soft); color: var(--brand-strong); }

/* === Capa IA : écran de révision des propositions (lignes T + suggestions IA) ===== */
.gen-toolbar {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .75rem;
}
.gen-toolbar-sep { flex: 1 1 auto; }
/* Bouton IA : distinct (dégradé aubergine) — l'IA est une action à part, jamais confondue avec le confirmé */
.btn.ia {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%);
  color: #fff; border: 0;
}
.btn.ia:hover { filter: brightness(1.07); }
.btn.ia:disabled { opacity: .7; cursor: progress; }

.gen-ai-error, .gen-ai-ok {
  display: flex; align-items: center; gap: .4rem; font-size: .82rem;
  padding: .55rem .8rem; border-radius: var(--r-md); margin-bottom: .75rem;
}
.gen-ai-error { background: rgba(192,57,43,.08); color: var(--danger); border: 1px solid rgba(192,57,43,.2); }
.gen-ai-ok { background: var(--warn-bg); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }

.prop-row {
  display: flex; gap: .65rem; align-items: flex-start;
  padding: .7rem 1rem; border-bottom: 1px solid var(--line);
}
.prop-row:last-child { border-bottom: 0; }
.prop-check { flex-shrink: 0; padding-top: .15rem; cursor: pointer; }
.prop-check input[type=checkbox] { width: 17px; height: 17px; cursor: pointer; }
.prop-body { flex: 1; min-width: 0; }
.prop-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .3rem; }
/* Badge d'origine — distinction visuelle permanente (transparence T4) */
.prop-origin {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .72rem; font-weight: 600; padding: .12rem .5rem;
  border-radius: 999px; letter-spacing: .01em; white-space: nowrap;
}
.prop-origin--ligne { background: var(--brand-soft); color: var(--brand-strong); }
.prop-origin--ia { background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%); color: #fff; }
.prop-origin--manual { background: var(--surface-2, #eef0f3); color: var(--ink-3); }
.prop-title { font-size: .92rem; font-weight: 500; margin-bottom: .25rem; display: inline-flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.prop-title.imp-warn { color: inherit; }
.prop-meta { display: flex; flex-wrap: wrap; gap: .15rem 1.25rem; font-size: .78rem; color: var(--ink-3); }
.prop-meta-item { display: inline-flex; align-items: center; gap: .3rem; }
.prop-meta-item.imp-warn { color: var(--warn); }
/* Petite pastille « à vérifier » orange (réutilise le marquage 2c-2) */
.imp-warn-tag {
  font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--warn); background: var(--warn-bg);
  border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
  padding: .05rem .35rem; border-radius: 999px; white-space: nowrap;
}
.prop-justif {
  margin-top: .4rem; font-size: .78rem; color: var(--brand-strong);
  background: var(--brand-tint); border-left: 2px solid var(--brand-soft);
  padding: .35rem .55rem; border-radius: 0 var(--r-sm) var(--r-sm) 0;
  display: flex; align-items: flex-start; gap: .35rem;
}
.prop-actions { flex-shrink: 0; }
@media (max-width: 640px) {
  .prop-row { flex-wrap: wrap; }
  .prop-actions { order: 3; }
  .gen-toolbar-sep { flex-basis: 100%; height: 0; }
}

/* === Module 1b : Actions CRUD ========================================== */
.action-check {
  background: transparent; border: 0; cursor: pointer; padding: 2px;
  color: var(--ink-4); display: inline-flex; transition: color var(--t-fast);
}
.action-check:hover { color: var(--brand); }
tr.action-closed .action-check { color: var(--ok); }
tr.action-closed .action-titre { text-decoration: line-through; color: var(--ink-4); }
.action-form label,
.action-modal label {
  display: block; font-size: .76rem; color: var(--ink-3);
  font-weight: 500; margin-bottom: .25rem;
  text-transform: uppercase; letter-spacing: .04em;
}

/* Modal action (réutilise l'overlay .gantt-panel) */
.action-modal {
  background: var(--bg); border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop); width: min(620px, calc(100vw - 32px));
  margin-top: 8vh; max-height: 84vh; overflow-y: auto;
  animation: toast-in 200ms cubic-bezier(.2,.8,.2,1);
}
.action-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--line);
}
.action-modal-head h3 { margin: 0; }
.action-modal-body { padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }

/* === Module 1a : Toasts (messages Django) ============================== */
.toast-stack {
  position: fixed; top: calc(var(--topbar-h, 52px) + 12px); right: 16px;
  z-index: 300; display: flex; flex-direction: column; gap: .5rem;
  max-width: min(420px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: flex-start; gap: .6rem;
  padding: .75rem .9rem;
  background: var(--bg); border: 1px solid var(--line);
  border-left: 3px solid var(--ink-3);
  border-radius: var(--r-md);
  box-shadow: 0 8px 28px rgba(13,13,12,.16);
  font-size: .88rem; color: var(--ink);
  animation: toast-in 220ms cubic-bezier(.2,.8,.2,1);
}
@keyframes toast-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }
.toast--success { border-left-color: var(--ok); }
.toast--success .toast-icon { color: var(--ok); }
.toast--error { border-left-color: var(--danger); }
.toast--error .toast-icon { color: var(--danger); }
.toast--info .toast-icon { color: var(--brand); }
.toast-icon { flex-shrink: 0; margin-top: 1px; }
.toast-msg { flex: 1; line-height: 1.4; }
.toast-close {
  flex-shrink: 0; background: transparent; border: 0; cursor: pointer;
  color: var(--ink-4); padding: 0; display: inline-flex;
}
.toast-close:hover { color: var(--ink); }
@media (max-width: 900px) {
  .toast-stack { left: 16px; right: 16px; max-width: none; }
}

/* === Étape 3 : Dashboards entreprise vs chantiers ======================
   - Répartition par type de mandat (barres horizontales)
   - Prochaines séances (liste compact)
   - Chantiers en alerte (filas)
   - Légende répartition CA + filas conformité
======================================================================= */

/* Répartition par mandat */
.mandat-row {
  display: grid;
  grid-template-columns: 220px 1fr 110px;
  align-items: center; gap: 1rem;
  padding: .5rem 0;
  border-bottom: 1px dashed var(--line);
}
.mandat-row:last-child { border-bottom: 0; }
.mandat-label { font-size: .88rem; color: var(--ink); }
.mandat-bar {
  height: 14px; background: var(--panel-2);
  border-radius: 99px; overflow: hidden; position: relative;
}
.mandat-bar > span {
  display: block; height: 100%; border-radius: 99px;
  transition: width 700ms cubic-bezier(.2,.8,.2,1);
}
.mandat-num { font-size: .85rem; text-align: right; }

/* Séances à venir */
.seances-list { display: flex; flex-direction: column; }
.seance-item {
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 2px;
}
.seance-item:last-child { border-bottom: 0; }
.seance-date {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .82rem; color: var(--ink);
}
.seance-pin {
  width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand);
}
.seance-chantier { font-size: .82rem; color: var(--ink); margin-top: 2px; }

/* Chantiers en alerte (chantiers dashboard) */
.alerte-row {
  display: grid;
  grid-template-columns: 18px 110px 1fr 70px 130px;
  align-items: center; gap: .85rem;
  padding: .65rem 1rem; border-bottom: 1px solid var(--line);
  font-size: .85rem; color: var(--ink); text-decoration: none;
  transition: background var(--t-fast);
}
.alerte-row:last-child { border-bottom: 0; }
.alerte-row:hover { background: var(--panel-2); }
.alerte-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
}
.alerte-dot[data-level="rouge"] { background: var(--danger); }
.alerte-dot[data-level="orange"] { background: var(--warn); }
.alerte-name { color: var(--ink-2); }
.alerte-pct {
  text-align: right; font-weight: 700; font-size: .88rem;
}
.alerte-pct[data-level="rouge"] { color: var(--danger); }
.alerte-pct[data-level="orange"] { color: var(--warn); }

/* Légende répartition CA (entreprise) */
.repart-legend {
  display: flex; flex-direction: column; gap: .35rem;
  margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line);
}
.repart-item {
  display: grid; grid-template-columns: 14px 1fr auto auto;
  align-items: center; gap: .55rem; font-size: .85rem;
}
.repart-dot {
  display: inline-block; width: 12px; height: 12px;
  border-radius: 3px;
}
.repart-label { color: var(--ink-2); }
.repart-val { font-weight: 600; color: var(--ink); }

/* Lignes conformité */
.conf-row {
  display: grid;
  grid-template-columns: 28px 1fr auto auto auto;
  align-items: center; gap: .85rem;
  padding: .65rem 1rem; border-bottom: 1px solid var(--line);
  font-size: .85rem;
}
.conf-row:last-child { border-bottom: 0; }
.conf-icon {
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}
.conf-icon[data-level="rouge"]  { background: var(--danger-bg); color: var(--danger); }
.conf-icon[data-level="orange"] { background: var(--warn-bg);   color: var(--warn); }
.conf-name { color: var(--ink); font-weight: 500; }
.conf-person { color: var(--ink-3); font-size: .82rem; }
.conf-jours {
  font-weight: 700; font-size: .82rem; padding: 3px 9px;
  border-radius: 99px;
}
.conf-jours[data-level="rouge"]  { background: var(--danger-bg); color: var(--danger); }
.conf-jours[data-level="orange"] { background: var(--warn-bg);   color: var(--warn); }

/* Mobile */
@media (max-width: 900px) {
  .mandat-row { grid-template-columns: 1fr; gap: .25rem; }
  .mandat-num { text-align: left; }
  .alerte-row {
    grid-template-columns: 18px 1fr auto;
    grid-template-rows: auto auto; gap: .35rem .55rem;
  }
  .alerte-row .mono { grid-column: 2; font-size: .75rem; }
  .alerte-name { grid-column: 1 / -1; order: 3; }
  .conf-row {
    grid-template-columns: 28px 1fr auto;
    grid-template-rows: auto auto auto;
  }
  .conf-row .conf-person { grid-column: 2 / -1; font-size: .76rem; }
  .conf-row .conf-jours { grid-column: 3; grid-row: 1; }
  .conf-row .btn { grid-column: 2 / -1; justify-self: end; }
}

/* === Étape 2 : Création chantier & arborescence ========================
   - Form de création (chantier_nouveau) en 2 colonnes
   - Cards de typologie sélectionnables
   - Grille des 6 dossiers (vue chantier > Plans & documents)
======================================================================= */
.nc-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 340px;
  gap: 1rem;
}
.nc-col { display: flex; flex-direction: column; gap: 1rem; }
.nc-col-aside { display: flex; flex-direction: column; gap: 1rem; }

.nc-types {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: .55rem;
}
.nc-type {
  display: flex; align-items: flex-start; gap: .55rem;
  padding: .75rem .85rem; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--bg); transition: var(--t-fast);
  position: relative;
}
.nc-type:hover { border-color: var(--ink-3); }
.nc-type.is-selected {
  border-color: var(--brand);
  background: var(--brand-tint);
  box-shadow: 0 0 0 3px rgba(123,42,133,.12);
}
.nc-type input[type="radio"] {
  position: absolute; opacity: 0; pointer-events: none;
}
.nc-type-body { flex: 1; min-width: 0; }
.nc-type-body strong { display: block; font-size: .88rem; color: var(--ink); margin-bottom: 2px; }
.nc-type-check {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel-2); color: var(--ink-disabled);
  transition: var(--t-fast);
}
.nc-type.is-selected .nc-type-check { background: var(--brand); color: #fff; }

.nc-checkbox {
  display: inline-flex; align-items: center; gap: .55rem;
  font-size: .85rem; color: var(--ink-2); cursor: pointer;
}
.nc-checkbox input[type="checkbox"] {
  width: 18px; height: 18px; accent-color: var(--brand);
}

.nc-field-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: .85rem;
}
.nc-field-grid label {
  display: block; font-size: .76rem; color: var(--ink-3);
  font-weight: 500; margin-bottom: .25rem;
  text-transform: uppercase; letter-spacing: .04em;
}

.nc-info-line {
  display: flex; align-items: center; gap: .55rem;
  padding: .65rem .75rem; margin-top: .65rem;
  background: var(--brand-soft); border-radius: var(--r);
  font-size: .85rem; color: var(--brand-strong);
}

/* Aperçu live à droite */
.nc-preview { border-color: rgba(123,42,133,.25); }
.nc-numero {
  font-size: 1.8rem; font-weight: 700; letter-spacing: -.02em;
  color: var(--brand-strong); font-family: ui-monospace, "JetBrains Mono", Menlo, monospace;
}
.nc-numero-full {
  font-size: .82rem; color: var(--ink-2);
  font-family: ui-monospace, "JetBrains Mono", Menlo, monospace;
}

.nc-folders {
  display: flex; flex-direction: column; gap: .35rem;
}
.nc-folder {
  display: flex; align-items: center; gap: .55rem;
  padding: .5rem .65rem; font-size: .82rem;
  border-radius: var(--r-sm); background: var(--panel-2);
  color: var(--ink-2); transition: var(--t-fast);
}
.nc-folder.is-off { opacity: .42; color: var(--ink-3); }
.nc-folder-icon {
  width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff;
}
.nc-folder.is-off .nc-folder-icon { background: var(--ink-disabled); }
.nc-folder-label { flex: 1; min-width: 0; }

@media (max-width: 1100px) {
  .nc-grid { grid-template-columns: 1fr; }
  .nc-types { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .nc-field-grid { grid-template-columns: 1fr; }
}

/* === Plans & documents — grille des 6 dossiers === */
.dossier-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem;
  margin-top: 1rem;
}
.dossier-tile {
  display: flex; flex-direction: column; gap: .35rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--bg); transition: var(--t-fast);
  min-height: 130px;
}
.dossier-tile.is-active { cursor: pointer; }
.dossier-tile.is-active:hover {
  border-color: var(--brand);
  background: var(--brand-tint);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(123,42,133,.10);
}
.dossier-tile.is-disabled {
  background: var(--panel-2);
  color: var(--ink-3);
  cursor: not-allowed;
}
.dossier-tile.is-disabled .dossier-tile-icon { color: var(--ink-disabled); }
.dossier-tile-head {
  display: flex; align-items: center; justify-content: space-between;
}
.dossier-tile-icon {
  width: 36px; height: 36px; border-radius: var(--r);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand);
}
.dossier-tile.is-disabled .dossier-tile-icon { background: var(--panel-2); }
.dossier-tile-count {
  font-size: .72rem; color: var(--ink-3); font-weight: 500;
}
.dossier-tile-name {
  font-weight: 600; font-size: .9rem; color: var(--ink); line-height: 1.3;
  margin-top: .25rem;
}

.doc-tab.is-off { opacity: .55; cursor: not-allowed; }

@media (max-width: 900px) {
  .dossier-grid { grid-template-columns: 1fr; }
}

/* === Mobile : hamburger + drawer sidebar =============================== */
.topbar-hamburger {
  display: none;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--line);
  color: var(--ink-2); border-radius: var(--r);
  cursor: pointer; flex-shrink: 0;
  margin-right: .25rem;
}
.topbar-hamburger:hover { background: var(--panel-2); color: var(--ink); }
.topbar-hamburger:active { transform: scale(.96); }

.mobile-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(13,13,12,.35);
  backdrop-filter: blur(2px);
  z-index: 90;
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-areas:
      "top"
      "main";
  }
  .sidebar {
    display: flex !important;
    position: fixed; top: 0; left: 0;
    width: 280px; height: 100vh;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 280ms cubic-bezier(.2,.8,.2,1);
    box-shadow: 4px 0 24px rgba(13,13,12,.18);
    border-right: 1px solid var(--line);
  }
  .app[data-mobile-nav-open="true"] .sidebar {
    transform: translateX(0);
  }
  .app[data-mobile-nav-open="true"] .mobile-backdrop { display: block; }
  .holding-selector { display: block; }

  .topbar-hamburger { display: inline-flex; }

  /* Topbar plus compact */
  .topbar { padding: 0 .5rem; gap: .35rem; }
  .topbar-search { max-width: none; flex: 1; min-width: 0; }
  .topbar-search input { padding-right: .5rem; }
  .topbar-search kbd { display: none; }

  /* User menu : avatar uniquement, pas de nom */
  .user-menu-btn .name { display: none; }
  .user-menu-btn > .icon { display: none; }

  /* Cacher boutons accessoires + status pills */
  .topbar-actions > button[title="Nouveau"],
  .topbar-actions > button[title="Aide"] { display: none; }
  .status-pills { display: none; }
  .topbar-sync { display: none; }

  /* Page-header : titre + actions wrap */
  .page-header { padding: .75rem .85rem; }
  .page-header h1 { font-size: 1.1rem; }
  .page-header .title-row { gap: .35rem; flex-wrap: wrap; }
  .page-header .actions {
    margin-left: auto; gap: .25rem;
    width: 100%; justify-content: flex-end; margin-top: .5rem;
  }
  .page-header .actions .btn { padding: 0 .5rem; height: 32px; font-size: .78rem; }
  .page-header .actions .btn .icon { margin: 0; }

  .content { padding: .85rem; }

  .mail { grid-template-columns: 1fr; }
  .mail-folders, .mail-list { display: none; }
  .chat { grid-template-columns: 1fr; }
  .chat-side { display: none; }
}

@media (max-width: 480px) {
  .page-header h1 { font-size: 1rem; }
  .page-header .title-row > .badge:not(.danger),
  .page-header .title-row > .muted { display: none; }
  /* Btn devient icon-only : font-size:0 cache le texte mais l'icône SVG conserve sa taille explicite */
  .page-header .actions .btn {
    width: 36px; height: 36px; padding: 0; gap: 0;
    justify-content: center; font-size: 0;
  }
  .page-header .actions .btn .icon { width: 16px; height: 16px; }
}

/* ====================================================================== */
/* === Phase 2A : modale réutilisable + select à icônes ================= */
/* ====================================================================== */

body.modal-open { overflow: hidden; }

.modal-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(13, 13, 12, .34); backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 16px 16px; overflow-y: auto;
}
.modal-card {
  background: var(--bg); border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  width: min(620px, 100%); max-height: calc(100vh - 9vh);
  display: flex; flex-direction: column; overflow: hidden;
  animation: modal-pop 160ms cubic-bezier(.2, .8, .2, 1);
}
@keyframes modal-pop {
  from { opacity: 0; transform: translateY(8px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  display: flex; align-items: center; gap: .75rem;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.modal-head h3 { margin: 0; font-size: 1rem; }
.modal-head .modal-close { margin-left: auto; }
.modal-body {
  padding: 1.25rem; overflow-y: auto; flex: 1;
  display: flex; flex-direction: column; gap: 1rem;
}
.modal-body label {
  display: block; font-size: .76rem; color: var(--ink-3);
  font-weight: 500; margin-bottom: .3rem;
  text-transform: uppercase; letter-spacing: .04em;
}
.modal-foot {
  display: flex; justify-content: flex-end; gap: .5rem;
  padding: .9rem 1.25rem; border-top: 1px solid var(--line);
  background: var(--panel-2); flex-shrink: 0;
}
@media (max-width: 640px) {
  .modal-overlay { padding: 0; align-items: stretch; }
  .modal-card { width: 100%; max-height: 100vh; min-height: 100vh; border-radius: 0; }
}

/* Segmented control à icônes — produit la même valeur qu'un <select> (input caché) */
.iseg { display: flex; flex-wrap: wrap; gap: .4rem; }
.iseg-opt {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem .7rem; min-height: 40px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--bg); color: var(--ink-2);
  font-size: .82rem; font-weight: 500; cursor: pointer;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}
.iseg-opt:hover { border-color: var(--brand); color: var(--brand); }
.iseg-opt:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.iseg-opt .icon { flex-shrink: 0; }
.iseg-opt.is-active {
  background: var(--brand); border-color: var(--brand); color: #fff;
  box-shadow: 0 1px 4px rgba(123, 42, 133, .3);
}
.iseg-opt.is-active:hover { color: #fff; }
.iseg-label { white-space: nowrap; }
/* Codes T/I/D : couleur active alignée sur les badges .pv-code-- */
.iseg-opt.iseg-code-I.is-active { background: var(--ink-3); border-color: var(--ink-3); }
.iseg-opt.iseg-code-D.is-active { background: var(--ok); border-color: var(--ok); box-shadow: none; }
@media (max-width: 480px) {
  .iseg-opt { flex: 1 1 auto; justify-content: center; }
}

/* === Phase 2B : champs avec unité / devise (affixe) ==================== */
.input-affix { display: flex; align-items: stretch; }
.input-affix > input { flex: 1; min-width: 0; }
.input-affix .affix {
  display: inline-flex; align-items: center; padding: 0 .75rem;
  background: var(--panel-2); border: 1px solid var(--line-strong);
  color: var(--ink-3); font-weight: 600; font-size: .85rem; white-space: nowrap;
}
.input-affix .affix-pre  { border-right: 0; border-radius: var(--r-sm) 0 0 var(--r-sm); }
.input-affix .affix-post { border-left: 0;  border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.input-affix .affix-input-pre  { border-radius: 0 var(--r-sm) var(--r-sm) 0 !important; }
.input-affix .affix-input-post { border-radius: var(--r-sm) 0 0 var(--r-sm) !important; }

/* ====================================================================== */
/* === Phase 2C : pulidos (drag Gantt, équipe, recherche, lignes PV) ===== */
/* ====================================================================== */

/* Tooltip de retour visuel pendant le drag du Gantt */
.ganttv3-drag-tip {
  position: fixed; z-index: 400; pointer-events: none;
  background: var(--brand-strong); color: #fff;
  padding: .35rem .6rem; border-radius: var(--r-sm);
  font-size: .76rem; font-weight: 500; white-space: nowrap;
  box-shadow: 0 4px 14px rgba(13, 13, 12, .28);
  transform: translate(-50%, 0); text-align: center; line-height: 1.35;
}
.ganttv3-drag-tip strong { display: block; font-size: .85rem; }

/* Équipe : membres lisibles (nom + fonction), sans survol, OK mobile */
.team-list { display: flex; flex-direction: column; gap: .55rem; }
.team-member { display: flex; align-items: center; gap: .6rem; }
.team-member-name { font-weight: 600; font-size: .88rem; line-height: 1.2; }
.team-member .avatar, .team-member .avatar-lg { flex-shrink: 0; }

/* Recherche : résultats descriptifs */
.search-badges { display: flex; flex-wrap: wrap; gap: .3rem; margin: .25rem 0; }

/* Lignes PV : meta responsable / délai lisible d'un coup d'œil */
.pv-ligne-soustitre { font-weight: 600; font-size: .82rem; color: var(--ink); }
.pv-ligne-libelle { line-height: 1.5; }
.pv-ligne-meta {
  display: flex; flex-wrap: wrap; gap: .35rem .9rem; margin-top: .3rem;
  font-size: .78rem; color: var(--ink-3);
}
.pv-ligne-meta span { display: inline-flex; align-items: center; gap: .3rem; }
.pv-ligne-meta .icon { width: 14px; height: 14px; }

/* ====================================================================== */
/* === Phase 3A : mobile — navigation + écrans de travail ================ */
/* ====================================================================== */

@media (max-width: 900px) {
  /* min-width:0 → les tables larges n'élargissent plus la colonne de contenu */
  .main { min-width: 0; }
  .content { min-width: 0; }

  /* Drawer : fermeture par Échap gérée côté Alpine ; cibles tactiles du menu */
  .nav a { min-height: 42px; }

  /* Onglets de détail défilables horizontalement (plus de troncature) */
  .tablist {
    overflow-x: auto; flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .tablist::-webkit-scrollbar { display: none; }
  .tablist a, .tablist button { white-space: nowrap; flex-shrink: 0; }
  /* Barre d'onglets « tabs » (Liste / Kanban / Supprimés…) aussi défilable */
  .toolbar .tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .toolbar .tabs::-webkit-scrollbar { display: none; }
  .toolbar .tabs a { white-space: nowrap; flex-shrink: 0; }
}

/* Tables marquées .tbl-stack → cartes empilées en mobile (≤640px) */
@media (max-width: 640px) {
  /* Pas de survol au doigt → les actions de ligne (éditer/supprimer) restent visibles */
  .row-actions { opacity: 1 !important; }
  table.tbl-stack thead { display: none; }
  table.tbl-stack,
  table.tbl-stack > tbody,
  table.tbl-stack > tbody > tr,
  table.tbl-stack > tbody > tr > td { display: block; width: auto; }
  table.tbl-stack > tbody > tr {
    border: 1px solid var(--line); border-radius: var(--r-md);
    margin: .6rem .85rem; padding: .5rem .85rem; background: var(--bg);
  }
  table.tbl-stack > tbody > tr:hover { background: var(--bg); }
  table.tbl-stack > tbody > tr.row-link { cursor: pointer; }
  table.tbl-stack > tbody > tr > td {
    border: 0 !important; padding: .3rem 0; white-space: normal !important;
    display: flex; gap: 1rem; align-items: center; justify-content: space-between; text-align: right;
  }
  table.tbl-stack > tbody > tr > td::before {
    content: attr(data-label); flex-shrink: 0; text-align: left;
    font-weight: 600; color: var(--ink-3); font-size: .7rem;
    text-transform: uppercase; letter-spacing: .03em;
  }
  /* Cellule-titre (numéro / intitulé) : pleine largeur, en évidence, sans label */
  table.tbl-stack > tbody > tr > td.cell-title { display: block; text-align: left; padding: .1rem 0 .2rem; }
  table.tbl-stack > tbody > tr > td.cell-title::before { content: none; }
  /* Cellule d'actions : à droite, sans label */
  table.tbl-stack > tbody > tr > td.cell-actions { justify-content: flex-end; padding-top: .45rem; }
  table.tbl-stack > tbody > tr > td.cell-actions::before { content: none; }
  /* Colonnes masquées sur mobile (réduire le bruit) */
  table.tbl-stack > tbody > tr > td.hide-mobile { display: none; }
  /* État vide : pleine largeur, sans label ni bordure de carte */
  table.tbl-stack > tbody > tr > td[colspan] { display: block; text-align: center; }
  table.tbl-stack > tbody > tr > td[colspan]::before { content: none; }
}

/* ====================================================================== */
/* === Phase 3B : Gantt en vue liste (mobile) + tables financières ====== */
/* ====================================================================== */

/* Vue liste des phases : mobile-only ; le Gantt draggable (1c) reste desktop */
.planning-mobile { display: none; }
@media (max-width: 640px) {
  .planning-mobile { display: block; }
  .ganttv3 { display: none; }
}
.phase-card {
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: .65rem .8rem; margin-bottom: .55rem; background: var(--bg); cursor: pointer;
}
.phase-card:active { background: var(--panel-2); }
.phase-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.phase-card-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.phase-card-title { flex: 1; min-width: 0; }
.phase-card-title strong { display: block; font-size: .9rem; line-height: 1.25; }
.phase-card-dates { display: flex; align-items: center; gap: .35rem; margin-bottom: .45rem; }
.phase-card-prog { display: flex; align-items: center; gap: .5rem; }
.phase-card-prog .bar-mini { display: inline-block; }

/* ====================================================================== */
/* === Explorateur de fichiers (Partie A) =============================== */
/* ====================================================================== */

.dropzone {
  border: 2px dashed var(--line-strong); border-radius: var(--r-md);
  padding: 1.4rem 1rem; text-align: center; color: var(--ink-3); margin-bottom: 1rem;
  display: flex; flex-direction: column; align-items: center; gap: .35rem;
  transition: border-color .15s, background .15s;
}
.dropzone .icon { color: var(--ink-3); width: 26px; height: 26px; }
.dropzone.is-over { border-color: var(--brand); background: var(--brand-tint); color: var(--brand-strong); }
.dropzone.is-over .icon { color: var(--brand); }

.doc-grid { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.doc-card {
  border: 1px solid var(--line); border-radius: var(--r-md);
  overflow: hidden; background: var(--bg); display: flex; flex-direction: column;
}
.doc-card-thumb {
  height: 108px; display: flex; align-items: center; justify-content: center;
  background: var(--panel-2); overflow: hidden;
}
.doc-card-thumb[role="button"] { cursor: pointer; }
.doc-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-card-icon .icon { width: 38px; height: 38px; color: var(--ink-3); }
.doc-card-icon[data-kind="pdf"] .icon { color: var(--danger); }
.doc-card-icon[data-kind="image"] .icon { color: var(--info); }
.doc-card-icon[data-kind="video"] .icon { color: var(--brand); }
.doc-card-icon[data-kind="sheet"] .icon { color: var(--ok); }
.doc-card-body { padding: .5rem .65rem; flex: 1; min-width: 0; }
.doc-card-name { font-weight: 600; font-size: .82rem; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-card-meta { margin-top: .15rem; }
.doc-card-actions {
  display: flex; gap: .1rem; padding: .2rem .35rem; border-top: 1px solid var(--line);
  justify-content: flex-end; align-items: center;
}
.doc-card-actions .icon-btn { opacity: 1; }

/* Aperçu en modale */
.doc-preview-card { width: min(920px, 100%); max-height: calc(100vh - 9vh); }
.doc-preview-body {
  flex: 1; min-height: 0; overflow: auto; background: #1a1a1a;
  display: flex; align-items: center; justify-content: center;
}
.doc-preview-body img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.doc-preview-body iframe { width: 100%; height: 78vh; border: 0; background: #fff; }
.doc-preview-body video { max-width: 100%; max-height: 80vh; display: block; }
@media (max-width: 640px) {
  .doc-preview-card { width: 100%; max-height: 100vh; }
  .doc-preview-body iframe { height: calc(100vh - 56px); }
  .doc-grid { grid-template-columns: 1fr 1fr; }
}

/* Progression d'upload */
.upload-overlay {
  position: fixed; inset: 0; z-index: 350; background: rgba(13, 13, 12, .4);
  display: flex; align-items: center; justify-content: center;
}
.upload-box {
  background: var(--bg); border-radius: var(--r-lg); padding: 1.5rem 2rem;
  box-shadow: var(--shadow-pop); text-align: center; min-width: 240px;
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
}
.upload-box .icon { color: var(--brand); width: 28px; height: 28px; }
.upload-bar { width: 100%; height: 8px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.upload-bar span { display: block; height: 100%; background: var(--brand); transition: width .15s; border-radius: 99px; }

/* Explorateur Partie B — arborescence (fil d'Ariane + sous-dossiers) */
.doc-breadcrumb { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; font-size: .85rem; min-width: 0; }
.doc-breadcrumb a { color: var(--ink-2); display: inline-flex; align-items: center; gap: .3rem; text-decoration: none; }
.doc-breadcrumb a:hover { color: var(--brand); }
.doc-breadcrumb .current { font-weight: 600; color: var(--ink); }
.doc-breadcrumb .icon { color: var(--ink-3); }
.folder-list { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1rem; }
.folder-row { display: flex; align-items: center; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg); }
.folder-row:hover { border-color: var(--line-strong); background: var(--panel-2); }
.folder-row-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: .55rem; padding: .6rem .8rem; text-decoration: none; color: inherit; }
.folder-row-icon { display: inline-flex; }
.folder-row-icon .icon { color: var(--brand); }
.folder-row-name { font-weight: 600; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-row-actions { display: flex; gap: .1rem; padding-right: .45rem; flex-shrink: 0; }
.folder-row-actions .icon-btn { opacity: 1; }
@media (max-width: 640px) {
  .folder-row-name { max-width: 38vw; }
}

/* === Capa audio : dictée vocale (bouton micro dans les modales editModal) ============ */
.dictee-bar {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  padding: .5rem .6rem; margin-bottom: .9rem;
  background: var(--brand-tint); border: 1px solid var(--brand-soft);
  border-radius: var(--r-md);
}
.dictee-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .8rem; border-radius: 999px; cursor: pointer;
  font-size: .82rem; font-weight: 600; white-space: nowrap;
  color: #fff; border: 0;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%);
  transition: filter var(--t-fast);
}
.dictee-btn:hover { filter: brightness(1.07); }
.dictee-btn:disabled { opacity: .75; cursor: progress; }
.dictee-btn.is-rec { background: linear-gradient(135deg, #d33 0%, #a11 100%); }
.rec-dot {
  width: 9px; height: 9px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 0 rgba(255,255,255,.7); animation: recpulse 1.1s ease-out infinite;
}
@keyframes recpulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,255,255,.7); }
  70%  { box-shadow: 0 0 0 7px rgba(255,255,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}
.dictee-hint { display: inline-flex; align-items: center; gap: .3rem; flex: 1; min-width: 0; }
.dictee-err {
  display: inline-flex; align-items: center; gap: .35rem; flex: 1; min-width: 0;
  font-size: .8rem; color: var(--danger);
}
/* Champ pré-rempli par la dictée → contour orange « à vérifier » (réutilise --warn de 2c-2) */
.field-warn {
  border-color: var(--warn) !important;
  box-shadow: inset 3px 0 0 var(--warn), 0 0 0 2px var(--warn-bg) !important;
  background: var(--warn-bg) !important;
}
.iseg-warn .iseg {
  border-color: var(--warn);
  box-shadow: inset 3px 0 0 var(--warn);
  background: var(--warn-bg);
  border-radius: var(--r-md);
}
@media (max-width: 640px) {
  .dictee-hint { flex-basis: 100%; }
  .dictee-btn { width: 100%; justify-content: center; }
}

/* === Import IA en LOT : sélection multi-fichiers, suivi, révision brouillon =========== */
.imp-filelist { list-style:none; margin:.6rem 0 .2rem; padding:0; text-align:left; max-height:160px; overflow:auto; }
.imp-filelist li { display:flex; align-items:center; gap:.35rem; font-size:.82rem; padding:.15rem 0; }

/* Bandeau d'explication de la détection du chantier (G4) */
.imp-explain {
  display:flex; gap:.5rem; align-items:flex-start; font-size:.86rem;
  padding:.6rem .8rem; margin-bottom:1rem; border-radius:var(--r-md);
  background:var(--brand-tint); border:1px solid var(--brand-soft); color:var(--brand-strong);
}

/* Cartes de suivi des items (mobile-first, 3A) */
.imp-items { display:flex; flex-direction:column; gap:.6rem; }
.imp-item {
  display:flex; gap:.75rem; align-items:flex-start; justify-content:space-between;
  padding:.75rem .9rem; background:var(--bg); border:1px solid var(--line);
  border-radius:var(--r-md); box-shadow:var(--shadow-sm);
}
.imp-item--erreur { border-color:color-mix(in srgb, var(--danger) 35%, transparent); }
.imp-item--termine { border-color:color-mix(in srgb, var(--ok) 35%, transparent); }
.imp-item-main { min-width:0; flex:1; }
.imp-item-name { font-weight:600; font-size:.92rem; display:flex; align-items:center; gap:.35rem; word-break:break-word; }
.imp-item-status { margin-top:.4rem; }
.imp-item-chantier { margin-top:.4rem; font-size:.82rem; display:flex; align-items:center; gap:.3rem; flex-wrap:wrap; }
.imp-item-err { margin-top:.4rem; font-size:.82rem; color:var(--danger); }
.imp-item-actions { flex-shrink:0; display:flex; flex-direction:column; gap:.35rem; align-items:flex-end; }

.imp-badge {
  display:inline-flex; align-items:center; gap:.3rem; font-size:.76rem; font-weight:600;
  padding:.18rem .55rem; border-radius:999px; white-space:nowrap;
}
.imp-badge--wait { background:var(--surface-2,#eef0f3); color:var(--ink-3); }
.imp-badge--run  { background:var(--brand-soft); color:var(--brand-strong); }
.imp-badge--done { background:var(--warn-bg); color:var(--warn); }
.imp-badge--ok   { background:color-mix(in srgb, var(--ok) 16%, transparent); color:var(--ok); }
.imp-badge--err  { background:rgba(192,57,43,.10); color:var(--danger); }

/* Poignée de drag dans la révision (réutilise .drag-handle existante + cellule dédiée) */
.drag-cell { width:1.6rem; text-align:center; padding-left:.35rem !important; }
.pv-edit-ligne-meta .drag-handle, .drag-cell .drag-handle { cursor:grab; color:var(--ink-4); display:inline-flex; }
.pv-edit-ligne-meta .drag-handle:active, .drag-cell .drag-handle:active { cursor:grabbing; }

@media (max-width:640px) {
  .imp-item { flex-direction:column; }
  .imp-item-actions { flex-direction:row; align-items:stretch; align-self:stretch; }
  .imp-item-actions .btn, .imp-item-actions form { flex:1; }
  .imp-item-actions .btn { width:100%; justify-content:center; }
}

/* === Envoi de PV : modale destinataires + suivi de lecture =========================== */
.envoi-list { display:flex; flex-direction:column; gap:.4rem; max-height:260px; overflow:auto; }
.envoi-row { display:flex; align-items:center; gap:.5rem; padding:.4rem .5rem; border:1px solid var(--line); border-radius:var(--r-md); }
.envoi-row input[type=checkbox] { flex-shrink:0; width:16px; height:16px; }
.envoi-row-body { flex:1; display:flex; gap:.4rem; min-width:0; }
/* Sélecteur à 2 classes (0,2,0) pour battre la règle de base input[type=…] (0,1,1) :
   sinon width:100% l'emportait → le nom prenait toute la largeur et l'e-mail s'écrasait. */
.envoi-row-body .envoi-in-nom  { flex:0 0 34%; width:auto; min-width:0; }
.envoi-row-body .envoi-in-mail { flex:1 1 auto; width:auto; min-width:0; }
@media (max-width:560px){
  .envoi-row-body { flex-direction:column; }
  .envoi-row-body .envoi-in-nom, .envoi-row-body .envoi-in-mail { flex:0 0 auto; width:100%; }
}

.envoi-bloc { border-bottom:1px solid var(--line); }
.envoi-bloc:last-child { border-bottom:0; }
.envoi-bloc-head { display:flex; align-items:center; gap:.4rem; padding:.55rem 1rem; background:var(--brand-tint); font-size:.84rem; font-weight:600; flex-wrap:wrap; }
.suivi-list { display:flex; flex-direction:column; }
.suivi-row { display:flex; align-items:center; justify-content:space-between; gap:.75rem; padding:.6rem 1rem; border-top:1px solid var(--line); flex-wrap:wrap; }
.suivi-who { display:flex; flex-direction:column; min-width:0; }
.suivi-who strong { font-size:.9rem; }
.suivi-state { display:flex; align-items:center; gap:.5rem; flex-wrap:wrap; justify-content:flex-end; }
.badge.tiny.ok { background:color-mix(in srgb, var(--ok) 15%, transparent); color:var(--ok); }
@media (max-width:640px){
  .suivi-row { flex-direction:column; align-items:flex-start; gap:.4rem; }
  .suivi-state { justify-content:flex-start; }
}

/* === CRM Partie A — annuaire : barre de filtres, picker, fiche, sélecteur de source ===== */
.crm-filterbar { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.crm-search {
  position: relative; display: flex; align-items: center; flex: 1; min-width: 220px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-md); padding: 0 .6rem;
}
.crm-search .icon { color: var(--ink-4); flex-shrink: 0; }
.crm-search input { border: 0; background: transparent; flex: 1; padding: .5rem .4rem; outline: none; font-size: .9rem; color: inherit; }
.crm-chips { display: flex; gap: .35rem; flex-wrap: wrap; }
.crm-chips .chip { padding: .3rem .7rem; border-radius: 999px; text-decoration: none; white-space: nowrap; cursor: pointer; transition: all var(--t-fast); }
.crm-chips .chip:hover { border-color: var(--brand-soft); }
.crm-chips .chip.is-on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Sélecteur CRM (modale intervenant / participant) — recherche descriptive (2C) */
.crm-picker-list {
  display: flex; flex-direction: column; gap: .2rem; max-height: 240px; overflow: auto;
  border: 1px solid var(--line); border-radius: var(--r-md); padding: .3rem; background: var(--brand-tint);
}
.crm-picker-item {
  display: flex; align-items: center; gap: .6rem; width: 100%; text-align: left;
  padding: .5rem .6rem; border: 1px solid transparent; border-radius: var(--r-sm); background: transparent; cursor: pointer;
}
.crm-picker-item:hover { background: #fff; }
.crm-picker-item.is-sel { background: var(--brand-soft); border-color: var(--brand); }
.crm-picker-ic { display: inline-flex; width: 30px; height: 30px; align-items: center; justify-content: center; border-radius: 50%; flex-shrink: 0; }
.crm-picker-ic--contact { background: var(--brand-soft); color: var(--brand-strong); }
.crm-picker-ic--org { background: #e8eef7; color: #3a5a8c; }
.crm-picker-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.crm-picker-txt strong { font-size: .88rem; }
.crm-picker-tag { margin-left: auto; color: var(--ink-4); text-transform: uppercase; letter-spacing: .04em; font-size: .62rem; font-weight: 700; white-space: nowrap; }

/* Sélecteur de source du participant : Saisie libre / CRM / Collaborateur */
.seg-source { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; flex-wrap: wrap; }
.seg-source button {
  display: inline-flex; align-items: center; gap: .3rem; padding: .4rem .7rem; border: 0;
  background: var(--bg); color: var(--ink-2); cursor: pointer; font-size: .82rem; border-right: 1px solid var(--line);
}
.seg-source button:last-child { border-right: 0; }
.seg-source button.is-on { background: var(--brand); color: #fff; }

/* Fiche organisation — grille d'infos + lignes compactes */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .75rem; }
.info-item { display: flex; flex-direction: column; gap: .15rem; }
.info-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-4); font-weight: 600; }
.mini-row {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .55rem 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit;
}
.mini-row:last-child { border-bottom: 0; }
.mini-row:hover { background: var(--brand-tint); }

/* === Visu des lignes de PV (présentation : lecture par chapitre plus claire) ============ */
.pv-lignes { display: flex; flex-direction: column; }
.pv-ligne-row {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .7rem 1rem; border-bottom: 1px solid var(--line);
}
.pv-ligne-row:last-child { border-bottom: 0; }
.pv-ligne-row:hover { background: var(--brand-tint); }
.pv-ligne-row > .pv-code { width: 26px; height: 26px; font-size: .76rem; margin-top: .1rem; }
.pv-ligne-main { flex: 1; min-width: 0; }
.pv-ligne-chips { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .4rem; }
.pv-ligne-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px;
  padding: .12rem .55rem; font-size: .76rem; color: var(--ink-2);
}
.pv-ligne-chip .icon { width: 13px; height: 13px; }
.pv-ligne-row .row-actions { margin-left: auto; opacity: 0; transition: var(--t-fast); flex-shrink: 0; }
.pv-ligne-row:hover .row-actions, .pv-ligne-row:focus-within .row-actions { opacity: 1; }
@media (hover: none) { .pv-ligne-row .row-actions { opacity: 1; } }

/* === Module Permis — onglet « marches à suivre » (checklists par phase) ===== */
.permis-phases { display: flex; flex-direction: column; gap: .6rem; }
.permis-phase { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--bg); }
.permis-phase-head { width: 100%; display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .7rem .9rem; background: none; border: 0; cursor: pointer; text-align: left; font: inherit; }
.permis-phase-head:hover { background: var(--brand-tint); }
.permis-phase-titre { display: flex; align-items: center; gap: .55rem; font-weight: 650; }
.permis-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); flex: 0 0 auto; }
.permis-phase.is-en_cours .permis-dot { background: var(--warn); }
.permis-phase.is-terminee .permis-dot { background: var(--ok); }
.permis-phase-meta { display: flex; align-items: center; gap: .6rem; flex: 0 0 auto; }
.permis-bar { width: 120px; }
.permis-phase.is-en_cours .permis-bar > span { background: var(--brand); }
.permis-phase.is-terminee .permis-bar > span { background: var(--ok); }
.permis-pct { font-variant-numeric: tabular-nums; font-weight: 650; min-width: 38px; text-align: right; font-size: .85rem; }
.permis-chev { display: inline-flex; transition: transform var(--t); color: var(--brand-grey); }
.permis-chev.is-open { transform: rotate(90deg); }
.permis-phase-body { padding: .3rem .9rem .8rem; border-top: 1px solid var(--line); }
.permis-section { margin-top: .6rem; }
.permis-section-titre { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--brand-grey); font-weight: 700; margin: .2rem 0 .3rem; }
.permis-tache { display: flex; align-items: flex-start; gap: .55rem; padding: .4rem .3rem; border-radius: 8px; }
.permis-tache:hover { background: var(--brand-tint); }
.permis-tache:hover .permis-mini { opacity: 1; }
.permis-check { flex: 0 0 auto; background: none; border: 0; cursor: pointer; color: var(--line-strong);
  padding: 0; display: inline-flex; margin-top: 1px; }
.permis-tache.st-faite .permis-check { color: var(--ok); }
.permis-tache.st-faite .permis-tache-lib { text-decoration: line-through; color: var(--brand-grey); }
.permis-tache.st-non_concernee { opacity: .55; }
.permis-tache.st-non_concernee .permis-tache-lib { text-decoration: line-through; }
.permis-tache-main { flex: 1 1 auto; min-width: 0; }
.permis-tache-lib { line-height: 1.35; }
.permis-tache-aide { margin-top: .15rem; white-space: pre-wrap; }
.permis-tache-note { margin-top: .4rem; }
.permis-note-input { width: 100%; font: inherit; font-size: .85rem; }
.permis-tache-actions { flex: 0 0 auto; display: flex; align-items: center; gap: .3rem; }
.permis-mini { background: none; border: 1px solid transparent; border-radius: 6px; cursor: pointer;
  color: var(--brand-grey); padding: .15rem .35rem; display: inline-flex; align-items: center;
  font-size: .72rem; opacity: .45; transition: opacity var(--t), background var(--t); }
.permis-mini:hover { background: var(--brand-soft); color: var(--brand-strong); opacity: 1; }
.permis-mini.danger:hover { background: var(--danger-bg); color: var(--danger); }
.permis-nc { font-weight: 700; letter-spacing: .02em; }
.permis-nc.is-on { background: var(--brand-soft); color: var(--brand-strong); opacity: 1; }
.permis-add { display: flex; gap: .5rem; margin-top: .8rem; padding-top: .6rem; border-top: 1px dashed var(--line); }
.permis-add input { flex: 1 1 auto; }
.btn-sm { padding: .35rem .6rem; font-size: .82rem; }
/* Zone « documents figés » (verrou DT) */
.doc-frozen-tag { color: var(--brand-strong); font-weight: 600; }
.doc-card.is-frozen { border-color: var(--brand-soft); background: var(--brand-tint); }

/* === Tableau réglementaire de la parcelle (IA + édition) =================== */
.tbl-gen-form { background: var(--brand-tint); border: 1px solid var(--brand-soft); border-radius: 10px;
  padding: .6rem .7rem; margin-top: .5rem; }
.tbl-meta { display: flex; gap: 1rem; flex-wrap: wrap; margin: .2rem 0 .7rem; }
.tbl-meta label { display: flex; flex-direction: column; gap: .2rem; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .03em; color: var(--brand-grey); font-weight: 700; }
.tbl-meta input { font: inherit; font-size: .9rem; text-transform: none; letter-spacing: 0;
  font-weight: 400; padding: .3rem .5rem; }
.reglement-wrap { overflow-x: auto; }
.reglement-tbl { width: 100%; border-collapse: collapse; }
.reglement-tbl th, .reglement-tbl td { border: 1px solid var(--line); padding: .25rem .35rem;
  text-align: left; vertical-align: middle; }
.reglement-tbl thead th { background: var(--brand-soft); color: var(--brand-strong); font-size: .7rem;
  text-transform: uppercase; letter-spacing: .02em; }
.reglement-tbl td.reglement-param { font-weight: 600; white-space: nowrap; font-size: .82rem; }
.reglement-tbl input { width: 100%; border: 1px solid transparent; background: transparent; font: inherit;
  font-size: .85rem; padding: .2rem .3rem; border-radius: 5px; }
.reglement-tbl input:hover { border-color: var(--line); }
.reglement-tbl input:focus { border-color: var(--brand); background: var(--bg); outline: none; }
.reglement-tbl tr.is-averif { background: var(--warn-bg); }
.reglement-tbl tr.is-averif td.reglement-param { color: var(--warn); }
.reglement-av { text-align: center; white-space: nowrap; }
.reglement-av .permis-mini { opacity: 1; }
/* Traçabilité : d'où vient chaque valeur remplie par l'IA */
.reglement-src { font-size: .64rem; color: var(--muted); margin-top: .12rem; font-style: italic;
  white-space: normal; word-break: break-word; }
.reglement-sources { display: flex; align-items: center; gap: .4rem; margin: 0 0 .5rem; padding: .4rem .6rem;
  background: var(--brand-soft); border-radius: 6px; font-size: .78rem; color: var(--brand-strong); }
.reglement-sources b { font-weight: 600; }
.tg-tabl-src { font-size: .62rem; color: var(--muted); margin-top: .1rem; font-style: italic;
  white-space: normal; word-break: break-word; }
/* Comparaison IA vs correction humaine */
.reglement-diff { font-size: .64rem; color: var(--warn); margin-top: .12rem; white-space: normal;
  word-break: break-word; border-left: 2px solid var(--warn); padding-left: .35rem; }
.reglement-corr { display: inline-flex; align-items: center; gap: .3rem; font-size: .74rem; color: var(--warn); }
.reglement-valide-ok { display: flex; align-items: center; gap: .4rem; margin-top: .5rem; padding: .45rem .6rem;
  background: var(--ok-bg, #e8f5ec); border-radius: 6px; font-size: .8rem; color: var(--ok, #1a7f45); }
.reglement-valide-ok a { font-weight: 600; }
/* Écran global de révision des corrections */
.corr-rank-list { display: flex; flex-wrap: wrap; gap: .4rem; padding: .3rem 0; }
.corr-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .55rem; border-radius: 999px;
  background: var(--surface-2, #f1f3f5); color: var(--text); font-size: .78rem; border: 1px solid var(--line); }
.corr-chip:hover { border-color: var(--brand); }
.corr-chip.is-on { background: var(--brand-soft); color: var(--brand-strong); border-color: var(--brand); }
.corr-chip b { font-weight: 700; }
.corr-wrap { overflow-x: auto; }
.corr-tbl { width: 100%; border-collapse: collapse; }
.corr-tbl th, .corr-tbl td { border-bottom: 1px solid var(--line); padding: .35rem .5rem; text-align: left;
  font-size: .82rem; vertical-align: top; }
.corr-tbl thead th { background: var(--brand-soft); color: var(--brand-strong); font-size: .7rem;
  text-transform: uppercase; letter-spacing: .03em; position: sticky; top: 0; }
.corr-date, .corr-col, .corr-par { white-space: nowrap; color: var(--muted); }
.corr-param { font-weight: 600; white-space: nowrap; }
.corr-av { color: var(--muted); }
.corr-ap { color: var(--warn); font-weight: 500; }
.reglement-foot { display: flex; align-items: center; gap: .6rem; margin-top: .7rem; justify-content: flex-end; }
.tbl-completer { background: var(--brand-tint); border: 1px solid var(--brand-soft); border-radius: 10px;
  padding: .55rem .7rem; margin-bottom: .7rem; }

/* === Mails types ========================================================== */
.mails-list { display: flex; flex-direction: column; gap: .4rem; }
.mail-item { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.mail-head { width: 100%; display: flex; align-items: center; gap: .6rem; padding: .55rem .8rem;
  background: none; border: 0; cursor: pointer; text-align: left; font: inherit; }
.mail-head:hover { background: var(--brand-tint); }
.mail-titre { flex: 1 1 auto; min-width: 0; }
.mail-body { padding: .3rem .8rem .8rem; border-top: 1px solid var(--line); }
.mail-lbl { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .03em;
  color: var(--brand-grey); font-weight: 700; margin: .5rem 0 .2rem; }
.mail-objet { width: 100%; font: inherit; padding: .35rem .5rem; }
.mail-corps { width: 100%; font: inherit; font-size: .88rem; line-height: 1.4; padding: .4rem .5rem; resize: vertical; }
.mail-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: .6rem; }

/* === Délais & relances ==================================================== */
.echeance-add { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: .7rem;
  background: var(--brand-tint); border: 1px solid var(--brand-soft); border-radius: 10px; padding: .6rem .7rem; }
.echeance-add input[type="text"], .echeance-add input[type="email"] { flex: 1 1 12rem; min-width: 0; }
.echeance-jrl { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem;
  color: var(--brand-grey); white-space: nowrap; }
.echeance-jrl input { width: 3.4rem; }
.echeances-tbl tr.is-relance { background: var(--warn-bg); }
.echeances-tbl tr.is-depassee { background: var(--danger-bg); }
.echeances-tbl tr.is-repondu { opacity: .6; }
.echeance-actions { white-space: nowrap; text-align: right; }
.echeance-actions .permis-mini { opacity: 1; vertical-align: middle; }
.echeance-actions .btn-sm { vertical-align: middle; }

/* === Faisabilité (brouillon IA, non contractuel) ========================== */
.faisa-warn { display: flex; align-items: flex-start; gap: .4rem; background: var(--warn-bg);
  border: 1px solid var(--warn); color: var(--warn); border-radius: 8px; padding: .5rem .7rem;
  font-size: .82rem; margin-top: .2rem; }
.faisa-warn strong { color: var(--warn); }
.faisa-synthese { margin: .7rem 0; line-height: 1.5; }
.faisa-tbl { width: 100%; border-collapse: collapse; margin: .5rem 0; }
.faisa-tbl td { border: 1px solid var(--line); padding: .3rem .5rem; font-size: .88rem; }
.faisa-tbl td.faisa-label { font-weight: 600; width: 45%; background: var(--brand-tint); }
.faisa-block { margin-top: .6rem; }
.faisa-block-t { font-size: .72rem; text-transform: uppercase; letter-spacing: .03em;
  color: var(--brand-grey); font-weight: 700; margin-bottom: .2rem; }
.faisa-block ul { margin: 0; padding-left: 1.1rem; }
.faisa-block li { margin: .15rem 0; font-size: .88rem; line-height: 1.4; }
.faisa-alertes .faisa-block-t { color: var(--warn); }
.faisa-possible .faisa-block-t { color: var(--ok); }
.faisa-contraintes .faisa-block-t { color: var(--danger); }
.faisa-foot { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: .8rem;
  padding-top: .6rem; border-top: 1px solid var(--line); }
.faisa-valider { display: flex; gap: .4rem; align-items: center; margin: 0 0 0 auto; }
.faisa-valider input { font: inherit; padding: .3rem .5rem; }
.badge.conf-faible { background: var(--danger-bg); color: var(--danger); }
.badge.conf-moyenne { background: var(--warn-bg); color: var(--warn); }
.badge.conf-elevee { background: var(--ok-bg); color: var(--ok); }

/* ============================================================================
   ÉTUDES — feuille de route à états (refonte onglet Permis)
   ============================================================================ */
/* nav : lien « +5 onglets masqués » */
.tablist .tab-more { color: var(--brand-grey); border: 1px dashed var(--line-strong); background: transparent; }
.tablist .tab-more:hover { color: var(--brand-strong); border-color: var(--brand-soft); background: var(--brand-tint); }

/* En-tête de phase */
.etudes-head-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.phase-pills { display: flex; gap: .4rem; flex-wrap: wrap; }
.phase-pill { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--line); background: var(--bg);
  border-radius: 999px; padding: .3rem .7rem; cursor: pointer; font: inherit; font-size: .85rem; color: var(--brand-grey); }
.phase-pill:hover { border-color: var(--brand-soft); }
.phase-pill.is-on { background: var(--brand-strong); border-color: var(--brand-strong); color: #fff; font-weight: 600; }
.phase-pill-pct { font-variant-numeric: tabular-nums; font-size: .76rem; opacity: .8; }
/* Offre « à la carte » — phase hors mandat : grisée, pointillés, non comptée */
.phase-pill.is-na { color: var(--ink-3); border-style: dashed; opacity: .7; }
.phase-pill.is-na.is-on { background: var(--brand-grey); border-color: var(--brand-grey); color: #fff; opacity: 1; }
.phase-pill-na { font-size: .68rem; text-transform: uppercase; letter-spacing: .3px; opacity: .8; }
.phase-cfg-btn { display: inline-flex; align-items: center; border: 1px dashed var(--line); background: var(--bg);
  border-radius: 999px; padding: .3rem .55rem; cursor: pointer; color: var(--brand-grey); }
.phase-cfg-btn:hover, .phase-cfg-btn.is-on { border-color: var(--brand-soft); color: var(--brand-strong); background: var(--brand-soft); }
.phase-cfg { margin: .7rem 0 .2rem; padding: .6rem .75rem; border: 1px dashed var(--line); border-radius: 10px; background: var(--surface-2, #faf8fb); }
.phase-cfg-lead { font-size: .82rem; color: var(--ink-2); margin-bottom: .5rem; display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.phase-cfg-items { display: flex; gap: 1.1rem; flex-wrap: wrap; }
.phase-cfg-item { display: inline-flex; align-items: center; gap: .4rem; font-size: .86rem; cursor: pointer; }
.phase-cfg-item input { width: 1rem; height: 1rem; accent-color: var(--brand-strong); }
.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.view-toggle button { background: var(--bg); border: 0; padding: .35rem .7rem; cursor: pointer; font: inherit;
  font-size: .82rem; color: var(--brand-grey); display: inline-flex; align-items: center; gap: .3rem; }
.view-toggle button + button { border-left: 1px solid var(--line); }
.view-toggle button.is-on { background: var(--brand-soft); color: var(--brand-strong); font-weight: 600; }
.etudes-progress { display: flex; align-items: center; gap: .7rem; margin: .8rem 0 .6rem; }
.etudes-progress .bar { flex: 1 1 auto; height: 7px; }
.etudes-progress .bar > span { background: var(--brand); }
.etudes-progress-txt { font-size: .85rem; color: var(--brand-grey); white-space: nowrap; }
.etudes-progress-txt strong { color: var(--brand-strong); }
.etat-counters { display: flex; flex-wrap: wrap; gap: .4rem; }
.etat-counters .ec { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: .2rem .6rem;
  cursor: pointer; font: inherit; font-size: .78rem; color: var(--brand-grey); display: inline-flex; align-items: center; gap: .3rem; }
.etat-counters .ec:hover { border-color: var(--brand-soft); }
.etat-counters .ec.is-on { border-color: var(--brand); background: var(--brand-tint); color: var(--brand-strong); font-weight: 600; }
.etat-counters .ec-g { font-weight: 700; }
.ec-a_faire .ec-g { color: var(--line-strong); } .ec-en_attente .ec-g { color: var(--brand); }
.ec-a_revoir .ec-g { color: var(--warn); } .ec-faite .ec-g { color: var(--ok); } .ec-nc .ec-g { color: var(--brand-grey); }

/* Bandeau « À traiter maintenant » */
.cockpit { position: sticky; top: .5rem; z-index: 5; background: var(--bg); border: 1px solid var(--warn);
  border-radius: 12px; padding: .7rem .9rem; margin-bottom: .85rem; box-shadow: 0 4px 18px rgba(177,100,12,.12); }
.cockpit-head { display: flex; align-items: center; gap: .4rem; font-weight: 700; color: var(--warn); font-size: .9rem; margin-bottom: .4rem; }
.cockpit-n { background: var(--warn); color: #fff; border-radius: 999px; font-size: .72rem; padding: 0 .4rem; }
.cockpit-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .45rem .2rem; border-top: 1px solid var(--line); flex-wrap: wrap; }
.cockpit-item:first-of-type { border-top: 0; }
.cockpit-item-main { display: flex; align-items: baseline; gap: .5rem; min-width: 0; flex: 1 1 auto; }
.cockpit-glyph { font-weight: 700; }
.ci-relance .cockpit-glyph { color: var(--danger); } .ci-attente .cockpit-glyph { color: var(--brand); } .ci-revoir .cockpit-glyph { color: var(--warn); }
.cockpit-label { font-weight: 600; }
.cockpit-sub { color: var(--brand-grey); font-size: .8rem; }
.cockpit-item-act { display: flex; align-items: center; gap: .4rem; flex-shrink: 0; }

/* Feuille de route */
.roadmap .rm-section { margin-top: .7rem; }
.roadmap .rm-section:first-child { margin-top: 0; }
.rm-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem;
  border-bottom: 1px solid var(--line); padding-bottom: .25rem; margin-bottom: .2rem; }
.rm-section-nom { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--brand-strong); font-weight: 700; }
.rm-section-count { font-size: .76rem; color: var(--brand-grey); font-variant-numeric: tabular-nums; }
.rm-tache { display: flex; align-items: flex-start; gap: .5rem; padding: .4rem .3rem; border-radius: 8px; }
.rm-tache:hover { background: var(--brand-tint); }
.rm-tache.is-long { box-shadow: inset 3px 0 0 var(--warn); }
.rm-check { flex: 0 0 auto; background: none; border: 0; cursor: pointer; padding: 0; margin-top: 1px; }
.rm-glyph { font-size: 1.05rem; line-height: 1; color: var(--line-strong); }
.st-en_attente .rm-glyph { color: var(--brand); } .st-a_revoir .rm-glyph { color: var(--warn); }
.st-faite .rm-glyph { color: var(--ok); } .st-non_concernee .rm-glyph { color: var(--brand-grey); }
.rm-main { flex: 1 1 auto; min-width: 0; cursor: pointer; }
.rm-lib { line-height: 1.35; }
.st-faite .rm-lib, .st-non_concernee .rm-lib { text-decoration: line-through; color: var(--brand-grey); }
.rm-meta { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-top: .15rem; }
.rm-state { font-size: .74rem; padding: .05rem .45rem; border-radius: 999px; background: var(--panel-2); color: var(--brand-grey); }
.rs-en_attente { background: var(--brand-soft); color: var(--brand-strong); }
.rs-a_revoir { background: var(--warn-bg); color: var(--warn); }
.rs-faite { background: var(--ok-bg); color: var(--ok); }
.rm-chip { font-size: .72rem; padding: .05rem .45rem; border-radius: 999px; background: var(--brand-soft);
  color: var(--brand-strong); cursor: pointer; }
.rm-chip:hover { background: var(--brand); color: #fff; }
/* Chip d'action (tâche = action) : bordé + coloré selon le type */
.rm-chip-act { border: 1px solid currentColor; background: transparent; display: inline-flex; align-items: center; gap: .25rem;
  font-weight: 600; padding: .05rem .5rem; }
.rm-chip-act.act-mail { color: #7b2a85; }
.rm-chip-act.act-dossier { color: #a86813; }
.rm-chip-act.act-outil { color: #2e7d6b; }
.rm-chip-act.act-lien { color: #2f6bb0; }
.rm-chip-act:hover { color: #fff; background: currentColor; }
.rm-chip-act:hover > span { color: #fff; }
.rm-chip-sent { color: var(--ok, #2e9e4f); font-weight: 600; }
/* Bloc d'action dans l'éditeur */
.rm-action { margin: .5rem 0 .1rem; }
.rm-action-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.rm-mail-track { font-size: .78rem; color: var(--ink-2); display: inline-flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.rm-mail-track .is-late { color: var(--danger); font-weight: 600; }

/* Check-list générale (aide au dessin, normes) */
.norme-section { border-top: 1px solid var(--line); }
.norme-section:first-of-type { border-top: 0; }
.norme-section-head { width: 100%; display: flex; align-items: center; gap: .5rem; background: none; border: 0;
  cursor: pointer; padding: .5rem .1rem; font: inherit; text-align: left; color: var(--ink); }
.norme-section-head .permis-chev { transition: transform .15s; color: var(--brand-grey); display: inline-flex; }
.norme-section-head .permis-chev.is-open { transform: rotate(90deg); }
.norme-section-nom { font-weight: 600; flex: 1 1 auto; }
.norme-items { padding: 0 0 .5rem; }
.norme-item { display: flex; align-items: center; gap: .6rem; padding: .35rem .55rem; border-left: 3px solid var(--line);
  border-radius: 0 6px 6px 0; margin: .2rem 0; background: var(--panel-2, #faf9fb); }
.norme-item .norme-lib { flex: 1 1 auto; font-size: .84rem; }
.norme-item.ns-conforme { border-left-color: #2e9e4f; }
.norme-item.ns-non_conforme { border-left-color: var(--danger); }
.norme-item.ns-non_applicable { border-left-color: var(--ink-3); opacity: .7; }
.norme-item.ns-a_verifier { border-left-color: #d69b16; }
.norme-states { display: inline-flex; gap: .2rem; flex: 0 0 auto; }
.norme-states button { width: 1.7rem; height: 1.7rem; border: 1px solid var(--line); background: var(--bg);
  border-radius: 6px; cursor: pointer; font-size: .8rem; line-height: 1; color: var(--brand-grey); }
.norme-states button.is-on { color: #fff; font-weight: 700; border-color: transparent; }
.norme-states button:nth-child(1).is-on { background: #2e9e4f; }
.norme-states button:nth-child(2).is-on { background: #d69b16; }
.norme-states button:nth-child(3).is-on { background: var(--danger); }
.norme-states button:nth-child(4).is-on { background: var(--brand-grey); }

/* Planning — avancement des 4 phases process (Part 5) */
.pg-phase { border-top: 1px solid var(--line); }
.pg-phase:first-of-type { border-top: 0; }
.pg-phase.is-na { opacity: .65; }
.pg-phase-head { width: 100%; display: flex; align-items: center; gap: .7rem; background: none; border: 0;
  cursor: pointer; padding: .7rem .1rem; font: inherit; text-align: left; color: var(--ink); }
.pg-phase-head .permis-chev { transition: transform .15s; color: var(--brand-grey); display: inline-flex; }
.pg-phase-head .permis-chev.is-open { transform: rotate(90deg); }
.pg-phase-nom { font-weight: 600; flex: 0 0 8.5rem; }
.pg-bar { flex: 1 1 auto; height: 9px; background: var(--panel-2, #efe9f1); border-radius: 999px; overflow: hidden; }
.pg-bar-fill { display: block; height: 100%; background: var(--brand-strong); border-radius: 999px; transition: width .3s; }
.pg-bar-fill.is-full { background: #2e9e4f; }
.pg-pct { font-variant-numeric: tabular-nums; font-weight: 700; flex: 0 0 auto; min-width: 2.6rem; text-align: right; }
.pg-na { font-size: .68rem; text-transform: uppercase; letter-spacing: .3px; color: var(--ink-3); flex: 1 1 auto; }
.pg-tasks { padding: 0 0 .8rem 1.6rem; }
.pg-sec { margin-bottom: .5rem; }
.pg-sec-nom { font-size: .72rem; text-transform: uppercase; letter-spacing: .4px; color: var(--brand-grey); margin: .3rem 0 .2rem; }
.pg-task { display: flex; align-items: center; gap: .5rem; padding: .18rem 0; font-size: .85rem; }
.pg-task .pg-glyph { flex: 0 0 1.1rem; text-align: center; color: var(--brand-grey); }
.pg-task.pgt-faite .pg-lib { color: var(--ink-3); text-decoration: line-through; }
.pg-task.pgt-faite .pg-glyph { color: #2e9e4f; }
.pg-task.pgt-en_attente .pg-glyph { color: #d69b16; }
.pg-task.pgt-a_revoir .pg-glyph { color: #b1640c; }

/* Planning — Gantt par tâche (faites = par date à gauche ; à faire = colonnes à droite) */
.tg { --tg-label: 240px; --k-faite: #2e9e4f; --k-a_faire: #b9b3c2; --k-en_attente: #d69b16; --k-a_revoir: #c0392b; --k-ia: #2f6bb0;
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.tg-tools { display: flex; align-items: center; gap: .7rem; }
.tg-zoom { display: inline-flex; align-items: center; gap: .1rem; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.tg-zoom button { width: 1.9rem; height: 1.7rem; border: 0; background: var(--bg); cursor: pointer; font-size: 1.05rem; line-height: 1; color: var(--brand-grey); }
.tg-zoom button:hover:not(:disabled) { background: var(--brand-soft); color: var(--brand-strong); }
.tg-zoom button:disabled { opacity: .4; cursor: default; }
.tg-zoom-val { min-width: 2.1rem; text-align: center; font-size: .78rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tg-legend { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: .1rem 0 .7rem; }
.tg-legend i.tg-lg { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: .3rem; }
.tg-lg.k-faite { background: #2e9e4f; } .tg-lg.k-a_faire { background: #b9b3c2; }
.tg-lg.k-en_attente { background: #d69b16; } .tg-lg.k-a_revoir { background: #c0392b; } .tg-lg.k-ia { background: #2f6bb0; }
.tg-lg-sep { color: var(--ink-3); }

/* Cockpit « à traiter maintenant » — au-dessus du Gantt */
.tg-cockpit { border: 1px solid #f0d9a8; background: #fdf8ee; border-radius: 8px; padding: .55rem .7rem; margin: 0 0 .8rem; }
.tg-cockpit-head { display: flex; align-items: center; gap: .4rem; font-weight: 700; font-size: .82rem; color: #8a5a09; margin-bottom: .45rem; }
.tg-cockpit-n { background: #c0392b; color: #fff; border-radius: 10px; font-size: .68rem; padding: 0 .4rem; line-height: 1.4; }
.tg-cockpit-list { display: flex; flex-direction: column; gap: .25rem; }
.tg-ck { display: flex; align-items: center; gap: .5rem; font-size: .8rem; padding: .2rem .3rem; border-radius: 5px; }
.tg-ck:hover { background: #fff; }
.tg-ck-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-grey); }
.ck-relance .tg-ck-dot, .ck-attente .tg-ck-dot { background: #b1640c; }
.ck-ia .tg-ck-dot { background: #2f6bb0; }
.ck-revoir .tg-ck-dot { background: #c0392b; }
.ck-satac .tg-ck-dot { background: #7a3ea3; }
.tg-ck-lbl { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-ck-meta { flex: 0 0 auto; color: var(--ink-3); font-size: .72rem; }
.tg-ck-act { flex: 0 0 auto; display: inline-flex; align-items: center; gap: .2rem; font-size: .72rem; border: 1px solid var(--border, #e3dce6);
             background: #fff; border-radius: 5px; padding: .1rem .4rem; cursor: pointer; color: var(--brand-strong); text-decoration: none; }
.tg-ck-act:hover { background: var(--brand-soft); }

/* Bandeau d'automatisation SITN (RDPPF → tableau → faisabilité) */
.tg-rdppf { border-radius: 10px; padding: .55rem .75rem; margin-bottom: .7rem; font-size: .85rem; }
.tg-rdppf.rb-en_cours { background: #eef4fb; border: 1px solid #bcd4ee; color: #2f6bb0; }
.tg-rdppf.rb-termine { background: #e6f4ea; border: 1px solid #b7e0c4; color: #2e7d46; }
.tg-rdppf.rb-erreur { background: #fbe4e1; border: 1px solid #efb9b1; color: #a5352a; }
.tg-rdppf.rb-bloque { background: #fdf1e0; border: 1px solid #f0cfa0; color: #8a5a09; }
.tg-rdppf-in { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.tg-rdppf-in strong { flex: 0 0 auto; }
.tg-rdppf-in .btn { margin-left: auto; }
.tg-rdppf-x { border: 0; background: none; cursor: pointer; color: inherit; opacity: .6; padding: 0 .1rem; display: inline-flex; }
.tg-rdppf-x:hover { opacity: 1; }

/* Scroll horizontal + zoom : la piste s'élargit (× zoom), les libellés restent collés à gauche */
.tg-scroll { overflow-x: auto; overflow-y: hidden; }
.tg-inner { position: relative; width: calc(100% * var(--z, 1)); min-width: 100%; }
.tg-row { display: flex; align-items: stretch; min-height: 34px; border-top: 1px solid var(--line); }
.tg-row.tg-head { min-height: 0; }
.tg-body { position: relative; }
.tg-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--brand-strong); z-index: 1; }
.tg-today-lbl { position: absolute; top: 3px; left: 4px; font-size: .64rem; font-weight: 700; color: var(--brand-strong);
  background: var(--bg); padding: 0 .2rem; white-space: nowrap; border-radius: 3px; }

.tg-label { flex: 0 0 var(--tg-label); position: sticky; left: 0; z-index: 4; background: var(--bg);
  display: flex; align-items: center; gap: .45rem; padding: .35rem .8rem; border-right: 1px solid var(--line); box-sizing: border-box; overflow: hidden; }
.tg-head-label, .tg-head-axis { background: var(--panel-2, #f3eff5); font-size: .74rem; font-weight: 700; color: var(--ink-2); padding: .55rem .8rem; }
.tg-head { border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.tg-head-axis { display: flex; align-items: center; }
.tg-ax-past { display: inline-flex; align-items: center; white-space: nowrap; overflow: hidden; box-sizing: border-box; }
.tg-ax-future { flex: 1 1 auto; padding-left: .6rem; border-left: 1px dashed var(--brand-soft); color: var(--brand-grey); }

.tg-row.is-phase { background: var(--brand-tint, #f7f2f8); }
.tg-phase-label { cursor: pointer; font-weight: 700; background: var(--brand-tint, #f7f2f8); }
.tg-phase-label:hover { background: var(--brand-soft); }
.tg-phase-label.is-selected { background: var(--brand-soft); color: var(--brand-strong); box-shadow: inset 3px 0 0 var(--brand-strong); }
.tg-phase-label.is-selected .tg-phase-nom { color: var(--brand-strong); }
.tg-phase-label .permis-chev { color: var(--brand-grey); display: inline-flex; transition: transform .15s; }
.tg-phase-label .permis-chev.is-open { transform: rotate(90deg); }
.tg-phase-nom { flex: 1 1 auto; }
.tg-phase-meta { font-weight: 500; }
.tg-phase-band { position: absolute; inset: 40% 0; background: transparent; }

.tg-task-label { cursor: pointer; }
.tg-task-label:hover { background: var(--surface-2, #faf8fb); }
.tg-g { flex: 0 0 auto; color: var(--brand-grey); }
/* Coche rapide inline (marquer fait sans ouvrir le modal) */
.tg-check { flex: 0 0 auto; width: 16px; height: 16px; border: 1.5px solid var(--brand-grey, #b7adba); border-radius: 4px;
            background: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; margin-right: .1rem; }
.tg-check:hover { border-color: var(--k-faite, #1a7f45); }
.tg-check .tg-check-mk { font-size: .7rem; line-height: 1; color: transparent; }
.tg-check.is-done { background: var(--k-faite, #1a7f45); border-color: var(--k-faite, #1a7f45); }
.tg-check.is-done .tg-check-mk { color: #fff; }
/* Bouton « + tâche » sur la ligne de phase ouverte */
.tg-addtask { flex: 0 0 auto; margin-left: .35rem; border: 1px solid var(--border, #e3dce6); background: #fff; border-radius: 5px;
              width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--brand-strong); }
.tg-addtask:hover { background: var(--brand-soft); }
.tg-label-t { font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-row.k-faite .tg-label-t { color: var(--ink-3); text-decoration: line-through; }
.tg-row.k-faite .tg-g { color: var(--k-faite); }
.tg-row.k-ia .tg-label-t { color: var(--k-ia); font-weight: 600; }
.tg-row.k-ia .tg-g { color: var(--k-ia); }
.tg-row.k-en_attente .tg-g { color: var(--k-en_attente); }
.tg-row.k-a_revoir .tg-g { color: var(--k-a_revoir); }
.tg-track { flex: 1 1 auto; position: relative; }
.tg-blk { position: absolute; top: 50%; transform: translateY(-50%); height: 24px; border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; box-sizing: border-box; min-width: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.12); transition: filter .1s; }
.tg-blk:hover { filter: brightness(1.08); outline: 2px solid var(--brand-soft); }
.tg-blk.k-faite { background: var(--k-faite); }
.tg-blk.k-ia { background: var(--k-ia); }
.tg-blk.k-a_faire { background: var(--k-a_faire); }
.tg-blk.k-en_attente { background: var(--k-en_attente); }
.tg-blk.k-a_revoir { background: var(--k-a_revoir); }
.tg-blk-date { position: absolute; left: calc(100% + 5px); font-size: .68rem; font-weight: 700; color: var(--k-faite); white-space: nowrap; }
.tg-blk-col { font-size: .62rem; font-weight: 700; color: #fff; padding: 0 .25rem; white-space: nowrap; overflow: hidden; }
.gantt-na { margin-top: .7rem; padding-top: .6rem; border-top: 1px dashed var(--line); display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; }
.gantt-na-pill { border: 1px dashed var(--line); border-radius: 999px; padding: .1rem .55rem; color: var(--ink-3); font-size: .72rem; text-transform: uppercase; letter-spacing: .3px; }

/* Modal tâche (Gantt) */
.tg-modal-ov { position: fixed; inset: 0; background: rgba(20,16,22,.45); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.tg-modal { background: var(--bg); border-radius: 14px; width: min(560px, 100%); max-height: 86vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); padding: 1.1rem 1.2rem 1.2rem; }
.tg-modal.tg-modal-wide { width: min(1500px, 96vw); max-height: 94vh; }
.tg-modal.tg-modal-wide .tg-tabl-wrap { max-height: 66vh; }
.tg-modal.tg-modal-wide .tg-tabl-t { font-size: .82rem; }
.tg-modal-head { display: flex; align-items: center; justify-content: space-between; }
.tg-modal-state { font-size: .72rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; background: var(--panel-2); color: var(--brand-grey); }
.tg-modal-state.k-faite { background: #e6f4ea; color: #2e7d46; } .tg-modal-state.k-en_attente { background: #fbf0d8; color: #a2740f; } .tg-modal-state.k-a_revoir { background: #fbe4e1; color: #a5352a; }
.tg-modal-x { border: 0; background: none; cursor: pointer; color: var(--brand-grey); padding: .2rem; display: inline-flex; }
.tg-modal-title { margin: .5rem 0 .8rem; font-size: 1.05rem; }
.tg-bf { border: 1px solid #e6b800; background: #fff9e6; border-radius: 10px; padding: .6rem .7rem; margin-bottom: .6rem; }
.tg-bf-lead { font-size: .8rem; color: #6b5300; margin-bottom: .5rem; display: flex; align-items: flex-start; gap: .35rem; }
.tg-bf-lead code { background: #fff; border: 1px solid #e6b800; border-radius: 4px; padding: 0 .2rem; }
.tg-bf-row { display: flex; gap: .4rem; flex-wrap: wrap; }
.tg-bf-row input { flex: 1 1 8rem; min-width: 7rem; border: 1px solid var(--line); border-radius: 8px; padding: .4rem .55rem; font: inherit; }
.tg-modal-mail .tg-ml { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .4px; color: var(--brand-grey); margin: .5rem 0 .2rem; }
.tg-modal-mail input, .tg-modal-mail textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: .5rem .6rem; font: inherit; box-sizing: border-box; }
.tg-modal-draft { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-top: .5rem; }
.tg-draft-saved { color: #2e9e4f; font-weight: 600; white-space: nowrap; }
.tg-modal-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .7rem; }
.tg-reset { margin-top: .55rem; border: 0; background: none; cursor: pointer; color: var(--brand-grey); font-size: .78rem; padding: 0; }
.tg-reset:hover { color: var(--brand-strong); text-decoration: underline; }
.tg-modal-foot { margin-top: .9rem; }
.tg-modal-bf { width: min(480px, 100%); }
.tg-bf-input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: .5rem .6rem; font: inherit; box-sizing: border-box; }
.tg-bf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; align-items: start; }
.tg-ac { position: relative; }
.tg-ac-list { position: absolute; z-index: 5; left: 0; right: 0; top: 100%; margin-top: 2px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.14); max-height: 200px; overflow: auto; }
.tg-ac-item { display: block; width: 100%; text-align: left; border: 0; background: none; cursor: pointer;
  padding: .4rem .6rem; font: inherit; font-size: .85rem; }
.tg-ac-item:hover { background: var(--brand-soft); color: var(--brand-strong); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .82rem; }
.tg-sitn { margin-top: .6rem; padding: .5rem .65rem; border-radius: 8px; font-size: .82rem; display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.tg-sitn.tg-sitn-ok { background: #e6f4ea; color: #2e7d46; border: 1px solid #b7e0c4; }
.tg-sitn.tg-sitn-err { background: #fbe4e1; color: #a5352a; border: 1px solid #efb9b1; display: block; }
.tg-sitn.tg-sitn-warn { background: #fff9e6; color: #6b5300; border: 1px solid #e6c34d; display: block; }
.tg-sitn.tg-sitn-run { background: #eef4fb; color: #2f6bb0; border: 1px solid #bcd4ee; }
.tg-cand { display: flex; align-items: center; gap: .5rem; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: .35rem .5rem; margin-top: .3rem; cursor: pointer; }
.tg-cand.is-on { border-color: #2e7d46; box-shadow: inset 3px 0 0 #2e7d46; background: #f2fbf5; }
.tg-sitn-note { margin-top: .5rem; padding: .4rem .6rem; border-radius: 8px; background: #eef4fb; border: 1px dashed #bcd4ee; color: #2f6bb0; line-height: 1.4; }
.tg-sitn-note .icon { vertical-align: -2px; margin-right: .25rem; }
.tg-cand:hover { border-color: var(--brand-soft); }
/* Fichiers rattachés à une tâche */
.tg-files { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .7rem; }
.tg-files-t { font-size: .72rem; text-transform: uppercase; letter-spacing: .4px; color: var(--brand-grey); margin-bottom: .4rem; }
.tg-file { display: flex; align-items: center; gap: .3rem; margin-bottom: .3rem; border: 1px solid var(--line);
  border-radius: 8px; background: var(--panel-2, #f6f3f7); }
.tg-file:hover { border-color: var(--brand-soft); }
.tg-file-lnk { flex: 1 1 auto; display: flex; align-items: center; gap: .4rem; padding: .35rem .5rem; text-decoration: none; color: var(--ink); overflow: hidden; }
.tg-file-lnk:hover { color: var(--brand-strong); }
.tg-file-del { flex: 0 0 auto; border: 0; background: none; cursor: pointer; color: var(--ink-3); padding: .35rem .5rem; display: inline-flex; }
.tg-file-del:hover { color: var(--danger); }
.tg-file-n { flex: 1 1 auto; font-size: .84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Note « fait par IA » (bleue) */
.tg-ia-note { margin: .2rem 0 .1rem; padding: .5rem .65rem; border-radius: 8px; background: #eef4fb; border: 1px solid #bcd4ee; color: #2f6bb0; font-size: .84rem; }
/* Tableau réglementaire éditable dans le modal */
.tg-tabl { margin-top: .8rem; }
.tg-tabl-meta { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem; }
.tg-tabl-meta label { font-size: .72rem; color: var(--brand-grey); display: flex; align-items: center; gap: .3rem; }
.tg-tabl-meta input { border: 1px solid var(--line); border-radius: 6px; padding: .25rem .4rem; font: inherit; font-size: .8rem; width: 8rem; }
.tg-tabl-wrap { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.tg-tabl-t { width: 100%; border-collapse: collapse; font-size: .78rem; }
.tg-tabl-t thead th { position: sticky; top: 0; background: var(--panel-2, #f3eff5); text-align: left; padding: .35rem .4rem; border-bottom: 1px solid var(--line); font-weight: 700; z-index: 1; }
.tg-tabl-t td { border-bottom: 1px solid var(--line); padding: .1rem .25rem; }
.tg-tabl-t td.tg-tabl-p { font-weight: 600; white-space: nowrap; padding-right: .5rem; }
.tg-tabl-t tr.is-av td.tg-tabl-p { color: #b1640c; }
.tg-tabl-t input[type=text] { width: 100%; border: 1px solid transparent; border-radius: 5px; padding: .25rem .35rem; font: inherit; font-size: .78rem; background: transparent; box-sizing: border-box; }
.tg-tabl-t input[type=text]:hover { border-color: var(--line); }
.tg-tabl-t input[type=text]:focus { border-color: var(--brand); background: var(--bg); outline: none; }
.tg-tabl-t tr.is-av input[type=text] { background: #fff8ef; }
.tg-tabl-av { text-align: center; }
.tg-tabl-foot { display: flex; align-items: center; gap: .6rem; margin-top: .6rem; flex-wrap: wrap; }
/* Fichiers : tag du sous-dossier (ex. Terrain vs Géomètre) + upload différencié */
.tg-file-folder { font-size: .62rem; color: var(--brand-strong); background: var(--brand-soft);
  border-radius: 4px; padding: .05rem .3rem; margin-left: .35rem; white-space: nowrap; }
.tg-files-multi { display: flex; flex-wrap: wrap; gap: .4rem; }
.tg-files-multi .btn { flex: 0 0 auto; }
.tg-valide-ok { display: inline-flex; align-items: center; gap: .3rem; font-size: .74rem; color: var(--ok, #1a7f45); }
.tg-valide-ok a { font-weight: 600; }
/* Check-list générale embarquée dans le modal de tâche */
.tg-chk { margin-top: .8rem; }
.tg-chk-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .5rem; }
.tg-modal-wide .tg-chk-wrap { max-height: 62vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: .3rem .5rem; }
/* Suivi SATAC (circulation des services) */
.badge.tiny.ok { background: #e6f4ea; color: #2e7d46; }
.satac-num { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: .6rem; }
.satac-num label { font-size: .78rem; color: var(--brand-grey); display: flex; align-items: center; gap: .35rem; }
.satac-num input { border: 1px solid var(--line); border-radius: 8px; padding: .35rem .5rem; font: inherit; }
.satac-pret { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; font-weight: 600; color: var(--ok, #1a7f45); }
.satac-wrap { overflow-x: auto; }
.satac-tbl { width: 100%; border-collapse: collapse; font-size: .82rem; }
.satac-tbl th, .satac-tbl td { border-bottom: 1px solid var(--line); padding: .3rem .45rem; text-align: left; vertical-align: middle; }
.satac-tbl thead th { background: var(--brand-soft); color: var(--brand-strong); font-size: .68rem; text-transform: uppercase; letter-spacing: .03em; }
.satac-tbl select, .satac-tbl input { border: 1px solid transparent; border-radius: 5px; padding: .2rem .3rem; font: inherit; font-size: .8rem; background: transparent; width: 100%; box-sizing: border-box; }
.satac-tbl select:hover, .satac-tbl input:hover { border-color: var(--line); }
.satac-tbl select:focus, .satac-tbl input:focus { border-color: var(--brand); background: var(--bg); outline: none; }
.satac-nom { font-weight: 600; white-space: nowrap; }
.satac-nomc { font-weight: 400; white-space: normal; max-width: 16rem; }
.satac-delai-lbl { display: block; font-size: .62rem; color: var(--muted); margin-top: .1rem; }
.satac-delai-lbl.is-relance { color: var(--warn); font-weight: 700; }
.satac-relance { white-space: nowrap; }
.satac-relance .permis-mini.is-on { color: var(--warn); border-color: var(--warn); font-weight: 700; }
.satac-lu { margin: .1rem 0 .5rem; }
.tg-satac { margin-top: .8rem; }
/* Documents du dossier de permis (checklist par type de projet) */
.tg-docs { margin-top: .8rem; }
.docs-top { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-bottom: .3rem; }
.docs-type { display: flex; align-items: center; gap: .35rem; font-size: .78rem; color: var(--brand-grey); }
.docs-type select { border: 1px solid var(--line); border-radius: 8px; padding: .3rem .45rem; font: inherit; }
.docs-list { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.docs-row { display: grid; grid-template-columns: 1fr auto; gap: .3rem .6rem; align-items: start; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
.docs-row:last-child { border-bottom: 0; }
.docs-row.ds-fait { background: #f2faf4; }
.docs-row.ds-non_requis { opacity: .55; }
.docs-nom { font-weight: 600; font-size: .86rem; }
.docs-custom { font-size: .6rem; font-weight: 500; color: var(--muted); background: var(--surface-2, #f1f3f5); border-radius: 4px; padding: 0 .3rem; margin-left: .35rem; }
.docs-actions { display: flex; align-items: center; gap: .35rem; white-space: nowrap; }
.docs-statut { border: 1px solid var(--line); border-radius: 6px; padding: .2rem .3rem; font: inherit; font-size: .78rem; }
.docs-brouillon { grid-column: 1 / -1; margin-top: .3rem; border-left: 3px solid var(--brand); padding-left: .5rem; }
.docs-brouillon-h { display: flex; align-items: center; gap: .3rem; }
.docs-brouillon-txt { white-space: pre-wrap; font: inherit; font-size: .78rem; margin: .2rem 0 0; background: var(--brand-soft); border-radius: 6px; padding: .5rem .6rem; max-height: 30vh; overflow: auto; }
.docs-add { display: flex; gap: .4rem; margin-top: .6rem; }
.docs-add input { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: .4rem .55rem; font: inherit; }
.docs-parcelle { border: 1px dashed var(--line); border-radius: 8px; padding: .5rem .6rem; margin-bottom: .6rem; background: var(--panel-2, #faf8fb); }
.docs-parc-search { display: flex; gap: .4rem; }
.docs-parc-search input { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: .35rem .5rem; font: inherit; }
.docs-parc-row { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; margin-top: .4rem; font-size: .82rem; }
.docs-parc-err { margin-top: .3rem; color: var(--warn); }
.satac-head-in { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-bottom: .3rem; }
.satac-email-mini { display: block; margin-top: .15rem; width: 100%; max-width: 15rem; border: 1px solid transparent;
  border-radius: 5px; padding: .1rem .3rem; font: inherit; font-size: .68rem; color: var(--muted); background: transparent; }
.satac-email-mini:hover { border-color: var(--line); }
.satac-email-mini:focus { border-color: var(--brand); background: var(--bg); color: var(--text); outline: none; }
/* Catalogue des services SATAC (/permis/services/) */
.svc-wrap { overflow-x: auto; }
.svc-tbl { width: 100%; border-collapse: collapse; }
.svc-tbl th, .svc-tbl td { border-bottom: 1px solid var(--line); padding: .45rem .55rem; text-align: left; vertical-align: middle; }
.svc-tbl thead th { background: var(--brand-soft); color: var(--brand-strong); font-size: .7rem; text-transform: uppercase; letter-spacing: .03em; }
.svc-nom { white-space: nowrap; }
.svc-email { width: 100%; min-width: 16rem; border: 1px solid var(--line); border-radius: 8px; padding: .4rem .55rem; font: inherit; }
.svc-email:focus { border-color: var(--brand); outline: none; }
.svc-state { white-space: nowrap; }
.svc-ok { display: inline-flex; align-items: center; gap: .25rem; font-size: .74rem; color: var(--ok, #1a7f45); }
/* Calendrier cross-chantier */
.cal-bar { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; margin-bottom: .7rem; }
.cal-nav { display: flex; align-items: center; gap: .5rem; }
.cal-nav > button:not(.btn) { border: 1px solid var(--line); background: var(--bg); border-radius: 8px; width: 30px; height: 30px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--text); }
.cal-nav > button:not(.btn):hover { border-color: var(--brand); }
.cal-month { min-width: 9rem; text-align: center; text-transform: capitalize; font-size: 1.02rem; }
.cal-legend { display: flex; gap: .8rem; flex-wrap: wrap; font-size: .74rem; color: var(--muted); }
.cal-dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 3px; vertical-align: middle; margin-right: .2rem; }
.cal-dot.t-satac, .cal-ev.t-satac { --c: #2f6bb0; }
.cal-dot.t-relance, .cal-ev.t-relance { --c: #b1640c; }
.cal-dot.t-echeance, .cal-ev.t-echeance { --c: #7a3ea3; }
.cal-dot.t-fin, .cal-ev.t-fin { --c: #1a7f45; }
.cal-dot.t-enquete, .cal-ev.t-enquete { --c: #c0392b; }
.cal-dot { background: var(--c, var(--brand)); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.cal-dow { background: var(--brand-soft); color: var(--brand-strong); font-size: .68rem; text-transform: uppercase; letter-spacing: .03em; padding: .3rem .4rem; text-align: center; font-weight: 700; }
.cal-dow.cal-we { color: var(--muted); }
.cal-day { background: var(--bg); min-height: 92px; padding: .25rem .3rem; display: flex; flex-direction: column; gap: .15rem; }
.cal-day.is-out { background: var(--panel-2, #faf8fb); }
.cal-day.is-we { background: #fbfafc; }
.cal-day.is-today { box-shadow: inset 0 0 0 2px var(--brand); }
.cal-daynum { font-size: .72rem; color: var(--muted); font-weight: 600; text-align: right; }
.cal-day.is-out .cal-daynum { opacity: .5; }
.cal-day.is-today .cal-daynum { color: var(--brand-strong); }
.cal-ev { display: block; border-left: 3px solid var(--c, var(--brand)); background: color-mix(in srgb, var(--c, var(--brand)) 10%, white); border-radius: 4px; padding: .1rem .3rem; text-decoration: none; overflow: hidden; }
.cal-ev.is-urgent { box-shadow: inset 0 0 0 1px #c0392b; }
.cal-ev-c { display: block; font-size: .64rem; font-weight: 700; color: var(--c, var(--brand)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev-l { display: block; font-size: .62rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-next-row { display: flex; align-items: center; gap: .55rem; padding: .4rem .2rem; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); }
.cal-next-row:hover { background: var(--brand-soft); }
.cal-next-row.is-urgent { box-shadow: inset 3px 0 0 #c0392b; }
.cal-next-date { font-weight: 700; font-size: .8rem; min-width: 3rem; }
.cal-next-lib { flex: 1; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-next-in { white-space: nowrap; }
.satac-cat { font-size: .62rem; font-weight: 500; color: var(--muted); background: var(--surface-2, #f1f3f5); border-radius: 4px; padding: 0 .3rem; margin-left: .25rem; }
.satac-date { max-width: 8.5rem; }
.satac-delai { white-space: nowrap; color: var(--muted); }
.satac-delai .is-relance { color: var(--warn); font-weight: 700; }
.satac-relance-badge { color: var(--warn); margin-left: .2rem; }
.satac-tbl tr.st-valide { background: #f2faf4; }
.satac-tbl tr.st-repondu { background: #eaf2fb; box-shadow: inset 3px 0 0 #2f6bb0; }
.satac-tbl select.to-valider { border-color: #2f6bb0; color: #235285; font-weight: 600; }
.badge.tiny.info { background: #eaf2fb; color: #235285; }
.satac-tbl tr.st-complement { background: #fbf0d8; }
.satac-tbl tr.is-relance { box-shadow: inset 3px 0 0 var(--warn); }
.satac-tbl tr.st-sans_objet { opacity: .55; }
.satac-cap { margin-top: .8rem; border-top: 1px dashed var(--line); padding-top: .6rem; }
.satac-cap-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; margin-bottom: .5rem; }
.satac-cap-grid { display: flex; gap: .6rem; flex-wrap: wrap; }
.satac-shot { margin: 0; width: 150px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg); }
.satac-shot.is-current { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.satac-shot img { width: 100%; height: 96px; object-fit: cover; display: block; }
.satac-shot figcaption { display: flex; align-items: center; gap: .3rem; font-size: .64rem; color: var(--muted); padding: .25rem .35rem; }
.satac-shot-cur { color: var(--brand-strong); font-weight: 700; }
.satac-shot .tg-file-del { margin-left: auto; }
.tg-file-auto { flex: 0 0 auto; font-size: .6rem; font-weight: 700; letter-spacing: .3px; background: var(--brand-strong); color: #fff; padding: .05rem .3rem; border-radius: 4px; }
.tg-files-empty { margin-bottom: .4rem; }
.tg-files-imp { display: flex; gap: .4rem; align-items: center; margin-top: .3rem; flex-wrap: wrap; }
.tg-files-sel { flex: 1 1 12rem; min-width: 8rem; border: 1px solid var(--line); border-radius: 8px; padding: .4rem .5rem; font: inherit; font-size: .82rem; background: var(--bg); }
.tg-files-imp .btn.is-busy { opacity: .6; pointer-events: none; }

/* Fil de commentaires horodatés */
.tg-com { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .7rem; }
.tg-com-t { font-size: .72rem; text-transform: uppercase; letter-spacing: .4px; color: var(--brand-grey); margin-bottom: .4rem; }
.tg-com-row { background: var(--panel-2, #f6f3f7); border-radius: 8px; padding: .45rem .6rem; margin-bottom: .4rem; }
.tg-com-txt { font-size: .85rem; white-space: pre-wrap; }
.tg-com-meta { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .2rem; }
.tg-com-del { border: 0; background: none; cursor: pointer; color: var(--ink-3); padding: 0; display: inline-flex; }
.tg-com-del:hover { color: var(--danger); }
.tg-com-empty { margin-bottom: .4rem; }
.tg-com-add { display: flex; gap: .4rem; align-items: flex-end; }
.tg-com-add textarea { flex: 1 1 auto; border: 1px solid var(--line); border-radius: 8px; padding: .45rem .55rem; font: inherit; resize: vertical; }

/* Historique des statuts */
.tg-hist { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .7rem; }
.tg-hist-t { font-size: .72rem; text-transform: uppercase; letter-spacing: .4px; color: var(--brand-grey); margin-bottom: .35rem; }
.tg-hist-row { display: flex; align-items: center; gap: .5rem; padding: .18rem 0; font-size: .82rem; }
.tg-hist-g { flex: 0 0 1.1rem; text-align: center; color: var(--brand-grey); }
.tg-hist-g.k-faite { color: #2e9e4f; } .tg-hist-g.k-en_attente { color: #d69b16; } .tg-hist-g.k-a_revoir { color: #c0392b; }
.tg-hist-s { flex: 0 0 auto; font-weight: 600; }
@media (max-width: 720px) { .tg { --tg-label: 160px; } .tg-label-t { font-size: .76rem; } }

/* Tableau de priorités des Études (Part 6) — liste réordonnable de chantiers */
.prio-list { display: flex; flex-direction: column; gap: .5rem; }
.prio-row { display: flex; align-items: center; gap: .8rem; padding: .6rem .8rem; background: var(--bg);
  border: 1px solid var(--line); border-radius: 12px; }
.prio-handle { cursor: grab; color: var(--ink-3); display: inline-flex; flex: 0 0 auto; }
.prio-handle:active { cursor: grabbing; }
.prio-rank { flex: 0 0 1.7rem; height: 1.7rem; display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-strong); color: #fff; border-radius: 999px; font-weight: 700; font-size: .82rem; }
.prio-main { flex: 1 1 auto; min-width: 0; }
.prio-nom { font-weight: 600; color: var(--ink); text-decoration: none; }
.prio-nom:hover { color: var(--brand-strong); }
.prio-sub { margin-top: .1rem; }
.prio-phase { flex: 0 0 auto; }
.prio-prog { flex: 0 0 9rem; display: flex; align-items: center; gap: .5rem; }
.prio-bar { flex: 1 1 auto; height: 8px; background: var(--panel-2, #efe9f1); border-radius: 999px; overflow: hidden; }
.prio-bar-fill { display: block; height: 100%; background: var(--brand-strong); border-radius: 999px; }
.prio-pct { font-variant-numeric: tabular-nums; font-weight: 700; font-size: .8rem; flex: 0 0 auto; min-width: 2.4rem; text-align: right; }
.prio-open { flex: 0 0 auto; padding: .3rem .5rem; }
@media (max-width: 720px) { .prio-prog { flex-basis: 5rem; } .prio-phase { display: none; } }
.rm-expand { flex: 0 0 auto; background: none; border: 0; cursor: pointer; color: var(--brand-grey); padding: .1rem; display: inline-flex; }
.rm-expand.is-open { transform: rotate(90deg); }
.rm-editor { flex-basis: 100%; margin: .4rem 0 .2rem 1.6rem; padding: .6rem .7rem; background: var(--brand-tint);
  border: 1px solid var(--brand-soft); border-radius: 10px; }
.rm-states { display: flex; flex-wrap: wrap; gap: .35rem; }
.rm-states button { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: .2rem .6rem;
  cursor: pointer; font: inherit; font-size: .8rem; color: var(--brand-grey); }
.rm-states button.is-on { border-color: var(--brand); background: var(--brand-strong); color: #fff; font-weight: 600; }
.rm-fields { margin-top: .5rem; display: flex; flex-direction: column; gap: .4rem; }
.rm-field { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; font-size: .85rem; }
.rm-field > label { font-size: .76rem; color: var(--brand-grey); font-weight: 600; }
.rm-field input, .rm-field select, .rm-field textarea { font: inherit; font-size: .85rem; padding: .25rem .45rem; }
.rm-field.rm-note { flex-direction: column; align-items: stretch; }
.rm-field.rm-note textarea { width: 100%; resize: vertical; }
.rm-editor-foot { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-top: .5rem; }

/* Frise (planning horizontal léger) */
.frise-lane { display: flex; align-items: center; gap: .6rem; padding: .3rem 0; border-top: 1px solid var(--line); }
.frise-lane:first-of-type { border-top: 0; }
.frise-label { flex: 0 0 30%; max-width: 220px; font-size: .8rem; color: var(--brand-strong); font-weight: 600; }
.frise-track { flex: 1 1 auto; display: flex; gap: 3px; flex-wrap: wrap; }
.frise-seg { width: 22px; height: 16px; border-radius: 3px; border: 0; cursor: pointer; background: var(--line-strong); }
.frise-seg.fs-en_attente { background: var(--brand); } .frise-seg.fs-a_revoir { background: var(--warn); }
.frise-seg.fs-faite { background: var(--ok); } .frise-seg.fs-non_concernee { background: var(--line); }
.frise-legende { margin-top: .7rem; }

/* Boîte à outils repliée */
.toolbox { margin-top: .85rem; }
.toolbox-head { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  background: none; border: 0; cursor: pointer; font: inherit; font-weight: 600; color: var(--brand-strong); padding: .2rem 0; }
.toolbox-body { margin-top: .6rem; border-top: 1px solid var(--line); padding-top: .6rem; }

@media (max-width: 640px) {
  .etudes-head-top { flex-direction: column; align-items: stretch; }
  .frise-label { flex-basis: 40%; }
}

/* === Module Soumission — annuaire d'entreprises ======================== */
.ent-form { max-width: 880px; }
.ent-form .card { margin-bottom: 1rem; }
/* Faire qu'un champ occupe toute la largeur de la grille 2 colonnes */
.nc-field-grid .field-full { grid-column: 1 / -1; }

/* Sélecteur de métiers : cases à cocher présentées en pastilles cliquables */
.metier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: .5rem;
}
.metier-toggle {
  display: flex; align-items: center; gap: .5rem;
  padding: .48rem .6rem; border: 1px solid var(--line);
  border-radius: var(--r-sm); font-size: .84rem; color: var(--ink-2);
  cursor: pointer; user-select: none; transition: var(--t-fast);
}
.metier-toggle:hover { border-color: var(--brand-soft); background: var(--panel-2); }
.metier-toggle input { width: 16px; height: 16px; accent-color: var(--brand); flex-shrink: 0; }
.metier-toggle:has(input:checked) {
  border-color: var(--brand); background: var(--brand-soft);
  color: var(--brand-strong); font-weight: 500;
}

/* Multi-select de filtres (annuaire entreprises) */
.ms { position: relative; }
.ms-trigger {
  display: inline-flex; align-items: center; gap: .35rem;
  height: 30px; padding: 0 .55rem;
  background: var(--bg); color: var(--ink-2);
  border: 1px solid var(--line); border-radius: var(--r);
  font-size: .82rem; font-weight: 500; cursor: pointer; transition: var(--t-fast);
}
.ms-trigger:hover { border-color: var(--brand-soft); color: var(--ink); }
.ms-trigger.is-active { border-color: var(--brand); color: var(--brand-strong); background: var(--brand-soft); }
.ms-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--brand); color: #fff; font-size: .7rem; font-weight: 600;
}
.ms-panel {
  position: absolute; top: calc(100% + 5px); left: 0; z-index: 60;
  width: 268px; background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-pop); padding: .5rem;
}
.ms-panel .ms-search { width: 100%; margin-bottom: .45rem; height: 30px; }
.ms-list { max-height: 264px; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.ms-opt {
  display: flex; align-items: center; gap: .5rem;
  padding: .38rem .5rem; border-radius: var(--r-sm);
  font-size: .84rem; color: var(--ink-2); cursor: pointer; transition: var(--t-fast);
}
.ms-opt:hover { background: var(--panel-2); color: var(--ink); }
.ms-opt input { width: 15px; height: 15px; accent-color: var(--brand); flex-shrink: 0; }
.ms-empty { padding: .5rem; font-size: .8rem; color: var(--ink-3); text-align: center; }
.ms-foot {
  display: flex; justify-content: space-between; gap: .5rem;
  margin-top: .45rem; padding-top: .45rem; border-top: 1px solid var(--line);
}
.ms-active { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .15rem; }
.ms-active .chip { cursor: pointer; }
.ms-active .chip:hover { border-color: var(--danger); color: var(--danger); }

/* === Soumission — détail de lot (refonte ergonomie) ===================== */
/* Bandeau de stats du lot */
.lot-stats {
  display: flex; flex-wrap: wrap; gap: 0;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-lg);
  margin-bottom: 1rem; overflow: hidden;
}
.lot-stat {
  flex: 1; min-width: 150px; padding: .8rem 1.1rem;
  border-right: 1px solid var(--line);
}
.lot-stat:last-child { border-right: 0; }
.lot-stat .k {
  font-size: .72rem; color: var(--ink-3); font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: .3rem;
}
.lot-stat .v { font-size: 1.15rem; font-weight: 700; color: var(--ink); }
.lot-stat .v input {
  font-size: 1.05rem; font-weight: 700; width: 130px; text-align: left;
}

/* Bordereau : chapitres pliables (numérotation Bobit en signature) */
.chap { border-top: 1px solid var(--line); }
.chap:first-child { border-top: 0; }
.chap-head {
  display: flex; align-items: center; gap: .65rem; width: 100%;
  padding: .6rem 1rem; background: var(--panel-2);
  border: 0; cursor: pointer; text-align: left; transition: var(--t-fast);
}
.chap-head:hover { background: var(--brand-soft); }
.chap-code {
  font-family: ui-monospace, "JetBrains Mono", Menlo, monospace;
  font-size: .8rem; font-weight: 700; color: var(--brand-strong);
  background: var(--bg); border: 1px solid var(--line);
  padding: .1rem .45rem; border-radius: var(--r-sm); min-width: 46px; text-align: center;
}
.chap-titre { font-weight: 600; font-size: .88rem; color: var(--ink); flex: 1; }
.chap-count { font-size: .76rem; color: var(--ink-3); }
.chap-head .icon { transition: transform var(--t-fast); color: var(--ink-3); }
.chap-head.is-open .icon { transform: rotate(180deg); }

/* Lignes du bordereau */
.blin td { vertical-align: top; }
.blin .clamp2 {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; cursor: pointer;
}
.blin .clamp2.is-open { -webkit-line-clamp: unset; }
.blin-edit td { background: var(--brand-soft); padding: .6rem .75rem; }
.blin-edit input { margin-right: .35rem; }

/* Zone d'upload de documents */
.drop-zone {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  border: 2px dashed var(--line); border-radius: var(--r);
  padding: .8rem 1rem; margin-top: .75rem; transition: var(--t-fast);
}
.drop-zone:hover, .drop-zone.is-drag { border-color: var(--brand); background: var(--brand-soft); }
.drop-zone input[type="file"] { display: none; }
.drop-zone .dz-btn {
  display: inline-flex; align-items: center; gap: .4rem; cursor: pointer;
  height: 30px; padding: 0 .8rem; background: var(--bg); color: var(--ink-2);
  border: 1px solid var(--line); border-radius: var(--r); font-size: .82rem; font-weight: 500;
}
.drop-zone .dz-btn:hover { border-color: var(--brand); color: var(--brand-strong); }
.dz-nom { font-size: .82rem; color: var(--ink-2); font-style: italic; }

/* Spinner (extraction IA en cours) */
.spin {
  display: inline-block; width: 14px; height: 14px; flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  border-radius: 50%; animation: spin-rot .7s linear infinite;
}
.btn.secondary .spin { border-color: rgba(123,42,133,.25); border-top-color: var(--brand); }
@keyframes spin-rot { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 1.6s; } }

/* Cabeceras pegajosas en listados largos plein-écran */
.content.flush .tbl thead th { position: sticky; top: 0; background: var(--bg); z-index: 2; box-shadow: 0 1px 0 var(--line); }

/* Une card qui contient un multi-select (.ms) ne doit pas rogner son panneau déroulant */
.card:has(.ms) { overflow: visible; }
