/* ═══════════════════════════════════════════════════════════════════════════
   FLAIR UI 1.0 — Premium Component Library
   Requires: flair-v9.css + flair-ui.css
   Adds: buttons, cards, modals, toasts, timeline, progress, chips,
         AI elements, empty states, data tables enhanced, forms enhanced.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  border-radius: var(--r);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--trans-base);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  letter-spacing: .01em;
}

/* Ripple effect */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255,255,255,.15) 0%, transparent 70%);
  opacity: 0;
  transition: opacity var(--trans-fast);
}
.btn:active::after { opacity: 1; transform: scale(1.5); }

/* Primary */
.btn-primary {
  background: linear-gradient(135deg, var(--violet), #5b21b6);
  color: #fff;
  border-color: rgba(124,58,237,.4);
  box-shadow: 0 2px 10px rgba(124,58,237,.25);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #8b5cf6, var(--violet));
  box-shadow: var(--glow-violet);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

/* Secondary */
.btn-secondary {
  background: var(--ui-input-bg);
  color: var(--ui-t1);
  border-color: var(--ui-border);
}
.btn-secondary:hover {
  border-color: var(--violet);
  color: #c4b5fd;
  background: rgba(124,58,237,.08);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--ui-t2);
  border-color: transparent;
}
.btn-ghost:hover {
  background: rgba(255,255,255,.05);
  color: var(--ui-t1);
}

/* Danger */
.btn-danger {
  background: linear-gradient(135deg, var(--red), #b91c1c);
  color: #fff;
  border-color: rgba(239,68,68,.4);
  box-shadow: 0 2px 10px rgba(239,68,68,.2);
}
.btn-danger:hover {
  box-shadow: var(--glow-pink);
  transform: translateY(-1px);
}

/* Success */
.btn-success {
  background: linear-gradient(135deg, var(--green), #047857);
  color: #fff;
  border-color: rgba(16,185,129,.4);
  box-shadow: 0 2px 10px rgba(16,185,129,.2);
}
.btn-success:hover { box-shadow: var(--glow-green); transform: translateY(-1px); }

/* Cyan */
.btn-cyan {
  background: linear-gradient(135deg, var(--cyan), #0e7490);
  color: #fff;
  border-color: rgba(6,182,212,.4);
  box-shadow: 0 2px 10px rgba(6,182,212,.2);
}
.btn-cyan:hover { box-shadow: var(--glow-cyan); transform: translateY(-1px); }

/* Sizes */
.btn-xs { padding: 4px 10px; font-size: .7rem; border-radius: 6px; }
.btn-sm { padding: 6px 14px; font-size: .78rem; }
.btn-lg { padding: 11px 24px; font-size: .95rem; }
.btn-xl { padding: 14px 32px; font-size: 1rem; letter-spacing: .02em; }
.btn-icon { padding: 8px; width: 34px; height: 34px; justify-content: center; }
.btn-icon-sm { padding: 6px; width: 28px; height: 28px; justify-content: center; }

/* Disabled */
.btn:disabled, .btn[disabled] {
  opacity: .4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Loading state */
.btn.loading { pointer-events: none; }
.btn.loading .btn-text { opacity: 0; }
.btn.loading::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* Action bar */
.action-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-5);
}
.action-bar .action-bar-right { margin-left: auto; display: flex; gap: var(--sp-2); align-items: center; }

/* ══════════════════════════════════════════════════════════
   BADGES & CHIPS
   ══════════════════════════════════════════════════════════ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-violet  { background: rgba(124,58,237,.18); color: #c4b5fd; border: 1px solid rgba(124,58,237,.35); }
.badge-cyan    { background: rgba(6,182,212,.15);  color: #67e8f9; border: 1px solid rgba(6,182,212,.3);  }
.badge-green   { background: rgba(16,185,129,.15); color: #6ee7b7; border: 1px solid rgba(16,185,129,.3); }
.badge-amber   { background: rgba(245,158,11,.15); color: #fcd34d; border: 1px solid rgba(245,158,11,.3); }
.badge-red     { background: rgba(239,68,68,.15);  color: #fca5a5; border: 1px solid rgba(239,68,68,.3);  }
.badge-pink    { background: rgba(236,72,153,.15); color: #f9a8d4; border: 1px solid rgba(236,72,153,.3); }
.badge-gray    { background: rgba(148,163,184,.1); color: #94a3b8; border: 1px solid rgba(148,163,184,.2);}

/* Severity badges */
.badge-critique { background: rgba(239,68,68,.2);  color: #fca5a5; border: 1px solid var(--red);   }
.badge-haute    { background: rgba(245,158,11,.18); color: #fcd34d; border: 1px solid var(--amber); }
.badge-moyenne  { background: rgba(99,102,241,.18); color: #a5b4fc; border: 1px solid var(--indigo);}
.badge-basse    { background: rgba(16,185,129,.15); color: #6ee7b7; border: 1px solid var(--green); }

/* Status dots */
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .78rem;
  color: var(--ui-t2);
}
.status-dot::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.status-dot.online  { color: var(--green); }
.status-dot.warning { color: var(--amber); }
.status-dot.offline { color: var(--red);   }
.status-dot.idle    { color: var(--ui-t3); }
.status-dot.online::before  { box-shadow: 0 0 6px var(--green); animation: pulse-dot 2s infinite; }

/* Chips (selectable) */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 99px;
  font-size: .78rem;
  font-weight: 500;
  border: 1px solid var(--ui-border);
  background: var(--ui-input-bg);
  color: var(--ui-t2);
  cursor: pointer;
  transition: all var(--trans-fast);
  white-space: nowrap;
}
.chip:hover   { border-color: var(--violet); color: #c4b5fd; background: rgba(124,58,237,.08); }
.chip.active  { border-color: var(--violet); color: #c4b5fd; background: rgba(124,58,237,.18); }
.chip .chip-remove { margin-left: 2px; opacity: .6; font-size: .9em; }
.chip .chip-remove:hover { opacity: 1; }

/* ══════════════════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════════════════ */

.card {
  background: var(--ui-glass);
  backdrop-filter: blur(18px);
  border: 1px solid var(--ui-border);
  border-radius: var(--rl);
  overflow: hidden;
  transition: border-color var(--trans-base), box-shadow var(--trans-base), transform var(--trans-base);
}
.card:hover {
  border-color: rgba(124,58,237,.32);
  box-shadow: var(--elev-3);
}
.card-hover:hover { transform: translateY(-3px); }

.card-header {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--ui-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}
.card-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--ui-t1);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.card-body   { padding: var(--sp-5); }
.card-footer {
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--ui-border);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: rgba(255,255,255,.02);
}

/* Stat card */
.stat-card {
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--stat-accent, linear-gradient(90deg, var(--violet), var(--cyan)));
}
.stat-card .stat-icon {
  font-size: 1.5rem;
  margin-bottom: var(--sp-3);
  opacity: .9;
}
.stat-card .stat-value {
  font-size: var(--text-2xl);
  font-weight: 900;
  line-height: 1;
  margin-bottom: 4px;
  background: var(--stat-accent, linear-gradient(135deg, var(--violet), var(--cyan)));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.stat-card .stat-label { font-size: var(--text-xs); color: var(--ui-t2); font-weight: 500; }
.stat-card .stat-trend {
  font-size: var(--text-xs);
  margin-top: var(--sp-2);
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat-card .stat-trend.up   { color: var(--green); }
.stat-card .stat-trend.down { color: var(--red);   }

/* ══════════════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════════════ */

.form-group { margin-bottom: var(--sp-4); }

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ui-t2);
  margin-bottom: var(--sp-2);
  letter-spacing: .02em;
}
.form-label .required { color: var(--red); margin-left: 3px; }

.form-control {
  width: 100%;
  padding: 9px 14px;
  background: var(--ui-input-bg);
  border: 1px solid var(--ui-border);
  border-radius: var(--r);
  color: var(--ui-t1);
  font-size: var(--text-base);
  font-family: inherit;
  transition: border-color var(--trans-fast), box-shadow var(--trans-fast);
  outline: none;
}
.form-control::placeholder { color: var(--ui-t3); }
.form-control:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(124,58,237,.15);
}
.form-control:disabled { opacity: .5; cursor: not-allowed; }
.form-control.error    { border-color: var(--red); box-shadow: 0 0 0 3px rgba(239,68,68,.12); }
.form-control.success  { border-color: var(--green); }

.form-hint  { font-size: var(--text-xs); color: var(--ui-t3); margin-top: 5px; }
.form-error { font-size: var(--text-xs); color: var(--red);   margin-top: 5px; display: flex; align-items: center; gap: 4px; }

/* Input with icon */
.form-input-wrap { position: relative; }
.form-input-wrap .form-control { padding-left: 36px; }
.form-input-wrap .input-icon {
  position: absolute; left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--ui-t3);
  pointer-events: none;
  font-size: .9rem;
}
.form-input-wrap .input-action {
  position: absolute; right: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--ui-t3);
  cursor: pointer;
  font-size: .85rem;
  padding: 2px;
  border-radius: 4px;
  transition: color var(--trans-fast);
}
.form-input-wrap .input-action:hover { color: var(--ui-t1); }

/* Select */
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* Toggle switch */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  cursor: pointer;
}
.toggle {
  position: relative;
  width: 40px; height: 22px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; inset: 0;
  background: rgba(255,255,255,.1);
  border-radius: 99px;
  border: 1px solid var(--ui-border);
  transition: background var(--trans-base), border-color var(--trans-base);
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--ui-t3);
  transition: transform var(--trans-spring), background var(--trans-base);
}
.toggle input:checked + .toggle-track {
  background: rgba(124,58,237,.4);
  border-color: var(--violet);
}
.toggle input:checked + .toggle-track::after {
  transform: translateX(18px);
  background: var(--violet);
}

