/* ==========================================================================
   COMPOSANTS — boutons, champs, cartes, tableaux, badges, fenêtres…
   Chaque composant est autonome et réutilisable dans toutes les pages.
   ========================================================================== */

/* ---------- Boutons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-weight: 650; font-size: 13.5px; line-height: 1.2; white-space: nowrap;
  transition: background .18s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease), transform .08s, color .18s;
  box-shadow: var(--shadow-xs); text-decoration: none; user-select: none;
}
.btn .i { width: 17px; height: 17px; }
.btn:hover { background: var(--surface-2); border-color: var(--border-2); text-decoration: none; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn--primary {
  background: var(--grad-brand); border-color: transparent; color: var(--on-brand);
  box-shadow: var(--shadow-brand), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.btn--primary:hover { background: var(--grad-brand); border-color: transparent; filter: brightness(1.08) saturate(1.05); }
.btn--ghost  { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-2); border-color: transparent; color: var(--text); }
.btn--danger { color: var(--danger); }
.btn--danger:hover { background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger); }
.btn--solid-danger { background: var(--danger); border-color: var(--danger); color: #fff; box-shadow: 0 8px 20px -8px rgba(220, 38, 38, .6); }
.btn--solid-danger:hover { background: var(--danger); border-color: var(--danger); filter: brightness(.94); }
.btn--success { background: var(--success-bg); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); box-shadow: none; }
.btn--success:hover { background: var(--success-bg); border-color: var(--success); }
.btn--violet  { background: var(--violet-bg); color: var(--violet); border-color: color-mix(in srgb, var(--violet) 30%, transparent); box-shadow: none; }
.btn--violet:hover { background: var(--violet-bg); border-color: var(--violet); }
.btn--white { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .25); color: #fff; box-shadow: none; backdrop-filter: blur(6px); }
.btn--white:hover { background: rgba(255, 255, 255, .24); border-color: rgba(255, 255, 255, .4); color: #fff; }
.btn--sm { min-height: 32px; padding: 5px 11px; font-size: 12.5px; border-radius: var(--r-xs); gap: 6px; }
.btn--sm .i { width: 15px; height: 15px; }
.btn--lg { min-height: 48px; padding: 12px 22px; font-size: 15px; border-radius: var(--r-md); }
.btn--block { width: 100%; }

.icon-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center; flex: none;
  border: 1px solid transparent; border-radius: var(--r-sm); background: transparent; color: var(--text-2);
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn[disabled] { opacity: .35; pointer-events: none; }
.icon-btn .i { width: 20px; height: 20px; }
.icon-btn--sm { width: 32px; height: 32px; border-radius: var(--r-xs); }
.icon-btn--sm .i { width: 16px; height: 16px; }
.icon-btn.btn--danger:hover { background: var(--danger-bg); color: var(--danger); }

/* ---------- Avatars (initiales sur fond coloré) ---------- */
.avatar {
  --av: 230; width: 36px; height: 36px; border-radius: 12px; flex: none;
  display: inline-grid; place-items: center; font-weight: 800; font-size: 12.5px; letter-spacing: .02em;
  color: hsl(var(--av) 65% 38%); background: hsl(var(--av) 85% 93%);
}
:root[data-theme="dark"] .avatar { color: hsl(var(--av) 85% 78%); background: hsl(var(--av) 45% 22%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .avatar { color: hsl(var(--av) 85% 78%); background: hsl(var(--av) 45% 22%); } }
.avatar--sm { width: 28px; height: 28px; border-radius: 9px; font-size: 10.5px; }
.avatar--lg { width: 46px; height: 46px; border-radius: 15px; font-size: 15px; }
.sidebar .avatar { background: var(--grad-brand); color: #fff; }
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person > div { min-width: 0; }

/* ---------- Champs de formulaire ---------- */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field__label { font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.field__hint  { font-size: 11.5px; color: var(--text-3); }
.field__req   { color: var(--danger); }
.input, .select, .textarea {
  width: 100%; min-height: 42px; padding: 10px 13px;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-sm);
  color: var(--text); transition: border-color .15s, box-shadow .15s, background .15s;
}
.input:hover, .select:hover, .textarea:hover { border-color: color-mix(in srgb, var(--brand-500) 35%, var(--border-2)); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand-500);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-500) 16%, transparent);
}
.input--lg { min-height: 48px; font-size: 15px; border-radius: var(--r-md); }
.input--error, .input--error:hover { border-color: var(--danger); box-shadow: 0 0 0 4px var(--danger-bg); }
.textarea { min-height: 90px; resize: vertical; line-height: 1.55; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238b93a5' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 13.5px; cursor: pointer; min-height: 38px; }
.check input { width: 18px; height: 18px; accent-color: var(--brand-600); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-section {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; margin-top: 6px;
  font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--brand-600);
}
.form-section::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.form-section:first-child { margin-top: 0; }

.search { position: relative; display: flex; align-items: center; min-width: 0; }
.search .i { position: absolute; left: 13px; width: 17px; height: 17px; color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 40px; background: var(--surface-2); border-color: transparent; }
.search .input:focus { background: var(--surface); }

/* ---------- Cartes ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); min-width: 0;
}
.card + .card { margin-top: 18px; }
.card__head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.card__title { font-size: 15px; font-weight: 750; letter-spacing: -.01em; }
.card__title-icon { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-600); }
.card__title-icon .i { width: 17px; height: 17px; }
.card__sub { font-size: 12.5px; color: var(--text-3); }
.card__body { padding: 20px; }
.card__body--flush { padding: 0; }
.card--accent { border-left: 4px solid var(--brand-600); }
.card--hover { transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s; }
.card--hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-2); }

/* ---------- En-tête de page ---------- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-head h1 { font-size: 27px; font-weight: 800; letter-spacing: -.035em; line-height: 1.15; }
.page-head p { color: var(--text-2); font-size: 14px; margin-top: 5px; max-width: 640px; }
.page-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 960px) {
  .page-head { margin-bottom: 18px; }
  .page-head h1 { font-size: 23px; }
  .page-head p { font-size: 13px; }
  /* Sur mobile, le bouton principal est remplacé par le bouton flottant */
  .page-head__actions .btn--primary[data-action="add"], .page-head__actions .btn--primary[data-action="addCourse"] { display: none; }
}

