:root {
  color-scheme: light;
  --ink: #1a2235;
  --muted: #5a6a88;
  --line: #d0d8ea;
  --surface: #ffffff;
  --soft: #f0f4fb;
  --nav: #131d3a;
  --nav-soft: rgba(255, 255, 255, 0.12);
  --accent: #1e2d5a;
  --accent-strong: #131d3a;
  --warning: #1e2d5a;
  --danger: #ef4444;
  --blue: #1e2d5a;
  --sky: #e0e8f8;
  --teal: #2d5be3;
  --cyan: #2d5be3;
  --amber: #f59e0b;
  --violet: #6d5dfc;
  --rose: #e11d48;
  --radius: 8px;
  --radius-lg: 16px;
  --radius-sm: 6px;
  --glass-card: rgba(255, 255, 255, 0.65);
  --glass-border: rgba(255, 255, 255, 0.3);
  --shadow-soft: 0 14px 36px rgba(30, 45, 90, 0.1);
  --shadow-strong: 0 24px 60px rgba(19, 29, 58, 0.18);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e2e8f4;
  --muted: #8899b4;
  --line: #253044;
  --surface: #151f2e;
  --soft: #1a2738;
  --nav: #0d1525;
  --nav-soft: rgba(255, 255, 255, 0.09);
  --accent: #4a7fd4;
  --accent-strong: #6a9af0;
  --warning: #4a7fd4;
  --sky: #1e3a5f;
  --glass-card: rgba(21, 31, 46, 0.8);
  --glass-border: rgba(255, 255, 255, 0.08);
  --shadow-soft: 0 14px 36px rgba(0, 0, 0, 0.35);
  --shadow-strong: 0 24px 60px rgba(0, 0, 0, 0.5);
}

