/* ==========================================================================
   Composants communs — boutons, champs, badges, cartes, tableaux, overlays…
   Chaque composant est documenté dans docs/COMPONENTS.md et visible sur
   la page « Bibliothèque UI » (#/components).
   ========================================================================== */

/* ------------------------------------------------------------------ Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.card--flat { box-shadow: none; }
.card--sunken { background: var(--surface-sunken); box-shadow: none; }
.card__head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 0; min-height: 46px; }
.card__head--bordered { padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.card__title { font-size: 13.5px; font-weight: 620; letter-spacing: -.008em; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.card__title .lucide { color: var(--text-3); }
.card__sub { font-size: 11.5px; color: var(--text-3); }
.card__actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.card__body { padding: 14px 16px 16px; }
.card__body--flush { padding: 8px 0 0; }
.card__foot { padding: 10px 16px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); }
.card--interactive { transition: border-color var(--dur-fast), transform var(--dur) var(--ease), box-shadow var(--dur); cursor: pointer; }
.card--interactive:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }

/* Stat tile */
.stat { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.stat__label { font-size: 12px; color: var(--text-2); font-weight: 520; display: flex; align-items: center; gap: 7px; }
.stat__label .lucide { width: 14px; height: 14px; color: var(--text-3); }
.stat__value { font-size: 26px; font-weight: 650; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; display: flex; align-items: baseline; gap: 6px; }
.stat__value small { font-size: 13px; font-weight: 520; color: var(--text-3); letter-spacing: 0; }
.stat__meta { font-size: 11.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.stat:has(.stat__spark) .stat__meta { padding-right: 96px; }
.stat__spark { position: absolute; right: 12px; bottom: 12px; width: 92px; height: 30px; opacity: .9; }
.delta { white-space: nowrap; font-size: 11.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 2px; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--success); } .delta.down { color: var(--danger); }

/* ---------------------------------------------------------------- Buttons */
.btn {
  --btn-h: 34px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: var(--btn-h); padding: 0 13px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 580; letter-spacing: -.003em; white-space: nowrap;
  border: 1px solid transparent; user-select: none;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast), transform 80ms;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled, .btn.is-disabled { opacity: .45; cursor: not-allowed; }
.btn .lucide { width: 15px; height: 15px; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 1px 2px rgba(0,0,0,.2); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:active:not(:disabled) { background: var(--accent-press); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
[data-theme="light"] .btn-secondary { background: var(--surface); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-3); }
[data-theme="light"] .btn-secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }
[data-theme="dark"] .btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-soft { background: var(--accent-soft); color: var(--accent-text); }
.btn-soft:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.07); }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); }
.btn-danger-soft:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 22%, transparent); }
.btn-live { background: var(--live); color: #fff; box-shadow: 0 6px 18px -8px var(--live); }
.btn-sm { --btn-h: 28px; padding: 0 10px; font-size: 12.5px; gap: 6px; }
.btn-sm .lucide { width: 14px; height: 14px; }
.btn-xs { --btn-h: 24px; padding: 0 8px; font-size: 12px; gap: 5px; border-radius: 6px; }
.btn-xs .lucide { width: 13px; height: 13px; }
.btn-lg { --btn-h: 42px; padding: 0 18px; font-size: 14px; border-radius: var(--r); }
.btn-icon { width: var(--btn-h); padding: 0; }
.btn-block { width: 100%; }
.btn.is-loading { pointer-events: none; color: transparent !important; position: relative; }
.btn.is-loading::after { content: ""; position: absolute; width: 15px; height: 15px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--on-accent) var(--on-accent) transparent transparent; animation: rm-spin .7s linear infinite; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.btn-group .btn:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.btn-group .btn + .btn { margin-left: -1px; }

/* Segmented control */
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); }
[data-theme="light"] .segmented { background: var(--surface-3); border-color: transparent; }
.segmented button { height: 28px; padding: 0 12px; border-radius: 7px; font-size: 12.5px; font-weight: 560; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; transition: background var(--dur-fast), color var(--dur-fast); }
.segmented button:hover { color: var(--text); }
.segmented button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
[data-theme="dark"] .segmented button.is-active { background: var(--surface-3); }
.segmented--sm button { height: 24px; padding: 0 9px; font-size: 12px; }
.segmented .lucide { width: 14px; height: 14px; }

