:root {
  /* Charte MB Agrolux : vert (MB), bleu marine (AGRO), orange (LUX) */
  --blue: #0a3a8c; --blue-d: #072b68; --blue-l: #e8eefa; --blue-m: #9db8ea;
  --green: #2e8b1f; --green-d: #1f6a14; --green-l: #eaf5e5; --green-m: #6cb33f;
  --orange: #f7690a; --orange-d: #d4540a; --orange-l: #fff1e4;
  --bg: #f4f7fb; --card: #fff; --line: #dde4ef; --text: #14233f; --muted: #62708a;
  --red: #b3261e; --red-l: #fdecea; --amber: #a65200; --amber-l: #fff1dc;
  --side: #082a63; --side-t: #cfdcf5;
  --brand-bar: linear-gradient(90deg, var(--green) 0 34%, var(--blue) 34% 68%, var(--orange) 68% 100%);
  --radius: 10px;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); 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.15rem; margin-bottom: .8rem; }
h3 { font-size: 1rem; margin-bottom: .6rem; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mt { margin-top: 1rem; }
.mb { margin-bottom: 1rem; }
.small { font-size: .86rem; }

/* ---------- structure */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 244px; background: linear-gradient(180deg, #0a3487 0%, #082a63 55%, #061f4b 100%); color: var(--side-t); flex-shrink: 0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { padding: 1rem 1rem .85rem; position: relative; }
.brand::after { content: ""; position: absolute; left: 1rem; right: 1rem; bottom: 0; height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--green-m) 0 34%, #5b97f0 34% 68%, var(--orange) 68% 100%); }
.brand a.brand-plate { display: block; background: #fff; border-radius: 12px; padding: .55rem .7rem; box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.brand a.brand-plate:hover { text-decoration: none; }
.brand img { display: block; width: auto; max-width: 100%; height: auto; max-height: 124px; margin: 0 auto; }
.brand small { display: block; font-weight: 600; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: #9fb7e6; margin: .6rem .15rem .55rem; }
.nav { padding: .4rem 0 1rem; flex: 1; }
.nav h4 { margin: 1rem 1.1rem .3rem; font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: #8fd36b; font-weight: 700; }
.nav a, .nav span.soon { display: block; padding: .46rem 1.1rem; color: var(--side-t); border-left: 3px solid transparent; font-size: .93rem; }
.nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; color: #fff; }
.nav a.active { background: rgba(255,255,255,.13); border-left-color: var(--orange); color: #fff; font-weight: 600; }
.nav span.soon { color: #7f96c4; cursor: default; }
.nav span.soon em { font-style: normal; font-size: .65rem; background: rgba(255,255,255,.10); border-radius: 8px; padding: 1px 6px; margin-left: 6px; }
.userbox { padding: .8rem 1.1rem; border-top: 1px solid rgba(255,255,255,.12); font-size: .85rem; }
.userbox strong { display: block; color: #fff; }
.userbox form { display: inline; }
.userbox .muted { color: #9fb7e6; }
.userbox button, .userbox a { background: none; border: 0; padding: 0; color: #ffb27a; cursor: pointer; font: inherit; font-size: .85rem; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: .8rem; padding: .9rem 1.5rem; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--brand-bar); }
.topbar h1 { font-size: 1.3rem; flex: 1; color: var(--blue-d); }
.topbar .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
#menu-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; font-size: 1.2rem; padding: .2rem .6rem; cursor: pointer; color: var(--blue-d); }
.content { padding: 1.3rem 1.5rem 3rem; max-width: 1280px; width: 100%; }

/* ---------- composants */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin-bottom: 1.1rem; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--blue); border-radius: var(--radius); padding: .9rem 1.1rem; }
.stat .label { color: var(--muted); font-size: .82rem; }
.stat .value { font-size: 1.45rem; font-weight: 700; margin-top: .15rem; }
.stat .value { color: var(--blue-d); }
.stat.warn { border-top-color: var(--orange); }
.stat.warn .value { color: var(--orange-d); }
.stat.bad { border-top-color: var(--red); }
.stat.bad .value { color: var(--red); }
.stat.good { border-top-color: var(--green); }
.stat.good .value { color: var(--green-d); }

.btn { display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 8px; padding: .5rem .95rem; font: inherit; font-size: .93rem; cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn:hover { background: #eef2f9; text-decoration: none; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--blue-d); }
.btn-accent { background: var(--orange); border-color: var(--orange); color: #fff; font-weight: 600; }
.btn-accent:hover { background: var(--orange-d); }
.btn-danger { background: #fff; border-color: #e5b5b1; color: var(--red); }
.btn-danger:hover { background: var(--red-l); }

/* menu « Exporter » (Excel, PDF client, PDF comptable) */
.export-menu { position: relative; display: inline-block; }
.export-menu > summary { list-style: none; cursor: pointer; user-select: none; }
.export-menu > summary::-webkit-details-marker { display: none; }
.export-menu > summary::after { content: " \25BE"; font-size: .8em; }
.export-menu[open] > summary { background: #eef2f9; }
.export-pop { position: absolute; right: 0; top: calc(100% + 5px); z-index: 60; min-width: 270px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 28px rgba(8,42,99,.2); padding: .35rem; display: flex; flex-direction: column; }
.export-pop a { display: block; padding: .5rem .7rem; border-radius: 7px; color: var(--text); text-decoration: none; line-height: 1.3; }
.export-pop a:hover { background: var(--blue-l); text-decoration: none; }
.export-pop a small { display: block; color: var(--muted); font-size: .76rem; font-weight: 400; }
@media (max-width: 640px) { .export-pop { position: fixed; left: 10px; right: 10px; top: auto; min-width: 0; margin-top: 5px; } }
.btn-sm { padding: .28rem .6rem; font-size: .84rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; }

.alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.alert-success { background: var(--green-l); border-color: #bfdfb4; color: #174d0f; }
.alert-error { background: var(--red-l); border-color: #f0c1bd; color: #7a1812; }
.alert-info { background: var(--blue-l); border-color: #bccbea; color: #0a2f6e; }
.alert-warn { background: var(--amber-l); border-color: #f3cf9f; color: #6b3500; }

.badge { display: inline-block; padding: .12rem .55rem; border-radius: 10px; font-size: .76rem; font-weight: 600; white-space: nowrap; }
.badge-green { background: var(--green-l); color: #174d0f; }
.badge-red { background: var(--red-l); color: #7a1812; }
.badge-orange { background: #ffdcc2; color: #7d2a00; }
.badge-amber { background: var(--orange-l); color: #8a3d00; }
.badge-gray { background: #eceff5; color: #46536b; }
.badge-blue { background: var(--blue-l); color: #0a2f6e; }

table.table { width: 100%; border-collapse: collapse; background: var(--card); }
.table th, .table td { padding: .55rem .7rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #f5f8fd; white-space: nowrap; }
.table td.num, .table th.num { text-align: right; white-space: nowrap; }
.table tr:hover td { background: #f9fbfe; }
.table tr.inactive td { color: #9aa5ba; }
.table tfoot td { font-weight: 700; background: #f5f8fd; }
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; margin-bottom: 1rem; }
.table-wrap .table th:first-child, .table-wrap .table td:first-child { padding-left: 1rem; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-bottom: 1rem; }
.filters .field { margin: 0; }
.field { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .9rem; }
.field label { font-size: .84rem; font-weight: 600; color: #2c3c5c; }
.field .hint { font-size: .78rem; color: var(--muted); }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], input[type=url], input[type=email], input[type=tel], select, textarea {
  font: inherit; padding: .5rem .65rem; border: 1px solid #c4cfe2; border-radius: 8px; background: #fff; color: var(--text); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue-m); border-color: var(--blue); }
input[type=checkbox], input[type=radio] { width: auto; margin-right: .4rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.2rem; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: .6rem; margin-top: .6rem; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: .3rem; font-weight: 400 !important; }

.pager { display: flex; gap: .3rem; flex-wrap: wrap; margin: 1rem 0; align-items: center; }
.pager a, .pager span { padding: .3rem .65rem; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: .88rem; }
.pager a.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.pager span { color: var(--muted); border-color: transparent; background: none; }

.kv { display: grid; grid-template-columns: fit-content(45%) minmax(0, 1fr); gap: .35rem 1.2rem; }
.kv dt { color: var(--muted); font-size: .86rem; }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.totals { margin-left: auto; width: 320px; max-width: 100%; }
.totals .row { display: flex; justify-content: space-between; padding: .3rem 0; }
.totals .row.big { font-size: 1.15rem; font-weight: 700; border-top: 2px solid var(--text); margin-top: .3rem; padding-top: .5rem; }

/* choix du retour (question caisse) */
.choice { display: block; border: 2px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; margin-bottom: .7rem; cursor: pointer; background: #fff; }
.choice:hover { border-color: var(--blue-m); }
.choice.is-on { border-color: var(--blue); background: var(--blue-l); }
.choice.is-off { opacity: .55; cursor: not-allowed; }
.choice strong { display: block; margin-bottom: .15rem; }
.choice .sub { display: block; color: var(--muted); font-size: .88rem; margin-left: 1.6rem; }
.choice select { margin-top: .5rem; margin-left: 1.6rem; width: calc(100% - 1.6rem); }

/* formulaire BL */
.lines-table input, .lines-table select { padding: .35rem .45rem; }
.lines-table td { padding: .35rem .4rem; }
.lines-table .rm { background: none; border: 0; color: var(--red); font-size: 1.2rem; cursor: pointer; }

.foot-brand { margin-top: 2rem; padding: 1rem 0 0; text-align: center; font-size: .78rem; color: var(--muted); position: relative; }
.foot-brand::before { content: ""; display: block; height: 3px; width: 120px; margin: 0 auto .7rem; border-radius: 3px; background: var(--brand-bar); }

/* identité : devise tricolore (comme sur le logo) */
.tag { font-weight: 700; letter-spacing: .02em; }
.tag .g { color: var(--green); } .tag .b { color: var(--blue); } .tag .o { color: var(--orange); }
.tag-ar { font-weight: 700; direction: rtl; unicode-bidi: isolate; }
.tag-ar .g { color: var(--green); } .tag-ar .b { color: var(--blue); } .tag-ar .o { color: var(--orange); }

/* connexion */
.auth-body { min-height: 100vh; background: #fff; }
.auth-split { display: flex; min-height: 100vh; }
.auth-visual { flex: 1.1; position: relative; background: #eaf2fb url("img/login-bg.jpg") right bottom / cover no-repeat; padding: 2.4rem 2.6rem; display: flex; flex-direction: column; }
.auth-visual .tagline { max-width: 460px; }
.auth-visual .tagline .fr { font-size: 1.35rem; line-height: 1.35; }
.auth-visual .tagline .ar { font-size: 1.3rem; margin-top: .5rem; }
.auth-visual .tagline .line { height: 3px; width: 170px; border-radius: 3px; background: var(--brand-bar); margin: 1rem 0 0; }
.auth-main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4.5rem 1.2rem 2rem; position: relative; overflow: hidden; background: #fff url("img/swoosh.svg") right top / min(440px, 85%) no-repeat; }
.auth-card { width: 100%; max-width: 400px; position: relative; }
.auth-card .auth-logo { display: block; width: auto; max-width: 100%; height: auto; max-height: 190px; margin: 0 auto 1.4rem; }
.auth-card h1 { font-size: 1.5rem; margin-bottom: .2rem; color: var(--blue-d); }
.auth-card h1 .ar { font-weight: 600; font-size: 1.1rem; color: var(--muted); margin-left: .5rem; }
.auth-card .sub { color: var(--muted); margin: 0 0 1.3rem; }
.auth-card .btn { width: 100%; padding: .72rem; font-size: 1rem; }
.auth-card form { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1.4rem 1.3rem 1.3rem; box-shadow: 0 10px 30px rgba(10,58,140,.08); border-top: 3px solid var(--blue); }
.auth-services { width: 100%; max-width: 520px; height: auto; margin: 2rem auto 0; display: block; opacity: .95; }

@media (max-width: 1000px) {
  .auth-visual { display: none; }
}
@media (max-width: 960px) {
  .grid-4, .grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  #menu-toggle { display: inline-block; }
  .sidebar { position: fixed; left: -270px; z-index: 20; transition: left .2s; height: 100%; }
  .sidebar.open { left: 0; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .content { padding: 1rem; }
  .topbar { padding: .7rem 1rem; flex-wrap: wrap; row-gap: .45rem; }
  .topbar h1 { font-size: 1.15rem; min-width: 0; overflow-wrap: anywhere; }
  .topbar .actions { flex: 0 1 auto; min-width: 0; }
  .grid-2, .grid-3, .grid-4, .grid-5, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .totals { width: 100%; }
}

.lines-table input.num, .lines-table td.num { text-align: right; }

/* menu repliable (façon Amevo) */
.nav details.nav-group { border-top: 1px solid rgba(255,255,255,.07); }
.nav details.nav-group > summary { list-style: none; cursor: pointer; padding: .55rem 1.1rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: #8fd36b; font-weight: 700; display: flex; justify-content: space-between; align-items: center; user-select: none; }
.nav details.nav-group > summary::-webkit-details-marker { display: none; }
.nav details.nav-group > summary::after { content: '▸'; font-size: .8rem; color: #7f96c4; transition: transform .15s; }
.nav details.nav-group[open] > summary::after { transform: rotate(90deg); }
.nav details.nav-group > summary:hover { background: rgba(255,255,255,.06); }
.nav details.nav-group.has-active > summary { color: #fff; }
.nav details.nav-group > a, .nav details.nav-group > span.soon { padding-left: 1.6rem; }
.nav details.nav-group > a, .nav details.nav-group > span.soon { padding-top: .36rem; padding-bottom: .36rem; font-size: .9rem; }
.userbox { position: sticky; bottom: 0; background: #061f4b; }
.table td:first-child strong { white-space: nowrap; }

/* ---------- onglets, calendrier, puces d'échéance, notes (blocs Gestion) */
.tabs { display: flex; gap: .3rem; margin-bottom: 1rem; border-bottom: 2px solid var(--line); }
.tabs a { padding: .5rem 1rem; border-radius: 8px 8px 0 0; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs a:hover { background: var(--blue-l); text-decoration: none; }
.tabs a.active { color: var(--blue); border-bottom-color: var(--orange); background: #fff; }
a.stat-link { color: inherit; display: block; }
a.stat-link:hover { text-decoration: none; filter: brightness(.97); }
.cal-head { display: flex; align-items: center; flex-wrap: wrap; gap: .8rem; margin-bottom: .8rem; }
.cal-head h2 { margin: 0; text-transform: capitalize; min-width: 11rem; text-align: center; }
table.cal { width: 100%; border-collapse: collapse; table-layout: fixed; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal th { background: var(--blue-l); color: var(--blue-d); font-size: .78rem; text-transform: uppercase; padding: .4rem; border: 1px solid var(--line); }
.cal td { border: 1px solid var(--line); vertical-align: top; height: 7.2rem; padding: .25rem .3rem; position: relative; }
.cal td.out { background: #f7f9fc; }
.cal td.out .dn { color: #a6b0c3; }
.cal td.today { background: var(--orange-l); }
.cal .dn { display: flex; justify-content: space-between; font-size: .8rem; font-weight: 600; color: var(--muted); }
.cal .dn a.add { visibility: hidden; font-weight: 700; padding: 0 .3rem; }
.cal td:hover .dn a.add { visibility: visible; }
.chip { display: block; font-size: .72rem; line-height: 1.25; padding: .08rem .35rem; margin-top: .15rem; border-radius: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-left: 3px solid; color: var(--text); background: #eef3fc; }
.chip:hover { text-decoration: none; filter: brightness(.96); }
.chip-blue { border-color: var(--blue); background: var(--blue-l); }
.chip-red { border-color: var(--red); background: var(--red-l); }
.chip-green { border-color: var(--green); background: var(--green-l); }
.chip-amber { border-color: var(--orange); background: var(--orange-l); }
.chip-orange { border-color: var(--orange-d); background: #ffdcc2; }
.chip-navy { border-color: var(--blue-d); background: #dfe6f5; }
.chip.done { text-decoration: line-through; opacity: .6; }
.legend { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; font-size: .8rem; color: var(--muted); margin: .7rem 0; }
.legend i { display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; vertical-align: -1px; margin-right: .3rem; border-left: 3px solid; }
.agenda-list { list-style: none; margin: 0; padding: 0; }
.agenda-list li { display: flex; gap: .8rem; padding: .5rem 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.agenda-list .when { min-width: 6.4rem; font-weight: 600; color: var(--blue-d); }
.agenda-list .when small { display: block; color: var(--muted); font-weight: 400; }
.meter { height: .55rem; background: #e6ecf6; border-radius: 6px; overflow: hidden; margin-top: .3rem; }
.meter > span { display: block; height: 100%; background: var(--green); }
.meter.over > span { background: var(--red); }
.note { border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 8px; padding: .6rem .8rem; margin-bottom: .6rem; background: #fff; }
.note .who { font-size: .8rem; color: var(--muted); display: flex; justify-content: space-between; gap: .5rem; margin-bottom: .2rem; }
.note.system { border-left-color: var(--orange); background: #fffaf3; }
.note p { margin: 0; white-space: pre-wrap; word-wrap: break-word; }
.members { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem .8rem; }
.members .m { display: flex; gap: .5rem; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: .35rem .6rem; }
.members .m input[type=text] { flex: 1; min-width: 0; }
@media (max-width: 760px) { .cal td { height: 5rem; } .chip { font-size: .66rem; } .members { grid-template-columns: 1fr; } }

/* ---------- comptabilité */
.acc-table .entry-head td { background: #f3f7fd; font-weight: 600; border-top: 2px solid var(--line); }
.acc-table tbody.entry tr.entry-line td { padding-top: .3rem; padding-bottom: .3rem; border-bottom: 1px dashed #e9eef6; }
.acc { font-family: Consolas, "Courier New", monospace; white-space: nowrap; }
.bad { color: var(--red); font-weight: 700; }

/* ---------- bouton de langue (Français / العربية) */
.lang-btn { display: inline-block; border: 1px solid var(--blue-m); background: var(--blue-l); color: var(--blue-d); border-radius: 20px; padding: .3rem .85rem; font-weight: 600; font-size: .88rem; white-space: nowrap; }
.lang-btn:hover { background: var(--blue-m); color: #fff; text-decoration: none; }
.lang-float { position: fixed; top: .9rem; right: 1rem; z-index: 30; box-shadow: 0 2px 8px rgba(10,58,140,.15); }
html[dir=rtl] .lang-float { right: auto; left: 1rem; }

/* ---------- sociétés (v5) */
.co-dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; background: var(--co, var(--blue)); flex-shrink: 0; }
.co-switch { margin: .7rem 1rem .2rem; border-radius: 10px; background: rgba(255,255,255,.09); border-left: 4px solid var(--co, var(--orange)); }
.co-switch summary { list-style: none; display: flex; align-items: center; gap: .5rem; padding: .55rem .7rem; cursor: pointer; color: #fff; font-weight: 600; }
.co-switch summary::-webkit-details-marker { display: none; }
.co-switch summary .co-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.co-switch summary small { font-weight: 400; font-size: .7rem; color: #9fb7e6; }
.co-switch .co-dot { background: var(--co); box-shadow: 0 0 0 2px rgba(255,255,255,.35); }
.co-switch details a { display: flex; align-items: center; gap: .5rem; padding: .42rem .7rem; border-left: 0; color: var(--side-t); font-size: .9rem; }
.co-switch details a.all { color: #ffb27a; font-size: .8rem; }
.co-switch details a:hover { background: rgba(255,255,255,.08); }
.nav-heading { margin: 1.1rem 1.1rem .2rem; padding-top: .7rem; border-top: 1px solid rgba(255,255,255,.12); font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: #8fa6d4; font-weight: 700; }
.co-banner { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; padding: .55rem .9rem; margin-bottom: 1rem; border: 1px solid var(--line, #d7dee9); border-inline-start: 5px solid var(--co, var(--blue)); border-radius: 8px; background: #fff; }
.co-banner .co-banner-others a { display: inline-block; margin-inline-start: .35rem; padding: .1rem .6rem; border-radius: 999px; border: 1px solid var(--co, var(--blue)); color: var(--co, var(--blue)); text-decoration: none; font-weight: 600; }
.co-banner .co-banner-others a:hover { background: var(--co, var(--blue)); color: #fff; }
.co-tag { display: inline-flex; align-items: center; gap: .4rem; padding: .15rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; color: #fff; background: var(--co, var(--blue)); }
.co-pill { display: inline-block; padding: 0 .5rem; border-radius: 999px; font-size: .74rem; font-weight: 600; color: var(--co, var(--blue)); border: 1px solid var(--co, var(--blue)); background: #fff; line-height: 1.5; }
.company-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.company-card { display: flex; flex-direction: column; gap: .35rem; background: var(--card); border: 1px solid var(--line); border-top: 5px solid var(--co, var(--blue)); border-radius: var(--radius); padding: 1.1rem 1.2rem; color: inherit; transition: box-shadow .15s, transform .15s; }
.company-card:hover { text-decoration: none; box-shadow: 0 8px 22px rgba(10,58,140,.12); transform: translateY(-2px); }
.company-card.is-off { opacity: .6; }
.company-card .co-head { display: flex; align-items: center; gap: .5rem; font-size: 1.15rem; color: var(--blue-d); }
.company-card .co-head .co-dot { background: var(--co); width: .9rem; height: .9rem; }
.co-figs { list-style: none; margin: .4rem 0; padding: 0; display: grid; gap: .25rem; font-size: .92rem; }
.co-figs li span { display: inline-block; min-width: 1.8rem; font-weight: 700; font-size: 1.1rem; color: var(--blue-d); }
.co-figs li.bad span { color: var(--red); }
.co-figs li.warn span { color: var(--orange-d); }
.co-go { margin-top: auto; padding-top: .6rem; font-weight: 600; color: var(--co, var(--blue)); }
.pillars .pillar { border-top: 4px solid var(--co, var(--blue)); }
.pillar-figs { display: flex; gap: .6rem; margin: .5rem 0 .8rem; flex-wrap: wrap; }
.pillar-figs a { display: flex; flex-direction: column; align-items: center; min-width: 4.6rem; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 10px; color: inherit; }
.pillar-figs a:hover { text-decoration: none; border-color: var(--blue-m); background: var(--blue-l); }
.pillar-figs strong { font-size: 1.4rem; color: var(--blue-d); line-height: 1.1; }
.pillar-figs span { font-size: .72rem; color: var(--muted); }
.pillar-figs a.bad strong { color: var(--red); }
.pillar-figs a.warn strong { color: var(--orange-d); }
.pillar-figs a.good strong { color: var(--green-d); }

/* ---------- grille des droits */
.access-grid th.co-col { border-top: 4px solid var(--co); text-align: left; }
.access-grid td.co-col { vertical-align: top; min-width: 11rem; }
.access-grid tr.pillar-row td { background: var(--blue-l); color: var(--blue-d); font-weight: 700; text-transform: uppercase; font-size: .76rem; letter-spacing: .08em; }
.access-grid tr.is-soon td { opacity: .55; }
.access-grid select.lvl { width: 100%; }
.access-grid select.lvl-0 { color: var(--muted); }
.access-grid select.lvl-1 { background: var(--blue-l); }
.access-grid select.lvl-2 { background: var(--green-l); }
.access-grid select.lvl-3 { background: var(--orange-l); font-weight: 600; }
.access-grid label.check { display: flex; gap: .35rem; align-items: center; margin-top: .3rem; }

@media (max-width: 900px) {
  .company-cards { grid-template-columns: minmax(0, 1fr); }
}

/* administratif : alertes graduées, listes de contrôle */
.level-bar { display: flex; flex-wrap: wrap; gap: .5rem; margin: .4rem 0 1rem; }
.check-list { list-style: none; margin: 0; padding: 0; }
.check-list li { display: flex; gap: .7rem; align-items: center; justify-content: space-between; padding: .6rem .2rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.check-list li .what { flex: 1 1 18rem; min-width: 0; }
.check-list li.is-na { opacity: .6; }
.todo-table td form.inline { display: inline; }
.day-pick { display: flex; flex-wrap: wrap; gap: .35rem .9rem; }
.day-pick label { display: inline-flex; align-items: center; gap: .3rem; font-size: .9rem; }

/* Administratif : choix des mois, modèles d'obligations */
.month-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .3rem .8rem; }
.tpl-list { display: flex; flex-direction: column; gap: .2rem; }
.tpl-item { align-items: flex-start !important; padding: .55rem .2rem; border-bottom: 1px solid var(--line); }
.tpl-item input { margin-top: .25rem; }
@media (max-width: 760px) { .month-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.btn-row { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 0; }
@media (max-width: 760px) {
  .todo-index th:nth-child(4), .todo-index td:nth-child(4), .todo-index th:nth-child(5), .todo-index td:nth-child(5) { display: none; }
  .todo-index th, .todo-index td { padding-left: .4rem; padding-right: .4rem; }
  .todo-index th { white-space: normal; font-size: .7rem; letter-spacing: 0; }
  .table-wrap .todo-index th:first-child, .table-wrap .todo-index td:first-child { padding-left: .6rem; }
  .todo-index { font-size: .84rem; }
  .todo-index td:nth-child(1) { white-space: normal; font-size: .78rem; }
  .todo-index td:nth-child(3) .badge { font-size: .7rem; padding-left: .4rem; padding-right: .4rem; }
  .todo-index td:nth-child(2) { min-width: 5.5rem; }
  .todo-index td:nth-child(3) { white-space: normal; min-width: 4.5rem; }
  .todo-index .btn-sm { padding-left: .5rem; padding-right: .5rem; }
}

/* ---------- Projets par étapes */
.kind-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.kind-card { display: flex; flex-direction: column; gap: .45rem; border: 1px solid var(--line); border-top: 4px solid var(--blue); border-radius: var(--radius); background: #fff; padding: 1rem 1.1rem; color: inherit; }
.kind-card:hover { text-decoration: none; border-color: var(--blue-m); background: var(--blue-l); }
.kind-card h3 { margin: 0; }
.kind-card.k-irrigation { border-top-color: var(--green); }
.kind-card.k-solaire { border-top-color: var(--orange); }
.kind-card .phases { margin: 0; padding-inline-start: 1.1rem; font-size: .84rem; color: var(--muted); }
.kind-card .go { margin-top: auto; font-weight: 600; color: var(--blue); }
.type-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.type-tabs a { padding: .3rem .85rem; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--text); font-size: .86rem; }
.type-tabs a:hover { text-decoration: none; border-color: var(--blue-m); }
.type-tabs a.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.cj-table td.cj-x.is-off { opacity: .35; }
.cj-table select.cj-acc { min-width: 12rem; }
.type-tabs a .tab-bal { margin-inline-start: .35rem; font-size: .74rem; opacity: .75; font-weight: 400; }
.new-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.pchip { display: inline-block; background: #eef2f9; border-radius: 8px; padding: .05rem .5rem; font-size: .76rem; color: #46536b; white-space: nowrap; }
.pchip.warn { background: var(--amber-l); color: var(--amber); font-weight: 600; }
.pchip.bad { background: var(--red-l); color: #7a1812; font-weight: 600; }

.phase-title { font-weight: 700; color: var(--blue-d); margin: 1.1rem 0 .45rem; display: flex; justify-content: space-between; gap: .5rem; border-bottom: 2px solid var(--line); padding-bottom: .25rem; }
.stage { display: flex; gap: .8rem; align-items: flex-start; padding: .65rem .75rem; border: 1px solid var(--line); border-inline-start: 5px solid #c4cde0; border-radius: 8px; background: #fff; margin-bottom: .45rem; }
.stage.st-en_cours { border-inline-start-color: var(--blue); }
.stage.st-termine { border-inline-start-color: var(--green); background: #f7fbf5; }
.stage.st-bloque { border-inline-start-color: var(--red); background: var(--red-l); }
.stage.st-sans_objet { opacity: .6; }
.stage .st-num { flex: 0 0 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--blue-l); color: var(--blue-d); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .82rem; }
.stage.st-termine .st-num { background: var(--green-l); color: var(--green-d); }
.stage .st-main { flex: 1; min-width: 0; }
.stage .st-name { font-weight: 600; }
.stage .st-meta { display: flex; flex-wrap: wrap; gap: .25rem .6rem; font-size: .82rem; color: var(--muted); margin-top: .25rem; align-items: center; }
.stage .st-block { margin-top: .35rem; font-size: .86rem; color: var(--red); font-weight: 600; }
.stage .st-actions { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: flex-end; }
.stage .meter { max-width: 14rem; }
.progress-big { height: .8rem; background: #e6ecf6; border-radius: 8px; overflow: hidden; margin: .3rem 0 .2rem; }
.progress-big > span { display: block; height: 100%; background: var(--green); }
.progress-line { display: flex; justify-content: space-between; gap: .5rem; font-size: .86rem; }

.round { border: 1px solid var(--line); border-radius: 10px; background: #fff; margin-bottom: .9rem; overflow: hidden; }
.round-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; background: #f5f8fd; padding: .5rem .85rem; font-weight: 700; }
.round-body { padding: .7rem .85rem; }
.round-obs, .round-ans { border-inline-start: 4px solid var(--orange); padding-inline-start: .75rem; margin-bottom: .7rem; }
.round-ans { border-inline-start-color: var(--green); }
.round-obs p, .round-ans p { margin: .2rem 0 0; white-space: pre-wrap; word-wrap: break-word; }
.round h4 { margin: 0; font-size: .86rem; color: var(--muted); font-weight: 600; }

.thread { border: 1px solid var(--line); border-radius: 10px; background: #fff; margin-bottom: .85rem; overflow: hidden; }
.post { padding: .65rem .85rem; }
.post + .post { border-top: 1px solid var(--line); }
.post.reply { margin-inline-start: 1.4rem; border-inline-start: 3px solid var(--blue-m); background: #fafcff; }
.post .who { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.post .who strong { color: var(--text); }
.post p { margin: .3rem 0 0; white-space: pre-wrap; word-wrap: break-word; }
.post .acts { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .4rem; align-items: flex-start; }
.post details { flex: 1 1 100%; }
.post details summary { cursor: pointer; display: inline-block; font-size: .82rem; color: var(--blue); font-weight: 600; }
.post details textarea { width: 100%; margin: .4rem 0; }

.link-list { list-style: none; margin: 0 0 .6rem; padding: 0; }
.link-list li { display: flex; justify-content: space-between; gap: .6rem; align-items: center; padding: .4rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.link-list a { word-break: break-all; }
.add-inline { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) auto; gap: .5rem; align-items: end; }
.add-inline .field { margin-bottom: 0; }

.stage-editor td { vertical-align: middle; }
.stage-editor input[type=text], .stage-editor select { width: 100%; min-width: 7rem; }
.stage-editor .ops { white-space: nowrap; }
.stage-editor .ops .btn { padding: .2rem .55rem; }

@media (max-width: 900px) {
  .kind-cards { grid-template-columns: minmax(0, 1fr); }
  .add-inline { grid-template-columns: minmax(0, 1fr); }
  .stage { flex-wrap: wrap; }
  .stage .st-actions { flex: 1 1 100%; justify-content: flex-start; }
}
.stage-editor td:nth-child(2) { width: 20%; }
.stage-editor td:nth-child(3) { width: 36%; }
/* éditeur d'étapes sur téléphone : une carte par étape, au lieu d'un tableau à faire défiler */
@media (max-width: 640px) {
  .stage-editor, .stage-editor tbody, .stage-editor tr, .stage-editor td { display: block; width: 100% !important; }
  .stage-editor thead { display: none; }
  .stage-editor tr { padding: .6rem .8rem; border-bottom: 1px solid var(--line); }
  .stage-editor td { padding: .15rem 0 !important; border: 0 !important; }
  .stage-editor td:first-child { font-weight: 700; color: var(--muted); }
  .stage-editor input[type=text], .stage-editor select { min-width: 0; }
  .stage-editor .ops { display: flex; gap: .4rem; flex-wrap: wrap; padding-top: .35rem !important; }
}

/* ---------- Comptabilité par tiers (5.3) */
[hidden] { display: none !important; }
.tiers-list tr.inactive td, .tiers-moves tr.inactive td { color: var(--muted); }
.tiers-moves tr.cancelled td { background: #faf6f6; }
.tiers-moves td { vertical-align: top; }
.acts-cell { min-width: 8.5rem; max-width: 13rem; }
.acts-cell form.inline, .acts-cell .btn, .acts-cell details { display: inline-block; margin: 0 .15rem .2rem 0; vertical-align: top; }
.cancel-box > summary { list-style: none; cursor: pointer; }
.cancel-box > summary::-webkit-details-marker { display: none; }
.cancel-box[open] { display: block; white-space: normal; margin-top: .3rem; }
.cancel-box form { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .3rem; }
.cancel-box input[type=text] { flex: 1 1 12rem; min-width: 0; }
.shared-box { border-left: 4px solid var(--blue-m, #3b6fc7); }
.shared-line { display: flex; flex-wrap: wrap; gap: .3rem .9rem; align-items: center; justify-content: space-between; padding: .55rem 0; border-top: 1px solid var(--line); }
.shared-line:first-of-type { border-top: 0; }
.shared-line > div:first-child, .shared-line .small { flex: 1 1 18rem; min-width: 0; }
.piece-form .form-grid { align-items: start; }

/* saisie en série */
.batch-table input, .batch-table select { width: 100%; min-width: 0; padding: .4rem .45rem; font-size: .88rem; }
.batch-table td { padding: .25rem .25rem; vertical-align: top; }
.batch-table th { padding: .55rem .25rem; }
.batch-table .b-n { color: var(--muted); text-align: center; width: 1.8rem; }
.batch-table .b-date { min-width: 7.6rem; }
.batch-table .b-tiers { min-width: 10rem; }
.batch-table .b-type { min-width: 8.6rem; }
.batch-table .b-number { min-width: 6.6rem; }
.batch-table .b-amount { min-width: 5.8rem; text-align: right; }
.batch-table .b-ht { min-width: 5.2rem; text-align: right; }
.batch-table .b-label { min-width: 7rem; }
.batch-table .b-pay { min-width: 8.6rem; }
.batch-table .b-pay-in { display: flex; flex-direction: column; gap: .25rem; }
.batch-table tr.b-row.is-filled td.b-n { color: var(--green-d); font-weight: 700; }
.batch-table tfoot td { background: var(--blue-l); font-weight: 600; }
.releve-table td.num, .releve-table th.num { white-space: nowrap; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .6rem; }
.card-head h3 { margin: 0; }
@media (max-width: 760px) {
  .batch-table, .batch-table tbody, .batch-table tr, .batch-table td { display: block; width: 100%; }
  .batch-table thead { display: none; }
  .batch-table tr.b-row { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .7rem; padding: .5rem .6rem; background: #fff; }
  .batch-table td { padding: .2rem 0; border: 0; }
  .batch-table td::before { content: attr(data-label); display: block; font-size: .72rem; color: var(--muted); margin-bottom: .1rem; }
  .batch-table .b-n { text-align: left; font-weight: 700; width: auto; }
  .batch-table .b-n::before { display: none; }
  .batch-table tfoot, .batch-table tfoot tr, .batch-table tfoot td { display: block; width: 100%; }
  .batch-table tfoot td[colspan="2"] { display: none; }
  .tiers-moves { font-size: .86rem; }
  .acts-cell { white-space: normal; min-width: 0; }
  .shared-line { flex-direction: column; align-items: flex-start; }
}

/* Import de fichiers Excel / CSV */
.import-sample td, .import-sample th { white-space: nowrap; max-width: 15rem; overflow: hidden; text-overflow: ellipsis; }
.import-sample tr.import-head th { text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--text); background: #eef2f9; }
.import-stats { max-width: 760px; margin-bottom: 1rem; }
.import-stats .stat .value { font-size: 1.3rem; }

/* téléchargement chiffré d'une sauvegarde */
pre { max-width: 100%; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
pre.codebox { background: #f4f6f5; padding: .6rem .8rem; border-radius: 8px; margin: .5rem 0; }
details.enc-box { display: inline-block; vertical-align: top; text-align: left; }
details.enc-box > summary { list-style: none; cursor: pointer; display: inline-block; }
details.enc-box > summary::-webkit-details-marker { display: none; }
details.enc-box[open] { display: block; margin-top: .5rem; padding: .7rem .8rem; background: #f4f6f5; border: 1px solid var(--line); border-radius: 8px; white-space: normal; min-width: 250px; }

/* 5.9 : vie du compte (clôture, réouverture), raccourcis de période, situation des comptes */
details.close-box { display: inline-block; vertical-align: top; text-align: left; }
details.close-box > summary { list-style: none; cursor: pointer; display: inline-block; }
details.close-box > summary::-webkit-details-marker { display: none; }
details.close-box[open] { display: block; margin-top: .5rem; padding: .7rem .8rem; background: #f4f6f5; border: 1px solid var(--line); border-radius: 8px; white-space: normal; width: 100%; max-width: 640px; }
form.inline-form { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
form.inline-form input[type=text] { flex: 1 1 14rem; min-width: 0; }
.shortcuts a { white-space: nowrap; }
.family-card h3 { margin-top: 0; }
.family-card .figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .6rem; margin: .6rem 0; }
.family-card .figures .stat .value { font-size: 1.05rem; white-space: nowrap; }
.family-card .btn-row { margin-top: .6rem; }
.top-list { list-style: none; margin: .4rem 0 0; padding: 0; }
.top-list li { display: flex; justify-content: space-between; gap: .6rem; padding: .25rem 0; border-bottom: 1px solid var(--line); }
.top-list li:last-child { border-bottom: 0; }
.statement-head { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: flex-start; }
.top-list .sub::before { content: '· '; }
.top-list .sub { margin-inline-start: .25rem; }

/* comptes d'un projet : catalogue (suggestions), lignes d'articles et de services */
.lines-table td.l-name { min-width: 14rem; }
.lines-table .l-unit { width: 5rem; }
.lines-table .l-qty, .lines-table .l-disc { width: 5.5rem; }
.lines-table .l-price { width: 7.5rem; }
.lines-table .l-new { display: inline-block; margin-top: .25rem; font-size: .72rem; }
.suggest { list-style: none; margin: 0; padding: 0; z-index: 60; background: #fff; border: 1px solid var(--blue-m); border-radius: 8px; box-shadow: 0 8px 22px rgba(8, 42, 99, .18); max-height: 16rem; overflow-y: auto; }
.suggest li { padding: .42rem .7rem; cursor: pointer; font-size: .92rem; border-bottom: 1px solid var(--line); }
.suggest li:last-child { border-bottom: 0; }
.suggest li span { color: var(--muted); font-size: .8rem; }
.suggest li:hover, .suggest li.on { background: var(--blue-l); }
.ledger-doc summary { cursor: pointer; }
.ledger-note { background: var(--amber-l); border-left: 4px solid var(--orange); padding: .5rem .8rem; border-radius: 6px; margin: .4rem 0; font-size: .9rem; }

/* ---- 6.2 : pictogrammes du menu latéral ---- */
.nav a, .nav span.soon { display: flex; align-items: center; gap: .6rem; }
.nav .ni { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 1.45rem; height: 1.45rem; border-radius: 7px; background: rgba(255,255,255,.08); color: #8fd36b; transition: background .15s, color .15s, transform .15s; }
.nav .ni svg { width: 1.02rem; height: 1.02rem; display: block; }
.nav a:hover .ni { background: rgba(255,255,255,.18); color: #fff; transform: scale(1.06); }
.nav a.active .ni { background: var(--orange); color: #fff; }
.nav span.soon .ni { color: #7f96c4; background: rgba(255,255,255,.04); }
.nav .nl { flex: 1 1 auto; min-width: 0; line-height: 1.25; }
.nav details.nav-group > summary .sum-label { display: flex; align-items: center; gap: .6rem; }
.nav details.nav-group > summary .ni { background: rgba(143,211,107,.16); color: #8fd36b; width: 1.55rem; height: 1.55rem; }
.nav details.nav-group.has-active > summary .ni { background: var(--orange); color: #fff; }
.nav details.nav-group > a, .nav details.nav-group > span.soon { padding-left: 1.3rem; }

/* suivi des chèques (6.3) */
.cheque-thumb { width: 56px; height: 40px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); background: #fff; display: block; }
.cheque-gallery { display: flex; flex-wrap: wrap; gap: .8rem; }
.cheque-photo { width: 240px; display: flex; flex-direction: column; gap: .35rem; }
.cheque-photo img { width: 100%; max-height: 170px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; background: #fff; display: block; }

/* 6.3 : approbation des saisies */
.approve-users { display: grid; gap: .45rem; margin-top: .4rem; }

/* 6.5 : bons du jour (HT, TVA, TTC), raccourcis de la barre du haut, rubriques de l'accueil */
.bons-table .b-vat, .bons-table .b-ttc { min-width: 5.8rem; text-align: right; }
.bons-table .b-ht { min-width: 5.8rem; text-align: right; }
.bons-table .b-cgnc { min-width: 4.6rem; }
.bons-table input.is-bad { border-color: var(--red); background: #fff5f5; }
.bons-table input[data-auto] { background: var(--blue-l); }
.bons-table .cgnc-all { display: inline-flex; gap: .25rem; margin-left: .3rem; font-weight: 400; }
.bons-import > summary { cursor: pointer; }
.bons-import[open] > summary { margin-bottom: .6rem; }
.bons-import h3 { margin-bottom: .4rem; }
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; }
.filters .field { margin: 0; }

.quick { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.quick a { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 2.3rem; height: 2.3rem; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--blue-d); }
.quick a:hover { background: var(--blue-l); border-color: var(--blue-m); text-decoration: none; }
.quick a.active { background: var(--blue-d); border-color: var(--blue-d); color: #fff; }
.quick a .ni { display: inline-flex; width: 1.2rem; height: 1.2rem; }
.quick a .ni svg { width: 100%; height: 100%; }
.quick a.q-edit { border-style: dashed; color: var(--muted); }
.quick a.q-edit:hover { color: var(--orange-d); border-color: var(--orange-d); }
.sc-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .5rem .9rem; }
.sc-item { display: flex; align-items: center; gap: .45rem; padding: .35rem .5rem; border: 1px solid var(--line); border-radius: 10px; }
.sc-item .ni { display: inline-flex; width: 1.1rem; height: 1.1rem; color: var(--blue-d); }
.sc-item .ni svg { width: 100%; height: 100%; }
.btn .ni { display: inline-flex; width: 1rem; height: 1rem; vertical-align: -.2em; margin-inline-end: .25rem; }
.btn .ni svg { width: 100%; height: 100%; display: block; }
.card > h3 > .ni:first-child { display: inline-flex; width: 1.15rem; height: 1.15rem; vertical-align: -.2em; margin-inline-end: .3rem; color: var(--blue-d); }
.card > h3 > .ni:first-child svg { width: 100%; height: 100%; display: block; }
.rubrics h2 { margin: 0; }
.rubric h3 { display: flex; align-items: center; gap: .4rem; }
.rubric h3 .ni { display: inline-flex; width: 1.15rem; height: 1.15rem; color: var(--co, var(--blue-d)); }
.rubric h3 .ni svg { width: 100%; height: 100%; }
.rubric { border-top: 4px solid var(--co, var(--blue)); }
.tiles { display: grid; gap: .45rem; }
.tile { display: flex; align-items: center; gap: .6rem; padding: .5rem .65rem; border: 1px solid var(--line); border-radius: 10px; color: inherit; }
.tile:hover { text-decoration: none; border-color: var(--blue-m); background: var(--blue-l); }
.tile > .ni { display: inline-flex; flex: none; width: 1.3rem; height: 1.3rem; color: var(--blue-d); }
.tile > .ni svg { width: 100%; height: 100%; }
.tile .t-body { display: flex; flex-direction: column; min-width: 0; }
.tile .t-label { font-weight: 600; }
.tile .t-fig { font-size: .8rem; color: var(--muted); }
.tile .t-sub { font-size: .76rem; color: var(--muted); }
.tile.good .t-fig { color: var(--green-d); }
.tile.warn .t-fig { color: var(--orange-d); font-weight: 600; }
.tile.bad .t-fig { color: var(--red); font-weight: 600; }
.tile.bad { border-color: var(--red); }
@media (max-width: 900px) {
  .quick a { width: 2.1rem; height: 2.1rem; }
  .topbar .quick { order: 5; flex: 1 1 100%; }
}

/* ---- droits projet par projet (6.6) ---- */
.pa-user { margin-bottom: 1rem; }
.pa-user.is-inherited .pa-grid select.pa-lvl { opacity: .6; }
.pa-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: .6rem; }
.pa-state { text-align: end; }
.pa-profile-field { max-width: 34rem; }
.pa-group { margin-top: .8rem; }
.pa-group-title { display: block; font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--blue-d); margin-bottom: .25rem; }
.pa-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; }
.pa-grid .field { margin: 0; }
.pa-grid select.lvl-0 { color: var(--muted); }
.pa-grid select.lvl-1 { background: var(--blue-l); }
.pa-grid select.lvl-2 { background: var(--green-l); }
.pa-grid select.lvl-3 { background: var(--orange-l); font-weight: 600; }
.pa-chip { display: inline-block; padding: .05rem .5rem; margin: .1rem .25rem .1rem 0; border-radius: 999px; background: var(--blue-l); color: #0a2f6e; font-size: .78rem; }
.pa-table td.center, .pa-table th.center { padding-inline: .35rem; }
.pa-lv { display: inline-block; min-width: 3.6rem; padding: .05rem .35rem; border-radius: 5px; font-size: .72rem; color: var(--muted); }
.pa-lv-1 { background: var(--blue-l); color: #0a2f6e; }
.pa-lv-2 { background: var(--green-l); color: #14532d; }
.pa-lv-3 { background: var(--orange-l); color: #8a3d00; font-weight: 600; }
@media (max-width: 760px) { .pa-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pa-others { margin: 1rem 0; }
.pa-others > summary { cursor: pointer; font-weight: 600; color: var(--blue-d); padding: .5rem .2rem; }
.pa-others[open] > summary { margin-bottom: .6rem; }

/* ---- documents et photos des projets, clôture d'un projet (6.9) ---- */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.file-card { margin: 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; display: flex; flex-direction: column; overflow: hidden; }
.file-card > a { display: block; background: #f3f5f8; }
.file-card img { display: block; width: 100%; height: 9rem; object-fit: cover; }
.file-card figcaption { padding: .45rem .55rem .2rem; display: flex; flex-direction: column; gap: .1rem; word-break: break-word; }
.file-card .file-actions { padding: .3rem .55rem .55rem; display: flex; flex-wrap: wrap; gap: .3rem; margin-top: auto; }
.file-docs .file-line { display: flex; gap: .6rem; align-items: flex-start; min-width: 0; flex: 1 1 14rem; }
.file-docs .file-line > span:last-child { min-width: 0; word-break: break-word; }
.file-docs .file-actions { display: flex; flex-wrap: wrap; gap: .3rem; align-items: flex-start; }
.file-ico { flex: none; min-width: 2.6rem; text-align: center; font-size: .68rem; font-weight: 700; letter-spacing: .04em; padding: .25rem .3rem; border-radius: 5px; background: var(--blue-l); color: #0a2f6e; }
.file-edit { display: inline-block; }
.file-edit > summary { list-style: none; cursor: pointer; display: inline-block; }
.file-edit > summary::-webkit-details-marker { display: none; }
.file-edit[open] { display: block; flex-basis: 100%; width: 100%; padding: .5rem; border: 1px solid var(--line); border-radius: 8px; background: #f8fafd; margin-top: .3rem; }
.file-edit-form { display: grid; gap: .4rem; margin: .5rem 0; }
.file-edit-form .field { margin-bottom: 0; }
.file-upload { display: grid; gap: .5rem; max-width: 40rem; padding-top: .8rem; border-top: 1px dashed var(--line); }
.file-upload .field { margin-bottom: 0; }
.file-warn { color: #8a1c1c; font-weight: 600; }
.closure-opt.is-off { opacity: .75; }
.closure-opt h3 { margin-top: 0; }

/* ---- missions et rappels (7.3) */
.lvl-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; margin-bottom: .6rem; }
.lvl-pick label { display: block; cursor: pointer; margin: 0; }
.lvl-pick input { position: absolute; opacity: 0; pointer-events: none; }
.lvl-pick .opt { display: block; border: 2px solid var(--line); border-radius: 12px; padding: .8rem .9rem; background: #fff; min-height: 6.2rem; }
.lvl-pick .opt strong { display: block; font-size: 1.05rem; margin-bottom: .2rem; }
.lvl-pick .opt small { color: var(--muted); font-size: .8rem; line-height: 1.35; display: block; }
.lvl-pick input:checked + .opt { border-color: var(--blue); background: var(--blue-l); box-shadow: 0 0 0 2px var(--blue-m) inset; }
.lvl-pick input:focus-visible + .opt { outline: 2px solid var(--blue); outline-offset: 2px; }
.lvl-pick .opt.tone-red strong { color: var(--red); }
.lvl-pick .opt.tone-amber strong { color: var(--orange-d); }
.quick { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .3rem; }
.people-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem .8rem; }
.people-pick .pp { border: 1px solid var(--line); border-radius: 10px; padding: .45rem .7rem; background: #fff; }
.people-pick .pp.off { background: #fafafa; }
.people-pick .pp label { display: flex; gap: .5rem; align-items: center; margin: 0; cursor: pointer; font-weight: 600; }
.people-pick .pp details { margin-top: .25rem; }
.people-pick .pp details summary { font-size: .78rem; color: var(--muted); cursor: pointer; }
.people-pick .pp details input { margin-top: .25rem; }
.step-n { display: inline-flex; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--blue); color: #fff; align-items: center; justify-content: center; font-size: .85rem; margin-inline-end: .4rem; }
.setup-list { list-style: none; padding: 0; margin: 0; }
.setup-list li { display: flex; gap: .6rem; padding: .5rem 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.setup-list li:last-child { border-bottom: 0; }
.setup-list .mk { flex: 0 0 1.5rem; height: 1.5rem; border-radius: 50%; border: 2px solid #c4cfe2; display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; color: #fff; }
.setup-list li.done .mk { background: var(--green); border-color: var(--green); }
.setup-list li.opt .mk { border-style: dashed; }
.copybox { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-start; }
.copybox textarea, .copybox input { flex: 1; min-width: 14rem; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; }
.banner-stale { background: #ffe3e0; color: #7a1812; border-bottom: 2px solid var(--red); padding: .55rem 1rem; font-weight: 600; text-align: center; }
.banner-stale a { color: #7a1812; text-decoration: underline; }
/* envoi à la main (7.3.1) */
.send-card { border-inline-start: 4px solid var(--blue-m); }
.send-card.sent { border-inline-start-color: var(--green); }
.send-card.blocked { opacity: .75; border-inline-start-color: #c4cfe2; }
.send-head { display: flex; justify-content: space-between; gap: .8rem; flex-wrap: wrap; align-items: flex-start; }
.send-head h3 { margin: 0 0 .15rem; }
.send-status { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.sent-mark { color: var(--green-d); font-weight: 600; font-size: .9rem; }
.sent-fail { color: var(--red); font-size: .85rem; }
.send-items { list-style: none; padding: 0; margin: .7rem 0 .4rem; }
.send-items li { display: flex; justify-content: space-between; gap: .8rem; padding: .45rem 0; border-top: 1px solid var(--line); align-items: flex-start; }
.send-item-main { min-width: 0; }
.send-item-main .late { color: var(--red); font-weight: 600; }
.send-done { margin: 0; flex: 0 0 auto; }
.send-note { color: var(--amber); margin: .2rem 0; }
.send-msg { margin: .5rem 0; }
.send-msg summary { cursor: pointer; color: var(--blue); }
.send-msg textarea { width: 100%; margin-top: .4rem; font-size: .9rem; background: #fafbfd; }
.send-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .5rem; }
.send-actions .btn-primary { font-size: 1rem; padding: .55rem 1.1rem; }
@media (max-width: 760px) { .lvl-pick { grid-template-columns: 1fr; } .people-pick { grid-template-columns: 1fr; } }
.send-how { margin: .35rem 0 0; padding-inline-start: 1.4rem; }
.send-how li { margin: .15rem 0; }
