/* ═══════════════════════════════════════════════════════════════════════════
   KRAVIO — Design system custom du HelpDesk (sans framework)
   Thème clair par défaut, thème sombre via <html class="dark">
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Tokens ────────────────────────────────────────────────────────────── */
:root {
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;

  --bg:          #f4f4f5;
  --bg-panel:    #ffffff;
  --bg-subtle:   #f7f7f8;
  --bg-hover:    #f1f1f2;
  --bg-input:    #ffffff;
  --border:      #e6e6e8;
  --border-soft: #efeff1;
  --text:        #131316;
  --text-2:      #55565c;
  --text-3:      #9a9ba1;
  --shadow-card: 0 1px 2px rgba(16,16,20,.04);
  --shadow-pop:  0 16px 48px -12px rgba(16,16,20,.25);

  --inv-bg:   #17171a;
  --inv-text: #ffffff;

  --red:    #dc2626;  --red-bg:    rgba(220,38,38,.10);
  --orange: #ea580c;  --orange-bg: rgba(234,88,12,.10);
  --amber:  #d97706;  --amber-bg:  rgba(217,119,6,.12);
  --green:  #16a34a;  --green-bg:  rgba(22,163,74,.10);
  --blue:   #2563eb;  --blue-bg:   rgba(37,99,235,.10);
  --purple: #7c3aed;  --purple-bg: rgba(124,58,237,.10);
  --indigo: #4f46e5;  --indigo-bg: rgba(79,70,229,.10);
  --gray:   #64748b;  --gray-bg:   rgba(100,116,139,.12);

  --radius:    14px;
  --radius-sm: 9px;

  --sidebar-w: 264px;
}

html.dark {
  --bg:          #09090b;
  --bg-panel:    #121214;
  --bg-subtle:   #17171a;
  --bg-hover:    #1c1c1f;
  --bg-input:    #17171a;
  --border:      #232327;
  --border-soft: #1c1c20;
  --text:        #f4f4f5;
  --text-2:      #a7a8ae;
  --text-3:      #64656c;
  --shadow-card: 0 1px 2px rgba(0,0,0,.4);
  --shadow-pop:  0 16px 48px -12px rgba(0,0,0,.7);

  --inv-bg:   #f4f4f5;
  --inv-text: #131316;

  --red:    #f87171;  --red-bg:    rgba(248,113,113,.12);
  --orange: #fb923c;  --orange-bg: rgba(251,146,60,.12);
  --amber:  #fbbf24;  --amber-bg:  rgba(251,191,36,.12);
  --green:  #4ade80;  --green-bg:  rgba(74,222,128,.12);
  --blue:   #60a5fa;  --blue-bg:   rgba(96,165,250,.12);
  --purple: #a78bfa;  --purple-bg: rgba(167,139,250,.12);
  --indigo: #818cf8;  --indigo-bg: rgba(129,140,248,.12);
  --gray:   #94a3b8;  --gray-bg:   rgba(148,163,184,.14);
}

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-weight: 650; letter-spacing: -0.01em; }
ul, ol { list-style: none; padding: 0; }
table { border-collapse: collapse; }
::placeholder { color: var(--text-3); }

