/* ==========================================================================
   L'Empreinte Verte — Gestion : feuille de style
   Charte : vert profond #0F3820, vert tendre #7CC68D, brun #412819, fond #F3F7F0
   Mobile-first, navigation basse sur mobile, barre latérale sur grand écran.
   ========================================================================== */
:root {
  --green: #0F3820;
  --green-2: #16502F;
  --green-soft: #7CC68D;
  --green-tint: #E3F1E6;
  --brown: #412819;
  --brown-soft: #6B4A35;
  --bg: #F3F7F0;
  --card: #FFFFFF;
  --line: #D9E4DA;
  --line-strong: #BFD0C2;
  --text: #2B2B2B;
  --muted: #6B7B6E;
  --danger: #B42318;
  --danger-bg: #FDECEC;
  --warn: #B7791F;
  --warn-bg: #FFF4DC;
  --info-bg: #E8F0FE;
  --info: #1A56DB;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 4px 20px rgba(15, 56, 32, .08);
  --shadow-sm: 0 1px 4px rgba(15, 56, 32, .08);
  --font: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.45;
  color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased;
}
a { color: var(--green); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
h1, h2, h3 { color: var(--green); margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.hidden { display: none !important; }
.grow { flex: 1; }

/* ---------- Écran de démarrage / connexion ---------- */
.boot { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; }
.boot-logo { width: 220px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 400px; background: var(--card); border-radius: 20px; padding: 32px 28px; box-shadow: var(--shadow); }
.login-card .logo { width: 200px; display: block; margin: 0 auto 10px; }
.login-card h1 { text-align: center; font-size: 18px; margin-bottom: 22px; }
.login-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin: -16px 0 22px; }

/* ---------- Structure ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; background: var(--green); color: #fff;
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top, 0px));
  box-shadow: 0 2px 10px rgba(0,0,0,.15);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .3px; text-decoration: none; color: #fff; }
.topbar .brand img { height: 30px; background: #fff; border-radius: 6px; padding: 3px 6px; }
.topbar .title { font-size: 15px; font-weight: 600; flex: 1; text-align: center; }
.topbar .user { font-size: 13px; opacity: .9; display: flex; align-items: center; gap: 8px; }
.topbar .btn-icon { color: #fff; }

.main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 16px 14px calc(var(--nav-h) + 24px + var(--safe-b)); }

.sidenav { display: none; }
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b); background: var(--card); border-top: 1px solid var(--line);
  display: flex; justify-content: space-around; align-items: stretch; box-shadow: 0 -2px 12px rgba(15,56,32,.06);
}
.bottomnav a {
  flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 0 2px;
  font-size: 10.5px; font-weight: 600; color: var(--muted); text-decoration: none;
}
.bottomnav a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bottomnav a svg { width: 24px; height: 24px; }
.bottomnav a.active { color: var(--green); }
.bottomnav a.active svg { stroke: var(--green); }

@media (min-width: 900px) {
  .bottomnav { display: none; }
  .shell { flex-direction: row; }
  .sidenav {
    display: flex; flex-direction: column; width: 230px; flex-shrink: 0; background: var(--green); color: #fff;
    position: sticky; top: 0; height: 100vh; padding: 18px 14px;
  }
  .sidenav .brand { display: block; background: #fff; border-radius: 12px; padding: 10px 12px; margin-bottom: 22px; }
  .sidenav .brand img { width: 100%; display: block; }
  .sidenav a.nav { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: rgba(255,255,255,.85); text-decoration: none; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
  .sidenav a.nav svg { width: 21px; height: 21px; }
  .sidenav a.nav:hover { background: rgba(255,255,255,.08); color: #fff; }
  .sidenav a.nav.active { background: var(--green-soft); color: var(--green); }
  .sidenav a.nav.active svg { stroke: var(--green); }
  .sidenav .foot { margin-top: auto; font-size: 12px; opacity: .7; line-height: 1.5; }
  .sidenav .foot a { color: #fff; }
  .topbar { display: none; }
  .content { flex: 1; min-width: 0; }
  .main { padding: 26px 28px 60px; }
}

/* ---------- Icônes ---------- */
svg.ico { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* ---------- En-têtes de page ---------- */
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { flex: 1; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Cartes ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 16px; margin-bottom: 14px; }
.card h2 { margin-bottom: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-sm); text-decoration: none; color: inherit; display: block; }
.kpi .lbl { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.kpi .val { font-size: 22px; font-weight: 700; color: var(--green); margin-top: 4px; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.warn .val { color: var(--danger); }

.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.quick a { background: var(--green); color: #fff; border-radius: var(--radius); padding: 14px 10px; text-decoration: none; font-weight: 600; font-size: 13px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.quick a svg { width: 26px; height: 26px; stroke: #fff; }
.quick a.alt { background: var(--card); color: var(--green); border: 1.5px solid var(--line-strong); }
.quick a.alt svg { stroke: var(--green); }

.chart { display: flex; align-items: flex-end; gap: 6px; height: 130px; padding-top: 10px; }
.chart .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; font-size: 10px; color: var(--muted); min-width: 0; }
.chart .bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.chart .bars i { display: block; width: 45%; max-width: 16px; background: var(--green-soft); border-radius: 3px 3px 0 0; min-height: 2px; }
.chart .bars i.enc { background: var(--green); }
/* Étiquettes de mois : à 375 px, « mars » et « avr. » se touchaient. */
.chart .bar b { font-weight: 500; white-space: nowrap; font-size: 9.5px; letter-spacing: -0.2px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1.5px solid transparent;
  border-radius: var(--radius-sm); padding: 10px 16px; font-weight: 600; font-size: 14px; line-height: 1.2;
  background: var(--green); color: #fff; text-decoration: none; white-space: nowrap; transition: background .15s, transform .05s;
}
.btn:hover { background: var(--green-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: var(--card); color: var(--green); border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--green-tint); }
.btn.ghost { background: transparent; color: var(--green); }
.btn.ghost:hover { background: var(--green-tint); }
.btn.danger { background: var(--danger-bg); color: var(--danger); }
.btn.danger:hover { background: #f9d6d6; }
.btn.soft { background: var(--green-tint); color: var(--green); }
.btn.sm { padding: 7px 11px; font-size: 13px; }
.btn.block { width: 100%; }
.btn.lg { padding: 14px 20px; font-size: 15px; }
.btn svg { width: 18px; height: 18px; }
.btn-icon { background: transparent; border: 0; padding: 8px; border-radius: 50%; display: inline-flex; color: var(--green); }
.btn-icon:hover { background: rgba(15,56,32,.08); }
.btn-icon.danger { color: var(--danger); }
.btn-icon svg { width: 20px; height: 20px; }
.fab {
  position: fixed; right: 18px; bottom: calc(var(--nav-h) + 16px + var(--safe-b)); z-index: 25;
  background: var(--green); color: #fff; border-radius: 999px; padding: 14px 20px; font-weight: 700; box-shadow: 0 6px 18px rgba(15,56,32,.3);
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; border: 0;
}
.fab svg { width: 22px; height: 22px; stroke: #fff; }
@media (min-width: 900px) { .fab { bottom: 28px; right: 28px; } }

/* ---------- Formulaires ---------- */
.field { margin-bottom: 12px; }
.field label, .lbl { display: block; font-size: 12.5px; font-weight: 600; color: var(--brown-soft); margin-bottom: 4px; }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: #fff;
  font-size: 15px; min-height: 42px; transition: border-color .15s;
}
.input:focus { outline: none; border-color: var(--green-soft); box-shadow: 0 0 0 3px rgba(124,198,141,.25); }
.input:disabled, .input[readonly] { background: #F6F8F5; color: #555; }
textarea.input { min-height: 80px; resize: vertical; line-height: 1.4; }
.input.num { text-align: right; font-variant-numeric: tabular-nums; }
.input.sm { padding: 7px 9px; min-height: 36px; font-size: 14px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 12px; }
.row > *, .row3 > *, .l-grid > * { min-width: 0; }
input[type=date].input { min-width: 0; width: 100%; padding-left: 8px; padding-right: 4px; }
@media (max-width: 560px) { .row.stack { grid-template-columns: 1fr; } .row3 { grid-template-columns: 1fr 1fr; } }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 8px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--green); }
.help { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.searchbar { position: relative; }
.searchbar .input { padding-left: 38px; }
.searchbar svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; stroke: var(--muted); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .searchbar { flex: 1; min-width: 180px; }
.toolbar select.input { width: auto; min-width: 130px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { border: 1.5px solid var(--line-strong); background: var(--card); color: var(--green); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.chip.active { background: var(--green); color: #fff; border-color: var(--green); }
.chip .n { opacity: .65; font-weight: 500; margin-left: 4px; }

/* ---------- Listes ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.item {
  background: var(--card); border-radius: var(--radius-sm); padding: 12px 14px; box-shadow: var(--shadow-sm);
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; text-decoration: none; color: inherit; cursor: pointer;
  border-left: 4px solid transparent;
}
.item > * { min-width: 0; }
.item .t, .item .s { overflow-wrap: anywhere; }
.item:hover { background: #FBFDFA; }
.item .t { font-weight: 600; color: var(--green); }
.item .s { font-size: 13px; color: var(--muted); }
.item .amt { font-weight: 700; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.item .meta { text-align: right; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.item.late { border-left-color: var(--danger); }
.item.ok { border-left-color: var(--green-soft); }
.item.warn { border-left-color: var(--warn); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 14px; }
.empty svg { width: 40px; height: 40px; stroke: var(--line-strong); margin-bottom: 8px; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .2px; white-space: nowrap; }
.badge.brouillon { background: #ECEFEA; color: #5C665E; }
.badge.envoye, .badge.envoyee { background: var(--info-bg); color: var(--info); }
.badge.accepte, .badge.payee { background: var(--green-tint); color: #1B7F3B; }
.badge.refuse, .badge.annulee, .badge.retard { background: var(--danger-bg); color: var(--danger); }
.badge.facture { background: #EDE7E1; color: var(--brown); }
.badge.type { background: var(--green); color: #fff; }
.badge.type.facture { background: var(--brown); }
.badge.type.avoir { background: var(--warn); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.tbl td { padding: 9px 6px; border-bottom: 1px solid var(--bg); vertical-align: top; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Éditeur de document ---------- */
.doc-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.doc-head h1 { font-size: 20px; }
.doc-head .num { color: var(--brown); font-weight: 700; }
.banner { border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13.5px; margin-bottom: 12px; display: flex; gap: 10px; align-items: flex-start; }
.banner.info { background: var(--info-bg); color: var(--info); }
.banner.warn { background: var(--warn-bg); color: #7a4f0a; }
.banner.danger { background: var(--danger-bg); color: var(--danger); }
.banner.ok { background: var(--green-tint); color: #1B7F3B; }
.banner svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

.client-pick { display: flex; gap: 8px; align-items: stretch; }
.client-pick .sel { flex: 1; min-width: 0; background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; justify-content: center; cursor: pointer; }
.client-pick .sel .n { font-weight: 600; color: var(--green); }
.client-pick .sel .a { font-size: 12.5px; color: var(--muted); }
.client-pick .sel.empty { color: var(--muted); font-style: italic; }

.lines { display: flex; flex-direction: column; gap: 8px; }
.line { background: var(--card); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); padding: 10px 12px; border-left: 4px solid var(--green-soft); }
.line.titre { border-left-color: var(--green); background: var(--green-tint); }
.line.texte { border-left-color: var(--line-strong); }
.line .l-top { display: flex; gap: 8px; align-items: flex-start; }
.line .l-top textarea { flex: 1; min-height: 40px; padding: 8px 10px; }
.line.titre .l-top input { font-weight: 700; color: var(--green); }
.line .l-tools { display: flex; flex-direction: column; gap: 0; }
.line.locked .l-tools, .line.titre.locked .l-tools, .line.texte.locked .l-tools { display: none; }
.line .l-tools .btn-icon { padding: 5px; }
.line .l-tools .btn-icon svg { width: 17px; height: 17px; }
.line .l-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; margin-top: 8px; align-items: end; }
.line .l-grid .lbl { font-size: 11px; margin-bottom: 2px; }
.line .l-total { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; margin-top: 4px; color: var(--muted); }
.line .l-total b { font-size: 15px; color: var(--green); font-variant-numeric: tabular-nums; }
.line.locked .l-grid { opacity: .85; }
@media (min-width: 1060px) {
  .line .l-top textarea { min-height: 38px; }
  .line .l-grid { grid-template-columns: 90px 90px 130px 80px 90px minmax(140px, 1fr); }
  .line .l-total { grid-column: auto; justify-content: flex-end; margin-top: 0; align-self: end; padding-bottom: 8px; }
}
.add-bar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.add-bar .btn { min-width: 0; white-space: normal; }
.add-bar .btn.catalog { grid-column: 1 / -1; }
@media (min-width: 700px) { .add-bar { grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); } .add-bar .btn.catalog { grid-column: auto; } }

.totals { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 820px) { .totals { grid-template-columns: 1fr 1fr; } }
.tot-table { width: 100%; font-size: 14px; border-collapse: collapse; }
.tot-table td { padding: 6px 4px; border-bottom: 1px solid var(--bg); }
.tot-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.tot-table tr.grand td { font-size: 17px; color: var(--green); font-weight: 700; border-top: 2px solid var(--green-soft); border-bottom: 0; padding-top: 10px; }
.tot-table tr.reste td { color: var(--brown); font-weight: 700; }

.savebar {
  position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b)); z-index: 24;
  background: rgba(255,255,255,.96); backdrop-filter: blur(8px); border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; box-shadow: 0 -2px 12px rgba(15,56,32,.06);
}
.savebar .tt { flex: 1; min-width: 0; line-height: 1.2; }
.savebar .btn { flex-shrink: 0; }
@media (max-width: 420px) { .savebar { padding: 8px 10px; gap: 8px; } .savebar .btn.lg { padding: 12px 14px; font-size: 14px; } .savebar .tt b { font-size: 16px; } }
.savebar .tt small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.savebar .tt b { font-size: 18px; color: var(--green); font-variant-numeric: tabular-nums; }
.savebar .dirty { color: var(--warn); font-size: 11.5px; font-weight: 600; }
@media (min-width: 900px) { .savebar { left: 230px; bottom: 0; padding: 12px 28px; } }
.has-savebar .main { padding-bottom: calc(var(--nav-h) + 90px + var(--safe-b)); }
@media (min-width: 900px) { .has-savebar .main { padding-bottom: 110px; } }

.actions-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 700px) { .actions-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.actions-grid .btn { justify-content: flex-start; min-width: 0; white-space: normal; text-align: left; }

.timeline { font-size: 13px; color: var(--muted); }
.timeline div { padding: 5px 0; border-bottom: 1px solid var(--bg); display: flex; justify-content: space-between; gap: 10px; }
.timeline div > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.timeline div > span:last-child { white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; }
.timeline .btn-icon { padding: 2px; }
.timeline .btn-icon svg { width: 15px; height: 15px; }

/* ---------- Modales / feuilles ---------- */
.overlay { position: fixed; inset: 0; background: rgba(20, 35, 25, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  background: var(--card); width: 100%; max-height: 92vh; border-radius: 20px 20px 0 0; display: flex; flex-direction: column;
  animation: up .2s ease-out; padding-bottom: var(--safe-b);
}
@keyframes up { from { transform: translateY(30px); opacity: .6; } }
.sheet .sh-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.sheet .sh-head h2 { flex: 1; font-size: 16px; }
.sheet .sh-body { overflow-y: auto; padding: 14px 16px; -webkit-overflow-scrolling: touch; }
.sheet .sh-foot { padding: 10px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.sheet .sh-foot .btn { flex: 1; }
@media (min-width: 700px) {
  .overlay { align-items: center; padding: 20px; }
  .sheet { max-width: 640px; border-radius: 18px; max-height: 88vh; }
  .sheet.wide { max-width: 860px; }
  .sheet .sh-foot .btn { flex: 0 1 auto; }
}
.picker-list { display: flex; flex-direction: column; gap: 6px; }
.picker-cat { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin: 10px 0 4px; }
.pick { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bg); cursor: pointer; border: 1.5px solid transparent; }
.pick:hover { border-color: var(--green-soft); }
.pick .pn { flex: 1; min-width: 0; }
.pick .pn b { display: block; color: var(--green); font-size: 14px; }
.pick .pn span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick .pp { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pick .pp small { color: var(--muted); font-weight: 500; }
.pick .badge-n { background: var(--green); color: #fff; border-radius: 999px; min-width: 22px; height: 22px; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 80px + var(--safe-b)); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
@media (min-width: 900px) { .toasts { bottom: 30px; } }
.toast { background: var(--green); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; box-shadow: 0 6px 18px rgba(0,0,0,.2); animation: up .2s; max-width: 92vw; text-align: center; }
.toast.err { background: var(--danger); }
.toast.warn { background: var(--warn); }

/* ---------- Onglets ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { background: none; border: 0; padding: 10px 14px; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs button.active { color: var(--green); border-bottom-color: var(--green); }

/* ---------- Prestations ---------- */
.presta { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: var(--radius-sm); padding: 10px 12px; box-shadow: var(--shadow-sm); }
.presta .pn { flex: 1; min-width: 0; }
.presta .pn b { color: var(--green); display: block; }
.presta .pn span { font-size: 12.5px; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.presta .pp { font-weight: 700; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.presta .pp small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; }
.cat-title { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 8px; }
.cat-title h2 { font-size: 15px; }

.logo-preview { max-height: 80px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.kv { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
/* ---------- Menu mobile ---------- */
.bottomnav .menu-btn {
  flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: none; border: 0; padding: 0 2px; font: inherit; font-size: 11px; font-weight: 600; color: var(--muted);
}
.bottomnav .menu-btn svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bottomnav .menu-btn.active { color: var(--green); }
.menu-list { display: flex; flex-direction: column; gap: 6px; }
.menu-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--bg); text-decoration: none; color: inherit; border: 1.5px solid transparent;
}
.menu-item:hover { border-color: var(--green-soft); background: var(--green-tint); }
.menu-item > svg:first-child { width: 24px; height: 24px; stroke: var(--green); flex-shrink: 0; }
.menu-item > svg:last-child { width: 18px; height: 18px; stroke: var(--line-strong); transform: rotate(-90deg); margin-left: auto; flex-shrink: 0; }
.menu-item span { display: flex; flex-direction: column; min-width: 0; }
.menu-item b { color: var(--green); font-size: 15.5px; }
.menu-item small { color: var(--muted); font-size: 12.5px; }

/* ---------- Le parc : chips de la feuille « Je pars » ---------- */
.chips-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-wrap .chip { min-height: 44px; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; max-width: 100%; min-width: 0; }
.chips-wrap .chip > span, .chips-wrap .chip .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.chips-wrap .chip.active { background: var(--green); color: #fff; border-color: var(--green); }
.chips-wrap .chip svg { width: 16px; height: 16px; }

/* ---------- Chantiers ---------- */
.argent { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 700px) { .argent { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.argent > div { background: var(--bg); border-radius: var(--radius-sm); padding: 10px 12px; min-width: 0; }
.argent b { display: block; font-size: 17px; font-weight: 700; color: var(--green); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.argent b.du { color: var(--brown); }
.sum-h2 { cursor: pointer; font-weight: 700; color: var(--green); font-size: 16px; list-style: none; }
.sum-h2::-webkit-details-marker { display: none; }
.sum-h2::before { content: '▸ '; color: var(--leaf, var(--green-soft)); }
details[open] > .sum-h2::before { content: '▾ '; }

/* ---------- Photos de chantier ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.photo { position: relative; border-radius: var(--radius-sm); overflow: hidden; aspect-ratio: 4 / 3; background: var(--bg); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .btn-icon { position: absolute; top: 4px; right: 4px; background: rgba(255,255,255,.9); padding: 4px; }
.photo .btn-icon svg { width: 15px; height: 15px; }

/* ---------- Badge modèle & suggestions d'adresse ---------- */
.badge.modele { background: #EEE6F7; color: #6941C6; }
.addr-sug { position: absolute; left: 0; right: 0; top: 100%; z-index: 60; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); max-height: 210px; overflow-y: auto; }
.addr-opt { padding: 9px 12px; font-size: 14px; cursor: pointer; border-bottom: 1px solid var(--bg); }
.addr-opt:hover { background: var(--green-tint); }

/* ---------- Mobile : anti-zoom iOS & zones sûres (encoche) ---------- */
@media (max-width: 899px) {
  .input, select.input, textarea.input, .input.sm { font-size: 16px; }
  .main { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
  .topbar { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
  .savebar { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
  .bottomnav { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .sheet .sh-body, .sheet .sh-head, .sheet .sh-foot { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
}

@media print { .topbar, .bottomnav, .sidenav, .savebar, .fab { display: none !important; } }
