:root {
  /* Identité de groupe : interface neutre. La couleur appartient aux quatre activités,
     pas à l'outil — voir ACTIVITIES dans js/data/schema.js. */
  --accent: #4F46C8; --accent-2: #3E37A6; --accent-soft: #EDECFB; --accent-ink: #241F52; --on-accent: #FFFFFF;
  --bg: #F5F5FA; --card: #FFFFFF; --card-2: #F1F1F8;
  --text: #16172B; --muted: #5C5F7A; --muted-2: #8C8FA8;
  --line: #E6E6F0; --line-strong: #D3D3E2;
  --green: #12805C; --red: #C8483C; --amber: #A96C10; --blue: #2F6FED; --violet: #E24C86;
  --green-soft: #E3F3EB; --red-soft: #FBE9E6; --amber-soft: #FAF0DF; --blue-soft: #E9F0FE;
  /* Alias conservés : plusieurs pages les utilisent en style inline */
  --orange: #A96C10; --orange-2: #C4881F; --orange-soft: #FAF0DF;
  --dark: #16172B; --dark-2: #2E2F4A;
  --sea: #2F6FED; --sea-soft: #E9F0FE; --sea-ink: #2456B8; --mimosa: #C4881F;
  --font-display: "Inter Tight", "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(17,21,28,.05);
  --shadow-lift: 0 6px 20px -8px rgba(17,21,28,.22);
  --rail: 66px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
body.no-scroll { overflow: hidden; }
a { color: inherit; }
h1 { font-family: var(--font-display); font-size: 23px; margin: 0; font-weight: 700; letter-spacing: -.028em; }
h2 { font-family: var(--font-display); font-size: 16.5px; margin: 0; font-weight: 700; letter-spacing: -.018em; }
h3 { font-size: 11px; margin: 0 0 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--muted-2); }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }

/* ---------- Layout ---------- */
#app { display: flex; flex-direction: column; min-height: 100vh; }
.brand { padding: 26px 24px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand .logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -.01em; }
.brand small { display: block; color: rgba(255,255,255,.5); margin-top: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }

/* ---------- Navigation : barre horizontale ---------- */
.topnav { position: sticky; top: 0; z-index: 20; }
.univ { background: var(--accent); color: var(--on-accent); display: flex; align-items: center; gap: 18px; padding: 0 20px; transition: background .25s ease; }
.u-mark { font-weight: 800; font-size: 15px; letter-spacing: -.02em; text-decoration: none; color: var(--on-accent); padding: 14px 0; white-space: nowrap; }
.u-set { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.u-set::-webkit-scrollbar { display: none; }
/* Sur un fond de marque, tout le texte de la bande prend la couleur lisible dessus :
   la distinction actif / inactif passe par le trait et le fond, pas par l'opacité. */
.u-tab { display: flex; align-items: center; gap: 8px; color: var(--on-accent); text-decoration: none; font-weight: 600; font-size: 13.5px; padding: 15px 13px 12px; border-bottom: 3px solid transparent; white-space: nowrap; transition: .13s; }
.u-tab:hover { background: color-mix(in srgb, var(--on-accent) 9%, transparent); }
.u-tab.on { font-weight: 700; border-bottom-color: var(--on-accent); background: color-mix(in srgb, var(--on-accent) 12%, transparent); }
.u-cnt { font-style: normal; background: color-mix(in srgb, var(--on-accent) 16%, transparent); color: var(--on-accent); border-radius: 999px; padding: 0 7px; font-size: 10.5px; font-weight: 800; }
.u-tab.on .u-cnt { background: color-mix(in srgb, var(--on-accent) 22%, transparent); color: var(--on-accent); }
.u-right { display: flex; align-items: center; gap: 4px; flex-shrink: 0; padding-left: 6px; }
.u-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; color: var(--on-accent); text-decoration: none; }
.u-ico:hover, .u-ico.on { background: color-mix(in srgb, var(--on-accent) 14%, transparent); }
.acct { position: relative; }
.u-me { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; color: var(--on-accent); padding: 5px 8px 5px 5px; border-radius: 999px; font-weight: 600; font-size: 13px; }
.u-me:hover { background: color-mix(in srgb, var(--on-accent) 12%, transparent); }
.u-me .av { width: 28px; height: 28px; border-radius: 50%; background: color-mix(in srgb, var(--on-accent) 18%, transparent); color: var(--on-accent); display: grid; place-items: center; font-size: 11px; font-weight: 800; }
.acct-menu { position: absolute; right: 0; top: calc(100% + 8px); background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lift); min-width: 232px; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.acct-head { padding: 8px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.acct-head .role { color: var(--muted-2); font-weight: 800; text-transform: uppercase; letter-spacing: .1em; font-size: 10.5px; }
.acct-head .name { font-weight: 700; margin-top: 4px; }
.acct-head .mail { color: var(--muted); font-size: 12px; margin-top: 2px; word-break: break-all; }
.acct-act { border: 0; background: transparent; text-align: left; padding: 9px 11px; border-radius: 9px; font-weight: 600; font-size: 13.5px; color: var(--muted); }
.acct-act:hover { background: var(--card-2); color: var(--text); }
.acct-act.danger { color: var(--red); }

.subnav { display: flex; align-items: center; gap: 12px; }
.s-set { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.s-set::-webkit-scrollbar { display: none; }
.s-tab { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; padding: 9px 14px; border-radius: 10px; white-space: nowrap; transition: .13s; }
/* Les structures se repèrent d'un coup d'œil : logo plus grand et trait de leur couleur */
.s-tab.brand { font-weight: 700; color: var(--text); box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--c) 55%, transparent); border-radius: 10px 10px 4px 4px; }
.s-tab.brand:hover { box-shadow: inset 0 -2px 0 var(--c); background: color-mix(in srgb, var(--c) 8%, transparent); }
.s-tab.brand .brandmark { width: 26px; height: 26px; border-radius: 7px; }
.s-sep { width: 1px; align-self: stretch; background: var(--line-strong); margin: 4px 10px; flex-shrink: 0; }
.s-tab:hover { background: var(--card-2); color: var(--text); }
.s-tab.on, .s-tab.brand.on { background: var(--accent); color: var(--on-accent); box-shadow: none; transition: background .2s ease; }
.s-cnt { font-style: normal; background: var(--card-2); color: var(--muted); border-radius: 999px; padding: 0 7px; font-size: 10.5px; font-weight: 800; }
.s-tab.on .s-cnt { background: color-mix(in srgb, var(--on-accent) 18%, transparent); color: var(--on-accent); }
.s-tab .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.brandmark { width: 20px; height: 20px; border-radius: 5px; background: var(--c, var(--line-strong)); display: inline-grid; place-items: center; overflow: hidden; flex-shrink: 0; }
.brandmark img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { flex: 1; }
.topbar { background: var(--card); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); padding: 10px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.topbar .datepill, .esp-head .datepill { background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 5px 12px 5px 5px; display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 12.5px; }
.topbar .datepill span, .esp-head .datepill span { background: var(--accent); color: var(--on-accent); font-size: 10px; font-weight: 700; padding: 4px 8px; border-radius: 6px; text-transform: uppercase; letter-spacing: .06em; }
.content { padding: 24px 28px 60px; display: flex; flex-direction: column; gap: 18px; }
.topbar.bare .datepill { display: none; }
.topbar[hidden] { display: none; }
.demo-banner { background: var(--amber-soft); border: 1px solid var(--amber-soft); color: var(--amber); padding: 9px 14px; border-radius: 10px; font-size: 13px; display: flex; gap: 10px; align-items: center; }
.demo-banner b { font-weight: 700; }

