/* =========================================================
   BEELY TICKETS — Maquette front
   Reprend les design tokens du site principal (charte Beely).
   BEM · thème sombre & clair · responsive desktop-first
   ========================================================= */

@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Marque */
  --color-primary: #1e69fe;
  --color-primary-t5: rgba(30, 105, 254, 0.21);
  --color-pink: #ff2d55;
  --on-primary: #ffffff;

  /* Thème SOMBRE (défaut) */
  --color-d6: #0d0d0d;          /* fond de page */
  --color-d2: #1e1d1d;          /* surfaces */
  --surface-2: #262525;         /* surfaces secondaires (inputs, hovers) */
  --color-white: #ffffff;
  --color-w-t1: rgba(255, 255, 255, 0.84);
  --color-w-t3: rgba(255, 255, 255, 0.53);
  --color-w-t5: rgba(255, 255, 255, 0.18);
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.16);
  --shadow: 0 18px 50px -12px rgba(0, 0, 0, 0.55);
  --shadow-sm: 0 4px 14px -6px rgba(0, 0, 0, 0.5);
  --orb-color: rgba(30, 105, 254, 0.30);
  --today-tint: rgba(30, 105, 254, 0.08);

  /* Typo */
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --fs-2xs: 0.65rem;
  --fs-xs: 0.78rem;
  --fs-s: 0.9375rem;
  --fs-m: 1.125rem;
  --fs-l: 1.3125rem;
  --fs-xl: 1.625rem;
  --lh-body: 1.55;

  /* Espacements */
  --space-3xs: 5px;
  --space-2xs: 7px;
  --space-xs: 11px;
  --space-s: 16px;
  --space-m: 24px;
  --space-l: 34px;
  --space-xl: 50px;

  /* Rayons */
  --radius-xs: 6px;
  --radius-s: 10px;
  --radius-m: 14px;
  --radius-l: 20px;
  --radius-full: 99999px;

  --control-h: 38px;
  --sidebar-w: 268px;
  --panel-w: 540px;
  --tl-col-min: 108px;        /* largeur mini d'un jour sur la timeline */
  --tl-gutter: 168px;         /* gouttière des libellés (vue charge de travail) */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

[data-theme="light"] {
  --color-d6: #f5f6f8;          /* fond de page (gris très clair) */
  --color-d2: #ffffff;          /* surfaces */
  --surface-2: #f1f3f6;
  --color-white: #14181f;       /* texte principal */
  --color-w-t1: rgba(20, 24, 31, 0.84);
  --color-w-t3: rgba(20, 24, 31, 0.55);
  --color-w-t5: rgba(20, 24, 31, 0.10);
  --border: rgba(20, 24, 31, 0.10);
  --border-strong: rgba(20, 24, 31, 0.15);
  --shadow: 0 20px 50px -14px rgba(20, 30, 60, 0.22);
  --shadow-sm: 0 4px 14px -6px rgba(20, 30, 60, 0.18);
  --orb-color: rgba(30, 105, 254, 0.18);
  --today-tint: rgba(30, 105, 254, 0.07);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }   /* prioritaire sur les .display des composants */
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-s);
  line-height: var(--lh-body);
  color: var(--color-white);
  background: var(--color-d6);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  transition: background-color .4s var(--ease), color .4s var(--ease);
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; border-radius: 4px; }

.bg-orb {
  position: fixed; top: 0; left: 0;
  width: 38vmax; height: 38vmax; z-index: 0;
  pointer-events: none; border-radius: 50%;
  background: radial-gradient(circle, var(--orb-color) 0%, transparent 60%);
  filter: blur(40px);
  transform: translate(58vw, -8vh);
}

/* =========================================================
   Boutons & contrôles génériques
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2xs);
  height: var(--control-h); padding: 0 var(--space-s);
  border-radius: var(--radius-full); font-size: var(--fs-s); font-weight: 600;
  white-space: nowrap; transition: background-color .2s, color .2s, border-color .2s, transform .12s var(--ease);
}
.btn:active { transform: scale(.97); }
.btn--block { width: 100%; }
.btn--sm { height: 30px; padding: 0 var(--space-xs); font-size: var(--fs-xs); }
.btn--primary { background: var(--color-primary); color: var(--on-primary); }
.btn--primary:hover { background: #1a5ce0; }
.btn--ghost { background: transparent; color: var(--color-w-t1); border: 1px solid var(--border-strong); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--danger { background: transparent; color: #ef4444; border: 1px solid color-mix(in srgb, #ef4444 40%, transparent); }
.btn--danger:hover { background: color-mix(in srgb, #ef4444 12%, transparent); }
.btn--danger-solid { background: #ef4444; color: #fff; }
.btn--danger-solid:hover { background: #dc2626; }

/* ---- Dialogue de confirmation ---- */
.cdlg-overlay {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: var(--space-m);
  background: rgba(8, 10, 16, 0.55); backdrop-filter: blur(2px);
  opacity: 0; transition: opacity .2s var(--ease);
}
.cdlg-overlay.is-open { opacity: 1; }
.cdlg {
  width: min(420px, 100%); background: var(--color-d2); border: 1px solid var(--border);
  border-radius: var(--radius-l); box-shadow: var(--shadow); padding: var(--space-l);
  text-align: center; transform: translateY(8px) scale(.97); transition: transform .2s var(--ease);
}
.cdlg-overlay.is-open .cdlg { transform: none; }
.cdlg__icon { display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; margin-bottom: var(--space-xs); }
.cdlg__icon--danger { color: #ef4444; background: color-mix(in srgb, #ef4444 14%, transparent); }
.cdlg__title { font-size: var(--fs-m); font-weight: 700; letter-spacing: -0.01em; }
.cdlg__msg { font-size: var(--fs-s); color: var(--color-w-t3); margin-top: var(--space-2xs); line-height: 1.5; }
.cdlg__actions { display: flex; gap: var(--space-2xs); justify-content: center; margin-top: var(--space-m); }
.cdlg__actions .btn { min-width: 120px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--control-h); height: var(--control-h);
  border-radius: var(--radius-s); color: var(--color-w-t1);
  transition: background-color .2s, color .2s;
  flex: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--color-white); }

