/* ParentsConcertés — design system : bleu pour l'espace Parent, vert profond pour l'espace DPE. */
:root {
  --pc: #1d56d8;
  --pc-dark: #1544ad;
  --pc-soft: #e9f0ff;
  --side-bg: #ffffff;
  --side-text: #1f2a44;
  --side-active-bg: #e9f0ff;
  --side-active-text: #1d56d8;
  --text: #17223b;
  --muted: #667085;
  --line: #e4e9f3;
  --bg: #f3f6fc;
  --card: #ffffff;
  --green: #0f7a55;
  --green-soft: #e3f5ec;
  --amber: #b7791f;
  --amber-soft: #fdf2d9;
  --red: #c9302c;
  --red-soft: #fde9e8;
  --violet: #7c3aed;
  --violet-soft: #f0e9fe;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 35, 70, 0.06), 0 4px 14px rgba(20, 35, 70, 0.05);
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
}
body[data-space='dpe'] {
  --pc: #0f6b4b;
  --pc-dark: #0b523a;
  --pc-soft: #e3f5ec;
  --side-bg: #0b4a37;
  --side-text: #d8eee5;
  --side-active-bg: #167a57;
  --side-active-text: #ffffff;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
a { color: var(--pc); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #f5a623; outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; left: -9999px; top: 0; background: #fff; padding: 8px 12px; z-index: 100; }
.sr:focus { left: 8px; top: 8px; }
.hidden { display: none !important; }
svg.ic { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Mise en page ---------- */
.app { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.side { background: var(--side-bg); color: var(--side-text); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
body[data-space='dpe'] .side { border-right: 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; padding: 4px 8px 18px; color: inherit; text-decoration: none !important; }
.brand svg { width: 34px; height: 34px; }
body:not([data-space='dpe']) .brand span { color: #1b3a8c; }
.nav a, .nav button { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: inherit; font-weight: 500; text-decoration: none; background: none; border: 0; width: 100%; cursor: pointer; text-align: left; }
.nav a:hover, .nav button:hover { background: rgba(127, 150, 200, 0.14); }
.nav a[aria-current='page'] { background: var(--side-active-bg); color: var(--side-active-text); font-weight: 600; }
.nav .count { margin-left: auto; background: var(--red); color: #fff; border-radius: 999px; font-size: 12px; min-width: 22px; text-align: center; padding: 1px 7px; font-weight: 700; }
.side .spacer { flex: 1; }
.help-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); background: #f7f9ff; }
.help-card b { display: block; color: var(--pc); font-size: 14px; }
.space-switch { display: grid; grid-template-columns: 1fr 1fr; background: rgba(120, 140, 190, 0.16); border-radius: 10px; padding: 3px; margin: 0 4px 12px; gap: 3px; }
.space-switch a { text-align: center; padding: 7px 4px; border-radius: 8px; font-size: 13px; font-weight: 600; color: inherit; text-decoration: none; }
.space-switch a[aria-current='true'] { background: #fff; color: var(--pc); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); }
.main { min-width: 0; padding: 0 32px 48px; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 24px 0 20px; }
.topbar .heading { flex: 1; min-width: 0; }
.topbar h1 { font-size: 28px; font-weight: 700; }
.topbar p { margin: 4px 0 0; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text); background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; }
.iconbtn { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 12px; width: 42px; height: 42px; display: grid; place-items: center; cursor: pointer; color: var(--text); }
.iconbtn .badge { position: absolute; top: -6px; right: -6px; background: var(--red); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; min-width: 20px; padding: 1px 5px; text-align: center; }
.userchip { display: flex; align-items: center; gap: 10px; background: none; border: 0; cursor: pointer; text-align: left; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--pc); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.userchip b { display: block; font-size: 14px; }
.userchip small { color: var(--muted); }
.menu { position: absolute; right: 32px; top: 74px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; min-width: 200px; z-index: 30; }
.menu a, .menu button { display: flex; gap: 10px; align-items: center; width: 100%; padding: 9px 12px; background: none; border: 0; border-radius: 8px; cursor: pointer; color: var(--text); text-align: left; text-decoration: none; }
.menu a:hover, .menu button:hover { background: var(--pc-soft); }
.mobilebar, .tabbar, .m-title { display: none; }

/* ---------- Composants ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card h2, .card h3.t { font-size: 17px; font-weight: 700; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head a, .link { font-size: 14px; font-weight: 600; }
.grid { display: grid; gap: 18px; }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g-main { grid-template-columns: 1.6fr 1fr; align-items: start; }
.stat { display: flex; gap: 14px; align-items: center; padding: 18px; text-decoration: none !important; color: inherit; }
.stat .ico { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.stat .ico svg { width: 26px; height: 26px; }
.stat .num { font-size: 26px; font-weight: 700; line-height: 1; }
.stat .lbl { color: var(--muted); font-size: 14px; }
.stat .more { display: block; margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--pc); }
.tone-blue { background: var(--pc-soft); color: var(--pc); }
.tone-green { background: var(--green-soft); color: var(--green); }
.tone-amber { background: var(--amber-soft); color: var(--amber); }
.tone-red { background: var(--red-soft); color: var(--red); }
.tone-violet { background: var(--violet-soft); color: var(--violet); }
.tone-grey { background: #eef1f6; color: #4b5565; }
.badge-s { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 8px; white-space: nowrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-weight: 600; cursor: pointer; text-decoration: none !important; color: var(--text); min-height: 42px; }
.btn:hover { border-color: var(--pc); }
.btn.primary { background: var(--pc); color: #fff; border-color: var(--pc); }
.btn.primary:hover { background: var(--pc-dark); }
.btn.good { background: var(--green); color: #fff; border-color: var(--green); }
.btn.danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn.ghost-danger { color: var(--red); border-color: #f0c4c2; }
.btn.outline { color: var(--pc); border-color: var(--pc); }
.btn.small { padding: 6px 12px; min-height: 34px; font-size: 14px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 2px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected='true'] { color: var(--pc); border-color: var(--pc); }
.item { display: flex; gap: 14px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item .grow { flex: 1; min-width: 0; }
.item h3 { font-size: 16px; }
.thumb { width: 92px; height: 92px; border-radius: 12px; display: grid; place-items: center; flex: none; color: #fff; }
.thumb svg { width: 40px; height: 40px; }
.thumb.t-blue { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.thumb.t-green { background: linear-gradient(135deg, #34d399, #0f7a55); }
.thumb.t-amber { background: linear-gradient(135deg, #fbbf24, #d97706); }
.thumb.t-violet { background: linear-gradient(135deg, #a78bfa, #6d28d9); }
.meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-top: 6px; align-items: center; }
.meta svg { width: 15px; height: 15px; vertical-align: -3px; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty svg { width: 40px; height: 40px; opacity: 0.5; margin-bottom: 8px; }
.notice { padding: 12px 14px; border-radius: 10px; font-size: 14px; background: var(--pc-soft); color: var(--text); }
.notice.warn { background: var(--amber-soft); }
.notice.bad { background: var(--red-soft); }
.notice.good { background: var(--green-soft); }
.spinner { padding: 60px; text-align: center; color: var(--muted); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 24px; display: flex; justify-content: space-between; gap: 12px; }
.timeline li::before { content: ''; position: absolute; left: 3px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: #fff; border: 2px solid var(--pc); }
.timeline li::after { content: ''; position: absolute; left: 7px; top: 18px; bottom: -2px; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.bar { height: 10px; border-radius: 6px; background: #e8edf6; overflow: hidden; min-width: 80px; }
.bar > i { display: block; height: 100%; background: var(--pc); border-radius: 6px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table-wrap { overflow-x: auto; }
.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.quick a { display: flex; gap: 10px; align-items: center; padding: 14px; border-radius: 12px; font-weight: 600; color: var(--text); text-decoration: none; }

/* ---------- Formulaires ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .lab { font-weight: 600; font-size: 14px; }
.field .hint { font-size: 13px; color: var(--muted); }
input[type='text'], input[type='email'], input[type='password'], input[type='date'], input[type='number'], input[type='search'], select, textarea { width: 100%; padding: 10px 12px; border: 1px solid #cfd7e6; border-radius: 10px; background: #fff; min-height: 42px; }
textarea { min-height: 110px; resize: vertical; }
.form { display: flex; flex-direction: column; gap: 16px; max-width: 720px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--pc); flex: none; }
.choice { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff; }
.choice:has(input:checked) { border-color: var(--pc); background: var(--pc-soft); }
.choice input { accent-color: var(--pc); width: 20px; height: 20px; }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.scale label { text-align: center; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 0; cursor: pointer; font-weight: 700; background: #fff; }
.scale label:has(input:checked) { border-color: var(--pc); background: var(--pc); color: #fff; }
.scale input { position: absolute; opacity: 0; }
.scale label:has(input:focus-visible) { outline: 3px solid #f5a623; }
.progress { height: 8px; background: #e4e9f3; border-radius: 6px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--pc); transition: width 0.2s; }
.err { color: var(--red); font-size: 14px; }
.idctl { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #f8faff; }

/* ---------- Discussions ---------- */
.contrib { padding: 14px 0; border-top: 1px solid var(--line); display: flex; gap: 12px; }
.contrib .body { flex: 1; min-width: 0; }
.contrib .who { font-weight: 700; }
.contrib p { margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.contrib.moderated { opacity: 0.65; }
.anon-avatar { background: #98a2b3; }

/* ---------- Fenêtres, messages ---------- */
dialog { border: 0; border-radius: 16px; padding: 0; max-width: min(560px, 94vw); width: 100%; box-shadow: 0 20px 60px rgba(10, 20, 50, 0.3); color: var(--text); }
dialog.wide { max-width: min(860px, 96vw); }
dialog::backdrop { background: rgba(15, 25, 50, 0.5); }
.dlg { padding: 20px; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; }
.dlg-head h3 { font-size: 18px; }
.dlg-head button { background: none; border: 0; cursor: pointer; padding: 6px; }
#toast { position: fixed; bottom: 80px; left: 50%; transform: translate(-50%, 20px); background: #17223b; color: #fff; padding: 11px 18px; border-radius: 12px; opacity: 0; transition: 0.2s; pointer-events: none; z-index: 200; max-width: 92vw; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--red); }

/* ---------- Pages d'authentification ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: linear-gradient(160deg, #e9f0ff, #f6f9ff 50%, #fff); }
.auth .box { width: 100%; max-width: 460px; }
.auth .brand { justify-content: center; padding-bottom: 18px; font-size: 22px; }
.auth .brand span { color: #1b3a8c; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 4px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ---------- Mobile ---------- */
@media (max-width: 1023px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 0 16px 100px; }
  .topbar { display: none; }
  .mobilebar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; position: sticky; top: 0; background: var(--bg); z-index: 20; }
  .mobilebar .brand { padding: 0; font-size: 17px; }
  .mobilebar .brand svg { width: 28px; height: 28px; }
  .mobilebar .iconbtn { width: 40px; height: 40px; border: 0; background: transparent; }
  .m-title { display: block; padding: 4px 0 14px; }
  .m-title h1 { font-size: 24px; }
  .m-title p { margin: 4px 0 0; color: var(--muted); }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 40; }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); text-decoration: none; background: none; border: 0; padding: 4px 0; position: relative; cursor: pointer; }
  .tabbar [aria-current='page'] { color: var(--pc); font-weight: 700; }
  .tabbar .dot { position: absolute; top: 0; left: 55%; background: var(--red); color: #fff; font-size: 10px; border-radius: 999px; padding: 0 5px; min-width: 16px; text-align: center; font-weight: 700; }
  .g4 { grid-template-columns: 1fr; }
  .g4.stats { grid-template-columns: 1fr; }
  .g2, .g3, .g-main { grid-template-columns: 1fr; }
  .quick { grid-template-columns: 1fr 1fr; }
  .thumb { width: 72px; height: 72px; }
  .btn { min-height: 46px; }
  .menu { right: 12px; top: 56px; }
}
@media (max-width: 640px) {
  .item { flex-wrap: wrap; }
  .item .grow { flex-basis: calc(100% - 90px); }
  .card { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

table.tbl td small { white-space: nowrap; }