/* ── Dark mode overrides ── */
[data-theme="dark"] body {
  background: linear-gradient(135deg, #0d1624 0%, #111b2b 60%, #0f1d2a 100%);
}
[data-theme="dark"] .login-card { background: #1a2738; }
[data-theme="dark"] kbd { background: #1e2d42; }
[data-theme="dark"] .shortcut-mouse { background: #1e2d42; color: var(--muted); border-color: var(--line); }

/* Inputs & selects */
[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background: #1a2738;
  color: var(--ink);
  border-color: var(--line);
}
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder { color: #4a5f7a; }

/* Cards génériques */
[data-theme="dark"] .client-card { background: #1a2738; }
[data-theme="dark"] .task-card {
  background: color-mix(in srgb, var(--task-type-bg, #1e3a5f) 30%, #1a2738);
  border-color: color-mix(in srgb, var(--task-type-bg, #253044) 40%, #253044);
}
[data-theme="dark"] .task-card { box-shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 10px rgba(0,0,0,.25); }

/* Kanban */
[data-theme="dark"] .kanban-column { background: #131d2c; }
[data-theme="dark"] .kanban-col-header { background: #1a2738; border-color: var(--line); }

/* Panels & modals */
[data-theme="dark"] .modal-backdrop { background: rgba(0,0,0,.65); }
[data-theme="dark"] .modal,
[data-theme="dark"] .dialog-panel,
[data-theme="dark"] .overlay-panel { background: #1a2738; border-color: var(--line); }

/* Chat */
[data-theme="dark"] .chat-list {
  background:
    radial-gradient(ellipse at 15% 25%, rgba(45,91,227,0.08) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 75%, rgba(30,45,90,0.06) 0%, transparent 55%),
    #111b2b;
}
[data-theme="dark"] .message-thread-panel { background: #111b2b; }
[data-theme="dark"] .message-thread-header { background: #151f2e; border-color: var(--line); }
[data-theme="dark"] .chat-row:not(.is-mine) .chat-bubble { background: #1e2d42; color: var(--ink); }
[data-theme="dark"] .chat-attachment { background: rgba(255,255,255,.08); }
[data-theme="dark"] .chat-attachment:hover { background: rgba(255,255,255,.13); }
[data-theme="dark"] .chat-toast { background: #1a2738; border-color: var(--line); }
[data-theme="dark"] .chat-toast-sender { color: #5aabf0; }
[data-theme="dark"] .chat-toast-text { color: var(--ink); }
[data-theme="dark"] .chat-widget-panel { background: #151f2e; border-color: var(--line); }
[data-theme="dark"] .chat-form--full { background: #151f2e; border-color: var(--line); }
[data-theme="dark"] .chat-search-bar { background: #1a2738; border-color: var(--line); }
[data-theme="dark"] .chat-search-bar input { background: #111b2b; }
[data-theme="dark"] .message-threads { background: #111b2b; }
[data-theme="dark"] .message-thread-button { color: var(--ink); }
[data-theme="dark"] .message-thread-button:hover,
[data-theme="dark"] .message-thread-button.is-active { background: rgba(255,255,255,.07); }

/* Tables */
[data-theme="dark"] table { color: var(--ink); }
[data-theme="dark"] th { background: #1a2738; border-color: var(--line); color: var(--muted); }
[data-theme="dark"] td { border-color: var(--line); }
[data-theme="dark"] tr:nth-child(even) { background: #131d2c; }
[data-theme="dark"] tr:hover { background: #1e2d42; }

/* Dropdowns & menus */
[data-theme="dark"] .dropdown,
[data-theme="dark"] .account-menu,
[data-theme="dark"] .context-menu { background: #1a2738; border-color: var(--line); }
[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .account-menu-item:hover { background: rgba(255,255,255,.07); }

/* Badges de statut */
[data-theme="dark"] .badge-todo { background: #1e2d42; color: #94a3b8; }
[data-theme="dark"] .badge-done { background: #0f2e1f; color: #4ade80; }
[data-theme="dark"] .badge-inprogress { background: #1e3a5f; color: #4a7fd4; }
[data-theme="dark"] .badge-blocked { background: #2e1515; color: #f87171; }

/* Scrollbars */
[data-theme="dark"] ::-webkit-scrollbar-track { background: #111b2b; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #253044; }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #2e3f58; }

/* Icône bouton thème */
.theme-toggle-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  color: rgba(255,255,255,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.theme-toggle-btn:hover { background: rgba(255,255,255,.1); color: #fff; }

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #e8edf8 0%, #f0f4ff 60%, #eaf0fb 100%);
  color: var(--ink);
  touch-action: manipulation;
  overflow-x: hidden;
}

html {
  touch-action: manipulation;
  overflow-x: hidden;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.nav-icon,
.button-icon,
.field-icon {
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.nav-icon {
  width: 20px;
  height: 20px;
}

.button-icon {
  width: 20px;
  height: 20px;
}

.field-icon {
  width: 19px;
  height: 19px;
}

.login-panel {
  min-height: 100vh;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(19, 29, 58, 0.45) 0%, rgba(8, 40, 77, 0.35) 100%),
    url("/assets/login-bg.png") center/cover no-repeat;
}

.login-card {
  display: grid;
  gap: 18px;
  width: min(440px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  padding: 28px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.login-brand {
  color: var(--ink);
}

.login-brand .brand-mark {
  background: #0f1d3a;
}

.login-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
}

.login-card input {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
}

.login-error {
  color: var(--danger);
  font-weight: 800;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  position: sticky;
  top: 0;
  background:
    linear-gradient(180deg, #131d3a 0%, #1a2540 58%, #243260 100%);
  color: #f8fafc;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.08), 18px 0 46px rgba(19, 29, 58, 0.09);
  scrollbar-width: none;
}

.sidebar::-webkit-scrollbar {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 62px;
  height: 62px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.1);
  object-fit: contain;
  padding: 6px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 16px 32px rgba(0, 0, 0, 0.14);
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 2px;
  color: #b9c2cf;
  font-size: 0.86rem;
}

.nav-list {
  display: grid;
  gap: 2px;
}

.nav-section-label {
  padding: 10px 10px 2px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.28);
  pointer-events: none;
  user-select: none;
}

.nav-divider {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 6px 8px;
}

.nav-item--muted {
  opacity: 0.55;
}
.nav-item--muted:hover {
  opacity: 1;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0 12px 0 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  text-align: left;
  font-size: 0.88rem;
  font-weight: 700;
  transition: background 160ms ease, color 160ms ease;
}

.nav-badge {
  display: grid;
  min-width: 22px;
  height: 22px;
  margin-left: auto;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--rose), #f97316);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 900;
}

.nav-item:hover {
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.07);
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

/* Icône colorée par section (état actif) */
.nav-item .nav-icon {
  flex-shrink: 0;
  padding: 5px;
  border-radius: 8px;
  width: 30px;
  height: 30px;
  transition: background 160ms, color 160ms;
  color: rgba(255, 255, 255, 0.45);
}

.nav-item:hover .nav-icon {
  color: rgba(255, 255, 255, 0.75);
}

#dashboardNavButton.active   .nav-icon { background: rgba(6,182,212,0.22);   color: #67e8f9; }
#activityNavButton.active    .nav-icon { background: rgba(245,158,11,0.22);  color: #fbbf24; }
#clientsNavButton.active     .nav-icon { background: rgba(167,139,250,0.22); color: #c4b5fd; }
#knowledgeNavButton.active   .nav-icon { background: rgba(16,185,129,0.22);  color: #6ee7b7; }
#chatNavButton.active        .nav-icon { background: rgba(244,114,182,0.22); color: #f9a8d4; }
#tasksNavButton.active       .nav-icon { background: rgba(59,130,246,0.25);  color: #93c5fd; }
#calendarNavButton.active    .nav-icon { background: rgba(99,102,241,0.22);  color: #a5b4fc; }
#trashNavButton.active       .nav-icon { background: rgba(239,68,68,0.18);   color: #fca5a5; }
#financesNavButton.active    .nav-icon { background: rgba(52,211,153,0.18);  color: #6ee7b7; }

/* ── Sous-menu Finances ── */
.nav-group {
  display: flex;
  flex-direction: column;
}

.nav-chevron {
  margin-left: auto;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  transition: transform 220ms ease;
  color: rgba(255,255,255,0.4);
}

.nav-item[aria-expanded="true"] .nav-chevron {
  transform: rotate(180deg);
}

.nav-sub {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 0 4px 38px;
}

.nav-sub-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: rgba(255,255,255,0.5);
  font-size: 0.82rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 140ms, color 140ms;
}

.nav-sub-item:hover {
  color: rgba(255,255,255,0.82);
  background: rgba(255,255,255,0.06);
}

.nav-sub-item.active {
  color: #ffffff;
  background: rgba(52,211,153,0.12);
  border-color: rgba(52,211,153,0.2);
}

.sidebar-footer {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.sidebar-version-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.sidebar-version {
  font-size: 0.82rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.72);
  letter-spacing: 0.05em;
}

.shortcuts-help-button {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.65rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.shortcuts-help-button:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.shortcuts-dialog {
  border: none;
  border-radius: 14px;
  padding: 0;
  background: var(--surface);
  box-shadow: 0 8px 40px rgba(19, 29, 58, 0.18);
  width: 360px;
  max-width: calc(100vw - 32px);
}
.shortcuts-dialog::backdrop {
  background: rgba(19, 29, 58, 0.35);
  backdrop-filter: blur(2px);
}
.shortcuts-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--line);
}
.shortcuts-dialog-head h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}
.shortcuts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 16px 20px 20px;
  gap: 16px;
}
.shortcuts-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
}
.shortcut-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  font-size: 0.83rem;
  color: var(--ink);
}
.shortcut-row:last-child { margin-bottom: 0; }
.shortcut-mouse {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #5a6a88;
  background: #f0f4fb;
  border: 1px solid #dce6f5;
  border-radius: 5px;
  padding: 2px 7px;
  white-space: nowrap;
}
kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #f4f7fc;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  flex-shrink: 0;
}

.sidebar-account {
  position: relative;
  display: flex;
  gap: 8px;
}

.sidebar-note {
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(103, 232, 249, 0.16), rgba(245, 158, 11, 0.1));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.sidebar-note span,
.sidebar-note strong {
  display: block;
}

.sidebar-note strong {
  margin-top: 6px;
  font-size: 2rem;
}

.workspace {
  display: grid;
  align-content: start;
  gap: 20px;
  padding: 28px;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  height: 100dvh;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(320px, 1.4fr) minmax(180px, 1fr);
  align-items: center;
  gap: 18px;
}

.page-heading {
  align-self: center;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  line-height: 1.05;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.account-button {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  padding: 0 12px 0 8px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--accent);
  font-weight: 900;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
}

.account-admin-button {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.11);
  color: #ffffff;
  font-weight: 900;
  transition: background 160ms ease, transform 160ms ease;
}

.account-admin-button:hover,
.account-admin-button.active {
  background: rgba(103, 232, 249, 0.2);
  transform: translateY(-1px);
}

.account-avatar {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--teal));
  color: #ffffff;
  font-size: 0.76rem;
  font-weight: 900;
}

.refresh-app-button {
  color: #dff7ff;
}

.account-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 10px);
  max-height: min(320px, calc(100dvh - 100px));
  overflow-y: auto;
  z-index: 50;
  display: grid;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 16px;
  background: linear-gradient(160deg, #0d2847 0%, #0a1f3a 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.account-menu-identity {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 4px;
}

.account-menu-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #2d5be3, #2d5be3);
  color: #ffffff;
  font-size: 1.2rem;
  font-weight: 900;
  overflow: hidden;
}

.account-menu-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.account-menu strong {
  display: block;
  color: #ffffff;
  font-size: 0.96rem;
  font-weight: 900;
  text-align: center;
}

.account-menu span {
  display: block;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
}

.account-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.88rem;
  font-weight: 800;
  text-align: left;
  transition: background 140ms, border-color 140ms;
}

.account-menu button:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.account-menu button.is-danger {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.2);
}

.account-menu button.is-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ff6b6b;
}

.active-user {
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.active-user select {
  min-width: 136px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 10px;
  background: var(--surface);
  color: var(--accent);
  font-weight: 800;
  text-transform: none;
}

.search {
  display: flex;
  align-items: center;
  justify-self: center;
  gap: 8px;
  width: min(520px, 100%);
  height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 14px;
  background: var(--surface);
  color: var(--muted);
  box-shadow: 0 10px 28px rgba(30, 45, 90, 0.07);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.search:focus-within,
.client-search:focus-within {
  border-color: #8bb9e8;
  box-shadow: 0 0 0 4px rgba(14, 165, 183, 0.12), 0 14px 34px rgba(30, 45, 90, 0.1);
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.icon-button,
.primary-button,
.segment,
.edit-button,
.delete-button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--accent);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.icon-button:hover {
  border-color: #9bb7dc;
  background: #eef8ff;
  box-shadow: 0 10px 24px rgba(30, 45, 90, 0.1);
  transform: translateY(-1px);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.metric {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(30, 45, 90, 0.06);
  cursor: pointer;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.metric:hover {
  border-color: #9bb7dc;
  background: rgba(238, 248, 255, 0.95);
  box-shadow: 0 4px 14px rgba(30, 45, 90, 0.12);
  transform: translateY(-1px);
}

.metric.active {
  border-color: transparent;
  background: linear-gradient(135deg, #131d3a, #1e2d5a);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

.metric.active span {
  color: rgba(255, 255, 255, 0.8);
}

.metric.active strong {
  background: none;
  -webkit-text-fill-color: #ffffff;
  color: #ffffff;
}

.metric span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.metric strong {
  margin-left: auto;
  background: linear-gradient(135deg, #1e2d5a, #2d5be3);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 1.15rem;
  font-weight: 900;
}

.global-results {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.global-result {
  display: grid;
  gap: 3px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
}

.global-result strong {
  color: var(--accent);
}

.global-result span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.admin-imports {
  display: grid;
  gap: 8px;
}

.entry-panel,
.controls,
.admin-panel,
.activity-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  min-width: 0;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.count-pill {
  display: grid;
  min-width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #e0e8f8, #ccfbf1);
  color: var(--accent);
  font-weight: 800;
}

.admin-subhead {
  margin-top: 26px;
}

.admin-home-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.admin-section-label {
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 20px 0 8px;
}

.admin-section-label:first-of-type {
  margin-top: 0;
}

/* ── Gestion tiles ── */
.admin-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.update-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.update-available-badge {
  display: inline-grid;
  min-height: 28px;
  place-items: center;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 0.74rem;
  font-weight: 800;
  white-space: nowrap;
}

.update-available-badge.has-update {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.update-available-badge.is-uptodate {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes spin-flipped {
  to { transform: scaleX(-1) rotate(-360deg); }
}

.is-spinning .button-icon,
.is-spinning svg {
  animation: spin 0.8s linear infinite;
}

.check-update-icon {
  transform: scaleX(-1);
}

.is-spinning .check-update-icon {
  animation: spin-flipped 0.8s linear infinite;
}

.version-badge {
  display: inline-grid;
  min-height: 34px;
  place-items: center;
  border: 1px solid #c8d4f0;
  border-radius: 999px;
  padding: 0 12px;
  background: linear-gradient(135deg, #f0f4fb, #ecfeff);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 950;
  white-space: nowrap;
}

.update-progress {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.update-progress span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  background: #ffffff;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.update-progress span.is-done {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}

.update-progress span.is-active {
  border-color: #93c5fd;
  background: #f0f4fb;
  color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 165, 183, 0.12);
}

.admin-status {
  margin-top: 10px;
  white-space: pre-wrap;
  border: 1px solid #c8d4f0;
  border-radius: var(--radius);
  padding: 10px 12px;
  background: #f0f4fb;
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 800;
}

.admin-status.is-error {
  border-color: #fecaca;
  background: #fff1f2;
  color: #b91c1c;
}

/* ── Update terminal modal ── */
.update-terminal-dialog {
  border: none;
  border-radius: 12px;
  padding: 0;
  width: min(720px, 96vw);
  max-height: 80vh;
  background: #0f172a;
  color: #e2e8f0;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.update-terminal-dialog[open] {
  display: flex;
  flex-direction: column;
}

.update-terminal-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
}

.update-terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
  flex-shrink: 0;
}

.update-terminal-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #94a3b8;
}

.terminal-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #334155;
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.update-terminal-close {
  width: 28px;
  height: 28px;
  border: 1px solid #334155;
  border-radius: 6px;
  background: transparent;
  color: #64748b;
  font-size: 0.8rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.12s, color 0.12s;
}

.update-terminal-close:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
}

.update-terminal-close:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.update-terminal-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  margin: 0;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", ui-monospace, monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  color: #cbd5e1;
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 200px;
  max-height: 50vh;
}

.update-terminal-log .log-dim     { color: #334155; }
.update-terminal-log .log-ok      { color: #4ade80; }
.update-terminal-log .log-warn    { color: #fb923c; }
.update-terminal-log .log-error   { color: #f87171; }
.update-terminal-log .log-info    { color: #38bdf8; }
.update-terminal-log .log-prompt  { color: #a78bfa; }
.update-terminal-log .log-section { color: #94a3b8; font-weight: 700; }
.update-terminal-log .log-commit  { color: #fbbf24; }

.update-terminal-footer {
  padding: 10px 16px;
  background: #1e293b;
  border-top: 1px solid #334155;
  font-size: 0.78rem;
  font-weight: 700;
  color: #64748b;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.update-terminal-footer.is-ok    { color: #4ade80; }
.update-terminal-footer.is-error { color: #f87171; }

.update-terminal-confirm {
  padding: 24px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.update-terminal-confirm-text {
  margin: 0;
  font-size: 0.9rem;
  color: #e2e8f0;
  line-height: 1.6;
}

.update-terminal-confirm-text span {
  color: #94a3b8;
  font-size: 0.82rem;
}

.update-terminal-confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.update-terminal-cancel-btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: transparent;
  color: #94a3b8;
  font-size: 0.85rem;
  cursor: pointer;
}

.update-terminal-cancel-btn:hover { background: #1e293b; color: #e2e8f0; }

.update-terminal-confirm-btn {
  padding: 8px 18px;
  border-radius: 8px;
  border: none;
  background: #1e2d5a;
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.update-terminal-confirm-btn:hover { background: #1e2d5a; }

.admin-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 2px 8px rgba(30, 45, 90, 0.05);
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
  cursor: pointer;
}

.admin-tile:hover {
  border-color: #93c5fd;
  background: #f0f4fb;
  box-shadow: 0 8px 24px rgba(30, 45, 90, 0.1);
  transform: translateY(-1px);
}

.admin-tile-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #ffffff;
}

.admin-tile-icon--users  { background: linear-gradient(135deg, #2d5be3, #1e2d5a); }
.admin-tile-icon--clients { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.admin-tile-icon--types  { background: linear-gradient(135deg, #2d5be3, #2d5be3); }

.admin-tile-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-tile-title {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-tile-desc {
  font-size: 0.76rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-tile-count {
  flex-shrink: 0;
  min-width: 32px;
  height: 32px;
  border-radius: 999px;
  background: linear-gradient(135deg, #e0e8f8, #e0f2fe);
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 900;
  display: grid;
  place-items: center;
}

.admin-tile-arrow {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  stroke: var(--muted);
  transition: stroke 140ms, transform 140ms;
}

.admin-tile:hover .admin-tile-arrow {
  stroke: var(--accent);
  transform: translateX(2px);
}

/* ── Données cards ── */
.admin-data-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.admin-data-card {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(30, 45, 90, 0.05);
  text-align: left;
}

.admin-data-card--clickable {
  cursor: pointer;
  transition: border-color 140ms, box-shadow 140ms, transform 140ms, background 140ms;
}

.admin-data-card--clickable:hover {
  border-color: #93c5fd;
  background: #f0f4fb;
  box-shadow: 0 8px 24px rgba(30, 45, 90, 0.1);
  transform: translateY(-1px);
}

.admin-data-card-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #ffffff;
}

.admin-data-card-icon--backup  { background: linear-gradient(135deg, #10b981, #059669); }
.admin-data-card-icon--restore { background: linear-gradient(135deg, #f59e0b, #d97706); }
.admin-app-card-icon--notif    { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }

.admin-data-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-data-card-body strong {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--accent);
}

.admin-data-card-body span {
  font-size: 0.76rem;
  color: var(--muted);
}

/* ── Application card ── */
.admin-app-card {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(30, 45, 90, 0.05);
  flex-wrap: wrap;
}

.admin-app-card-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: linear-gradient(135deg, #1e2d5a, #131d3a);
}

.admin-app-card-body {
  flex: 1;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-app-card-body strong {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--accent);
}

.admin-app-card-body span {
  font-size: 0.76rem;
  color: var(--muted);
}

.admin-app-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Import rows ── */
.admin-import-row {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  background: #f8fbff;
}

.admin-import-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  stroke: var(--muted);
}

.admin-import-label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  cursor: pointer;
  margin-right: auto;
}

.admin-import-label span {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.admin-import-label input[type="file"] {
  font-size: 0.8rem;
  color: var(--muted);
  min-width: 0;
  flex: 1;
}

.admin-file-label {
  cursor: pointer;
  white-space: nowrap;
}

.user-form,
.client-form,
.client-import-form {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
}

.user-form {
  grid-template-columns: minmax(150px, 0.8fr) minmax(150px, 1fr) minmax(140px, 0.8fr) 92px minmax(150px, 1fr) auto;
}

.client-form {
  grid-template-columns: minmax(220px, 1fr) auto;
}

#clientForm {
  grid-template-columns: minmax(150px, 0.6fr) minmax(220px, 1fr) auto;
}

.client-import-form {
  grid-template-columns: minmax(260px, 1fr) auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}

#typeForm {
  grid-template-columns: minmax(220px, 1fr) 120px auto;
}

.user-form label,
.client-form label,
.client-import-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.user-form input,
.user-form select,
.client-form input,
.client-import-form input {
  min-height: 42px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 12px;
  background: #ffffff;
  color: var(--ink);
}

.user-color-swatch {
  display: block;
  width: 42px;
  height: 8px;
  margin-top: 8px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(19, 29, 58, 0.14);
}

.messages-layout {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: 14px;
}

.knowledge-layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 16px;
  margin-top: 14px;
  align-items: start;
}

.knowledge-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  margin-bottom: 12px;
}

.knowledge-filters select {
  height: 40px;
  min-height: 40px;
  border: 1px solid rgba(30, 45, 90, 0.15);
  border-radius: 10px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--accent);
  font-weight: 700;
}

.knowledge-list {
  display: grid;
  align-content: start;
  gap: 6px;
  max-height: 68vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: #f8fafd;
  box-shadow: 0 2px 12px rgba(19, 29, 58, 0.06);
}
[data-theme="dark"] .knowledge-list { background: #151f2e; }

.knowledge-group {
  border: none;
  border-radius: var(--radius);
  background: transparent;
  overflow: hidden;
  margin-bottom: 4px;
}

.knowledge-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
  padding: 0 10px;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  list-style: none;
  background: transparent;
  border-radius: 8px;
  transition: background 140ms;
}

.knowledge-group summary::-webkit-details-marker {
  display: none;
}

.knowledge-group summary:hover {
  background: rgba(30, 45, 90, 0.05);
  color: var(--accent);
}

.knowledge-group[open] summary {
  color: var(--accent);
}

.knowledge-group summary::before {
  content: "›";
  color: var(--muted);
  font-size: 1.2rem;
  transition: transform 0.16s ease;
}

.knowledge-group[open] summary::before {
  transform: rotate(90deg);
}

.knowledge-group summary span {
  flex: 1;
}

.knowledge-group summary strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.7rem;
  padding: 2px 7px;
}

.knowledge-kind-troubleshooting summary strong {
  background: #e11d48;
}

.knowledge-kind-commissioning summary strong {
  background: #0e7490;
}

.knowledge-kind-order summary strong {
  background: #b45309;
}

.knowledge-kind-internal summary strong {
  background: var(--accent);
}

.knowledge-kind-faq summary strong {
  background: #15803d;
}

.knowledge-group-items {
  display: grid;
  gap: 4px;
  padding: 6px;
}

.knowledge-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 3px 8px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 9px 11px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms, box-shadow 140ms, background 140ms;
  box-shadow: 0 1px 3px rgba(19,29,58,0.05);
}
[data-theme="dark"] .knowledge-item { background: #1a2738; }

.knowledge-item:hover {
  border-color: var(--line);
  box-shadow: 0 2px 8px rgba(19,29,58,0.09);
}

.knowledge-item.active {
  background: #ffffff;
  border-color: var(--accent);
  border-left-width: 3px;
  box-shadow: 0 2px 10px rgba(30,45,90,0.12);
}
[data-theme="dark"] .knowledge-item.active { background: #1e2d42; }

.knowledge-item strong,
.knowledge-detail h3 {
  color: var(--accent);
}

.knowledge-item strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.knowledge-item span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.knowledge-item em {
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.65rem;
  font-style: normal;
  font-weight: 700;
  flex-shrink: 0;
  border: 1px solid transparent;
}
.knowledge-item em[data-status="validated"] {
  background: rgba(16,185,129,0.12);
  color: #059669;
  border-color: rgba(16,185,129,0.25);
}
.knowledge-item em[data-status="draft"] {
  background: rgba(90,106,136,0.1);
  color: var(--muted);
  border-color: var(--line);
}
.knowledge-item em[data-status="review"] {
  background: rgba(245,158,11,0.12);
  color: #d97706;
  border-color: rgba(245,158,11,0.25);
}

.knowledge-item small,
.knowledge-detail-head span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
}

.knowledge-item small {
  grid-column: 1 / -1;
  opacity: 0.6;
  font-size: 0.68rem;
}

.knowledge-item.active strong {
  color: var(--accent);
  font-weight: 800;
}

.knowledge-detail {
  min-height: 400px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  background: #ffffff;
  box-shadow: 0 2px 16px rgba(19, 29, 58, 0.06);
}
[data-theme="dark"] .knowledge-detail { background: #151f2e; }

.knowledge-detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(203, 213, 225, 0.4);
}

.knowledge-detail h2,
.knowledge-detail-head h2 {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--accent);
  margin: 0;
}

.knowledge-detail h3 {
  margin: 0 0 4px;
  font-size: 1.35rem;
}

.knowledge-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0;
}

.knowledge-tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  background: #ffffff;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(19,29,58,0.06);
}
[data-theme="dark"] .knowledge-tags span { background: #1a2738; }

.knowledge-meta-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0;
}

.knowledge-meta-grid span {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #f8fafd;
}
[data-theme="dark"] .knowledge-meta-grid span { background: #1a2738; }

.knowledge-meta-grid strong {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.knowledge-meta-grid small {
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 700;
}

.knowledge-block {
  display: grid;
  gap: 10px;
  margin: 12px 0;
  border: none;
  border-left: 3px solid var(--line);
  border-radius: 0 10px 10px 0;
  padding: 14px 16px;
  background: #f8fafd;
}
[data-theme="dark"] .knowledge-block { background: #1a2738; border-left-color: #253044; }

.knowledge-block:nth-child(1) { border-left-color: #6366f1; }
.knowledge-block:nth-child(2) { border-left-color: #0ea5e9; }
.knowledge-block:nth-child(3) { border-left-color: #10b981; }

.knowledge-block h4 {
  margin: 0;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: none;
}

.knowledge-block ul,
.knowledge-block ol {
  margin: 0;
  padding-left: 20px;
  color: var(--ink);
  line-height: 1.6;
  font-size: 0.9rem;
}

.knowledge-block li {
  padding: 2px 0;
}

.knowledge-content {
  display: grid;
  gap: 12px;
  color: var(--ink);
  line-height: 1.65;
  white-space: pre-wrap;
  font-size: 0.9rem;
}

/* ── Chat sidebar (threads) ── */
/* ══════════════════════════════════════════════
   MESSAGERIE — design S2MI brand
   ══════════════════════════════════════════════ */

/* Thread list (colonne gauche) */
.message-threads {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #ffffff;
  border-right: 1px solid #e4eaf4;
  overflow-y: auto;
  padding: 8px 6px;
}

.message-thread {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 6px;
  border-radius: 12px;
  background: transparent;
  border: none;
  text-align: center;
  cursor: pointer;
  transition: background 0.12s;
  min-width: 0;
  width: 100%;
  position: relative;
}

.message-thread:hover {
  background: #f0f5ff;
}

.message-thread.active {
  background: #deeafb;
}

.thread-avatar {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e2d5a, #2d5be3);
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 6px rgba(30,45,90,0.25);
}

.thread-info {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.thread-info-top {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 4px;
  width: 100%;
}

.thread-info-name {
  font-weight: 700;
  font-size: 0.75rem;
  color: #1a2235;
  word-break: break-word;
  width: 100%;
  text-align: center;
}

.thread-info-time {
  font-size: 0.62rem;
  color: #8a9ab8;
  text-align: center;
  width: 100%;
}

.thread-info-preview {
  font-size: 0.7rem;
  color: #8a9ab8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  text-align: center;
}

.message-thread.has-unread .thread-info-preview {
  font-weight: 600;
  color: #1a2235;
}

.message-thread-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  padding: 0 4px;
  border: 2px solid #fff;
}

/* ── Chat panel (colonne droite) ── */
.message-thread-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #f0f4fb;
}

.message-thread-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #ffffff;
  border-bottom: 1px solid #e4eaf4;
  box-shadow: 0 1px 4px rgba(30,45,90,0.07);
}

.message-thread-header-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e2d5a, #2d5be3);
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 6px rgba(30,45,90,0.2);
}

.message-thread-title {
  flex: 1;
  color: #1a2235;
  font-size: 0.95rem;
  font-weight: 800;
}

/* ── Search bar ── */
.chat-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f7f9fd;
  border-bottom: 1px solid #e4eaf4;
}

.chat-search-bar svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  stroke: #8a9ab8;
  stroke-width: 2;
  fill: none;
}

.chat-search-bar input {
  flex: 1;
  height: 34px;
  border: 1px solid #d6e0f0;
  border-radius: 17px;
  padding: 0 14px;
  font-size: 0.85rem;
  background: #ffffff;
  color: #1a2235;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.chat-search-bar input::placeholder {
  color: #b0bdd4;
}

.chat-search-bar input:focus {
  outline: none;
  border-color: #1e2d5a;
  box-shadow: 0 0 0 3px rgba(30,45,90,0.1);
}

.chat-search-count {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: #ffffff;
  background: #1e2d5a;
  padding: 2px 8px;
  border-radius: 99px;
  white-space: nowrap;
}

/* ── Messages list ── */
.chat-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  max-height: min(56vh, 600px);
  overflow-y: auto;
  padding: 12px 14px;
  scroll-behavior: smooth;
  background:
    radial-gradient(ellipse at 15% 25%, rgba(45,91,227,0.06) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 75%, rgba(30,45,90,0.05) 0%, transparent 55%),
    #f0f4fb;
}

.chat-date-separator {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 10px;
}

.chat-date-separator span {
  background: rgba(255,255,255,0.9);
  color: #1e2d5a;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 99px;
  border: 1px solid rgba(30,45,90,0.2);
  white-space: nowrap;
}

.chat-date-separator::before,
.chat-date-separator::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(30,45,90,0.12);
}

/* row = avatar + bubble(s) */
.chat-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.chat-row.is-mine {
  flex-direction: row-reverse;
}

.chat-row + .chat-row.same-user {
  margin-top: 2px;
}

.chat-avatar {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  background: var(--message-user-color, var(--accent));
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-avatar-placeholder {
  width: 30px;
  flex-shrink: 0;
}

.chat-bubble-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  max-width: min(480px, 72%);
}

.chat-sender-name {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--message-user-color, #2d5be3);
  padding: 0 12px;
  margin-bottom: 2px;
}

.chat-bubble {
  position: relative;
  padding: 8px 14px 6px;
  border-radius: 18px;
  line-height: 1.5;
  font-size: 0.9rem;
  word-break: break-word;
  background: #ffffff;
  color: #1a2235;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.chat-bubble.first {
  border-top-left-radius: 4px;
}

.chat-bubble.last {
  border-bottom-left-radius: 4px;
}

.is-mine .chat-bubble {
  background: linear-gradient(135deg, #1e2d5a, #0a4a8a);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(30,45,90,0.3);
}

.is-mine .chat-bubble.first {
  border-top-right-radius: 4px;
  border-top-left-radius: 18px;
}

.is-mine .chat-bubble.last {
  border-bottom-right-radius: 4px;
  border-bottom-left-radius: 18px;
}

.chat-bubble-time {
  display: block;
  margin-bottom: 3px;
  padding: 0 2px;
  color: rgba(26,41,66,0.38);
  font-size: 0.62rem;
  font-weight: 500;
  text-align: center;
}

.is-mine .chat-bubble-group .chat-bubble-time {
  text-align: center;
}

/* ── Search highlight ── */
mark.chat-highlight {
  background: #fde047;
  color: #1a2235;
  border-radius: 2px;
  padding: 0 1px;
}

/* ── Input area ── */
.chat-form {
  display: flex;
  align-items: center;
  position: relative;
  gap: 8px;
  padding: 10px 12px;
  background: #f7f9fd;
  border-top: 1px solid #e4eaf4;
}

.chat-emoji-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: transparent;
  font-size: 1.2rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s, transform 0.1s;
  color: #8a9ab8;
}

.chat-emoji-btn:hover {
  background: #e8edf8;
  transform: scale(1.1);
}

.chat-attach-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #8a9ab8;
  transition: background 0.15s, transform 0.1s;
}
.chat-attach-btn:hover { background: #e8edf8; transform: scale(1.1); color: #1e2d5a; }

.chat-attachment {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  color: inherit;
  font-size: 0.78rem;
  text-decoration: none;
  max-width: 100%;
  overflow: hidden;
}
.chat-attachment:hover { background: rgba(255,255,255,0.25); }
.chat-attachment-img {
  max-width: 200px;
  max-height: 160px;
  border-radius: 8px;
  display: block;
  object-fit: cover;
}

.chat-form input {
  flex: 1;
  min-height: 44px;
  border: 1px solid #d6e0f0;
  border-radius: 22px;
  padding: 0 16px;
  font-size: 0.92rem;
  background: #ffffff;
  color: #1a2235;
  box-shadow: 0 1px 3px rgba(30,45,90,0.06);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.chat-form input::placeholder {
  color: #b0bdd4;
}

.chat-form input:focus {
  outline: none;
  border-color: #1e2d5a;
  box-shadow: 0 0 0 3px rgba(30,45,90,0.1);
}

.chat-send-button {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #2d5be3, #1e2d5a);
  color: #ffffff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
  box-shadow: 0 2px 8px rgba(45,91,227,0.4);
}

.chat-send-button:hover { filter: brightness(1.12); }
.chat-send-button:active { transform: scale(0.93); }

.chat-send-button svg {
  width: 18px;
  height: 18px;
  stroke: #ffffff;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Emoji picker ── */
.emoji-picker {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(8, 34px);
  gap: 4px;
  border: 1px solid #d6e0f0;
  border-radius: 14px;
  padding: 10px;
  background: #ffffff;
  box-shadow: 0 8px 32px rgba(30,45,90,0.15);
  max-height: 220px;
  overflow-y: auto;
}

.emoji-picker button {
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-size: 1.15rem;
  cursor: pointer;
  transition: background 0.1s, transform 0.1s;
  display: grid;
  place-items: center;
}

.emoji-picker button:hover {
  background: #e8edf8;
  transform: scale(1.2);
}

@media (max-width: 820px) {
  .messages-layout {
    grid-template-columns: 1fr;
  }

  .knowledge-layout {
    grid-template-columns: 1fr;
  }

  .knowledge-meta-grid {
    grid-template-columns: 1fr;
  }
}

.photo-field input {
  padding-top: 9px;
}

.user-list,
.client-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.user-card,
.client-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #f8fafc;
}

.client-card {
  grid-template-columns: 44px minmax(0, 1fr) auto;
}

.type-card {
  grid-template-columns: 34px minmax(0, 1fr) auto;
}

.admin-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.admin-card-actions .secondary-button {
  min-height: 30px;
  padding: 0 10px;
}

.type-swatch {
  display: block;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--type-color);
}

.user-card.is-active {
  border-color: #9bb7dc;
  background: #eef6ff;
}

.avatar {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  font-weight: 900;
  object-fit: cover;
}

.avatar-upload-wrap {
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
  border-radius: 50%;
}

.avatar-upload-wrap::after {
  content: "📷";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(6,26,51,0.55);
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  opacity: 0;
  transition: opacity 0.15s;
}

.avatar-upload-wrap:hover::after {
  opacity: 1;
}

.user-card strong,
.user-card span {
  display: block;
}

.client-card strong,
.client-card span {
  display: block;
}

.client-card span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
}

.client-logo,
.client-directory-logo,
.client-detail-logo {
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #f0f4ff;
  color: var(--accent);
  font-weight: 900;
  object-fit: contain;
  padding: 6px;
  border: 2px solid rgba(30, 45, 90, 0.1);
}

.client-logo {
  width: 44px;
  height: 44px;
}

.client-directory-logo {
  width: 80px;
  height: 80px;
  box-shadow: 0 3px 10px rgba(19, 29, 58, 0.12);
  border-radius: 16px;
}

.client-detail-logo {
  width: 74px;
  height: 74px;
  box-shadow: 0 4px 12px rgba(19, 29, 58, 0.1);
}

.client-logo-fallback {
  border: 1px solid var(--line);
}

.client-search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  margin-bottom: 0;
  border: 1px solid rgba(30, 45, 90, 0.15);
  border-radius: 12px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--muted);
  box-shadow: 0 2px 8px rgba(19, 29, 58, 0.06);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.client-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
}

.client-search .field-icon {
  color: var(--muted);
  flex-shrink: 0;
}

.client-directory {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 10px;
}

.client-directory-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  text-align: center;
  border: 1px solid rgba(203, 213, 225, 0.6);
  border-radius: 12px;
  padding: 14px 10px 12px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(19, 29, 58, 0.05), 0 4px 10px rgba(19, 29, 58, 0.04);
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.client-directory-card:hover,
.client-directory-card.is-selected {
  border-color: #9bb7dc;
  background: rgba(238, 246, 255, 0.95);
  box-shadow: 0 4px 14px rgba(30, 45, 90, 0.12);
  transform: translateY(-2px);
}

.client-directory-card strong,
.client-directory-card span span {
  display: block;
}

.client-directory-card strong {
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 900;
  line-height: 1.2;
}

.client-directory-card span span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.client-overview,
.calendar-list {
  display: grid;
  gap: 12px;
}

/* ── Monthly calendar (desktop) ── */
.month-calendar {
  display: grid;
  gap: 12px;
}

.month-calendar-head,
.calendar-cell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.month-calendar-head h3 {
  color: var(--accent);
  font-size: 1.1rem;
  font-weight: 800;
  text-transform: capitalize;
}

.calendar-nav-group {
  display: flex;
  gap: 6px;
}

.calendar-nav-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: rgba(30, 45, 90, 0.08);
  color: var(--accent);
  font-size: 1.2rem;
  font-weight: 900;
  transition: background 140ms, transform 140ms;
}

.calendar-nav-button:hover {
  background: rgba(30, 45, 90, 0.15);
  transform: scale(1.08);
}

.month-calendar-head span,
.calendar-cell-head span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.calendar-weekdays,
.calendar-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-weekdays span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-bottom: 4px;
}

.calendar-cell {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 120px;
  border: 1px solid rgba(203, 213, 225, 0.5);
  border-radius: 10px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 1px 4px rgba(30, 45, 90, 0.05);
  transition: box-shadow 140ms, border-color 140ms;
}

.calendar-cell:hover {
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 0 4px 12px rgba(30, 45, 90, 0.1);
}

.calendar-cell.is-today {
  background: linear-gradient(160deg, rgba(37, 99, 235, 0.12), rgba(8, 145, 178, 0.08));
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.2), 0 4px 12px rgba(37, 99, 235, 0.1);
}

.calendar-cell.is-today .calendar-cell-head strong {
  color: #1e2d5a;
  background: #1e2d5a;
  color: #ffffff;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 0.8rem;
}

.calendar-cell.is-drag-over {
  border-color: #2d5be3;
  background: rgba(219, 234, 254, 0.6);
}

.calendar-cell.is-outside-month {
  opacity: 0.32;
  box-shadow: none;
}

.calendar-cell-head strong {
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 800;
}

.calendar-cell-tasks {
  display: grid;
  gap: 4px;
}

.calendar-task-pill {
  overflow: hidden;
  width: 100%;
  border: 1px solid color-mix(in srgb, var(--task-type-bg, #e0e8f8) 65%, #6b7ea0);
  border-radius: 6px;
  padding: 4px 6px;
  background: color-mix(in srgb, var(--task-type-bg, #e0e8f8) 60%, #ffffff);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: transform 100ms;
}

.calendar-task-pill:hover {
  transform: translateX(2px);
}

.calendar-task-pill.is-dragging {
  opacity: 0.5;
}

.calendar-task-pill.is-late {
  color: #dc2626;
  font-weight: 900;
}

/* ── Agenda calendar (mobile) ── */
.agenda-calendar {
  display: grid;
  gap: 14px;
}

.agenda-list {
  display: grid;
  gap: 10px;
}

.agenda-day {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 12px;
  align-items: start;
  border: 1px solid rgba(203, 213, 225, 0.6);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(30, 45, 90, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.agenda-day.is-today {
  border-color: rgba(37, 99, 235, 0.4);
  background: linear-gradient(160deg, rgba(37, 99, 235, 0.07), rgba(255, 255, 255, 0.9));
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15), 0 4px 14px rgba(37, 99, 235, 0.1);
}

.agenda-day.is-past {
  opacity: 0.6;
}

.agenda-day-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 2px;
  border-right: 1px solid rgba(203, 213, 225, 0.5);
  padding-right: 12px;
}

.agenda-day-label strong {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
}

.agenda-day.is-today .agenda-day-label strong {
  color: #1e2d5a;
}

.agenda-day-label span {
  margin-top: 3px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: capitalize;
  text-align: center;
}

.agenda-task-list {
  display: grid;
  gap: 6px;
}

.agenda-task-pill {
  width: 100%;
  border: 1px solid color-mix(in srgb, var(--task-type-bg, #e0e8f8) 65%, #6b7ea0);
  border-radius: 8px;
  padding: 8px 10px;
  background: color-mix(in srgb, var(--task-type-bg, #e0e8f8) 55%, #ffffff);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 700;
  text-align: left;
  min-height: 44px;
  display: flex;
  align-items: center;
  transition: transform 120ms;
}

.agenda-task-pill:hover {
  transform: translateX(3px);
}

.agenda-task-pill.is-late {
  color: #dc2626;
  font-weight: 900;
}

.client-overview-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(19,29,58,0.05);
}
[data-theme="dark"] .client-overview-card { background: #1a2738; }

.client-overview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.client-overview-head strong {
  color: var(--accent);
  font-size: 1rem;
}

.client-overview-head span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.client-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.client-stats span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  background: #ffffff;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.client-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.client-summary span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid #e4eaf4;
  border-radius: 99px;
  padding: 3px 10px 3px 8px;
  background: #ffffff;
  white-space: nowrap;
}

.client-summary strong {
  color: #1e2d5a;
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1;
}

.client-summary small {
  color: #8a9ab8;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.client-detail {
  display: grid;
  gap: 16px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: #f8fbff;
  box-shadow: 0 14px 36px rgba(30, 45, 90, 0.08);
}

.client-detail-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  border: 1px solid rgba(203, 213, 225, 0.6);
  border-radius: 14px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(19, 29, 58, 0.06), 0 8px 24px rgba(30, 45, 90, 0.06);
  margin-bottom: 16px;
}

.client-detail-head span {
  color: rgba(100, 116, 139, 0.62);
  font-size: 0.72rem;
  font-weight: 800;
  padding-left: 4px;
}

.client-logo-edit {
  display: grid;
  cursor: pointer;
}

.client-logo-edit input {
  display: none;
}

.client-logo-edit:hover .client-detail-logo {
  outline: 2px solid #9bb7dc;
  outline-offset: 2px;
}

.client-detail-title {
  display: grid;
  gap: 5px;
}

.client-detail-name-input,
.client-detail-address-input {
  width: 100%;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 2px 4px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 900;
}

.client-detail-name-input {
  max-width: 520px;
  font-size: 1.55rem;
  line-height: 1.15;
}

.client-detail-address-input {
  max-width: 620px;
  resize: vertical;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.client-detail-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.client-detail-name-input:hover,
.client-detail-name-input:focus,
.client-detail-address-input:hover,
.client-detail-address-input:focus {
  border-color: var(--line);
  background: #f8fafc;
  outline: 0;
}

.client-detail h4 {
  color: var(--accent);
  font-size: 0.92rem;
}

.client-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 16px;
}

.client-tab {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 6px 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.82rem;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.client-tab.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.client-tab-panel,
.client-contact-tab,
.client-info-tab,
.client-documents-tab { display: grid; gap: 12px; }

/* ── Documents tab refonte ────────────────────────────────────────────── */
.docs-tab {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.docs-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.docs-sort-select {
  padding: 5px 10px;
  border: 1px solid #d0ddf0;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #2a3a52;
  background: #f7f9fd;
  cursor: pointer;
  outline: none;
}
.docs-sort-select:focus { border-color: #1e2d5a; }

.docs-counter {
  font-size: 0.78rem;
  font-weight: 700;
  color: #9aabca;
  margin-left: 4px;
  margin-right: auto;
}

.docs-view-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid #d0ddf0;
  border-radius: 8px;
  background: #f7f9fd;
  color: #7a8daa;
  cursor: pointer;
  transition: all 0.12s;
}
.docs-view-btn.is-active { background: #1e2d5a; border-color: #1e2d5a; color: #fff; }
.docs-view-btn:hover:not(.is-active) { border-color: #1e2d5a; color: #1e2d5a; }

/* ── Grille ── */
.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.doc-card {
  position: relative;
  border: 1px solid #e4eaf4;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  transition: box-shadow 0.15s, transform 0.12s;
  cursor: pointer;
}
.doc-card:hover {
  box-shadow: 0 6px 20px rgba(30,45,90,0.12);
  transform: translateY(-2px);
  border-color: #b8d0f0;
}

.doc-thumb {
  width: 100%;
  aspect-ratio: 4/3;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
}
.doc-thumb-img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.doc-type-badge {
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  padding: 10px 14px;
  border-radius: 10px;
}

.doc-card-info {
  padding: 8px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.doc-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: #1a2e4a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.doc-meta {
  font-size: 0.7rem;
  color: #9aabca;
}

.doc-del-btn {
  position: absolute;
  top: 5px; right: 5px;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(6,26,51,0.45);
  color: #fff;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
}
.doc-card:hover .doc-del-btn { display: flex; }
.doc-del-btn:hover { background: #c0392b; }

/* ── Liste ── */
.docs-list {
  display: flex;
  flex-direction: column;
  border: 1px solid #e4eaf4;
  border-radius: 12px;
  overflow: hidden;
}

.doc-row {
  display: grid;
  grid-template-columns: 36px 1fr 70px 110px 28px 28px;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-bottom: 1px solid #f0f4fb;
  background: #fff;
  transition: background 0.1s;
}
.doc-row:last-child { border-bottom: none; }
.doc-row:hover { background: #f7f9fd; }

.doc-row-icon {
  font-size: 0.68rem;
  font-weight: 900;
  padding: 4px 5px;
  border-radius: 6px;
  text-align: center;
  letter-spacing: 0.02em;
}
.doc-row-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: #1a2e4a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-row-size {
  font-size: 0.75rem;
  color: #9aabca;
  text-align: right;
}
.doc-row-date {
  font-size: 0.75rem;
  color: #9aabca;
  text-align: right;
}
.doc-row-open, .doc-row-del {
  width: 26px; height: 26px;
  border: none; border-radius: 6px;
  background: none;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.1s, color 0.1s;
  color: #9aabca;
}
.doc-row-open:hover { background: #eef4ff; color: #1e2d5a; }
.doc-row-del:hover { background: #ffeaea; color: #c0392b; }

/* ── Zone de dépôt ── */
.docs-dropzone {
  border: 2px dashed #c8d8f0;
  border-radius: 14px;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: #f7f9fd;
  color: #7a8daa;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  user-select: none;
}
.docs-dropzone:hover, .docs-dropzone.is-over {
  background: #eef4ff;
  border-color: #1e2d5a;
  color: #1e2d5a;
}
.docs-dropzone.is-loading { opacity: 0.6; pointer-events: none; }

.dropzone-label {
  font-size: 0.88rem;
  font-weight: 700;
}
.dropzone-sub {
  font-size: 0.78rem;
}
.dropzone-browse { cursor: pointer; color: #1e2d5a; }

.docs-empty {
  padding: 32px 16px;
  text-align: center;
  color: #9aabca;
  font-size: 0.85rem;
}

.client-tab-panel {
  border: 1px solid rgba(203, 213, 225, 0.6);
  border-radius: 12px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 2px 6px rgba(19, 29, 58, 0.04);
}

.client-identity-form,
.client-contact-form,
.client-info-form,
.client-document-form {
  display: grid;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #f6f9fd;
}

.client-identity-form {
  grid-template-columns: minmax(140px, 0.45fr) minmax(180px, 0.8fr) minmax(220px, 1fr) auto;
}

.client-identity-summary {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #f8fafc;
}

.client-identity-summary strong {
  display: block;
  color: var(--accent);
  font-size: 1rem;
}

.client-identity-summary p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
  white-space: pre-line;
}

.client-identity-actions {
  display: flex;
  gap: 8px;
}

.client-contact-form {
  grid-template-columns: repeat(5, minmax(120px, 1fr)) auto;
}

/* Formulaire d'édition inline dans la carte */
.client-contact-edit-card {
  align-items: stretch;
}

.client-contact-edit-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 12px 14px;
  border-left: 1px solid #f0f4fb;
}

.client-contact-edit-form input {
  width: 100%;
  min-width: 0;
  border: 1px solid #d6e0f0;
  border-radius: 8px;
  padding: 7px 10px;
  font: inherit;
  font-size: 0.87rem;
  background: #fff;
  color: #1a2235;
  box-sizing: border-box;
}

.client-contact-edit-form input:focus {
  outline: none;
  border-color: #1e2d5a;
  box-shadow: 0 0 0 3px rgba(30, 95, 168, 0.12);
}

.contact-edit-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.contact-edit-buttons {
  display: flex;
  gap: 7px;
  margin-top: 2px;
}

.contact-edit-buttons .primary-button,
.contact-edit-buttons .secondary-button {
  padding: 6px 14px;
  font-size: 0.84rem;
}

.client-info-form {
  grid-template-columns: minmax(180px, 0.55fr) minmax(240px, 1fr) auto;
}

.client-document-form {
  grid-template-columns: minmax(240px, 1fr) auto;
}

.client-identity-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.client-identity-form input,
.client-identity-form textarea,
.client-contact-form input,
.client-info-form input,
.client-info-form textarea,
.client-document-form input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 11px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
}

/* ── Rubriques info client ── */
/* ── Sections de texte libre (nouveau modèle infoSections) ────────────── */
.info-section-card {
  border: 1px solid #e4eaf4;
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(30,45,90,0.05);
}

.info-section-card.is-sensitive {
  border-color: #fce8c1;
}

.info-section-card-header {
  display: flex;
  align-items: center;
  background: #f7f9fd;
  border-bottom: 1px solid #e4eaf4;
  padding: 0 10px 0 0;
}

.info-section-card.is-sensitive .info-section-card-header {
  background: #fffbf3;
  border-bottom-color: #fce8c1;
}

.info-section-card-toggle {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}

.info-section-card-chevron {
  font-size: 0.78rem;
  color: #8a9ab8;
  flex-shrink: 0;
}

.info-section-card-title {
  font-weight: 800;
  font-size: 0.9rem;
  color: #1a2235;
}

.info-section-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.info-section-card-body {
  padding: 0;
}

.info-section-content {
  margin: 0;
  padding: 14px 16px;
  font-size: 0.85rem;
  line-height: 1.6;
  color: #1a2f52;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, "Cascadia Code", "Fira Mono", monospace;
  max-height: 420px;
  overflow-y: auto;
  background: #fff;
}

.info-section-content.is-masked {
  color: #b0bdd4;
  font-family: inherit;
  font-size: 0.88rem;
  font-style: italic;
}

/* Formulaire d'édition inline */
.info-section-edit-form {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  background: #f7f9fd;
  border-top: 1px solid #e4eaf4;
}

.info-section-edit-title {
  width: 100%;
  border: 1px solid #d6e0f0;
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  background: #fff;
  color: #1a2235;
}

.info-section-edit-content {
  width: 100%;
  border: 1px solid #d6e0f0;
  border-radius: 8px;
  padding: 10px 12px;
  font-family: ui-monospace, "Cascadia Code", "Fira Mono", monospace;
  font-size: 0.84rem;
  line-height: 1.6;
  background: #fff;
  color: #1a2f52;
  resize: vertical;
  min-height: 180px;
  box-sizing: border-box;
}

.info-section-edit-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.info-section-edit-footer .primary-button,
.info-section-edit-footer .secondary-button {
  padding: 7px 16px;
  font-size: 0.84rem;
}

/* Formulaire ajout section */
.info-section-add-form {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding: 14px;
  border: 1px solid #e4eaf4;
  border-radius: 10px;
  background: #f7f9fd;
}

/* Bouton ajout */
.info-add-form-wrap {
  margin-top: 4px;
}

.info-add-toggle {
  width: 100%;
  padding: 10px 14px;
  background: #f7f9fd;
  border: 1.5px dashed #c8d8f0;
  border-radius: 10px;
  color: #1e2d5a;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  text-align: center;
  transition: background 0.12s, border-color 0.12s;
}

.info-add-toggle:hover {
  background: #eef3fb;
  border-color: #1e2d5a;
}

.info-add-form {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding: 14px;
  border: 1px solid #e4eaf4;
  border-radius: 10px;
  background: #f7f9fd;
}

.info-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.info-add-row select,
.info-add-row input[type="text"],
.info-add-row textarea {
  flex: 1;
  border: 1px solid #d6e0f0;
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 0.87rem;
  background: #fff;
  color: #1a2235;
}

.info-add-row textarea {
  resize: vertical;
  min-height: 60px;
}

.info-add-options {
  justify-content: space-between;
}

.info-sensitive-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.83rem;
  color: #5a6a88;
  cursor: pointer;
  flex: 1;
}

.client-contact-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 10px;
}

.client-document-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 12px;
}

/* ── Carte contact redesign ───────────────────────────────────────────── */
.client-contact-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0;
  border: 1px solid #e4eaf4;
  border-radius: 16px;
  overflow: hidden;
  background: #ffffff;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.12s;
}

.client-contact-card:hover {
  border-color: #b8d0f0;
  box-shadow: 0 6px 20px rgba(30, 95, 168, 0.1);
  transform: translateY(-1px);
}

/* Bande latérale colorée + avatar */
.contact-avatar {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 72px;
  padding: 16px 0;
  font-weight: 900;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  user-select: none;
  flex-shrink: 0;
  overflow: hidden;
}

.contact-avatar-img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.contact-avatar-cam {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  background: rgba(19, 29, 58, 0.45);
  opacity: 0;
  transition: opacity 0.15s;
}

.contact-avatar:hover .contact-avatar-cam {
  opacity: 1;
}

/* Corps du contact */
.client-contact-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 13px 12px 13px 14px;
  border-left: 1px solid #f0f4fb;
}

.client-contact-head {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.client-contact-name {
  flex: 1;
  font-weight: 800;
  font-size: 0.97rem;
  color: #1a2235;
  line-height: 1.2;
  word-break: break-word;
}

/* Badge rôle coloré */
.client-contact-role-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  max-width: 100%;
  word-break: break-word;
}

/* Liens téléphone / email */
.client-contact-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.contact-link {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  word-break: break-all;
  overflow-wrap: anywhere;
  transition: opacity 0.12s;
  line-height: 1.4;
}

.contact-link:hover { opacity: 0.72; }

.contact-link::before {
  flex-shrink: 0;
  font-size: 0.8em;
}

.contact-link-phone { color: #2d5be3; }
.contact-link-phone::before { content: "☏"; }

.contact-link-email { color: #5a6a88; }
.contact-link-email::before { content: "@"; font-weight: 900; }

.contact-link-empty {
  font-size: 0.8rem;
  color: #b0bdd4;
  font-style: italic;
}

/* ── Bouton + formulaire ajout contact ─────────────────────────────────── */
.contact-add-wrap {
  margin-top: 4px;
}

.contact-add-btn {
  padding: 8px 16px;
  background: #f7f9fd;
  border: 1.5px dashed #c8d8f0;
  border-radius: 10px;
  color: #1e2d5a;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.contact-add-btn:hover {
  background: #eef3fb;
  border-color: #1e2d5a;
}

.contact-add-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px solid #e4eaf4;
  border-radius: 12px;
  background: #f7f9fd;
}

/* ── Menu contextuel contact ─────────────────────────────────────────── */
.contact-ctx-menu {
  background: #fff;
  border: 1px solid #dce6f5;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(6,26,51,0.14);
  padding: 5px;
  min-width: 200px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ctx-menu-item {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-radius: 7px;
  padding: 8px 13px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #1a2e4a;
  cursor: pointer;
  transition: background 0.1s;
}
.ctx-menu-item:hover { background: #f0f6ff; }
.ctx-menu-item.is-danger { color: #c0392b; }
.ctx-menu-item.is-danger:hover { background: #fff0ef; }

.ctx-menu-sep {
  height: 1px;
  background: #e8eef8;
  margin: 3px 0;
}

/* ── Sélecteur de client (picker) ──────────────────────────────────── */
.contact-client-picker {
  background: #fff;
  border: 1px solid #dce6f5;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(6,26,51,0.16);
  padding: 8px;
  width: 300px;
  max-height: 320px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.client-picker-search {
  border: 1px solid #d0ddf0;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.875rem;
  outline: none;
  background: #f7f9fd;
  width: 100%;
  box-sizing: border-box;
}
.client-picker-search:focus { border-color: #1e2d5a; background: #fff; }

.client-picker-list {
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.client-picker-item {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-radius: 7px;
  padding: 8px 12px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #1a2e4a;
  cursor: pointer;
  white-space: normal;
  word-break: break-word;
  transition: background 0.1s;
}
.client-picker-item:hover { background: #eef4ff; color: #1e2d5a; }

.contact-add-form input {
  width: 100%;
  border: 1px solid #d6e0f0;
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 0.87rem;
  background: #fff;
  color: #1a2235;
  box-sizing: border-box;
}

.contact-add-form input:focus {
  outline: none;
  border-color: #1e2d5a;
  box-shadow: 0 0 0 3px rgba(30, 95, 168, 0.12);
}

.client-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.client-document-card {
  display: grid;
  align-content: start;
  gap: 12px;
  border: 1px solid rgba(203, 213, 225, 0.6);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 2px 6px rgba(19, 29, 58, 0.04), 0 8px 20px rgba(30, 45, 90, 0.06);
}

.client-contact-card span,
.client-document-card span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}


.client-activity-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.activity-day-sep {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9aabca;
  padding: 14px 0 5px 20px;
}
.activity-day-sep:first-child { padding-top: 2px; }

.client-activity-item {
  display: grid;
  grid-template-columns: 20px 1fr auto auto;
  align-items: center;
  gap: 0 8px;
  padding: 5px 4px;
  border-radius: 7px;
  transition: background 0.1s;
}
.client-activity-item:hover { background: #f4f7fc; }

.activity-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c8d8f0;
  justify-self: center;
  flex-shrink: 0;
}

.activity-label {
  font-size: 0.83rem;
  font-weight: 700;
  color: #1a2e4a;
  white-space: nowrap;
}

.activity-meta {
  font-size: 0.8rem;
  color: #7a8daa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.activity-time {
  font-size: 0.73rem;
  font-weight: 700;
  color: #b0bdd4;
  white-space: nowrap;
  flex-shrink: 0;
}

.client-document-card strong {
  display: block;
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.document-thumbnail {
  display: grid;
  width: 100%;
  aspect-ratio: 4 / 3;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
  color: var(--accent);
}

.document-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.document-thumbnail-placeholder {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border-radius: 14px;
  background: #eaf4ff;
  color: var(--accent);
  font-weight: 900;
}

.client-document-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
}

.document-viewer-dialog {
  width: min(980px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  color: var(--ink);
  box-shadow: 0 28px 70px rgba(19, 29, 58, 0.28);
}

.document-viewer-dialog::backdrop {
  background: rgba(19, 29, 58, 0.44);
}

.document-viewer {
  display: grid;
  gap: 14px;
  padding: 20px;
  background: var(--surface);
}

.document-viewer-body {
  display: grid;
  min-height: min(68vh, 680px);
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}

.document-viewer-body img,
.document-viewer-body iframe {
  width: 100%;
  height: min(68vh, 680px);
  border: 0;
}

.document-viewer-body img {
  object-fit: contain;
}

.document-viewer-fallback {
  display: grid;
  justify-items: center;
  gap: 12px;
  color: var(--muted);
  text-align: center;
}

.document-viewer-fallback a {
  color: var(--accent);
  font-weight: 900;
  text-decoration: none;
}

.document-viewer-docx {
  width: 100%;
  height: min(68vh, 680px);
  overflow-y: auto;
  padding: 32px 40px;
  background: #fff;
  text-align: left;
  color: #1a1a1a;
  line-height: 1.55;
}
.document-viewer-docx h1, .document-viewer-docx h2, .document-viewer-docx h3 { margin: 1em 0 0.4em; line-height: 1.25; }
.document-viewer-docx p { margin: 0 0 0.8em; }
.document-viewer-docx table { border-collapse: collapse; margin: 0.8em 0; }
.document-viewer-docx table td, .document-viewer-docx table th { border: 1px solid #ddd; padding: 4px 8px; }
.document-viewer-docx img { max-width: 100%; }

.document-viewer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.attachment-grid {
  grid-template-columns: repeat(3, minmax(120px, 1fr));
}

.attachment-card {
  gap: 8px;
}


.user-card span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.82rem;
}

.activity-list {
  display: grid;
  gap: 10px;
}

.activity-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid rgba(203, 213, 225, 0.6);
  border-radius: 12px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow:
    0 1px 2px rgba(19, 29, 58, 0.05),
    0 4px 12px rgba(19, 29, 58, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 200ms ease;
}

.activity-item:hover {
  transform: translateY(-1px);
  box-shadow:
    0 2px 4px rgba(19, 29, 58, 0.07),
    0 8px 20px rgba(19, 29, 58, 0.09),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.activity-item.is-read {
  opacity: 0.48;
  box-shadow: none;
}

.activity-avatar {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #2d5be3);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 900;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(19, 29, 58, 0.2);
  flex-shrink: 0;
}

.activity-item strong,
.activity-item span,
.activity-item time {
  display: block;
}

.activity-item strong {
  color: var(--ink);
  font-weight: 800;
}

.activity-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.activity-item time {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.seen-button {
  flex-shrink: 0;
  min-height: 30px;
  border: 1px solid rgba(30, 45, 90, 0.2);
  border-radius: 999px;
  padding: 0 12px;
  background: transparent;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  transition: background 140ms, border-color 140ms;
}

.seen-button:hover:not(:disabled) {
  background: rgba(30, 45, 90, 0.06);
  border-color: rgba(30, 45, 90, 0.4);
}

.seen-button:disabled {
  border-color: transparent;
  color: var(--muted);
  cursor: default;
}

.edit-dialog {
  width: min(680px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  color: var(--ink);
  box-shadow: 0 28px 70px rgba(19, 29, 58, 0.28);
}

.edit-dialog::backdrop {
  background: rgba(19, 29, 58, 0.44);
}

.knowledge-editor-dialog {
  width: min(1040px, calc(100vw - 32px));
}

.edit-form {
  display: grid;
  gap: 14px;
  padding: 20px;
  background: var(--surface);
}

.knowledge-editor-form {
  max-height: min(88vh, 920px);
  overflow: auto;
}

.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.edit-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.edit-recurrence-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.edit-recurrence-row label {
  flex: 1;
  min-width: 140px;
}

.recurrence-badge {
  display: inline-flex;
  align-items: center;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #065f46;
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
}

.edit-form input,
.edit-form select,
.edit-form textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
}

.edit-form textarea {
  resize: vertical;
}

.inline-create-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  margin-top: -4px;
  border: 1px solid #c8d4f0;
  border-radius: var(--radius);
  padding: 10px;
  background: linear-gradient(180deg, #f8fbff 0%, #eef8ff 100%);
}

.inline-create-panel label {
  margin: 0;
}

.inline-create-panel .secondary-button {
  min-height: 44px;
  white-space: nowrap;
}

.knowledge-editor-form textarea {
  min-height: 110px;
  line-height: 1.45;
}

.knowledge-editor-form #knowledgeEditSteps,
.knowledge-editor-form #knowledgeEditContent {
  min-height: 180px;
}

.edit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.secondary-button {
  min-height: 38px;
  border: 1px solid rgba(30, 45, 90, 0.2);
  border-radius: 10px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--accent);
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(30, 45, 90, 0.06);
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.secondary-button:hover {
  border-color: rgba(30, 45, 90, 0.35);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 8px 20px rgba(30, 45, 90, 0.11);
  transform: translateY(-1px);
}

.finish-task-button {
  min-height: 38px;
  border: 1px solid #16a34a;
  border-radius: 10px;
  padding: 0 16px;
  background: linear-gradient(135deg, #16a34a, #0d9488);
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.2);
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}

.finish-task-button:hover {
  filter: brightness(1.08);
  box-shadow: 0 8px 20px rgba(22, 163, 74, 0.3);
  transform: translateY(-1px);
}

.primary-button {
  min-height: 42px;
  border-color: var(--accent);
  padding: 0 18px;
  background: linear-gradient(135deg, var(--accent), #0f766e);
  color: #ffffff;
  font-weight: 850;
  box-shadow: 0 12px 26px rgba(30, 45, 90, 0.18);
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.primary-button:hover {
  filter: brightness(0.96);
  box-shadow: 0 16px 34px rgba(30, 45, 90, 0.22);
  transform: translateY(-1px);
}

.entry-panel {
  display: flex;
  align-items: center;
  gap: 10px;
}

.entry-panel .metrics {
  flex: 1;
  min-width: 0;
}

.quick-add-button {
  display: grid;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e2d5a, #2d5be3);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(8, 145, 178, 0.4);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.quick-add-button .button-icon {
  width: 20px;
  height: 20px;
}

.quick-add-button-mobile {
  display: none;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #1e2d5a, #2d5be3);
  color: #fff;
  box-shadow: 0 3px 10px rgba(45,91,227,0.35);
  place-items: center;
  cursor: pointer;
}
.quick-add-button-mobile .button-icon {
  width: 18px;
  height: 18px;
}

.quick-add-button:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(8, 145, 178, 0.55);
}

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 10px 16px;
  box-shadow: 0 4px 16px rgba(30, 45, 90, 0.06);
}

.segmented {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
}

.view-segmented {
  gap: 4px;
}

.view-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
}

.view-btn .button-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.segment {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 850;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.segment.active,
.segment:hover {
  border-color: transparent;
  background: linear-gradient(135deg, #2d5be3, #1e2d5a);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.segment.active {
  border-color: transparent;
  background: linear-gradient(135deg, #2d5be3, #1e2d5a);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Active filter badges */
.active-filter-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding-top: 2px;
}

.filter-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  border: 1px solid #c8d4f0;
  border-radius: 999px;
  padding: 0 10px 0 12px;
  background: #f0f4fb;
  color: #1e2d5a;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}

.filter-badge:hover {
  background: #e0e8f8;
  border-color: #93c5fd;
}

.filter-badge .button-icon {
  width: 12px;
  height: 12px;
  opacity: 0.7;
}

.filter-badge-clear {
  border-color: #fca5a5;
  background: #fff1f2;
  color: #dc2626;
  padding: 0 12px;
}

.filter-badge-clear:hover {
  background: #fee2e2;
  border-color: #f87171;
}

/* Sortable table headers */
.sortable-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color 140ms ease, background 140ms ease;
}

.sortable-th:hover {
  color: var(--accent);
  background: var(--soft);
}

.sortable-th.sort-active {
  color: #1e2d5a;
  background: #f0f4fb;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.filter-select {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.filter-select select {
  min-width: 170px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 10px;
  background: #ffffff;
  color: var(--accent);
  font-weight: 700;
}

.board {
  display: grid;
  gap: 14px;
}

.active-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.active-columns.view-list {
  grid-template-columns: 1fr;
}

.done-column {
  background: var(--glass-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(16, 185, 129, 0.08);
}

.done-column .column-head h2,
.done-column .column-head span {
  color: rgba(255, 255, 255, 0.9);
}

.done-column .task-card {
  border-color: #e5e7eb;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: none;
  opacity: 0.62;
}

.done-column .task-card h3,
.done-column .task-section p,
.done-column .task-section li {
  color: #7b8494;
}

.done-column .task-section,
.done-column .assignee-badge,
.done-column .client-badge {
  background: #f8fafc;
}

.done-column.is-collapsed {
  min-height: auto;
}

.column {
  min-height: 360px;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: var(--glass-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(30, 45, 90, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.column.is-drag-over {
  border-color: #2d5be3;
  background: rgba(219, 234, 254, 0.75);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25), 0 8px 32px rgba(30, 45, 90, 0.12);
}

/* Column headers */
.column-head {
  margin: 10px 10px 0;
  border-radius: 10px !important;
  border: none !important;
  background: #1e3a5f;
  box-shadow: 0 2px 10px rgba(19, 29, 58, 0.25);
  color: #ffffff !important;
}

.column-head h2 {
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.task-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.task-table {
  width: 100%;
  min-width: 940px;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.task-table th,
.task-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
}

.task-table th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.task-table tbody tr {
  border-left: 4px solid var(--accent);
  background: var(--task-type-bg, #ffffff);
}

.task-table tbody tr.priority-high {
  border-left: 5px solid #dc2626;
  background: color-mix(in srgb, var(--task-type-bg, #ffffff) 80%, #fecaca);
}

.task-table tbody tr.priority-medium {
  border-left-color: var(--warning);
}

.task-table tbody tr.priority-low {
  border-left-color: #ffffff;
}

.task-table tbody tr.is-late .task-title-cell {
  color: var(--danger);
  font-weight: 900;
}

.task-table tbody tr:hover {
  filter: brightness(0.98);
}

.task-title-cell {
  min-width: 180px;
  color: var(--ink);
  font-weight: 900;
}

.table-actions {
  white-space: nowrap;
  text-align: right;
}

.mini-action {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-left: 5px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  color: var(--accent);
  font-weight: 900;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.mini-action:hover {
  border-color: var(--accent);
  background: #eef8ff;
  transform: translateY(-1px);
}

.mini-action.is-danger {
  color: var(--danger);
}

.mini-action.is-danger:hover {
  border-color: #fecaca;
  background: #fff1f2;
}

.empty-row td {
  height: 90px;
  color: var(--muted);
  text-align: left;
}

.column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  padding: 0 14px;
  border-bottom: none;
}

.collapse-button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 1.1rem;
  line-height: 1;
}


.column-head h2 {
  font-size: 1rem;
}

.column-head span {
  display: grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.75rem;
  font-weight: 800;
}

.task-list {
  display: grid;
  align-content: start;
  min-height: 300px;
  padding: 12px;
}

.task-card {
  position: relative;
  display: grid;
  gap: 14px;
  border: 1px solid color-mix(in srgb, var(--task-type-bg, #e0e8f8) 65%, #6b7ea0);
  border-radius: 12px;
  padding: 12px;
  background: color-mix(in srgb, var(--task-type-bg, #e0e8f8) 70%, #ffffff);
  cursor: grab;
  transition: opacity 160ms ease, transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.task-card {
  box-shadow:
    0 1px 2px rgba(19, 29, 58, 0.08),
    0 4px 10px rgba(19, 29, 58, 0.07),
    0 14px 28px rgba(19, 29, 58, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.task-list {
  gap: 14px;
}

/* ── Vue compacte par défaut : détails masqués tant que la carte n'est pas dépliée ── */
.task-card:not(.is-expanded) .previous-steps,
.task-card:not(.is-expanded) .current-step,
.task-card:not(.is-expanded) .upcoming-steps,
.task-card:not(.is-expanded) .task-attachments,
.task-card:not(.is-expanded) .task-details {
  display: none;
}

.task-card:not(.is-expanded) {
  cursor: pointer;
}

.task-card.is-expanded .task-card-head h3 {
  -webkit-line-clamp: unset;
}

.task-card:hover {
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow:
    0 2px 4px rgba(19, 29, 58, 0.1),
    0 10px 20px rgba(19, 29, 58, 0.12),
    0 28px 48px rgba(19, 29, 58, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transform: translateY(-3px);
}

.task-card.is-dragging {
  cursor: grabbing;
  opacity: 0.55;
  transform: scale(0.99);
}

/* Priority dot indicator (top-right corner) */

.task-card.is-late {
  border-color: #f59e0b;
}

.task-card.priority-high {
  border: 2px solid #dc2626;
}

.task-card.priority-high:hover {
  border-color: #dc2626;
}

.task-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 142px;
  align-items: center;
  gap: 10px;
}

.task-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  align-items: start;
  gap: 8px;
  margin-bottom: -7px;
}

.task-card-head h3 {
  display: -webkit-box;
  min-height: 1.3em;
  width: 100%;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.3;
  text-align: left;
}

.task-card-head h3.is-overdue-title {
  color: var(--danger);
  font-weight: 900;
}

.task-owner {
  display: flex;
  flex-wrap: wrap;
  align-self: center;
  align-items: center;
  justify-self: center;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
}

.task-classification {
  display: grid;
  align-items: center;
  justify-items: end;
  gap: 5px;
  width: 142px;
  min-width: 0;
}

.task-client,
.task-type {
  display: flex;
  width: 100%;
  min-width: 0;
}

.task-client {
  justify-content: end;
}

.task-main > div:first-of-type .task-type {
  align-items: center;
  justify-content: start;
}

.client-badge,
.type-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  border: 1px solid #b7d7f3;
  border-radius: 999px;
  padding: 3px 8px 3px 4px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-client-logo {
  display: grid;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  background: #ffffff;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 900;
  object-fit: contain;
}

.type-badge {
  gap: 0;
  border-color: rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.62);
  color: #536173;
  font-size: 0.72rem;
}

.finish-check {
  display: grid;
  width: 24px;
  height: 28px;
  place-items: center;
  cursor: pointer;
}

.finish-check input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--accent);
}

.finish-check input:disabled {
  cursor: not-allowed;
}

.assignee-badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  gap: 6px;
  border: 1px solid rgba(30, 45, 90, 0.18);
  border-radius: 999px;
  padding: 3px 8px 3px 3px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent);
  font-weight: 800;
}

.assignee-avatar {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 900;
  object-fit: cover;
}

.task-meta {
  display: grid;
  grid-template-columns: auto auto minmax(112px, 1fr) auto;
  align-items: center;
  column-gap: 8px;
  row-gap: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.task-meta .due-summary {
  margin-left: 10px;
}

.task-actions {
  display: flex;
  grid-column: 4;
  align-self: center;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.task-time-display {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--muted);
  min-width: 3ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.timer-button {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: background 140ms, border-color 140ms, color 140ms, box-shadow 140ms;
  flex-shrink: 0;
}

.timer-button .button-icon {
  width: 13px;
  height: 13px;
}

.timer-button:hover {
  border-color: #22c55e;
  color: #16a34a;
  background: #f0fdf4;
}

.timer-button.timer-running {
  border-color: #ef4444;
  color: #dc2626;
  background: #fff1f2;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.15);
  animation: timer-pulse 1.5s ease-in-out infinite;
}

@keyframes timer-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(239,68,68,0.15); }
  50%       { box-shadow: 0 0 0 5px rgba(239,68,68,0.08); }
}

.task-section {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(203, 213, 225, 0.84);
  border-radius: var(--radius);
  padding: 10px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.task-section span {
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.task-attachments {
  background: rgba(255, 255, 255, 0.7);
}

.task-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
}

.quick-step-button {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(30, 45, 90, 0.28);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  color: var(--accent);
  font-weight: 900;
  line-height: 1;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.quick-step-button:hover {
  border-color: var(--accent);
  background: #eef8ff;
  transform: translateY(-1px);
}

.quick-step-button:disabled {
  border-color: var(--line);
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.7;
}

.previous-toggle {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--muted);
  line-height: 1;
}

.task-section p,
.task-section li {
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.35;
}

.step-check {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  cursor: pointer;
}

.step-check input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--accent);
}

.step-check input:disabled {
  cursor: not-allowed;
}

.task-section ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
}

.upcoming-steps {
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
}

.upcoming-steps .task-section-head {
  display: contents;
}

.upcoming-steps .quick-step-button {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  justify-self: center;
}

.upcoming-steps ul {
  grid-column: 1;
}

.previous-steps li {
  color: #8a94a6;
  text-decoration: line-through;
}

.previous-steps {
  border: 1px solid rgba(203, 213, 225, 0.55);
  background: rgba(255, 255, 255, 0.42);
}

.current-step {
  border-color: rgba(30, 45, 90, 0.18);
  background: rgba(255, 255, 255, 0.88);
}

.previous-steps span {
  color: rgba(11, 61, 113, 0.58);
}

.previous-steps ul {
  opacity: 0.68;
}

.previous-steps .muted-item {
  text-decoration: none;
}

.created-summary,
.due-summary {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.25;
}

.created-summary,
.due-summary,
.date-value,
.date-detail {
  display: block;
}

.date-label {
  display: block;
  font-weight: 800;
}

.overdue-days {
  display: block;
  color: var(--danger);
  font-weight: 900;
}

.remaining-days {
  display: block;
  color: #15803d;
  font-weight: 900;
}

.remaining-days.is-tomorrow {
  color: #f59e0b;
}

.edit-button,
.delete-button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--muted);
  line-height: 1;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.edit-button:hover {
  border-color: #9bb7dc;
  background: #eef8ff;
  color: var(--accent);
  transform: translateY(-1px);
}

.delete-button:hover {
  border-color: #fecaca;
  background: #fff1f2;
  color: var(--danger);
  transform: translateY(-1px);
}

.task-details {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.task-details summary {
  color: var(--accent);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 800;
}

.comment-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 10px;
}

.comment-form input {
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 10px;
}

.comment-form button {
  min-height: 38px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 0 12px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
}

.details-block {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.details-block h4 {
  color: var(--accent);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.history-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 9px;
  background: #ffffff;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.history-toggle strong {
  color: var(--muted);
  font-size: 1rem;
}

.comments,
.step-history,
.change-history,
.attachments {
  display: grid;
  gap: 8px;
}

.comment {
  border-radius: var(--radius);
  padding: 9px;
  background: #f8fafc;
}

.comment p {
  font-size: 0.88rem;
  line-height: 1.35;
}

.comment time,
.step-history time,
.change-history time {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.75rem;
}

.step-history,
.change-history {
  margin-bottom: 0;
  padding-left: 20px;
}

.step-history li,
.change-history li {
  color: var(--ink);
  font-size: 0.84rem;
}

.step-history small,
.change-history small {
  display: block;
  margin-top: 3px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
}

.attachment-link {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 10px;
  background: #ffffff;
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 800;
  text-decoration: none;
}

.muted-item {
  color: var(--muted);
  font-size: 0.86rem;
}

.empty-state {
  display: grid;
  min-height: 110px;
  place-items: center;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.context-menu {
  position: fixed;
  z-index: 1000;
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px;
  background: #ffffff;
  box-shadow: 0 18px 45px rgba(19, 29, 58, 0.2);
}

.context-menu button {
  width: 100%;
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  padding: 0 10px;
  background: transparent;
  color: var(--danger);
  font-weight: 800;
  text-align: left;
}

.document-context-menu button:first-child {
  color: var(--accent);
}

.context-menu button:hover {
  background: #fee2e2;
}

.document-context-menu button:first-child:hover {
  background: #eaf4ff;
}

/* ── Mobile bottom navigation ── */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: calc(60px + env(safe-area-inset-bottom, 0px));
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: #131d3a;
  box-shadow: 0 -2px 20px rgba(19, 29, 58, 0.25);
  align-items: center;
  justify-content: space-around;
  gap: 0;
}

.mob-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 1;
  min-height: 48px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.62rem;
  font-weight: 700;
  padding: 4px 2px;
  transition: color 160ms ease;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mob-nav-item svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.mob-nav-item.active,
.mob-nav-item:hover {
  color: #ffffff;
}

.mob-nav-item.active svg {
  filter: drop-shadow(0 0 6px rgba(99, 179, 237, 0.7));
}

/* ── Écrans intermédiaires type MacBook Air 13" (~1280px) ── */
@media (max-width: 1400px) {
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }
  .sidebar {
    padding: 18px 16px;
    gap: 20px;
  }
  .workspace {
    padding: 20px;
  }
  .entry-panel {
    flex-wrap: wrap;
    gap: 8px;
  }
  .entry-panel .metrics {
    order: -1;
    width: 100%;
    flex: none;
  }
  .task-table {
    min-width: 860px;
  }
  .topbar {
    grid-template-columns: minmax(160px, 1fr) minmax(260px, 1.2fr) minmax(140px, 1fr);
    gap: 12px;
  }
  .client-document-list {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

/* ── Mode compact : activé par défaut (Réglages → Application pour repasser en confortable) ── */
[data-density="compact"] { font-size: 13.5px; }
[data-density="compact"] .app-shell { grid-template-columns: 200px minmax(0, 1fr); }
[data-density="compact"] .nav-item { min-height: 34px; padding: 0 10px 0 8px; font-size: 0.82rem; gap: 8px; }
[data-density="compact"] .nav-icon { width: 17px; height: 17px; }
[data-density="compact"] .nav-section-label { margin: 8px 0 3px; }
[data-density="compact"] .sidebar { padding: 14px 12px; gap: 14px; }
[data-density="compact"] .workspace { padding: 14px; gap: 12px; }
[data-density="compact"] .topbar { gap: 10px; }
[data-density="compact"] h1 { font-size: clamp(1.4rem, 2.4vw, 1.9rem); }
[data-density="compact"] button, [data-density="compact"] input, [data-density="compact"] select { min-height: 34px; }
[data-density="compact"] .task-list { gap: 8px; }
[data-density="compact"] .task-card { padding: 8px; gap: 8px; }
[data-density="compact"] .task-card-head h3 { font-size: 0.86rem; }
[data-density="compact"] .task-meta { font-size: 0.72rem; }
[data-density="compact"] .column-head { padding: 8px 10px; }
[data-density="compact"] .dash-kpis { gap: 10px; }
[data-density="compact"] .dash-kpi { padding: 10px 12px; gap: 8px; }
[data-density="compact"] .dash-kpi-value { font-size: 1.3rem; }
[data-density="compact"] .dash-kpi-label { font-size: 0.68rem; }
[data-density="compact"] .dash-kpi-icon { width: 32px; height: 32px; }
[data-density="compact"] .dash-kpi-icon svg { width: 18px; height: 18px; }
[data-density="compact"] .previ-card-body { padding: 10px; }
[data-density="compact"] .previ-card-header { padding: 8px 10px; }
[data-density="compact"] .previ-kpi { padding: 8px 10px; }
[data-density="compact"] .previ-kpi-value { font-size: 15px; }
[data-density="compact"] .client-tab-panel { padding: 12px; }
[data-density="compact"] .client-tabs { gap: 3px; }
[data-density="compact"] .client-tab { padding: 5px 10px; font-size: 0.78rem; }
[data-density="compact"] .client-detail-head { padding: 12px; gap: 10px; }
[data-density="compact"] .client-summary { padding: 10px 12px; gap: 14px; }

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .sidebar-note {
    display: none;
  }

  .sidebar-footer {
    margin-top: 0;
  }

  .sidebar-account {
    max-width: 280px;
  }

  .task-form,
  .active-columns,
  .metrics,
  .admin-tiles,
  .client-summary,
  .client-identity-form,
  .client-contact-form,
  .client-info-form,
  .client-document-form,
  .user-list,
  .client-list,
  .client-directory,
  .client-contact-list,
  .client-info-list,
  .client-document-list {
    grid-template-columns: 1fr 1fr;
  }

  .task-form .primary-button {
    grid-column: span 2;
  }

  #clientForm {
    grid-template-columns: minmax(150px, 0.6fr) minmax(220px, 1fr) auto;
  }
}

@media (max-width: 720px) {
  .workspace,
  .sidebar {
    padding: 18px;
  }

  .topbar,
  .entry-panel,
  .dialog-head,
  .dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .controls {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 8px;
    padding: 8px 12px;
    align-items: center;
  }
  .controls::-webkit-scrollbar { display: none; }

  .topbar {
    grid-template-columns: 1fr;
  }

  .top-actions,
  .search {
    width: 100%;
    min-width: 0;
  }

  .sidebar-account {
    max-width: none;
  }

  .account-menu {
    right: auto;
    left: 0;
  }

  .nav-list,
  .task-form,
  .active-columns,
  .metrics,
  .admin-tiles,
  .admin-data-cards,
  .admin-app-card,
  .user-form,
  .client-form,
  #clientForm,
  .client-detail-head,
  .client-summary,
  .dash-kpis,
  .dash-charts,
  .client-identity-summary,
  .client-identity-form,
  .client-contact-form,
  .client-info-form,
  .client-document-form,
  .user-list,
  .client-list,
  .client-contact-list,
  .client-info-list,
  .client-document-list {
    grid-template-columns: 1fr;
  }

  .task-form .primary-button {
    grid-column: auto;
  }

  .comment-form {
    grid-template-columns: 1fr;
  }

  .edit-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .sidebar {
    display: none;
  }

  .mobile-nav {
    display: flex;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .workspace {
    padding: 14px;
    padding-top: calc(14px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(60px + max(14px, env(safe-area-inset-bottom, 0px)));
  }

  /* Métriques : scroll horizontal pour éviter le débordement */
  .metrics,
  .entry-panel .metrics {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    scrollbar-width: none;
    padding-bottom: 2px;
  }

  .metrics::-webkit-scrollbar { display: none; }

  .metric {
    flex: 0 0 auto;
    min-width: 120px;
  }

  /* Kanban : scroll horizontal façon Trello sur mobile */
  .active-columns:not(.view-list) {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 12px;
    padding-bottom: 8px;
    scrollbar-width: none;
  }

  .active-columns:not(.view-list)::-webkit-scrollbar { display: none; }

  .active-columns:not(.view-list) .column {
    flex: 0 0 min(340px, 85vw);
    scroll-snap-align: start;
    min-height: 240px;
  }

  .active-columns.view-list {
    grid-template-columns: 1fr;
  }

  /* Dashboard — tablet */
  .dash-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dash-hero {
    padding: 24px 24px;
    gap: 16px;
  }

  .dash-charts {
    grid-template-columns: 1fr 1fr;
  }

  .dash-chart-card:last-child {
    grid-column: span 2;
  }
}

@media (max-width: 640px) {
  /* Topbar mobile : search + bouton + compact */
  .topbar.task-view {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border-radius: 14px;
    padding: 6px 10px 6px 14px;
    box-shadow: 0 2px 8px rgba(6,26,51,0.08);
  }

  .topbar.task-view .search {
    flex: 1;
    border: none;
    background: none;
    padding: 0;
    box-shadow: none;
    border-radius: 0;
  }

  .topbar.task-view .search input {
    padding: 4px 0;
    font-size: 0.9rem;
  }

  .quick-add-button-mobile {
    display: grid;
  }

  /* Cacher l'entry-panel (gros bouton + metrics) */
  .entry-panel {
    display: none;
  }

  /* Controls : une seule ligne scrollable */
  .controls {
    background: white;
    border-radius: 14px;
    padding: 8px 10px;
    box-shadow: 0 2px 8px rgba(6,26,51,0.08);
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    gap: 8px;
    scrollbar-width: none;
  }
  .controls::-webkit-scrollbar { display: none; }

  .view-segmented, .controls .segmented {
    flex-shrink: 0;
  }

  /* Séparateur visuel entre groupes */
  .controls .segmented + .segmented::before,
  .controls .segmented + .filter-select::before {
    content: "";
    display: block;
    width: 1px;
    height: 24px;
    background: var(--line);
    align-self: center;
    margin-right: 0;
    position: relative;
    left: -4px;
  }

  /* Boutons de vue : icône seule */
  .view-btn span:not(.button-icon) {
    display: none;
  }

  .view-btn {
    padding: 0 10px;
    min-width: 36px;
    justify-content: center;
  }

  .segment {
    min-height: 34px;
    padding: 0 11px;
    font-size: 0.8rem;
  }

  /* Toggle : cacher le label texte */
  .controls .toggle span {
    display: none;
  }

  body {
    background: linear-gradient(135deg, #e8edf8 0%, #f0f4ff 60%, #eaf0fb 100%);
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 30;
    gap: 12px;
    padding: max(12px, env(safe-area-inset-top)) 12px 12px;
    border-radius: 0 0 var(--radius) var(--radius);
  }

  .brand {
    gap: 9px;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
    padding: 5px;
  }

  .brand strong {
    font-size: 1rem;
  }

  .brand span {
    font-size: 0.74rem;
  }

  .nav-list {
    display: flex;
    gap: 7px;
    margin: 0 -12px;
    padding: 0 12px 3px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .nav-list::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 0 10px;
    font-size: 0.82rem;
    white-space: nowrap;
  }

  .nav-item.active::before {
    display: none;
  }

  .nav-icon {
    width: 17px;
    height: 17px;
  }

  .sidebar-footer {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .sidebar-account {
    flex: 1;
    min-width: 0;
  }

  .account-button,
  .account-admin-button {
    min-height: 38px;
  }

  .account-admin-button {
    width: 38px;
    height: 38px;
  }

  .account-avatar {
    width: 26px;
    height: 26px;
  }

  .workspace {
    gap: 14px;
    padding: 14px 10px calc(60px + max(18px, env(safe-area-inset-bottom, 0px)));
    padding-top: calc(14px + env(safe-area-inset-top, 0px));
  }

  .topbar {
    gap: 10px;
  }

  .page-heading {
    display: none;
  }

  .search,
  .client-search {
    height: 44px;
    min-height: 44px;
    padding: 0 11px;
  }

  .top-actions {
    justify-content: stretch;
  }

  .top-actions .icon-button {
    width: 100%;
  }

  .entry-panel {
    gap: 10px;
  }

  .quick-add-button {
    width: 72px;
    min-height: 46px;
  }

  .metrics,
  .entry-panel .metrics,
  .client-summary {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .metrics::-webkit-scrollbar,
  .client-summary::-webkit-scrollbar {
    display: none;
  }

  .metric {
    flex: 0 0 122px;
    min-height: 50px;
  }

  .client-summary span {
    flex: 0 0 auto;
    min-height: unset;
  }

  .backup-tools,
  .knowledge-filters {
    align-items: stretch;
    gap: 10px;
  }

  .segmented,
  .client-tabs,
  .backup-tools,
  .update-progress {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .segmented::-webkit-scrollbar,
  .client-tabs::-webkit-scrollbar,
  .backup-tools::-webkit-scrollbar,
  .update-progress::-webkit-scrollbar {
    display: none;
  }

  .segment,
  .client-tab,
  .backup-tools > *,
  .update-progress span {
    flex: 0 0 auto;
  }

  /* Dans .controls sur mobile, assignee + toggle restent compacts */
  .controls .filter-select select {
    width: auto;
    min-width: 90px;
  }

  .controls .toggle {
    width: auto;
    font-size: 0.78rem;
  }

  /* Badges de filtre actif passent en pleine largeur sur leur propre ligne */
  .active-filter-badges {
    width: 100%;
    order: 99;
  }

  .knowledge-filters select {
    width: 100%;
  }

  .section-head {
    align-items: flex-start;
    gap: 10px;
  }

  .section-head h2 {
    font-size: 1.25rem;
  }

  .active-columns:not(.view-list) .column {
    flex: 0 0 min(320px, 82vw);
  }

  .done-column {
    margin-top: 2px;
  }

  .column {
    min-width: 0;
  }

  .task-list {
    min-height: 220px;
    padding: 9px;
  }

  /* Compact task cards on mobile */
  .task-card {
    gap: 4px;
    padding: 8px 10px;
    border-radius: 8px;
  }

  .task-card-head {
    margin-bottom: 0;
  }

  .task-card-head h3 {
    font-size: 0.9rem;
    -webkit-line-clamp: 1;
  }

  .task-main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
  }

  .task-main > div:first-of-type {
    flex: 1;
    min-width: 0;
  }

  .task-classification {
    width: auto;
    justify-items: start;
  }

  .task-client {
    justify-content: start;
  }

  .client-badge,
  .type-badge {
    font-size: 0.72rem;
    padding: 2px 6px 2px 3px;
  }

  .task-client-logo {
    width: 20px;
    height: 20px;
  }

  /* Hide secondary sections on mobile */
  .task-section.previous-steps,
  .task-section.current-step,
  .task-section.upcoming-steps,
  .task-details {
    display: none;
  }

  .task-meta {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .task-meta .created-summary {
    display: none;
  }

  .task-meta .due-summary {
    flex: 1;
    margin-left: 0;
    font-size: 0.78rem;
  }

  .task-owner {
    display: none;
  }

  .task-actions {
    grid-column: unset;
    justify-self: unset;
    gap: 4px;
  }

  .task-section {
    padding: 9px;
  }

  .task-list {
    gap: 7px;
  }

  .comment-form,
  .inline-create-panel {
    grid-template-columns: 1fr;
  }

  .messages-layout,
  .knowledge-layout {
    gap: 10px;
  }

  .message-threads,
  .knowledge-list {
    max-height: 200px;
  }

  .chat-bubble-group {
    max-width: 88%;
  }

  .chat-list {
    max-height: 44vh;
  }

  /* Monthly grid hidden on mobile — agenda view used instead */
  .month-calendar .calendar-weekdays,
  .month-calendar .calendar-month-grid {
    display: none;
  }

  .task-table-wrap {
    margin: 0 -10px;
    border-radius: 0;
    overflow-x: auto;
  }

  .task-table {
    min-width: 760px;
  }

  .client-detail {
    margin: 0 -2px;
    padding: 12px;
  }

  .client-detail-head {
    gap: 12px;
    text-align: left;
  }

  .client-detail-actions {
    justify-content: flex-start;
  }

  .client-tab-panel {
    padding: 11px;
  }

  .client-contact-card,
  .client-info-card,
  .client-document-card,
  .user-card,
  .client-card {
    min-width: 0;
  }

  .edit-dialog,
  .document-viewer-dialog {
    width: 100vw;
    max-width: 100vw;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .edit-form,
  .document-viewer {
    max-height: 100dvh;
    overflow: auto;
    padding: 16px 12px max(16px, env(safe-area-inset-bottom));
  }

  .dialog-head h2 {
    font-size: 1.35rem;
  }

  .dialog-actions {
    gap: 8px;
  }

  .dialog-actions .secondary-button,
  .dialog-actions .finish-task-button,
  .dialog-actions .primary-button {
    width: 100%;
  }

  /* Dashboard — iPhone */
  .dash-hero {
    flex-direction: column;
    align-items: flex-start;
    padding: 18px 16px;
    gap: 12px;
    margin-bottom: 14px;
    border-radius: 16px;
    width: 100%;
    box-sizing: border-box;
  }

  .dash-hero-left {
    width: 100%;
    min-width: 0;
  }

  .dash-greeting {
    font-size: 1.5rem;
  }

  .dash-search-wrap {
    width: 100%;
    max-width: none;
  }

  .dash-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .dash-kpi {
    padding: 14px 12px;
    gap: 12px;
  }

  .dash-kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }

  .dash-kpi-value {
    font-size: 1.8rem;
  }

  .dash-charts {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 8px;
  }

  .dash-chart-card:last-child {
    grid-column: auto;
  }

  .dash-full-list {
    border-radius: 12px;
  }

  /* Clients — 2 colonnes compactes */
  .client-directory {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .client-directory-card {
    padding: 14px 10px;
    gap: 8px;
    border-radius: 12px;
  }

  .client-directory-logo {
    width: 44px;
    height: 44px;
    border-radius: 10px;
  }

  .client-directory-card strong {
    font-size: 0.8rem;
  }

  .client-directory-card span span {
    font-size: 0.72rem;
  }

  /* Task list rows mobile */
  .dash-list-row {
    padding: 10px 12px;
    gap: 8px;
  }

  .dash-list-status {
    font-size: 0.68rem;
    padding: 2px 6px;
  }
}

@media (max-width: 420px) {
  .nav-item {
    gap: 7px;
  }

  .nav-badge {
    min-width: 19px;
    height: 19px;
  }

  .task-card-head h3 {
    font-size: 0.95rem;
  }

  .created-summary,
  .due-summary {
    font-size: 0.76rem;
  }

  .assignee-badge,
  .client-badge,
  .type-badge {
    max-width: 100%;
  }
}

/* ── Dashboard v3.4 ── */
.dash-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 32px 36px;
  border-radius: 20px;
  background: linear-gradient(135deg, #131d3a 0%, #0d3558 60%, #0c3b5a 100%);
  box-shadow: 0 8px 32px rgba(6,26,51,0.25), inset 0 1px 0 rgba(255,255,255,0.08);
  color: #ffffff;
  margin-bottom: 20px;
  min-width: 0;
  width: 100%;
}

.dash-hero-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dash-greeting {
  font-size: 2rem;
  font-weight: 900;
  color: #ffffff;
  line-height: 1.1;
  margin: 0;
  word-break: break-word;
  overflow-wrap: break-word;
}

.dash-date {
  font-size: 0.88rem;
  color: rgba(255,255,255,0.6);
  font-weight: 600;
  text-transform: capitalize;
  margin: 0;
}

.dash-alert-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.dash-alert-badge.is-ok { background: rgba(16,185,129,0.25); color: #6ee7b7; }
.dash-alert-badge.is-warning { background: rgba(245,158,11,0.25); color: #fbbf24; }
.dash-alert-badge.is-urgent { background: rgba(239,68,68,0.25); color: #fca5a5; }

.dash-search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  max-width: 420px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 12px;
  padding: 0 14px;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(8px);
  height: 48px;
  cursor: text;
}

.dash-search-wrap .field-icon {
  color: rgba(255,255,255,0.5);
  flex-shrink: 0;
}

.dash-search-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 0.9rem;
  outline: none;
}

.dash-search-wrap input::placeholder { color: rgba(255,255,255,0.4); }

/* KPI grid */
.dash-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

.dash-kpi {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--kpi-color, #2d5be3);
  border-radius: 12px;
  background: #ffffff;
  text-align: left;
  cursor: pointer;
  transition: transform 140ms, box-shadow 140ms;
  box-shadow: 0 2px 8px rgba(6,26,51,0.05);
}
[data-theme="dark"] .dash-kpi { background: #1a2738; border-color: #253044; border-top-color: var(--kpi-color, #4a7fd4); }

.dash-kpi:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--kpi-color) 25%, transparent), inset 0 1px 0 rgba(255,255,255,0.9);
  background: color-mix(in srgb, var(--kpi-color, #2d5be3) 14%, #ffffff);
}

.dash-kpi-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--kpi-color) 12%, transparent);
  display: grid;
  place-items: center;
}

.dash-kpi-icon svg {
  width: 24px;
  height: 24px;
  stroke: var(--kpi-color);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dash-kpi-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dash-kpi-value {
  display: block;
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--kpi-color);
  line-height: 1;
}

.dash-kpi-label {
  display: block;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

/* Charts */
.dash-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 10px;
}

.dash-chart-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 22px;
  box-shadow: 0 2px 8px rgba(6,26,51,0.05);
}

.dash-chart-card--wide { grid-column: span 1; }

.dash-chart-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 16px;
}

.dash-donut-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}

.donut-val {
  font-size: 18px;
  font-weight: 800;
  fill: var(--ink);
}

.donut-sub {
  font-size: 10px;
  fill: var(--muted);
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.donut-leg {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  color: var(--ink);
}

.donut-leg b { margin-left: auto; padding-left: 12px; font-weight: 800; }

.donut-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dash-prio-bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 4px;
}

.prio-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.prio-bar-label {
  font-size: 0.8rem;
  color: var(--ink);
  width: 56px;
  flex-shrink: 0;
}

.prio-bar-track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.prio-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 400ms ease;
}

.prio-bar-count {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  width: 22px;
  text-align: right;
}

.dash-workload {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.workload-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.workload-name {
  font-size: 0.82rem;
  color: var(--ink);
  width: 80px;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workload-track {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.workload-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2d5be3, #2d5be3);
  transition: width 400ms ease;
}

.workload-count {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  width: 22px;
  text-align: right;
}

/* Lists */
.dash-lists {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 16px;
}

.dash-full-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #eef2f8;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
}

.dash-full-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 6px;
}

.dash-full-list-head h3 {
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 0;
}

.dash-full-list-count {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--line);
  padding: 2px 9px;
  border-radius: 999px;
}

/* Each task = individual card */
.dash-list-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 14px 10px 14px;
  border-left: 4px solid #cbd5e1;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(6,26,51,0.06), 0 4px 10px rgba(6,26,51,0.04);
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
  text-align: left;
  width: 100%;
  min-width: 0;
}

.dash-list-row:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(6,26,51,0.1), 0 8px 24px rgba(6,26,51,0.07);
}

.dash-list-row.is-late {
  background: #fff8f8;
}

.dash-list-row.is-today {
  background: #fffdf5;
}

/* Client avatar */
.dash-list-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #ffffff;
  border: 1.5px solid var(--line);
  color: #131d3a;
  font-size: 0.68rem;
  font-weight: 900;
  flex-shrink: 0;
  overflow: hidden;
  letter-spacing: 0.02em;
}

.dash-list-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
}

.dash-list-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 0;
}

.dash-list-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.dash-list-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.dash-list-client {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-list-due {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.dash-list-due::before { content: "· "; }

.dash-list-due.is-late {
  color: #dc2626;
  background: #fee2e2;
  border-radius: 999px;
  padding: 1px 7px;
  font-weight: 800;
}

.dash-list-due.is-late::before { content: ""; }

.dash-list-due.is-today {
  color: #b45309;
  background: #fef3c7;
  border-radius: 999px;
  padding: 1px 7px;
  font-weight: 800;
}

.dash-list-due.is-today::before { content: ""; }

.dash-list-status {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
  text-align: center;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.dash-list-status.s-todo    { background: #f0f4fb; color: #1e2d5a; border: 1px solid #c8d4f0; }
.dash-list-status.s-waiting { background: #f5f3ff; color: #6d28d9; border: 1px solid #ddd6fe; }
.dash-list-status.s-inprog  { background: #ecfeff; color: #0e7490; border: 1px solid #a5f3fc; }
.dash-list-status.s-done    { background: #f0fdf4; color: #065f46; border: 1px solid #bbf7d0; }

.dash-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dash-col-title {
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 0 0 2px;
}

.dash-secondary-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.dash-empty {
  font-size: 0.88rem;
  color: var(--muted);
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  text-align: center;
  margin: 0;
}

.dash-task-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 1px solid color-mix(in srgb, var(--task-type-bg, #e0e8f8) 65%, #6b7ea0);
  border-radius: 10px;
  padding: 12px 14px;
  background: color-mix(in srgb, var(--task-type-bg, #e0e8f8) 55%, #ffffff);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(6,26,51,0.06), inset 0 1px 0 rgba(255,255,255,0.8);
  transition: transform 130ms, box-shadow 130ms;
}

.dash-task-card:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 14px rgba(6,26,51,0.1), inset 0 1px 0 rgba(255,255,255,0.9);
}

.dash-task-card.is-large {
  padding: 14px 16px;
}

.dash-task-card.is-late {
  border-color: rgba(239,68,68,0.4);
}

.dash-task-card.priority-high {
  border: 2px solid rgba(220, 38, 38, 0.7);
}

.dash-task-card-main {
  flex: 1;
  min-width: 0;
}

.dash-task-title {
  display: block;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
}

.dash-task-due.is-late { color: #dc2626; font-weight: 800; }

/* ── Corbeille v3 ── */
.trash-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.trash-header > div { flex: 1; }

.trash-empty-button {
  flex-shrink: 0;
  min-height: 36px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  padding: 0 14px;
  background: rgba(239, 68, 68, 0.06);
  color: #dc2626;
  font-size: 0.82rem;
  font-weight: 800;
  transition: background 140ms, border-color 140ms;
}

.trash-empty-button:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.5);
}

.trash-grid {
  display: grid;
  gap: 10px;
}

.trash-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 48px 24px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  text-align: center;
}

.trash-empty-icon { font-size: 2.5rem; }

.trash-empty-state strong {
  font-size: 1rem;
  color: var(--accent);
}

.trash-empty-state span {
  font-size: 0.84rem;
  color: var(--muted);
}

.trash-card {
  display: grid;
  grid-template-columns: 5px 1fr auto;
  align-items: center;
  gap: 0;
  border: 1px solid color-mix(in srgb, var(--task-type-bg, #e0e8f8) 65%, #6b7ea0);
  border-radius: 12px;
  background: color-mix(in srgb, var(--task-type-bg, #e0e8f8) 45%, #ffffff);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(19, 29, 58, 0.06), inset 0 1px 0 rgba(255,255,255,0.8);
  transition: transform 130ms, box-shadow 130ms;
}

.trash-card:hover {
  transform: translateX(3px);
  box-shadow: 0 4px 16px rgba(19, 29, 58, 0.1), inset 0 1px 0 rgba(255,255,255,0.9);
}

.trash-card-color-bar {
  align-self: stretch;
  background: color-mix(in srgb, var(--task-type-bg, #e0e8f8) 80%, #6b7ea0);
  width: 5px;
}

.trash-card-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px 14px;
  min-width: 0;
}

.trash-card-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trash-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.trash-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(18,60,105,0.12);
  color: var(--accent);
  white-space: nowrap;
}

.trash-card-date {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}

.trash-card-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  flex-shrink: 0;
}

.trash-action-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 0.75rem;
  font-weight: 800;
  transition: background 130ms, transform 100ms;
  white-space: nowrap;
}

.trash-action-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.trash-action-btn--restore {
  border: 1px solid rgba(16,185,129,0.3);
  background: rgba(16,185,129,0.08);
  color: #059669;
}

.trash-action-btn--restore:hover {
  background: rgba(16,185,129,0.16);
  transform: scale(1.03);
}

.trash-action-btn--delete {
  border: 1px solid rgba(239,68,68,0.25);
  background: rgba(239,68,68,0.06);
  color: #dc2626;
}

.trash-action-btn--delete:hover {
  background: rgba(239,68,68,0.14);
  transform: scale(1.03);
}

/* ── Onglet Informations — layout OneNote ────────────────────────────── */
.notes-tab {
  display: grid;
  grid-template-columns: 200px 1fr;
  height: calc(100vh - 260px);
  min-height: 420px;
  gap: 0;
  border: 1px solid #e4eaf4;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

/* ── Sidebar pages ── */
.notes-sidebar {
  display: flex;
  flex-direction: column;
  background: #f4f7fc;
  border-right: 1px solid #e4eaf4;
  overflow-y: auto;
  padding: 8px 6px 12px;
  gap: 2px;
}

.notes-page-item {
  display: flex;
  align-items: center;
  border-radius: 8px;
  padding: 0 4px 0 0;
  cursor: pointer;
  transition: background 0.1s;
  min-height: 34px;
}
.notes-page-item:hover { background: #e8eef8; }
.notes-page-item.is-active {
  background: #dce8f8;
}
.notes-page-item.is-active .notes-page-title {
  color: #1e2d5a;
  font-weight: 800;
}

.notes-page-title {
  flex: 1;
  padding: 7px 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #2a3a52;
  word-break: break-word;
  line-height: 1.3;
  user-select: none;
}

.notes-page-rename {
  flex: 1;
  margin: 4px 4px 4px 8px;
  padding: 3px 6px;
  border: 1.5px solid #1e2d5a;
  border-radius: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  outline: none;
  background: #fff;
}

.notes-page-del {
  opacity: 0;
  background: none;
  border: none;
  color: #a0aec0;
  font-size: 1rem;
  line-height: 1;
  padding: 2px 5px;
  cursor: pointer;
  border-radius: 4px;
  transition: opacity 0.1s, color 0.1s;
  flex-shrink: 0;
}
.notes-page-item:hover .notes-page-del { opacity: 1; }
.notes-page-del:hover { color: #c0392b; background: #ffeaea; }

.notes-page-rename-btn {
  opacity: 0;
  display: grid;
  place-items: center;
  background: none;
  border: none;
  color: #a0aec0;
  padding: 3px 5px;
  cursor: pointer;
  border-radius: 4px;
  transition: opacity 0.1s, color 0.1s;
  flex-shrink: 0;
}
.notes-page-item:hover .notes-page-rename-btn { opacity: 1; }
.notes-page-rename-btn:hover { color: #1e5fa8; background: #eaf1fb; }

.notes-add-page-btn {
  margin-top: 6px;
  padding: 7px 10px;
  background: none;
  border: 1.5px dashed #c8d8f0;
  border-radius: 8px;
  color: #1e2d5a;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, border-color 0.12s;
}
.notes-add-page-btn:hover { background: #eef4ff; border-color: #1e2d5a; }

/* ── Zone principale (toolbar + éditeur) ── */
.notes-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.notes-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid #e4eaf4;
  background: #f7f9fd;
  flex-shrink: 0;
}

.notes-mode-btn {
  padding: 5px 14px;
  border-radius: 7px;
  border: 1px solid #d0ddf0;
  background: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  color: #5a6a88;
  cursor: pointer;
  transition: all 0.12s;
}
.notes-mode-btn.is-active {
  background: #1e2d5a;
  border-color: #1e2d5a;
  color: #fff;
}
.notes-mode-btn:hover:not(.is-active) {
  border-color: #1e2d5a;
  color: #1e2d5a;
}

.notes-hint {
  margin-left: 6px;
  font-size: 0.73rem;
  color: #9aabca;
  font-style: italic;
}

.notes-saved {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 700;
  color: #1e8a4a;
}

.notes-editor {
  flex: 1;
  border: none;
  padding: 18px 20px;
  font-family: ui-monospace, "JetBrains Mono", "Fira Code", monospace;
  font-size: 0.875rem;
  line-height: 1.65;
  color: #1a2e4a;
  background: #fff;
  resize: none;
  outline: none;
  tab-size: 2;
}

.notes-preview {
  flex: 1;
  padding: 20px 24px;
  background: #fff;
  overflow-y: auto;
  font-size: 0.9rem;
  line-height: 1.7;
  color: #1a2e4a;
}

/* Éléments Markdown rendus */
.md-h1 { font-size: 1.4rem; font-weight: 900; color: #131d3a; margin: 1.2em 0 0.4em; border-bottom: 2px solid #e4eaf4; padding-bottom: 6px; }
.md-h2 { font-size: 1.1rem; font-weight: 800; color: #1e2d5a; margin: 1.1em 0 0.35em; }
.md-h3 { font-size: 0.95rem; font-weight: 800; color: #2d5be3; margin: 0.9em 0 0.3em; }
.md-p  { margin: 0 0 0.7em; }
.md-hr { border: none; border-top: 1px solid #e4eaf4; margin: 1.2em 0; }
.md-ul { margin: 0 0 0.7em 1.2em; padding: 0; }
.md-ul li { margin-bottom: 0.2em; }
.md-link { color: #1e2d5a; text-decoration: underline; }
.md-link:hover { color: #2d5be3; }

.md-code {
  font-family: ui-monospace, monospace;
  font-size: 0.85em;
  background: #f0f4fb;
  border: 1px solid #dce6f5;
  border-radius: 4px;
  padding: 1px 5px;
  color: #c0392b;
}

.md-code-block {
  background: #1a2235;
  color: #e2f0ff;
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  font-family: ui-monospace, monospace;
  font-size: 0.83rem;
  line-height: 1.55;
  margin: 0.8em 0;
  position: relative;
}
.md-code-block[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 6px;
  right: 10px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #5a8ec0;
  letter-spacing: 0.05em;
}

.md-img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid #e4eaf4;
  box-shadow: 0 2px 10px rgba(6,26,51,0.08);
  margin: 8px 0;
  display: block;
  cursor: zoom-in;
}
.md-img:hover {
  box-shadow: 0 4px 18px rgba(6,26,51,0.15);
}

/* ── Cartes liste clients enrichies ────────────────────────────────────── */
.dir-card-indicators {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3px;
  min-height: 16px;
}

.dir-pill {
  font-size: 0.62rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 99px;
}
.dir-pill.is-late    { background: #fdecea; color: #e74c3c; }
.dir-pill.is-active  { background: #e8f3fc; color: #1e2d5a; }

.dir-card-meta {
  font-size: 0.65rem;
  color: #b0bdd4;
  font-weight: 600;
}

/* ── Onglet Tâches — cartes ────────────────────────────────────────────── */
.client-tasks-tab {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ctask-stats {
  display: flex;
  gap: 16px;
}
.ctask-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 8px 16px;
  border: 1px solid #e4eaf4;
  border-radius: 10px;
  background: #fff;
  min-width: 72px;
}
.ctask-stat-val {
  font-size: 1.4rem;
  font-weight: 900;
  line-height: 1;
}
.ctask-stat-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: #9aabca;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ctask-group { display: flex; flex-direction: column; gap: 6px; }

.ctask-group-hdr {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 2px;
  cursor: pointer;
  user-select: none;
  font-size: 0.78rem;
  font-weight: 800;
  color: #5a6a88;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ctask-group-hdr:hover { color: #1e2d5a; }
.ctask-chevron { font-size: 0.7rem; }

.ctask-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ctask-card {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: #f0f4fb;
  overflow: hidden;
  transition: box-shadow 0.12s, filter 0.12s;
  cursor: default;
}
.ctask-card:hover { box-shadow: 0 3px 12px rgba(30,45,90,0.1); filter: brightness(0.96); }
.ctask-card.is-late { border-color: #f5c6c3 !important; }

.ctask-left {
  display: flex;
  align-items: stretch;
  min-width: 0;
}
.ctask-color-bar {
  width: 5px;
  background: rgba(0,0,0,0.18);
  flex-shrink: 0;
}
.ctask-body {
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.ctask-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #1a2e4a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ctask-meta {
  font-size: 0.75rem;
  color: #9aabca;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ctask-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  padding: 6px 4px;
}
.ctask-status-badge {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 99px;
  white-space: nowrap;
}
.ctask-status-new      { background: #f0f4fb; color: #5a6a88; }
.ctask-status-todo     { background: #e8f3fc; color: #1e2d5a; }
.ctask-status-waiting  { background: #fef3e2; color: #854f0b; }
.ctask-status-done     { background: #e8f8ef; color: #1e8a4a; }

.ctask-date { font-size: 0.72rem; font-weight: 700; color: #9aabca; }
.ctask-date.is-late { color: #e74c3c; }

.ctask-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 6px 8px 6px 0;
}
.ctask-time {
  font-size: 0.72rem;
  font-weight: 700;
  color: #9aabca;
  margin-right: 2px;
}
.ctask-btn {
  width: 28px; height: 28px;
  border: 1px solid #e4eaf4;
  border-radius: 7px;
  background: #f7f9fd;
  color: #5a6a88;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.ctask-btn:hover { background: #eef4ff; border-color: #1e2d5a; color: #1e2d5a; }
.ctask-btn.timer-running { background: #fef3e2; border-color: #e67e22; color: #e67e22; }

/* ── Recherche globale ────────────────────────────────────────────────── */
.gs-overlay {
  position: fixed;
  inset: 0;
  background: rgba(19, 29, 58, 0.45);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}

.gs-box {
  width: 580px;
  max-width: calc(100vw - 32px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(6,26,51,0.25);
  overflow: hidden;
}

.gs-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid #e4eaf4;
}
.gs-search-icon {
  font-size: 1.3rem;
  color: #9aabca;
  flex-shrink: 0;
}
.gs-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  font-weight: 500;
  color: #1a2e4a;
  background: transparent;
}
.gs-input::placeholder { color: #b0bdd4; }
.gs-esc-hint {
  font-size: 0.72rem;
  font-weight: 700;
  color: #9aabca;
  background: #f0f4fb;
  border: 1px solid #e4eaf4;
  border-radius: 5px;
  padding: 2px 7px;
  flex-shrink: 0;
}

.gs-results {
  max-height: 400px;
  overflow-y: auto;
  padding: 6px;
}

.gs-empty {
  padding: 24px 16px;
  text-align: center;
  color: #9aabca;
  font-size: 0.85rem;
}

.gs-result-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: 9px;
  background: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.08s;
}
.gs-result-item:hover, .gs-result-item.is-focused { background: #f0f6ff; }

.gs-result-icon {
  font-size: 1rem;
  text-align: center;
}
.gs-result-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: #1a2e4a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gs-result-sub {
  font-size: 0.76rem;
  color: #9aabca;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

/* ── Logo client cliquable en mode lecture ──────────────────────────── */
.client-logo-edit {
  cursor: pointer;
  position: relative;
  display: inline-flex;
}
.client-logo-edit input[type="file"] { display: none; }
.client-logo-edit::after {
  content: "📷";
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: rgba(6,26,51,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  opacity: 0;
  transition: opacity 0.15s;
}
.client-logo-edit:hover::after { opacity: 1; }

/* ── Barre recherche client + bouton recherche globale ─────────────────── */
.client-search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.client-search-row .client-search {
  flex: 1;
  margin-bottom: 0;
}

.global-search-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  height: 46px;
  border: 1px solid rgba(30, 45, 90, 0.18);
  border-radius: 12px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #1e2d5a;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(6,26,51,0.06);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}
.global-search-btn:hover {
  background: #eef4ff;
  border-color: #1e2d5a;
  box-shadow: 0 4px 14px rgba(30,45,90,0.12);
}
.global-search-btn kbd {
  font-size: 0.72rem;
  font-weight: 700;
  background: #e8f0fb;
  border: 1px solid #c8d8f0;
  border-radius: 5px;
  padding: 1px 6px;
  color: #5a7ab0;
  margin-left: 2px;
}

/* ── Vue d'ensemble client ──────────────────────────────────────────────── */
.overview-tab {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* KPIs */
.ov-kpis {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.ov-kpi {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 8px;
  border: 1px solid #e4eaf4;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: box-shadow 0.12s, border-color 0.12s, transform 0.1s;
}
.ov-kpi:hover { border-color: #b8d0f0; box-shadow: 0 3px 10px rgba(30,45,90,0.1); transform: translateY(-1px); }
.ov-kpi-val { font-size: 1.5rem; font-weight: 900; line-height: 1; }
.ov-kpi-label { font-size: 0.65rem; font-weight: 700; color: #9aabca; text-transform: uppercase; letter-spacing: 0.05em; text-align: center; }

/* Grille 2×3 */
.ov-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Blocs */
.ov-block {
  border: 1px solid #e4eaf4;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ov-block-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 8px;
  border-bottom: 1px solid #f0f4fb;
  background: #f7f9fd;
}
.ov-block-title {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #5a6a88;
}
.ov-block-more {
  background: none;
  border: none;
  font-size: 0.72rem;
  font-weight: 700;
  color: #1e2d5a;
  cursor: pointer;
  padding: 0;
}
.ov-block-more:hover { text-decoration: underline; }
.ov-empty { padding: 16px; text-align: center; color: #b0bdd4; font-size: 0.82rem; }
.ov-empty-link { background: none; border: none; color: #1e2d5a; font-size: 0.82rem; font-weight: 700; cursor: pointer; text-decoration: underline; }
.ov-more-hint { padding: 6px 10px; font-size: 0.74rem; color: #9aabca; font-weight: 600; text-align: center; }

/* Tâches */
.ov-tasks { display: flex; flex-direction: column; }
.ov-task-row {
  display: grid;
  grid-template-columns: 4px 1fr auto;
  align-items: center;
  gap: 0 10px;
  border-bottom: 1px solid #f0f4fb;
  cursor: pointer;
  transition: filter 0.1s;
}
.ov-task-row:last-child { border-bottom: none; }
.ov-task-row:hover { filter: brightness(0.96); }
.ov-task-row.is-late { background: #fffbfb !important; }
.ov-task-bar { height: 100%; min-height: 46px; background: rgba(0,0,0,0.14); }
.ov-task-body { padding: 8px 0; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ov-task-title { font-size: 0.83rem; font-weight: 700; color: #1a2e4a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-task-meta { font-size: 0.72rem; color: rgba(0,0,0,0.4); }
.ov-task-status { font-size: 0.65rem; font-weight: 800; padding: 2px 7px; border-radius: 99px; margin-right: 10px; white-space: nowrap; }
.ov-status-new     { background: rgba(0,0,0,0.08); color: rgba(0,0,0,0.45); }
.ov-status-todo    { background: rgba(30,45,90,0.12); color: #1e2d5a; }
.ov-status-waiting { background: rgba(230,126,34,0.12); color: #b05e00; }
.ov-status-done    { background: rgba(39,174,96,0.12); color: #1e8a4a; }

/* Contacts */
.ov-contacts { display: flex; flex-direction: column; gap: 0; }
.ov-contact-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid #f0f4fb;
}
.ov-contact-row:last-child { border-bottom: none; }
.ov-contact-av {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 900; flex-shrink: 0;
  overflow: hidden;
}
.ov-contact-av-img { width: 100%; height: 100%; object-fit: cover; }
.ov-contact-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ov-contact-name { font-size: 0.84rem; font-weight: 700; color: #1a2e4a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-contact-role { font-size: 0.72rem; color: #9aabca; }
.ov-contact-links { display: flex; flex-direction: column; gap: 1px; align-items: flex-end; }
.ov-contact-link { font-size: 0.72rem; color: #2d5be3; text-decoration: none; white-space: nowrap; }
.ov-contact-email { color: #5a6a88; }
.ov-contact-link:hover { text-decoration: underline; }

/* Notes */
.ov-notes { display: flex; flex-direction: column; }
.ov-note-item {
  padding: 9px 14px;
  border-bottom: 1px solid #f0f4fb;
  cursor: pointer;
  transition: background 0.1s;
}
.ov-note-item:last-child { border-bottom: none; }
.ov-note-item:hover { background: #f7f9fd; }
.ov-note-page-title { font-size: 0.78rem; font-weight: 800; color: #1e2d5a; display: block; margin-bottom: 3px; }
.ov-note-excerpt { font-size: 0.78rem; color: #7a8daa; line-height: 1.4; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Documents */
.ov-docs { display: flex; flex-direction: column; }
.ov-doc-row {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid #f0f4fb;
  cursor: pointer;
  transition: background 0.1s;
}
.ov-doc-row:last-child { border-bottom: none; }
.ov-doc-row:hover { background: #f7f9fd; }
.ov-doc-icon { font-size: 0.65rem; font-weight: 900; padding: 3px 5px; border-radius: 5px; text-align: center; }
.ov-doc-name { font-size: 0.82rem; font-weight: 600; color: #1a2e4a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-doc-size { font-size: 0.72rem; color: #b0bdd4; white-space: nowrap; }

/* Activité récente */
.ov-activity { display: flex; flex-direction: column; }
.ov-act-row {
  display: grid;
  grid-template-columns: 10px 1fr 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-bottom: 1px solid #f0f4fb;
}
.ov-act-row:last-child { border-bottom: none; }
.ov-act-dot { width: 6px; height: 6px; border-radius: 50%; background: #c8d8f0; justify-self: center; }
.ov-act-label { font-size: 0.78rem; font-weight: 700; color: #1a2e4a; }
.ov-act-meta { font-size: 0.75rem; color: #9aabca; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-act-time { font-size: 0.7rem; color: #b0bdd4; font-weight: 600; text-align: right; white-space: nowrap; }

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE MOBILE — tout ce qui a été ajouté depuis v4.3
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 820px) {
  /* Onglets client : scroll horizontal */
  .client-tabs {
    overflow-x: auto;
    scrollbar-width: none;
    flex-wrap: nowrap;
  }
  .client-tabs::-webkit-scrollbar { display: none; }
  .client-tab { flex-shrink: 0; }

  /* Barre recherche client : bouton réduit */
  .client-search-row { gap: 8px; }
  .global-search-btn span { display: none; }
  .global-search-btn kbd { display: none; }
  .global-search-btn { padding: 0 14px; min-width: 46px; justify-content: center; }

  /* KPIs overview : 3 par ligne */
  .ov-kpis { grid-template-columns: repeat(3, 1fr); }

  /* Grille overview : 1 colonne */
  .ov-grid { grid-template-columns: 1fr; }

  /* Notes sidebar : repliée en onglets scrollables */
  .notes-tab {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .notes-sidebar {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: none;
    border-bottom: 1px solid #e4eaf4;
    padding: 6px 8px;
    gap: 4px;
    min-height: unset;
    scrollbar-width: none;
  }
  .notes-sidebar::-webkit-scrollbar { display: none; }
  .notes-page-item {
    flex-shrink: 0;
    border-radius: 20px;
    min-height: 32px;
    padding: 0 10px;
    white-space: nowrap;
  }
  .notes-page-del { display: none; }
  .notes-add-page-btn {
    flex-shrink: 0;
    margin-top: 0;
    white-space: nowrap;
    padding: 5px 12px;
    border-radius: 20px;
  }

  /* Docs liste : colonnes réduites */
  .doc-row {
    grid-template-columns: 30px 1fr auto 28px 28px;
  }
  .doc-row-size { display: none; }

  /* Recherche globale : plein écran */
  .gs-overlay { padding-top: 0; align-items: flex-end; }
  .gs-box {
    width: 100%;
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 75vh;
  }
  .gs-results { max-height: 55vh; }

  /* Contacts overview : sans les liens */
  .ov-contact-links { display: none; }
  .ov-contact-row { grid-template-columns: 36px 1fr; }
}

@media (max-width: 640px) {
  /* KPIs overview : 2 par ligne */
  .ov-kpis { grid-template-columns: repeat(2, 1fr); }
  .ov-kpi-val { font-size: 1.2rem; }

  /* Stats tâches client : wrap */
  .ctask-stats { flex-wrap: wrap; gap: 8px; }
  .ctask-stat { min-width: calc(33% - 6px); flex: 1; }

  /* Cartes contact : réduire la grille */
  .client-contact-card { grid-template-columns: 60px 1fr; }
  .contact-avatar { width: 60px; }

  /* Docs grille : 2 colonnes fixes */
  .docs-grid { grid-template-columns: repeat(2, 1fr); }

  /* Picker client : pleine largeur */
  .contact-client-picker {
    width: calc(100vw - 32px);
    left: 16px !important;
  }

  /* Cartes tâches client : actions cachées sauf edit */
  .ctask-actions .ctask-btn:not(:last-child) { display: none; }
  .ctask-card { grid-template-columns: 1fr auto; }

  /* Vue d'ensemble : contact links inline sous le nom */
  .ov-contact-links {
    display: flex;
    flex-direction: row;
    gap: 8px;
    margin-top: 2px;
  }
  .ov-contact-row {
    grid-template-columns: 36px 1fr;
    grid-template-rows: auto auto;
  }
  .ov-contact-links {
    grid-column: 2;
    margin-top: 0;
  }

  /* Doc liste → masquer date aussi */
  .doc-row-date { display: none; }
  .doc-row { grid-template-columns: 30px 1fr 28px 28px; }

  /* Barre docs toolbar : compress */
  .docs-toolbar { flex-wrap: wrap; gap: 6px; }
  .docs-sort-select { font-size: 0.78rem; padding: 4px 8px; }
}

/* ── Liens utiles ─────────────────────────────────────────────────────────── */
.links-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 32px 32px 24px;
  border-bottom: 1px solid var(--line);
}
.links-head h2 { font-size: 1.4rem; font-weight: 700; color: var(--ink); margin: 0; }
.links-head .eyebrow { font-size: 0.72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 4px; }

.links-empty {
  padding: 48px 32px;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
}

#linksContent { padding: 24px 32px 48px; }

.links-section { margin-bottom: 32px; }
.links-cat-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.link-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  transition: box-shadow .15s, transform .15s;
}
.link-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.1); transform: translateY(-1px); }

.link-card-bar {
  height: 4px;
  background: var(--lc, #1e2d5a);
}

.link-card-body {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 44px 14px 14px;
  cursor: pointer;
}

.link-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--lc, #1e2d5a);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}

.link-card-info { min-width: 0; }
.link-card-title { font-size: 0.95rem; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-card-desc { font-size: 0.8rem; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-card-url { font-size: 0.72rem; color: var(--accent); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.link-card-actions {
  position: absolute;
  top: 10px;
  right: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  transition: opacity .15s;
}
.link-card:hover .link-card-actions { opacity: 1; }
.link-btn-edit, .link-btn-del {
  width: 24px; height: 24px;
  border: none; border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center;
  background: var(--line);
  color: var(--ink);
}
.link-btn-del:hover { background: #fee2e2; color: #dc2626; }
.link-btn-edit:hover { background: #e0e8f8; color: #1e2d5a; }

/* Modal ajout lien */
.link-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 9000;
}
.link-modal {
  background: var(--surface);
  border-radius: 14px;
  padding: 28px 28px 24px;
  width: 420px;
  max-width: 92vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.link-modal h3 { font-size: 1.1rem; font-weight: 700; color: var(--ink); margin: 0; }
.link-modal label { display: flex; flex-direction: column; gap: 4px; font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.lf-input {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.9rem;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
}
.lf-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(45,91,227,.15); }

.lf-color-row { display: flex; gap: 8px; flex-wrap: wrap; }
.lf-color-opt { cursor: pointer; }
.lf-color-opt input { display: none; }
.lf-color-opt span {
  display: block;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 3px solid transparent;
  transition: border-color .12s;
}
.lf-color-opt input:checked + span { border-color: var(--ink); }

.lf-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }

@media (max-width: 640px) {
  .links-head { padding: 20px 16px 16px; flex-wrap: wrap; gap: 12px; }
  #linksContent { padding: 16px 12px 32px; }
  .links-grid { grid-template-columns: 1fr; }
  .link-card-actions { opacity: 1; }
}

/* ── Admin liens utiles ───────────────────────────────────────────────────── */
.admin-tile-icon--links { background: linear-gradient(135deg, #2d5be3, #1e2d5a); }

.admin-link-cat-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }

.admin-link-cat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.admin-link-cat-name { font-size: 0.9rem; font-weight: 600; color: var(--ink); }
.admin-link-cat-actions { display: flex; gap: 6px; }

.admin-link-add-cat-form {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 4px;
}
.admin-link-add-cat-form .lf-input { flex: 1; }

.admin-link-add-row { margin-bottom: 12px; }

.admin-link-list { display: flex; flex-direction: column; gap: 6px; }

.admin-link-row {
  display: grid;
  grid-template-columns: 12px 130px 1fr 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.admin-link-color-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.admin-link-cat-pill {
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--line);
  border-radius: 20px;
  padding: 2px 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-link-title { font-size: 0.9rem; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-link-url { font-size: 0.78rem; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-link-row-actions { display: flex; gap: 6px; }

@media (max-width: 640px) {
  .admin-link-row { grid-template-columns: 12px 1fr auto; }
  .admin-link-cat-pill, .admin-link-url { display: none; }
}

/* ── Chat flottant ────────────────────────────────────────────────────────── */
.chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 8000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.chat-fab {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e2d5a, #2d5be3);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(45,91,227,.45);
  transition: transform .15s, box-shadow .15s;
  position: relative;
  flex-shrink: 0;
}
.chat-fab:hover { transform: scale(1.08); box-shadow: 0 6px 22px rgba(45,91,227,.55); }
.chat-unread-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 12px 8px;
  padding: 8px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #dc2626;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  width: calc(100% - 24px);
  text-align: left;
  transition: background .15s;
}
.chat-unread-notice:hover { background: #fee2e2; }
.chat-fab.open { background: linear-gradient(135deg, #2d5be3, #1e2d5a); }

/* ── Chat toast (message preview popup) ── */
.chat-toast {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  width: 280px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(8,30,80,.18), 0 2px 8px rgba(8,30,80,.10);
  padding: 12px 14px;
  cursor: pointer;
  border: 1px solid #e4eaf4;
  transform: translateY(12px);
  opacity: 0;
  transition: transform .28s cubic-bezier(.4,0,.2,1), opacity .28s ease;
  pointer-events: none;
}
.chat-toast.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.chat-toast-sender {
  font-size: 0.72rem;
  font-weight: 700;
  color: #1e2d5a;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.chat-toast-sender::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2d5be3;
  flex-shrink: 0;
}
.chat-toast-text {
  font-size: 0.82rem;
  color: #1a2235;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #2d5be3, #1e2d5a);
  border-radius: 0 0 14px 14px;
  width: 100%;
  transform-origin: left;
  animation: toast-progress 10s linear forwards;
}
@keyframes toast-progress {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

.chat-fab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: #ef4444;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid #fff;
}

/* ── Accusé de lecture ── */
.chat-read-receipt {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 2px 14px 6px;
}
.chat-read-receipt span {
  font-size: 0.62rem;
  color: #2d5be3;
  font-weight: 600;
}
.chat-read-avatar {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #2d5be3;
  color: #fff;
  font-size: 0.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.chat-read-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── Indicateur de frappe ── */
.chat-typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px 4px;
  color: #64748b;
  font-size: 0.75rem;
}
.chat-typing-indicator em { font-style: normal; }
.chat-typing-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #94a3b8;
  animation: typing-bounce 1.2s infinite ease-in-out;
  flex-shrink: 0;
}
.chat-typing-dot:nth-child(1) { animation-delay: 0s; }
.chat-typing-dot:nth-child(2) { animation-delay: .2s; }
.chat-typing-dot:nth-child(3) { animation-delay: .4s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30%            { transform: translateY(-4px); opacity: 1; }
}

.chat-widget-panel {
  width: 480px;
  height: 560px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0,0,0,.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: chatSlideIn .18s ease;
}

@keyframes chatSlideIn {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to   { opacity: 1; transform: translateY(0)  scale(1); }
}

.chat-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: linear-gradient(135deg, #131d3a, #1e2d5a);
  color: #fff;
  flex-shrink: 0;
}
.chat-widget-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.9rem;
}
.chat-widget-header-left .count-pill {
  background: rgba(255,255,255,.2);
  color: #fff;
  border: none;
  font-size: 0.72rem;
}
.chat-widget-header-right { display: flex; gap: 4px; }
.chat-widget-header-right .icon-button {
  color: rgba(255,255,255,.8);
  background: transparent;
}
.chat-widget-header-right .icon-button:hover { background: rgba(255,255,255,.15); color: #fff; }
.chat-widget-header-right .icon-button--danger:hover { background: rgba(239,68,68,.35); color: #fff; }
.chat-widget-header-right .chat-header-btn--detached { margin-right: 12px; }

.chat-widget-panel .messages-layout {
  flex: 1;
  min-height: 0;
  grid-template-columns: 100px 1fr;
  gap: 0;
}
.chat-widget-panel .message-threads { width: 100px; min-width: 100px; max-width: 100px; }
.chat-widget-panel .message-thread-panel { flex: 1; min-height: 0; }
.chat-widget-panel .chat-list { max-height: none; flex: 1; min-height: 0; }
.chat-resize-handle {
  position: absolute;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
  z-index: 10;
  border-radius: 16px 0 0 0;
}
.chat-resize-handle::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 10px;
  height: 10px;
  border-top: 2px solid rgba(255,255,255,.4);
  border-left: 2px solid rgba(255,255,255,.4);
  border-radius: 3px 0 0 0;
}

.chat-form--full {
  border-top: 1px solid var(--line);
  border-radius: 0 0 16px 16px;
  padding: 8px 12px;
  background: var(--surface);
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .chat-widget { bottom: 16px; right: 12px; }
  .chat-widget-panel { width: calc(100vw - 24px); height: 70vh; }
  .chat-widget-panel .message-threads { width: 110px; }
}