/* ══════════════════════════════════════════════════════════
   DATA TABLES (enhanced)
   ══════════════════════════════════════════════════════════ */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--rl);
  border: 1px solid var(--ui-border);
}
.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.table-wrap thead th {
  padding: 11px 14px;
  background: rgba(255,255,255,.025);
  color: var(--ui-t2);
  font-weight: 600;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  text-align: left;
  border-bottom: 1px solid var(--ui-border);
  white-space: nowrap;
  cursor: default;
}
.table-wrap thead th.sortable { cursor: pointer; user-select: none; }
.table-wrap thead th.sortable:hover { color: var(--ui-t1); }
.table-wrap thead th.sorted { color: var(--violet); }

.table-wrap tbody tr {
  border-bottom: 1px solid rgba(108,99,255,.07);
  transition: background var(--trans-fast);
}
.table-wrap tbody tr:last-child { border-bottom: none; }
.table-wrap tbody tr:hover { background: rgba(124,58,237,.05); }
.table-wrap tbody td {
  padding: 11px 14px;
  color: var(--ui-t1);
  vertical-align: middle;
}

/* Table empty state */
.table-empty {
  text-align: center;
  padding: var(--sp-12) var(--sp-6);
  color: var(--ui-t3);
}
.table-empty .table-empty-icon { font-size: 2.5rem; margin-bottom: var(--sp-3); opacity: .5; }
.table-empty .table-empty-text { font-size: var(--text-base); }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--ui-border);
  font-size: var(--text-sm);
  color: var(--ui-t2);
}
.pagination-btns { display: flex; gap: var(--sp-1); }
.pagination-btns button {
  width: 30px; height: 30px;
  border-radius: 6px;
  border: 1px solid var(--ui-border);
  background: transparent;
  color: var(--ui-t2);
  cursor: pointer;
  font-size: .8rem;
  transition: all var(--trans-fast);
}
.pagination-btns button:hover    { border-color: var(--violet); color: #c4b5fd; }
.pagination-btns button.active   { background: rgba(124,58,237,.2); border-color: var(--violet); color: #c4b5fd; }
.pagination-btns button:disabled { opacity: .3; cursor: not-allowed; }

/* ══════════════════════════════════════════════════════════
   MODALS
   ══════════════════════════════════════════════════════════ */

.modal-overlay {
  position: fixed; inset: 0;
  background: var(--ui-overlay);
  backdrop-filter: blur(4px);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--trans-base);
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--ui-surface);
  border: 1px solid var(--ui-border2);
  border-radius: var(--rx);
  box-shadow: var(--elev-float);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(.95) translateY(10px);
  transition: transform var(--trans-spring);
}
.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}