/* ── Layout applicatif ─────────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

.main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
}
.content { flex: 1; padding: 22px 26px 40px; overflow-y: auto; }
.content > * { animation: fadeInUp .45s cubic-bezier(.22,1,.36,1) both; }

/* ── Sidebar ───────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  display: flex; flex-direction: column;
  background: var(--bg);
  border-right: 1px solid var(--border);
  position: sticky; top: 0; height: 100vh;
}
.sidebar-head {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 12px;
}
.sidebar-logo {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--inv-bg); color: var(--inv-text);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
}
.sidebar-brand { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; }

.sidebar-search { padding: 4px 14px 10px; }
.search-box { position: relative; }
.search-box .fa-magnifying-glass {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  font-size: 11px; color: var(--text-3); pointer-events: none;
}
.search-box input {
  width: 100%; padding: 7px 40px 7px 30px;
  font-size: 13px;
  background: var(--bg-panel);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.search-box input:focus { border-color: var(--text-3); box-shadow: 0 0 0 3px var(--gray-bg); }
.search-kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 10px; font-weight: 600; color: var(--text-3);
  border: 1px solid var(--border); border-radius: 5px;
  padding: 1px 5px; pointer-events: none; background: var(--bg-subtle);
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 14px 16px; }
.nav-title {
  font-size: 10.5px; font-weight: 650; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-3);
  padding: 14px 10px 5px;
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; margin-bottom: 1px;
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500; color: var(--text-2);
  transition: background .12s, color .12s;
}
.nav-link i.nav-ico { width: 17px; text-align: center; font-size: 13px; color: var(--text-3); transition: color .12s; }
.nav-link:hover { background: var(--bg-hover); color: var(--text); }
.nav-link:hover i.nav-ico { color: var(--text-2); }
.nav-link.active {
  background: var(--bg-panel); color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  padding: 6px 9px;
  font-weight: 600;
}
.nav-link.active i.nav-ico { color: var(--text); }
.nav-caret { margin-left: auto; font-size: 10px; color: var(--text-3); transition: transform .15s; }
details[open] > summary .nav-caret { transform: rotate(180deg); }
summary.nav-link { cursor: pointer; list-style: none; }
summary.nav-link::-webkit-details-marker { display: none; }

.nav-sub {
  margin: 2px 0 4px 18px; padding-left: 10px;
  border-left: 1px solid var(--border);
}
.nav-sub .nav-link { font-size: 12.5px; padding: 5.5px 9px; }
.nav-sub .nav-link.active { padding: 4.5px 8px; }

.sidebar-foot { border-top: 1px solid var(--border); padding: 10px 14px 14px; }
.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-panel);
  transition: background .12s;
}
.user-card:hover { background: var(--bg-hover); }
.user-card .u-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card .u-role { font-size: 11.5px; color: var(--text-3); }

/* ── Topbar ────────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 26px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky; top: 0; z-index: 20;
}
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-3); }
.breadcrumb b { color: var(--text); font-weight: 600; }
.breadcrumb .sep { font-size: 10px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ── Boutons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 550; white-space: nowrap;
  border: 1px solid transparent;
  transition: background .13s, border-color .13s, transform .1s, box-shadow .13s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--inv-bg); color: var(--inv-text); }
.btn-primary:hover { opacity: .88; box-shadow: 0 6px 16px -8px rgba(0,0,0,.4); }
.btn-ghost {
  background: var(--bg-panel); color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); border-color: var(--text-3); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
html.dark .btn-danger { color: #18181b; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { filter: brightness(1.08); }
html.dark .btn-success { color: #18181b; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon {
  width: 30px; height: 30px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); color: var(--text-3); font-size: 13px;
  transition: background .12s, color .12s;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text); }
.btn-icon.danger:hover { background: var(--red-bg); color: var(--red); }
.btn-icon.success:hover { background: var(--green-bg); color: var(--green); }
.btn-icon.info:hover { background: var(--blue-bg); color: var(--blue); }

/* ── Cartes ────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
}
.card.p0 { padding: 0; overflow: hidden; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-soft);
}
.card-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 620; }
.card-title i { color: var(--text-3); font-size: 12.5px; }
.card-link { font-size: 12.5px; color: var(--text-3); font-weight: 500; }
.card-link:hover { color: var(--text); }

.stat-card { position: relative; }
.stat-label { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.stat-label i { color: var(--text-3); font-size: 12px; }
.stat-ico {
  width: 28px; height: 28px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; flex-shrink: 0;
}
.stat-value { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; margin-top: 8px; line-height: 1.1; }
.stat-foot { margin-top: 8px; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); }

.delta { font-size: 11.5px; font-weight: 650; display: inline-flex; align-items: center; gap: 3px; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }
.delta.flat { color: var(--text-3); }

/* ── Badges ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2.5px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge-gray   { background: var(--gray-bg);   color: var(--gray); }
.badge-red    { background: var(--red-bg);    color: var(--red); }
.badge-orange { background: var(--orange-bg); color: var(--orange); }
.badge-amber  { background: var(--amber-bg);  color: var(--amber); }
.badge-green  { background: var(--green-bg);  color: var(--green); }
.badge-blue   { background: var(--blue-bg);   color: var(--blue); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-indigo { background: var(--indigo-bg); color: var(--indigo); }

.badge-yellow  { background: var(--amber-bg);  color: var(--amber); }
.badge-emerald { background: var(--green-bg);  color: var(--green); }
.badge-slate   { background: var(--gray-bg);   color: var(--gray); }
.badge-violet  { background: var(--purple-bg); color: var(--purple); }

/* ── Stepper de statut (page ticket) ───────────────────────────────────── */
.stepper { display: flex; align-items: flex-start; padding: 4px 8px; }
.step { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
.step-dot {
  width: 32px; height: 32px; border-radius: 999px; z-index: 1;
  display: flex; align-items: center; justify-content: center; font-size: 11px;
  background: var(--bg-subtle); color: var(--text-3);
  border: 1px solid var(--border-soft);
}
.step-label { font-size: 11.5px; margin-top: 6px; font-weight: 550; color: var(--text-3); white-space: nowrap; }
.step-line { flex: 1; height: 2px; margin: 16px 4px 0; background: var(--border); border-radius: 2px; }

.step.done .step-dot   { background: var(--step-bg, var(--gray-bg)); color: var(--step-c, var(--gray)); border-color: transparent; }
.step.done .step-label { color: var(--text-3); }
.step.active .step-dot {
  background: var(--step-c, var(--gray)); color: #fff; border-color: transparent;
  box-shadow: 0 0 0 3px var(--step-bg, var(--gray-bg));
}
html.dark .step.active .step-dot { color: #111; }
.step.active .step-label { color: var(--step-c, var(--gray)); }
.step-line.on { background: var(--step-c, var(--border)); opacity: .45; }

.st-purple { --step-c: var(--purple); --step-bg: var(--purple-bg); }
.st-blue   { --step-c: var(--blue);   --step-bg: var(--blue-bg); }
.st-amber  { --step-c: var(--amber);  --step-bg: var(--amber-bg); }
.st-green  { --step-c: var(--green);  --step-bg: var(--green-bg); }
.st-gray   { --step-c: var(--gray);   --step-bg: var(--gray-bg); }

.mention {
  display: inline-flex; padding: 1px 6px; border-radius: 5px;
  font-size: 11.5px; font-weight: 650;
  background: var(--indigo-bg); color: var(--indigo);
}
.mention-dropdown {
  position: absolute; z-index: 30; left: 0; margin-top: 4px; width: 260px;
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-pop); overflow: hidden;
}
.mention-dropdown li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; }
.mention-dropdown li:hover, .mention-dropdown li.sel { background: var(--bg-hover); }

