/* ==========================================================================
   Art'Jardin Création · Dossiers — feuille de style
   Identité : logo officiel Art’Jardin Création, vert #039516, police Google Sans.
   Les couleurs de marque (--brand, --accent…) sont injectées par index.php
   depuis Paramètres → Identité visuelle.
   ========================================================================== */

/* --- Police Google Sans (auto-hébergée, licence OFL — aucune requête externe)
   Police variable : graisses 400 à 700 et tailles optiques (texte / titres) dans un seul fichier. */
@font-face {
  font-family: 'Google Sans'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('../fonts/google-sans.woff') format('woff');
  unicode-range: U+0000-017F, U+0218-021B, U+02BB-02DC, U+0300-0328, U+1E9E, U+2000-2152, U+2190-2199, U+2212-2265, U+25CF, U+2713, U+2715;
}

/* --- Jetons de design ----------------------------------------------------- */
:root {
  --brand: #111d19;
  --brand-2: #1f2a26;
  --brand-3: #2e3834;
  --accent: #039516;
  --accent-600: #038013;
  --accent-700: #026b10;
  --accent-50: #ebf7ec;
  --accent-100: #d7eeda;
  --accent-ink: #ffffff;
  --leaf: #5bba68;
  --sand: #c8b48a;

  --bg: #f4f2ec;
  --surface: #ffffff;
  --surface-2: #faf9f5;
  --surface-3: #f1efe8;
  --line: #e3dfd3;
  --line-2: #d3cdbd;
  --ink: #18211d;
  --ink-2: #34403a;
  --muted: #5b6760;
  --faint: #89928c;

  --draft: #55635d;  --draft-bg: #eaece7;
  --progress: #8f5307; --progress-bg: #fbeed6;
  --done: var(--accent-700); --done-bg: var(--accent-50);
  --danger: #b42318; --danger-bg: #fdecea;
  --info: #1f5d86;   --info-bg: #e5eff6;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-1: 0 1px 2px rgba(17, 29, 25, .05), 0 1px 3px rgba(17, 29, 25, .04);
  --shadow-2: 0 10px 30px rgba(17, 29, 25, .10), 0 2px 8px rgba(17, 29, 25, .06);
  --shadow-3: 0 24px 60px rgba(17, 29, 25, .22);
  --font: 'Google Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  --topbar-h: 58px;
  --tabbar-h: 62px;
  --sidebar-w: 256px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --gutter: 16px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* --- Base ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-600); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #81ca8a; outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }
::selection { background: var(--accent-100); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.icon { width: 20px; height: 20px; flex: none; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }

/* --- Écran de démarrage --------------------------------------------------- */
.boot {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: var(--brand); color: #fff; text-align: center; padding: 24px;
}
.boot-logo { width: 220px; max-width: 70vw; height: auto; }
.boot-spinner { width: 26px; height: 26px; margin-top: 26px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.18); border-top-color: var(--leaf); animation: spin .8s linear infinite; }
.boot-msg { margin-top: 22px; color: #cfd8d2; font-size: 14px; max-width: 360px; }
.boot-msg code { background: rgba(255,255,255,.1); padding: 1px 6px; border-radius: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Logo ------------------------------------------------------------------ */
.wordmark { display: flex; align-items: center; color: #fff; text-decoration: none; min-width: 0; }
.wordmark:hover { text-decoration: none; }
.wordmark img { height: auto; }
.wordmark-logo { width: 176px; }          /* logo complet (barre latérale) */
.wordmark-mono { width: auto; height: 30px !important; }  /* monogramme AJC (barre mobile) */

/* --- Structure de l'application ------------------------------------------ */
.shell { min-height: 100vh; min-height: 100dvh; }
.sidebar { display: none; }
.main { min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: calc(var(--topbar-h) + var(--safe-t));
  padding: var(--safe-t) 8px 0 12px;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; gap: 6px;
  box-shadow: 0 1px 0 rgba(255,255,255,.04);
}
.topbar-title { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.topbar-title strong { font-size: 16px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title small { font-size: 11.5px; color: #aebdb4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .wordmark { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 2px; }
.topbar .icon-btn { color: #e6ece8; }
.topbar .icon-btn:hover { background: rgba(255,255,255,.08); }

.sync {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: #c9d5ce; padding: 6px 10px; border-radius: 999px;
  background: rgba(255,255,255,.06); white-space: nowrap;
}
.sync .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--leaf); }
.sync.is-saving .dot { background: #f1c56b; animation: pulse 1s ease-in-out infinite; }
.sync.is-offline .dot { background: #f08a7e; }
.sync.is-error .dot { background: #f08a7e; }
@keyframes pulse { 50% { opacity: .35; } }

.view {
  padding: 18px var(--gutter) calc(var(--tabbar-h) + var(--safe-b) + 28px);
  max-width: 820px; margin: 0 auto;
  animation: fadein .18s var(--ease);
}
.view.has-actionbar { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 96px); }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(255, 255, 255, .96);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-around; align-items: stretch;
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 10.5px; font-weight: 500; text-decoration: none; position: relative;
  border: 0; background: none; padding: 0; cursor: pointer; min-width: 0;
}
.tab:hover { text-decoration: none; }
.tab .icon { width: 22px; height: 22px; }
.tab.is-active { color: var(--accent-600); }
.tab.is-active::before { content: ''; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
.tab-new { flex: 0 0 72px; }
.tab-new .tab-new-btn {
  width: 50px; height: 50px; margin-top: -18px; border-radius: 16px;
  background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 38%, transparent), 0 0 0 5px var(--bg);
}
.tab-new .tab-new-btn .icon { width: 26px; height: 26px; }
.tab-badge {
  position: absolute; top: 6px; left: calc(50% + 6px);
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; line-height: 17px; text-align: center;
}

.banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; font-size: 13px;
  background: #3b2a12; color: #fbe7c4;
}
.banner.is-offline { background: #3a2320; color: #ffd9d2; }

/* --- Titres de page ------------------------------------------------------- */
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.page-head h1 { font-size: 24px; flex: 1; min-width: 0; }
.page-sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.eyebrow { font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); margin: 26px 2px 10px;
}
.section-title .count { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--faint); }
.section-title .spacer { flex: 1; }
.section-title .hint-inline { letter-spacing: 0; text-transform: none; font-weight: 400; color: var(--faint); font-size: 12.5px; }
@media (max-width: 480px) { .section-title .hint-inline { display: none; } }
.section-title a { font-size: 13px; font-weight: 500; letter-spacing: 0; text-transform: none; }

/* --- Boutons -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font-weight: 500; font-size: 14.5px; line-height: 1.2; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .08s, color .15s;
  white-space: nowrap; user-select: none;
}
.btn:hover { text-decoration: none; background: var(--surface-2); border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; box-shadow: 0 1px 0 rgba(0,0,0,.06), 0 6px 16px color-mix(in srgb, var(--accent) 22%, transparent); }
.btn-primary:hover { background: var(--accent-600); border-color: var(--accent-600); }
.btn-dark { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-dark:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-soft { background: var(--accent-50); border-color: var(--accent-100); color: var(--accent-700); }
.btn-soft:hover { background: var(--accent-100); border-color: var(--accent-100); }
.btn-danger { background: var(--surface); border-color: #f1c4bf; color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); border-color: #eaa59d; }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: #9a1d13; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; gap: 6px; }
.btn-lg { min-height: 52px; padding: 0 24px; font-size: 16px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn .icon { width: 18px; height: 18px; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-color: rgba(255,255,255,.4); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn:not(.btn-primary):not(.btn-dark):not(.btn-danger-solid).is-loading::after { border-color: var(--line-2); border-top-color: var(--accent); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 12px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; flex: none;
  transition: background .15s;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn.sm { width: 34px; height: 34px; border-radius: 10px; }
.icon-btn.danger { color: var(--danger); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-row.end { justify-content: flex-end; }

/* --- Formulaires ---------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field + .field, .field + .grid, .grid + .field, .grid + .grid,
.suggest + .field, .field + .suggest, .suggest + .grid, .grid + .suggest, .suggest + .suggest { margin-top: 14px; }
.grid > .field, .grid > .suggest { margin-top: 0; }
.label { font-size: 13px; font-weight: 500; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.label .req { color: var(--danger); }
.label .hint, .hint { font-weight: 400; color: var(--faint); font-size: 12.5px; }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 11px 13px;
  border: 1px solid var(--line-2); border-radius: 11px; background: var(--surface);
  font-size: 16px; line-height: 1.35; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none; appearance: none;
}
.input::placeholder, .textarea::placeholder { color: #a3aaa5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(3, 149, 22, .16); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
.input.is-invalid { border-color: var(--danger); }
.textarea { min-height: 110px; resize: vertical; }
.select {
  padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235b6760' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-npa { grid-template-columns: 110px 1fr; }
.grid-civ { grid-template-columns: 130px 1fr; }
@media (max-width: 420px) { .grid-2.stack-sm { grid-template-columns: 1fr; } }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.input-icon .input { padding-left: 42px; }
.input-icon .clear { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }

.seg { display: inline-flex; padding: 4px; gap: 4px; background: var(--surface-3); border-radius: 12px; border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; font-weight: 500; font-size: 14px; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; }
.seg button.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.seg.full { display: flex; }
.seg.full button { flex: 1; justify-content: center; }

.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 46px; height: 28px; border-radius: 999px; background: #cfd3cd; position: relative; transition: background .18s; flex: none; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .18s var(--ease); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 2px; }
.switch .switch-text { display: flex; flex-direction: column; min-width: 0; }
.switch .switch-text strong { font-weight: 500; font-size: 14.5px; }
.switch .switch-text small { color: var(--muted); font-size: 12.5px; }
.switch.danger input:checked + .track { background: var(--danger); }

.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14.5px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; flex: none; }

/* --- Cartes --------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.card + .card { margin-top: 14px; }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 16px; font-weight: 500; flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.card-head h2 .num { width: 26px; height: 26px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-50); color: var(--accent-700); font-size: 13px; font-weight: 700; flex: none; }
.card-head h2 .done-mark { color: var(--accent); }
.card-body { padding: 18px; }
.card-foot { padding: 14px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

/* --- Pastilles ------------------------------------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
  background: var(--draft-bg); color: var(--draft);
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.no-dot::before { display: none; }
.badge-brouillon { background: var(--draft-bg); color: var(--draft); }
.badge-en_cours { background: var(--progress-bg); color: var(--progress); }
.badge-traite { background: var(--done-bg); color: var(--done); }
.badge-urgent { background: var(--danger-bg); color: var(--danger); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: 10.5px; }
.badge-new { background: var(--info-bg); color: var(--info); font-weight: 700; }
.badge-modified { background: #f5ecff; color: #6b3fa0; }
.badge-lg { height: 30px; padding: 0 13px; font-size: 13.5px; }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 4px; margin: 0 -2px; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2);
  font-size: 13.5px; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.chip:hover { text-decoration: none; border-color: var(--faint); }
.chip .n { color: var(--faint); font-weight: 500; }
.chip.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip.is-active .n { color: #aebdb4; }

/* --- Listes de dossiers --------------------------------------------------- */
.dlist { display: flex; flex-direction: column; gap: 10px; }
.dcard {
  display: block; position: relative; padding: 14px 16px 14px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--ink); text-decoration: none; box-shadow: var(--shadow-1);
  transition: border-color .15s, box-shadow .15s, transform .12s;
}
.dcard:hover { text-decoration: none; border-color: var(--line-2); box-shadow: var(--shadow-2); }
.dcard:active { transform: scale(.995); }
.dcard::before { content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0; background: var(--line-2); }
.dcard.st-en_cours::before { background: #e6a53c; }
.dcard.st-traite::before { background: var(--accent); }
.dcard.is-urgent::before { background: var(--danger); }
.dcard-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.dcard-ref { font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.dcard-top .spacer { flex: 1; }
.dcard-title { font-size: 16px; font-weight: 500; line-height: 1.3; }
.dcard-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; color: var(--muted); font-size: 13px; }
.dcard-meta span { display: inline-flex; align-items: center; gap: 5px; }
.dcard-meta .icon { width: 15px; height: 15px; color: var(--faint); }
.dcard-foot { margin-top: 8px; font-size: 12.5px; color: var(--faint); }
.dcard.is-unsynced { border-style: dashed; }

/* --- Accueil -------------------------------------------------------------- */
.hero {
  position: relative; overflow: hidden;
  background: var(--brand); color: #fff; border-radius: var(--radius-lg);
  padding: 22px 20px 20px; box-shadow: var(--shadow-2);
}
.hero::after {
  content: ''; position: absolute; right: -36px; top: -14px; width: 250px; height: 120px; opacity: .07;
  background: url('../img/monogramme-blanc.png') no-repeat right top / contain; pointer-events: none;
}
.hero .eyebrow { color: #9fb0a7; }
.hero h1 { font-weight: 700; font-size: 29px; margin-top: 4px; letter-spacing: -.015em; position: relative; z-index: 1; }
.hero p { color: #c9d5ce; margin-top: 4px; font-size: 14.5px; max-width: 460px; position: relative; z-index: 1; }
.hero .btn { margin-top: 18px; position: relative; z-index: 1; }
.hero-count { display: flex; align-items: baseline; gap: 10px; margin-top: 12px; position: relative; z-index: 1; }
.hero-count strong { font-size: 44px; line-height: 1; font-weight: 700; color: var(--leaf); }
.hero-count span { color: #dfe7e2; font-size: 15px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.stat {
  display: flex; flex-direction: column; gap: 2px; padding: 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; box-shadow: var(--shadow-1);
}
.stat:hover { text-decoration: none; border-color: var(--line-2); }
.stat-n { font-size: 26px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-l { font-size: 12.5px; color: var(--muted); }
.stat .dot { width: 8px; height: 8px; border-radius: 50%; margin-bottom: 6px; }
.stat-brouillon .dot { background: var(--faint); }
.stat-en_cours .dot { background: #e6a53c; }
.stat-traite .dot { background: var(--accent); }

.prompt {
  display: flex; gap: 14px; align-items: flex-start; padding: 16px;
  border-radius: var(--radius); background: var(--accent-50); border: 1px solid var(--accent-100); margin-top: 14px;
}
.prompt .prompt-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--surface); color: var(--accent); display: flex; align-items: center; justify-content: center; flex: none; }
.prompt strong { display: block; font-weight: 500; }
.prompt p { color: var(--ink-2); font-size: 13.5px; margin-top: 2px; }
.prompt .btn-row { margin-top: 10px; }
.prompt-body { flex: 1; min-width: 0; }

/* --- États vides / chargement -------------------------------------------- */
.empty { text-align: center; padding: 34px 18px; color: var(--muted); }
.empty .empty-icon { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 18px; background: var(--surface-3); display: flex; align-items: center; justify-content: center; color: var(--faint); }
.empty strong { display: block; color: var(--ink); font-weight: 500; font-size: 15.5px; }
.empty p { font-size: 14px; margin-top: 4px; }
.empty .btn { margin-top: 16px; }
.empty.compact { padding: 20px 12px; }
.skeleton { background: linear-gradient(90deg, var(--surface-3), #f8f7f2, var(--surface-3)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: var(--radius); }
.skeleton.card-sk { height: 92px; }
.skeleton + .skeleton { margin-top: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.loading-block { display: flex; justify-content: center; padding: 40px 0; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }

/* --- Éditeur de dossier --------------------------------------------------- */
.editor-nav {
  position: sticky; top: calc(var(--topbar-h) + var(--safe-t)); z-index: 20;
  margin: -18px calc(var(--gutter) * -1) 14px; padding: 10px var(--gutter);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.editor-nav .chip { height: 32px; padding: 0 12px; font-size: 13px; }
.editor-nav .chip .ok { color: var(--accent); }
.editor-nav .chip.is-done { border-color: var(--accent-100); background: var(--accent-50); color: var(--accent-700); }
.editor-section { scroll-margin-top: calc(var(--topbar-h) + var(--safe-t) + 70px); }
.editor-section + .editor-section { margin-top: 14px; }
.notice {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px;
  background: var(--progress-bg); color: #6b3f06; font-size: 13.5px; border: 1px solid #f2d9aa; margin-bottom: 14px;
}
.notice.info { background: var(--info-bg); color: #184a6c; border-color: #cfe1ee; }
.notice.danger { background: var(--danger-bg); color: #7a1a12; border-color: #f4c9c4; }
.notice.success { background: var(--done-bg); color: #1f4d27; border-color: #c7e1c0; }
.notice .icon { margin-top: 1px; }
.notice > div { flex: 1; min-width: 0; }
.notice .btn { margin-top: 8px; }

.suggest { position: relative; }
.suggest-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 25;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow-2);
  max-height: 290px; overflow-y: auto; padding: 6px;
}
.suggest-item {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left;
  padding: 10px 10px; border: 0; background: none; border-radius: 9px; cursor: pointer; color: var(--ink);
}
.suggest-item:hover, .suggest-item.is-active { background: var(--surface-3); }
.suggest-item .icon { color: var(--faint); margin-top: 2px; }
.suggest-item span { display: flex; flex-direction: column; min-width: 0; }
.suggest-item strong { font-weight: 500; font-size: 14.5px; }
.suggest-item small { color: var(--muted); font-size: 12.5px; }
.suggest-foot { padding: 6px 10px 2px; font-size: 11px; color: var(--faint); text-align: right; }

.map-box {
  position: relative; height: 270px; border-radius: 14px; overflow: hidden;
  background: #dfe6dc; border: 1px solid var(--line); margin-top: 14px;
}
.map-box .map { position: absolute; inset: 0; }
.map-box .map-tools { position: absolute; left: 10px; bottom: 10px; display: flex; gap: 8px; z-index: 2; }
.map-box .map-tools .btn { box-shadow: var(--shadow-2); border-color: transparent; }
.map-hint { position: absolute; top: 10px; left: 10px; right: 60px; z-index: 2; pointer-events: none; }
.map-hint span { display: inline-block; background: rgba(17, 29, 25, .78); color: #fff; font-size: 12px; padding: 5px 10px; border-radius: 999px; }
.map-placeholder {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  text-align: center; padding: 20px; color: var(--muted); font-size: 13.5px;
  background: repeating-linear-gradient(45deg, #e7ece3, #e7ece3 12px, #e1e7dd 12px, #e1e7dd 24px);
}
.map-placeholder .icon { width: 30px; height: 30px; color: var(--accent); }
.coords { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.coords > span, .coords > a { display: inline-flex; align-items: center; gap: 6px; }
.coords code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-3); padding: 3px 8px; border-radius: 7px; color: var(--ink-2); }

/* Lignes d'articles */
.items-group + .items-group { margin-top: 16px; }
.items-group-title { font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 2px 8px; display: flex; gap: 8px; }
.items-group-title .n { font-weight: 500; letter-spacing: 0; color: var(--faint); text-transform: none; }
.item-row {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name name" "ctrl del" "note note";
  gap: 10px 10px; align-items: center;
  padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
}
.item-row .item-name { grid-area: name; }
.item-row .item-controls { grid-area: ctrl; }
.item-row .item-del { grid-area: del; }
.item-row .item-note { grid-area: note; min-height: 40px; font-size: 14px; padding: 8px 11px; border-radius: 9px; }
@media (min-width: 720px) {
  .item-row { grid-template-columns: 1fr auto auto; grid-template-areas: "name ctrl del" "note note note"; }
}
.item-row + .item-row { margin-top: 8px; }
.item-row.is-zero { border-color: #f2d9aa; background: #fffbf3; }
.item-name { min-width: 0; }
.item-name strong { font-weight: 500; font-size: 14.5px; display: block; line-height: 1.3; }
.item-name small { color: var(--faint); font-size: 12px; }
.item-controls { display: flex; align-items: center; gap: 6px; }
.item-extra { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; }
.item-extra .note-input { flex: 1; min-height: 38px; font-size: 14px; padding: 8px 11px; border-radius: 9px; }
.item-note-view { grid-column: 1 / -1; font-size: 13px; color: var(--muted); display: flex; gap: 6px; }

.qty { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 11px; background: var(--surface); overflow: hidden; height: 40px; }
.qty button { width: 38px; height: 100%; border: 0; background: var(--surface-2); color: var(--ink-2); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.qty button:hover { background: var(--surface-3); }
.qty button .icon { width: 17px; height: 17px; }
.qty input { width: 58px; height: 100%; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); text-align: center; font-size: 16px; font-weight: 500; font-variant-numeric: tabular-nums; background: var(--surface); padding: 0 4px; -moz-appearance: textfield; }
.qty input:focus { outline: none; background: var(--accent-50); }
.qty .unit { padding: 0 8px 0 2px; font-size: 12.5px; color: var(--muted); min-width: 30px; text-align: left; }
.unit-tag { font-size: 12.5px; color: var(--muted); min-width: 34px; }

.add-items {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  margin-top: 14px; min-height: 54px; border-radius: 14px;
  border: 1.5px dashed #8fce97; border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, var(--line-2)); background: var(--accent-50);
  color: var(--accent-700); font-weight: 500; font-size: 15px; cursor: pointer;
}
.add-items:hover { background: var(--accent-100); }

.actionbar {
  position: fixed; left: 0; right: 0; z-index: 35;
  bottom: calc(var(--tabbar-h) + var(--safe-b));
  padding: 10px var(--gutter); background: rgba(255,255,255,.96);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.actionbar-info { flex: 1; min-width: 0; font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.actionbar-info strong { display: block; color: var(--ink); font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actionbar .btn { flex: none; }

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 14.5px; }
.checklist li + li { border-top: 1px solid var(--line); }
.checklist .icon { color: var(--danger); }
.checklist li.ok .icon { color: var(--accent); }
.checklist li.warn .icon { color: var(--progress); }

/* --- Sélecteur d'articles (feuille) --------------------------------------- */
.picker { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.picker-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.picker-top { display: flex; align-items: center; gap: 10px; }
.picker-top h2 { font-size: 17px; font-weight: 500; flex: 1; }
.picker-list { flex: 1; overflow-y: auto; padding: 6px 12px 16px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.picker-group-title { position: sticky; top: 0; z-index: 1; background: var(--surface); padding: 12px 4px 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.picker-item { display: flex; align-items: center; gap: 12px; padding: 8px 4px 8px 8px; border-radius: 12px; min-height: 58px; }
.picker-item + .picker-item { border-top: 1px solid var(--surface-3); }
.picker-item.is-selected { background: var(--accent-50); border-top-color: transparent; }
.picker-item-name { flex: 1; min-width: 0; cursor: pointer; }
.picker-item-name strong { display: block; font-weight: 500; font-size: 15px; line-height: 1.3; }
.picker-item-name small { color: var(--faint); font-size: 12.5px; }
.picker-add { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--accent-100); background: var(--accent-50); color: var(--accent-700); display: flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.picker-add:hover { background: var(--accent-100); }
.picker-foot { padding: 12px 16px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); display: flex; gap: 10px; background: var(--surface-2); }
.picker-foot .btn-primary { flex: 1; }
mark { background: #fff0b8; color: inherit; border-radius: 3px; padding: 0 1px; }

/* --- Vue d'un dossier ----------------------------------------------------- */
.dhead { padding: 18px; }
.dhead-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dhead-ref { font-size: 13px; color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.dhead h1 { font-size: 23px; margin-top: 10px; }
.dhead-client { font-size: 15.5px; color: var(--ink-2); margin-top: 4px; }
.dhead-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.dhead-meta span { display: inline-flex; align-items: center; gap: 6px; }
.dhead-meta .icon { width: 15px; height: 15px; color: var(--faint); }
.status-panel { padding: 16px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.status-panel .label { margin-bottom: 8px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 14px; font-size: 14.5px; }
.kv dt { color: var(--muted); font-size: 13.5px; padding-top: 1px; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.items-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.items-table th { text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line); }
.items-table td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.items-table .cat td { background: var(--surface-2); font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; }
.items-table .q { text-align: right; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; width: 72px; }
.items-table .u { color: var(--muted); white-space: nowrap; width: 64px; }
.items-table .note { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
.items-table .ref { color: var(--faint); font-size: 12px; }
.comment-box { border-left: 4px solid var(--accent); background: var(--surface-2); padding: 14px 16px; border-radius: 0 12px 12px 0; white-space: pre-wrap; font-size: 15px; line-height: 1.6; }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ''; position: absolute; left: 15px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline li { position: relative; display: flex; gap: 12px; padding: 8px 0; }
.tl-dot { width: 32px; height: 32px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line); display: flex; align-items: center; justify-content: center; flex: none; z-index: 1; color: var(--muted); }
.tl-dot .icon { width: 15px; height: 15px; }
.tl-dot.sent { border-color: #e6a53c; color: #b06b0c; }
.tl-dot.done { border-color: var(--accent); color: var(--done); }
.tl-dot.note { border-color: #8fb6d3; color: var(--info); }
.tl-body { flex: 1; min-width: 0; padding-top: 5px; }
.tl-body strong { font-weight: 500; font-size: 14px; }
.tl-body time { display: block; color: var(--faint); font-size: 12px; margin-top: 1px; }
.tl-msg { margin-top: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-form { display: flex; gap: 8px; align-items: flex-end; margin-top: 14px; }
.note-form .textarea { min-height: 46px; height: 46px; }

/* --- Bibliothèque --------------------------------------------------------- */
.lib-cat { overflow: hidden; }
.lib-cat + .lib-cat { margin-top: 12px; }
.lib-cat-head { display: flex; align-items: center; gap: 8px; padding: 12px 10px 12px 16px; cursor: pointer; user-select: none; }
.lib-cat-head h3 { flex: 1; min-width: 0; font-size: 15.5px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.lib-cat-head .n { color: var(--faint); font-size: 13px; font-weight: 400; }
.lib-cat-head .chev { transition: transform .18s; color: var(--faint); }
.lib-cat.is-open .chev { transform: rotate(90deg); }
.lib-cat.is-inactive h3 { color: var(--faint); text-decoration: line-through; }
.lib-items { border-top: 1px solid var(--line); }
.lib-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px 9px 16px; }
.lib-item + .lib-item { border-top: 1px solid var(--surface-3); }
.lib-item-name { flex: 1; min-width: 0; }
.lib-item-name strong { font-weight: 400; font-size: 14.5px; }
.lib-item-name small { color: var(--faint); font-size: 12.5px; margin-left: 6px; }
.lib-item.is-inactive .lib-item-name strong { color: var(--faint); text-decoration: line-through; }
.lib-add { padding: 10px 16px 14px; }

/* --- Paramètres ----------------------------------------------------------- */
.menu { list-style: none; margin: 0; padding: 0; }
.menu a, .menu button.menu-link {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; color: var(--ink); text-decoration: none;
  width: 100%; border: 0; background: none; text-align: left; cursor: pointer; font-size: 15px;
}
.menu a:hover, .menu button.menu-link:hover { background: var(--surface-2); text-decoration: none; }
.menu li + li { border-top: 1px solid var(--line); }
.menu-icon { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; background: var(--accent-50); color: var(--accent-700); flex: none; }
.menu-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.menu-text small { color: var(--muted); font-size: 12.5px; }
.menu .chev { color: var(--faint); }
.menu-danger { color: var(--danger) !important; }
.menu-danger .menu-icon { background: var(--danger-bg); color: var(--danger); }
.profile-card { display: flex; align-items: center; gap: 14px; }
.avatar { width: 52px; height: 52px; border-radius: 16px; background: var(--brand); color: var(--leaf); font-weight: 700; font-size: 19px; letter-spacing: .02em; display: flex; align-items: center; justify-content: center; flex: none; }
.avatar.sm { width: 38px; height: 38px; border-radius: 12px; font-size: 15px; }
.device { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.device + .device { border-top: 1px solid var(--line); }
.device-icon { width: 38px; height: 38px; border-radius: 11px; background: var(--surface-3); display: flex; align-items: center; justify-content: center; color: var(--muted); flex: none; }
.device-text { flex: 1; min-width: 0; }
.device-text strong { font-weight: 500; font-size: 14.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.device-text small { display: block; color: var(--muted); font-size: 12.5px; }
.user-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.user-row + .user-row { border-top: 1px solid var(--line); }
.user-row.is-inactive { opacity: .6; }
.user-text { flex: 1; min-width: 0; }
.user-text strong { font-weight: 500; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-text small { display: block; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.color-field { display: flex; align-items: center; gap: 10px; }
.color-field input[type=color] { width: 52px; height: 46px; padding: 3px; border: 1px solid var(--line-2); border-radius: 11px; background: var(--surface); cursor: pointer; }
.brand-previews { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.brand-preview { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 20px 16px 14px; border-radius: 12px; background: var(--brand); color: #c9d5ce; font-size: 12px; text-align: center; }
.brand-preview.light { background: #fff; border: 1px solid var(--line); color: var(--muted); }
.brand-preview img { width: 180px; max-width: 100%; height: auto; }
.icon-preview { width: 72px; height: 72px; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); flex: none; }
.log-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.log-table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.log-table td { padding: 9px 10px; border-bottom: 1px solid var(--surface-3); vertical-align: top; }
.log-table .warn { color: var(--progress); }
.log-table .fail { color: var(--danger); font-weight: 500; }
.log-table small { color: var(--faint); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.help { font-size: 13.5px; color: var(--muted); line-height: 1.55; }
.help ol, .help ul { padding-left: 20px; margin: 8px 0 0; }
.help li + li { margin-top: 4px; }
.help code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-3); padding: 1px 6px; border-radius: 6px; color: var(--ink-2); }

/* --- Fenêtres modales et feuilles ---------------------------------------- */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 18, 15, .5);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .18s var(--ease);
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 560px; max-height: 92vh; max-height: 92dvh;
  background: var(--surface); border-radius: 22px 22px 0 0; box-shadow: var(--shadow-3);
  display: flex; flex-direction: column; overflow: hidden;
  animation: slideup .24s var(--ease);
  padding-bottom: var(--safe-b);
}
.modal.full { height: 92vh; height: 92dvh; }
@keyframes slideup { from { transform: translateY(40px); opacity: .6; } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 8px 20px; }
.modal-head h2 { flex: 1; font-size: 17px; font-weight: 500; }
.modal-body { padding: 6px 20px 18px; overflow-y: auto; }
.modal-body p + p { margin-top: 10px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 20px 16px; border-top: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap-reverse; }
.modal-foot .btn { flex: 1 1 auto; }
.modal-grip { width: 38px; height: 4px; border-radius: 99px; background: var(--line-2); margin: 8px auto 0; flex: none; }

.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px); z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 520px;
  background: var(--brand); color: #fff; padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow-3);
  font-size: 14px; animation: toastin .22s var(--ease);
}
.toast .icon { color: var(--leaf); }
.toast.error { background: #5b1b14; }
.toast.error .icon { color: #ffb4a8; }
.toast button { background: none; border: 0; color: var(--leaf); font-weight: 700; cursor: pointer; padding: 4px 6px; font-size: 14px; }
.toast.out { opacity: 0; transform: translateY(10px); transition: all .2s; }
body:has(.actionbar) .toasts { bottom: calc(var(--tabbar-h) + var(--safe-b) + 84px); }
@keyframes toastin { from { opacity: 0; transform: translateY(12px) scale(.98); } }

/* --- Connexion ------------------------------------------------------------ */
.login {
  min-height: 100vh; min-height: 100dvh; position: relative; overflow: hidden;
  background: radial-gradient(1200px 600px at 110% -10%, var(--brand-3), transparent 60%), var(--brand);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(28px + var(--safe-t)) 18px calc(24px + var(--safe-b));
}
.login-art { position: absolute; inset: 0; pointer-events: none; opacity: .5; }
.login-art svg { position: absolute; width: 520px; max-width: none; right: -170px; bottom: -120px; }
.login-art svg.second { width: 300px; left: -120px; top: -60px; right: auto; bottom: auto; transform: rotate(160deg); opacity: .6; }
.login-brand { position: relative; text-align: center; color: #fff; margin-bottom: 26px; }
.login-logo { width: 236px; max-width: 72vw; height: auto; margin: 0 auto; }
.login-card { position: relative; width: 100%; max-width: 410px; background: var(--surface); border-radius: 22px; padding: 26px 22px 22px; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.login-card h1 { font-size: 21px; }
.login-card .lead { color: var(--muted); font-size: 14px; margin-top: 4px; margin-bottom: 18px; }
.login-card .btn-block { margin-top: 16px; }
.otp-input { text-align: center; font-size: 30px !important; letter-spacing: .45em; font-weight: 700; font-variant-numeric: tabular-nums; padding-left: .45em !important; height: 62px; }
.login-links { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.linkish { background: none; border: 0; color: var(--accent-700); font-weight: 500; font-size: 13.5px; cursor: pointer; padding: 6px 0; }
.linkish:disabled { color: var(--faint); cursor: default; }
.login-foot { position: relative; margin-top: 22px; color: #8fa197; font-size: 12px; text-align: center; display: flex; align-items: center; gap: 6px; }
.login-foot .icon { width: 14px; height: 14px; }
.form-error { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--danger-bg); color: #7a1a12; font-size: 13.5px; }
.form-info { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--accent-50); color: var(--accent-700); font-size: 13.5px; }

/* --- Divers --------------------------------------------------------------- */
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.load-more { display: flex; justify-content: center; margin-top: 16px; }
.divider-label { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 12px; margin: 14px 0; }
.divider-label::before, .divider-label::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.kbd { font-family: var(--mono); font-size: 12px; background: var(--surface-3); border: 1px solid var(--line); border-bottom-width: 2px; padding: 0 5px; border-radius: 5px; }
.install-steps { counter-reset: s; list-style: none; padding: 0; margin: 10px 0 0; }
.install-steps li { counter-increment: s; display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; font-size: 14px; }
.install-steps li::before { content: counter(s); width: 24px; height: 24px; border-radius: 50%; background: var(--accent-50); color: var(--accent-700); font-weight: 700; font-size: 12.5px; display: flex; align-items: center; justify-content: center; flex: none; }

/* --- Tablette / bureau ---------------------------------------------------- */
@media (min-width: 720px) {
  :root { --gutter: 24px; }
  .view { padding-top: 24px; }
  .overlay { align-items: center; padding: 24px; }
  .modal { border-radius: 22px; }
  .modal-grip { display: none; }
  .modal-foot .btn { flex: 0 0 auto; }
  .hero { padding: 28px 28px 24px; }
  .hero h1 { font-size: 34px; }
  .stats { gap: 14px; }
  .toasts { bottom: 24px; }
}

@media (min-width: 1024px) {
  .shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; }
  .sidebar {
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
    background: var(--brand); color: #fff; padding: 22px 14px 16px;
  }
  .sidebar .wordmark { justify-content: center; padding: 4px 0 24px; }
  .side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
  .side-link {
    display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 11px;
    color: #c9d5ce; text-decoration: none; font-weight: 500; font-size: 14.5px; position: relative;
  }
  .side-link:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
  .side-link.is-active { background: rgba(255,255,255,.1); color: #fff; }
  .side-link.is-active .icon { color: var(--leaf); }
  .side-link .count { margin-left: auto; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
  .side-new { margin: 6px 0 14px; }
  .side-new .btn { width: 100%; }
  .side-user { display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1px solid rgba(255,255,255,.08); }
  .side-user .avatar { background: var(--brand-3); }
  .side-user-text { flex: 1; min-width: 0; }
  .side-user-text strong { display: block; font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side-user-text small { color: #9fb0a7; font-size: 12px; }
  .side-sync { margin: 0 8px 12px; }
  .topbar { display: none; }
  .tabbar { display: none; }
  .view { padding: 30px 36px 60px; max-width: 1040px; }
  .view.has-actionbar { padding-bottom: 120px; }
  .view.narrow { max-width: 820px; }
  .actionbar { left: var(--sidebar-w); bottom: 0; padding: 14px 36px; }
  .editor-nav { top: 0; margin: -30px -36px 18px; padding: 12px 36px; }
  .editor-section { scroll-margin-top: 80px; }
  .page-head h1 { font-size: 28px; }
  .dlist.grid-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .home-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 24px; align-items: start; }
  .home-grid .section-title:first-child { margin-top: 0; }
  .dossier-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; }
  .dossier-grid .col > .card + .card { margin-top: 18px; }
  .toasts { left: var(--sidebar-w); }
  body:has(.actionbar) .toasts { bottom: 96px; }
  .home-grid { margin-top: 26px; }
  .desktop-only { display: initial; }
  .mobile-only { display: none !important; }
  .map-box { height: 330px; }
}
@media (max-width: 1023.98px) { .desktop-only { display: none !important; } }

/* --- Impression (dossier → PDF) ------------------------------------------ */
.print-head { display: none; }
@media print {
  @page { size: A4; margin: 14mm 14mm 16mm; }
  body { background: #fff; font-size: 11pt; }
  .sidebar, .topbar, .tabbar, .actionbar, .toasts, .banner, .no-print, .note-form, .status-panel, .contact-actions, .map-box, .editor-nav { display: none !important; }
  .shell { display: block; }
  .view { padding: 0 !important; max-width: none; animation: none; }
  .card { box-shadow: none; border: 0; border-radius: 0; break-inside: avoid; }
  .card + .card { margin-top: 8mm; }
  .card-head { padding: 0 0 3mm; border-bottom: 1.5pt solid #18211d; }
  .card-body, .dhead { padding: 3mm 0 0; }
  .dossier-grid { display: block; }
  .print-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2pt solid #18211d; padding-bottom: 4mm; margin-bottom: 6mm; }
  .print-head .print-logo { width: 42mm; height: auto; }
  .print-head .pt { font-size: 8pt; letter-spacing: .2em; text-transform: uppercase; color: #5b6760; margin-top: 2mm; }
  .items-table { font-size: 10pt; }
  .items-table tr { break-inside: avoid; }
  .timeline::before { display: none; }
  a { color: inherit; text-decoration: none; }
  .badge { border: 1px solid currentColor; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* --- Compléments -------------------------------------------------------- */
.modal > .picker { flex: 1; min-height: 0; }
.modal.picker-modal { max-width: 640px; }
@media (min-width: 720px) {
  .modal.full { height: min(780px, 90vh); }
}
.dcard .badge { height: 22px; font-size: 11.5px; padding: 0 8px; }
.card-head h2 .icon { color: var(--accent); }
.status-panel .seg button { min-height: 44px; font-size: 15px; }
.status-panel .seg button[data-status="traite"].is-active { background: var(--done); color: #fff; }
.status-panel .seg button[data-status="en_cours"].is-active { background: #fff; color: var(--progress); }
.user-row .btn + .btn { margin-left: 4px; }
.menu-link[disabled] { opacity: .45; cursor: not-allowed; }
.dossier-grid .col { min-width: 0; }
.dossier-grid .col > .card + .card, .col > section + section { margin-top: 14px; }
.home-grid > div { min-width: 0; }