.modal-lg  { max-width: 720px; }
.modal-xl  { max-width: 960px; }
.modal-full { max-width: 95vw; max-height: 95vh; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--ui-border);
}
.modal-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--ui-t1);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.modal-close {
  width: 30px; height: 30px;
  border-radius: 6px;
  border: 1px solid var(--ui-border);
  background: transparent;
  color: var(--ui-t2);
  cursor: pointer;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--trans-fast);
  flex-shrink: 0;
}
.modal-close:hover { border-color: var(--red); color: var(--red); }

.modal-body   { padding: var(--sp-6); }
.modal-footer {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--ui-border);
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
  background: rgba(255,255,255,.02);
}

/* ══════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ══════════════════════════════════════════════════════════ */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  max-width: 360px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--rl);
  border-left: 3px solid transparent;
  background: var(--ui-surface);
  box-shadow: var(--elev-3);
  pointer-events: auto;
  animation: toastSlideIn .3s var(--trans-spring) both;
}
.toast.removing { animation: toastSlideOut .25s ease both; }

.toast-success { border-left-color: var(--green); background: var(--status-success-bg); }
.toast-warning { border-left-color: var(--amber); background: var(--status-warning-bg); }
.toast-error   { border-left-color: var(--red);   background: var(--status-error-bg);   }
.toast-info    { border-left-color: var(--indigo); background: var(--status-info-bg);    }

