/* ════════════════════════════════════════════════════════════════
   AstraGyn — direction « Station orbitale » (refonte nov. 2026)
   Thème clair par défaut ; sombre via <html data-theme="dark">.
   Règle de performance : le flou (backdrop-filter) est réservé aux
   surfaces uniques (.glass-bar : header, sidebar, toasts) ; panneaux et
   cartes sont semi-transparents SANS flou ; modales opaques.
   ════════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #eef2f9;
  --glass:       rgba(255,255,255,0.58);
  --glass-2:     rgba(255,255,255,0.80);
  --glass-bar:   rgba(255,255,255,0.68);
  --surface:     #ffffff;
  --surface-2:   #f4f6fb;
  --card:        rgba(255,255,255,0.90);
  --line:        rgba(15,23,42,0.08);
  --line-2:      rgba(15,23,42,0.15);
  --hi:          rgba(255,255,255,0.9);
  --text:        #0e1525;
  --text-dim:    #3b4558;
  --text-muted:  #687287;
  --text-faint:  #a6aebe;
  --accent:      #0a6fc2;
  --accent-ink:  #ffffff;
  --accent-soft: rgba(10,111,194,0.10);
  --accent-line: rgba(10,111,194,0.40);
  --violet:      #6d4fd6;
  --pink:        #c0367a;
  --amber:       #b45309;
  --rose:        #d6304b;
  --emerald:     #05875f;
  --neb-1:       rgba(129,140,248,0.30);
  --neb-2:       rgba(56,189,248,0.24);
  --neb-3:       rgba(244,114,182,0.16);
  --shadow:      0 10px 30px rgba(15,23,42,0.08);
  --overlay:     rgba(15,23,42,0.35);
  --stars:       0;

  --f-ui:   'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --f-head: 'Oxanium', 'Inter', sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --ease:   cubic-bezier(.22,.8,.24,1);
  --r-lg: 18px; --r: 12px; --r-sm: 8px;
  --side-w: 236px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg:          #04060c;
  --glass:       rgba(255,255,255,0.045);
  --glass-2:     rgba(255,255,255,0.075);
  --glass-bar:   rgba(10,14,26,0.66);
  --surface:     #0d1322;
  --surface-2:   #141b2e;
  --card:        rgba(18,24,40,0.78);
  --line:        rgba(255,255,255,0.08);
  --line-2:      rgba(255,255,255,0.15);
  --hi:          rgba(255,255,255,0.08);
  --text:        #e9edf5;
  --text-dim:    #a3abbd;
  --text-muted:  #6f788d;
  --text-faint:  #434b60;
  --accent:      #8fd3ff;
  --accent-ink:  #04131f;
  --accent-soft: rgba(143,211,255,0.13);
  --accent-line: rgba(143,211,255,0.42);
  --violet:      #b49cff;
  --pink:        #f9a8d4;
  --amber:       #fbbf24;
  --rose:        #fb7185;
  --emerald:     #34d399;
  --neb-1:       rgba(92,76,220,0.34);
  --neb-2:       rgba(18,140,165,0.26);
  --neb-3:       rgba(180,60,170,0.17);
  --shadow:      0 12px 40px rgba(0,0,0,0.38);
  --overlay:     rgba(2,4,10,0.6);
  --stars:       1;
  color-scheme: dark;
}

html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.55 var(--f-ui);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }

/* ── Fond : nébuleuse + étoiles ────────────────────────────────
   Dégradés radiaux (pas de filter) animés en transform uniquement. */