/* ----------------------------------------------------------------- Inputs */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 12.5px; font-weight: 560; color: var(--text); display: flex; align-items: center; gap: 6px; }
.field__hint { font-size: 11.5px; color: var(--text-3); }
.field__error { font-size: 11.5px; color: var(--danger); display: flex; align-items: center; gap: 5px; }
.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 11px;
  border-radius: var(--r-sm); border: 1px solid var(--border-strong);
  background: var(--surface-sunken); color: var(--text);
  font-size: 13.5px; transition: border-color var(--dur-fast), box-shadow var(--dur-fast), background var(--dur-fast);
}
[data-theme="light"] .input, [data-theme="light"] .select, [data-theme="light"] .textarea { background: var(--surface); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: color-mix(in srgb, var(--text-3) 50%, transparent); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--border-focus); box-shadow: var(--ring); }
.input.is-invalid { border-color: var(--danger); }
.input:disabled { opacity: .55; cursor: not-allowed; }
.input-sm, .select.input-sm { height: 30px; font-size: 12.5px; }
.textarea { height: auto; min-height: 84px; padding: 9px 11px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238D92A0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 15 5 5 5-5'/%3E%3Cpath d='m7 9 5-5 5 5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 14px;
}
.input-group { position: relative; display: flex; align-items: center; }
.input-group > .lucide { position: absolute; left: 11px; color: var(--text-3); pointer-events: none; }
.input-group > .input { padding-left: 34px; }
.input-group > .input-suffix { position: absolute; right: 10px; font-size: 12px; color: var(--text-3); pointer-events: none; }
.input-group > .input-action { position: absolute; right: 4px; }
.input-addon { display: flex; }
.input-addon > .addon { display: flex; align-items: center; padding: 0 10px; font-size: 12.5px; color: var(--text-3); border: 1px solid var(--border-strong); border-right: 0; border-radius: var(--r-sm) 0 0 var(--r-sm); background: var(--surface-2); white-space: nowrap; }
.input-addon > .input { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 680px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.form-section { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; padding: 22px 0; border-top: 1px solid var(--border); }
.form-section:first-child { border-top: 0; padding-top: 4px; }
.form-section__intro h3 { font-size: 14px; font-weight: 620; margin-bottom: 4px; }
.form-section__intro p { font-size: 12.5px; color: var(--text-3); }
@media (max-width: 1024px) { .form-section { grid-template-columns: minmax(0, 1fr); gap: 12px; } }

/* Stepper numérique */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface-sunken); height: 36px; }
[data-theme="light"] .stepper { background: var(--surface); }
.stepper button { width: 32px; height: 100%; display: grid; place-items: center; color: var(--text-2); }
.stepper button:hover { color: var(--text); background: var(--surface-hover); }
.stepper input { width: 44px; text-align: center; border: 0; background: transparent; font-weight: 620; font-variant-numeric: tabular-nums; height: 100%; }
.stepper input:focus { outline: none; }

/* Range slider */
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 20px; background: transparent; cursor: pointer; --val: 50%; }
.range::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--accent) var(--val), var(--surface-3) var(--val)); }
.range::-moz-range-track { height: 4px; border-radius: 4px; background: var(--surface-3); }
.range::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; margin-top: -6px; box-shadow: 0 0 0 1px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.3); }
.range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 1px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.3); }

/* Switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track { width: 34px; height: 20px; border-radius: 20px; background: var(--surface-3); position: relative; flex-shrink: 0; transition: background var(--dur) var(--ease); box-shadow: inset 0 0 0 1px var(--border); }
[data-theme="light"] .switch__track { background: #D9D9D4; }
.switch__track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform var(--dur) var(--ease-out); }
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(14px); }
.switch input:focus-visible + .switch__track { box-shadow: var(--ring); }
.switch input:disabled + .switch__track { opacity: .5; }
.switch--sm .switch__track { width: 28px; height: 16px; }
.switch--sm .switch__track::after { width: 12px; height: 12px; }
.switch--sm input:checked + .switch__track::after { transform: translateX(12px); }

/* Checkbox & radio */
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13px; user-select: none; }
.check input { appearance: none; -webkit-appearance: none; margin: 0; width: 16px; height: 16px; border-radius: 4.5px; border: 1.5px solid var(--text-3); background: transparent; display: grid; place-items: center; flex-shrink: 0; cursor: pointer; transition: background var(--dur-fast), border-color var(--dur-fast); }
.check input:hover { border-color: var(--text-2); }
.check input:checked, .check input:indeterminate { background: var(--accent); border-color: var(--accent); }
.check input:checked::after { content: ""; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.check input:indeterminate::after { content: ""; width: 8px; height: 2px; background: #fff; border-radius: 2px; }
.check input[type="radio"] { border-radius: 50%; }
.check input[type="radio"]:checked { background: transparent; border-color: var(--accent); border-width: 5px; }
.check input[type="radio"]:checked::after { display: none; }
.check input:focus-visible { box-shadow: var(--ring); }

/* Choix sous forme de cartes */
.choice { position: relative; display: flex; gap: 12px; padding: 14px; border-radius: var(--r); border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; transition: border-color var(--dur-fast), background var(--dur-fast), box-shadow var(--dur-fast); }
.choice:hover { border-color: color-mix(in srgb, var(--text-3) 60%, transparent); }
.choice input { position: absolute; opacity: 0; }
.choice.is-selected, .choice:has(input:checked) { border-color: var(--accent); background: var(--accent-softer); box-shadow: 0 0 0 1px var(--accent); }
.choice__icon { width: 34px; height: 34px; border-radius: 9px; background: var(--surface-2); display: grid; place-items: center; color: var(--text-2); flex-shrink: 0; }
.choice:has(input:checked) .choice__icon, .choice.is-selected .choice__icon { background: var(--accent-soft); color: var(--accent-text); }
.choice__title { font-weight: 600; font-size: 13.5px; }
.choice__desc { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.choice__radio { margin-left: auto; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--text-3); flex-shrink: 0; }
.choice:has(input:checked) .choice__radio, .choice.is-selected .choice__radio { border: 5px solid var(--accent); }

/* ------------------------------------------------------------------- Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 12px; font-size: 13px; font-weight: 560; color: var(--text-2); white-space: nowrap; transition: color var(--dur-fast); }
.tab:hover { color: var(--text); }
.tab .lucide { width: 15px; height: 15px; color: var(--text-3); }
.tab.is-active { color: var(--text); }
.tab.is-active .lucide { color: var(--accent); }
.tab.is-active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: var(--accent); }
.tab .count { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 8px; background: var(--surface-3); color: var(--text-2); font-variant-numeric: tabular-nums; }
.tab.is-active .count { background: var(--accent-soft); color: var(--accent-text); }
.tab-panel { animation: rm-fade-in var(--dur) var(--ease); }

/* Liste de navigation verticale (sous-menus de paramètres) */
.vnav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: calc(var(--header-h) + 20px); }
.vnav a, .vnav button { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: var(--r-sm); font-size: 13px; color: var(--text-2); font-weight: 520; width: 100%; text-align: left; }
.vnav a:hover, .vnav button:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.vnav .is-active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: inset 0 0 0 1px var(--border); }
.vnav .is-active .lucide { color: var(--accent); }
.vnav .lucide { color: var(--text-3); }

/* ----------------------------------------------------------------- Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 21px; padding: 0 8px; border-radius: var(--r-full); font-size: 11.5px; font-weight: 580; white-space: nowrap; background: var(--surface-3); color: var(--text-2); font-variant-numeric: tabular-nums; }
.badge .lucide { width: 12px; height: 12px; }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-live { background: var(--live); color: #fff; letter-spacing: .06em; font-size: 10.5px; font-weight: 700; text-transform: uppercase; }
.badge-outline { background: transparent; box-shadow: inset 0 0 0 1px var(--border-strong); color: var(--text-2); }
.badge-sq { border-radius: 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; display: inline-block; }
.dot-live { color: var(--live); animation: rm-pulse 1.6s var(--ease) infinite; }
.dot-ok { color: var(--success); } .dot-warn { color: var(--warning); } .dot-err { color: var(--danger); } .dot-off { color: var(--text-3); }
.dot-ring { animation: rm-ring 1.8s ease-out infinite; }

/* Tag de catégorie de contenu */
.cat { display: inline-flex; align-items: center; gap: 6px; height: 21px; padding: 0 8px 0 7px; border-radius: 6px; font-size: 11.5px; font-weight: 580; white-space: nowrap; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); }
.cat .lucide { width: 12px; height: 12px; }
.cat--music { --c: var(--cat-music); } .cat--jingle { --c: var(--cat-jingle); } .cat--ad { --c: var(--cat-ad); }
.cat--top { --c: var(--cat-top); } .cat--show { --c: var(--cat-show); } .cat--event { --c: var(--cat-event); }
.cat--request { --c: var(--cat-request); } .cat--other, .cat--sweeper, .cat--decro, .cat--raccro, .cat--virgule { --c: var(--cat-other); }
.cat--decro, .cat--raccro { --c: var(--cat-show); } .cat--virgule { --c: var(--cat-ad); }
.cat-bar { width: 3px; border-radius: 3px; align-self: stretch; background: var(--c, var(--accent)); flex-shrink: 0; }
.swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--c, var(--accent)); flex-shrink: 0; display: inline-block; }