.list-head { justify-content: space-between; gap: 12px; }
.list-head .search { flex: 1 1 260px; max-width: 380px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .search { flex: 1 1 240px; max-width: 380px; }
.toolbar .select { width: auto; min-width: 150px; }

/* ---------- Indicateurs chiffrés (KPI) ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi {
  --tone: var(--brand-600); --tone-bg: var(--brand-50);
  position: relative; overflow: hidden; display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 4px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 18px 20px; box-shadow: var(--shadow-sm);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi::after { /* touche de couleur discrète */
  content: ''; position: absolute; right: -30px; bottom: -40px; width: 120px; height: 120px; border-radius: 50%;
  background: var(--tone-bg); opacity: .7; pointer-events: none;
}
.kpi__icon {
  grid-column: 2; grid-row: 1 / span 2; position: relative; z-index: 1;
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  background: var(--tone-bg); color: var(--tone);
}
.kpi__icon .i { width: 20px; height: 20px; }
.kpi__label { grid-column: 1; grid-row: 1; font-size: 13px; color: var(--text-2); font-weight: 600; }
.kpi__value { grid-column: 1; grid-row: 2; font-size: 26px; font-weight: 800; letter-spacing: -.035em; line-height: 1.15; font-variant-numeric: tabular-nums; position: relative; z-index: 1; }
.kpi--success { --tone: var(--success); --tone-bg: var(--success-bg); }
.kpi--warning { --tone: var(--warning); --tone-bg: var(--warning-bg); }
.kpi--violet  { --tone: var(--violet);  --tone-bg: var(--violet-bg); }
.kpi--danger  { --tone: var(--danger);  --tone-bg: var(--danger-bg); }
.kpi--sky     { --tone: var(--sky);     --tone-bg: var(--sky-bg); }
@media (max-width: 480px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; grid-template-columns: 1fr; }
  .kpi__icon { grid-column: 1; grid-row: 1; width: 34px; height: 34px; border-radius: 11px; margin-bottom: 8px; }
  .kpi__label { grid-row: 3; font-size: 12px; }
  .kpi__value { grid-row: 2; font-size: 19px; }
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 700; line-height: 1.5; white-space: nowrap;
  background: var(--neutral-bg); color: var(--neutral);
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge--plain::before { display: none; }
.badge--info    { background: var(--info-bg);    color: var(--info); }
.badge--success { background: var(--success-bg); color: var(--success); }
.badge--warning { background: var(--warning-bg); color: var(--warning); }
.badge--danger  { background: var(--danger-bg);  color: var(--danger); }
.badge--violet  { background: var(--violet-bg);  color: var(--violet); }
.badge--sky     { background: var(--sky-bg);     color: var(--sky); }