.sky { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.neb { position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%; will-change: transform; }
.neb.n1 { left: -18vmax; top: -22vmax; background: radial-gradient(circle, var(--neb-1), transparent 62%); animation: drift1 90s ease-in-out infinite alternate; }
.neb.n2 { right: -24vmax; top: 10vmax;  background: radial-gradient(circle, var(--neb-2), transparent 62%); animation: drift2 110s ease-in-out infinite alternate; }
.neb.n3 { left: 25vmax; bottom: -35vmax; background: radial-gradient(circle, var(--neb-3), transparent 60%); animation: drift3 130s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(14vmax, 10vmax) scale(1.12); } }
@keyframes drift2 { to { transform: translate(-12vmax, 14vmax) scale(0.92); } }
@keyframes drift3 { to { transform: translate(-10vmax, -12vmax) scale(1.08); } }
.stars, .stars::after {
  position: absolute; inset: 0; opacity: var(--stars);
  background-image:
    radial-gradient(1px 1px at 12% 18%, #fff 50%, transparent), radial-gradient(1px 1px at 78% 42%, #fff 50%, transparent),
    radial-gradient(1.2px 1.2px at 92% 12%, #fff 50%, transparent), radial-gradient(1px 1px at 48% 64%, #fff 50%, transparent),
    radial-gradient(1px 1px at 22% 88%, #fff8e8 50%, transparent), radial-gradient(1px 1px at 67% 15%, #eaf0ff 50%, transparent),
    radial-gradient(.8px .8px at 5% 32%, #fff 50%, transparent), radial-gradient(1px 1px at 41% 6%, #fff 50%, transparent),
    radial-gradient(.9px .9px at 95% 70%, #fff 50%, transparent), radial-gradient(1.1px 1.1px at 31% 47%, #fff 50%, transparent),
    radial-gradient(.8px .8px at 73% 83%, #dde6ff 50%, transparent), radial-gradient(1px 1px at 57% 31%, #fff 50%, transparent),
    radial-gradient(.7px .7px at 84% 58%, #fff 50%, transparent), radial-gradient(.7px .7px at 16% 63%, #fff 50%, transparent);
}
.stars::after { content: ''; background-size: 50% 50%; opacity: calc(var(--stars) * .55); animation: twinkle 5s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: calc(var(--stars) * .15); } }
.meteor { position: absolute; width: 140px; height: 1px; opacity: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.9)); transform: rotate(-24deg); }
[data-theme="light"] .meteor { background: linear-gradient(90deg, transparent, rgba(10,111,194,.55)); }
.meteor.go { animation: meteor 1.1s ease-out forwards; }
@keyframes meteor { 0% { opacity: 0; translate: 0 0; } 15% { opacity: 1; } 100% { opacity: 0; translate: -340px 150px; } }
body.onglet-cache .neb, body.onglet-cache .stars::after { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
  .neb, .stars::after, .orbit-mini .craft { animation: none !important; }
  .page.active { animation: none !important; }
}

/* ── Coquille ──────────────────────────────────────────────── */
.shell { position: relative; z-index: 1; display: grid; grid-template-columns: var(--side-w) 1fr; height: 100%; }
.glass-bar { background: var(--glass-bar); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%); }

.sidebar { display: flex; flex-direction: column; border-right: 1px solid var(--line); padding: 20px 14px 14px; gap: 16px; overflow-y: auto; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; color: var(--text); }
.brand-name { font: 600 13px/1 var(--f-head); letter-spacing: .3em; }
.orbit-mini { position: relative; width: 104px; height: 104px; margin: 4px auto 0; }
.orbit-mini .ring { position: absolute; inset: 0; border-radius: 50%; border: 1px dashed var(--accent-line); opacity: .55; }
.orbit-mini .planet {
  position: absolute; inset: 28px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0%, var(--pl, #cfe0f0) 28%, color-mix(in srgb, var(--pl, #cfe0f0) 55%, #000) 100%);
  box-shadow: 0 0 36px color-mix(in srgb, var(--pl, #cfe0f0) 35%, transparent);
}
.orbit-mini .craft { position: absolute; inset: 0; animation: spin 12s linear infinite; }
.orbit-mini .craft::after { content: ''; position: absolute; top: -3px; left: 50%; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--text); box-shadow: 0 0 10px var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }
.orbit-label { text-align: center; font: 500 10px var(--f-mono); letter-spacing: .26em; color: var(--text-dim); margin-top: 8px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-sep { font: 500 9px var(--f-mono); letter-spacing: .24em; color: var(--text-faint); text-transform: uppercase; padding: 12px 10px 6px; }
.nav-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: var(--r-sm); color: var(--text-dim); font-size: 13px; text-align: left; transition: background .2s, color .2s; }
.nav-btn:hover { background: var(--glass); color: var(--text); }
.nav-btn.active { background: var(--accent-soft); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.nav-btn .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.nav-btn .num { margin-left: auto; font: 10px var(--f-mono); color: var(--text-faint); }
.nav-btn[disabled] { opacity: .45; cursor: default; }
.nav-btn[disabled]:hover { background: none; color: var(--text-dim); }
.pause-tag { margin-left: auto; font: 9px var(--f-mono); letter-spacing: .1em; color: var(--text-faint); border: 1px solid var(--line); padding: 1px 5px; border-radius: 4px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 12px; border-top: 1px solid var(--line); }
.side-foot button { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-sm); color: var(--text-muted); font-size: 12.5px; text-align: left; }
.side-foot button:hover { background: var(--glass); color: var(--text); }
.side-foot .logout:hover { color: var(--rose); }

.main { position: relative; display: flex; flex-direction: column; min-width: 0; }
.top { position: relative; z-index: 20; height: 56px; flex-shrink: 0; display: flex; align-items: center; gap: 14px; padding: 0 28px; border-bottom: 1px solid var(--line); }
.crumb { font: 500 10px var(--f-mono); letter-spacing: .24em; color: var(--text-muted); text-transform: uppercase; }
.crumb b { color: var(--text); font-weight: 500; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--glass); font: 500 10.5px var(--f-mono); letter-spacing: .06em; color: var(--text-dim); text-decoration: none; transition: border-color .2s, color .2s; }
a.chip:hover { border-color: var(--accent-line); color: var(--text); }
.chip .live { width: 6px; height: 6px; border-radius: 50%; background: var(--emerald); box-shadow: 0 0 8px var(--emerald); }
.btn-hamburger { display: none; width: 34px; height: 34px; border-radius: 8px; font-size: 18px; color: var(--text-dim); }
.sidebar-overlay { display: none; }

/* Pages : chacune est son propre conteneur de défilement */
.app-main { position: relative; flex: 1; min-height: 0; }
.page { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; padding: 36px 40px 80px; display: none; }
.page.active { display: block; animation: page-in .3s var(--ease) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } }
.wrap { max-width: 1280px; margin: 0 auto; }

/* Scroll reveal — une seule fois par élément */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s var(--ease), transform .5s var(--ease); transition-delay: var(--d, 0ms); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* En-têtes */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.page-header h2 { font: 500 32px/1.1 var(--f-head); letter-spacing: -.01em; }
.page-header p { color: var(--text-muted); margin-top: 8px; }
.page-header .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sec { margin-top: 44px; }
.sec-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.sec-idx { font: 500 11px var(--f-mono); color: var(--accent); letter-spacing: .1em; }
.sec-title { font: 500 20px/1.2 var(--f-head); letter-spacing: 0; }
.sec-sub { color: var(--text-muted); font-size: 13px; }
.sec-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* Briefing */
.hero { padding-top: 6px; }
.eyebrow { font: 500 11px var(--f-mono); letter-spacing: .2em; text-transform: uppercase; color: var(--text-muted); }
.hero h1 { font: 500 44px/1.05 var(--f-head); letter-spacing: -.01em; margin: 12px 0 10px; }
.hero h1 span { background: linear-gradient(100deg, var(--text) 30%, var(--accent) 70%, var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { color: var(--text-dim); font-size: 15px; max-width: 620px; min-height: 1.55em; }
.lede b { color: var(--text); font-weight: 600; }

/* Panneau verre (sans flou) */
.panel, .card { background: var(--glass); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: inset 0 1px 0 var(--hi), var(--shadow); }
.card { padding: 20px 22px; min-width: 0; }
.card-title { font: 500 10px var(--f-mono); letter-spacing: .2em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; min-width: 0; }
.grid-2 > * { min-width: 0; }

/* ── Boutons ───────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 15px; border-radius: 999px; font-size: 12.5px; font-weight: 500; border: 1px solid var(--line-2); color: var(--text-dim); background: var(--glass); white-space: nowrap; transition: border-color .2s, color .2s, background .2s, transform .1s; text-decoration: none; }
.btn:hover { border-color: var(--accent-line); color: var(--text); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); color: var(--accent-ink); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--rose); border-color: transparent; background: transparent; }
.btn-danger:hover { background: color-mix(in srgb, var(--rose) 10%, transparent); border-color: transparent; color: var(--rose); }
.btn-sm { height: 28px; padding: 0 11px; font-size: 12px; }
.btn-icon { width: 30px; height: 30px; display: inline-grid; place-items: center; border-radius: 8px; color: var(--text-muted); font-size: 13px; flex-shrink: 0; transition: background .15s, color .15s; }
.btn-icon:hover { background: var(--glass-2); color: var(--text); }
.btn-icon.del:hover { color: var(--rose); }

/* ── Formulaires ───────────────────────────────────────────── */
input, textarea, select { font: inherit; color: var(--text); width: 100%; padding: 9px 12px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); outline: none; transition: border-color .2s, box-shadow .2s; }
input:focus, textarea:focus, select:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
input[type=file] { padding: 0; border: 0; }
.form-row { display: grid; gap: 12px; margin-bottom: 12px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; }
.form-label { display: block; font: 500 9.5px var(--f-mono); letter-spacing: .18em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; }
.rich-textarea { min-height: 220px; line-height: 1.7; }

/* Onglets segmentés */
.tab-group, .monitor-tabs, .seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; border: 1px solid var(--line); background: var(--glass); margin-bottom: 18px; flex-wrap: wrap; }
.tab-btn, .monitor-tab { height: 30px; padding: 0 15px; border-radius: 999px; font-size: 12.5px; color: var(--text-muted); transition: color .15s, background .15s; }
.tab-btn:hover, .monitor-tab:hover { color: var(--text); }
.tab-btn.active, .monitor-tab.active { background: var(--accent-soft); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent-line); }
.monitor-panel { display: none; }
.monitor-panel.active { display: block; }

.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .tab-group { margin-bottom: 0; }
.search-box { position: relative; flex: 1; min-width: 220px; max-width: 420px; }
.search-box input { height: 36px; padding: 0 44px 0 34px; border-radius: 999px; background: var(--glass); border-color: var(--line); }
.search-box::before { content: '⌕'; position: absolute; left: 13px; top: 50%; transform: translateY(-52%); color: var(--text-muted); font-size: 16px; pointer-events: none; }
.search-box .kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 10px var(--f-mono); color: var(--text-faint); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; pointer-events: none; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 5px; font: 500 10px var(--f-mono); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; color: var(--c, var(--text-dim)); background: color-mix(in srgb, var(--c, var(--text-muted)) 13%, transparent); }
.badge-accent { --c: var(--accent); } .badge-violet { --c: var(--violet); } .badge-amber { --c: var(--amber); }
.badge-rose { --c: var(--rose); } .badge-emerald { --c: var(--emerald); } .badge-gray { --c: var(--text-muted); }

/* ── Modales (opaques) ─────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 20px; background: var(--overlay); }
.modal-overlay.open { display: flex; animation: fade .2s ease both; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: 0 30px 80px rgba(0,0,0,.35); padding: 24px 26px; animation: pop .25s var(--ease) both; }
.modal.modal-lg { max-width: 820px; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal-header { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.modal-header h3 { flex: 1; font: 500 19px var(--f-head); }
.modal-close { width: 30px; height: 30px; border-radius: 8px; color: var(--text-muted); font-size: 15px; flex-shrink: 0; }
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* Toasts « transmission » */
.toast-container { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 40px)); }
.toast { padding: 10px 14px; border-radius: var(--r); border: 1px solid var(--line-2); font-size: 13px; display: flex; gap: 10px; align-items: center; animation: pop .25s var(--ease) both; box-shadow: var(--shadow); }
.toast .tx { font: 500 10px var(--f-mono); letter-spacing: .14em; color: var(--accent); flex-shrink: 0; }
.toast.error .tx { color: var(--rose); }