/* Chip filtre */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: var(--r-full); font-size: 12.5px; font-weight: 540; border: 1px dashed var(--border-strong); color: var(--text-2); background: transparent; white-space: nowrap; }
.chip:hover { color: var(--text); border-color: var(--text-3); }
.chip.is-active { border-style: solid; background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.chip .x { opacity: .6; }
.chip .x:hover { opacity: 1; }

/* ----------------------------------------------------------------- Covers */
.cover {
  --size: 40px; --h: 240;
  width: var(--size); height: var(--size); flex-shrink: 0;
  border-radius: calc(var(--size) * .16);
  position: relative; overflow: hidden;
  background:
    radial-gradient(120% 90% at 85% 10%, hsl(calc(var(--h) + 40) var(--cover-sat) calc(var(--cover-light) + 10%) / .95), transparent 60%),
    radial-gradient(90% 90% at 10% 100%, hsl(calc(var(--h) - 30) var(--cover-sat) calc(var(--cover-light) - 14%)), transparent 70%),
    hsl(var(--h) var(--cover-sat) var(--cover-light));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08), 0 1px 2px rgba(0,0,0,.2);
  display: grid; place-items: center;
}
.cover::after { content: ""; position: absolute; inset: 0; background: repeating-radial-gradient(circle at 30% 120%, rgba(255,255,255,.06) 0 1px, transparent 1px 7px); mix-blend-mode: overlay; }
.cover__txt { position: relative; z-index: 1; font-weight: 750; color: rgba(255,255,255,.92); letter-spacing: -.04em; font-size: calc(var(--size) * .3); text-shadow: 0 1px 8px rgba(0,0,0,.2); }
.cover--icon { background: color-mix(in srgb, var(--c) 16%, var(--surface-2)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 30%, transparent); color: var(--c); }
.cover--icon::after { display: none; }
.cover--icon .lucide { width: calc(var(--size) * .44); height: calc(var(--size) * .44); }
.cover-xs { --size: 28px; } .cover-sm { --size: 34px; } .cover-md { --size: 44px; } .cover-lg { --size: 64px; } .cover-xl { --size: 168px; } .cover-2xl { --size: 220px; }