.prio { display: inline-flex; align-items: flex-end; gap: 1.5px; height: 11px; margin-right: 2px; }
.prio span { width: 3px; border-radius: 1px; background: var(--border); }
.prio span:nth-child(1) { height: 4px; }
.prio span:nth-child(2) { height: 7px; }
.prio span:nth-child(3) { height: 11px; }
.prio.p-low span:nth-child(1) { background: var(--green); }
.prio.p-medium span:nth-child(-n+2) { background: var(--amber); }
.prio.p-high span, .prio.p-urgent span { background: var(--red); }

.group-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); }
.group-ico {
  width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; font-size: 11px;
}

.dot { width: 7px; height: 7px; border-radius: 999px; display: inline-block; flex-shrink: 0; }
.dot-green { background: var(--green); } .dot-amber { background: var(--amber); }
.dot-red { background: var(--red); }     .dot-gray { background: var(--border); }

/* ── Avatars ───────────────────────────────────────────────────────────── */
.avatar {
  width: 28px; height: 28px; border-radius: 999px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
  background: var(--gray);
}
.avatar.lg { width: 40px; height: 40px; font-size: 15px; }
.avatar.xl { width: 64px; height: 64px; font-size: 24px; }
.avatar.sm { width: 22px; height: 22px; font-size: 9px; }

