:root {
  --paper: #f7f8fc;
  --surface: #ffffff;
  --ink: #1c2340;
  --on-ink: #ffffff;
  --ink-2: #565f82;
  --ink-3: #6b7398;
  --line: #e4e6f2;
  --brand: #3d4db8;
  --brand-deep: #2e3d95;
  --brand-light: #6878c4;
  --arm-1: #3d4db8;
  --arm-2: #6878c4;
  --gold: #3d4db8;
  --gold-deep: #2e3d95;
  --gold-wash: #eef0fa;
  --danger: #c0281a;
  --danger-wash: #fdeeeb;
  --pending: #eef0fa;
  --radius: 12px;
  --radius-lg: 20px;
  --font: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e1226; --surface: #161b34; --ink: #eceefb; --on-ink: #0e1226;
    --ink-2: #b7bcdb; --ink-3: #8991bd; --line: #262c4d;
    --brand: #7484e0; --brand-deep: #94a1ea; --brand-light: #97a2e6;
    --arm-1: #7484e0; --arm-2: #97a2e6;
    --gold: #7484e0; --gold-deep: #94a1ea; --gold-wash: #1c2350; --pending: #1a1f3c;
    --danger: #ff8a7a; --danger-wash: #2b1714; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0e1226; --surface: #161b34; --ink: #eceefb; --on-ink: #0e1226;
  --ink-2: #b7bcdb; --ink-3: #8991bd; --line: #262c4d;
  --brand: #7484e0; --brand-deep: #94a1ea; --brand-light: #97a2e6;
  --arm-1: #7484e0; --arm-2: #97a2e6;
  --gold: #7484e0; --gold-deep: #94a1ea; --gold-wash: #1c2350; --pending: #1a1f3c;
  --danger: #ff8a7a; --danger-wash: #2b1714; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.5;
}
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; line-height: 1.2; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.muted { color: var(--ink-3); }

/* Spirale (marque + indicateur d'attente) */
.arm-ink, .arm-gold { fill: none; stroke-width: 6.5; stroke-linecap: round; stroke-linejoin: round; }
.arm-ink { stroke: var(--arm-1); }
.arm-gold { stroke: var(--arm-2); }
.mark { width: 26px; height: 26px; display: block; }
.mark-lg { width: 72px; height: 72px; margin: 0 auto 14px; }

/* Barre latérale et barre mobile */
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 10px;
  background: none; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--pending); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.mobile-bar {
  display: none; align-items: center; justify-content: space-between; gap: 10px;
  height: 56px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--surface);
  position: sticky; top: 0; z-index: 20;
}
.mobile-bar .brand { font-size: 1rem; }

.sidebar-backdrop { position: fixed; inset: 0; background: rgba(20, 24, 48, .4); z-index: 29; }
.sidebar-close { display: none; }

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 264px; z-index: 30;
  display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line);
  padding: 16px 14px 14px;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; color: var(--ink); text-decoration: none; }

.sidebar-nav { display: grid; gap: 3px; }
.sidebar-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--ink-2); text-decoration: none; font-size: 0.95rem;
}
.sidebar-link svg { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-link:hover { background: var(--gold-wash); color: var(--ink); }
.sidebar-link[aria-current="page"] { background: var(--gold-wash); color: var(--brand-deep); font-weight: 500; }
.sidebar-link.is-primary { color: var(--brand-deep); font-weight: 500; }

.sidebar-recent { flex: 1; min-height: 0; margin-top: 22px; display: flex; flex-direction: column; }
.sidebar-label { padding: 0 12px; margin-bottom: 6px; font-size: 0.78rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.sidebar-recent-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: grid; gap: 1px; }
.sidebar-recent-list li a {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px;
  color: var(--ink-2); text-decoration: none; font-size: 0.88rem;
}
.sidebar-recent-list li a:hover { background: var(--gold-wash); color: var(--ink); }
.sidebar-recent-list .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--brand-light); }
.sidebar-recent-list .dot.is-active { background: var(--brand); animation: pulse 1.6s ease-in-out infinite; }
.sidebar-recent-list .dot.is-failed { background: var(--danger); }
.sidebar-recent-list span.txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes pulse { 50% { opacity: .35; } }
.sidebar-empty { padding: 8px 12px; font-size: 0.85rem; color: var(--ink-3); }

