/* ==========================================================================
   Note Pit — feuille de styles
   Jetons de design (clair / sombre), layout, composants, vues.
   ========================================================================== */

/* ---------------------------------------------------------------- Jetons */
:root {
  color-scheme: light;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Segoe UI Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --bg: #f7f7f8;
  --bg-elev: #fbfbfc;
  --surface: #ffffff;
  --surface-2: #f3f4f6;
  --surface-3: #e9ebef;
  --surface-sunken: #f5f6f8;
  --border: #e6e7eb;
  --border-strong: #d4d6dc;
  --text: #15171c;
  --text-2: #3f4450;
  --text-3: #6a707c;
  --text-4: #9aa0aa;

  --accent: #5b5bd6;
  --accent-hover: #4a4ac4;
  --accent-soft: #eeefff;
  --accent-text: #4545b5;
  --accent-contrast: #ffffff;
  --ring: rgba(91, 91, 214, 0.32);

  --success: #16a34a;
  --success-soft: #ecfdf3;
  --success-text: #15803d;
  --warning: #d97706;
  --warning-soft: #fff8eb;
  --warning-text: #b45309;
  --danger: #dc2626;
  --danger-hover: #c81e1e;
  --danger-soft: #fef2f2;
  --danger-text: #c11f1f;

  --u-low: #64748b;
  --u-low-soft: #f1f4f8;
  --u-low-text: #475569;
  --u-medium: #3b82f6;
  --u-medium-soft: #edf4ff;
  --u-medium-text: #1d55c9;
  --u-high: #f97316;
  --u-high-soft: #fff4ea;
  --u-high-text: #c2410c;
  --u-critical: #ef4444;
  --u-critical-soft: #fff0f0;
  --u-critical-text: #c81e1e;

  --av-sat: 70%;
  --av-bg-l: 90%;
  --av-fg-l: 32%;

  --toast-bg: #17191f;
  --toast-text: #f5f6f8;
  --backdrop: rgba(15, 17, 22, 0.42);

  --shadow-xs: 0 1px 1px rgba(16, 24, 40, 0.04);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 4px 14px rgba(16, 24, 40, 0.08), 0 1px 3px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 18px 48px rgba(16, 24, 40, 0.18), 0 4px 12px rgba(16, 24, 40, 0.08);

  --radius-xs: 5px;
  --radius-sm: 7px;
  --radius: 9px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --sidebar-w: 256px;
  --topbar-h: 56px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d0e11;
    --bg-elev: #111317;
    --surface: #16181d;
    --surface-2: #1d2026;
    --surface-3: #262a31;
    --surface-sunken: #121418;
    --border: #262930;
    --border-strong: #353942;
    --text: #ececf0;
    --text-2: #c2c6ce;
    --text-3: #8d929d;
    --text-4: #626772;
    --accent: #7676ee;
    --accent-hover: #8a8af3;
    --accent-soft: rgba(118, 118, 238, 0.15);
    --accent-text: #a9a9ff;
    --accent-contrast: #ffffff;
    --ring: rgba(118, 118, 238, 0.42);
    --success: #22c55e;
    --success-soft: rgba(34, 197, 94, 0.13);
    --success-text: #6ee79a;
    --warning: #f59e0b;
    --warning-soft: rgba(245, 158, 11, 0.13);
    --warning-text: #fcc461;
    --danger: #ef4444;
    --danger-hover: #f05a5a;
    --danger-soft: rgba(239, 68, 68, 0.14);
    --danger-text: #ff8f8f;
    --u-low: #8a96a8;
    --u-low-soft: rgba(148, 163, 184, 0.13);
    --u-low-text: #c2cad6;
    --u-medium: #5b9bff;
    --u-medium-soft: rgba(91, 155, 255, 0.14);
    --u-medium-text: #9cc2ff;
    --u-high: #fb8a3c;
    --u-high-soft: rgba(251, 138, 60, 0.14);
    --u-high-text: #ffb27d;
    --u-critical: #f45656;
    --u-critical-soft: rgba(244, 86, 86, 0.15);
    --u-critical-text: #ff9a9a;
    --av-sat: 40%;
    --av-bg-l: 24%;
    --av-fg-l: 80%;
    --toast-bg: #f2f3f5;
    --toast-text: #15171c;
    --backdrop: rgba(0, 0, 0, 0.6);
    --shadow-xs: 0 1px 1px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6), 0 4px 14px rgba(0, 0, 0, 0.4);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0e11;
  --bg-elev: #111317;
  --surface: #16181d;
  --surface-2: #1d2026;
  --surface-3: #262a31;
  --surface-sunken: #121418;
  --border: #262930;
  --border-strong: #353942;
  --text: #ececf0;
  --text-2: #c2c6ce;
  --text-3: #8d929d;
  --text-4: #626772;
  --accent: #7676ee;
  --accent-hover: #8a8af3;
  --accent-soft: rgba(118, 118, 238, 0.15);
  --accent-text: #a9a9ff;
  --accent-contrast: #ffffff;
  --ring: rgba(118, 118, 238, 0.42);
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.13);
  --success-text: #6ee79a;
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.13);
  --warning-text: #fcc461;
  --danger: #ef4444;
  --danger-hover: #f05a5a;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --danger-text: #ff8f8f;
  --u-low: #8a96a8;
  --u-low-soft: rgba(148, 163, 184, 0.13);
  --u-low-text: #c2cad6;
  --u-medium: #5b9bff;
  --u-medium-soft: rgba(91, 155, 255, 0.14);
  --u-medium-text: #9cc2ff;
  --u-high: #fb8a3c;
  --u-high-soft: rgba(251, 138, 60, 0.14);
  --u-high-text: #ffb27d;
  --u-critical: #f45656;
  --u-critical-soft: rgba(244, 86, 86, 0.15);
  --u-critical-text: #ff9a9a;
  --av-sat: 40%;
  --av-bg-l: 24%;
  --av-fg-l: 80%;
  --toast-bg: #f2f3f5;
  --toast-text: #15171c;
  --backdrop: rgba(0, 0, 0, 0.6);
  --shadow-xs: 0 1px 1px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6), 0 4px 14px rgba(0, 0, 0, 0.4);
}

/* Couleurs d'urgence contextuelles */
.u-low { --u: var(--u-low); --u-bg: var(--u-low-soft); --u-fg: var(--u-low-text); }
.u-medium { --u: var(--u-medium); --u-bg: var(--u-medium-soft); --u-fg: var(--u-medium-text); }
.u-high { --u: var(--u-high); --u-bg: var(--u-high-soft); --u-fg: var(--u-high-text); }
.u-critical { --u: var(--u-critical); --u-bg: var(--u-critical-soft); --u-fg: var(--u-critical-text); }