/* Segmented control */
.seg { display: inline-flex; background: var(--surface-2); border-radius: var(--radius-full); padding: 3px; gap: 2px; }
.seg__btn {
  padding: 6px 14px; border-radius: var(--radius-full); font-size: var(--fs-xs); font-weight: 600;
  color: var(--color-w-t3); transition: color .2s, background-color .2s, box-shadow .2s; white-space: nowrap;
}
.seg__btn:hover { color: var(--color-white); }
.seg__btn.is-active { background: var(--color-d2); color: var(--color-white); box-shadow: var(--shadow-sm); }

.field-inline { display: inline-flex; align-items: center; gap: var(--space-2xs); font-size: var(--fs-xs); color: var(--color-w-t3); font-weight: 600; }
.field-inline select {
  height: 32px; padding: 0 28px 0 10px; border-radius: var(--radius-s);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--color-white); font-weight: 600;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.4'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; cursor: pointer;
}

/* =========================================================
   App shell
   ========================================================= */
.app {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh; height: 100dvh;
}

/* ---- Sidebar ---- */
.app__sidebar {
  display: flex; flex-direction: column; gap: var(--space-s);
  padding: var(--space-s);
  background: var(--color-d2); border-right: 1px solid var(--border);
  min-height: 0;
}
.sidebar__head { display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: var(--space-2xs); }
.brand__logo { width: 26px; height: 26px; }
.brand__name { font-weight: 700; font-size: var(--fs-m); letter-spacing: -0.01em; }
.sidebar__close { display: none; }

.sidebar__scroll { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: var(--space-m); margin: 0 calc(var(--space-s) * -1); padding: var(--space-2xs) var(--space-s); }
.sidebar__scroll::-webkit-scrollbar { width: 8px; }
.sidebar__scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }

.filter-group__title { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .08em; color: var(--color-w-t3); font-weight: 700; margin-bottom: var(--space-2xs); }
.seg#stateSeg { display: flex; width: 100%; }
.seg#stateSeg .seg__btn { flex: 1; text-align: center; padding: 7px 4px; }

.facet { display: flex; align-items: center; gap: var(--space-2xs); padding: 5px 6px; border-radius: var(--radius-xs); cursor: pointer; transition: background-color .15s; }
.facet:hover { background: var(--surface-2); }
.facet input { position: absolute; opacity: 0; pointer-events: none; }
.facet__box {
  width: 17px; height: 17px; border-radius: 5px; border: 1.5px solid var(--border-strong);
  flex: none; display: grid; place-items: center; transition: background-color .15s, border-color .15s;
}
.facet__box svg { width: 12px; height: 12px; opacity: 0; color: #fff; }
.facet input:checked + .facet__box { background: var(--color-primary); border-color: var(--color-primary); }
.facet input:checked + .facet__box svg { opacity: 1; }
.facet__label { font-size: var(--fs-xs); display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.facet__label .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.facet__txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.facet__count { margin-left: auto; font-size: var(--fs-2xs); color: var(--color-w-t3); font-variant-numeric: tabular-nums; }

/* =========================================================
   Topbar
   ========================================================= */
.app__main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  flex: none; background: color-mix(in srgb, var(--color-d2) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
  padding: var(--space-xs) var(--space-m); display: flex; flex-direction: column; gap: var(--space-xs);
}
.topbar__row { display: flex; align-items: center; gap: var(--space-s); }
.topbar__burger { display: none; }
.topbar__heading { display: flex; align-items: baseline; gap: var(--space-2xs); }
.topbar__title { font-size: var(--fs-l); font-weight: 700; letter-spacing: -0.02em; }
.topbar__count { font-size: var(--fs-xs); font-weight: 600; color: var(--color-w-t3); background: var(--surface-2); padding: 2px 9px; border-radius: var(--radius-full); }

.topbar__search { margin-left: auto; display: flex; align-items: center; gap: var(--space-2xs); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-full); padding: 0 var(--space-s); height: var(--control-h); width: 280px; transition: border-color .2s, width .2s; }
.topbar__search:focus-within { border-color: var(--color-primary); }
.topbar__search svg { color: var(--color-w-t3); flex: none; }
.topbar__search input { border: none; background: none; outline: none; width: 100%; }
.topbar__search input::placeholder { color: var(--color-w-t3); }

.theme-toggle .theme-toggle__moon { display: none; }
[data-theme="light"] .theme-toggle .theme-toggle__sun { display: none; }
[data-theme="light"] .theme-toggle .theme-toggle__moon { display: block; }

.topbar__row--controls { justify-content: space-between; }
.weeknav { display: flex; align-items: center; gap: var(--space-2xs); }
.weeknav__label { font-size: var(--fs-s); font-weight: 600; min-width: 190px; text-align: center; }
.weeknav .icon-btn { width: 32px; height: 32px; }
.topbar__controls-right { display: flex; align-items: center; gap: var(--space-s); }

/* =========================================================
   Contenu
   ========================================================= */
.app__content { flex: 1; min-height: 0; overflow: auto; padding: var(--space-m); }
.empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-s); color: var(--color-w-t3); }