.sidebar-bottom { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; display: grid; gap: 10px; }
.sidebar-bottom .quota { padding: 0 12px; font-size: 0.82rem; }
.sidebar-profile { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 10px; text-decoration: none; color: var(--ink); }
.sidebar-profile:hover { background: var(--gold-wash); }
.sidebar-profile-name { font-size: 0.92rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.app-content { margin-left: 264px; min-height: 100vh; }

@media (max-width: 900px) {
  .mobile-bar { display: flex; }
  .sidebar {
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 0 transparent;
  }
  .sidebar.is-open { transform: translateX(0); box-shadow: 20px 0 40px -20px rgba(20,24,48,.35); }
  .sidebar-close { display: inline-grid; }
  .sidebar-backdrop[hidden] { display: none; }
  .app-content { margin-left: 0; }
}

.quota { color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.quota b { color: var(--ink); font-weight: 500; }
.quota.is-full b { color: var(--danger); }
.avatar {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 0.78rem; font-weight: 700; text-decoration: none; flex: none;
}
.avatar-lg { width: 64px; height: 64px; font-size: 1.2rem; }
.link-quiet { color: var(--ink-2); text-decoration: none; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.link-quiet:hover { color: var(--ink); border-color: var(--brand); }

/* Pages */
.page { max-width: 1280px; margin: 0 auto; padding: 28px 20px 72px; display: grid; gap: 36px; align-content: start; }
.page-narrow { max-width: 680px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.sub { color: var(--ink-2); font-size: 0.95rem; margin-top: 4px; }
.sub-title { margin: 24px 0 8px; font-size: 0.95rem; color: var(--ink-2); font-weight: 500; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 18px; }

/* Boutons */
.btn-primary, .btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 22px;
  border-radius: var(--radius); font-weight: 700; font-size: 1rem; cursor: pointer; text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-primary { border: 0; border-radius: var(--radius); background: var(--brand); color: #fff; box-shadow: 0 6px 16px -6px rgba(61,77,184,.45); }
.btn-primary:hover { background: var(--brand-deep); color: #fff; }
.btn-primary:disabled { background: var(--ink-3); box-shadow: none; cursor: progress; }
.btn-secondary { border: 1px solid var(--brand); background: transparent; color: var(--gold-deep); min-height: 44px; }
.btn-secondary:hover { background: var(--brand); color: #fff; }
.btn-secondary:disabled { opacity: 0.5; cursor: progress; }
.btn-text {
  padding: 4px 0; border: 0; background: none; cursor: pointer; color: var(--ink);
  border-bottom: 1px solid var(--line); font-size: 0.9rem;
}
.btn-text:hover { border-color: var(--gold); color: var(--gold-deep); }
.danger-text:hover { border-color: var(--danger); color: var(--danger); }

/* Statistiques : chiffres séparés par des filets, sans cartes */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stats > div { padding: 18px 20px; border-left: 1px solid var(--line); }
.stats > div:first-child { border-left: 0; padding-left: 0; }
.stats dt { color: var(--ink-2); font-size: 0.88rem; }
.stats dd { margin: 4px 0 0; font-size: 2.1rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

.split { display: grid; gap: 40px; }
@media (min-width: 900px) { .split { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 56px; } }
.split h2 { margin-bottom: 18px; }

.chart { display: flex; gap: 10px; height: 200px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: stretch; min-width: 0; text-align: center; }
.chart .val { height: 20px; font-size: 0.78rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.chart .track { flex: 1; display: flex; align-items: flex-end; border-bottom: 1px solid var(--line); }
.chart .track i { display: block; width: 100%; background: #9cc8ff; border-radius: 3px 3px 0 0; transition: height 0.4s ease; }
.chart .today .track i { background: var(--brand); }
.chart .day { margin-top: 6px; font-size: 0.8rem; color: var(--ink-3); }

.meter { margin-bottom: 16px; }
.meter-head { display: flex; justify-content: space-between; gap: 12px; font-size: 0.92rem; margin-bottom: 6px; }
.meter-head b { font-weight: 500; font-variant-numeric: tabular-nums; }
.meter-track { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.meter-track i { display: block; height: 100%; background: var(--gold); border-radius: 3px; }
.meter-track.is-high i { background: var(--danger); }
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.plain li b { font-weight: 500; }

/* Formulaires */
.field { border: 0; padding: 0; margin: 0; min-width: 0; }
.field:disabled { opacity: 0.55; }
.field > label, .field > legend { display: block; padding: 0; margin-bottom: 8px; font-weight: 500; font-size: 0.95rem; }
.opt { font-weight: 400; color: var(--ink-3); font-size: 0.85rem; margin-left: 6px; }
textarea, select, input[type="number"], input[type="password"], input[type="email"], input[type="text"], input[type="search"] {
  width: 100%; padding: 12px 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); transition: border-color 0.15s;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.45; }
select { appearance: none; padding-right: 36px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; }
textarea:focus, select:focus, input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--gold-wash); }
::placeholder { color: #9a9993; }
.hint { margin-top: 6px; font-size: 0.85rem; color: var(--ink-3); }
.hint.center { text-align: center; margin: 0; }
.form-error { padding: 10px 12px; border-radius: var(--radius); background: var(--danger-wash); color: var(--danger); font-size: 0.92rem; }

.segmented { display: flex; flex-wrap: wrap; gap: 8px; }
.segmented label { position: relative; flex: 1 1 auto; }
.segmented input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.segmented span {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 0.95rem; white-space: nowrap; transition: background 0.15s, border-color 0.15s;
}
.segmented label:hover span { border-color: var(--ink-3); }
.segmented input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.segmented input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.ratio { display: inline-block; border: 1.5px solid currentColor; border-radius: 2px; }
.r-land { width: 16px; height: 11px; } .r-port { width: 11px; height: 16px; } .r-sq { width: 13px; height: 13px; }

.check label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-weight: 400; margin: 0; }
.check input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--brand); flex: none; }
.check .hint { margin-left: 28px; }
.advanced summary { cursor: pointer; font-size: 0.95rem; color: var(--ink-2); padding: 4px 0; }
.advanced summary:hover { color: var(--ink); }
.advanced .field { margin-top: 14px; }

/* Références image / vidéo */
.slots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.slot { min-height: 96px; display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; background: var(--surface); min-width: 0; }
.slot.is-disabled { opacity: 0.55; }
.drop { flex: 1; display: grid; place-content: center; text-align: center; gap: 2px; min-height: 78px; border: 1.5px dashed var(--line); border-radius: 7px; cursor: pointer; padding: 6px; }
.drop:hover { border-color: var(--gold); background: var(--gold-wash); }
.slot.is-disabled .drop { cursor: not-allowed; }
.drop:focus-within { outline: 2px solid var(--gold); outline-offset: 2px; }
.drop-title { font-weight: 500; font-size: 0.92rem; }
.drop-sub { font-size: 0.8rem; color: var(--ink-3); }
.slot-thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; flex: none; background: var(--pending); }
.slot-info { display: grid; gap: 2px; min-width: 0; justify-items: start; font-size: 0.85rem; }
.slot-info b { font-size: 0.92rem; }
.slot-info span { color: var(--ink-3); overflow-wrap: anywhere; }
.picker { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); display: grid; gap: 10px; }
.picker video { width: 100%; max-height: 260px; background: #000; border-radius: 6px; }
.picker-label { font-size: 0.9rem; font-weight: 500; }
.picker input[type="range"] { width: 100%; accent-color: var(--gold); padding: 0; border: 0; }
.picker-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.picker-actions { display: flex; gap: 14px; }

/* Création */
.workspace { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) {
  .workspace { grid-template-columns: 400px minmax(0, 1fr); gap: 56px; }
  .composer { position: sticky; top: 24px; align-self: start; }
}
.composer form { margin-top: 20px; display: grid; gap: 22px; }

/* Bibliothèque */
.filters { display: grid; gap: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button, .chip-toggle span {
  display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); font-size: 0.9rem;
}
.chips button:hover, .chip-toggle:hover span { border-color: var(--ink-3); }
.chips button[aria-pressed="true"], .chip-toggle input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.filter-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filter-row select { width: auto; min-width: 160px; min-height: 38px; padding: 6px 34px 6px 12px; }
.chip-toggle { position: relative; }
.chip-toggle input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.chip-toggle input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.group { margin-bottom: 36px; }
.group-title { font-size: 1rem; padding-bottom: 10px; margin-bottom: 18px; border-bottom: 1px solid var(--line); color: var(--ink-2); font-weight: 500; }
.more { text-align: center; }

.empty { padding: 36px 24px; max-width: 46ch; color: var(--ink-2); border: 1px dashed var(--line); border-radius: var(--radius); }
.grid { display: grid; gap: 32px 28px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); align-items: start; }

/* Cartes vidéo */
.frame { position: relative; width: 100%; aspect-ratio: var(--ar, 3 / 2); background: #000; border-radius: 6px; overflow: hidden; }
.frame.is-pending { background: var(--pending); }
.frame.is-failed { background: var(--danger-wash); }
.media { position: absolute; inset: 0; }
.media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.wait { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 16px; text-align: center; font-size: 0.9rem; color: var(--ink-2); }
.wait svg { width: 64px; height: 64px; animation: turn 3.2s linear infinite; }
@keyframes turn { to { transform: rotate(360deg); } }
.bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(128, 128, 128, 0.2); }
.bar i { display: block; height: 100%; width: 0; background: var(--gold); transition: width 0.6s ease; }
.fail { color: var(--danger); }
.fail b { display: block; margin-bottom: 4px; }
.fav {
  position: absolute; top: 8px; right: 8px; z-index: 2; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; background: rgba(0, 0, 0, 0.5); color: #fff;
}
.fav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.fav.on svg { fill: #ffd45c; stroke: #ffd45c; }
.fav:hover { background: rgba(0, 0, 0, 0.72); }
.card-body { padding-top: 12px; }
.card-tag { font-size: 0.78rem; color: var(--gold-deep); margin-bottom: 4px; }
.card-prompt { margin-bottom: 6px; font-size: 0.95rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { font-size: 0.85rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.card-actions { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 10px; }
.card-actions a, .card-actions button { padding: 4px 0; border: 0; background: none; cursor: pointer; font-size: 0.9rem; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.card-actions a:hover, .card-actions button:hover { border-color: var(--gold); color: var(--gold-deep); }
.card-actions .danger:hover { border-color: var(--danger); color: var(--danger); }

/* Connexion, inscription */
.auth-screen {
  position: relative; min-height: 100vh; display: grid; place-items: center;
  padding: 20px; overflow: hidden; background: var(--paper);
}
.auth-blob {
  position: absolute; width: 46vw; height: 46vw; max-width: 560px; max-height: 560px;
  border-radius: 50%; filter: blur(70px); opacity: .55; pointer-events: none;
}
.auth-blob-a { top: -14%; left: -12%; background: radial-gradient(circle, var(--brand-light), transparent 70%); }
.auth-blob-b { bottom: -18%; right: -10%; background: radial-gradient(circle, var(--brand), transparent 70%); }
.auth-card {
  position: relative; z-index: 1; width: 100%; max-width: 400px; padding: 40px 34px 34px;
  background: var(--surface); border-radius: var(--radius-lg); text-align: center;
  box-shadow: 0 24px 60px -20px rgba(30, 41, 110, .28), 0 2px 8px rgba(30, 41, 110, .06);
}
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 22px; }
.auth-brand-name { font-weight: 700; font-size: 1.15rem; color: var(--brand-deep); }
.auth-card h1 { font-size: 1.5rem; }
.auth-tagline { margin: 6px 0 26px; color: var(--ink-3); font-size: 0.92rem; }
.auth-card form { display: grid; gap: 15px; text-align: left; }
.form-error.is-info { background: var(--gold-wash); color: var(--brand-deep); } /* ex. nouvelle tentative en cours */
.auth-card .form-error { margin-bottom: 4px; text-align: left; }
.btn-block { width: 100%; margin-top: 4px; }
.auth-alt { margin-top: 22px; color: var(--ink-2); font-size: 0.92rem; }
.auth-alt a { color: var(--brand); font-weight: 500; border-bottom: 1px solid transparent; text-decoration: none; }
.auth-alt a:hover { border-color: var(--brand); }

/* Profil */
.profile-head { display: flex; align-items: center; gap: 18px; }
.pf-name { font-size: 1.3rem; font-weight: 700; }
.page-narrow section h2 { margin-bottom: 14px; }
.inline-form { display: flex; gap: 12px; align-items: flex-start; }
.inline-form .field { flex: 1; }
.stack-form { display: grid; gap: 16px; justify-items: start; }
.stack-form .field { width: 100%; }
#name-msg, #pw-msg { min-height: 1.4em; }

/* Mobile */
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 0 12px; padding: 8px 14px 0; }
  .brand { order: 1; flex: 1; }
  .topbar-right { order: 2; }
  .nav { order: 3; flex: 1 0 100%; overflow-x: auto; margin: 0 -14px; padding: 0 8px; }
  .nav a { padding: 12px 10px; white-space: nowrap; }
  .quota { display: none; }
  .stats dd { font-size: 1.7rem; }
  .stats > div { padding: 14px 12px; }
  .slots { grid-template-columns: minmax(0, 1fr); }
  .segmented span { padding: 0 10px; }
  .chart { gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .wait svg { animation: none; }
  .bar i, .chart .track i { transition: none; }
}

/* Tarifs : colonnes séparées par des filets, comme une fiche technique */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.plan { padding: 22px 22px 26px; border-left: 1px solid var(--line); border-top: 3px solid transparent; margin-top: -1px; }
.plan:first-child { border-left: 0; padding-left: 0; }
.plan.is-current { border-top-color: var(--gold); }
.plan-badge { min-height: 1.4em; font-size: 0.8rem; color: var(--gold-deep); margin-bottom: 6px; }
.plan-badge.is-empty { visibility: hidden; }
.plan h2 { font-size: 1.3rem; }
.plan-desc { min-height: 1.5em; color: var(--ink-2); font-size: 0.9rem; margin: 4px 0 14px; }
.plan-price { margin-bottom: 18px; }
.plan-price b { font-size: 1.9rem; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.plan-price span { color: var(--ink-3); font-size: 0.9rem; }
.plan-facts { margin: 0; }
.plan-facts > div { padding: 9px 0; border-top: 1px solid var(--line); }
.plan-facts dt { font-size: 0.8rem; color: var(--ink-3); }
.plan-facts dd { margin: 2px 0 0; font-size: 0.95rem; }
.contact { max-width: 60ch; }
.contact h2 { margin-bottom: 8px; }
.contact p { color: var(--ink-2); }

/* Administration */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; margin-bottom: -12px; }
.tabs button { padding: 12px 14px; border: 0; border-bottom: 2px solid transparent; background: none; cursor: pointer; color: var(--ink-2); white-space: nowrap; font-size: 0.95rem; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--gold); font-weight: 500; }
#admin-body { display: grid; gap: 22px; align-content: start; }
.admin-tools { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.admin-tools input { max-width: 340px; }
.admin-list { display: grid; gap: 0; }
.admin-row { display: grid; gap: 14px; padding: 18px 0; border-top: 1px solid var(--line); }
@media (min-width: 1100px) { .admin-row { grid-template-columns: 240px minmax(0, 1fr) 150px; align-items: start; } }
.admin-who { display: grid; gap: 2px; align-content: start; justify-items: start; }
.admin-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.admin-fields .field > label, .admin-grid .field > label { font-size: 0.85rem; color: var(--ink-2); font-weight: 400; margin-bottom: 4px; }
.admin-fields input, .admin-fields select, .admin-grid input, .admin-grid select { padding: 9px 10px; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.admin-actions .hint { margin: 0; }
.hint.is-bad { color: var(--danger); }
.badge { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; font-size: 0.75rem; background: var(--gold-wash); color: var(--gold-deep); font-weight: 400; }
.badge.is-muted { background: var(--pending); color: var(--ink-3); }
.admin-who .badge { margin-left: 0; }
.admin-plan { border-top: 1px solid var(--line); padding: 4px 0; }
.admin-plan > summary { cursor: pointer; display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; padding: 14px 0; list-style-position: inside; }
.admin-plan[open] > summary { padding-bottom: 8px; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin: 8px 0 18px; }
.admin-checks { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-bottom: 18px; align-items: center; }
.admin-checks .label-like { flex: 1 0 100%; font-weight: 500; font-size: 0.9rem; }
.check-inline { display: inline-flex; gap: 8px; align-items: center; font-size: 0.95rem; cursor: pointer; }
.check-inline input { width: 18px; height: 18px; accent-color: var(--brand); }
.provider { padding: 20px 0; border-top: 1px solid var(--line); }
.provider-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.provider-head .badge { margin-left: 0; }
.model-rows { display: grid; gap: 0; }
.model-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 140px; gap: 16px; align-items: end; padding: 12px 0; border-top: 1px dashed var(--line); }
.model-row .sub { margin-top: 2px; }
.model-row .badge { margin-left: 8px; }
.stack-form.wide { max-width: 560px; justify-items: stretch; }
@media (max-width: 720px) {
  .model-row { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .plan { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
  .plan:first-child { border-top: 3px solid transparent; }
  .plan.is-current { border-top-color: var(--gold); }
}

/* Accent indigo, façon "Bienvenue" d'Agnes AI */
.accent { color: var(--brand); }
#hello { display: flex; flex-wrap: wrap; gap: 0.4ch; align-items: baseline; }

/* Tableau de bord : composeur central façon Agnes AI */
.hero { max-width: 820px; margin: 0 auto; padding: 48px 20px 8px; text-align: center; }
.hero h1 { font-size: 2rem; letter-spacing: -0.02em; }
.hero .sub { margin-top: 8px; font-size: 1rem; }
.composer-box {
  margin-top: 28px; padding: 18px 20px 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: 0 20px 45px -24px rgba(30,41,110,.22); text-align: left;
}
.composer-box textarea {
  width: 100%; border: 0; padding: 0; resize: none; min-height: 56px; font-size: 1.05rem; line-height: 1.5;
  background: transparent;
}
.composer-box textarea:focus { outline: none; box-shadow: none; }
.composer-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.composer-tools { display: flex; gap: 2px; }
.composer-format { display: flex; gap: 4px; padding: 3px; background: var(--pending); border-radius: 10px; }
.composer-format button {
  border: 0; background: none; padding: 6px 10px; border-radius: 8px; font-size: 0.85rem; color: var(--ink-2); cursor: pointer;
}
.composer-format button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(20,24,48,.12); }
.composer-send {
  width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; cursor: pointer;
  display: grid; place-items: center; flex: none; box-shadow: 0 6px 16px -6px rgba(61,77,184,.5);
}
.composer-send:hover { background: var(--brand-deep); }
.composer-send:disabled { background: var(--ink-3); box-shadow: none; cursor: progress; }
.composer-send svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.pills-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 20px 0 0; }
.pill-link {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--surface); color: var(--ink-2); text-decoration: none; font-size: 0.9rem; cursor: pointer;
}
.pill-link:hover { border-color: var(--brand-light); color: var(--brand-deep); }
.pill-link svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.suggest-title { max-width: 820px; margin: 34px auto 12px; padding: 0 20px; font-size: 0.9rem; color: var(--ink-2); font-weight: 500; }
.suggest-row { max-width: 820px; margin: 0 auto; padding: 0 20px; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.suggest-card {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface); text-align: left; cursor: pointer; font-size: 0.88rem; color: var(--ink-2);
}
.suggest-card:hover { border-color: var(--brand-light); background: var(--gold-wash); color: var(--ink); }
.suggest-dot { width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 0.85rem; background: var(--gold-wash); }

.promo {
  max-width: 820px; margin: 26px auto 0; padding: 20px 22px; border-radius: var(--radius-lg);
  background: linear-gradient(120deg, var(--gold-wash), var(--paper)); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.promo h3 { font-size: 1rem; }
.promo p { margin-top: 4px; color: var(--ink-2); font-size: 0.9rem; }

.dash-body { max-width: 1100px; margin: 0 auto; padding: 44px 20px 64px; display: grid; gap: 36px; }

@media (max-width: 640px) {
  .hero { padding-top: 30px; }
  .hero h1 { font-size: 1.5rem; }
  .composer-row { flex-wrap: wrap; }
}