/* ----------------------------------------------------------------- Avatar */
.avatar { --size: 32px; width: var(--size); height: var(--size); border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; font-weight: 650; font-size: calc(var(--size) * .38); color: #fff; background: hsl(var(--h, 240) 45% 48%); letter-spacing: -.02em; box-shadow: 0 0 0 2px var(--surface); }
.avatar-sm { --size: 24px; } .avatar-lg { --size: 44px; } .avatar-xl { --size: 80px; }
.avatar-stack { display: flex; } .avatar-stack .avatar + .avatar { margin-left: -8px; }
.station-logo { --size: 32px; width: var(--size); height: var(--size); border-radius: calc(var(--size) * .28); flex-shrink: 0; display: grid; place-items: center; background: var(--c, var(--accent)); color: #fff; font-weight: 750; font-size: calc(var(--size) * .4); letter-spacing: -.04em; box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); }
.station-logo.sm { --size: 24px; } .station-logo.lg { --size: 44px; } .station-logo.xl { --size: 64px; }
.station-logo.all { background: var(--surface-3); color: var(--text-2); }

/* --------------------------------------------------------------- Progress */
.progress { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; position: relative; }
.progress > .progress__bar { height: 100%; border-radius: inherit; background: var(--c, var(--accent)); width: var(--p, 0%); transition: width .9s linear; }
.progress-sm { height: 4px; } .progress-lg { height: 8px; }
.progress--live > .progress__bar { background: linear-gradient(90deg, var(--live), color-mix(in srgb, var(--live) 70%, #ff9a5a)); position: relative; }
.progress--live > .progress__bar::after { content: ""; position: absolute; right: -1px; top: 50%; width: 12px; height: 12px; border-radius: 50%; transform: translateY(-50%); background: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--live) 40%, transparent); }
.progress--live { overflow: visible; }
.progress-segments { display: flex; height: 8px; border-radius: 8px; overflow: hidden; gap: 2px; background: var(--surface-3); }
.progress-segments > i { display: block; height: 100%; background: var(--c); }
.ring { --p: 50; --c: var(--accent); width: 56px; height: 56px; border-radius: 50%; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-3) 0); display: grid; place-items: center; }
.ring > span { width: calc(100% - 10px); height: calc(100% - 10px); border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ Table */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th { position: sticky; top: 0; text-align: left; font-size: 11.5px; font-weight: 600; color: var(--text-3); padding: 0 12px; height: 36px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); z-index: 1; user-select: none; }
.table th.sortable { cursor: pointer; }
.table th.sortable:hover { color: var(--text-2); }
.table th .sort-ico { display: inline-flex; vertical-align: -2px; margin-left: 3px; opacity: .35; }
.table th.is-sorted { color: var(--text); }
.table th.is-sorted .sort-ico { opacity: 1; color: var(--accent); }
.table td { padding: 0 12px; height: 50px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background var(--dur-fast); }
.table tbody tr:hover { background: var(--surface-hover); }
[data-theme="dark"] .table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.table tbody tr.is-selected { background: var(--accent-softer); }
.table tbody tr.is-selected td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.is-clickable { cursor: pointer; }
.table tbody tr.is-muted td { color: var(--text-3); }
.table tbody tr.is-muted .cell-title { color: var(--text-2); }
.table .col-check { width: 40px; padding-right: 0; }
.table .col-actions { width: 1%; text-align: right; white-space: nowrap; }
.table .col-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .col-num.mono, .table td.mono { font-family: var(--font-mono); font-size: 12.5px; }
.table-compact td { height: 40px; }
.table-dense td { height: 34px; font-size: 12.5px; }
.cell-media { display: flex; align-items: center; gap: 11px; min-width: 0; }
.cell-title { font-weight: 580; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-actions { opacity: 0; transition: opacity var(--dur-fast); display: inline-flex; gap: 2px; }
tr:hover .row-actions, tr.is-selected .row-actions, .row-actions:focus-within { opacity: 1; }
@media (hover: none) { .row-actions { opacity: 1; } }

/* Barre de sélection / actions groupées */
.bulkbar {
  position: sticky; bottom: 16px; z-index: 20; margin: 12px auto 0; width: max-content; max-width: 100%;
  display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 14px; border-radius: var(--r-lg);
  background: var(--text); color: var(--text-inv); box-shadow: var(--shadow-lg);
  animation: rm-pop var(--dur) var(--ease-out);
}
.bulkbar .btn-ghost { color: color-mix(in srgb, var(--text-inv) 80%, transparent); }
.bulkbar .btn-ghost:hover { background: color-mix(in srgb, var(--text-inv) 12%, transparent) !important; color: var(--text-inv); }
.bulkbar__count { font-weight: 620; font-size: 13px; margin-right: 8px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bulkbar__sep { width: 1px; height: 20px; background: color-mix(in srgb, var(--text-inv) 18%, transparent); margin: 0 2px; }

/* Toolbar */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 16px; }
.toolbar .input-group { width: 280px; max-width: 100%; }
.toolbar__spacer { flex: 1; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-3); flex-wrap: wrap; }
.pagination__pages { display: flex; align-items: center; gap: 2px; }
.pagination__pages button { min-width: 28px; height: 28px; padding: 0 6px; border-radius: 7px; font-size: 12.5px; font-weight: 560; color: var(--text-2); font-variant-numeric: tabular-nums; display: grid; place-items: center; }
.pagination__pages button:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }
.pagination__pages button.is-active { background: var(--accent-soft); color: var(--accent-text); }
.pagination__pages button:disabled { opacity: .35; cursor: default; }