/* ── Tableaux ──────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; font-size: 13px; }
.table thead th {
  text-align: left; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-subtle);
  white-space: nowrap;
}
.table tbody td { padding: 11px 16px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--bg-subtle); }
.table .cell-id { font-family: var(--mono); font-size: 12px; color: var(--text-3); }
.table a.cell-title { font-weight: 550; white-space: nowrap; }
.table a.cell-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.th-sort a { display: flex; align-items: center; gap: 5px; color: inherit; }
.th-sort a:hover { color: var(--text); }
.th-sort .fa-sort { color: var(--border); }
.th-sort a:hover .fa-sort { color: var(--text-3); }
th.th-active { color: var(--text); background: var(--bg-hover); }
tr.row-merged { background: var(--indigo-bg); }
tr.row-merged:hover { background: var(--indigo-bg); }

/* ── Formulaires ───────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; }
.label { font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.input, .select, .textarea, input[type=text].dj, select.dj, textarea.dj {
  width: 100%;
  padding: 8px 11px;
  font-size: 13px;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--text-3);
  box-shadow: 0 0 0 3px var(--gray-bg);
}
.select { appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23909097' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.select.inline, .input.inline { width: auto; }
.textarea { resize: vertical; min-height: 90px; }
.checkbox {
  width: 15px; height: 15px; accent-color: var(--text); cursor: pointer;
  border-radius: 4px;
}
input[type="date"].input { color-scheme: light; }
html.dark input[type="date"].input { color-scheme: dark; }

.color-input {
  height: 38px; width: 76px; padding: 3px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
}
.file-input { width: 100%; font-size: 12.5px; color: var(--text-3); }
.file-input::file-selector-button {
  margin-right: 12px; padding: 7px 13px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-subtle); color: var(--text-2);
  font: inherit; font-size: 12.5px; font-weight: 550; cursor: pointer;
  transition: background .12s;
}
.file-input::file-selector-button:hover { background: var(--bg-hover); }

form p label { font-size: 12.5px; font-weight: 550; color: var(--text-2); display: block; margin-bottom: 5px; }
.errorlist { color: var(--red); font-size: 12px; margin-top: 4px; }

/* ── Interrupteur (toggle) ─────────────────────────────────────────────── */
.switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 40px; height: 22px; border-radius: 999px;
  background: var(--border); transition: background .15s; position: relative;
}
.switch .track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 999px;
  background: var(--bg-panel); box-shadow: var(--shadow-card);
  transition: transform .18s cubic-bezier(.22,1,.36,1);
}
.switch input:checked + .track { background: var(--switch-c, var(--green)); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--gray-bg); }

.pill-check {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 13px; border: 1px solid var(--border); border-radius: 999px;
  font-size: 12.5px; font-weight: 550; color: var(--text-2);
  cursor: pointer; transition: all .13s; background: var(--bg-panel);
}
.pill-check input { position: absolute; opacity: 0; pointer-events: none; }
.pill-check:has(input:checked) {
  background: var(--inv-bg); color: var(--inv-text); border-color: var(--inv-bg);
}