/* ---------- Tableaux (deviennent des cartes quand la place manque) ---------- */
.table-wrap { overflow-x: auto; container-type: inline-size; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th {
  padding: 11px 16px; text-align: left; white-space: nowrap;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3);
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; transition: background .12s; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--brand-50) 45%, transparent); }
.table .cell-main { font-weight: 700; }
.table .cell-sub  { font-size: 12px; color: var(--text-3); }
.table .actions   { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: nowrap; align-items: center; }
.table th.right, .table td.right { text-align: right; }

/* Version « cartes » : c'est la largeur réelle du tableau (container query) qui décide. */
@container (max-width: 960px) {
  .table--cards thead { display: none; }
  .table--cards, .table--cards tbody, .table--cards tr, .table--cards td { display: block; width: 100%; }
  .table--cards tr { padding: 16px 18px; border-bottom: 1px solid var(--border); position: relative; }
  .table--cards tbody tr:last-child { border-bottom: 0; }
  .table--cards tbody tr:hover td { background: transparent; }
  .table--cards td { padding: 5px 0; border: 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 14px; align-items: center; text-align: right; }
  .table--cards td::before {
    content: attr(data-label); flex: none; font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; color: var(--text-3); text-align: left;
  }
  .table--cards .cell-body { min-width: 0; max-width: 100%; margin-left: auto; }
  .table--cards td.cell-title { display: block; text-align: left; padding-bottom: 10px; }
  .table--cards td.cell-title::before { display: none; }
  .table--cards td.cell-title .cell-body { margin-left: 0; }
  .table--cards td.cell-actions { padding-top: 12px; margin-top: 8px; border-top: 1px dashed var(--border); }
  .table--cards td.cell-actions::before { display: none; }
  .table--cards td.cell-actions .cell-body { width: 100%; }
  .table--cards td.cell-actions .actions { justify-content: flex-start; flex-wrap: wrap; width: 100%; }
}