/* ----------------------------------------------------------------- Lists */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 9px 16px; position: relative; transition: background var(--dur-fast); min-width: 0; }
.list-item:hover { background: var(--surface-hover); }
[data-theme="dark"] .list-item:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.list-item + .list-item { border-top: 1px solid var(--border); }
.list-item__body { flex: 1; min-width: 0; }
.list-item__title { font-weight: 580; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item__sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.list-item__aside { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.list-item__time { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); width: 42px; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.list-item.is-enter { animation: rm-drop var(--dur-slow) var(--ease-out); }
.list-item.is-enter-up { animation: rm-rise var(--dur-slow) var(--ease-out); }
.list-item.is-leave { animation: rm-slide-out-up var(--dur-slow) var(--ease) forwards; overflow: hidden; }

/* Drag & drop */
.drag-handle { cursor: grab; color: var(--text-3); display: grid; place-items: center; width: 20px; flex-shrink: 0; opacity: .7; }
.drag-handle:hover { color: var(--text-2); opacity: 1; }
.is-dragging { opacity: .4; }
.drop-before { box-shadow: inset 0 2px 0 var(--accent) !important; }
.drop-after { box-shadow: inset 0 -2px 0 var(--accent) !important; }
.drop-left { box-shadow: -3px 0 0 var(--accent) !important; }
.drop-right { box-shadow: 3px 0 0 var(--accent) !important; }

/* KV list */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 9px 16px; font-size: 13px; }
.kv dt { color: var(--text-3); white-space: nowrap; }
.kv dd { margin: 0; font-weight: 520; text-align: right; font-variant-numeric: tabular-nums; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv--left dd { text-align: left; }

/* --------------------------------------------------------------- Alerts */
.alert { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--r); font-size: 13px; background: var(--surface-2); border: 1px solid var(--border); align-items: flex-start; }
.alert > .lucide { margin-top: 1px; color: var(--c, var(--text-2)); width: 17px; height: 17px; }
.alert__title { font-weight: 620; margin-bottom: 2px; }
.alert__body { color: var(--text-2); flex: 1; min-width: 0; }
.alert-info { --c: var(--info); background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 22%, transparent); }
.alert-success { --c: var(--success); background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 22%, transparent); }
.alert-warning { --c: var(--warning); background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 25%, transparent); }
.alert-danger { --c: var(--danger); background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }

/* --------------------------------------------------------------- Overlays */
.overlay-root { position: fixed; inset: 0; z-index: var(--z-modal); pointer-events: none; }
.scrim { position: fixed; inset: 0; background: var(--overlay); animation: rm-fade-in var(--dur) var(--ease); pointer-events: auto; backdrop-filter: blur(2px); }
.scrim.is-leaving { opacity: 0; transition: opacity var(--dur); }

.modal {
  position: fixed; left: 50%; top: 9vh; transform: translateX(-50%);
  width: min(560px, calc(100vw - 24px)); max-height: 82vh;
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-xl); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg); pointer-events: auto;
  animation: rm-pop var(--dur-slow) var(--ease-out);
}
[data-theme="dark"] .modal { background: var(--surface-2); }
.modal.is-leaving { opacity: 0; transform: translateX(-50%) translateY(6px) scale(.98); transition: all var(--dur) var(--ease); }
.modal-sm { width: min(420px, calc(100vw - 24px)); }
.modal-lg { width: min(760px, calc(100vw - 24px)); }
.modal-xl { width: min(1000px, calc(100vw - 24px)); }
.modal__head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 4px; }
.modal__icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; background: var(--accent-soft); color: var(--accent-text); }
.modal__icon.is-danger { background: var(--danger-soft); color: var(--danger); }
.modal__icon.is-warning { background: var(--warning-soft); color: var(--warning); }
.modal__icon.is-live { background: var(--live-soft); color: var(--live); }
.modal__title { font-size: 16px; font-weight: 650; letter-spacing: -.015em; }
.modal__desc { font-size: 13px; color: var(--text-2); margin-top: 3px; }
.modal__close { margin-left: auto; margin-top: -4px; margin-right: -6px; }
.modal__body { padding: 16px 20px; overflow-y: auto; }
.modal__foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
.modal__foot .left { margin-right: auto; font-size: 12px; color: var(--text-3); }