/* ---------------------------------------------------------------- Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body:has(dialog[open]) { overflow: hidden; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.011em; line-height: 1.25; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
code, kbd, pre { font-family: var(--font-mono); font-size: 0.92em; }
:not(pre) > code {
  padding: 0.1em 0.38em;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 0.86em;
  overflow-wrap: break-word;
}
::selection { background: var(--accent-soft); color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.icon { flex: none; display: inline-block; vertical-align: middle; }
.logo { flex: none; color: var(--accent); }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.spacer { flex: 1 1 auto; }
.truncate { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: var(--text-3); }
.mono { font-family: var(--font-mono); font-size: 0.92em; }
.text-danger { color: var(--danger-text); }
.grow { flex: 1 1 auto; min-width: 0; }
.center-pad { display: grid; place-items: center; padding: 48px 16px; }
.only-mobile { display: none !important; }

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  padding: 8px 12px; border-radius: var(--radius); background: var(--accent); color: #fff;
}
.skip-link:focus { top: 12px; }

/* ---------------------------------------------------------------- Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font-size: 13px; font-weight: 500; line-height: 1;
  white-space: nowrap; text-decoration: none; user-select: none;
  box-shadow: var(--shadow-xs);
  transition: background-color .12s, border-color .12s, color .12s, box-shadow .12s, transform .06s;
  position: relative;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(0.5px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); border-color: var(--accent); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); box-shadow: 0 1px 2px rgba(60, 60, 180, .25), inset 0 1px 0 rgba(255,255,255,.12); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn-danger-ghost { color: var(--danger-text); }
.btn-danger-ghost:hover { background: var(--danger-soft); color: var(--danger-text); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: var(--radius-sm); }
.btn-xs { height: 24px; padding: 0 6px; font-size: 12px; border-radius: 6px; }
.btn-lg { height: 40px; padding: 0 16px; font-size: 14px; }
.btn-icon { width: 32px; padding: 0; }
.btn-sm.btn-icon { width: 28px; }
.btn-xs.btn-icon { width: 24px; }
.btn-block { width: 100%; }
.btn.is-busy { color: transparent !important; pointer-events: none; }
.btn.is-busy > * { visibility: hidden; }
.btn.is-busy::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 14px; height: 14px;
  border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  color: var(--text-3); animation: np-spin .7s linear infinite;
}
.btn-primary.is-busy::after, .btn-danger.is-busy::after { color: #fff; border-color: #fff; border-right-color: transparent; }

.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px;
  background: var(--surface); color: var(--text-3);
  font-family: var(--font-sans); font-size: 11px; font-weight: 500; line-height: 1;
}
.kbd-on-primary { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.28); color: rgba(255,255,255,.92); margin-left: 2px; }

/* ---------------------------------------------------------------- Formulaires */
.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 11px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-xs);
  transition: border-color .12s, box-shadow .12s, background-color .12s;
  min-width: 0;
}
.input::placeholder, .textarea::placeholder { color: var(--text-4); }
.input:hover, .select:hover, .textarea:hover { border-color: color-mix(in srgb, var(--border-strong) 60%, var(--text-4)); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.input[readonly] { background: var(--surface-sunken); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px var(--danger-soft); }
.input-sm, .select-sm { height: 30px; font-size: 13px; border-radius: var(--radius-sm); }
.input-lg { height: 42px; font-size: 16px; font-weight: 500; }
.textarea { height: auto; min-height: 92px; padding: 9px 11px; line-height: 1.55; resize: vertical; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b909c' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 14px;
  text-overflow: ellipsis;
}
.select.is-active, .input.is-active { border-color: color-mix(in srgb, var(--accent) 55%, var(--border-strong)); background-color: var(--accent-soft); color: var(--accent-text); }
input[type="date"].input { padding-right: 8px; }
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }

.input-icon { position: relative; display: flex; align-items: center; min-width: 0; }
.input-icon > .icon { position: absolute; left: 10px; color: var(--text-4); pointer-events: none; }
.input-icon > .input { padding-left: 32px; }
.input-group { display: flex; align-items: stretch; position: relative; }
.input-group > .input { padding-right: 42px; }
.input-addon {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 28px; display: grid; place-items: center;
  border: 0; border-radius: 6px; background: transparent; color: var(--text-3);
}
.input-addon:hover { background: var(--surface-2); color: var(--text); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.field-optional { font-weight: 400; color: var(--text-4); }
.field-hint { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.field-error { font-size: 12.5px; color: var(--danger-text); }
.fieldset { border: 0; padding: 0; margin: 0; }
.fieldset legend { padding: 0; margin-bottom: 8px; }
.form-stack { display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-error {
  display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px;
  border-radius: var(--radius); background: var(--danger-soft); color: var(--danger-text);
  border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent); font-size: 13px;
}
.form-error .icon { margin-top: 1px; }
.inline-form { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.inline-form .btn { height: 36px; }

.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.checkbox:hover { border-color: var(--border-strong); }
.checkbox code { margin-left: auto; font-size: 11px; color: var(--text-4); }
.checkbox input, .switch input { accent-color: var(--accent); }
.checkbox-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.checkbox input { width: 15px; height: 15px; margin: 0; }

.switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-track { width: 34px; height: 20px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-strong); transition: background .15s, border-color .15s; position: relative; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .18s var(--ease); }
.switch input:checked + .switch-track { background: var(--success); border-color: var(--success); }
.switch input:checked + .switch-track::after { transform: translateX(14px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px var(--ring); }

/* ---------------------------------------------------------------- Badges, pastilles */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 20px; padding: 0 7px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2);
  font-size: 11.5px; font-weight: 550; line-height: 1; white-space: nowrap;
  flex: none;
}
.badge-soft { background: var(--surface-2); color: var(--text-3); font-weight: 500; border: 1px solid var(--border); }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }
.badge-u { background: var(--u-bg); color: var(--u-fg); }
.badge-u.u-critical {
  background: var(--u-critical); color: #fff; font-weight: 650; letter-spacing: .01em;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--u-critical) 55%, transparent);
  animation: np-ring 2s var(--ease) infinite;
}
.badge-flame { color: #fff; }
.badge-status.st-in_progress { background: var(--warning-soft); color: var(--warning-text); }
.badge-status.st-done { background: var(--success-soft); color: var(--success-text); }
.badge-status.st-todo { background: var(--surface-2); color: var(--text-2); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--u, currentColor); flex: none; }
.dot-pulse { box-shadow: 0 0 0 0 color-mix(in srgb, var(--u-critical) 60%, transparent); animation: np-ring 1.8s var(--ease) infinite; }
.cdot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }

.status-icon { display: inline-grid; place-items: center; color: var(--text-4); flex: none; }
.status-icon.st-in_progress { color: var(--warning); }
.status-icon.st-done { color: var(--success); }

.avatar {
  --av-hue: 240;
  display: inline-grid; place-items: center; flex: none;
  width: 24px; height: 24px; border-radius: 50%;
  background: hsl(var(--av-hue) var(--av-sat) var(--av-bg-l));
  color: hsl(var(--av-hue) 55% var(--av-fg-l));
  font-size: 10px; font-weight: 650; letter-spacing: .02em; line-height: 1;
  user-select: none;
}
.avatar-md { width: 30px; height: 30px; font-size: 11.5px; }
.avatar-lg { width: 44px; height: 44px; font-size: 15px; }

.client-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 180px; color: var(--text-2); font-size: 12px; font-weight: 500; min-width: 0; }
.client-chip.is-internal { color: var(--text-3); }
.client-chip .icon { color: var(--text-4); }

.due { display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); font-size: 12px; white-space: nowrap; }
.due.is-today { color: var(--warning-text); font-weight: 550; }
.due.is-overdue { color: var(--danger-text); font-weight: 600; }

.tag {
  display: inline-flex; align-items: center; height: 19px; padding: 0 6px; border-radius: 5px;
  background: var(--surface-2); color: var(--text-3); font-size: 11.5px; font-weight: 500;
  border: 1px solid var(--border); white-space: nowrap; max-width: 140px; overflow: hidden; text-overflow: ellipsis;
}
.tag::before { content: "#"; opacity: .55; margin-right: 1px; }
.tag-more::before { content: none; }
.count-pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 18px; padding: 0 6px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-3);
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1;
  vertical-align: middle;
}

