/* MultiSoft — socle visuel commun (studio + applications générées) */
:root {
  --acc: #2563eb;
  --acc-txt: #fff;
  --acc-doux: color-mix(in srgb, var(--acc) 12%, transparent);
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --txt: #161a22;
  --txt-2: #5b6474;
  --bord: #e3e6ec;
  --bord-fort: #cfd4dc;
  --ok: #15803d;
  --ok-doux: #dcfce7;
  --alerte: #b45309;
  --alerte-doux: #fef3c7;
  --danger: #dc2626;
  --danger-doux: #fee2e2;
  --ombre: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .08);
  --ombre-haute: 0 12px 32px rgba(16, 24, 40, .16);
  --r: 10px;
  --police: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, ui-monospace, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1218; --surface: #171b23; --surface-2: #1d222c; --txt: #e8ebf1; --txt-2: #98a1b2;
    --bord: #2a303c; --bord-fort: #3a4150; --ok: #4ade80; --ok-doux: #12301e; --alerte: #fbbf24; --alerte-doux: #33260b;
    --danger: #f87171; --danger-doux: #3a1717; --ombre: 0 1px 2px rgba(0,0,0,.4); --ombre-haute: 0 12px 32px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1218; --surface: #171b23; --surface-2: #1d222c; --txt: #e8ebf1; --txt-2: #98a1b2;
  --bord: #2a303c; --bord-fort: #3a4150; --ok: #4ade80; --ok-doux: #12301e; --alerte: #fbbf24; --alerte-doux: #33260b;
  --danger: #f87171; --danger-doux: #3a1717; --ombre: 0 1px 2px rgba(0,0,0,.4); --ombre-haute: 0 12px 32px rgba(0,0,0,.5);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--txt); font: 14px/1.45 var(--police); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
a { color: var(--acc); text-decoration: none; }
.ic { flex: none; vertical-align: middle; }
.muet { color: var(--txt-2); }
.petit { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; text-align: end; white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.ligne { display: flex; align-items: center; gap: 8px; }
.ligne.espace { justify-content: space-between; }
.pousse { flex: 1; }
.cache { display: none !important; }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border: 1px solid var(--bord-fort); border-radius: 8px; background: var(--surface); color: var(--txt);
  font: 500 13.5px var(--police); cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { background: var(--surface-2); border-color: var(--txt-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primaire { background: var(--acc); border-color: var(--acc); color: var(--acc-txt); }
.btn.primaire:hover { filter: brightness(1.07); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.danger:hover { background: var(--danger-doux); }
.btn.fantome { border-color: transparent; background: transparent; }
.btn.fantome:hover { background: var(--surface-2); }
.btn.petit { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.grand { height: 46px; padding: 0 20px; font-size: 15px; border-radius: 10px; }
.btn.icone { width: 36px; padding: 0; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

/* Cartes, badges */
.carte { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--r); box-shadow: var(--ombre); }
.carte > .tete { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--bord); }
.carte > .corps { padding: 16px; }
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--txt-2); border: 1px solid var(--bord); white-space: nowrap; }
.badge.ok { background: var(--ok-doux); color: var(--ok); border-color: transparent; }
.badge.alerte { background: var(--alerte-doux); color: var(--alerte); border-color: transparent; }
.badge.danger { background: var(--danger-doux); color: var(--danger); border-color: transparent; }
.badge.acc { background: var(--acc-doux); color: var(--acc); border-color: transparent; }

/* Formulaires */
.champ { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.champ > label { font-size: 12.5px; font-weight: 600; color: var(--txt-2); }
.champ .aide { font-size: 12px; color: var(--txt-2); }
input, select, textarea {
  width: 100%; min-height: 36px; padding: 7px 10px; border: 1px solid var(--bord-fort); border-radius: 8px; background: var(--surface);
  color: var(--txt); font: 14px var(--police);
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-doux); }
input[type="checkbox"] { width: 18px; min-height: 18px; height: 18px; accent-color: var(--acc); }
input[type="color"] { padding: 2px; width: 60px; }
input[readonly] { background: var(--surface-2); color: var(--txt-2); }
.grille-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px 16px; }
.grille-form .large { grid-column: 1 / -1; }

/* Tableaux */
.tableau-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: start; font-size: 12px; font-weight: 600; color: var(--txt-2); padding: 9px 12px; border-bottom: 1px solid var(--bord);
  background: var(--surface-2); position: sticky; top: 0; white-space: nowrap; }