.drawer {
  position: fixed; top: 8px; right: 8px; bottom: 8px; width: min(480px, calc(100vw - 16px));
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg); pointer-events: auto;
  animation: rm-drawer-in var(--dur-slow) var(--ease-out);
  z-index: var(--z-drawer);
}
[data-theme="dark"] .drawer { background: var(--surface-2); }
.drawer-lg { width: min(640px, calc(100vw - 16px)); }
.drawer.is-leaving { transform: translateX(24px); opacity: 0; transition: all var(--dur) var(--ease); }
@keyframes rm-drawer-in { from { transform: translateX(32px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer__head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.drawer__body { flex: 1; overflow-y: auto; padding: 18px; }
.drawer__foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--border); }

/* Popover / menu */
.popover {
  position: fixed; z-index: var(--z-popover); min-width: 200px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); padding: 6px;
  animation: rm-pop var(--dur) var(--ease-out); transform-origin: top;
}
[data-theme="dark"] .popover { background: var(--surface-2); }
.popover--pad { padding: 14px; }
.menu-label { font-size: 10.5px; font-weight: 640; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); padding: 8px 10px 4px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px; border-radius: var(--r-sm); font-size: 13px; color: var(--text); text-align: left; white-space: nowrap; }
.menu-item:hover, .menu-item.is-focus { background: var(--surface-hover); text-decoration: none; }
[data-theme="dark"] .menu-item:hover { background: var(--surface-3); }
.menu-item .lucide { color: var(--text-3); width: 15px; height: 15px; }
.menu-item .kbd { margin-left: auto; }
.menu-item .menu-check { margin-left: auto; color: var(--accent); }
.menu-item.is-danger { color: var(--danger); }
.menu-item.is-danger .lucide { color: var(--danger); }
.menu-item.is-selected { background: var(--accent-softer); }
.menu-sep { height: 1px; background: var(--border); margin: 5px -6px; }

/* Tooltip (CSS) */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 7px); transform: translateX(-50%) translateY(3px);
  padding: 5px 8px; border-radius: 6px; background: var(--text); color: var(--text-inv); font-size: 11.5px; font-weight: 550; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity var(--dur-fast), transform var(--dur-fast); z-index: var(--z-tooltip); letter-spacing: 0; text-transform: none;
}
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translateX(-50%); transition-delay: 350ms; }
[data-tip-pos="bottom"]::after { bottom: auto; top: calc(100% + 7px); }
[data-tip-pos="right"]::after { left: calc(100% + 8px); bottom: auto; top: 50%; transform: translateY(-50%); }
[data-tip-pos="right"]:hover::after { transform: translateY(-50%); }
html:not([data-sidebar="collapsed"]) .sidebar [data-tip]::after { display: none; }

/* ----------------------------------------------------------------- Toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 11px; align-items: flex-start; padding: 12px 12px 12px 14px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg);
  animation: rm-toast-in var(--dur-slow) var(--ease-out); position: relative; overflow: hidden;
}
[data-theme="dark"] .toast { background: var(--surface-3); }
.toast.is-leaving { animation: rm-toast-out var(--dur) var(--ease) forwards; }
@keyframes rm-toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes rm-toast-out { to { opacity: 0; transform: translateX(20px); } }
.toast > .lucide { color: var(--c, var(--accent)); margin-top: 1px; width: 17px; height: 17px; }
.toast__title { font-weight: 620; font-size: 13px; }
.toast__desc { font-size: 12.5px; color: var(--text-2); margin-top: 1px; }
.toast__body { flex: 1; min-width: 0; }
.toast__timer { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--c, var(--accent)); opacity: .6; animation: rm-toast-timer linear forwards; }
@keyframes rm-toast-timer { from { width: 100%; } to { width: 0; } }
.toast-success { --c: var(--success); } .toast-warning { --c: var(--warning); } .toast-danger { --c: var(--danger); } .toast-live { --c: var(--live); }

/* --------------------------------------------------------------- Skeleton */
.skeleton { border-radius: 6px; background: linear-gradient(90deg, var(--skeleton-a) 0, var(--skeleton-b) 50%, var(--skeleton-a) 100%); background-size: 800px 100%; animation: rm-shimmer 1.4s linear infinite; }
.sk-line { height: 10px; } .sk-title { height: 14px; width: 40%; } .sk-circle { border-radius: 50%; }

/* ----------------------------------------------------------- Empty/Error */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 40px 24px; gap: 6px; }
.empty__icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-3); margin-bottom: 8px; box-shadow: inset 0 0 0 1px var(--border); }
.empty__icon.is-danger { background: var(--danger-soft); color: var(--danger); }
.empty__title { font-weight: 620; font-size: 14.5px; }
.empty__desc { color: var(--text-2); font-size: 13px; max-width: 44ch; }
.empty .btn { margin-top: 10px; }