/* =========================================================
   TIMELINE (vue semaine, type Gantt)
   ========================================================= */
.timeline { min-width: calc(var(--tl-col-min) * 7); }
.timeline.has-gutter { min-width: calc(var(--tl-gutter) + var(--tl-col-min) * 7); }
.timeline__head {
  display: grid; grid-template-columns: repeat(7, minmax(var(--tl-col-min), 1fr));
  position: sticky; top: 0; z-index: 4; background: var(--color-d6);
  border-bottom: 1px solid var(--border); margin-bottom: var(--space-xs);
}
.timeline__head.has-gutter { grid-template-columns: var(--tl-gutter) repeat(7, minmax(var(--tl-col-min), 1fr)); }
.tl-day { padding: var(--space-2xs) var(--space-xs) var(--space-xs); text-align: left; border-left: 1px solid var(--border); }
.tl-day:first-child { border-left: none; }
.tl-day__name { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .06em; color: var(--color-w-t3); font-weight: 700; }
.tl-day__num { font-size: var(--fs-m); font-weight: 700; line-height: 1.1; }
.tl-day.is-today .tl-day__num { color: var(--color-primary); }
.tl-day.is-today .tl-day__name { color: var(--color-primary); }
.tl-day__badge { display: inline-block; margin-top: 2px; font-size: var(--fs-2xs); font-weight: 700; color: var(--on-primary); background: var(--color-primary); border-radius: var(--radius-full); padding: 1px 8px; }