table.t td { padding: 9px 12px; border-bottom: 1px solid var(--bord); vertical-align: middle; }
table.t tbody tr:last-child td { border-bottom: 0; }
table.t tbody tr.clic { cursor: pointer; }
table.t tbody tr.clic:hover td { background: var(--surface-2); }
table.t tfoot td { font-weight: 650; background: var(--surface-2); border-top: 1px solid var(--bord); }
.vide { padding: 40px 16px; text-align: center; color: var(--txt-2); }

/* Fenêtre modale, notifications */
.voile { position: fixed; inset: 0; background: rgba(10, 14, 22, .45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; animation: fondu .12s; }
.modale { background: var(--surface); border-radius: 14px; box-shadow: var(--ombre-haute); width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; animation: monte .16s ease-out; }
.modale.large { width: min(860px, 100%); }
.modale > .tete { padding: 16px 20px; border-bottom: 1px solid var(--bord); display: flex; align-items: center; justify-content: space-between; }
.modale > .corps { padding: 20px; overflow: auto; }
.modale > .pied { padding: 14px 20px; border-top: 1px solid var(--bord); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
@keyframes fondu { from { opacity: 0; } }
@keyframes monte { from { transform: translateY(8px); opacity: 0; } }
#toasts { position: fixed; inset-inline-end: 16px; top: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: calc(100vw - 32px); }
.toast { background: var(--txt); color: var(--surface); padding: 11px 14px; border-radius: 10px; box-shadow: var(--ombre-haute); font-weight: 500; max-width: 420px; animation: monte .16s; }
.toast.erreur { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- animation de démarrage (reprise de ZainSoft) */
/* ---------- animation de démarrage */
.splash { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; overflow: hidden; cursor: pointer; animation: spIn .35s ease-out; }
.splash.sp-out { animation: spOut .45s ease-in forwards; }
@keyframes spIn { from { opacity: 0; } }
@keyframes spOut { to { opacity: 0; transform: scale(1.04); } }
.sp-shade { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.sp-center { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; padding: 24px; }
.sp-logo-wrap { position: relative; display: grid; place-items: center; }
.sp-logo { width: 104px; height: 104px; border-radius: 28px; background: rgba(255,255,255,.16); display: grid; place-items: center; font-size: 2.6rem; font-weight: 800; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.35), inset 0 0 0 1px rgba(255,255,255,.25); backdrop-filter: blur(4px); }
.sp-logo img { width: 100%; height: 100%; object-fit: cover; }
.sp-title {  font-size: clamp(1.8rem, 5vw, 3.2rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.sp-sub { font-size: 1.1rem; opacity: .85; }
.sp-bar { position: absolute; bottom: 12%; left: 50%; width: 180px; height: 4px; margin-left: -90px; border-radius: 4px; background: rgba(255,255,255,.2); overflow: hidden; z-index: 2; }
.sp-bar i { display: block; height: 100%; background: currentColor; transform-origin: left; animation: spBar var(--sp-dur) linear forwards; }
@keyframes spBar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.sp-skip { position: absolute; bottom: 24px; inset-inline-end: 28px; font-size: .8rem; opacity: .6; z-index: 2; }
/* 1. fondu & zoom */
.sp-fade .sp-logo { animation: spZoom .9s cubic-bezier(.2,.9,.3,1.3) both; }
.sp-fade .sp-title { animation: spRise .7s .35s ease-out both; }
.sp-fade .sp-sub { animation: spRise .7s .55s ease-out both; }
@keyframes spZoom { from { opacity: 0; transform: scale(.4) rotate(-8deg); } }
@keyframes spRise { from { opacity: 0; transform: translateY(18px); } }
/* 2. glissement */
.sp-panel { position: absolute; top: 0; bottom: 0; width: 50%; background: rgba(0,0,0,.25); z-index: 1; }
.sp-p1 { left: 0; animation: spPanelL calc(var(--sp-dur) * .45) .1s cubic-bezier(.7,0,.3,1) forwards; }
.sp-p2 { right: 0; animation: spPanelR calc(var(--sp-dur) * .45) .1s cubic-bezier(.7,0,.3,1) forwards; }
@keyframes spPanelL { to { transform: translateX(-100%); } }
@keyframes spPanelR { to { transform: translateX(100%); } }
.sp-slide .sp-logo { animation: spDrop .8s .3s cubic-bezier(.2,.9,.3,1.2) both; }
.sp-slide .sp-title { animation: spFromLeft .7s .55s ease-out both; }
.sp-slide .sp-sub { animation: spFromRight .7s .7s ease-out both; }
@keyframes spDrop { from { opacity: 0; transform: translateY(-120px); } }
@keyframes spFromLeft { from { opacity: 0; transform: translateX(-80px); } }
@keyframes spFromRight { from { opacity: 0; transform: translateX(80px); } }
/* 3. rebond */
.sp-bounce .sp-logo { animation: spBounce 1.1s both; }
.sp-ch { display: inline-block; animation: spCh .55s cubic-bezier(.2,.9,.3,1.5) both; }
.sp-bounce .sp-sub { animation: spRise .6s 1s ease-out both; }
@keyframes spBounce { 0% { opacity: 0; transform: translateY(-200px); } 45% { opacity: 1; transform: translateY(0); } 62% { transform: translateY(-36px); } 78% { transform: translateY(0); } 88% { transform: translateY(-10px); } 100% { transform: translateY(0); } }
@keyframes spCh { from { opacity: 0; transform: translateY(30px) scale(.6); } }
/* 4. onde (pulsation) */
.sp-ring { position: absolute; width: 104px; height: 104px; border-radius: 50%; border: 2px solid currentColor; opacity: 0; animation: spRing 1.8s ease-out infinite; }
.sp-ring.r2 { animation-delay: .6s; }
@keyframes spRing { 0% { opacity: .7; transform: scale(1); } 100% { opacity: 0; transform: scale(2.6); } }
.sp-pulse .sp-logo { border-radius: 50%; animation: spBeat 1.2s ease-in-out infinite; }
.sp-pulse .sp-title { animation: spRise .7s .3s ease-out both; }
.sp-pulse .sp-sub { animation: spRise .7s .5s ease-out both; }
@keyframes spBeat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
/* 5. machine à écrire */
.sp-typewriter .sp-logo { animation: spZoom .6s both; }
.sp-caret { animation: spBlink .7s steps(1) infinite; font-weight: 300; margin-left: 2px; }
.sp-typewriter .sp-sub { animation: spRise .6s calc(var(--sp-dur) * .55) ease-out both; }
@keyframes spBlink { 50% { opacity: 0; } }
/* 6. bulles */
.sp-bubbles { position: absolute; inset: 0; z-index: 1; }
.sp-bubbles i { position: absolute; bottom: -60px; border-radius: 50%; background: rgba(255,255,255,.18); animation: spBubble linear infinite; }
@keyframes spBubble { to { transform: translateY(-120vh); opacity: 0; } }
.sp-bubbles ~ .sp-center .sp-logo { animation: spZoom .9s .2s cubic-bezier(.2,.9,.3,1.3) both; }
.sp-bubbles ~ .sp-center .sp-title { animation: spRise .7s .5s ease-out both; }
.sp-bubbles ~ .sp-center .sp-sub { animation: spRise .7s .7s ease-out both; }
@media (prefers-reduced-motion: reduce) { .splash * { animation-duration: .01s !important; animation-iteration-count: 1 !important; } }