/* Dropzone */
.dropzone { border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg); padding: 30px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; background: var(--surface-sunken); transition: border-color var(--dur), background var(--dur); cursor: pointer; }
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-softer); }
.dropzone__icon { width: 46px; height: 46px; border-radius: 13px; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; }
.dropzone.is-over .dropzone__icon { transform: translateY(-3px); transition: transform var(--dur); }

/* Mini calendrier */
.calendar { width: 264px; user-select: none; }
.calendar__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.calendar__title { font-weight: 620; font-size: 13px; text-transform: capitalize; }
.calendar__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.calendar__dow { font-size: 10.5px; color: var(--text-3); text-align: center; padding: 4px 0; font-weight: 600; }
.calendar__day { height: 32px; border-radius: 8px; font-size: 12.5px; font-variant-numeric: tabular-nums; display: grid; place-items: center; color: var(--text); position: relative; }
.calendar__day:hover { background: var(--surface-hover); }
[data-theme="dark"] .calendar__day:hover { background: var(--surface-3); }
.calendar__day.is-out { color: var(--text-3); opacity: .5; }
.calendar__day.is-today { color: var(--accent-text); font-weight: 700; }
.calendar__day.is-selected { background: var(--accent) !important; color: var(--on-accent); }
.calendar__day.is-range { background: var(--accent-soft); border-radius: 0; }
.calendar__day.has-dot::after { content: ""; position: absolute; bottom: 4px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }

/* Steps (wizard) */
.steps { display: flex; gap: 6px; }
.step { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.step__bar { height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.step__bar::after { content: ""; display: block; height: 100%; width: 0; background: var(--accent); transition: width var(--dur-slow) var(--ease-out); }
.step.is-done .step__bar::after, .step.is-active .step__bar::after { width: 100%; }
.step__label { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 560; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step.is-active .step__label { color: var(--text); }
.step.is-done .step__label { color: var(--text-2); }
.step__num { width: 20px; height: 20px; border-radius: 50%; font-size: 11px; font-weight: 650; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex-shrink: 0; }
.step.is-active .step__num { background: var(--accent); color: var(--on-accent); }
.step.is-done .step__num { background: var(--success-soft); color: var(--success); }

/* Timeline verticale */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 1.5px; background: var(--border-strong); }
.timeline__item { position: relative; padding: 0 0 16px; }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item::before { content: ""; position: absolute; left: -20px; top: 4px; width: 11px; height: 11px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 2px var(--c, var(--text-3)); }
.timeline__item.is-now::before { background: var(--c, var(--live)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c, var(--live)) 25%, transparent); }
.timeline__item.is-past { opacity: .55; }

/* Command palette */
.cmdk { top: 12vh; width: min(620px, calc(100vw - 24px)); }
.cmdk__input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.cmdk__input input { flex: 1; border: 0; background: transparent; font-size: 15px; outline: none; }
.cmdk__list { max-height: 50vh; overflow-y: auto; padding: 6px; }
.cmdk__foot { display: flex; gap: 14px; padding: 9px 14px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-3); }

/* Spinner */
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--surface-3); border-top-color: var(--accent); animation: rm-spin .7s linear infinite; display: inline-block; }

/* Code */
.code { font-family: var(--font-mono); font-size: 12px; padding: 2px 6px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.code-block { font-family: var(--font-mono); font-size: 12px; padding: 12px 14px; border-radius: var(--r); background: var(--surface-sunken); border: 1px solid var(--border); overflow-x: auto; line-height: 1.6; color: var(--text-2); }

/* Copie */
.copy-field { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 4px 0 10px; border-radius: var(--r-sm); background: var(--surface-sunken); border: 1px solid var(--border); font-family: var(--font-mono); font-size: 12px; min-width: 0; }
.copy-field span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }

/* Live badge */
.live-badge { display: inline-flex; align-items: center; gap: 7px; height: 24px; padding: 0 10px 0 8px; border-radius: 6px; background: var(--live); color: #fff; font-size: 11px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; box-shadow: 0 4px 14px -4px var(--live); }
.live-badge .dot { background: #fff; animation: rm-pulse 1.4s var(--ease) infinite; }
.live-badge.is-off { background: var(--surface-3); color: var(--text-2); box-shadow: none; }
.live-badge.is-off .dot { background: var(--text-3); animation: none; }
.live-badge.is-maint { background: var(--warning); color: #1a1200; }