/* ── Segmented control / onglets ───────────────────────────────────────── */
.seg { display: flex; gap: 3px; background: var(--bg-subtle); border: 1px solid var(--border-soft); border-radius: 10px; padding: 3px; }
.seg button, .seg a {
  flex: 1; padding: 5.5px 12px; border-radius: 7px;
  font-size: 12px; font-weight: 550; color: var(--text-3); text-align: center;
  transition: background .12s, color .12s;
}
.seg .active { background: var(--bg-panel); color: var(--text); box-shadow: var(--shadow-card); border: 1px solid var(--border); padding: 4.5px 11px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); }
.tabs a, .tabs button {
  padding: 9px 14px; font-size: 13px; font-weight: 550; color: var(--text-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs .active { color: var(--text); border-bottom-color: var(--text); }
.tabs a:hover { color: var(--text); }

/* ── Chips (filtres actifs, tags) ──────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500;
  background: var(--bg-panel); border: 1px solid var(--border); color: var(--text-2);
  transition: border-color .12s, background .12s;
}
.chip:hover { border-color: var(--text-3); background: var(--bg-hover); }
.chip i { font-size: 10px; color: var(--text-3); }

/* ── Alertes / flash ───────────────────────────────────────────────────── */
.alert {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  border: 1px solid;
}
.alert-info    { background: var(--blue-bg);  color: var(--blue);  border-color: transparent; }
.alert-success { background: var(--green-bg); color: var(--green); border-color: transparent; }
.alert-error   { background: var(--red-bg);   color: var(--red);   border-color: transparent; }
.alert .alert-close { margin-left: auto; opacity: .6; }
.alert .alert-close:hover { opacity: 1; }

.callout {
  font-size: 12px; border-radius: var(--radius-sm); padding: 9px 12px;
  display: flex; gap: 8px; align-items: flex-start;
}
.callout-red   { background: var(--red-bg);   color: var(--red); }
.callout-amber { background: var(--amber-bg); color: var(--amber); }
.callout-blue  { background: var(--blue-bg);  color: var(--blue); }

/* ── Modales ───────────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(9,9,11,.55); backdrop-filter: blur(3px); animation: fadeIn .2s ease-out; }
.modal-panel {
  position: relative; width: 100%; max-width: 480px;
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-pop);
  animation: scaleIn .22s cubic-bezier(.22,1,.36,1);
  max-height: 90vh; display: flex; flex-direction: column;
}
.modal-panel.wide { max-width: 620px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 20px; border-bottom: 1px solid var(--border-soft); flex-shrink: 0;
}
.modal-title { font-size: 14.5px; font-weight: 650; display: flex; align-items: center; gap: 9px; }
.modal-body { padding: 18px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-actions { display: flex; gap: 8px; padding-top: 4px; }
.modal-actions .btn { flex: 1; }

/* ── Barre d'actions groupées ──────────────────────────────────────────── */
.bulk-bar {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  z-index: 40;
  display: flex; flex-wrap: nowrap; align-items: center; gap: 6px;
  max-width: calc(100vw - 24px);
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-pop);
  padding: 8px 12px;
  animation: fadeInUp .25s ease-out;
}
/* Les actions défilent horizontalement si la barre dépasse ; le « ✕ » reste
   toujours visible, collé à droite, au lieu de passer à la ligne. */
.bulk-bar-actions {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 6px;
  min-width: 0; overflow-x: auto; scrollbar-width: thin;
}
.bulk-bar-actions::-webkit-scrollbar { height: 4px; }
.bulk-bar-actions::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
.bulk-bar-actions > * { flex-shrink: 0; }
.bulk-bar > .sep-v, .bulk-bar > .btn-icon { flex-shrink: 0; }
.bulk-bar .sep-v { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }

/* ── États vides ───────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty i { font-size: 30px; display: block; margin-bottom: 12px; color: var(--border); }
.empty p { font-weight: 500; color: var(--text-2); }

/* ── Listes ────────────────────────────────────────────────────────────── */
.list > li { border-bottom: 1px solid var(--border-soft); }
.list > li:last-child { border-bottom: none; }
.list-item { display: block; padding: 12px 20px; transition: background .1s; }
.list-item:hover { background: var(--bg-subtle); }

.activity-ico {
  width: 28px; height: 28px; border-radius: 999px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; font-size: 11px;
}
.ico-purple { background: var(--purple-bg); color: var(--purple); }
.ico-blue   { background: var(--blue-bg);   color: var(--blue); }
.ico-green  { background: var(--green-bg);  color: var(--green); }
.ico-orange { background: var(--orange-bg); color: var(--orange); }
.ico-red    { background: var(--red-bg);    color: var(--red); }
.ico-amber  { background: var(--amber-bg);  color: var(--amber); }
.ico-gray   { background: var(--gray-bg);   color: var(--gray); }
.ico-indigo { background: var(--indigo-bg); color: var(--indigo); }

.ico-emerald, .ico-teal   { background: var(--green-bg);  color: var(--green); }
.ico-yellow               { background: var(--amber-bg);  color: var(--amber); }
.ico-violet, .ico-fuchsia { background: var(--purple-bg); color: var(--purple); }
.ico-sky, .ico-cyan       { background: var(--blue-bg);   color: var(--blue); }
.ico-slate, .ico-zinc, .ico-stone, .ico-neutral { background: var(--gray-bg); color: var(--gray); }
.ico-rose, .ico-pink      { background: var(--red-bg);    color: var(--red); }
.ico-lime                 { background: var(--green-bg);  color: var(--green); }

.tone-gray, .tone-slate, .tone-zinc { --tone: var(--gray); --tone-bg: var(--gray-bg); }
.tone-red, .tone-rose      { --tone: var(--red);    --tone-bg: var(--red-bg); }
.tone-orange               { --tone: var(--orange); --tone-bg: var(--orange-bg); }
.tone-amber, .tone-yellow  { --tone: var(--amber);  --tone-bg: var(--amber-bg); }
.tone-green, .tone-emerald { --tone: var(--green);  --tone-bg: var(--green-bg); }
.tone-blue, .tone-sky      { --tone: var(--blue);   --tone-bg: var(--blue-bg); }
.tone-purple, .tone-violet { --tone: var(--purple); --tone-bg: var(--purple-bg); }
.tone-indigo               { --tone: var(--indigo); --tone-bg: var(--indigo-bg); }
.dot-tone   { background: var(--tone, var(--gray)); }
.badge-tone { background: var(--tone-bg, var(--gray-bg)); color: var(--tone, var(--gray)); }

/* ── Kanban (project board) ────────────────────────────────────────────── */
.kanban { display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; padding-bottom: 12px; }
.kanban-col {
  flex: 0 0 290px; background: var(--bg-subtle);
  border: 1px solid var(--border-soft); border-radius: var(--radius);
  border-top: 3px solid var(--tone, var(--border));
  padding: 10px;
  display: flex; flex-direction: column; max-height: 100%;
}
.kanban-cards { min-height: 60px; overflow-y: auto; }
.kanban-card.overdue { border-color: color-mix(in srgb, var(--red) 45%, var(--border)); }
.sortable-ghost { opacity: .4; }
.kanban-col-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; font-size: 12.5px; font-weight: 650; }
.kanban-card {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-card);
  padding: 11px 12px; margin-bottom: 8px; display: block;
  transition: border-color .12s, transform .12s;
}
.kanban-card:hover { border-color: var(--text-3); transform: translateY(-1px); }