/* États vides */
.empty-state { text-align: center; padding: 36px 16px; color: var(--text-muted); }
.empty-state .icon { font-size: 26px; margin-bottom: 8px; opacity: .8; }
.empty-state p { font-size: 13px; }

/* ── Briefing : alertes, tâches, notes ─────────────────────── */
.alerts { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.reminder-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--r); }
.reminder-card .beacon { width: 9px; height: 9px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px color-mix(in srgb, var(--amber) 18%, transparent); flex-shrink: 0; }
.reminder-card.urgent .beacon { background: var(--rose); box-shadow: 0 0 0 4px color-mix(in srgb, var(--rose) 18%, transparent); }
.reminder-info { flex: 1; min-width: 0; }
.reminder-info strong { display: block; font-size: 13px; }
.reminder-info span { color: var(--text-muted); font-size: 12px; }
.reminder-days { font: 500 12px var(--f-mono); color: var(--amber); white-space: nowrap; }
.reminder-card.urgent .reminder-days { color: var(--rose); }
.all-clear { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r); color: var(--text-dim); font-size: 13px; }
.all-clear .beacon { width: 9px; height: 9px; border-radius: 50%; background: var(--emerald); box-shadow: 0 0 0 4px color-mix(in srgb, var(--emerald) 18%, transparent); }