/* Barre empilée par urgence */
.stack { display: block; position: relative; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; min-width: 40px; }
.stack-fill { display: flex; height: 100%; border-radius: 999px; overflow: hidden; gap: 1.5px; transition: width .4s var(--ease); }
.stack .seg { display: block; height: 100%; min-width: 3px; }
.stack .s-critical { background: var(--u-critical); }
.stack .s-high { background: var(--u-high); }
.stack .s-medium { background: var(--u-medium); }
.stack .s-low { background: var(--u-low); }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-3); }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend .dot { width: 7px; height: 7px; }

/* Boutons segmentés */
.segmented {
  display: inline-flex; padding: 2px; gap: 2px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--border);
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.seg-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 28px; padding: 0 11px; border: 0; border-radius: 6px;
  background: transparent; color: var(--text-3); font-size: 13px; font-weight: 500; white-space: nowrap;
  transition: background .12s, color .12s, box-shadow .12s;
}
.seg-btn:hover { color: var(--text); }
.seg-btn[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--ring); }
.segmented-urgency { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; }
.segmented-urgency .seg-btn { height: 34px; }
.segmented-urgency .seg-btn[aria-checked="true"] { background: var(--u-bg); color: var(--u-fg); box-shadow: inset 0 0 0 1.5px var(--u); font-weight: 600; }
.segmented-urgency .seg-btn.u-critical[aria-checked="true"] { background: var(--u-critical); color: #fff; box-shadow: 0 2px 8px color-mix(in srgb, var(--u-critical) 40%, transparent); }
.segmented-urgency .seg-btn.u-critical[aria-checked="true"] .dot { background: #fff; }

/* Sélecteur de couleur */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch {
  --sw: #6366f1;
  width: 26px; height: 26px; border-radius: 8px; border: 0; padding: 0;
  background: var(--sw); box-shadow: inset 0 0 0 1px rgba(0,0,0,.1);
  transition: transform .12s var(--ease), box-shadow .12s;
  position: relative; display: inline-grid; place-items: center; color: #fff;
}
.swatch:hover { transform: scale(1.08); }
.swatch[aria-checked="true"], .swatch-custom.is-active { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--sw); }
.swatch[aria-checked="true"]::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.swatch-custom { background: conic-gradient(from 90deg, #ef4444, #f59e0b, #10b981, #0ea5e9, #8b5cf6, #ec4899, #ef4444); cursor: pointer; overflow: hidden; }
.swatch-custom.is-active { background: var(--sw); }
.swatch-custom .icon { color: #fff; filter: drop-shadow(0 1px 1px rgba(0,0,0,.4)); pointer-events: none; }
.swatch-custom-input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; border: 0; padding: 0; }
.swatch:focus-within, .swatch:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Bloc de code */
.code { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-sunken); overflow: hidden; min-width: 0; }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 4px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.code-lang { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-4); }
.code pre { margin: 0; padding: 12px 14px; overflow-x: auto; font-size: 12.5px; line-height: 1.6; color: var(--text-2); tab-size: 2; }

/* ---------------------------------------------------------------- Callouts, états vides, chargement */
.callout {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px;
  border-radius: var(--radius); background: var(--accent-soft); color: var(--text-2);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); font-size: 13px;
}
.callout > .icon { color: var(--accent-text); margin-top: 1px; }
.callout p { flex: 1; min-width: 0; }
.callout-warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 28%, transparent); }
.callout-warning > .icon { color: var(--warning-text); }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 48px 20px; color: var(--text-3); }
.empty-icon {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 6px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-3); box-shadow: var(--shadow-sm);
}
.empty-title { font-size: 15px; color: var(--text); font-weight: 600; }
.empty-text { max-width: 420px; font-size: 13.5px; }
.empty-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.empty-compact { padding: 20px 12px; gap: 4px; }
.empty-compact .empty-icon { width: 34px; height: 34px; border-radius: 10px; margin-bottom: 2px; box-shadow: none; }
.empty-compact .empty-title { font-size: 13px; font-weight: 550; }
.empty-compact .empty-text { font-size: 12.5px; }

.spinner { display: inline-block; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: np-spin .7s linear infinite; }
.boot { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; }
.skeleton-list { display: flex; flex-direction: column; gap: 8px; }
.skeleton {
  border-radius: var(--radius-lg);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%; animation: np-shimmer 1.4s ease infinite;
}