/* ── Code / API docs ───────────────────────────────────────────────────── */
code, .code { font-family: var(--mono); font-size: 12px; }
pre.code-block {
  background: #17171a; color: #e4e4e7;
  border-radius: var(--radius-sm); border: 1px solid #232327;
  padding: 13px 15px; overflow-x: auto; font-size: 12px; line-height: 1.6;
  font-family: var(--mono);
}
html.dark pre.code-block { background: #0d0d0f; }
.method {
  font-family: var(--mono); font-size: 10.5px; font-weight: 700;
  padding: 2px 7px; border-radius: 5px; letter-spacing: .03em;
}
.method-get { background: var(--green-bg); color: var(--green); }
.method-post { background: var(--blue-bg); color: var(--blue); }
.method-patch, .method-put { background: var(--amber-bg); color: var(--amber); }
.method-delete { background: var(--red-bg); color: var(--red); }

.api-desc code, .inline-code {
  background: var(--gray-bg); border-radius: 4px;
  padding: 1px 5px; font-size: 11px; font-family: var(--mono);
}

/* ── Loader global ─────────────────────────────────────────────────────── */
#app-loader {
  position: fixed; inset: 0; z-index: 70;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--bg) 45%, transparent);
  backdrop-filter: blur(1px);
}
#app-loader.hidden { display: none; }
.spinner {
  width: 36px; height: 36px; border-radius: 999px;
  border: 3px solid var(--border);
  border-top-color: var(--text);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Utilitaires (mini couche layout) ──────────────────────────────────── */
.flex { display: flex; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-baseline { align-items: baseline; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.min-w-0 { min-width: 0; }
.shrink-0 { flex-shrink: 0; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; }
.grid { display: grid; gap: 16px; }
.grid.tight { gap: 10px; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-5 { grid-template-columns: repeat(5, 1fr); }
.span-2 { grid-column: span 2; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.ml-auto { margin-left: auto; }
.w-full { width: 100%; }
.truncate { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.text-xs { font-size: 11.5px; }
.text-sm { font-size: 12.5px; }
.text-lg { font-size: 16px; }
.font-semi { font-weight: 600; }
.mono { font-family: var(--mono); font-size: 12px; }
.space-y-2 > * + * { margin-top: 8px; }
.space-y-3 > * + * { margin-top: 12px; }
.space-y-4 > * + * { margin-top: 16px; }
.divide-y > * + * { border-top: 1px solid var(--border-soft); }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.page-title { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; }
.page-sub { font-size: 13px; color: var(--text-2); margin-top: 2px; }

/* ── Animations ────────────────────────────────────────────────────────── */
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes scaleIn  { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }

.reveal > * { animation: fadeInUp .5s cubic-bezier(.22,1,.36,1) both; }
.reveal > *:nth-child(1) { animation-delay: .03s; }
.reveal > *:nth-child(2) { animation-delay: .07s; }
.reveal > *:nth-child(3) { animation-delay: .11s; }
.reveal > *:nth-child(4) { animation-delay: .15s; }
.reveal > *:nth-child(5) { animation-delay: .19s; }
.reveal > *:nth-child(6) { animation-delay: .23s; }
.reveal > *:nth-child(7) { animation-delay: .27s; }
.reveal > *:nth-child(8) { animation-delay: .31s; }
.reveal > *:nth-child(n+9) { animation-delay: .35s; }

.hover-lift { transition: transform .2s cubic-bezier(.22,1,.36,1), box-shadow .2s ease, border-color .15s; }
.hover-lift:hover { transform: translateY(-2px); border-color: var(--text-3); box-shadow: 0 10px 24px -14px rgba(0,0,0,.25); }

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

/* ── Responsive ────────────────────────────────────────────────────────── */
.mobile-bar { display: none; }
@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 60;
    transform: translateX(-100%); transition: transform .22s ease;
    background: var(--bg); height: 100%;
  }
  .sidebar.open { transform: none; box-shadow: var(--shadow-pop); }
  #sidebar-backdrop { position: fixed; inset: 0; z-index: 55; background: rgba(9,9,11,.45); }
  #sidebar-backdrop.hidden { display: none; }
  .mobile-bar {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--bg);
    position: sticky; top: 0; z-index: 30;
  }
  .topbar { display: none; }
  .content { padding: 16px 14px 32px; }
  .cols-3, .cols-4, .cols-5 { grid-template-columns: repeat(2, 1fr); }
  .span-2 { grid-column: auto; }
}
@media (max-width: 560px) {
  .cols-2, .cols-3, .cols-4, .cols-5 { grid-template-columns: 1fr; }
}

.grid-main { display: grid; gap: 16px; grid-template-columns: 2fr 1fr; }
/* Sans min-width:0 une colonne de grille se dimensionne sur son contenu : une
   URL insécable (alerte Grafana, lien de webhook…) élargit alors toute la page
   et fait sortir la colonne latérale de l'écran. */
.grid-main > * { min-width: 0; }
@media (max-width: 1100px) { .grid-main { grid-template-columns: 1fr; } }

/* Texte libre saisi par l'utilisateur : sauts de ligne conservés, chaînes
   insécables coupées plutôt que débordantes. */
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }

.checkbox-list { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 2px 0; margin: 0; }
.checkbox-list li { margin: 0; }
.checkbox-list label { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; font-weight: 400; }
.checkbox-list input[type="checkbox"] { accent-color: var(--accent, #6366f1); width: 15px; height: 15px; }

/* ── Sélecteur d'icône Font Awesome ─────────────────────────────────────── */
.icon-picker { position: relative; }

.icon-picker-trigger {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 6px 11px 6px 6px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  font: inherit; font-size: 13px; color: var(--text); text-align: left;
  transition: border-color .15s, box-shadow .15s;
}
.icon-picker-trigger:hover { border-color: var(--text-3); }
.icon-picker-trigger:focus-visible {
  outline: none; border-color: var(--text-3); box-shadow: 0 0 0 3px var(--gray-bg);
}
.icon-picker-current {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-subtle); color: var(--text-2); font-size: 13px;
}
.icon-picker-name { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.icon-picker-caret { margin-left: auto; font-size: 10px; color: var(--text-3); }

.icon-picker-panel {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-pop); overflow: hidden;
}
.icon-picker-search {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 13px; border-bottom: 1px solid var(--border-soft);
}
.icon-picker-search i { font-size: 12px; color: var(--text-3); }
.icon-picker-search input {
  flex: 1; border: none; outline: none; background: none;
  font: inherit; font-size: 13px; color: var(--text);
}
.icon-picker-body { max-height: 290px; overflow-y: auto; padding: 6px 10px 12px; }
.icon-picker-section {
  font-size: 11px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase;
  color: var(--text-3); padding: 10px 3px 6px;
}
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 4px; }
.icon-opt {
  aspect-ratio: 1; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: none; color: var(--text-2); font-size: 14px; cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.icon-opt:hover { background: var(--bg-hover); color: var(--text); }
.icon-opt.selected { background: var(--inv-bg); color: var(--inv-text); border-color: var(--inv-bg); }
.icon-picker-empty { font-size: 12.5px; color: var(--text-3); padding: 18px 3px; text-align: center; }

/* ── Sélecteur de couleur de badge ──────────────────────────────────────── */
.color-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.color-picker .swatch {
  width: 32px; height: 32px; border-radius: 9px; cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; transition: transform .12s, box-shadow .12s;
}
.color-picker .swatch:hover { transform: scale(1.08); }
.color-picker .swatch i { opacity: 0; transition: opacity .12s; }
.color-picker .swatch.selected i { opacity: 1; }
.color-picker .swatch.selected { box-shadow: 0 0 0 2px var(--bg-panel), 0 0 0 4px currentColor; }

.modal-body .icon-picker-panel { position: static; box-shadow: none; margin-top: 6px; }
.modal-body .icon-picker-body { max-height: 200px; }