/* ── Kanban (« Tableau de mission ») ─────────────────────────
   Colonnes : panneaux semi-transparents ; cartes opaques, sans flou. */
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.fchip { height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); color: var(--text-muted); display: inline-flex; align-items: center; gap: 6px; }
.fchip:hover { color: var(--text); }
.fchip.on { border-color: var(--accent-line); color: var(--text); background: var(--accent-soft); }
.fchip i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.board { display: flex; gap: 14px; overflow-x: auto; padding: 2px 2px 14px; margin-top: 14px; align-items: flex-start; }
.col { flex: 0 0 292px; display: flex; flex-direction: column; max-height: 680px; border-radius: var(--r-lg); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 14px 12px 10px 14px; cursor: grab; }
.col-head:active { cursor: grabbing; }
.col-name { font: 600 13.5px var(--f-head); letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-count { font: 11px var(--f-mono); color: var(--text-muted); background: var(--glass-2); border-radius: 999px; padding: 1px 8px; }
.col-tag { font: 9px var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--emerald); border: 1px solid color-mix(in srgb, var(--emerald) 40%, transparent); border-radius: 4px; padding: 0 5px; }
.col-menu { margin-left: auto; color: var(--text-muted); width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0; }
.col-menu:hover { background: var(--glass-2); color: var(--text); }
.cards { display: flex; flex-direction: column; gap: 8px; padding: 2px 10px 6px; overflow-y: auto; min-height: 44px; }
.add-card { margin: 4px 10px 12px; padding: 8px 10px; border-radius: var(--r-sm); text-align: left; color: var(--text-muted); font-size: 12.5px; }
.add-card:hover { background: var(--glass-2); color: var(--text); }
.col-new { flex-basis: 240px; border: 1px dashed var(--line-2); }
.col-new button { padding: 16px; color: var(--text-muted); font-size: 13px; text-align: left; width: 100%; }
.col-new button:hover { color: var(--text); }
.kcard { position: relative; padding: 11px 12px 10px 15px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); box-shadow: inset 0 1px 0 var(--hi), 0 3px 10px rgba(15,23,42,.06); cursor: pointer; transition: border-color .15s, transform .15s; }
.kcard::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--text-faint); }
.kcard.p-high::before { background: var(--rose); }
.kcard.p-normal::before { background: var(--accent); }
.kcard:hover { border-color: var(--line-2); transform: translateY(-1px); }
.kcard.done { opacity: .6; }
.kcard.done .kt { text-decoration: line-through; text-decoration-color: var(--text-faint); }
.kcard.hidden { display: none; }
.klabels { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 7px; }
.lbl { font: 500 9.5px var(--f-mono); letter-spacing: .08em; text-transform: uppercase; padding: 2px 7px; border-radius: 4px; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.kt { font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.kmeta { display: flex; align-items: center; gap: 10px; margin-top: 9px; font: 11px var(--f-mono); color: var(--text-muted); }
.kmeta .due.soon { color: var(--amber); }
.kmeta .due.late { color: var(--rose); }
.kmeta .done-ico { color: var(--emerald); }
.sortable-ghost { opacity: .35; }
.sortable-drag { transform: rotate(2deg); box-shadow: 0 16px 40px rgba(0,0,0,.25); }
.lbl-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.lbl-pick .lbl { cursor: pointer; opacity: .45; border: 0; height: 24px; }
.lbl-pick .lbl.on { opacity: 1; box-shadow: inset 0 0 0 1px var(--c); }
.modal-title-input { flex: 1; font: 500 19px var(--f-head); border: 0; background: none; padding: 4px 0; box-shadow: none !important; }
.check-row { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--text-dim); cursor: pointer; }
.check-row input { width: 16px; height: 16px; accent-color: var(--accent); }
.archive-row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.archive-row:last-child { border-bottom: 0; }
.archive-row .t { flex: 1; min-width: 0; }
.archive-row .t b { display: block; font-weight: 500; font-size: 13.5px; overflow-wrap: anywhere; }
.archive-row .t span { font: 11px var(--f-mono); color: var(--text-muted); }

/* À lire */
.lectures { padding: 6px 6px 4px; }
.lecture-ajout { display: flex; gap: 8px; padding: 8px 10px 10px; }
.lecture-ajout input { flex: 1; height: 36px; }
.lecture { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-top: 1px solid var(--line); }
.lecture-texte { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lecture-titre { font-size: 13.5px; color: var(--text); text-decoration: none; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
a.lecture-titre:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.lecture-titre.brut { font: 12px var(--f-mono); color: var(--text-dim); }
.lecture-infos { font: 11px var(--f-mono); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lecture-lu { flex-shrink: 0; }
.lecture-lu:hover { color: var(--emerald); border-color: color-mix(in srgb, var(--emerald) 50%, transparent); }

.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.note-card { padding: 16px 16px 12px; border-radius: var(--r); cursor: pointer; border-top: 2px solid var(--c, var(--line-2)); transition: transform .2s var(--ease), border-color .2s; }
.note-card:hover { transform: translateY(-2px); }
.note-card.color-blue { --c: var(--accent); } .note-card.color-green { --c: var(--emerald); }
.note-card.color-amber { --c: var(--amber); } .note-card.color-violet { --c: var(--violet); }
.note-card h4 { font: 500 14px var(--f-head); margin-bottom: 6px; }
.note-card p { color: var(--text-dim); font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.note-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; font: 10.5px var(--f-mono); color: var(--text-faint); }
.note-add { display: grid; place-items: center; min-height: 110px; color: var(--text-muted); border: 1px dashed var(--line-2); border-radius: var(--r); font-size: 13px; }
.note-add:hover { color: var(--text); border-color: var(--accent-line); }

/* ── Protocoles ────────────────────────────────────────────── */
.protocol-list { overflow: hidden; }
.protocol-item { border-bottom: 1px solid var(--line); }
.protocol-item:last-child { border-bottom: 0; }
.protocol-header { display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 18px; cursor: pointer; transition: background .15s; }
.protocol-header:hover { background: var(--glass); }
.protocol-header .badge { width: 120px; justify-content: flex-start; flex-shrink: 0; background: none; padding-left: 0; }
.protocol-header .title-text { flex: 1; font-size: 13.5px; min-width: 0; }
.protocol-header .chev { color: var(--text-faint); transition: transform .2s; width: 14px; text-align: center; }
.protocol-item.open .chev { transform: rotate(90deg); }
.protocol-body { display: none; padding: 4px 22px 20px 150px; color: var(--text-dim); font-size: 13.5px; line-height: 1.7; }
.protocol-item.open .protocol-body { display: block; }
.mermaid-render, #diagram-preview { background: #fff; border-radius: var(--r-sm); padding: 14px; text-align: center; min-height: 60px; overflow: auto; color: #111; }

.md-content h1, .md-content h2, .md-content h3 { font-family: var(--f-head); font-weight: 500; color: var(--text); margin: 14px 0 4px; }
.md-content h1 { font-size: 16px; } .md-content h2 { font-size: 15px; } .md-content h3 { font-size: 14px; }
.md-content strong { color: var(--text); font-weight: 600; }
.md-content ul { padding-left: 20px; margin: 4px 0; }
.md-content li { margin-bottom: 2px; }
.md-content hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.md-content code { background: var(--surface-2); border-radius: 4px; padding: 1px 5px; font: 12px var(--f-mono); }
.md-content table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0; }
.md-content th { text-align: left; padding: 7px 10px; background: var(--accent-soft); color: var(--text); font-weight: 600; }
.md-content td { padding: 7px 10px; border-bottom: 1px solid var(--line); }

.md-toolbar { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; padding: 5px 6px; background: var(--surface-2); border: 1px solid var(--line-2); border-bottom: 0; border-radius: var(--r-sm) var(--r-sm) 0 0; }
.md-toolbar .t-btn { height: 26px; min-width: 28px; padding: 0 8px; border-radius: 6px; font-size: 12px; color: var(--text-dim); }
.md-toolbar .t-btn:hover { background: var(--surface); color: var(--text); }
.md-toolbar .t-sep { width: 1px; height: 16px; background: var(--line-2); margin: 0 3px; }
.md-toolbar .t-preview-btn { margin-left: auto; height: 26px; padding: 0 10px; border-radius: 6px; font-size: 12px; color: var(--text-muted); }
.md-toolbar .t-preview-btn:hover { color: var(--accent); }
.md-toolbar + .rich-textarea { border-radius: 0 0 var(--r-sm) var(--r-sm); }
.md-preview-pane { display: none; border: 1px solid var(--line-2); border-top: 0; border-radius: 0 0 var(--r-sm) var(--r-sm); padding: 12px 16px; min-height: 160px; max-height: 360px; overflow-y: auto; font-size: 13.5px; color: var(--text-dim); background: var(--surface); }
.md-preview-pane.open { display: block; }
.diagram-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px; }

.attachments-area { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line-2); }
.attachments-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.attachment-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 12px; color: var(--text-dim); text-decoration: none; background: var(--surface); }
.attachment-chip:hover { border-color: var(--accent-line); color: var(--text); }
.attachment-del { color: var(--text-muted); font-size: 12px; }
.attachment-del:hover { color: var(--rose); }
.upload-btn-wrap { position: relative; display: inline-block; }
.upload-btn-wrap input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-progress { display: none; font-size: 12px; color: var(--accent); margin-top: 6px; }
.upload-progress.show { display: block; }
.protocol-images { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.protocol-images img { max-width: 100%; max-height: 300px; border-radius: var(--r-sm); border: 1px solid var(--line); cursor: zoom-in; }
.lightbox { position: fixed; inset: 0; z-index: 300; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,.88); cursor: zoom-out; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 10px; }