.toast-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.toast-content { flex: 1; min-width: 0; }
.toast-title   { font-size: var(--text-sm); font-weight: 700; color: var(--ui-t1); }
.toast-message { font-size: var(--text-xs); color: var(--ui-t2); margin-top: 2px; line-height: 1.4; }
.toast-close {
  background: none; border: none; cursor: pointer;
  color: var(--ui-t3); font-size: .9rem;
  padding: 2px; border-radius: 4px;
  flex-shrink: 0;
  transition: color var(--trans-fast);
}
.toast-close:hover { color: var(--ui-t1); }

/* ══════════════════════════════════════════════════════════
   TIMELINE
   ══════════════════════════════════════════════════════════ */

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline-item {
  position: relative;
  padding-left: 36px;
  padding-bottom: var(--sp-5);
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: 11px; top: 24px; bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, var(--ui-border2), transparent);
}
.timeline-item:last-child::before { display: none; }

.timeline-dot {
  position: absolute;
  left: 4px; top: 4px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--ui-surface);
  border: 2px solid var(--ui-border2);
  display: flex; align-items: center; justify-content: center;
  font-size: .55rem;
  z-index: 1;
}
.timeline-dot.violet { border-color: var(--violet); background: rgba(124,58,237,.2); }
.timeline-dot.green  { border-color: var(--green);  background: rgba(16,185,129,.2); }
.timeline-dot.amber  { border-color: var(--amber);  background: rgba(245,158,11,.2); }
.timeline-dot.red    { border-color: var(--red);    background: rgba(239,68,68,.2);  }
.timeline-dot.cyan   { border-color: var(--cyan);   background: rgba(6,182,212,.2);  }
.timeline-dot.pulse::after {
  content: '';
  position: absolute; inset: -3px;
  border-radius: 50%;
  border: 1px solid var(--violet);
  animation: pulse-ring 2s infinite;
}

.timeline-content { }
.timeline-time    { font-size: .68rem; color: var(--ui-t3); margin-bottom: 3px; }
.timeline-title   { font-size: var(--text-sm); font-weight: 600; color: var(--ui-t1); }
.timeline-text    { font-size: var(--text-xs); color: var(--ui-t2); margin-top: 3px; line-height: 1.5; }

/* ══════════════════════════════════════════════════════════
   PROGRESS
   ══════════════════════════════════════════════════════════ */

.progress-wrap { }
.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.progress-label { font-size: var(--text-xs); color: var(--ui-t2); font-weight: 500; }
.progress-value { font-size: var(--text-xs); font-weight: 700; color: var(--ui-t1); }

.progress-bar {
  height: 6px;
  background: rgba(255,255,255,.07);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  transition: width .6s cubic-bezier(.4,0,.2,1);
  position: relative;
  overflow: hidden;
}
.progress-bar-fill::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.2) 50%, transparent 100%);
  animation: shimmer 2s infinite;
  background-size: 200% 100%;
}