/* ---------------------------------------------------------------- Toasts */
.toasts {
  position: fixed; z-index: 1000; inset: auto 20px 20px auto;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  pointer-events: none; margin: 0; padding: 0; border: 0; background: transparent; overflow: visible;
  width: auto; height: auto; max-width: calc(100vw - 32px); color: inherit;
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px;
  min-width: 260px; max-width: 440px; padding: 10px 8px 10px 12px;
  border-radius: 11px; background: var(--toast-bg); color: var(--toast-text);
  box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 500;
  opacity: 0; transform: translateY(8px) scale(.98);
  transition: opacity .18s var(--ease), transform .18s var(--ease);
}
.toast.is-in { opacity: 1; transform: none; }
.toast.is-out { opacity: 0; transform: translateY(4px) scale(.98); }
.toast-icon { opacity: .9; }
.toast-success .toast-icon { color: #4ade80; }
.toast-error .toast-icon { color: #f87171; }
.toast-info .toast-icon { color: #a5a5ff; }
:root[data-theme="dark"] .toast-success .toast-icon { color: #16a34a; }
:root[data-theme="dark"] .toast-error .toast-icon { color: #dc2626; }
:root[data-theme="dark"] .toast-info .toast-icon { color: #5b5bd6; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .toast-success .toast-icon { color: #16a34a; }
  :root:not([data-theme="light"]) .toast-error .toast-icon { color: #dc2626; }
  :root:not([data-theme="light"]) .toast-info .toast-icon { color: #5b5bd6; }
}
.toast-msg { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-action { border: 0; background: transparent; color: inherit; font-weight: 650; padding: 5px 8px; border-radius: 6px; text-decoration: underline; text-underline-offset: 2px; }
.toast-action:hover { background: color-mix(in srgb, currentColor 12%, transparent); }
.toast-close { border: 0; background: transparent; color: inherit; opacity: .55; width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; padding: 0; }
.toast-close:hover { opacity: 1; background: color-mix(in srgb, currentColor 12%, transparent); }

/* ---------------------------------------------------------------- Modales */
.modal {
  padding: 0; margin: auto; border: 1px solid var(--border); border-radius: var(--radius-xl);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
  width: min(540px, calc(100vw - 32px)); max-width: none; max-height: min(88vh, 900px);
  flex-direction: column; overflow: hidden;
}
.modal[open] { display: flex; animation: np-modal-in .18s var(--ease); }
.modal.is-closing { animation: np-modal-out .13s ease-in forwards; }
.modal::backdrop { background: var(--backdrop); backdrop-filter: blur(2px); }
.modal[open]::backdrop { animation: np-fade-in .18s ease; }
.modal-sm { width: min(420px, calc(100vw - 32px)); }
.modal-lg { width: min(700px, calc(100vw - 32px)); }
.modal-header { display: flex; align-items: flex-start; gap: 12px; padding: 16px 16px 10px 20px; }
.modal-heading { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding-top: 3px; }
.modal-title { font-size: 16px; font-weight: 650; }
.modal-subtitle { font-size: 12.5px; color: var(--text-3); overflow-wrap: anywhere; }
.modal-body { padding: 6px 20px 18px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal-footer {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 16px 12px 20px; border-top: 1px solid var(--border); background: var(--bg-elev);
}
.footer-hint { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; color: var(--text-4); margin-right: 4px; }
.confirm-body { display: flex; gap: 12px; align-items: flex-start; }
.confirm-icon { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--danger-soft); color: var(--danger-text); }
.confirm-text { color: var(--text-2); font-size: 13.5px; padding-top: 6px; overflow-wrap: anywhere; }
.note-modal-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.note-modal-meta .badge { height: 18px; font-size: 11px; }

/* ---------------------------------------------------------------- Menus & popovers */
.menu, .popover {
  position: fixed; z-index: 900; min-width: 200px; max-width: min(320px, calc(100vw - 16px));
  padding: 5px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  animation: np-pop-in .12s var(--ease);
}
.menu-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  height: 32px; padding: 0 9px; border: 0; border-radius: 7px;
  background: transparent; color: var(--text-2); font-size: 13px; text-align: left;
}
.menu-item .icon { color: var(--text-3); }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); color: var(--text); outline: none; }
.menu-item.is-danger { color: var(--danger-text); }
.menu-item.is-danger .icon { color: var(--danger-text); }
.menu-item.is-danger:hover { background: var(--danger-soft); }
.menu-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-check { color: var(--accent-text) !important; }
.menu-sep { height: 1px; margin: 5px 4px; background: var(--border); }
.menu-heading { padding: 6px 9px 3px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.popover { padding: 12px; min-width: 0; }
.popover-title { font-size: 12px; font-weight: 600; color: var(--text-3); margin-bottom: 10px; }
.popover .swatches { max-width: 200px; }

/* ---------------------------------------------------------------- Layout authentifié */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; gap: 6px;
  padding: 12px 10px 10px; background: var(--bg-elev); border-right: 1px solid var(--border);
  overflow: hidden; z-index: 40;
}
.sidebar-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 8px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; color: var(--text); text-decoration: none; padding: 4px; border-radius: var(--radius); }
.brand:hover { text-decoration: none; background: var(--surface-2); }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand-name { font-weight: 700; font-size: 14.5px; letter-spacing: -0.02em; }
.brand-ws { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; margin: 0 -4px; padding: 0 4px; scrollbar-width: thin; }
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  height: 32px; padding: 0 9px; border-radius: 7px; border: 0;
  background: transparent; color: var(--text-2); font-size: 13.5px; font-weight: 500;
  text-decoration: none; text-align: left; transition: background .1s, color .1s;
}
.nav-item .icon { color: var(--text-3); }
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.is-active { background: var(--surface-3); color: var(--text); }
.nav-item.is-active .icon { color: var(--accent-text); }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-section { display: flex; flex-direction: column; gap: 1px; }
.nav-section-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 4px 9px; }
.nav-section-title { font-size: 11.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--text-4); text-decoration: none; border-radius: 4px; }
.nav-section-title:hover, .nav-section-title.is-active { color: var(--text-2); text-decoration: none; }
.nav-clients { list-style: none; display: flex; flex-direction: column; gap: 1px; }
.nav-client { height: 30px; font-size: 13px; }
.nav-client .cdot { margin: 0 2px; }
.nav-client-icon { display: inline-grid; place-items: center; width: 13px; }
.nav-client-icon .icon { color: var(--text-4); }
.nav-count { font-size: 11.5px; color: var(--text-4); font-variant-numeric: tabular-nums; font-weight: 550; padding: 0 2px; }
.nav-count.has-critical { color: #fff; background: var(--u-critical); border-radius: 999px; padding: 0 6px; min-width: 18px; height: 17px; display: inline-grid; place-items: center; font-weight: 650; }
.nav-add { color: var(--text-3); font-size: 13px; height: 30px; }
.nav-add .icon { color: var(--text-4); }
.nav-empty { padding: 4px 9px; font-size: 12.5px; color: var(--text-4); }
.sidebar-foot { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.user-btn {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px; border: 0; border-radius: var(--radius);
  background: transparent; text-align: left; color: var(--text);
}
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--surface-2); }
.user-btn-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.user-btn-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-btn-sub { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-btn-chevron { color: var(--text-4); }
.sidebar-backdrop { display: none; }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 10px; padding: 0 24px;
  background: var(--bg); background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(10px); backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.main { width: 100%; max-width: 1280px; margin: 0 auto; padding: 28px 32px 72px; outline: none; min-width: 0; }

/* Recherche globale */
.search { position: relative; display: flex; align-items: center; width: min(440px, 100%); min-width: 0; flex: 0 1 440px; }
.search-icon { position: absolute; left: 11px; color: var(--text-4); pointer-events: none; }
.search-input {
  width: 100%; height: 34px; padding: 0 36px 0 33px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-size: 13.5px; box-shadow: var(--shadow-xs);
  transition: border-color .12s, box-shadow .12s;
}
.search-input::placeholder { color: var(--text-4); }
.search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.search-input::-webkit-search-cancel-button { display: none; }
.search .kbd { position: absolute; right: 8px; pointer-events: none; }
.search-input:focus ~ .kbd { display: none; }
.search-panel {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 50;
  padding: 5px; max-height: min(420px, 70vh); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  animation: np-pop-in .12s var(--ease);
}
.search-group { padding: 7px 9px 4px; font-size: 11px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--text-4); }
.search-option { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 7px; cursor: pointer; min-width: 0; font-size: 13px; }
.search-option.is-active { background: var(--surface-2); }
.search-option-main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.search-option-main.is-done { text-decoration: line-through; color: var(--text-3); }
.search-option-sub { flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); font-size: 12px; }
.search-option > .icon { color: var(--text-3); }
.search-empty { padding: 6px 9px 8px; font-size: 12.5px; color: var(--text-4); }

