/* StreamHub — fondations communes (site public + tableau de bord) */
:root {
  --bg: #0d0b16;
  --bg-2: #110e1d;
  --surface: #161327;
  --surface-2: #1d1934;
  --surface-3: #26213f;
  --border: #2b2647;
  --border-strong: #3d3566;
  --text: #f0edf9;
  --text-2: #cdc6e3;
  --muted: #9d96b8;
  --primary: #9b5cff;
  --primary-2: #b47bff;
  --primary-soft: rgba(155, 92, 255, .16);
  --accent: #ff5fa2;
  --grad: linear-gradient(135deg, #8b4dff 0%, #b47bff 45%, #ff5fa2 100%);
  --success: #3ddc97;
  --success-soft: rgba(61, 220, 151, .13);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, .13);
  --danger: #ff6b81;
  --danger-soft: rgba(255, 107, 129, .13);
  --info: #6ea8ff;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .5);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Outfit', 'Inter', system-ui, sans-serif;
  --mono: ui-monospace, 'Cascadia Code', 'SFMono-Regular', Consolas, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
img, svg, video { max-width: 100%; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
a { color: var(--primary-2); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: var(--mono); font-size: .88em; }
code { background: var(--surface-3); padding: .1em .4em; border-radius: 6px; color: #e3d5ff; overflow-wrap: anywhere; }
pre { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; overflow-x: auto; }
pre code { background: none; padding: 0; }
::selection { background: rgba(155, 92, 255, .45); }
:focus-visible { outline: 2px solid var(--primary-2); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ico { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }

/* Marque */
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.brand:hover { text-decoration: none; }
.logo-mark { width: 30px; height: 30px; flex: none; }
.brand-sm .logo-mark { width: 24px; height: 24px; }
.brand-sm { font-size: 1rem; }
.brand-lg { font-size: 1.5rem; }
.brand-lg .logo-mark { width: 40px; height: 40px; }

/* Boutons */
.btn { --b: var(--surface-3); display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 11px; border: 1px solid transparent; background: var(--b); color: var(--text); font: 600 .92rem/1.2 var(--font); cursor: pointer; text-decoration: none; white-space: normal; text-align: center; max-width: 100%; transition: background .18s var(--ease), border-color .18s var(--ease), transform .12s var(--ease), box-shadow .18s var(--ease), opacity .18s; user-select: none; }
.btn:hover { text-decoration: none; background: #302a4e; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, #8d4fff, #a66bff); color: #fff; box-shadow: 0 6px 18px rgba(139, 77, 255, .35); }
.btn-primary:hover { background: linear-gradient(135deg, #9a60ff, #b47bff); box-shadow: 0 8px 24px rgba(139, 77, 255, .45); }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger-soft); color: #ffb3c0; border-color: rgba(255, 107, 129, .35); }
.btn-danger:hover { background: rgba(255, 107, 129, .25); }
.btn-success { background: var(--success-soft); color: #9cf0c8; border-color: rgba(61, 220, 151, .35); }
.btn-success:hover { background: rgba(61, 220, 151, .22); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: .84rem; border-radius: 9px; }
.btn-lg { min-height: 50px; padding: 0 24px; font-size: 1rem; border-radius: 13px; }
.btn-block { width: 100%; white-space: normal; text-align: center; line-height: 1.25; padding-top: 8px; padding-bottom: 8px; }
.btn-icon { width: 36px; min-height: 36px; padding: 0; }
.btn-icon.btn-sm { width: 32px; min-height: 32px; }
.btn .spinner { width: 16px; height: 16px; border-width: 2px; }

/* Champs */
.field { display: grid; gap: 6px; margin-bottom: 18px; min-width: 0; }
.field > label, .field-label { font-weight: 600; font-size: .9rem; color: var(--text-2); }
.field .hint { font-size: .8rem; color: var(--muted); margin: 0; }
.field-error { font-size: .82rem; color: #ffadbb; display: flex; gap: 6px; align-items: flex-start; }
.input, .select, .textarea { width: 100%; min-height: 42px; padding: 9px 12px; background: var(--bg-2); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font: inherit; transition: border-color .15s, box-shadow .15s, background .15s; }
.textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239d96b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; }
.input:hover, .select:hover, .textarea:hover { border-color: #4a4178; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(155, 92, 255, .25); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(255, 107, 129, .15); }
.input-group { display: flex; align-items: stretch; }
.input-group .prefix, .input-group .suffix { display: flex; align-items: center; padding: 0 12px; background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--muted); font-size: .9rem; }
.input-group .prefix { border-radius: var(--radius-sm) 0 0 var(--radius-sm); border-right: 0; }
.input-group .suffix { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: 0; }
.input-group .prefix + .input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-group .input:has(+ .suffix) { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
input[type="color"].input { padding: 4px; width: 56px; min-height: 42px; cursor: pointer; }

/* Interrupteur */
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; min-height: 40px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { position: relative; width: 44px; height: 24px; flex: none; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--border-strong); transition: background .2s var(--ease), border-color .2s; }
.switch .track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #cfc8e6; transition: transform .2s var(--ease), background .2s; }
.switch input:checked + .track { background: var(--primary); border-color: var(--primary); }
.switch input:checked + .track::after { transform: translateX(20px); background: #fff; }
.switch input:focus-visible + .track { outline: 2px solid var(--primary-2); outline-offset: 2px; }
.switch input:disabled + .track { opacity: .5; }
.switch .switch-label { font-weight: 600; font-size: .92rem; color: var(--text-2); }

/* Puces / badges */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); font-size: .8rem; font-weight: 600; border: 1px solid var(--border); text-decoration: none; }
a.chip:hover { border-color: var(--primary); text-decoration: none; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: .75rem; font-weight: 700; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.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-primary { background: var(--primary-soft); color: var(--primary-2); }
.badge .dot, .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; flex: none; }
.dot.pulse { box-shadow: 0 0 0 0 currentColor; animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(61, 220, 151, .55); } 70% { box-shadow: 0 0 0 8px rgba(61, 220, 151, 0); } 100% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0); } }

/* Cartes, alertes */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.card h2 { font-size: 1.15rem; }
.alert { overflow-wrap: anywhere; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid; margin-bottom: 16px; font-size: .9rem; line-height: 1.5; }
.alert-error { background: var(--danger-soft); border-color: rgba(255, 107, 129, .35); color: #ffc9d2; }
.alert-warn { background: var(--warning-soft); border-color: rgba(251, 191, 36, .35); color: #fde7a8; }
.alert-info { background: rgba(110, 168, 255, .1); border-color: rgba(110, 168, 255, .3); color: #cfe0ff; }
.alert-success { background: var(--success-soft); border-color: rgba(61, 220, 151, .35); color: #b8f5d9; }
.alert .ico { margin-top: 2px; }
.alert > div { flex: 1; min-width: 0; }
.alert p:last-child { margin: 0; }

/* Tableaux */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--bg-2); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; overflow-wrap: anywhere; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: rgba(255, 255, 255, .02); }

/* Chargement */
.spinner { width: 28px; height: 28px; border: 3px solid rgba(255, 255, 255, .15); border-top-color: var(--primary-2); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

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