/* ── Modèles (cartes de consultation) ──────────────────────── */
.postit-category-label { display: flex; align-items: baseline; gap: 12px; margin: 30px 0 12px; font: 500 16px var(--f-head); }
.postit-category-label:first-child { margin-top: 0; }
.postit-category-label .n { font: 11px var(--f-mono); color: var(--text-muted); }
.postit-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.postit-card { display: flex; flex-direction: column; height: 190px; padding: 14px 16px 12px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); border-top: 2px solid var(--c, var(--accent)); box-shadow: inset 0 1px 0 var(--hi), 0 4px 14px rgba(0,0,0,.06); transition: transform .15s, border-color .15s; }
.postit-card:hover { transform: translateY(-2px); }
.postit-card { cursor: grab; }
.postit-card.color-pma { --c: var(--accent); } .postit-card.color-gyneco { --c: var(--violet); }
.postit-card.color-obs { --c: var(--pink); } .postit-card.color-general { --c: var(--amber); } .postit-card.color-other { --c: var(--text-muted); }
.postit-title { font: 500 14px/1.3 var(--f-head); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.postit-tags { display: flex; gap: 4px; margin-top: 6px; overflow: hidden; flex-wrap: nowrap; }
.postit-tag { font: 10px var(--f-mono); padding: 1px 6px; border-radius: 4px; background: var(--surface-2); color: var(--text-muted); white-space: nowrap; }
.postit-preview { flex: 1; margin-top: 8px; font: 11.5px/1.5 var(--f-mono); color: var(--text-muted); overflow: hidden; word-break: break-word; }
.postit-footer { display: flex; align-items: center; gap: 4px; padding-top: 8px; margin-top: 6px; border-top: 1px solid var(--line); }
.postit-copy-btn { flex: 1; height: 30px; border-radius: 8px; font-size: 12px; font-weight: 500; color: var(--text-dim); background: var(--surface-2); transition: background .15s, color .15s; }
.postit-copy-btn:hover, .postit-copy-btn.copied { background: var(--accent-soft); color: var(--accent); }

/* ── Tableaux (transferts, ponctions) ──────────────────────── */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; padding: 12px 14px; font: 500 9.5px var(--f-mono); letter-spacing: .18em; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--text-dim); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: var(--glass); }
.data-table .num { font-family: var(--f-mono); color: var(--text); }
.data-table .actions { display: flex; gap: 2px; justify-content: flex-end; }
.data-table .notes-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); }
.alert-dot { color: var(--amber); margin-left: 4px; }
.outcome-btn { height: 26px; padding: 0 10px; border-radius: 999px; font-size: 11.5px; font-weight: 500; border: 1px solid var(--line-2); color: var(--text-muted); white-space: nowrap; }
.outcome-btn:hover { border-color: var(--accent-line); color: var(--text); }
.outcome-btn.pregnant-yes { color: var(--emerald); border-color: color-mix(in srgb, var(--emerald) 50%, transparent); background: color-mix(in srgb, var(--emerald) 10%, transparent); }
.outcome-btn.pregnant-no { color: var(--rose); border-color: color-mix(in srgb, var(--rose) 45%, transparent); background: color-mix(in srgb, var(--rose) 8%, transparent); }