/* ---------------------------------------------------------------- En-têtes de page, barres d'outils */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-heading { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.page-eyebrow { font-size: 12px; color: var(--text-3); font-weight: 500; }
.page-title { font-size: 23px; font-weight: 700; letter-spacing: -0.022em; display: flex; align-items: center; gap: 10px; }
.page-title .count-pill { font-size: 12px; height: 20px; min-width: 24px; }
.page-subtitle { color: var(--text-3); font-size: 13.5px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.title-row { display: flex; align-items: center; gap: 10px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar-search { flex: 0 1 300px; min-width: 180px; }
.section-label { font-size: 11.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--text-4); margin: 4px 0 8px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); }

/* ---------------------------------------------------------------- Filtres */
.filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; min-width: 0; flex: 1; }
.filters-main { display: flex; gap: 8px; align-items: center; min-width: 0; }
.filters-search { flex: 1 1 260px; min-width: 0; max-width: 420px; }
.filters-sort { width: auto; flex: 0 0 auto; max-width: 170px; }
.filters-toggle { display: none; }
.filters-more { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters-more .select { width: auto; max-width: 200px; }
.filters-tag { width: 150px; }
.filters-tag .input { padding-left: 30px; }
.chip-group { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.chip-toggle {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface);
  color: var(--text-2); font-size: 12.5px; font-weight: 500; transition: background .12s, border-color .12s, color .12s;
}
.chip-toggle:hover { background: var(--surface-2); }
.chip-toggle[aria-pressed="true"] { background: var(--u-bg); border-color: var(--u); color: var(--u-fg); font-weight: 600; }
.chip-toggle.u-critical[aria-pressed="true"] { background: var(--u-critical); color: #fff; }
.chip-toggle.u-critical[aria-pressed="true"] .dot { background: #fff; }
.chip-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.filters-slot { flex: 1; min-width: 0; display: flex; }
.filters-slot .filters { margin-bottom: 0; }
.toolbar-client { align-items: flex-start; }

/* ---------------------------------------------------------------- Cartes de notes */
.note-list { display: flex; flex-direction: column; gap: 6px; }
.notes-list { transition: opacity .15s; }
.notes-list.is-loading { opacity: .55; }
.note-card {
  position: relative; display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--border); border-left: 3px solid var(--u, var(--border-strong));
  border-radius: 10px; background: var(--surface); cursor: pointer; min-width: 0;
  transition: box-shadow .15s, border-color .15s, background-color .15s, opacity .2s;
}
.note-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); border-left-color: var(--u); }
.note-card.u-critical { background: linear-gradient(90deg, var(--u-critical-soft), var(--surface) 55%); }
.note-card.is-done { opacity: .66; }
.note-card.is-done .note-title { text-decoration: line-through; text-decoration-color: var(--text-4); color: var(--text-3); }
.note-card.is-done.u-critical { background: var(--surface); }
.note-card.is-compact { padding: 9px 10px; }
.note-card.is-draggable { cursor: grab; }
.note-card.is-dragging { opacity: .35; cursor: grabbing; }
.check {
  flex: none; display: grid; place-items: center; width: 18px; height: 18px; margin-top: 1px; padding: 0;
  border: 1.5px solid var(--border-strong); border-radius: 50%; background: var(--surface); color: transparent;
  transition: background .15s, border-color .15s, color .15s, transform .15s var(--ease);
}
.check:hover { border-color: var(--success); color: var(--success); }
.check[aria-checked="true"] { background: var(--success); border-color: var(--success); color: #fff; }
.just-toggled .check[aria-checked="true"] { animation: np-pop .3s var(--ease); }
.check:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.note-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.note-title {
  display: block; padding: 0; margin: 0; border: 0; background: none; text-align: left;
  color: var(--text); font-size: 13.5px; font-weight: 550; line-height: 1.4; cursor: pointer;
  overflow-wrap: anywhere;
}
.note-title:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.note-excerpt { color: var(--text-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: -2px; }
.note-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 9px; font-size: 12px; color: var(--text-3); min-width: 0; }
.note-side { flex: none; display: flex; align-items: center; }

/* ---------------------------------------------------------------- Modale de note */
.note-form { display: flex; flex-direction: column; gap: 16px; }
.quick-dates { display: flex; gap: 4px; flex-wrap: wrap; }
.chip-btn {
  height: 24px; padding: 0 8px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-3); font-size: 11.5px; font-weight: 500;
}
.chip-btn:hover { color: var(--text); border-color: var(--border-strong); }
.chips-input {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px; min-height: 36px; padding: 4px 6px;
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); cursor: text;
  box-shadow: var(--shadow-xs); transition: border-color .12s, box-shadow .12s;
}
.chips-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.chips { display: contents; }
.chip {
  display: inline-flex; align-items: center; gap: 2px; height: 24px; padding: 0 3px 0 8px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent-text); font-size: 12.5px; font-weight: 550; max-width: 100%;
}
.chip-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-label::before { content: "#"; opacity: .6; }
.chip-x { display: grid; place-items: center; width: 18px; height: 18px; border: 0; border-radius: 4px; background: transparent; color: inherit; padding: 0; opacity: .7; }
.chip-x:hover { opacity: 1; background: color-mix(in srgb, currentColor 14%, transparent); }
.chips-field { flex: 1 1 120px; min-width: 100px; height: 26px; border: 0; outline: none; background: transparent; padding: 0 4px; font-size: 13.5px; }
.note-body-input { min-height: 110px; }

/* ---------------------------------------------------------------- Partage */
.share-dialog { display: flex; flex-direction: column; gap: 14px; }
.share-create { display: flex; gap: 8px; flex-wrap: wrap; }
.share-create .select { width: auto; flex: 1 1 170px; }
.share-list { display: flex; flex-direction: column; gap: 8px; }
.share-row { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); transition: border-color .3s, background .3s; }
.share-row.is-fresh { border-color: color-mix(in srgb, var(--success) 50%, var(--border)); background: var(--success-soft); }
.share-url { display: flex; gap: 6px; align-items: center; min-width: 0; }
.share-url .input { flex: 1; min-width: 0; font-size: 12px; }
.share-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--text-3); }
.share-meta > span + span::before { content: "·"; margin-right: 8px; color: var(--text-4); }