.tl-group { margin-bottom: var(--space-s); }
/* Bande « charge de travail » : gouttière de gauche + corps timeline */
.tl-group--banded { display: grid; grid-template-columns: var(--tl-gutter) 1fr; margin-bottom: 0; border-bottom: 1px solid var(--border); }
.tl-group--banded:hover { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.tl-gutter {
  display: flex; align-items: center; gap: var(--space-2xs); min-width: 0;
  padding: var(--space-2xs) var(--space-xs); border-right: 1px solid var(--border);
  position: sticky; left: 0; z-index: 2; background: var(--color-d6);
  font-size: var(--fs-xs); font-weight: 600;
}
.tl-group--banded .tl-gutter { background: var(--color-d6); }
.tl-gutter--head { color: var(--color-w-t3); font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.tl-gutter .avatar { width: 28px; height: 28px; }
.tl-gutter__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-gutter__count { margin-left: auto; font-size: var(--fs-2xs); color: var(--color-w-t3); font-variant-numeric: tabular-nums; background: var(--surface-2); padding: 1px 7px; border-radius: var(--radius-full); }
.avatar--ghost { background: var(--surface-2); color: var(--color-w-t3); border-style: dashed; }

.tl-body { position: relative; }
/* colonnes de fond (lignes verticales + today) */
.tl-cols { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(7, minmax(var(--tl-col-min), 1fr)); z-index: 0; pointer-events: none; }
.tl-col { border-left: 1px solid var(--border); }
.tl-col:first-child { border-left: none; }
.tl-col.is-today { background: var(--today-tint); }

.tl-lane { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(7, minmax(var(--tl-col-min), 1fr)); align-items: stretch; min-height: 52px; padding: 4px 0; }

.tl-bar {
  position: relative; align-self: center; margin: 3px 6px;
  background: var(--color-d2); border: 1px solid var(--border);
  border-left: 3px solid var(--c, var(--color-primary));
  border-radius: var(--radius-s); padding: 8px 10px;
  display: flex; flex-direction: column; gap: 5px; cursor: grab; overflow: hidden;
  box-shadow: var(--shadow-sm); touch-action: none;
  transition: transform .12s var(--ease), box-shadow .2s, border-color .2s;
}
.tl-bar:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }
.tl-bar.is-dragging { cursor: grabbing; z-index: 20; box-shadow: var(--shadow); opacity: .96; transition: none; }
body.is-grabbing, body.is-grabbing * { cursor: grabbing !important; user-select: none; }
.tl-bar.is-overflow-left { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.tl-bar.is-overflow-right { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.tl-bar__top { display: flex; align-items: center; gap: 6px; }
.tl-bar__title { font-size: var(--fs-xs); font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-bar__meta { display: flex; align-items: center; gap: 6px; }
.tl-bar__meta .avatars { margin-left: auto; }
.tl-bar.is-done .tl-bar__title { text-decoration: line-through; color: var(--color-w-t3); }

/* Poignées de redimensionnement (gauche / droite) */
.tl-bar__resize { position: absolute; top: 0; bottom: 0; width: 10px; cursor: ew-resize; z-index: 3; }
.tl-bar__resize--l { left: 0; }
.tl-bar__resize--r { right: 0; }
.tl-bar__resize::before { content: ""; position: absolute; top: 50%; transform: translateY(-50%); width: 3px; height: 16px; border-radius: 2px; background: var(--c, var(--color-primary)); opacity: 0; transition: opacity .15s; }
.tl-bar__resize--l::before { left: 3px; }
.tl-bar__resize--r::before { right: 3px; }
.tl-bar:hover .tl-bar__resize::before { opacity: .55; }

/* =========================================================
   Badges, points, avatars
   ========================================================= */
.badge {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  font-size: var(--fs-2xs); font-weight: 700; line-height: 1;
  padding: 4px 9px; border-radius: var(--radius-full);
  color: var(--c, var(--color-primary));
  background: color-mix(in srgb, var(--c, var(--color-primary)) 16%, transparent);
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.badge--solid { color: #fff; background: var(--c); }

.prio { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-2xs); font-weight: 700; color: var(--c); }
.prio__flag { width: 8px; height: 8px; border-radius: 2px; background: var(--c); }

.dot { display: inline-block; }

.avatars { display: inline-flex; align-items: center; }
.avatars .avatar:not(:first-child) { margin-left: -7px; }
.avatar {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 10px; font-weight: 700; color: #fff;
  border: 2px solid var(--color-d2); box-shadow: 0 0 0 1px var(--border);
}
.avatar--lg { width: 34px; height: 34px; font-size: 13px; }
.avatar--client {
  background: #fff; padding: 3px; box-shadow: 0 0 0 1px var(--border);
}
.avatar--client img { width: 100%; height: 100%; object-fit: contain; }

/* =========================================================
   LISTE (tableau triable)
   ========================================================= */
.list { width: 100%; }
.list__table { width: 100%; border-collapse: collapse; }
.list__table th {
  text-align: left; font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .05em;
  color: var(--color-w-t3); font-weight: 700; padding: var(--space-2xs) var(--space-xs);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--color-d6); z-index: 2;
}
.list__row { cursor: pointer; transition: background-color .15s; }
.list__row:hover { background: var(--color-d2); }
.list__row td { padding: var(--space-2xs) var(--space-xs); border-bottom: 1px solid var(--border); font-size: var(--fs-xs); vertical-align: middle; }
.list__title { font-weight: 600; font-size: var(--fs-s); }
.list__client { display: flex; align-items: center; gap: var(--space-2xs); }
.list__dates { color: var(--color-w-t3); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* =========================================================
   PANNEAU TICKET (slide-over)
   ========================================================= */
.panel-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 40; opacity: 0; animation: fade .25s var(--ease) forwards; }
.ticket-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(var(--panel-w), 100vw); z-index: 50;
  background: var(--color-d2); border-left: 1px solid var(--border); box-shadow: var(--shadow);
  display: flex; flex-direction: column; transform: translateX(100%);
  transition: transform .32s var(--ease), width .32s var(--ease), top .32s var(--ease), bottom .32s var(--ease), border-radius .32s var(--ease);
}
.ticket-panel.is-open { transform: translateX(0); }
/* Mode plein écran : modale large centrée */
.ticket-panel.is-open.is-expanded {
  top: 2.5vh; bottom: 2.5vh; right: 50%; left: auto;
  width: min(1160px, 95vw); transform: translateX(50%);
  border: 1px solid var(--border); border-radius: var(--radius-l); overflow: hidden;
}
@keyframes fade { to { opacity: 1; } }

.panel__head { flex: none; padding: var(--space-s) var(--space-m); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: var(--space-2xs); }
.panel__head-main { flex: 1; min-width: 0; }
.panel__title { font-size: var(--fs-l); font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; }
/* Titre éditable mais d'apparence « titre » (transparent, indice au survol/focus) */
.panel__title-input {
  font-size: var(--fs-l); font-weight: 700; letter-spacing: -0.02em; line-height: 1.25;
  width: 100%; background: transparent; border: 1px solid transparent; border-radius: var(--radius-xs);
  padding: 3px 6px; margin-left: -6px; transition: background-color .15s, border-color .15s;
}
.panel__title-input:hover { background: var(--surface-2); }
.panel__title-input:focus { outline: none; background: var(--surface-2); border-color: var(--border-strong); }

/* Icônes agrandir / réduire */
.ic-collapse { display: none; }
.ticket-panel.is-expanded .ic-expand { display: none; }
.ticket-panel.is-expanded .ic-collapse { display: block; }

.panel__body { flex: 1; min-height: 0; overflow-y: auto; padding: var(--space-m); display: flex; flex-direction: column; gap: var(--space-l); }
.panel__col { display: flex; flex-direction: column; gap: var(--space-l); min-width: 0; }
.panel-block--chat { display: flex; flex-direction: column; min-height: 0; }

.meta-grid { display: grid; grid-template-columns: 96px 1fr; gap: var(--space-2xs) var(--space-s); align-items: center; }
.meta-grid__key { font-size: var(--fs-xs); color: var(--color-w-t3); font-weight: 600; }
.meta-grid__val { display: flex; align-items: center; gap: var(--space-2xs); flex-wrap: wrap; font-size: var(--fs-s); min-width: 0; }
.meta-client { display: inline-flex; align-items: center; gap: var(--space-2xs); font-weight: 600; }

/* Édition de date en place */
.date-edit { font-size: var(--fs-s); color: var(--color-white); padding: 4px 8px; margin-left: -8px; border-radius: var(--radius-xs); cursor: pointer; transition: background-color .15s; text-align: left; }
.date-edit:hover { background: var(--surface-2); }
.mini-input { background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-s); padding: 6px 10px; color: var(--color-white); }
.mini-input:focus { outline: none; border-color: var(--color-primary); }

.panel-section__title { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .07em; color: var(--color-w-t3); font-weight: 700; margin-bottom: var(--space-xs); }

/* Rendu contenu riche (blocs) */
.rich { font-size: var(--fs-s); color: var(--color-w-t1); }
.rich h3 { font-size: var(--fs-m); font-weight: 700; color: var(--color-white); margin: var(--space-s) 0 var(--space-3xs); }
.rich h3:first-child { margin-top: 0; }
.rich p { margin: 0 0 var(--space-2xs); }
.rich ul.rich-list { list-style: disc; padding-left: 1.2em; display: flex; flex-direction: column; gap: 3px; }
.rich .checklist { display: flex; flex-direction: column; gap: var(--space-3xs); }
.rich .check { display: flex; align-items: flex-start; gap: var(--space-2xs); }
.rich .check__box { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--border-strong); flex: none; display: grid; place-items: center; margin-top: 1px; }
.rich .check__box svg { width: 12px; height: 12px; opacity: 0; color: #fff; }
.rich .check.is-checked .check__box { background: var(--color-primary); border-color: var(--color-primary); }
.rich .check.is-checked .check__box svg { opacity: 1; }
.rich .check.is-checked .check__txt { color: var(--color-w-t3); text-decoration: line-through; }
.rich img { border-radius: var(--radius-s); margin: var(--space-2xs) 0; }
.rich .delimiter { text-align: center; color: var(--color-w-t3); letter-spacing: .4em; margin: var(--space-s) 0; }
.rich blockquote { border-left: 3px solid var(--color-primary); padding-left: var(--space-s); color: var(--color-w-t1); font-style: italic; margin: var(--space-2xs) 0; }

/* Éditeur (Editor.js) */
.editor-holder { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-s); padding: var(--space-2xs) var(--space-s); min-height: 160px; }
.editor-holder .ce-toolbar__plus, .editor-holder .ce-toolbar__settings-btn { color: var(--color-white); background: var(--color-d2); border: 1px solid var(--border); }
.editor-holder .cdx-block { padding: 4px 0; }
.editor-fallback { width: 100%; min-height: 160px; resize: vertical; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-s); padding: var(--space-xs); }