/* ---------- Cards & grids ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; }
.card.tight { padding: 16px 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.grid { display: grid; gap: 18px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { position: relative; }

.kpi .lbl { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--muted-2); display: flex; justify-content: space-between; }
.kpi .val { font-family: var(--font-display); font-size: 28px; font-weight: 700; margin: 8px 0 2px; letter-spacing: -.035em; color: var(--kpi-c, var(--accent)); font-variant-numeric: lining-nums tabular-nums; }
.kpi .sub { color: var(--muted); font-size: 13px; }
.big { font-family: var(--font-display); font-size: 34px; font-weight: 700; color: var(--text); letter-spacing: -.035em; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted-2); font-weight: 700; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--card-2); }
tr.total td { font-weight: 700; background: var(--card-2); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------- Badges & buttons ---------- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; background: color-mix(in srgb, var(--c, var(--accent)) 11%, white); color: var(--c, var(--accent)); white-space: nowrap; }
.pill { display: inline-block; padding: 3px 9px; border-radius: 6px; font-size: 11.5px; font-weight: 600; background: var(--card-2); color: var(--muted); }
.pill.ok { background: var(--green-soft); color: var(--green); } .pill.warn { background: var(--amber-soft); color: var(--amber); } .pill.bad { background: var(--red-soft); color: var(--red); } .pill.info { background: var(--blue-soft); color: var(--sea-ink); }
.btn { display: inline-flex; text-decoration: none; align-items: center; gap: 7px; border: 1px solid transparent; border-radius: 9px; padding: 9px 15px; font-weight: 600; font-size: 13.5px; background: var(--accent); color: var(--on-accent); transition: background .2s ease, border-color .13s; white-space: nowrap; }
.btn:hover { background: var(--accent-2); }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn.ghost { background: var(--card); color: var(--text); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--card-2); border-color: var(--muted-2); }
.btn.dark { background: var(--accent); } .btn.green { background: var(--green); } .btn.danger { background: var(--red); }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { border: 0; background: transparent; font-size: 16px; padding: 6px 8px; border-radius: 8px; color: var(--muted); }
.icon-btn:hover { background: var(--bg); color: var(--text); }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-2); color: #fff; font-size: 10px; font-weight: 800; display: inline-grid; place-items: center; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.toolbar input[type=search], .toolbar select, .filter-input { border: 1px solid var(--line-strong); border-radius: 9px; padding: 8px 12px; background: #fff; min-width: 140px; font-size: 13.5px; }
.tabs { display: flex; gap: 4px; background: var(--card); border: 1px solid var(--line); padding: 4px; border-radius: 10px; width: fit-content; flex-wrap: wrap; }
.tabs button { border: 0; background: transparent; padding: 8px 14px; border-radius: 7px; font-weight: 600; font-size: 13.5px; color: var(--muted); }
.tabs button.active { background: var(--accent); color: var(--on-accent); }
.tabs button .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; background: var(--c); }
.seg { display: inline-flex; background: var(--card-2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 6px; font-weight: 600; color: var(--muted); font-size: 12.5px; }
.seg button.active { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(17,21,28,.1); }
.empty { color: var(--muted-2); padding: 24px; text-align: center; font-size: 13px; }
.alert { border-radius: 10px; padding: 12px 15px; display: flex; gap: 12px; align-items: center; background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--amber); }
.alert b { font-family: var(--font-display); font-size: 20px; letter-spacing: -.03em; color: var(--amber); }
.alert.red { border-left-color: var(--red); } .alert.red b { color: var(--red); }
.alert.blue { border-left-color: var(--blue); } .alert.blue b { color: var(--blue); }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(205px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: var(--card-2); border-radius: 11px; padding: 9px; min-height: 180px; display: flex; flex-direction: column; gap: 7px; }
.col.over { outline: 2px dashed var(--accent); background: var(--accent-soft); }
.col-head { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 6px 8px; }
.col-head b { font-size: 13px; } .col-head span { font-size: 11px; color: var(--muted); font-weight: 600; }
.col-head .sum { display: block; font-size: 11px; color: var(--muted); }
.dcard { background: #fff; border-radius: 9px; padding: 11px 12px 10px; box-shadow: var(--shadow); border: 1px solid var(--line); cursor: pointer; border-left: 3px solid var(--c, var(--accent)); }
.dcard:hover { box-shadow: var(--shadow-lift); border-color: var(--line-strong); }
.dcard.dragging { opacity: .4; }
.dcard .t { font-weight: 700; font-size: 13px; line-height: 1.3; }
.dcard .p { color: var(--muted); font-size: 12px; margin-top: 3px; }
.dcard .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 12px; }
.dcard .amt { font-weight: 800; }
.dcard .next { margin-top: 8px; font-size: 11.5px; padding: 4px 8px; border-radius: 8px; background: var(--bg); color: var(--muted); }
.dcard .next.late { background: var(--red-soft); color: var(--red); } .dcard .next.none { background: var(--amber-soft); color: var(--amber); } .dcard .next.today { background: var(--green-soft); color: var(--green); }
.dcard .rot { color: var(--red); font-weight: 700; }

/* ---------- Forms ---------- */
form.form, .form { display: flex; flex-wrap: wrap; gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 5px; flex: 1 1 100%; }
.field.half { flex: 1 1 calc(50% - 8px); }
.field label { font-size: 10.5px; font-weight: 700; color: var(--muted-2); text-transform: uppercase; letter-spacing: .07em; }
.field input, .field select, .field textarea { border: 1px solid var(--line-strong); border-radius: 9px; padding: 9px 12px; background: #fff; width: 100%; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 6px 0; }
.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: 13px; }
.check input { width: auto; }
.form-actions { flex: 1 1 100%; display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.form-actions .left { margin-right: auto; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(17,21,28,.45); backdrop-filter: blur(3px); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 40px 20px; overflow: auto; }
.modal { background: #fff; border: 1px solid var(--line); border-radius: 14px; width: min(680px, 100%); box-shadow: 0 24px 48px -20px rgba(17,21,28,.35); }
.modal.wide { width: min(1040px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 22px 24px; }
.detail { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; }
.detail .section { margin-bottom: 20px; }
.detail dl { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 0; font-size: 13px; }
.detail dt { color: var(--muted); } .detail dd { margin: 0; font-weight: 600; }
.timeline { display: flex; flex-direction: column; gap: 10px; }
.tl { background: var(--card-2); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.tl .meta { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.tl.stage { background: var(--blue-soft); }
.act-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--card-2); }
.act-row.done { opacity: .55; text-decoration: line-through; }
.act-row .when { font-size: 12px; color: var(--muted); }
.act-row .when.late { color: var(--red); font-weight: 700; }
.act-row input[type=checkbox] { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--green); }
.stage-steps { display: flex; gap: 4px; flex-wrap: wrap; }
.stage-steps button { border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 5px 11px; font-size: 12px; font-weight: 600; color: var(--muted); }
.stage-steps button.cur { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.stage-steps button.past { background: var(--card-2); color: var(--text); }
.status-won { color: var(--green); font-weight: 700; } .status-lost { color: var(--red); font-weight: 700; }

/* ---------- Today ---------- */
.today-group { margin-bottom: 18px; }
.today-group h3 { display: flex; justify-content: space-between; }
.trow { display: grid; grid-template-columns: 26px 1fr auto auto; gap: 12px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.trow:last-child { border-bottom: 0; }
.trow .ttl { font-weight: 700; } .trow .ctx { font-size: 12px; color: var(--muted); }
.trow.late .ttl::before { content: "⚠ "; color: var(--red); }

/* ---------- Login ---------- */
.login { flex: 1; width: 100%; min-height: 100vh; display: grid; place-items: center; background: linear-gradient(150deg, var(--accent-ink), var(--accent) 75%); padding: 16px; }
.login .card { width: min(400px, 100%); }
.login .brand small { color: var(--muted); }
.login .brand { border: 0; padding: 0 0 16px; color: var(--text); }
.userpick { display: flex; flex-direction: column; gap: 8px; }
.userpick button { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 12px 14px; text-align: left; }
.userpick button:hover { border-color: var(--accent); background: var(--card-2); }
.userpick small { display: block; color: var(--muted); }

/* ---------- Toasts ---------- */
#toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--accent-ink); color: #fff; padding: 10px 15px; border-radius: 9px; font-weight: 600; font-size: 13.5px; opacity: 0; transform: translateY(8px); transition: .25s; }
.toast.show { opacity: 1; transform: none; }
.toast.err { background: var(--red); } .toast.warn { background: var(--amber); }

/* ---------- Charts ---------- */
.chart-box { position: relative; height: 260px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) { .grid.c4 { grid-template-columns: repeat(2, 1fr); } .grid.c3 { grid-template-columns: repeat(2, 1fr); } .detail { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .univ { padding: 0 12px; gap: 10px; }
  .u-mark { font-size: 14px; }
  .u-tab span { display: none; }            /* place au doigt : l'icône suffit pour l'univers */
  .u-tab { padding: 13px 11px 10px; }
  .u-me .nm { display: none; }
  .topbar { padding: 7px 12px; }
  .datepill { display: none; }              /* la date mange une ligne entière sur un téléphone */
  .content { padding-left: 16px; padding-right: 16px; }
  .grid.c4, .grid.c3, .grid.c2 { grid-template-columns: 1fr; }
  .field.half { flex-basis: 100%; }
}

/* ---------- Tableau de bord (hub) ---------- */
.hub-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.hub-card { border-top: 3px solid var(--c, var(--accent)); }
.hub-card.soon { border-top-color: var(--line); }
.hub-icon { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: color-mix(in srgb, var(--c, var(--accent)) 12%, white); margin-right: 8px; font-size: 15px; }
.hub-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 12px; }
.hub-kpis > div { background: var(--card-2); border-radius: 9px; padding: 10px 12px; }
.hub-kpis b { display: block; font-family: var(--font-display); font-size: 21px; font-weight: 700; letter-spacing: -.025em; font-variant-numeric: lining-nums tabular-nums; }
.hub-kpis b:not(.status-lost):not(.status-won) { color: var(--accent); }
.hub-kpis span { font-size: 11.5px; color: var(--muted); }
.hub-lines { display: flex; flex-direction: column; gap: 4px; }
.hub-lines a, .hub-lines > span { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 9px; text-decoration: none; font-size: 13px; }
.hub-lines a:hover { background: var(--card-2); }
.hub-lines .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.hub-lines .grow { flex: 1; }
@media (max-width: 900px) { .hub-grid { grid-template-columns: 1fr; } }

.kind-switch { display: flex; gap: 4px; background: var(--card-2); border: 1px solid var(--line); padding: 4px; border-radius: 10px; margin-bottom: 16px; }
.kind-switch button { flex: 1; border: 0; background: transparent; padding: 8px 12px; border-radius: 7px; font-weight: 600; color: var(--muted); }
.kind-switch button.active { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(17,21,28,.12); }

/* ---------- Documents ---------- */
.docs { margin-top: 18px; }
.docs h3 span { text-transform: none; letter-spacing: 0; display: flex; gap: 6px; align-items: center; }
.docs .doc-cat { font-size: 12px; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line-strong); background: #fff; }
.docs label.btn { cursor: pointer; }
.doc-list { display: flex; flex-direction: column; gap: 6px; }
.doc-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.doc-row .doc-ico { font-size: 18px; }
.doc-row .grow { flex: 1; min-width: 0; }
.doc-row a { text-decoration: none; }
.doc-row a:hover { text-decoration: underline; }
.doc-row b { overflow-wrap: anywhere; }
/* ---------- Résumé de prêt ---------- */
.loan-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px 16px; background: var(--card-2); border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; font-size: 13px; }
.loan-summary > div { display: flex; flex-direction: column; }
.loan-summary span { color: var(--muted); font-size: 11.5px; }
.loan-summary b { font-variant-numeric: tabular-nums; }

/* ---------- Gestion locative ---------- */
.rent-sheet td, .rent-sheet th { padding: 7px 8px; font-size: 12.5px; }
.rent-sheet tr.grp td { background: var(--card-2); padding: 9px 10px; border-top: 2px solid var(--line-strong); }
.rent-sheet tr.vacant td { background: var(--amber-soft); }
.cell-in { border: 1px solid transparent; background: transparent; border-radius: 7px; padding: 4px 6px; font: inherit; font-size: 12.5px; text-align: right; }
.cell-in[type=text] { text-align: left; }
select.cell-in { text-align: left; }
.cell-in:hover { border-color: var(--line-strong); background: #fff; }
.cell-in:focus { border-color: var(--accent); background: #fff; outline: 0; }
.dd { position: relative; }
.dd-btn { border: 1px solid var(--line-strong); border-radius: 9px; padding: 8px 12px; background: #fff; font-weight: 600; font-size: 13.5px; min-width: 190px; text-align: left; }
.dd-panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; background: #fff; border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 12px; min-width: 260px; display: flex; flex-direction: column; gap: 6px; }
.dd-panel .check { font-size: 13px; font-weight: 600; padding: 4px 2px; }
.dd-foot { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 4px; display: flex; justify-content: flex-end; }
.rent-sheet tr.subtotal td { font-weight: 700; background: var(--card-2); border-bottom: 2px solid var(--line-strong); }
.dd-panel[hidden] { display: none; }

/* Sélecteur multiple recherchable + puces de filtre */
.dd-btn.on { border-color: var(--accent); color: var(--accent); }
.dd-panel.wide { min-width: 320px; max-width: min(380px, calc(100vw - 40px)); }
.dd-search { border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 11px; font: inherit; font-size: 13px; width: 100%; }
.dd-search:focus { border-color: var(--accent); outline: 3px solid var(--accent-soft); }
.dd-list { max-height: 260px; overflow: auto; display: flex; flex-direction: column; gap: 2px; margin: 2px -4px; padding: 0 4px; }
.dd-list .check { align-items: flex-start; border-radius: 8px; }
.dd-list .check:hover { background: var(--card-2); }
.dd-foot { align-items: center; gap: 8px; justify-content: flex-end; }
.dd-foot .grow { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); background: #fff; border-radius: 7px; padding: 4px 9px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.chip span { color: var(--muted); font-weight: 700; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip:hover span { color: var(--accent); }
.chip.q { background: var(--card-2); }

/* ---------- Application externe intégrée (iframe) ---------- */
/* Page à ras : l'application occupe toute la surface, sans cadre ni carte. */
.content.flush { padding: 0; gap: 0; }
.embed-frame { background: #fff; }
.embed-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.embed-frame:fullscreen iframe { height: 100vh; }
.embed-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.embed-act { background: none; border: 0; border-radius: 7px; padding: 6px 10px; font-size: 12.5px; font-weight: 600; color: var(--muted); text-decoration: none; white-space: nowrap; }
.embed-act:hover { background: var(--card-2); color: var(--text); }

/* ---------- Espaces de structure (.esp-*) ---------- */
/* Coquille commune à BTP Expertise et La Référence Courtage : menu vertical à gauche,
   contenu à droite — la présentation du tableau de bord RGD Renova, aux couleurs de la
   structure. L'accent vient de applyBrand() : ACTIVITIES est la seule source. */
.content.flush { padding: 0; gap: 0; display: flex; }
.esp-app { flex: 1; display: flex; min-width: 0; background: var(--bg); }
.esp-side { width: 224px; flex-shrink: 0; background: var(--accent-ink); color: #fff; display: flex; flex-direction: column; }
.esp-side-brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,.1); font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.esp-side-brand img { width: 30px; height: 30px; object-fit: contain; background: #fff; border-radius: 8px; padding: 3px; }
.esp-side-nav { flex: 1; padding: 14px 12px; display: flex; flex-direction: column; gap: 3px; }
.esp-side-nav a { display: block; padding: 11px 15px; border-radius: 9px; text-decoration: none; color: rgba(255,255,255,.76); font-size: 13.5px; font-weight: 600; transition: background .13s, color .13s; }
.esp-side-nav a:hover { background: rgba(255,255,255,.09); color: #fff; }
.esp-side-nav a.on { background: var(--accent); color: var(--on-accent); }
.esp-side-foot { padding: 16px 18px 20px; border-top: 1px solid rgba(255,255,255,.1); display: flex; flex-direction: column; gap: 3px; }
.esp-side-foot b { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); }
.esp-side-foot span { font-size: 11.5px; color: rgba(255,255,255,.55); }
.esp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.esp-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 20px 28px; background: var(--card); border-bottom: 1px solid var(--line); }
.esp-head h1 { font-family: var(--font-display); font-size: 25px; font-weight: 700; margin: 0; letter-spacing: -.02em; }
.esp-body { flex: 1; padding: 22px 28px 50px; display: flex; flex-direction: column; gap: 18px; }
/* Une seule pastille de date à l'écran : celle de la structure */
body:has(.esp-app) .subnav .datepill { display: none; }
@media (max-width: 820px) {
  .esp-app { flex-direction: column; }
  .esp-side { width: 100%; }
  .esp-side-nav { flex-direction: row; flex-wrap: wrap; }
  .esp-side-foot { display: none; }
  .esp-head, .esp-body { padding-left: 16px; padding-right: 16px; }
}
@media (prefers-reduced-motion: reduce) { .esp-side-nav a { transition: none; } }

/* Indicateurs : libellé à gauche, icône en pastille à droite, valeur en gros */
.esp-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 14px; }
.esp-kpi { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 18px; box-shadow: var(--shadow); transition: transform .13s, box-shadow .13s, border-color .13s; }
.esp-kpi::after { content: ""; position: absolute; inset: auto -40px -40px auto; width: 150px; height: 150px; border-radius: 50%; background: var(--ts); opacity: .5; }
.esp-kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: var(--t); }
.esp-kpi-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; position: relative; z-index: 1; }
.esp-kpi-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted-2); font-weight: 700; }
.esp-kpi-ico { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--ts); font-size: 14px; flex-shrink: 0; }
.esp-kpi-val { font-family: var(--font-display); font-size: 32px; font-weight: 700; letter-spacing: -.02em; color: var(--t); margin: 10px 0 2px; position: relative; z-index: 1; font-variant-numeric: lining-nums tabular-nums; }
.esp-kpi-sub { font-size: 12.5px; color: var(--muted); position: relative; z-index: 1; }

@media (prefers-reduced-motion: reduce) { .esp-kpi { transition: none; } }

/* Pipeline en colonnes, dans la vue d'ensemble */
.esp-kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(168px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.esp-col { background: var(--card-2); border-radius: var(--radius); padding: 12px 11px; display: flex; flex-direction: column; min-width: 0; }
.esp-col-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.esp-col-head b { font-size: 12.5px; font-weight: 700; line-height: 1.25; }
.esp-col-head span { font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--accent-ink); }
.esp-col-sum { font-size: 11.5px; color: var(--muted); margin: 3px 0 9px; }
.esp-col-body { display: flex; flex-direction: column; gap: 7px; }
.esp-card-deal { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: left; width: 100%; background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 9px; padding: 9px 10px; font-size: 12.5px; }
.esp-card-deal:hover { border-color: var(--accent); box-shadow: var(--shadow-lift); }
.esp-card-deal b { font-weight: 600; line-height: 1.3; }
.esp-card-deal .muted { font-size: 11.5px; }
.esp-card-amount { font-weight: 700; color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.esp-col-vide { color: var(--muted-2); font-size: 12px; padding: 4px 2px; }

/* ---------- Écrans propres à BTP Expertise (.btp-*) ---------- */

/* Agenda Google, habillé aux couleurs de la structure. L'intérieur du cadre est
   rendu par Google : on soigne ce qui l'entoure et les couleurs qu'on lui passe. */
.agenda-head { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; margin-bottom: 14px; }
.agenda-head h2 { margin: 0; }
.agenda-ico { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent-soft); font-size: 14px; flex-shrink: 0; }
.agenda-vues { margin-left: 6px; }
.agenda-card { background: linear-gradient(180deg, var(--accent-soft) 0%, var(--card) 120px); }
.agenda-cadre { border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: var(--radius); overflow: hidden; background: var(--card); box-shadow: var(--shadow); }
.agenda-cadre iframe { width: 100%; border: 0; display: block; background: var(--card); }
.agenda-week iframe { height: 620px; }
.agenda-month iframe { height: 600px; }
.agenda-agenda iframe { height: 430px; }
.agenda-card > p { margin: 12px 0 0; }
@media (max-width: 820px) {
  .agenda-week iframe, .agenda-month iframe { height: 460px; }
  .agenda-head h2 { flex-basis: 100%; }
}
.btp-setup ol { margin: 8px 0 14px; padding-left: 20px; display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; }
.btp-setup p { margin: 0 0 6px; }

.btp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.btp-card { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; text-align: left; background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.btp-card:hover { border-color: var(--accent); box-shadow: var(--shadow-lift); }
.btp-code { font-family: var(--font-display); font-weight: 700; color: var(--accent-ink); letter-spacing: -.01em; }
.btp-title { font-size: 13px; line-height: 1.35; }
.btp-points { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.btp-mail { border-top: 1px solid var(--line); padding: 14px 0 4px; }
.btp-mail:first-of-type { border-top: 0; padding-top: 0; }
.btp-mail-head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.btp-mail-head .grow { flex: 1; min-width: 0; }
.btp-mail-body { margin: 0; background: var(--card-2); border-radius: 10px; padding: 12px 14px; font: inherit; font-size: 13px; white-space: pre-wrap; word-break: break-word; max-height: 240px; overflow: auto; }
.seg .cnt { background: var(--card-2); border-radius: 999px; padding: 1px 7px; font-size: 11px; margin-left: 4px; }
.seg button.active .cnt { background: rgba(255,255,255,.25); }

/* Une bascule de structure ne doit pas clignoter pour qui préfère moins d'animation */
@media (prefers-reduced-motion: reduce) { .univ, .s-tab.on, .btn { transition: none; } }