/* ---------------------------------------------------------------- Authentification */
.bare-root, .public-root { min-height: 100vh; min-height: 100dvh; }
.auth {
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 16px; gap: 18px; position: relative;
  background:
    radial-gradient(800px 400px at 50% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
    var(--bg);
}
.auth-top { position: absolute; top: 12px; right: 12px; }
.auth-card {
  width: min(420px, 100%); padding: 28px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 6px;
}
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.auth-brand-name { font-size: 18px; font-weight: 750; letter-spacing: -0.03em; }
.auth-title { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; }
.auth-sub { color: var(--text-3); font-size: 13.5px; margin-bottom: 14px; }
.auth-note { margin-top: 14px; font-size: 12.5px; color: var(--text-3); text-align: center; }
.auth-foot { font-size: 12.5px; color: var(--text-4); }
.auth-loading { display: grid; place-items: center; padding: 40px 0; }
.auth-invalid { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.auth-invalid .empty-icon { margin-bottom: 4px; }
.auth .callout { margin-bottom: 14px; }

.fatal { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.fatal-card { width: min(420px, 100%); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 32px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-md); }
.fatal-card h1 { font-size: 18px; }
.fatal-card p { color: var(--text-3); margin-bottom: 8px; }

/* ---------------------------------------------------------------- Vue entreprise */
.dash { display: flex; flex-direction: column; gap: 18px; }
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.kpi {
  position: relative; display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 13px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  color: var(--text); text-decoration: none; box-shadow: var(--shadow-xs);
  transition: box-shadow .15s, border-color .15s, transform .15s var(--ease);
  overflow: hidden; min-width: 0;
}
.kpi:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kpi-label { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-3); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-icon { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--surface-2); color: var(--text-3); flex: none; }
.kpi-value { font-size: 27px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.kpi.tone-critical.has-value { border-color: color-mix(in srgb, var(--u-critical) 45%, var(--border)); background: linear-gradient(160deg, var(--u-critical-soft), var(--surface) 70%); }
.kpi.tone-critical.has-value .kpi-value { color: var(--u-critical-text); }
.kpi.tone-critical.has-value .kpi-icon { background: var(--u-critical); color: #fff; }
.kpi.tone-warning.has-value .kpi-value { color: var(--warning-text); }
.kpi.tone-warning.has-value .kpi-icon { background: var(--warning-soft); color: var(--warning-text); }
.kpi.tone-success.has-value .kpi-icon { background: var(--success-soft); color: var(--success-text); }
.kpi-pulse { position: absolute; top: 14px; right: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--u-critical); animation: np-ring 1.8s var(--ease) infinite; }

.dash-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.dash-bottom { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; min-width: 0; box-shadow: var(--shadow-xs); }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-bottom: 1px solid var(--border); min-height: 46px; flex-wrap: wrap; }
.panel-icon { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: var(--surface-2); color: var(--text-3); }
.panel-title { font-size: 13.5px; font-weight: 650; }
.panel-link { display: inline-flex; align-items: center; gap: 2px; font-size: 12.5px; color: var(--text-3); font-weight: 500; }
.panel-link:hover { color: var(--text); text-decoration: none; }
.panel-body { padding: 10px; display: flex; flex-direction: column; gap: 6px; max-height: 440px; overflow-y: auto; }
.panel-body-flush { padding: 6px; max-height: none; }
.dash-col.tone-critical .panel-icon { background: var(--u-critical); color: #fff; }
.dash-col.tone-critical { border-top: 2px solid var(--u-critical); }
.dash-col.tone-warning .panel-icon { background: var(--warning-soft); color: var(--warning-text); }
.dash-col .panel-body { background: var(--bg-elev); border-radius: 0 0 var(--radius-lg) var(--radius-lg); min-height: 120px; }

.client-bars { display: flex; flex-direction: column; gap: 2px; }
.cbar { display: grid; grid-template-columns: minmax(0, 190px) minmax(0, 1fr) 30px; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
.cbar:hover { background: var(--surface-2); text-decoration: none; }
.cbar-name { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; font-weight: 500; }
.cbar-internal { display: inline-grid; place-items: center; width: 9px; color: var(--text-3); }
.cbar-count { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; color: var(--text-2); font-size: 13px; }
.cbar .stack { height: 10px; }

.activity { list-style: none; display: flex; flex-direction: column; }
.activity-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; text-align: left; color: var(--text); min-width: 0; }
.activity-row:hover { background: var(--surface-2); }
.activity-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.activity-title { font-size: 13px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-title.is-done { text-decoration: line-through; color: var(--text-3); }
.activity-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); min-width: 0; overflow: hidden; white-space: nowrap; }
.activity-meta > span + span::before { content: "·"; margin-right: 8px; color: var(--text-4); }
.activity-meta .client-chip { max-width: 140px; }

.welcome {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 18px 20px; border-radius: var(--radius-lg);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
  background: linear-gradient(120deg, var(--accent-soft), var(--surface) 70%);
}
.welcome-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent); color: #fff; flex: none; box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent); }
.welcome-text { flex: 1 1 300px; min-width: 0; }
.welcome-text h2 { font-size: 15.5px; margin-bottom: 3px; }
.welcome-text p { color: var(--text-3); font-size: 13.5px; }
.welcome-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- Clients */
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.client-grid.is-empty { display: block; }
.client-card {
  --client: #6366f1;
  position: relative; display: flex; flex-direction: column; gap: 12px; padding: 16px 16px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs); overflow: hidden; min-width: 0;
  transition: box-shadow .15s, border-color .15s, transform .15s var(--ease);
}
.client-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); transform: translateY(-1px); }
.client-card.is-archived { opacity: .75; }
.client-card-band { position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--client); }
.client-card-head { display: flex; align-items: flex-start; gap: 11px; }
.client-avatar {
  flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: var(--client, #6366f1); color: #fff; font-weight: 700; font-size: 15px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08), 0 2px 6px color-mix(in srgb, var(--client, #6366f1) 30%, transparent);
}
.client-avatar-lg { width: 48px; height: 48px; font-size: 20px; border-radius: 13px; }
.client-card-title { flex: 1; min-width: 0; }
.client-card-title h3 { font-size: 14.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-card-title a { color: var(--text); }
.client-card-title a:hover { text-decoration: none; }
.stretched::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.stretched:focus-visible { outline: none; }
.stretched:focus-visible::after { box-shadow: inset 0 0 0 2px var(--accent); border-radius: var(--radius-lg); }
.client-card-company { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-menu { position: relative; z-index: 2; margin: -4px -6px 0 0; }
.client-card-desc { font-size: 13px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; overflow-wrap: anywhere; }
.client-card-desc.is-empty { color: var(--text-4); font-style: italic; }
.client-card-stats, .client-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 12.5px; color: var(--text-2); }
.stat { display: inline-flex; align-items: center; gap: 4px; }
.stat strong { font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-critical { color: var(--u-critical-text); font-weight: 600; }
.stat-overdue { color: var(--danger-text); font-weight: 550; }
.stat-muted { color: var(--text-3); }
.client-card-foot { display: flex; align-items: center; gap: 8px; justify-content: space-between; font-size: 12px; color: var(--text-4); border-top: 1px solid var(--border); padding-top: 10px; margin-top: auto; }

/* Vue client */
.client-header { --client: #6366f1; display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.breadcrumb { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--text-3); min-width: 0; }
.breadcrumb a { color: var(--text-3); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb .icon { color: var(--text-4); }
.client-header-main { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.client-color-btn {
  flex: none; width: 44px; height: 44px; border-radius: 12px; border: 0; padding: 0; margin-top: 2px;
  background: var(--client); box-shadow: inset 0 0 0 1px rgba(0,0,0,.08), 0 4px 12px color-mix(in srgb, var(--client) 35%, transparent);
  transition: transform .12s var(--ease);
}
.client-color-btn:hover { transform: scale(1.05); }
.client-color-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--client); }
.client-header-text { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 0; }
.inline-edit {
  width: 100%; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--text);
  padding: 2px 6px; margin-left: -7px; transition: background .12s, border-color .12s, box-shadow .12s;
}
.inline-edit:hover { background: var(--surface-2); }
.inline-edit:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.inline-edit::placeholder { color: var(--text-4); }
.inline-title { font-size: 24px; font-weight: 700; letter-spacing: -0.022em; height: 38px; }
.inline-sub { font-size: 13.5px; color: var(--text-3); height: 28px; }
.inline-desc { resize: none; font-size: 13.5px; line-height: 1.55; color: var(--text-2); min-height: 32px; padding: 5px 6px; max-width: 820px; overflow: hidden; }
.saved-hint { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--success-text); opacity: 0; transition: opacity .2s; }
.saved-hint.is-visible { opacity: 1; }
.client-stats { padding-top: 2px; }
.client-stats-bar { flex: 1 1 160px; max-width: 280px; min-width: 120px; }
.client-archived { margin-top: 4px; align-items: center; }

.groups { display: flex; flex-direction: column; gap: 22px; }
.group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 0 2px; }
.group-title { font-size: 13px; font-weight: 650; color: var(--text-2); }
.group.u-critical .group-title { color: var(--u-critical-text); }

.kanban { display: grid; grid-template-columns: repeat(3, minmax(220px, 1fr)); gap: 14px; align-items: start; overflow-x: auto; padding-bottom: 6px; }
.kanban-col {
  display: flex; flex-direction: column; gap: 8px; min-height: 240px; padding: 8px;
  border-radius: var(--radius-lg); background: var(--surface-sunken); border: 1px solid var(--border);
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.kanban.is-dragging .kanban-col { border-style: dashed; }
.kanban-col.is-over { background: var(--accent-soft); border-color: var(--accent); border-style: solid; box-shadow: 0 0 0 3px var(--ring); }
.kanban-head { display: flex; align-items: center; gap: 7px; padding: 4px 4px 2px 6px; }
.kanban-head h3 { font-size: 13px; font-weight: 650; }
.kanban-list { display: flex; flex-direction: column; gap: 6px; min-height: 60px; flex: 1; }
.kanban-empty { display: grid; place-items: center; min-height: 80px; border: 1.5px dashed var(--border-strong); border-radius: 10px; color: var(--text-4); font-size: 12.5px; }

.load-more { display: flex; justify-content: center; padding: 18px 0 0; }

/* ---------------------------------------------------------------- Paramètres */
.settings-nav { display: flex; gap: 4px; flex-wrap: wrap; margin: -8px 0 18px; }
.settings-nav-item { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); font-size: 12.5px; font-weight: 500; box-shadow: var(--shadow-xs); }
.settings-nav-item:hover { text-decoration: none; color: var(--text); border-color: var(--border-strong); }
.settings { display: flex; flex-direction: column; gap: 18px; max-width: 920px; }
.settings-section { scroll-margin-top: calc(var(--topbar-h) + 60px); overflow: hidden; }
.settings-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.settings-head-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.settings-head-text { flex: 1 1 240px; min-width: 0; }
.settings-head-text h2 { font-size: 15px; font-weight: 650; }
.settings-head-text p { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.settings-head-actions { display: flex; gap: 8px; align-items: center; }
.settings-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 16px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.profile { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius); background: var(--bg-elev); border: 1px solid var(--border); min-width: 0; }
.profile > div { min-width: 0; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.profile-name { font-weight: 650; }
.profile-sub { font-size: 12.5px; color: var(--text-3); overflow-wrap: anywhere; }
.secret-field { display: flex; gap: 8px; }
.secret-field .input { flex: 1; font-size: 12.5px; }
.rows { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.rows > .skeleton-list, .rows > .empty { border: 0; }
.rows > .skeleton-list { padding: 8px; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; min-width: 0; background: var(--surface); flex-wrap: wrap; }
.row + .row { border-top: 1px solid var(--border); }
.row-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-3); flex: none; }
.row-main { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.row-title.mono { font-weight: 500; font-size: 12.5px; display: block; }
.row-sub { font-size: 12.5px; color: var(--text-3); overflow-wrap: anywhere; }
.row-sub code { font-size: 11.5px; }
.row-meta { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.row-actions { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.webhook-form { display: flex; flex-direction: column; gap: 14px; padding: 14px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--bg-elev); }
.webhook-row.is-inactive .row-main { opacity: .6; }
.chips-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 3px; }
.chips-inline .tag::before { content: none; }
.delivery { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-3); margin-left: 4px; }
.delivery-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-4); }
.delivery.is-good { color: var(--success-text); }
.delivery.is-good .delivery-dot { background: var(--success); }
.delivery.is-bad { color: var(--danger-text); }
.delivery.is-bad .delivery-dot { background: var(--danger); }