/* Commentaires (chat) */
.chat { display: flex; flex-direction: column; gap: var(--space-s); }
.msg { display: flex; gap: var(--space-2xs); max-width: 94%; position: relative; }
.msg__bubble-wrap { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.msg__head { display: flex; align-items: baseline; gap: var(--space-2xs); }
.msg__name { font-size: var(--fs-xs); font-weight: 700; }
.msg__time { font-size: var(--fs-2xs); color: var(--color-w-t3); }
.msg__bubble { background: var(--surface-2); border-radius: 4px var(--radius-m) var(--radius-m) var(--radius-m); padding: 8px 12px; font-size: var(--fs-s); line-height: 1.45; word-wrap: break-word; overflow-wrap: anywhere; }
.msg__bubble b, .msg__bubble strong { font-weight: 700; }
.msg__bubble p { margin: 0; }
.msg--me { align-self: flex-end; flex-direction: row-reverse; }
.msg--me .msg__head { flex-direction: row-reverse; }
.msg--me .msg__bubble { background: var(--color-primary); color: var(--on-primary); border-radius: var(--radius-m) 4px var(--radius-m) var(--radius-m); }
/* puce de mention */
.mention { display: inline; font-weight: 600; color: var(--color-primary); background: color-mix(in srgb, var(--color-primary) 14%, transparent); padding: 0 5px; border-radius: var(--radius-full); white-space: nowrap; }
.msg--me .mention { color: #fff; background: rgba(255,255,255,0.22); }
/* actions (éditer / supprimer) au survol */
.msg__actions { display: flex; gap: 2px; align-self: center; opacity: 0; transition: opacity .15s; }
.msg:hover .msg__actions { opacity: 1; }
.msg__act { width: 26px; height: 26px; border-radius: var(--radius-xs); color: var(--color-w-t3); display: grid; place-items: center; transition: background-color .15s, color .15s; }
.msg__act:hover { background: var(--surface-2); color: var(--color-white); }
/* édition inline d'un commentaire */
.comment-edit { display: flex; flex-direction: column; gap: var(--space-2xs); }
.comment-edit .composer__input { background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-s); color: var(--color-white); }
.comment-edit .composer__input:empty::before { color: var(--color-w-t3); }
/* en édition, la mention reprend ses couleurs normales (et non le blanc des bulles « moi ») */
.comment-edit .mention { color: var(--color-primary); background: color-mix(in srgb, var(--color-primary) 14%, transparent); }
.comment-edit__actions { display: flex; gap: var(--space-2xs); justify-content: flex-end; }

/* Onglets Discussion / Activité */
.chat-tabs { display: flex; gap: var(--space-s); margin-bottom: var(--space-xs); border-bottom: 1px solid var(--border); }
.chat-tab { padding: 4px 2px 9px; margin-bottom: -1px; font-size: var(--fs-xs); font-weight: 600; color: var(--color-w-t3); border-bottom: 2px solid transparent; display: inline-flex; align-items: center; gap: 6px; }
.chat-tab:hover { color: var(--color-white); }
.chat-tab.is-active { color: var(--color-white); border-bottom-color: var(--color-primary); }
.chat-tab__n { font-size: var(--fs-2xs); font-weight: 700; background: var(--surface-2); padding: 0 7px; border-radius: var(--radius-full); }
.chat-tab.is-active .chat-tab__n { background: color-mix(in srgb, var(--color-primary) 18%, transparent); color: var(--color-primary); }

/* Journal d'activité */
.activity { display: flex; flex-direction: column; gap: 1px; }
.act { display: flex; gap: var(--space-2xs); padding: 7px 2px; align-items: flex-start; }
.act__icon { width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--surface-2); color: var(--color-w-t3); display: grid; place-items: center; margin-top: 1px; }
.act__body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.act__text { font-size: var(--fs-xs); color: var(--color-w-t1); line-height: 1.4; }
.act__time { font-size: var(--fs-2xs); color: var(--color-w-t3); }

