/* Composants partagés (espace Communication et espace collaborateurs). */
@font-face { font-family: 'Montserrat Alternates'; font-weight: 600; font-display: swap; src: url('/assets/fonts/montserrat-alternates-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat Alternates'; font-weight: 700; font-display: swap; src: url('/assets/fonts/montserrat-alternates-latin-700-normal.woff2') format('woff2'); }

body.admin, body.pub { --bg: #f5f4f9; background: var(--bg); }
body.admin main, body.pub main.pub-main { max-width: none; margin: 0; padding: 22px 28px 60px; min-width: 0; }
.ico { flex: none; display: block; }
[data-icon] { display: inline-flex; }

/* ---------- En-tête ---------- */
.ph-header { height: 80px; background: var(--navy); color: #fff; display: flex; align-items: center; gap: 22px; padding: 0 28px; position: sticky; top: 0; z-index: 30; }
.ph-header .brand img { height: 46px; display: block; }
.brand-sep { width: 1px; height: 40px; background: rgba(255,255,255,.35); }
.app-title { display: flex; flex-direction: column; line-height: 1.1; }
.app-title-main { font-family: 'Montserrat Alternates', 'Montserrat', sans-serif; font-weight: 700; font-size: 1.75rem; letter-spacing: .01em; }
.app-title-sub { font-size: .9rem; font-weight: 500; opacity: .9; margin-top: 2px; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.header-link, .user-btn { font: inherit; color: #fff; background: none; border: 0; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; font-weight: 600; }
.header-link:hover, .user-btn:hover { background: rgba(255,255,255,.1); }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: #e7e5f0; color: var(--navy); display: grid; place-items: center; font-weight: 700; font-size: .95rem; }
.user-txt { display: flex; flex-direction: column; text-align: left; line-height: 1.2; font-size: .92rem; }
.user-role { font-weight: 500; opacity: .85; font-size: .82rem; }
.usermenu { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(35,26,81,.16); min-width: 210px; padding: 6px; z-index: 40; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 7px; color: var(--ink); text-decoration: none; font: inherit; font-weight: 600; font-size: .9rem; background: none; border: 0; cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--soft); }
.menu .danger { color: var(--err); }

/* ---------- Coque ---------- */
.shell { display: grid; grid-template-columns: 270px minmax(0, 1fr); min-height: calc(100vh - 80px); }
.sidebar { background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; justify-content: space-between; padding: 22px 0; position: sticky; top: 80px; height: calc(100vh - 80px); }
.side-nav { display: flex; flex-direction: column; gap: 2px; padding-right: 16px; }
.side-nav a, .side-nav button { display: flex; align-items: center; gap: 14px; padding: 11px 16px 11px 26px; color: var(--ink); text-decoration: none; font: inherit; font-weight: 600; font-size: .95rem; border-radius: 0 10px 10px 0; background: none; border: 0; cursor: pointer; text-align: left; border-left: 4px solid transparent; }
.side-nav a:hover, .side-nav button:hover { background: var(--soft); }
.side-nav a.active { background: #fde8ec; color: var(--red); border-left-color: var(--red); }
.side-nav .count { margin-left: auto; background: var(--red); color: #fff; border-radius: 12px; min-width: 24px; height: 24px; display: grid; place-items: center; font-size: .78rem; padding: 0 7px; }
.side-bottom { border-top: 1px solid var(--line); padding-top: 14px; margin: 0 0 0 0; }
body.no-shell .shell { grid-template-columns: 1fr; }
body.no-shell .shell-only { display: none !important; }

@media (max-width: 1100px) {
  .shell { grid-template-columns: 76px minmax(0, 1fr); }
  .side-nav a > span:not([data-icon]):not(.count), .side-nav button > span:not([data-icon]) { display: none; }
  .side-nav a, .side-nav button { padding-left: 22px; }
  .side-nav .count { position: absolute; margin-left: 20px; margin-top: -18px; min-width: 18px; height: 18px; font-size: .68rem; }
}
@media (max-width: 720px) {
  .ph-header { padding: 0 14px; gap: 12px; }
  .brand-sep, .app-title-sub, .user-txt, .header-link span:last-child { display: none; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; overflow-x: auto; padding: 6px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-nav { flex-direction: row; padding: 0; }
  .side-bottom { display: none; }
  body.admin main { padding: 16px; }
}

/* ---------- Titre de page ---------- */
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .back { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9rem; text-decoration: none; color: var(--ink); margin-bottom: 4px; }
.page-head h1 { font-size: 1.75rem; font-weight: 800; margin: 0; }
.page-head .sub { color: var(--muted); margin: 4px 0 0; }
.page-head .tools { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.btn.lg { padding: 12px 20px; font-size: .95rem; border-radius: 9px; }
.btn.icon-only { padding: 11px 13px; }
.dirty { font-size: .82rem; font-weight: 600; color: var(--warn); display: flex; align-items: center; gap: 6px; }

/* ---------- Éditeur de modèle ---------- */
.tpl-editor { display: grid; grid-template-columns: minmax(360px, 1.15fr) minmax(320px, 1fr) minmax(260px, .72fr); gap: 18px; align-items: start; }
.tpl-editor .card { border-radius: 12px; padding: 18px 18px 20px; }
.tpl-editor .card h2 { font-size: 1.1rem; margin-bottom: 10px; }
.card-sub { font-size: .82rem; color: var(--muted); margin: -4px 0 12px; }
.frow { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 11px 0; border-top: 1px solid var(--line); }
.frow:first-of-type { border-top: 0; }
.frow .fic { width: 44px; height: 44px; border-radius: 9px; background: var(--soft); color: var(--navy); display: grid; place-items: center; }
.frow .fic .swatch { width: 22px; height: 22px; border-radius: 50%; }
.frow .flabel { font-weight: 700; font-size: .88rem; margin-bottom: 5px; }
.frow input[type=text], .frow textarea { padding: 7px 10px; font-size: .88rem; }
.frow textarea { min-height: 66px; }
.frow .imgref { display: flex; align-items: center; gap: 10px; }
.frow .imgref img { width: 70px; aspect-ratio: 3/2; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.lockctl { display: flex; align-items: center; gap: 8px; padding-top: 26px; min-width: 150px; justify-content: flex-end; }
.lockctl .ico { color: var(--muted); }
.lockctl .state { font-size: .84rem; font-weight: 600; width: 78px; color: var(--muted); }
.lockctl.on .state { color: var(--teal); }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch .track { position: absolute; inset: 0; border-radius: 13px; background: #c9c6d8; transition: background .15s; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + .track { background: var(--teal); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--navy); outline-offset: 2px; }

.preview-card { position: sticky; top: 100px; }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.preview-head h2 { margin: 0 !important; }
.zoom { display: flex; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.zoom button { background: none; border: 0; cursor: pointer; color: var(--ink); width: 32px; height: 30px; border-radius: 6px; display: grid; place-items: center; }
.zoom button:hover { background: var(--soft); }
.zoom .val { font-size: .82rem; font-weight: 600; min-width: 48px; text-align: center; }
.icon-btn { background: #fff; border: 1px solid var(--line); border-radius: 9px; width: 38px; height: 38px; display: grid; place-items: center; cursor: pointer; color: var(--ink); }
.icon-btn:hover { background: var(--soft); }
.sheet-scroll { overflow: auto; max-height: calc(100vh - 230px); display: flex; justify-content: center; padding: 4px; }
.sheet { flex: none; box-shadow: 0 2px 4px rgba(35,26,81,.08), 0 10px 30px rgba(35,26,81,.14); }
.sheet canvas.poster { box-shadow: none; }

.side-col { display: flex; flex-direction: column; gap: 18px; }
.illu { display: flex; gap: 12px; align-items: center; }
.illu img { width: 118px; aspect-ratio: 3/2; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--soft); }
.note { display: flex; gap: 10px; align-items: flex-start; background: #ecebf7; color: var(--navy); border-radius: 9px; padding: 10px 12px; font-size: .82rem; line-height: 1.45; margin-top: 12px; }
.note .ico { color: #5a51a8; margin-top: 1px; }
.opt { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); font-weight: 600; font-size: .9rem; }
.opt:first-of-type { border-top: 0; }
.opt .ico { color: var(--navy); }
.opt .grow { flex: 1; }
.opt input[type=number] { width: 76px; padding: 6px 8px; text-align: center; }
.opt-help { font-size: .8rem; color: var(--muted); margin-top: 4px; }

@media (max-width: 1350px) {
  .tpl-editor { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
  .tpl-editor .side-col { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}
@media (max-width: 900px) {
  .tpl-editor { grid-template-columns: 1fr; }
  .preview-card { position: static; }
  .frow { grid-template-columns: 1fr; }
  .frow .fic { display: none; }
  .lockctl { padding-top: 0; justify-content: flex-start; }
}

/* ---------- Plein écran & aide ---------- */
.overlay { position: fixed; inset: 0; background: rgba(20,15,50,.55); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px; }
.overlay .sheet { max-height: calc(100vh - 48px); }
.overlay .close { position: absolute; top: 18px; right: 18px; background: #fff; border: 0; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); background: #fff; z-index: 61; box-shadow: -10px 0 40px rgba(0,0,0,.15); padding: 24px; overflow-y: auto; }
.drawer h2 { display: flex; align-items: center; justify-content: space-between; }
.drawer ol { padding-left: 20px; } .drawer li { margin-bottom: 10px; font-size: .92rem; }

/* Ajustements de mise en page */
.page-head > div:first-child { flex: 1 1 420px; min-width: 0; }
.page-head .tools { flex: none; flex-wrap: wrap; justify-content: flex-end; }
.side-col > .card + .card { margin-top: 0; }
.illu img { width: 96px; }
.illu .btn { white-space: nowrap; }
.opt .grow { line-height: 1.3; }
.page-head h1 { font-size: 1.6rem; text-wrap: balance; }

/* ---------- Liste des modèles ---------- */
.tbar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.searchbox { position: relative; flex: 0 1 480px; min-width: 240px; }
.searchbox .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.searchbox input { padding-left: 40px; height: 42px; border-radius: 9px; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill-f { font: inherit; font-weight: 600; font-size: .88rem; padding: 8px 16px; border-radius: 20px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
.pill-f:hover { border-color: #b9b4d3; }
.pill-f.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.tcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.tcard { background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s; display: flex; flex-direction: column; }
.tcard:hover, .tcard:focus-within { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(35,26,81,.13); border-color: #f4a3b3; }
.tcard:hover .tedit, .tcard:focus-within .tedit { background: var(--red); color: #fff; border-color: var(--red); }
.tthumb { background: #f1f0f7; display: flex; justify-content: center; padding: 16px 0; }
.tthumb .sheet { box-shadow: 0 1px 3px rgba(35,26,81,.1), 0 6px 16px rgba(35,26,81,.12); }
.tbody { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.tbody h3 { font-size: 1rem; margin: 0; }
.tmeta { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: .85rem; }
.badge.ib { display: inline-flex; align-items: center; gap: 5px; }
.tuses { display: inline-flex; align-items: center; gap: 5px; color: var(--ink); font-weight: 600; }
.tlocks { display: flex; gap: 7px; align-items: center; font-size: .82rem; color: var(--muted); }
.tactions { display: flex; gap: 8px; margin-top: auto; padding-top: 4px; }
.tactions .btn { flex: 1; }
.tcard.off .tthumb { background: #e9e8ee; }
.tcard.off .tthumb canvas { filter: grayscale(.85) opacity(.75); }
.tcard.off .tbody h3 { color: var(--muted); }
.empty { grid-column: 1 / -1; background: #fff; border: 1px dashed #cfcbe0; border-radius: 12px; padding: 40px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; }

/* ---------- Détail d'une demande ---------- */
.title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn.soft-red { background: #fde8ec; color: var(--red-d); border-color: #fde8ec; }
.btn.soft-red:hover { background: #fbd5dc; }
.req-grid { display: grid; grid-template-columns: minmax(330px, 1fr) minmax(320px, .95fr) minmax(300px, .9fr); gap: 18px; align-items: start; }
.req-grid .card { border-radius: 12px; }
.req-grid .card h2 { font-size: 1.1rem; margin-bottom: 12px; }
.who { display: flex; gap: 14px; align-items: flex-start; font-size: .92rem; }
.avatar.lg { width: 52px; height: 52px; font-size: 1.05rem; flex: none; }
.msg { background: #ecebf7; border-radius: 9px; padding: 10px 12px; margin-top: 14px; font-size: .9rem; }
.card-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.card-title-row h2 { margin-bottom: 2px !important; }
.ro { margin-bottom: 10px; }
.ro-l { font-weight: 700; font-size: .86rem; margin-bottom: 4px; }
.ro-v { background: var(--soft); border: 1px solid var(--line); border-radius: 7px; padding: 8px 11px; font-size: .88rem; white-space: pre-wrap; text-transform: uppercase; }
.ro-v.ro-red { background: #fdecef; border-color: #f8cdd6; color: #c42d4b; }
.ro-v.ro-blue { background: #ecebf7; border-color: #d6d3ec; color: var(--navy); }
.ro-model { background: var(--soft); border-radius: 7px; padding: 9px 11px; font-size: .88rem; margin-top: 4px; }
.pdf-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.hist { list-style: none; margin: 0; padding: 0; }
.hist li { display: grid; grid-template-columns: 30px 1fr; gap: 12px; position: relative; padding-bottom: 16px; font-size: .9rem; }
.hist li:not(:last-child)::before { content: ''; position: absolute; left: 14px; top: 30px; bottom: 0; width: 2px; background: var(--line); }
.hdot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.ev-navy { background: var(--navy); } .ev-teal { background: var(--teal); } .ev-red { background: var(--red); }
.ev-soft { background: #d9d6ee; color: var(--navy); } .ev-grey { background: #e3e2ea; color: var(--muted); }
.hcom { background: var(--soft); border-radius: 8px; padding: 8px 10px; margin-top: 6px; white-space: pre-wrap; font-size: .86rem; }
.danger-zone { padding: 12px 18px !important; box-shadow: none; background: transparent; border-style: dashed; }
.linklike { background: none; border: 0; font: inherit; font-weight: 600; font-size: .85rem; color: var(--err); cursor: pointer; display: inline-flex; gap: 7px; align-items: center; }
@media (max-width: 1400px) { .req-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .req-grid .side-col { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); } }
@media (max-width: 900px) { .req-grid { grid-template-columns: 1fr; } }

/* ---------- Modale et notification ---------- */
.modal { background: #fff; border-radius: 14px; width: min(560px, 100%); box-shadow: 0 24px 60px rgba(20,15,50,.3); max-height: calc(100vh - 48px); overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 22px 6px; }
.modal-head h2 { margin: 0; font-size: 1.2rem; }
.modal-sub { margin: 4px 0 0; color: var(--muted); font-size: .88rem; }
.modal-body { padding: 10px 22px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 22px 20px; }
.notif { position: fixed; right: 24px; bottom: 24px; z-index: 70; background: var(--navy); color: #fff; border-radius: 12px; padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; box-shadow: 0 12px 34px rgba(20,15,50,.3); max-width: 380px; font-size: .9rem; }
.notif-ok { width: 26px; height: 26px; border-radius: 50%; background: var(--teal); display: grid; place-items: center; flex: none; }
.notif button { background: none; border: 0; color: #fff; cursor: pointer; opacity: .8; padding: 2px; }
.preview-head h2 { white-space: nowrap; font-size: 1.05rem !important; }
.preview-head .actions { flex-wrap: nowrap; }
.pdf-actions .btn, .linkbox .btn, .side-nav a > span { white-space: nowrap; }
.pdf-actions .btn { font-size: .86rem; padding: 10px 12px; }
.side-nav a, .side-nav button { font-size: .92rem; padding-left: 22px; gap: 12px; }

/* ---------- Liste des demandes ---------- */
.selectbox select { height: 42px; border-radius: 9px; min-width: 220px; padding: 0 12px; }
.table-card { padding: 0 !important; overflow: hidden; border-radius: 12px; }
.req-table th { padding: 12px 14px; background: #fbfbfd; }
.req-table td { padding: 10px 14px; vertical-align: middle; }
.req-table tr.rowlink { cursor: pointer; }
.req-table tr.rowlink:hover td, .req-table tr.rowlink:focus td { background: #fdf3f5; }
.req-table tr.rowlink:focus { outline: none; }
.req-table .num { font-weight: 700; color: var(--muted); white-space: nowrap; }
.req-table .addr { font-weight: 700; }
.req-table .right { text-align: right; }
.mini { width: 44px; border-radius: 2px; }
.who-mini { display: flex; gap: 10px; align-items: center; }
.avatar.sm { width: 34px; height: 34px; font-size: .78rem; flex: none; }
.strong { font-weight: 600; }
.table-foot { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; gap: 10px; }
.pager { display: flex; gap: 10px; align-items: center; }
.badge.ib .ico { flex: none; }
@media (max-width: 900px) { .req-table th:nth-child(1), .req-table td:nth-child(1), .req-table th:nth-child(5), .req-table td:nth-child(5) { display: none; } }

/* ---------- Administrateurs, compte, paramètres, e-mails ---------- */
.req { color: var(--red); margin-left: 2px; }
.row-menu { position: relative; display: inline-block; }
.row-menu .menu { right: 0; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; align-items: start; max-width: 1100px; }
.two-col .card, .settings-grid .card { border-radius: 12px; }
.two-col h2, .settings-grid h2 { font-size: 1.1rem; margin-bottom: 12px; }
.meter { height: 6px; border-radius: 3px; background: var(--line); margin-top: 8px; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--red); transition: width .2s; }
.meter[data-level=mid] span { background: #e7a33e; } .meter[data-level=high] span { background: var(--teal); }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr); gap: 18px; align-items: start; }
.settings-grid .stack > .card + .card { margin-top: 0; }
@media (max-width: 1100px) { .settings-grid { grid-template-columns: 1fr; } }
.mailbox { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 18px; align-items: start; }
.mail-list { padding: 6px !important; border-radius: 12px; max-height: calc(100vh - 230px); overflow-y: auto; }
.mail-item { display: block; width: 100%; text-align: left; font: inherit; color: var(--ink); background: none; border: 0; border-radius: 9px; padding: 11px 12px; cursor: pointer; border-left: 3px solid transparent; }
.mail-item + .mail-item { margin-top: 2px; }
.mail-item:hover { background: var(--soft); }
.mail-item.on { background: #fde8ec; border-left-color: var(--red); }
.mi-top { display: flex; justify-content: space-between; gap: 8px; font-size: .85rem; }
.mi-to { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-sub { font-size: .86rem; margin-top: 3px; color: var(--ink); }
.mail-view { border-radius: 12px; }
.mv-head { display: flex; flex-direction: column; gap: 3px; font-size: .9rem; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.mail-view .mail-frame { height: calc(100vh - 330px); min-height: 460px; border-radius: 8px; }
@media (max-width: 900px) { .mailbox { grid-template-columns: 1fr; } .mail-list { max-height: 280px; } }

/* ---------- Connexion ---------- */
body.no-shell .ph-header { display: none; }
body.no-shell main { padding: 0 !important; }
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.1fr); }
.auth-side { background: var(--navy); color: #fff; padding: 56px 48px; display: flex; flex-direction: column; justify-content: center; gap: 18px; position: relative; overflow: hidden; }
.auth-side::after { content: ''; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%; background: rgba(239,64,96,.18); }
.auth-side img { width: 190px; }
.auth-title { font-family: 'Montserrat Alternates', 'Montserrat', sans-serif; font-weight: 700; font-size: 2.6rem; }
.auth-side p { max-width: 380px; opacity: .9; font-size: 1.02rem; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 32px 20px; background: var(--bg); }
.auth-card { width: min(440px, 100%); padding: 32px !important; border-radius: 14px; }
.auth-card h1 { font-size: 1.6rem; }
@media (max-width: 800px) { .auth { grid-template-columns: 1fr; } .auth-side { padding: 28px 24px; } .auth-side p, .auth-side::after { display: none; } .auth-title { font-size: 1.8rem; } .auth-side img { width: 140px; } }

/* Ajustements finaux */
.illu { flex-wrap: wrap; }
.mi-top .muted { flex: none; white-space: nowrap; }
@media (max-width: 1500px) {
  .tpl-editor { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
  .tpl-editor .side-col { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}
@media (max-width: 720px) {
  .ph-header .brand img { height: 34px; }
  .app-title-main { font-size: 1.3rem; }
  .user-btn .ico { display: none; }
  .avatar { width: 36px; height: 36px; font-size: .85rem; }
  .header-right { gap: 4px; }
  .req-table th:nth-child(4), .req-table td:nth-child(4), .req-table th:nth-child(7), .req-table td:nth-child(7) { display: none; }
  .page-head .tools { width: 100%; justify-content: flex-start; }
}

/* ---------- Sélecteur de période ---------- */
.period { position: relative; }
.period-btn { font: inherit; height: 42px; display: inline-flex; align-items: center; gap: 9px; background: #fff; border: 1px solid #cfcbe0; border-radius: 9px; padding: 0 12px; cursor: pointer; color: var(--ink); font-size: .9rem; white-space: nowrap; }
.period-btn:hover { border-color: var(--navy); }
.period-lbl .muted { font-weight: 500; }
.period-pop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 45; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(35,26,81,.18); width: 300px; padding: 8px; max-height: 70vh; overflow-y: auto; }
.period-group + .period-group { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; }
.period-gt { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 6px 10px 4px; }
.period-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; font: inherit; font-size: .9rem; background: none; border: 0; border-radius: 7px; padding: 8px 10px; cursor: pointer; color: var(--ink); }
.period-item:hover { background: var(--soft); }
.period-item.on { font-weight: 700; }
.period-item .chk { width: 16px; display: inline-flex; color: var(--red); }
.period-custom { border-top: 1px solid var(--line); margin-top: 6px; padding: 6px 4px 4px; }
.period-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0 8px; }
.period-dates label { display: flex; flex-direction: column; gap: 3px; font-size: .8rem; font-weight: 600; }
.period-dates input { padding: 6px 8px; font-size: .85rem; }

/* ---------- Statistiques ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 12px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow); border-top: 4px solid var(--navy); }
.kpi.warn { border-top-color: var(--red); }
.kpi-l { font-size: .82rem; font-weight: 700; color: var(--muted); }
.kpi-v { font-size: 2rem; font-weight: 800; line-height: 1.15; margin-top: 4px; color: var(--navy); }
.kpi-s { font-size: .8rem; color: var(--muted); margin-top: 3px; }
.kpi-line { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: .88rem; color: var(--muted); margin: 0 2px 18px; }
.kpi-line b { color: var(--ink); }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .ax { font-size: 11px; fill: #6b6788; font-family: Montserrat, sans-serif; }
.chart .grp { cursor: default; }
.chart .grp.on .hit { fill: rgba(35,26,81,.05); }
.chart-tip { position: absolute; pointer-events: none; background: #fff; border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 8px 24px rgba(35,26,81,.15); padding: 8px 11px; font-size: .82rem; min-width: 160px; }
.chart-tip div { display: flex; align-items: center; gap: 6px; }
.legend { display: flex; gap: 16px; font-size: .84rem; font-weight: 600; margin-top: 2px; }
.legend span, .chart-tip .sw { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(480px, 1fr)); gap: 18px; margin: 18px 0; }
.stats-grid .card + .card { margin-top: 0; }
.tc-head { padding: 16px 18px 10px; }
.tc-head h2 { margin: 0 0 2px !important; font-size: 1.1rem; }
.stats-table th.n, .stats-table td.n { text-align: right; white-space: nowrap; }
.stats-table .hi { color: var(--red-d); font-weight: 700; }
.linkbtn { background: none; border: 0; font: inherit; font-weight: 700; color: var(--navy); cursor: pointer; display: inline-flex; gap: 5px; align-items: center; padding: 0; text-align: left; }
.linkbtn:hover { color: var(--red); text-decoration: underline; }
.defs summary { cursor: pointer; font-weight: 700; display: flex; gap: 8px; align-items: center; list-style: none; }
.defs ul { margin: 12px 0 0; padding-left: 20px; font-size: .9rem; } .defs li { margin-bottom: 6px; }
.print-only { display: none; }
@media print {
  .ph-header, .sidebar, .no-print, .notif, .chart-tip, button.btn { display: none !important; }
  .shell { display: block; } body.admin main { padding: 0; }
  .print-only { display: block; font-weight: 600; }
  .card, .kpi { box-shadow: none; break-inside: avoid; }
  .defs { display: block; } .defs ul { display: block; }
  body.admin { background: #fff; }
}
@media (max-width: 720px) { .stats-grid { grid-template-columns: 1fr; } .period-btn .muted { display: none; } }
.kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1350px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi-v { font-size: 1.6rem; } }
.stats-table td:first-child { min-width: 150px; }
.stats-grid { grid-template-columns: repeat(auto-fit, minmax(620px, 1fr)); }
.linkbtn { white-space: nowrap; }
.stats-table td:first-child { min-width: 170px; }

/* ---------- Connexion Microsoft ---------- */
.btn.ms { background: #fff; color: #2f2f2f; border: 1px solid #8c8c8c; font-weight: 600; }
.btn.ms:hover { background: #f3f3f3; }
.ms-logo { display: inline-flex; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .82rem; margin: 16px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.sso-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 22px; margin: 6px 0 10px; }
.sso-body.dim { opacity: .55; }
.radio { display: flex; gap: 9px; align-items: flex-start; font-size: .88rem; margin: 6px 0; cursor: pointer; }
.radio input { margin-top: 3px; accent-color: var(--navy); }
.ms-verified { display: inline-flex; gap: 6px; align-items: center; font-size: .8rem; font-weight: 600; color: var(--muted); margin-top: 4px; }

/* ---------- Sauvegardes et journal ---------- */
table.simple { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.simple th, table.simple td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); }
table.simple th { font-size: .78rem; color: var(--muted); font-weight: 600; }
.plain-list { margin: 0; padding-left: 18px; } .plain-list li { margin-bottom: 8px; font-size: .92rem; }
.plain-list code { font-size: .82rem; word-break: break-all; }
.log-list { display: grid; gap: 2px; max-height: 60vh; overflow-y: auto; }
.log-row { display: grid; grid-template-columns: 150px 70px 1fr; gap: 10px; align-items: start; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.log-row .badge { justify-self: start; }
.log-row .small { word-break: break-word; }
@media (max-width: 720px) { .log-row { grid-template-columns: 1fr; gap: 4px; } }

/* ---------- Téléphone : aucun écran ne doit dépasser la largeur ---------- */
@media (max-width: 900px) {
  .req-grid, .tpl-editor, .req-grid .side-col, .tpl-editor .side-col { grid-template-columns: minmax(0, 1fr); }
  .stack, .side-col, .card { min-width: 0; }
}
@media (max-width: 720px) {
  .stats-grid { grid-template-columns: minmax(0, 1fr); }
  .table-card { overflow-x: auto; }
  .actions, .preview-head .actions { flex-wrap: wrap; }
}