/* ── Statistiques ──────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi-card { padding: 16px 18px; border-radius: var(--r); background: var(--glass); border: 1px solid var(--line); box-shadow: inset 0 1px 0 var(--hi); }
.kpi-value { font: 500 28px/1 var(--f-mono); letter-spacing: -.02em; color: var(--text); }
.kpi-value.accent { color: var(--accent); } .kpi-value.amber { color: var(--amber); }
.kpi-value.rose { color: var(--rose); } .kpi-value.violet { color: var(--violet); }
.kpi-label { font: 500 9.5px var(--f-mono); letter-spacing: .18em; text-transform: uppercase; color: var(--text-muted); margin-top: 10px; }
.chart-wrap { padding: 18px 20px; margin-bottom: 14px; min-width: 0; }
.chart-title { font: 500 10px var(--f-mono); letter-spacing: .18em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 14px; }
.chart-container { position: relative; height: clamp(200px, 26vh, 340px); width: 100%; }

/* ── CV ────────────────────────────────────────────────────── */
.cv-layout { display: flex; gap: 16px; align-items: flex-start; }
.cv-layout > div { flex: 1; min-width: 0; }
.cv-section-block { margin-bottom: 10px; overflow: hidden; border-radius: var(--r); }
.cv-section-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; cursor: pointer; user-select: none; }
.cv-section-header:hover { background: var(--glass); }
.cv-section-header-title { font: 500 14px var(--f-head); }
.cv-section-body { display: none; padding: 0 18px 16px; border-top: 1px solid var(--line); }
.cv-section-body.open { display: block; }
.cv-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; margin-top: 10px; }
.cv-item-row { display: grid; grid-template-columns: 160px 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.cv-label-row { display: grid; grid-template-columns: 200px 1fr; gap: 10px; margin-bottom: 6px; align-items: center; }
.cv-bullet-row { display: flex; gap: 6px; margin-bottom: 6px; align-items: flex-start; }
.cv-bullet-row textarea { min-height: 44px; font-size: 13px; }
.cv-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
#cv-preview-frame { background: #fff; color: #333; padding: 2rem; border-radius: var(--r); border: 1px solid var(--line); font: 10.5pt/1.5 Georgia, serif; max-height: 80vh; overflow-y: auto; }
#cv-preview-frame .prev-exp { display: flex; gap: 12px; margin-bottom: 8px; }
#cv-preview-frame .prev-dates { width: 110px; flex-shrink: 0; color: #7D92A1; font-size: 9pt; }
#cv-preview-frame .prev-title { font-weight: bold; font-size: 10pt; }
#cv-preview-frame .prev-sub { color: #7D92A1; font-size: 9pt; }
#cv-preview-frame .prev-bullets { color: #7D92A1; font-size: 9pt; padding-left: 14px; }
#cv-preview-frame .prev-lbl { display: flex; gap: 10px; margin-bottom: 4px; }
#cv-preview-frame .prev-lbl-key { width: 140px; flex-shrink: 0; color: #7D92A1; font-size: 9.5pt; font-weight: bold; }
#cv-preview-frame .prev-lbl-val { font-size: 9.5pt; }

/* ── Assistant de rédaction ────────────────────────────────── */
#page-assistant.active { display: flex; flex-direction: column; overflow: hidden; padding-bottom: 24px; }
#page-assistant .page-header { flex-shrink: 0; margin-bottom: 14px; }
.assistant-fil { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 4px 4px 20px; }
.assistant-msg { display: flex; flex-direction: column; max-width: 78%; gap: 6px; }
.assistant-msg.moi { align-self: flex-end; align-items: flex-end; }
.assistant-msg.ia { align-self: flex-start; align-items: flex-start; }
.assistant-bulle { border-radius: var(--r); padding: 12px 16px; font-size: 14px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; border: 1px solid var(--line); background: var(--glass); }
.assistant-msg.moi .assistant-bulle { background: var(--accent-soft); border-color: var(--accent-line); }
.assistant-msg-meta { display: flex; gap: 10px; }
.assistant-systeme { align-self: center; width: 100%; text-align: center; font: 500 9.5px var(--f-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--text-faint); padding: 6px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.assistant-attente { display: flex; align-items: baseline; gap: 12px; }
.assistant-chrono { font: 300 20px var(--f-mono); color: var(--text); }
.assistant-attente-note { font-size: 12px; color: var(--text-muted); }
.assistant-composeur { flex-shrink: 0; border-top: 1px solid var(--line); padding-top: 14px; }
.assistant-modes { margin-bottom: 10px; }
.assistant-modes-sep { width: 1px; align-self: stretch; background: var(--line-2); margin: 4px 8px; }
.assistant-saisie-ligne { display: flex; align-items: flex-end; gap: 10px; }
#assistant-saisie { flex: 1; min-height: 44px; max-height: 200px; overflow-y: auto; resize: none; }
.assistant-boutons { display: flex; gap: 6px; }
.assistant-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.assistant-compteur { font: 500 9.5px var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--text-faint); }
.assistant-compteur.proche-limite { color: var(--amber); }
.assistant-compteur.limite { color: var(--rose); }
.assistant-hint { font-size: 12px; color: var(--text-muted); }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 1024px) {
  :root { --side-w: 210px; }
  .page { padding: 28px 26px 70px; }
}
@media (max-width: 768px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 260px; transform: translateX(-100%); transition: transform .25s var(--ease); box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .sidebar.open { transform: none; }
  .sidebar-overlay.open { display: block; position: fixed; inset: 0; z-index: 25; background: var(--overlay); }
  .btn-hamburger { display: inline-grid; place-items: center; }
  .top { padding: 0 14px; }
  .top .hide-m { display: none; }
  .page { padding: 22px 16px 80px; }
  .hero h1 { font-size: 32px; }
  .col { flex-basis: 84vw; }
  .page-header h2 { font-size: 26px; }
  .grid-2, .form-row.cols-2, .form-row.cols-3, .cv-item-row, .cv-label-row { grid-template-columns: 1fr; }
  .cv-layout { flex-direction: column; }
  .protocol-header .badge { width: auto; }
  .protocol-body { padding-left: 18px; }
  .assistant-msg { max-width: 92%; }
  .assistant-saisie-ligne { flex-direction: column; align-items: stretch; }
  .modal { padding: 18px; }
}