/* ---------- Barre de progression ---------- */
.progress { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--grad-brand); transition: width .5s var(--ease); }
.progress--success > span { background: linear-gradient(90deg, #10b981, #34d399); }
.progress--warning > span { background: linear-gradient(90deg, #f59e0b, #fbbf24); }

/* ---------- Message d'état vide ---------- */
.empty { text-align: center; padding: 44px 20px; color: var(--text-3); }
.empty__icon {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 20px; display: grid; place-items: center;
  background: var(--grad-soft); color: var(--brand-600); position: relative;
}
.empty__icon::after { content: ''; position: absolute; inset: -8px; border-radius: 26px; border: 1px dashed var(--border-2); }
.empty__icon .i { width: 28px; height: 28px; }
.empty strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.empty p { font-size: 13px; max-width: 340px; margin: 0 auto; }

/* ---------- Squelette de chargement ---------- */
.skeleton { border-radius: var(--r-sm); background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Alertes ---------- */
.alert { padding: 12px 15px; border-radius: var(--r-md); font-size: 13.5px; background: var(--info-bg); color: var(--info); display: flex; gap: 11px; align-items: flex-start; border: 1px solid color-mix(in srgb, currentColor 18%, transparent); }
.alert--danger  { background: var(--danger-bg);  color: var(--danger); }
.alert--warning { background: var(--warning-bg); color: var(--warning); }
.alert--success { background: var(--success-bg); color: var(--success); }
.alert > .i { margin-top: 1px; width: 18px; height: 18px; }

/* ---------- Fenêtres modales (bottom-sheet sur mobile) ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(8, 11, 26, .5); backdrop-filter: blur(6px);
  animation: fade .18s var(--ease);
}
.modal {
  width: 100%; max-width: 640px; max-height: calc(100dvh - 48px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  animation: pop .26s var(--ease);
}
.modal--wide { max-width: 880px; }
.modal--sm { max-width: 460px; }
.modal__head { display: flex; align-items: center; gap: 14px; padding: 20px 22px 16px; }
.modal__icon {
  width: 42px; height: 42px; flex: none; border-radius: 13px; display: grid; place-items: center;
  background: var(--grad-brand); color: #fff; box-shadow: var(--shadow-brand);
}
.modal__icon .i { width: 20px; height: 20px; }
.modal__title { font-size: 18px; font-weight: 800; letter-spacing: -.025em; flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.modal__body { padding: 6px 22px 22px; overflow-y: auto; flex: 1; }
.modal__foot {
  display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap;
  padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2);
}
.modal__foot .spacer { margin-right: auto; display: flex; gap: 8px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop  { from { opacity: 0; transform: translateY(14px) scale(.97); } }

@media (max-width: 720px) {
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    max-width: none; max-height: 94dvh; border-radius: var(--r-xl) var(--r-xl) 0 0; border-bottom: 0;
    animation: sheet .32s var(--ease);
  }
  .modal::before { /* poignée */
    content: ''; display: block; width: 42px; height: 5px; border-radius: 9px; background: var(--border-2); margin: 9px auto 0;
  }
  .modal__head { padding-top: 12px; }
  .modal__foot { padding-bottom: calc(14px + var(--safe-bottom)); }
  .modal__foot .btn { flex: 1 1 auto; }
  .form-grid { grid-template-columns: 1fr; }
  /* 16px minimum : empêche le zoom automatique d'iOS dans les champs */
  .input, .select, .textarea { font-size: 16px; }
}
@keyframes sheet { from { transform: translateY(60px); opacity: .5; } }

/* ---------- Menu déroulant d'actions ---------- */
.menu__panel {
  position: fixed; z-index: 70; min-width: 230px; max-width: calc(100vw - 20px); padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); animation: pop .16s var(--ease);
}
.menu__item {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 11px; border: 0; border-radius: var(--r-xs);
  background: transparent; text-align: left; font-weight: 600; font-size: 13.5px; color: var(--text);
}
.menu__item:hover { background: var(--surface-2); }
.menu__item .i { color: var(--text-3); width: 17px; height: 17px; }
.menu__item:hover .i { color: var(--brand-600); }
.menu__item--danger, .menu__item--danger .i, .menu__item--danger:hover .i { color: var(--danger); }
.menu__item--danger:hover { background: var(--danger-bg); }
.menu__sep { height: 1px; background: var(--border); margin: 5px 4px; }

/* ---------- Notifications (toasts) ---------- */
.toast-root {
  position: fixed; z-index: 120; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px;
  max-width: min(400px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; gap: 12px; align-items: center; padding: 12px 16px 12px 12px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  font-size: 13.5px; font-weight: 600; animation: toast-in .3s var(--ease);
}
.toast .i { width: 32px; height: 32px; padding: 7px; border-radius: 10px; flex: none; background: var(--success-bg); color: var(--success); }
.toast--error .i { background: var(--danger-bg); color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.96); } }
@media (max-width: 960px) {
  .toast-root { left: 14px; right: 14px; bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 14px); max-width: none; }
}

