/* ============================================================
   MyGestion — feuille de style
   ============================================================ */
:root {
  --bg: #f3f5f9;
  --card: #ffffff;
  --ink: #1b2236;
  --muted: #6b7489;
  --line: #e3e7ef;
  --side: #141b2d;
  --side-ink: #c9d1e3;
  --accent: #ff6b3d;
  --accent-dark: #e4552a;
  --blue: #3d7bff;
  --green: #1fa971;
  --red: #e5484d;
  --amber: #f0a020;
  --violet: #7a5af8;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 27, 45, .06), 0 4px 14px rgba(20, 27, 45, .05);
  font-size: 15px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.45;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 1.05rem; margin-bottom: .8rem; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.petit { font-size: .82rem; }
.bloc { display: block; }
.center { text-align: center; }
.mt { margin-top: 1.6rem; }
.cache { display: none !important; }
.txt-alerte { color: var(--red); }
.vide { color: var(--muted); font-style: italic; padding: .6rem 0; }

/* ---------- Structure ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--side); color: var(--side-ink);
  display: flex; flex-direction: column; padding: 1.2rem .8rem; position: sticky; top: 0; height: 100vh;
}
.logo { font-weight: 800; font-size: 1.45rem; color: #fff; padding: 0 .6rem .9rem; letter-spacing: -.5px; display: flex; align-items: center; gap: .55rem; }
.logo .logo-img { height: 30px; width: auto; }
.logo span { color: #3FD3E3; }
.login-logo span { color: #0466FF; }
.side-ent { background: rgba(255,255,255,.06); border-radius: 10px; padding: .7rem .8rem; margin-bottom: .4rem; }
.side-ent-nom { color: #fff; font-weight: 700; }
.side-ent-sub { font-size: .8rem; opacity: .7; }
.side-user { font-size: .8rem; padding: .3rem .8rem .9rem; opacity: .75; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a {
  color: var(--side-ink); padding: .6rem .8rem; border-radius: 8px; display: flex; align-items: center; gap: .6rem;
  font-weight: 500; text-decoration: none;
}
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-sec { font-size: .7rem; text-transform: uppercase; letter-spacing: .8px; opacity: .5; padding: .9rem .8rem .3rem; font-weight: 700; }
.sidebar { overflow-y: auto; }
.sidebar nav a { padding: .48rem .8rem; }
.sidebar nav a.actif { background: var(--accent); color: #fff; }
.sidebar .ico { width: 1.3rem; text-align: center; }
.badge { margin-left: auto; background: var(--red); color: #fff; border-radius: 99px; font-size: .72rem; padding: 1px 7px; font-weight: 700; }
.actif .badge { background: #fff; color: var(--accent); }
.logout { color: var(--side-ink); opacity: .7; padding: .6rem .8rem; font-size: .9rem; }
.logout:hover { opacity: 1; color: #fff; }

.main { flex: 1; min-width: 0; }
.topbar { display: flex; align-items: center; gap: .8rem; padding: 1.2rem 1.8rem .4rem; }
.topbar h1 { font-size: 1.5rem; letter-spacing: -.3px; }
.burger { display: none; background: none; border: 0; font-size: 1.4rem; cursor: pointer; color: var(--ink); }
.content { padding: .8rem 1.8rem 3rem; max-width: 1500px; }

/* ---------- Cartes ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.2rem 1.3rem; margin-bottom: 1.1rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; }
.card-head h2 { margin: 0; }
.card-table { padding: 0; overflow-x: auto; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
.grid-2 > .card { margin: 0; }
.lien { display: inline-block; margin-top: .8rem; font-weight: 600; font-size: .9rem; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.1rem; margin-bottom: 1.1rem; }
.kpi { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.2rem; border-top: 3px solid var(--blue); }
.kpi:nth-child(1) { border-color: var(--green); }
.kpi:nth-child(2) { border-color: var(--blue); }
.kpi:nth-child(3) { border-color: var(--violet); }
.kpi:nth-child(4) { border-color: var(--line); }
.kpi.kpi-alerte { border-color: var(--red); }
.kpi.kpi-alerte .kpi-val { color: var(--red); }
.kpi-lab { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; font-weight: 600; }
.kpi-val { font-size: 1.7rem; font-weight: 800; margin: .2rem 0; letter-spacing: -.5px; }
.kpi-sub { font-size: .82rem; color: var(--muted); }

/* ---------- Entonnoir ---------- */
.funnel { display: flex; flex-direction: column; gap: .55rem; }
.funnel-row { display: grid; grid-template-columns: 105px 1fr 130px; gap: .7rem; align-items: center; font-size: .88rem; }
.funnel-bar { background: var(--bg); border-radius: 6px; height: 14px; overflow: hidden; }
.funnel-bar .fill { display: block; height: 100%; border-radius: 6px; min-width: 2px; }
.funnel-val { text-align: right; color: var(--muted); white-space: nowrap; }

/* Couleurs des étapes */
.etape-prospect { --c: #8a94a8; }
.etape-qualifie { --c: var(--blue); }
.etape-proposition { --c: var(--violet); }
.etape-negociation { --c: var(--amber); }
.etape-gagne { --c: var(--green); }
.etape-perdu { --c: var(--red); }
.fill[class*="etape-"] { background: var(--c); }
.pill[class*="etape-"] { background: color-mix(in srgb, var(--c) 14%, white); color: var(--c); }

/* ---------- Pastilles, tags ---------- */
.pill { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 9px; border-radius: 99px; white-space: nowrap; }
.pill-prospect { background: #eef3ff; color: var(--blue); }
.pill-client { background: #e6f7ef; color: var(--green); }
.pill-fournisseur { background: #f2eefe; color: var(--violet); }
.pill-rouge { background: var(--red); color: #fff; margin-left: .3rem; }
.tag { display: inline-block; background: var(--bg); color: var(--muted); font-size: .75rem; padding: 1px 8px; border-radius: 6px; margin: 1px 3px 1px 0; }
a.tag:hover { background: var(--line); text-decoration: none; }

/* ---------- Listes ---------- */
.liste-act { list-style: none; padding: 0; margin: 0; }
.liste-act li { display: flex; align-items: center; gap: .7rem; padding: .55rem 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.liste-act li:last-child { border-bottom: 0; }
.liste-act .txt { flex: 1; min-width: 0; }
.liste-act .date { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.liste-act li.retard .date { color: var(--red); font-weight: 600; }
.liste-act.grande li { padding: .75rem 0; }
.notif-mini { display: flex; justify-content: space-between; gap: .6rem; padding: .6rem .7rem; border-radius: 8px; background: #fff7f3; margin-bottom: .45rem; color: var(--ink); font-size: .9rem; border-left: 3px solid var(--accent); }
.notif-mini:hover { text-decoration: none; background: #ffeee6; }
.notif-mini .muted { white-space: nowrap; font-size: .8rem; }
.top { padding-left: 1.2rem; margin: 0; }
.top li { padding: .35rem 0; }
.top li span { float: right; font-weight: 700; }
.repart { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; padding-top: .8rem; border-top: 1px solid var(--line); font-size: .88rem; color: var(--muted); }

/* ---------- Boutons, formulaires ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .3rem; border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: .55rem 1rem; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-danger { color: var(--red); }
.btn-sm { padding: .3rem .7rem; font-size: .82rem; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: wait; }
.ml-auto { margin-left: auto; }

input, select, textarea {
  font: inherit; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); border-color: var(--accent); }
label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; font-weight: 600; color: #3a4258; }
label .muted { font-weight: 400; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem 1rem; }
.col-2 { grid-column: 1 / -1; }
.actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.form-inline { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.form-inline > input, .form-inline > select { width: auto; flex: 1 1 140px; }
.form-inline .grow { flex: 3 1 240px; }
.form-inline label.mini { flex-direction: row; align-items: center; font-weight: 500; }
.form-inline label.mini input { width: auto; }
label.check { flex-direction: row; align-items: center; font-weight: 500; gap: .4rem; }
label.check input { width: auto; }
#f-opp { margin-bottom: 1rem; padding: .8rem; background: var(--bg); border-radius: 10px; }
.form-card { max-width: 820px; }
.aide { font-size: .82rem; color: var(--muted); margin: .4rem 0 0; }

.form-act { display: flex; flex-direction: column; gap: .6rem; }
.types-act { display: flex; flex-wrap: wrap; gap: .4rem; }
.radio-btn { flex-direction: row; }
.radio-btn input { display: none; }
.radio-btn span { padding: .4rem .8rem; border: 1px solid var(--line); border-radius: 99px; cursor: pointer; font-weight: 500; font-size: .85rem; }
.radio-btn input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Barre d'outils, filtres ---------- */
.barre-outils { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.barre-outils p { margin: 0; }
.filtres { display: flex; gap: .5rem; flex-wrap: wrap; flex: 1; }
.filtres input { flex: 2 1 220px; width: auto; }
.filtres select { flex: 1 1 140px; width: auto; }
.compteur { margin: -.3rem 0 .6rem; font-size: .85rem; }

/* ---------- Tableau ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: .8rem 1rem; border-bottom: 1px solid var(--line); background: #fafbfd; white-space: nowrap; }
.table td { padding: .7rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.cliquable { cursor: pointer; }
.cliquable:hover td { background: #fafbfd; }

/* ---------- Onglets ---------- */
.tabs { display: flex; background: var(--bg); border-radius: 10px; padding: 4px; margin-bottom: 1.2rem; }
.tabs a { flex: 1; text-align: center; padding: .5rem; border-radius: 8px; color: var(--muted); font-weight: 600; text-decoration: none; }
.tabs a.actif { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.tabs-inline { background: #e8ecf3; margin: 0; }
.tabs-inline a { padding: .45rem 1.2rem; white-space: nowrap; }

/* ---------- Fiche contact ---------- */
.fiche { display: grid; grid-template-columns: 320px 1fr; gap: 1.1rem; align-items: start; }
.fiche-id { text-align: center; position: sticky; top: 1rem; }
.avatar { width: 72px; height: 72px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--violet)); color: #fff; font-weight: 800; font-size: 1.5rem; display: grid; place-items: center; margin: 0 auto .7rem; }
.fiche-id h2 { margin-bottom: .2rem; }
.fiche-id p { margin: 0 0 .6rem; }
.coord { display: grid; grid-template-columns: auto 1fr; gap: .4rem .8rem; text-align: left; font-size: .88rem; margin: 1rem 0; padding: 1rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.coord dt { color: var(--muted); }
.coord dd { margin: 0; word-break: break-word; }
.fiche-id .tags { margin-bottom: .8rem; }
.notes { text-align: left; background: #fffbea; border-radius: 8px; padding: .7rem; font-size: .88rem; margin-bottom: .8rem; }
.fiche-id .actions { justify-content: center; }
.opp-ligne { display: flex; align-items: center; gap: .7rem; padding: .6rem .3rem; border-bottom: 1px solid var(--line); color: var(--ink); }
.opp-ligne:hover { background: var(--bg); text-decoration: none; }
.opp-titre { flex: 1; }
.opp-montant { font-weight: 700; }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 17px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.timeline li { display: flex; gap: .9rem; padding: .5rem 0; position: relative; }
.tl-ico { width: 36px; height: 36px; border-radius: 50%; background: #fff; border: 2px solid var(--line); display: grid; place-items: center; flex-shrink: 0; z-index: 1; font-size: 1rem; }
.timeline li.a-faire .tl-ico { border-color: var(--blue); border-style: dashed; }
.timeline li.retard .tl-ico { border-color: var(--red); }
.tl-body { flex: 1; background: #fafbfd; border-radius: 10px; padding: .6rem .8rem; min-width: 0; }
.timeline li.a-faire .tl-body { background: #f2f6ff; }
.timeline li.retard .tl-body { background: #fff1f1; }
.tl-head { display: flex; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }
.tl-head .muted { font-size: .8rem; }
.tl-body p { margin: .35rem 0 0; font-size: .9rem; }
.tl-body .btn { margin-top: .5rem; }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(6, minmax(160px, 1fr)); gap: .8rem; overflow-x: auto; padding-bottom: 1rem; align-items: start; }
.col { background: #e9edf4; border-radius: var(--radius); padding: .6rem; min-height: 300px; transition: background .15s; border-top: 3px solid var(--c); }
.col.over { background: color-mix(in srgb, var(--c) 18%, #e9edf4); }
.col-prospect { --c: #8a94a8; }
.col-qualifie { --c: var(--blue); }
.col-proposition { --c: var(--violet); }
.col-negociation { --c: var(--amber); }
.col-gagne { --c: var(--green); }
.col-perdu { --c: var(--red); }
.col-head { padding: .2rem .3rem .7rem; }
.col-titre { font-weight: 700; display: flex; align-items: center; gap: .4rem; }
.col-nb { background: #fff; border-radius: 99px; font-size: .75rem; padding: 0 7px; color: var(--muted); }
.col-total { font-size: .85rem; color: var(--muted); font-weight: 600; }
.col-body { display: flex; flex-direction: column; gap: .5rem; min-height: 60px; }
.kcard { background: #fff; border-radius: 10px; padding: .7rem .8rem; box-shadow: var(--shadow); cursor: grab; border-left: 3px solid var(--c); font-size: .88rem; }
.kcard:hover { box-shadow: 0 4px 16px rgba(20,27,45,.12); }
.kcard.drag { opacity: .4; }
.kcard-titre { font-weight: 700; margin-bottom: .2rem; }
.kcard-client { color: var(--muted); font-size: .82rem; margin-bottom: .5rem; }
.kcard-bas { display: flex; justify-content: space-between; align-items: center; }
.proba { font-size: .75rem; background: var(--bg); padding: 1px 7px; border-radius: 99px; color: var(--muted); font-weight: 600; }
.kcard-date, .kcard-motif { font-size: .78rem; margin-top: .4rem; color: var(--muted); }

.dialog { border: 0; border-radius: 16px; padding: 1.5rem; width: min(640px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.dialog::backdrop { background: rgba(20,27,45,.45); }

/* ---------- Notifications ---------- */
.notif { display: flex; gap: 1rem; border-left: 4px solid var(--accent); }
.notif.traitee { border-left-color: var(--line); opacity: .65; }
.notif.nouvelle { animation: flash 1.5s ease 2; }
@keyframes flash { 50% { background: #fff1ea; } }
.notif-ico { font-size: 1.6rem; }
.notif-body { flex: 1; min-width: 0; }
.notif-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.notif-body p { margin: .4rem 0 .8rem; }

/* ---------- Messages ---------- */
.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-weight: 500; }
.flash-ok { background: #e6f7ef; color: #0f6b46; }
.flash-err { background: #fdecec; color: #a3262a; }
.bandeau-prof { background: #eef3ff; color: #1f4fbf; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
#toast-zone { position: fixed; right: 1.2rem; bottom: 1.2rem; display: flex; flex-direction: column; gap: .5rem; z-index: 100; }
.toast { background: var(--ink); color: #fff; padding: .8rem 1.1rem; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 360px; font-weight: 500; animation: monte .3s ease; transition: opacity .4s, transform .4s; }
.toast.ok { background: var(--green); }
.toast.err { background: var(--red); }
.toast.notif { background: var(--accent); }
.toast.out { opacity: 0; transform: translateY(10px); }
@keyframes monte { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Connexion ---------- */
.page-login { min-height: 100vh; display: grid; place-items: center; padding: 1rem;
  background: radial-gradient(circle at 20% 10%, #2a3554 0, var(--side) 55%); }
.login-box { background: #fff; border-radius: 18px; padding: 2rem; width: min(420px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-box form { display: flex; flex-direction: column; gap: .9rem; }
.login-box h2 { margin-bottom: 1rem; }
.login-logo { font-weight: 800; font-size: 2rem; text-align: center; letter-spacing: -1px; display: flex; flex-direction: column; align-items: center; gap: .4rem; }
.login-logo .logo-img { height: 64px; width: auto; }
.login-tag { text-align: center; color: var(--muted); margin: .2rem 0 1.4rem; }

/* ---------- Espace prof ---------- */
.mode-prof .sidebar nav a.actif { background: var(--blue); }
.mode-prof .actif .badge { color: var(--blue); }
.classe-carte { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--bg); padding: 2px 8px; border-radius: 6px; font-weight: 700; letter-spacing: 1px; }
.scen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.scen { border: 1px solid var(--line); border-radius: 12px; padding: 1rem; }
.scen h3 { margin-bottom: .3rem; }
.scen p { font-size: .88rem; margin: .4rem 0; }
.evt-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .6rem; }
.evt-type input { display: none; }
.evt-type > span { display: block; border: 2px solid var(--line); border-radius: 12px; padding: .8rem; cursor: pointer; font-weight: 400; height: 100%; }
.evt-type span b { display: block; font-size: 1rem; margin-bottom: .2rem; }
.evt-type input:checked + span { border-color: var(--blue); background: #f2f6ff; }
.journal { list-style: none; padding: 0; margin: 0; font-size: .88rem; max-height: 520px; overflow-y: auto; }
.journal li { padding: .45rem 0; border-bottom: 1px solid var(--line); display: flex; gap: .8rem; }
.journal .muted { white-space: nowrap; font-size: .8rem; min-width: 110px; }
.barre-prog { background: var(--bg); border-radius: 99px; height: 8px; overflow: hidden; min-width: 60px; }
.barre-prog span { display: block; height: 100%; background: var(--green); }

/* ---------- Mobile ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fiche { grid-template-columns: 1fr; }
  .fiche-id { position: static; }
}
@media (max-width: 800px) {
  .sidebar { position: fixed; left: -260px; z-index: 50; transition: left .2s; }
  .sidebar.open { left: 0; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .burger { display: block; }
  .topbar, .content { padding-left: 1rem; padding-right: 1rem; }
  .grid-2, .form-grid { grid-template-columns: 1fr; }
  .hide-m { display: none; }
  .funnel-row { grid-template-columns: 90px 1fr; }
  .funnel-val { grid-column: 2; text-align: left; font-size: .8rem; }
  .kanban { grid-template-columns: repeat(6, 78vw); }
}
@media (max-width: 480px) {
  .kpis { grid-template-columns: 1fr; }
}

/* ============================================================
   Modules de gestion
   ============================================================ */
.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
a.kpi { color: inherit; text-decoration: none; display: block; }
a.kpi:hover { box-shadow: 0 6px 20px rgba(20,27,45,.12); }
.kpis-gestion .kpi { border-top-color: var(--accent); }
.kpis-gestion .kpi.kpi-alerte { border-top-color: var(--red); }
.kpi-val.txt-alerte { color: var(--red); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mt-s { margin-top: .8rem; }
.scroll-x { overflow-x: auto; max-width: 100%; }
.scroll-x a { white-space: nowrap; flex: 0 0 auto; }
tr.archive td, li.archive { opacity: .45; }
.pill-rouge-clair { background: #fdecec; color: var(--red); }

/* Statuts */
.statut { display: inline-block; font-size: .74rem; font-weight: 700; padding: 2px 9px; border-radius: 6px; white-space: nowrap; }
.statut-gris { background: #eef0f4; color: #5a6378; }
.statut-bleu { background: #eef3ff; color: var(--blue); }
.statut-vert { background: #e6f7ef; color: var(--green); }
.statut-rouge { background: #fdecec; color: var(--red); }
.statut-violet { background: #f2eefe; color: var(--violet); }
.statut-orange { background: #fff4e0; color: #b8730a; }

/* Pièces */
.piece-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.1rem; align-items: start; }
.piece-layout.sans-side { grid-template-columns: minmax(0, 1fr); }
.piece-side { position: sticky; top: 1rem; }
.table.lignes .l-tva { min-width: 82px; }
.table.lignes .l-art { min-width: 120px; }
.piece-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
.piece-head h2 { margin: .1rem 0 .4rem; }
.actions-col { display: flex; flex-direction: column; gap: .45rem; }
.actions-col form { display: flex; flex-direction: column; gap: .45rem; }
.lignes-wrap { overflow-x: auto; margin: 1rem 0 .6rem; }
.table.lignes td { padding: .35rem .3rem; }
.table.lignes input, .table.lignes select { padding: .4rem .45rem; font-size: .88rem; }
.table.lignes input.num { text-align: right; width: 100%; min-width: 72px; }
.table.lignes .l-pu { min-width: 95px; }
.table.lignes td:has(.l-des) { width: 38%; }
.table.lignes .l-des { min-width: 200px; }
.table.lignes td:has(.l-qte), .table.lignes td:has(.l-rem) { width: 90px; }
.table.lignes td:has(.l-pu) { width: 115px; }
.table.lignes input.invalide { border-color: var(--red); background: #fff1f1; }
.table.lignes .l-tot { font-weight: 700; white-space: nowrap; }
.totaux-wrap { display: flex; gap: 1.5rem; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; margin-top: 1rem; }
.notes-piece { flex: 1 1 260px; }
.totaux { border-collapse: collapse; min-width: 280px; }
.totaux td { padding: .4rem .6rem; }
.totaux tr.ttc td { background: var(--side); color: #fff; font-weight: 800; font-size: 1.1rem; }
.totaux tr.ttc td:first-child { border-radius: 8px 0 0 8px; }
.totaux tr.ttc td:last-child { border-radius: 0 8px 8px 0; }
.chaine { list-style: none; padding: 0; margin: 0; }
.chaine li { padding: .5rem .7rem; border-left: 3px solid var(--line); margin-left: .4rem; display: flex; flex-direction: column; }
.chaine li.courant { border-color: var(--accent); font-weight: 700; background: #fff7f3; }
.regl { display: flex; justify-content: space-between; gap: .5rem; padding: .45rem 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.regl.total { border-bottom: 0; font-size: .95rem; }
.table.compact th, .table.compact td { padding: .45rem .7rem; font-size: .86rem; }

/* Comptabilité */
.journal-table tr.ecr-debut td { border-top: 2px solid var(--line); }
.cpt-credit { padding-left: 2rem !important; }
.gl-head { padding: .8rem 1rem; background: #fafbfd; border-bottom: 1px solid var(--line); }
.classe-titre td { background: #f4f6fa; font-weight: 700; font-size: .78rem !important; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.sous-total td { font-weight: 700; background: #fafbfd; }
.resultat td { font-weight: 800; border-top: 2px solid var(--ink); }
.total-final td { font-weight: 800; background: var(--side); color: #fff; font-size: 1rem !important; }
.total-final.positif td { background: var(--green); }
.total-final.negatif td { background: var(--red); }
tfoot td { background: #fafbfd; }
.ligne-active td { background: #fff7f3; font-weight: 600; }
.barres-mois { display: flex; gap: .5rem; align-items: flex-end; height: 180px; padding-top: .5rem; overflow-x: auto; }
.bm { flex: 1 0 34px; display: flex; flex-direction: column; align-items: center; height: 100%; }
.bm-barres { flex: 1; display: flex; align-items: flex-end; gap: 3px; width: 100%; justify-content: center; }
.bm-barres span { width: 12px; border-radius: 4px 4px 0 0; }
.bm-p, .legende i.bm-p { background: var(--green); }
.bm-c, .legende i.bm-c { background: var(--accent); }
.bm-lab { font-size: .72rem; color: var(--muted); margin-top: .3rem; }
.legende { display: flex; gap: 1rem; font-size: .8rem; color: var(--muted); margin-top: .6rem; }
.legende i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; }
.etapes { padding-left: 1.2rem; margin: 0; }
.etapes li { padding: .6rem 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: .35rem; align-items: flex-start; }
.etapes li.fait strong::after { content: " ✓"; color: var(--green); }
.explication { padding-left: 1.1rem; margin: 0; }
.explication li { margin-bottom: .5rem; font-size: .92rem; }

/* Caisse */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1.1rem; align-items: start; }
.pos-familles { display: flex; gap: .4rem; flex-wrap: wrap; margin: .8rem 0; }
.pos-familles .actif { background: var(--ink); color: #fff; border-color: var(--ink); }
.pos-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.pos-tuile { display: flex; flex-direction: column; gap: .3rem; text-align: left; padding: .8rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; font: inherit; min-height: 110px; transition: transform .1s, box-shadow .1s; }
.pos-tuile:hover { box-shadow: var(--shadow); transform: translateY(-1px); border-color: var(--accent); }
.pos-tuile:active { transform: scale(.97); }
.pos-tuile.epuise { opacity: .5; }
.pos-des { font-weight: 600; font-size: .88rem; flex: 1; }
.pos-prix { font-weight: 800; font-size: 1.1rem; color: var(--accent-dark); }
.pos-stock { font-size: .75rem; color: var(--muted); }
.pos-panier { position: sticky; top: 1rem; }
.pos-panier select { margin-bottom: .6rem; }
.pos-lignes { list-style: none; padding: 0; margin: 0; max-height: 340px; overflow-y: auto; }
.pos-lignes li { display: grid; grid-template-columns: 1fr auto auto; gap: .5rem; align-items: center; padding: .5rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.pos-qte { display: flex; align-items: center; gap: .4rem; }
.pos-qte button { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 700; }
.pos-total { display: flex; justify-content: space-between; align-items: center; padding: 1rem 0; font-size: 1.1rem; }
.pos-total strong { font-size: 1.8rem; }
.pos-pay { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; margin-bottom: .5rem; }
.pos-pay .btn { justify-content: center; padding: .8rem .3rem; }
.pos-rendu { font-size: 1.2rem; }

/* Paie */
.bul-entete { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: start; padding-bottom: 1rem; border-bottom: 2px solid var(--ink); margin-bottom: 1rem; }

/* Mobile */
@media (max-width: 1100px) {
  .piece-layout, .pos { grid-template-columns: 1fr; }
  .piece-side, .pos-panier { position: static; }
}
@media (max-width: 800px) {
  .kpis-3 { grid-template-columns: 1fr; }
  .bul-entete { grid-template-columns: 1fr; }
  .right { text-align: left; }
}

/* Impression des pages (balance, bulletin, états) */
@media print {
  .sidebar, .topbar .burger, .barre-outils, .no-print, .filtres, #toast-zone, .piece-side .btn, form button { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  .piece-layout { grid-template-columns: 1fr; }
  body { background: #fff; }
}

/* Création d'entreprise par l'élève */
.creation-box { width: min(680px, 100%); margin: 2rem 0; }
.creation-box h2 { margin: .6rem 0 .2rem; }
.etape-titre { margin: .8rem 0 0; padding-top: .8rem; border-top: 1px solid var(--line); font-size: 1rem; color: var(--accent-dark); }
.modeles { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.modeles .evt-type span b { font-size: .92rem; }
@media (max-width: 600px) { .modeles { grid-template-columns: 1fr; } }
.creation-box form.form-grid { display: grid; }
.evt-type > span .muted { display: block; margin-top: .2rem; }
.bul-infos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .4rem 1rem; background: #f4f6fa; border-radius: 8px; padding: .7rem .9rem; margin-bottom: 1rem; }
.bul-infos b { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); }
.bul-infos .bul-conv { grid-column: span 2; }
@media (max-width: 800px) { .bul-infos { grid-template-columns: 1fr 1fr; } }
.zone-danger { border: 1px solid #f6c9cb; }
.zone-danger h2 { color: var(--red); }
.restaurer-creation { display: flex !important; flex-direction: row !important; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: 1.2rem; padding-top: 1rem; border-top: 1px dashed var(--line); }
.restaurer-creation input[type=file] { flex: 1 1 200px; width: auto; }

/* Licences */
.cadenas { margin-left: auto; font-size: .75rem; opacity: .7; }
.side-plan { margin-top: .45rem; display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; font-size: .75rem; }
.verrou { text-align: center; max-width: 620px; margin: 2rem auto; padding: 2.2rem; }
.verrou-ico { font-size: 3rem; margin-bottom: .4rem; }
.verrou p { margin: .6rem 0 1.2rem; }
.offres { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.1rem; }
.offre { display: flex; flex-direction: column; gap: .6rem; position: relative; margin: 0; }
.offre.actuelle { outline: 3px solid var(--blue); }
.offre .prix { font-size: 2.2rem; font-weight: 800; letter-spacing: -1px; }
.offre .prix small { font-size: .9rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.offre ul { padding-left: 1.1rem; margin: 0; flex: 1; }
.offre li { margin-bottom: .35rem; font-size: .9rem; }
.offre .ruban { position: absolute; top: -10px; right: 12px; background: var(--blue); color: #fff; font-size: .72rem; font-weight: 700; padding: 2px 10px; border-radius: 99px; }
.admin-filtres { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.code-etab { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 800; letter-spacing: 1px; background: #eef3ff; color: var(--blue); padding: 2px 8px; border-radius: 6px; }
@media (max-width: 1000px) { .offres { grid-template-columns: 1fr; } }
.etab-edit summary { list-style: none; cursor: pointer; }
.etab-edit summary::-webkit-details-marker { display: none; }
.etab-edit[open] { background: #fafbfd; padding: .5rem; border-radius: 10px; }

/* Sélecteur de langue */
.lang-switch { display: inline-flex; gap: 4px; margin-left: auto; padding: 3px; border-radius: 8px; background: rgba(0,0,0,.04); }
.lang-switch a { display: flex; padding: 3px; border-radius: 5px; opacity: .45; transition: opacity .15s, background .15s; line-height: 0; }
.lang-switch a:hover { opacity: .9; }
.lang-switch a.actif { opacity: 1; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.lang-switch svg { border-radius: 2px; display: block; }
.login-box { position: relative; }
.lang-switch.lang-coin { position: absolute; top: 12px; right: 12px; }
@media print { .lang-switch { display: none !important; } }

/* Bulletin : le tableau des cotisations ne déborde plus de la carte */
.card.bulletin { overflow-x: auto; }
.table.bul th, .table.bul td { padding-left: .5rem; padding-right: .5rem; }
.table.bul th { white-space: normal; }

/* Liste déroulante dans un libellé (ex. « Période » en TVA) : ne s'étire plus en hauteur */
.filtres label { flex: 0 1 auto; }
.filtres label select, .filtres label input { flex: none; }