.progress-bar.lg { height: 10px; }
.progress-bar.sm { height: 4px; }
.progress-bar-fill.green  { background: linear-gradient(90deg, var(--green), #34d399); }
.progress-bar-fill.amber  { background: linear-gradient(90deg, var(--amber), #fbbf24); }
.progress-bar-fill.red    { background: linear-gradient(90deg, var(--red),   #f87171); }
.progress-bar-fill.cyan   { background: linear-gradient(90deg, var(--cyan),  #22d3ee); }

/* ══════════════════════════════════════════════════════════
   LOADERS
   ══════════════════════════════════════════════════════════ */

.loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-8);
}
.loader-ring {
  width: 36px; height: 36px;
  border: 3px solid rgba(124,58,237,.2);
  border-top-color: var(--violet);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.loader-ring.sm { width: 20px; height: 20px; border-width: 2px; }
.loader-ring.lg { width: 52px; height: 52px; border-width: 4px; }

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,.05) 25%, rgba(255,255,255,.1) 50%, rgba(255,255,255,.05) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
.skeleton-text  { height: 12px; margin-bottom: 8px; }
.skeleton-title { height: 20px; margin-bottom: 12px; width: 60%; }
.skeleton-card  { height: 120px; border-radius: var(--rl); }

/* Dots loader */
.dots-loader {
  display: flex;
  gap: 5px;
  align-items: center;
}
.dots-loader span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--violet);
  animation: bounce-dot .8s infinite;
}
.dots-loader span:nth-child(2) { animation-delay: .15s; }
.dots-loader span:nth-child(3) { animation-delay: .30s; }

/* ══════════════════════════════════════════════════════════
   EMPTY STATES
   ══════════════════════════════════════════════════════════ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-12) var(--sp-6);
  text-align: center;
}
.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--sp-4);
  opacity: .4;
  filter: grayscale(.5);
}
.empty-state-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--ui-t1);
  margin-bottom: var(--sp-2);
}
.empty-state-text {
  font-size: var(--text-sm);
  color: var(--ui-t2);
  max-width: 320px;
  line-height: 1.6;
  margin-bottom: var(--sp-5);
}

/* ══════════════════════════════════════════════════════════
   AI ELEMENTS
   ══════════════════════════════════════════════════════════ */

/* AI response block */
.ai-block {
  background: var(--ai-surface);
  border: 1px solid var(--ai-border);
  border-radius: var(--rl);
  padding: var(--sp-4);
  position: relative;
  overflow: hidden;
}
.ai-block::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--violet), var(--cyan), transparent);
  opacity: .6;
}
.ai-block-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
  font-size: var(--text-xs);
  color: var(--ai-text);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.ai-block-header .ai-avatar {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--violet), var(--cyan));
  display: flex; align-items: center; justify-content: center;
  font-size: .55rem;
  color: #fff;
  flex-shrink: 0;
}
.ai-block-content {
  font-size: var(--text-sm);
  color: var(--ui-t1);
  line-height: 1.65;
}

/* AI typing indicator */
.ai-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: var(--ai-surface);
  border: 1px solid var(--ai-border);
  border-radius: 99px;
  font-size: var(--text-xs);
  color: var(--ai-text);
}
.ai-typing-dots {
  display: flex;
  gap: 3px;
}
.ai-typing-dots span {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--violet);
  animation: bounce-dot .8s infinite;
}
.ai-typing-dots span:nth-child(2) { animation-delay: .15s; }
.ai-typing-dots span:nth-child(3) { animation-delay: .30s; }

/* AI suggestion chips */
.ai-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}
.ai-suggestion-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 99px;
  font-size: .75rem;
  border: 1px solid var(--ai-border);
  background: var(--ai-surface);
  color: var(--ai-text);
  cursor: pointer;
  transition: all var(--trans-fast);
}
.ai-suggestion-chip:hover {
  background: rgba(124,58,237,.2);
  border-color: var(--violet);
  color: #e9d5ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(124,58,237,.2);
}

/* AI pulse border (animated ring) */
.ai-pulse-ring {
  position: relative;
}
.ai-pulse-ring::after {
  content: '';
  position: absolute; inset: -2px;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--violet), var(--cyan), var(--pink));
  z-index: -1;
  opacity: 0;
  transition: opacity var(--trans-slow);
  animation: ai-border-pulse 3s infinite;
}
.ai-pulse-ring:hover::after,
.ai-pulse-ring.active::after { opacity: .6; }