/* Composer riche (contenteditable + barre d'outils) */
.composer { flex: none; border-top: 1px solid var(--border); padding: var(--space-xs) var(--space-m); display: flex; gap: var(--space-2xs); align-items: flex-end; background: var(--color-d2); }
.composer__box { flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-m); overflow: hidden; transition: border-color .2s; }
.composer__box:focus-within { border-color: var(--color-primary); }
.composer__toolbar { display: flex; gap: 2px; padding: 4px 6px 0; }
.composer__tool { width: 26px; height: 26px; border-radius: var(--radius-xs); color: var(--color-w-t3); font-weight: 700; display: grid; place-items: center; transition: background-color .15s, color .15s; }
.composer__tool:hover { background: var(--color-d2); color: var(--color-white); }
.composer__input { min-height: 24px; max-height: 140px; overflow-y: auto; padding: 6px 12px 9px; line-height: 1.45; outline: none; font-size: var(--fs-s); }
.composer__input:empty::before { content: attr(data-ph); color: var(--color-w-t3); pointer-events: none; }
.composer__input .mention { cursor: default; }
.composer__send { width: 40px; height: 40px; border-radius: 50%; background: var(--color-primary); color: #fff; display: grid; place-items: center; flex: none; transition: transform .12s, background-color .2s; }
.composer__send:hover { background: #1a5ce0; }
.composer__send:active { transform: scale(.92); }

/* Popup de mention (@) */
.mention-pop { position: fixed; z-index: 80; transform: translateY(-100%); min-width: 220px; max-width: 280px; padding: 5px; background: var(--color-d2); border: 1px solid var(--border-strong); border-radius: var(--radius-s); box-shadow: var(--shadow); max-height: 240px; overflow-y: auto; }
.mention-pop__item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px 8px; border-radius: var(--radius-xs); text-align: left; font-size: var(--fs-s); color: var(--color-w-t1); }
.mention-pop__item .avatar { width: 24px; height: 24px; }
.mention-pop__item.is-active { background: var(--surface-2); color: var(--color-white); }

.panel__foot { flex: none; padding: var(--space-xs) var(--space-m); border-top: 1px solid var(--border); display: flex; gap: var(--space-2xs); }
.panel__foot .spacer { flex: 1; }

/* Édition : sélecteurs inline (statut/cat/prio…) */
.editable { cursor: pointer; border: 1px dashed transparent; border-radius: var(--radius-xs); transition: border-color .15s; }
.is-editing .editable { border-color: var(--border-strong); padding: 2px 6px; }
.mini-select { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 5px 8px; }

/* =========================================================
   Select custom (apparence « lecture », éditable au clic)
   ========================================================= */
.csel-host { display: flex; min-width: 0; max-width: 100%; }
.csel { position: relative; max-width: 100%; }
.csel__btn {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 4px 6px; margin-left: -6px; border-radius: var(--radius-xs);
  cursor: pointer; text-align: left; color: inherit; transition: background-color .15s;
}
.csel__btn:hover, .csel[data-open="true"] .csel__btn { background: var(--surface-2); }
/* variante « champ » bordé (topbar : Grouper / Trier) */
.csel--field .csel__btn { border: 1px solid var(--border); background: var(--surface-2); padding: 0 10px; height: 32px; border-radius: var(--radius-s); margin-left: 0; font-size: var(--fs-xs); font-weight: 600; }
.csel--field .csel__btn:hover { border-color: var(--border-strong); }
.csel--field .csel__chev { opacity: .7; }
.csel--field .csel__list { left: 0; right: auto; min-width: 100%; }
.csel__value { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.csel__muted { color: var(--color-w-t3); }
.csel__chev {
  flex: 0 0 auto; width: 8px; height: 8px; margin-left: 1px;
  border-right: 1.5px solid var(--color-w-t3); border-bottom: 1.5px solid var(--color-w-t3);
  transform: translateY(-2px) rotate(45deg); opacity: 0; transition: opacity .15s, transform .2s var(--ease);
}
.csel__btn:hover .csel__chev, .csel[data-open="true"] .csel__chev { opacity: .7; }
.csel[data-open="true"] .csel__chev { transform: translateY(1px) rotate(-135deg); }

.csel__list {
  position: absolute; top: calc(100% + 5px); left: -6px; min-width: 220px; max-width: 300px; z-index: 60;
  margin: 0; padding: 5px; list-style: none;
  background: var(--color-d2); border: 1px solid var(--border-strong); border-radius: var(--radius-s);
  box-shadow: var(--shadow); max-height: 260px; overflow-y: auto;
  opacity: 0; transform: translateY(-6px) scale(.99); transform-origin: top left; pointer-events: none;
  transition: opacity .16s var(--ease), transform .16s var(--ease);
}
.csel[data-open="true"] .csel__list { opacity: 1; transform: none; pointer-events: auto; }
.csel__opt {
  display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: var(--radius-xs);
  font-size: var(--fs-s); color: var(--color-w-t1); cursor: pointer; transition: background-color .12s;
}
.csel__opt .avatar { width: 24px; height: 24px; }
.csel__opt .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.csel__opt-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.csel__opt-check { flex: none; color: var(--color-primary); opacity: 0; }
.csel__opt.is-active { background: var(--surface-2); }
.csel__opt[aria-selected="true"] { color: var(--color-white); font-weight: 600; }
.csel__opt[aria-selected="true"] .csel__opt-check { opacity: 1; }

/* Contenu (Editor.js) — apparence document */
.editor-holder { background: transparent; border: none; padding: 0; min-height: 120px; }
.chat__empty { color: var(--color-w-t3); }
.panel__saved { font-size: var(--fs-2xs); color: var(--color-w-t3); align-self: center; display: inline-flex; align-items: center; gap: 5px; }
.panel__saved::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #22c55e; }

/* Plein écran : corps en 2 colonnes (contenu | discussion) */
@media (min-width: 860px) {
  .ticket-panel.is-expanded .panel__body { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 0; padding: 0; overflow: hidden; }
  .ticket-panel.is-expanded .panel__col { gap: var(--space-l); }
  .ticket-panel.is-expanded .panel__col--main { padding: var(--space-l); overflow-y: auto; }
  .ticket-panel.is-expanded .panel__col--side { border-left: 1px solid var(--border); overflow: hidden; gap: 0; }
  .ticket-panel.is-expanded .panel__col--side .panel-block--chat { flex: 1; min-height: 0; padding: var(--space-l) var(--space-l) 0; }
  .ticket-panel.is-expanded .panel__col--side .chat,
  .ticket-panel.is-expanded .panel__col--side .activity { flex: 1; overflow-y: auto; }
}

/* =========================================================
   Multi-éditeurs : sélecteur d'identité + présence
   ========================================================= */
.identity { position: relative; flex: none; }
.identity__btn {
  display: inline-flex; align-items: center; gap: 8px; height: var(--control-h);
  padding: 0 10px 0 5px; border-radius: var(--radius-full);
  border: 1px solid var(--border); background: var(--surface-2);
  font-weight: 600; transition: border-color .2s, background-color .2s;
}
.identity__btn:hover { border-color: var(--border-strong); }
.identity__avatar .avatar { width: 28px; height: 28px; }
.identity__name { font-size: var(--fs-xs); max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity__chev { color: var(--color-w-t3); flex: none; }

.identity__menu {
  position: absolute; top: calc(100% + 8px); right: 0; width: 264px; z-index: 30;
  background: var(--color-d2); border: 1px solid var(--border);
  border-radius: var(--radius-m); box-shadow: var(--shadow); padding: 7px;
}
.identity__title { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .07em; color: var(--color-w-t3); font-weight: 700; padding: 6px 8px 8px; }
.identity__item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border-radius: var(--radius-s); text-align: left; transition: background-color .15s; }
.identity__item:hover { background: var(--surface-2); }
.identity__item .avatar { width: 30px; height: 30px; }
.identity__item-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.identity__item-name { font-size: var(--fs-xs); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity__item-role { font-size: var(--fs-2xs); color: var(--color-w-t3); }
.identity__check { margin-left: auto; color: var(--color-primary); opacity: 0; flex: none; }
.identity__item.is-active .identity__check { opacity: 1; }
.identity__sep { height: 1px; background: var(--border); margin: 6px 4px; }
.identity__add-toggle { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 8px; border-radius: var(--radius-s); color: var(--color-primary); font-weight: 600; font-size: var(--fs-xs); }
.identity__add-toggle:hover { background: var(--surface-2); }
.identity__add { display: flex; gap: 6px; padding: 4px; }
.identity__add input { height: 34px; border-radius: var(--radius-s); border: 1px solid var(--border); background: var(--surface-2); padding: 0 10px; }
.identity__add input[type="text"] { flex: 1; min-width: 0; }
.identity__add input[type="color"] { flex: none; width: 38px; padding: 3px; cursor: pointer; }
.identity__add button { flex: none; }

.presence { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.presence__label { font-size: var(--fs-2xs); color: var(--color-w-t3); font-weight: 600; }
.presence .avatar { width: 26px; height: 26px; }

/* =========================================================
   Écran de connexion
   ========================================================= */
.login { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: var(--space-m); background: var(--color-d6); }
.login__card { width: min(380px, 100%); background: var(--color-d2); border: 1px solid var(--border); border-radius: var(--radius-l); box-shadow: var(--shadow); padding: var(--space-xl) var(--space-l); display: flex; flex-direction: column; gap: var(--space-xs); text-align: center; }
.login__logo { width: 40px; height: 40px; margin: 0 auto var(--space-2xs); }
.login__title { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -0.02em; }
.login__sub { font-size: var(--fs-s); color: var(--color-w-t3); margin-bottom: var(--space-s); }
.login__field { display: flex; flex-direction: column; gap: 4px; text-align: left; margin-bottom: var(--space-2xs); }
.login__field span { font-size: var(--fs-xs); font-weight: 600; color: var(--color-w-t3); }
.login__field input { height: 42px; padding: 0 var(--space-s); border-radius: var(--radius-s); border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--color-white); }
.login__field input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-t5); }
.login__err { min-height: 18px; font-size: var(--fs-xs); color: #ef4444; margin: 2px 0 var(--space-2xs); }
.login .btn { height: 44px; }

/* Menu identité : entrées d'action + carte profil */
.identity__me { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.identity__me .avatar { width: 34px; height: 34px; }
.identity__action { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 8px; border-radius: var(--radius-s); text-align: left; font-size: var(--fs-xs); font-weight: 600; color: var(--color-w-t1); transition: background-color .15s; }
.identity__action:hover { background: var(--surface-2); color: var(--color-white); }
.identity__action svg { color: var(--color-w-t3); flex: none; }
.identity__action--danger { color: #ef4444; }
.identity__action--danger svg { color: #ef4444; }

/* Volet profil (formulaire dans le dialogue) */
.cdlg--form { text-align: left; width: min(440px, 100%); }
.pform { display: flex; flex-direction: column; gap: var(--space-2xs); }
.pform__row { display: grid; grid-template-columns: 80px 1fr; align-items: center; gap: var(--space-s); }
.pform__row span { font-size: var(--fs-xs); color: var(--color-w-t3); font-weight: 600; }
.pform__row input { height: 38px; padding: 0 10px; border-radius: var(--radius-s); border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--color-white); }
.pform__row input[type="color"] { width: 46px; padding: 3px; cursor: pointer; }
.pform__row input:focus { outline: none; border-color: var(--color-primary); }
.pform__sep { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .07em; color: var(--color-w-t3); font-weight: 700; margin: var(--space-s) 0 var(--space-2xs); border-top: 1px solid var(--border); padding-top: var(--space-s); }
.pform__msg { min-height: 16px; font-size: var(--fs-xs); margin-top: var(--space-2xs); }
.pform__msg.is-ok { color: #22c55e; }
.pform__msg.is-err { color: #ef4444; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1000px) {
  :root { --sidebar-w: 0px; }
  .app { grid-template-columns: 1fr; }
  .app__sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 280px; z-index: 60;
    transform: translateX(-100%); transition: transform .3s var(--ease);
  }
  .app__sidebar.is-open { transform: translateX(0); box-shadow: var(--shadow); }
  .sidebar__close { display: inline-flex; }
  .app__overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 55; }
  .topbar__burger { display: inline-flex; }
}
@media (max-width: 720px) {
  .app__content { padding: var(--space-s); }
  .topbar { padding: var(--space-xs) var(--space-s); }
  /* 1re ligne : burger ............ identité · thème — recherche sur sa propre ligne */
  .topbar__row { gap: var(--space-2xs); flex-wrap: wrap; }
  .topbar__heading { display: none; }
  .topbar__search { order: 5; flex: 1 0 100%; min-width: 0; margin-left: 0; width: auto; }
  .identity { margin-left: auto; }
  .topbar__row--controls { flex-direction: column; align-items: stretch; gap: var(--space-2xs); }
  .weeknav { justify-content: space-between; }
  .weeknav__label { min-width: 0; flex: 1; }
  .topbar__controls-right { justify-content: space-between; flex-wrap: wrap; gap: var(--space-2xs); }
  .seg--view { margin-left: auto; }
  .field-inline span { display: none; }
  .ticket-panel { --panel-w: 100vw; }
  .panel__body { padding: var(--space-s); }
  .meta-grid { grid-template-columns: 84px 1fr; }
}
@media (max-width: 720px) { .timeline { --tl-col-min: 88px; } }