/* ---------- Pastilles de filtre (segmented) ---------- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface);
  font-size: 12.5px; font-weight: 650; color: var(--text-2); transition: all .15s var(--ease);
}
.chip b { font-size: 11px; padding: 0 6px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); }
.chip:hover { border-color: var(--border-2); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--surface); }
.chip[aria-pressed="true"] b { background: color-mix(in srgb, var(--surface) 22%, transparent); color: var(--surface); }
@media (max-width: 720px) { .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -2px; padding: 2px; } .chip { flex: none; } }

/* ---------- Zone de dépôt de fichiers ---------- */
.dropzone-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 5px; text-align: center;
  padding: 18px 8px; border: 1.5px dashed var(--border-2); border-radius: var(--r-md); background: var(--surface-2);
  color: var(--text); font-size: 13px; font-weight: 700; transition: border-color .15s, background .15s, transform .15s;
}
.dropzone:hover { border-color: var(--brand-500); background: var(--brand-50); transform: translateY(-1px); }
.dropzone small { font-weight: 500; color: var(--text-3); font-size: 11.5px; }
.dropzone .i { width: 26px; height: 26px; color: var(--brand-600); }
@media (max-width: 480px) { .dropzone-grid { grid-template-columns: 1fr; } .dropzone { flex-direction: row; justify-content: flex-start; text-align: left; padding: 13px 15px; gap: 12px; } }

.file-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); transition: border-color .15s, box-shadow .15s;
}
.file-row:hover { border-color: var(--border-2); box-shadow: var(--shadow-sm); }
.file-row__type { min-width: 42px; height: 42px; display: grid; place-items: center; border-radius: 11px; font-size: 10.5px; font-weight: 800; background: var(--info-bg); color: var(--info); }
.file-row__type--img { background: var(--warning-bg); color: var(--warning); }
.file-row__name { font-weight: 700; font-size: 13.5px; }
.file-row__meta { font-size: 12px; color: var(--text-3); }
.file-row__thumb { width: 42px; height: 42px; border-radius: 11px; object-fit: cover; border: 1px solid var(--border); }

/* ---------- Aperçu / impression de document (plein écran) ---------- */
.doc-viewer { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; background: var(--bg); animation: fade .18s; }
.doc-viewer__bar {
  display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--safe-top)) 16px 10px;
  background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.doc-viewer__title { font-weight: 750; flex: 1; min-width: 0; }
.doc-viewer__frame { flex: 1; width: 100%; border: 0; background: #e5e8f0; }

/* ---------- Scanner (caméra) ---------- */
.scanner { margin-top: 12px; border-radius: var(--r-md); overflow: hidden; background: #000; position: relative; }
.scanner video { width: 100%; max-height: 320px; display: block; }
.scanner__frame { position: absolute; inset: 12% 10%; border: 2px solid rgba(165, 180, 252, .95); border-radius: 10px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .45); pointer-events: none; }
.scanner__bar { position: absolute; left: 0; right: 0; bottom: 12px; display: flex; justify-content: center; gap: 10px; }

/* ---------- Palette de recherche globale (Ctrl+K) ---------- */
.palette-overlay {
  position: fixed; inset: 0; z-index: 90; display: flex; justify-content: center; align-items: flex-start;
  padding: 12vh 16px 16px; background: rgba(8, 11, 26, .5); backdrop-filter: blur(6px); animation: fade .15s;
}
.palette {
  width: 100%; max-width: 620px; max-height: 70vh; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
  animation: pop .2s var(--ease);
}
.palette__input { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.palette__input .i { width: 20px; height: 20px; color: var(--brand-600); }
.palette__input input { flex: 1; border: 0; outline: none; background: transparent; font-size: 16px; color: var(--text); }
.palette__list { overflow-y: auto; padding: 8px; }
.palette__group { padding: 10px 10px 6px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.palette__item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border: 0; border-radius: var(--r-sm);
  background: transparent; text-align: left; color: var(--text);
}
.palette__item small { display: block; color: var(--text-3); font-size: 12px; }
.palette__item .palette__ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex: none; }
.palette__item .palette__ico .i { width: 17px; height: 17px; }
.palette__item[aria-selected="true"] { background: var(--brand-50); }
.palette__item[aria-selected="true"] .palette__ico { background: var(--grad-brand); color: #fff; }
.palette__item .palette__go { margin-left: auto; color: var(--text-3); font-size: 12px; opacity: 0; }
.palette__item[aria-selected="true"] .palette__go { opacity: 1; }
.palette__foot { display: flex; gap: 14px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-3); background: var(--surface-2); }
@media (max-width: 720px) { .palette-overlay { padding: calc(10px + var(--safe-top)) 10px 10px; } .palette { max-height: 80vh; } .palette__foot { display: none; } }