/* ---------------------------------------------------------------- Synchronisation des outils locaux */
.badge-success { background: var(--success-soft); color: var(--success-text); }
.badge-source { height: 18px; padding: 0 6px; font-size: 11px; gap: 4px; color: var(--text-2); }
.badge-source .icon { color: var(--accent-text); }
.source-link { display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); font-size: 12px; white-space: nowrap; }
.source-link:hover { color: var(--accent-text); }
.delivery.is-warn { color: var(--warning-text); }
.delivery.is-warn .delivery-dot { background: var(--warning); }
.sync-state { display: flex; flex-direction: column; gap: 10px; }
.sync-state-main, .sync-last { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; }
.sync-last .delivery { margin-left: 0; }
.sync-error { color: var(--danger-text); }
.sync-run .delivery { margin-left: 0; }
.sync-run .row-title { font-weight: 550; }
.sync-line { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-4); }
.sync-line:hover { color: var(--text-2); text-decoration: none; }
.sync-line.is-bad { color: var(--warning-text); }

/* ---------------------------------------------------------------- Documentation */
.docs { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 28px; align-items: start; }
.docs-toc { position: sticky; top: calc(var(--topbar-h) + 20px); display: flex; flex-direction: column; gap: 6px; max-height: calc(100vh - var(--topbar-h) - 40px); overflow-y: auto; }
.toc-title { font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--text-4); padding: 8px 8px 2px; }
.toc-list { list-style: none; display: flex; flex-direction: column; gap: 1px; }
.toc-list a { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 5px 8px; border-radius: 6px; color: var(--text-2); font-size: 13px; }
.toc-list a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.toc-list .muted { padding: 5px 8px; font-size: 12.5px; }
.toc-count { font-size: 11px; color: var(--text-4); font-variant-numeric: tabular-nums; }
.docs-content { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.doc-section { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; scroll-margin-top: calc(var(--topbar-h) + 16px); min-width: 0; }
#reference.doc-section { padding: 6px 0 0; }
.doc-h2 { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 650; }
.doc-h2-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.doc-section p { color: var(--text-2); font-size: 13.5px; line-height: 1.6; }
.steps { padding-left: 20px; display: flex; flex-direction: column; gap: 4px; color: var(--text-2); font-size: 13.5px; }
.ref-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ref-filter { flex: 0 1 320px; min-width: 200px; }
.docs-ref { display: flex; flex-direction: column; gap: 22px; }
.ref-intro { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.ref-intro-head { display: flex; align-items: center; gap: 8px; }
.ref-intro p { font-size: 13px; color: var(--text-2); }
.ref-group { display: flex; flex-direction: column; gap: 8px; scroll-margin-top: calc(var(--topbar-h) + 16px); }
.ref-group-title { display: flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 650; }
.ops { display: flex; flex-direction: column; gap: 6px; }
.op { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; scroll-margin-top: calc(var(--topbar-h) + 16px); }
.op[open] { box-shadow: var(--shadow-sm); border-color: var(--border-strong); }
.op-summary { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; list-style: none; min-width: 0; }
.op-summary::-webkit-details-marker { display: none; }
.op-summary:hover { background: var(--surface-2); }
.op-summary:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.method { flex: none; display: inline-grid; place-items: center; min-width: 58px; height: 22px; padding: 0 6px; border-radius: 6px; font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: .03em; }
.m-get { background: var(--success-soft); color: var(--success-text); }
.m-post { background: var(--u-medium-soft); color: var(--u-medium-text); }
.m-put, .m-patch { background: var(--warning-soft); color: var(--warning-text); }
.m-delete { background: var(--danger-soft); color: var(--danger-text); }
.op-path { flex: none; font-size: 12.5px; font-weight: 600; color: var(--text); background: none !important; border: 0 !important; padding: 0 !important; white-space: nowrap; }
.op-title { flex: 1 1 auto; min-width: 0; color: var(--text-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sec { flex: none; display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-4); }
.sec-public { color: var(--success-text); }
.sec-session { color: var(--warning-text); }
.op-chevron { color: var(--text-4); transition: transform .15s; }
.op[open] .op-chevron { transform: rotate(180deg); }
.op-body { padding: 4px 14px 16px; display: flex; flex-direction: column; gap: 14px; border-top: 1px solid var(--border); }
.op-desc p { font-size: 13px; color: var(--text-2); margin-top: 8px; }
.op-block { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.op-block h4 { font-size: 11.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th { text-align: left; font-weight: 600; color: var(--text-3); background: var(--bg-elev); padding: 7px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--text-2); }
.table tr:last-child td { border-bottom: 0; }
.prop-name { font-weight: 600; color: var(--text) !important; white-space: nowrap; }
.prop-type { color: var(--accent-text) !important; background: var(--accent-soft) !important; border-color: transparent !important; }
.prop-default { color: var(--text-3); font-size: 11.5px; }
.req { display: inline-block; margin-left: 6px; font-size: 10px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--danger-text); }
.responses { list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.responses li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.code-badge { display: inline-grid; place-items: center; min-width: 38px; height: 20px; border-radius: 5px; font-family: var(--font-mono); font-size: 11px; font-weight: 700; background: var(--surface-2); color: var(--text-2); }
.c-2xx { background: var(--success-soft); color: var(--success-text); }
.c-4xx { background: var(--warning-soft); color: var(--warning-text); }
.c-5xx { background: var(--danger-soft); color: var(--danger-text); }

/* ---------------------------------------------------------------- Vue publique */
.public { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: radial-gradient(900px 380px at 50% -12%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%), var(--bg); }
.public-header { display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 24px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 80%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 10; }
.public-header .brand { flex: none; }
.public-header .brand:hover { background: none; }
.public-ws { font-size: 13px; color: var(--text-3); padding-left: 12px; border-left: 1px solid var(--border); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.public-ws:empty { display: none; }
.public-main { flex: 1; width: 100%; max-width: 860px; margin: 0 auto; padding: 32px 20px 56px; min-width: 0; }
.public-footer { text-align: center; font-size: 12px; color: var(--text-4); padding: 20px 16px 28px; }
.public-note { padding: 26px 28px; border-left: 4px solid var(--u); display: flex; flex-direction: column; gap: 18px; }
.public-title { font-size: 25px; font-weight: 700; letter-spacing: -0.022em; overflow-wrap: anywhere; }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 18px; margin: 0; padding: 14px 16px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); }
.meta-item dt { font-size: 11.5px; font-weight: 600; color: var(--text-4); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 5px; }
.meta-item dd { margin: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.inline-person { display: inline-flex; align-items: center; gap: 7px; }
.tags { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; line-height: 1.7; color: var(--text-2); }
.public-updated { font-size: 12px; color: var(--text-4); }
.public-client { display: flex; flex-direction: column; gap: 22px; }
.public-client-head { --client: #6366f1; padding: 22px 24px; display: flex; flex-direction: column; gap: 12px; border-top: 4px solid var(--client); }
.public-client-top { display: flex; align-items: center; gap: 14px; min-width: 0; }
.public-client-top > div { min-width: 0; }
.public-desc { color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.public-card { display: block; padding: 0; cursor: default; }
.public-card > summary { display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; cursor: pointer; list-style: none; }
.public-card > summary::-webkit-details-marker { display: none; }
.public-card > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 8px; }
.public-card .note-title { cursor: pointer; }
.public-card-chevron { color: var(--text-4); margin-top: 2px; transition: transform .15s; flex: none; }
.public-card[open] .public-card-chevron { transform: rotate(180deg); }
.public-card-body { padding: 2px 14px 14px 14px; display: flex; flex-direction: column; gap: 10px; border-top: 1px dashed var(--border); margin: 0 2px; padding-top: 12px; }
.public-card-body .prose { font-size: 13.5px; }

/* ---------------------------------------------------------------- Animations */
@keyframes np-spin { to { transform: rotate(360deg); } }
@keyframes np-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@keyframes np-ring {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--u-critical) 55%, transparent); }
  70% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--u-critical) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--u-critical) 0%, transparent); }
}
@keyframes np-pop { 0% { transform: scale(.7); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes np-modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes np-modal-out { to { opacity: 0; transform: translateY(6px) scale(.98); } }
@keyframes np-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes np-pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes np-sheet-in { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .skeleton { animation: none; }
}

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 1240px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  .dash-cols { grid-template-columns: minmax(0, 1fr); }
  .dash-bottom { grid-template-columns: minmax(0, 1fr); }
  .docs { grid-template-columns: minmax(0, 1fr); }
  .docs-toc { display: none; }
}
@media (max-width: 900px) {
  .only-mobile { display: inline-flex !important; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 60;
    transform: translateX(-102%); transition: transform .22s var(--ease); box-shadow: var(--shadow-lg);
    visibility: hidden;
  }
  .app.sidebar-open .sidebar { transform: none; visibility: visible; }
  .sidebar-backdrop {
    display: block; position: fixed; inset: 0; z-index: 55; background: var(--backdrop);
    opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  .app.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  .topbar { padding: 0 12px; gap: 8px; }
  .search { flex: 1 1 auto; }
  .search .kbd { display: none; }
  .main { padding: 20px 16px 88px; }
  .kanban { grid-template-columns: repeat(3, minmax(260px, 82vw)); scroll-snap-type: x mandatory; margin: 0 -16px; padding: 0 16px 8px; scroll-padding: 0 16px; }
  .kanban-col { scroll-snap-align: start; }
  .filters-toggle { display: inline-flex; }
  .filters-more { display: none; }
  .filters.is-open .filters-more { display: flex; }
  .filters-sort { max-width: 140px; }
  .settings-nav { position: static; }
}
@media (max-width: 640px) {
  .hide-sm { display: none !important; }
  .page-header { margin-bottom: 16px; align-items: flex-start; }
  .page-title { font-size: 20px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 12px; }
  .kpi-value { font-size: 23px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .checkbox-grid { grid-template-columns: minmax(0, 1fr); }
  .cbar { grid-template-columns: minmax(0, 110px) minmax(0, 1fr) 26px; gap: 8px; }
  .client-grid { grid-template-columns: minmax(0, 1fr); }
  .toolbar-search { flex: 1 1 100%; }
  .filters-search { max-width: none; }
  .filters-more .select { flex: 1 1 calc(50% - 4px); max-width: none; }
  .filters-tag { flex: 1 1 calc(50% - 4px); width: auto; }
  .inline-title { font-size: 20px; height: 34px; }
  .client-header-main .page-actions { width: 100%; }
  .client-header-main .page-actions .btn-primary { margin-left: auto; }
  .toolbar-client { flex-direction: column; align-items: stretch; }
  .toolbar-client .segmented { align-self: flex-start; }
  .public-header { padding: 0 14px; }
  .public-main { padding: 20px 14px 40px; }
  .public-note { padding: 18px 16px; }
  .public-title { font-size: 21px; }
  .doc-section { padding: 16px 14px; }
  .settings-head, .settings-body { padding-left: 14px; padding-right: 14px; }
  .inline-form .btn { width: 100%; }
  .secret-field { flex-direction: column; }
  .auth-card { padding: 22px 18px; }
  .toasts { inset: auto 12px 12px 12px; align-items: stretch; }
  .toast { min-width: 0; max-width: none; }
  .op-title { display: none; }
  /* Modales en feuille du bas */
  .modal, .modal-sm, .modal-lg {
    width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 18px 18px 0 0;
    border-left: 0; border-right: 0; border-bottom: 0;
  }
  .modal[open] { animation: np-sheet-in .22s var(--ease); }
  .modal-footer { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .footer-hint { display: none; }
}
@media (max-width: 420px) {
  .hide-xs { display: none !important; }
  .topbar .btn-primary { width: 34px; padding: 0; }
  .segmented-urgency .seg-btn { padding: 0 4px; font-size: 12px; gap: 4px; }
  .modal-footer .btn { padding: 0 10px; }
}

@media print {
  .sidebar, .topbar, .toasts, .public-header .btn { display: none !important; }
  .app { display: block; }
}