/* Inline AI field suggestion */
.form-ai-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  margin-top: 5px;
  background: var(--ai-surface);
  border: 1px solid var(--ai-border);
  border-radius: 6px;
  font-size: var(--text-xs);
  color: var(--ai-text);
  cursor: pointer;
  transition: all var(--trans-fast);
  animation: fadeUp .2s ease;
}
.form-ai-hint:hover {
  background: rgba(124,58,237,.15);
  border-color: var(--violet);
}
.form-ai-hint .ai-hint-icon { font-size: .85rem; }
.form-ai-hint .ai-hint-apply {
  margin-left: auto;
  font-size: .68rem;
  font-weight: 700;
  color: var(--violet);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ══════════════════════════════════════════════════════════
   THEME SWITCHER
   ══════════════════════════════════════════════════════════ */

.theme-switcher {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 5px;
  background: var(--ui-input-bg);
  border: 1px solid var(--ui-border);
  border-radius: 99px;
}
.theme-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ui-t3);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
  transition: all var(--trans-fast);
}
.theme-btn:hover   { color: var(--ui-t1); background: rgba(255,255,255,.05); }
.theme-btn.active  { color: var(--violet); border-color: var(--violet); background: rgba(124,58,237,.12); }

/* ══════════════════════════════════════════════════════════
   ALERTS / CALLOUTS
   ══════════════════════════════════════════════════════════ */

.alert {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r);
  border-left: 3px solid transparent;
  font-size: var(--text-sm);
}
.alert-icon    { flex-shrink: 0; font-size: 1rem; margin-top: 1px; }
.alert-content { flex: 1; }
.alert-title   { font-weight: 700; margin-bottom: 2px; }
.alert-text    { color: var(--ui-t2); line-height: 1.5; }

.alert-success { background: var(--status-success-bg); border-left-color: var(--green); }
.alert-success .alert-title { color: var(--green); }
.alert-warning { background: var(--status-warning-bg); border-left-color: var(--amber); }
.alert-warning .alert-title { color: var(--amber); }
.alert-error   { background: var(--status-error-bg);   border-left-color: var(--red);   }
.alert-error   .alert-title { color: var(--red);   }
.alert-info    { background: var(--status-info-bg);    border-left-color: var(--indigo); }
.alert-info    .alert-title { color: #a5b4fc; }

/* ══════════════════════════════════════════════════════════
   DROPDOWN MENU
   ══════════════════════════════════════════════════════════ */

.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-border2);
  border-radius: var(--rl);
  box-shadow: var(--elev-4);
  z-index: 300;
  overflow: hidden;
  opacity: 0;
  transform: scale(.95) translateY(-6px);
  pointer-events: none;
  transition: opacity var(--trans-fast), transform var(--trans-fast);
}
.dropdown.open .dropdown-menu {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 9px var(--sp-4);
  font-size: var(--text-sm);
  color: var(--ui-t1);
  cursor: pointer;
  transition: background var(--trans-fast);
}
.dropdown-item:hover  { background: rgba(124,58,237,.08); }
.dropdown-item.danger { color: var(--red); }
.dropdown-item.danger:hover { background: rgba(239,68,68,.08); }
.dropdown-divider { height: 1px; background: var(--ui-border); margin: 4px 0; }
.dropdown-header {
  padding: 6px var(--sp-4) 4px;
  font-size: var(--text-xs);
  color: var(--ui-t3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
}

/* ══════════════════════════════════════════════════════════
   AVATAR
   ══════════════════════════════════════════════════════════ */

.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--violet), var(--cyan));
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  position: relative;
}
.avatar.sm { width: 26px; height: 26px; font-size: .65rem; }
.avatar.lg { width: 48px; height: 48px; font-size: 1rem; }
.avatar.xl { width: 64px; height: 64px; font-size: 1.25rem; }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar-ring { box-shadow: 0 0 0 2px var(--violet); }

.avatar-group { display: flex; }
.avatar-group .avatar { margin-left: -10px; border: 2px solid var(--ui-surface); }
.avatar-group .avatar:first-child { margin-left: 0; }

/* ══════════════════════════════════════════════════════════
   SEARCH BAR
   ══════════════════════════════════════════════════════════ */

.search-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--ui-input-bg);
  border: 1px solid var(--ui-border);
  border-radius: 99px;
  padding: 7px 16px;
  transition: border-color var(--trans-fast), box-shadow var(--trans-fast);
}
.search-bar:focus-within {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(124,58,237,.12);
}
.search-bar input {
  background: none; border: none; outline: none;
  color: var(--ui-t1); font-size: var(--text-sm);
  flex: 1;
  min-width: 0;
}
.search-bar input::placeholder { color: var(--ui-t3); }
.search-bar .search-icon { color: var(--ui-t3); font-size: .85rem; flex-shrink: 0; }
