/* ============================================================
   APEX FBA — design « Notion 2.0 » (maquette Apex FBA Workspace)
   Fond #191919, barre latérale #202020, bordures #2F2F2F, texte #E6E6E6 / #9B9B9B,
   Inter + JetBrains Mono, étiquettes de couleur façon Notion, bouton bleu #1F75CB,
   pages avec couverture, grande icône, grand titre et encadré 💡.
   ============================================================ */
:root {
  color-scheme: dark;
  --bg: #191919;
  --s1: #202020;
  --s2: #252525;
  --s3: #2C2C2C;
  --s4: #2F2F2F;
  --hov: rgba(47, 47, 47, 0.6);
  --line: #2F2F2F;
  --line2: #3A3A3A;
  --text: #E6E6E6;
  --sub: #BDBDBD;
  --mut: #9B9B9B;
  --dim: #8E8E8E;          /* ≥ 4,5:1 sur #191919 (WCAG AA) */
  --blue: #1F75CB;
  --em: #3FB27F;
  --em2: #3FB27F;
  --cy: #4C8DF6;
  --cy2: #8EC2FF;
  --am: #F1D27C;
  --rd: #FF9C9C;
  --pk: #E5609F;
  --or: #F0B37E;
  --vi: #D2A8FF;
  --t-gray-bg: #373737; --t-gray: #D4D4D4;
  --t-orange-bg: #4A3220; --t-orange: #F0B37E;
  --t-yellow-bg: #4A3F1E; --t-yellow: #F1D27C;
  --t-blue-bg: #1E3554; --t-blue: #8EC2FF;
  --t-green-bg: #1C3F2F; --t-green: #7FD3A6;
  --t-red-bg: #4F2222; --t-red: #FF9C9C;
  --t-purple-bg: #3D2C4F; --t-purple: #D2A8FF;
  --em-soft: var(--t-green-bg); --cy-soft: var(--t-blue-bg); --am-soft: var(--t-yellow-bg); --rd-soft: var(--t-red-bg); --vi-soft: var(--t-purple-bg);
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --r-lg: 8px; --r: 6px; --r-sm: 6px;
  --side: 260px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--mut); text-decoration: none; }
a:hover { color: var(--text); }
::selection { background: rgba(31, 117, 203, 0.45); }
::placeholder { color: var(--dim); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #3a3a3a; border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }
:where(button, a, input, select, textarea, [tabindex]):focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.bg { display: none; }

/* ── Cadre ────────────────────────────────────────────────── */
.shell { display: flex; min-height: 100dvh; }
.shell[data-side="closed"] .side { display: none; }
.side {
  position: sticky; top: 0; height: 100dvh; overflow-y: auto; flex: none; width: var(--side);
  display: flex; flex-direction: column; gap: 14px; padding: 10px 8px;
  background: var(--s1); border-right: 1px solid var(--line);
}
.ws { display: flex; align-items: center; gap: 8px; }
.ws-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 8px; border: 0; background: transparent; border-radius: 6px; color: var(--text); text-align: left; }
.ws-logo { width: 26px; height: 26px; border-radius: 6px; background: var(--text); color: var(--bg); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.ws-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-sub { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--mut); }
.ws-sub i { width: 6px; height: 6px; border-radius: 50%; background: var(--em); flex: none; }
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-title { font-size: 12px; font-weight: 500; color: var(--mut); padding: 0 10px 4px; }
.nav-item { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 32px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: #D4D4D4; font-size: 14px; text-align: left; }
.nav-item:hover, .hov:hover { background: var(--hov); }
.nav-item[aria-current="page"] { background: var(--s3); color: #fff; }
.nav-item .em { width: 20px; text-align: center; flex: none; }
.nav-item .lbl { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item.muted-item { color: var(--mut); min-height: 34px; gap: 10px; }
.nav-item .kbd { margin-left: auto; }
.nav-item .count { margin-left: auto; font-size: 12px; color: var(--mut); font-variant-numeric: tabular-nums; }
.nav-item .count.warn { color: var(--am); }
.tree-row { display: flex; align-items: center; border-radius: 6px; }
.tree-row[aria-current="page"] { background: var(--s3); }
.tree-tog { width: 28px; height: 32px; flex: none; border: 0; background: transparent; border-radius: 6px; color: var(--mut); display: grid; place-items: center; }
.tree-tog:hover { background: var(--hov); }
.tree-tog svg { transition: transform 0.15s; }
.tree-tog[aria-expanded="true"] svg { transform: rotate(90deg); }
.tree-row .nav-item { padding-left: 2px; }
.tree-row[aria-current="page"] .nav-item { color: #fff; background: transparent; }
.nav-kid { padding-left: 36px; min-height: 30px; font-size: 13px; }
.nav-kid .em { width: 18px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 1px; }
.credits { margin-top: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; display: flex; flex-direction: column; gap: 6px; }
.credits .top { display: flex; justify-content: space-between; font-size: 12px; position: static; min-height: 0; padding: 0; background: none; }
.credits .track { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.credits .track i { display: block; height: 4px; background: var(--em); transition: width 0.3s; }
.me { display: flex; align-items: center; gap: 8px; padding: 6px 4px 0; }
.me b { font-size: 13px; font-weight: 500; display: block; }
.me small { font-size: 11px; color: var(--mut); display: flex; align-items: center; gap: 6px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 12px; min-height: 48px; background: var(--bg); }
.crumbs { flex: 1; min-width: 200px; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-size: 13px; }
.crumbs button { min-height: 32px; padding: 0 6px; border: 0; background: transparent; border-radius: 4px; color: var(--mut); }
.crumbs button:hover { background: var(--hov); }
.crumbs button.cur { color: var(--text); }
.crumbs .sep { color: #5A5A5A; }
.top-right { display: flex; align-items: center; gap: 2px; }
.top-meta { font-size: 12px; color: var(--mut); padding: 0 6px; }
.btn.menu-btn { display: none; }
.content { width: 100%; max-width: 1280px; padding: 0 clamp(16px, 5vw, 72px) 96px; display: flex; flex-direction: column; gap: 14px; }

/* En-tête de page : couverture, icône, titre, encadré */
.cover { height: 180px; position: relative; flex: none; }
.cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(25, 25, 25, 0) 40%, var(--bg) 100%); }
.page-head { display: flex; flex-direction: column; gap: 10px; margin-top: -42px; position: relative; z-index: 1; }
.page-emoji { font-size: 62px; line-height: 1; width: 78px; height: 78px; display: flex; align-items: center; }
.page-head h2 { margin: 0; font-size: 40px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.2; }
.page-head p { margin: 0; color: var(--mut); }
.callout { display: flex; gap: 12px; align-items: flex-start; background: var(--s2); border-radius: 6px; padding: 14px 16px; color: var(--sub); }
.callout > .ico { font-size: 20px; line-height: 1.2; flex: none; }
.callout b { color: var(--text); font-weight: 600; }

/* ── Blocs ────────────────────────────────────────────────── */
.glass { background: transparent; border: 1px solid var(--line); border-radius: 8px; }
.pad { padding: 16px 18px; }
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.h2 { margin: 0; font-size: 16px; font-weight: 600; }
.h2 span { color: var(--mut); font-weight: 400; }
.sub { font-size: 13px; color: var(--mut); margin-top: 2px; }
.label { font-size: 12px; color: var(--mut); font-weight: 500; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.divider { height: 1px; background: var(--line); margin: 4px 0; }
.muted { color: var(--mut); }
.small { font-size: 12px; }
.up { animation: fade 0.2s ease both; }

.kpi { padding: 14px 16px; min-height: 104px; display: flex; flex-direction: column; gap: 4px; background: var(--s1); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-ico { width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; flex: none; background: var(--t-gray-bg); color: var(--t-gray); }
.kpi-ico.go { background: var(--t-green-bg); color: var(--t-green); }
.kpi-ico.info { background: var(--t-blue-bg); color: var(--t-blue); }
.kpi-ico.maybe { background: var(--t-yellow-bg); color: var(--t-yellow); }
.kpi-ico.no { background: var(--t-red-bg); color: var(--t-red); }
.kpi .v { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi .hint { font-size: 12px; color: var(--mut); }

/* ── Boutons ──────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font-size: 14px; font-weight: 400; white-space: nowrap; text-decoration: none; transition: background 0.12s; }
.btn:hover { background: var(--hov); color: var(--text); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.sm { min-height: 28px; padding: 0 8px; font-size: 13px; }
.btn.icon { width: 36px; min-height: 36px; padding: 0; color: var(--mut); }
.btn.sm.icon { width: 30px; min-height: 30px; }
.btn.ghost { color: var(--mut); }
.btn.em { background: var(--s2); border: 1px solid var(--line); }
.btn.em:hover { background: var(--s3); }
.btn.danger { color: var(--t-red); }
.btn.danger:hover { background: var(--t-red-bg); }
.btn.cta { background: var(--blue); color: #fff; font-weight: 500; padding: 0 12px; }
.btn.cta:hover { background: #2a83db; color: #fff; }
label.btn { cursor: pointer; }

/* ── Champs ───────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 12px; color: var(--mut); }
.input, .select, .textarea { width: 100%; min-height: 34px; padding: 0 10px; border-radius: 6px; background: var(--s1); border: 1px solid var(--line); color: var(--text); font-size: 14px; outline: none; }
.textarea { min-height: 90px; padding: 8px 10px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.select { appearance: none; -webkit-appearance: none; padding-right: 28px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239B9B9B' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; }
.select option { background: var(--s2); }
.search { position: relative; flex: 1 1 220px; min-width: 160px; }
.search svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--mut); pointer-events: none; }
.search .input { padding-left: 30px; border-color: transparent; }

/* ── Étiquettes ───────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 8px; border-radius: 6px; font-size: 12px; color: var(--mut); background: var(--s1); }
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; flex: none; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; padding: 1px 7px; border-radius: 3px; white-space: nowrap; line-height: 1.5; background: var(--t-gray-bg); color: var(--t-gray); }
.pill.go { background: var(--t-green-bg); color: var(--t-green); }
.pill.maybe { background: var(--t-yellow-bg); color: var(--t-yellow); }
.pill.orange { background: var(--t-orange-bg); color: var(--t-orange); }
.pill.no { background: var(--t-red-bg); color: var(--t-red); }
.pill.info { background: var(--t-blue-bg); color: var(--t-blue); }
.pill.mute { background: var(--t-gray-bg); color: var(--t-gray); }
.pill.vi { background: var(--t-purple-bg); color: var(--t-purple); }
.pill .d { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 8px; border-radius: 6px; font-size: 13px; border: 0; background: transparent; color: var(--mut); }
.chip:hover { background: var(--hov); color: var(--text); }
.chip[aria-pressed="true"] { color: var(--text); background: var(--s3); }
.chip .n { font-size: 12px; color: var(--dim); }
.kbd { font-family: var(--mono); font-size: 11px; color: var(--mut); }

/* ── Sous-pages (liens) et onglets de vue (Table / Board / …) ── */
.subnav { display: flex; flex-wrap: wrap; gap: 2px; max-width: 100%; }
.subnav button { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--mut); font-size: 14px; white-space: nowrap; }
.subnav button:hover { background: var(--hov); color: var(--text); }
.subnav button[aria-pressed="true"] { background: var(--s3); color: var(--text); }
.subnav .pill { font-size: 11px; padding: 0 5px; }
.vtabs { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px; }
.vtabs button { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 8px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: transparent; color: var(--mut); font-weight: 500; transition: color 0.2s, border-color 0.25s; white-space: nowrap; }
.vtabs button:hover { color: var(--text); }
.vtabs button[aria-pressed="true"] { color: var(--text); border-bottom-color: var(--text); }
.dbbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px; border-bottom: 1px solid var(--line); margin-top: 8px; }
.dbbar .tools { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding-bottom: 6px; }

/* ── Tableau base de données ──────────────────────────────── */
.tablewrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 13px; font-weight: 400; color: var(--mut); padding: 7px 10px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th + th, .table td + td { border-left: 1px solid var(--line); }
.table td { padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover td { background: var(--s1); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .pos { color: var(--t-green); }
.table .neg { color: var(--t-red); }
.glass > .tablewrap .table th { border-top: 0; }
.asin { flex: none; border: 0; background: #2A2A2A; color: var(--sub); border-radius: 4px; padding: 1px 6px; font-family: var(--mono); font-size: 11px; }
.thumb { width: 28px; height: 28px; border-radius: 4px; flex: none; overflow: hidden; display: grid; place-items: center; background: #fff; color: #888; }
.thumb.none { background: var(--s2); color: var(--dim); }
.thumb img { width: 100%; height: 100%; object-fit: contain; padding: 2px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score { display: inline-flex; align-items: center; gap: 8px; }
.score i { width: 40px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; display: block; }
.score i b { display: block; height: 100%; }
.addrow { min-height: 36px; width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--mut); text-align: left; padding: 0 10px; }
.addrow:hover { background: var(--hov); }
.bar { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--em); transition: width 0.4s var(--ease); }

.av { width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 10px; font-weight: 600; color: #191919; }
.av.sq { border-radius: 4px; }
.av.lg { width: 28px; height: 28px; font-size: 12px; }

/* ── Board ────────────────────────────────────────────────── */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.lane { display: flex; flex-direction: column; gap: 8px; border-radius: 8px; padding: 8px; background: rgba(55, 55, 55, 0.25); min-height: 160px; max-height: 72vh; overflow-y: auto; }
.lane.t-blue { background: rgba(30, 53, 84, 0.3); }
.lane.t-yellow { background: rgba(74, 63, 30, 0.25); }
.lane.t-orange { background: rgba(74, 50, 32, 0.25); }
.lane.t-green { background: rgba(28, 63, 47, 0.3); }
.lane.t-red { background: rgba(79, 34, 34, 0.25); }
.lane-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px; font-size: 13px; }
.lane-head .n { font-size: 13px; color: var(--mut); }
.lane-head .dot { display: none; }
.lane-empty { padding: 10px 6px; color: var(--dim); font-size: 13px; }
.card { display: flex; flex-direction: column; gap: 8px; text-align: left; background: var(--s2); border: 1px solid var(--line); border-radius: 6px; padding: 10px; color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); width: 100%; transition: border-color 0.12s; }
.card:hover { border-color: #454545; }
button.card { cursor: pointer; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.gcard { display: flex; flex-direction: column; text-align: left; background: var(--s1); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; padding: 0; color: var(--text); }
.gcard:hover { border-color: #454545; }
.gcard .gcover { height: 130px; display: grid; place-items: center; background: #fff; font-size: 44px; }
.gcard .gcover.none { background: var(--s2); }
.gcard .gcover img { max-width: 100%; max-height: 100%; object-fit: contain; padding: 8px; }
.gcard .gbody { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 12px; }
.lrow { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; min-height: 44px; padding: 4px 8px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); text-align: left; width: 100%; }
.lrow:hover { background: var(--hov); }

/* ── Fiche latérale, menus, toast ─────────────────────────── */
.backdrop { position: fixed; inset: 0; z-index: 80; border: 0; padding: 0; background: rgba(0, 0, 0, 0.55); cursor: default; animation: fade 0.15s ease both; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 81; width: min(660px, 100%); overflow-y: auto; display: flex; flex-direction: column; gap: 18px; padding: 0 clamp(16px, 4vw, 44px) 40px; background: var(--s1); border-left: 1px solid var(--line); box-shadow: -12px 0 40px rgba(0, 0, 0, 0.55); animation: slide 0.25s var(--ease) both; }
.drawer > .head:first-child { position: sticky; top: 0; z-index: 2; margin: 0 calc(-1 * clamp(16px, 4vw, 44px)); padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--s1); align-items: center; }
.drawer > .head:first-child .h2 { font-size: 14px; font-weight: 500; color: var(--mut); }
.drawer .glass { background: transparent; }
.props { display: flex; flex-direction: column; gap: 2px; }
.prop { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; min-height: 32px; font-size: 14px; }
.prop > span:first-child { color: var(--mut); }
.toast { display: flex; align-items: center; position: fixed; z-index: 120; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 8px 14px; border-radius: 6px; background: var(--s2); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 13px; animation: rise 0.2s ease both; max-width: calc(100% - 32px); }
.err { padding: 10px 14px; border-radius: 6px; background: var(--t-red-bg); color: var(--t-red); font-size: 13px; }
.note { display: block; padding: 14px 16px; border-radius: 6px; background: var(--s2); color: var(--sub); font-size: 14px; }
.note.row { display: flex; }
.note.small { font-size: 13px; padding: 10px 14px; }
.empty { padding: 32px; text-align: center; color: var(--mut); border: 1px dashed var(--line); border-radius: 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.glass > .empty { border: 0; }
.empty-ico { color: var(--mut); }

/* ── Palette ──────────────────────────────────────────────── */
.palette { position: fixed; z-index: 130; left: 50%; top: 90px; transform: translateX(-50%); width: min(620px, calc(100% - 32px)); background: var(--s2); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); overflow: hidden; animation: fade 0.12s ease both; }
.palette-in { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.palette-in svg { color: var(--mut); flex: none; }
.palette-in input { flex: 1; min-height: 52px; border: 0; outline: none; background: transparent; color: var(--text); font-size: 16px; }
.palette-list { max-height: 360px; overflow-y: auto; padding: 6px; }
.palette-group { padding: 8px 10px 4px; font-size: 12px; color: var(--mut); }
.palette-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text); text-align: left; }
.palette-item svg { color: var(--mut); flex: none; }
.palette-item .hint { margin-left: auto; font-size: 12px; color: var(--mut); white-space: nowrap; }
.palette-item[aria-selected="true"] { background: var(--hov); }
.palette-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 11px; color: var(--mut); }

.skel { border-radius: 4px; background: linear-gradient(90deg, #232323, #2c2c2c, #232323); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }

@keyframes rise { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes blink { 50% { opacity: 0; } }
.spin { animation: spin 1s linear infinite; }

/* ── Jarvis ───────────────────────────────────────────────── */
.chat { display: flex; flex-direction: column; gap: 18px; }
.turn { display: flex; gap: 12px; align-items: flex-start; max-width: 880px; }
.turn.me { align-self: flex-end; flex-direction: row-reverse; }
.ai-av { width: 26px; height: 26px; border-radius: 6px; flex: none; display: grid; place-items: center; background: var(--text); color: var(--bg); }
.msg { min-width: 0; padding: 8px 12px; border-radius: 8px; line-height: 1.6; font-size: 14px; white-space: pre-wrap; word-wrap: break-word; }
.msg.me { background: var(--s2); }
.msg.ai { padding: 2px 0 0; color: var(--text); }
.msg .steps { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.composer { display: flex; align-items: flex-end; gap: 6px; padding: 6px; border-radius: 8px; background: var(--s1); border: 1px solid var(--line); }
.composer:focus-within { border-color: #454545; }
.composer input { flex: 1; min-width: 0; min-height: 36px; padding: 0 8px; background: transparent; border: 0; outline: none; color: var(--text); }
.orb { position: fixed; right: 20px; bottom: 20px; z-index: 96; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); cursor: pointer; display: grid; place-items: center; color: var(--text); background: var(--s2); box-shadow: var(--shadow); }
.orb:hover { background: var(--s3); }
.orb.busy:not(.on)::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--blue); animation: spin 1s linear infinite; }
.orb-dot { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; display: grid; place-items: center; background: var(--blue); color: #fff; font: 600 10.5px/1 var(--font); }
.orb-dot:empty { min-width: 10px; width: 10px; height: 10px; padding: 0; }
.orb-tip { position: absolute; right: calc(100% + 8px); top: 50%; transform: translateY(-50%); opacity: 0; pointer-events: none; white-space: nowrap; display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 6px; background: var(--s2); border: 1px solid var(--line); color: var(--sub); font-size: 12px; transition: opacity 0.12s; }
.orb:hover .orb-tip { opacity: 1; }
.jpanel { position: fixed; z-index: 95; right: 20px; bottom: 76px; width: 410px; height: min(640px, calc(100dvh - 100px)); display: flex; flex-direction: column; overflow: hidden; background: var(--s1); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); animation: fade 0.15s ease both; }
.jpanel[hidden] { display: none; }
.jpanel-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border-bottom: 1px solid var(--line); }
.jctx { display: flex; align-items: center; gap: 8px; padding: 6px 12px; font-size: 12px; color: var(--mut); border-bottom: 1px solid var(--line); }
.jctx b { color: var(--text); font-weight: 500; }
.jpanel-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 12px 0; }
.jpanel-body .composer { margin-bottom: 10px; background: var(--s2); }
.jpanel-body .composer .btn.cta span, .jpanel-body .composer .btn span:not([style]) { display: none; }
.jpanel-body .turn { max-width: 100%; }
.jchips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: -6px -12px -8px; padding: 0 12px; }
.jchips .chip { flex: none; max-width: 250px; background: var(--s2); }
@media (min-width: 1180px) { body:has(.drawer) .jpanel { right: 680px; } }
.md { white-space: normal; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 10px; }
.md h4 { margin: 16px 0 6px; font-size: 16px; font-weight: 600; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; }
.md ul ul { margin: 3px 0; }
.md li { margin: 3px 0; }
.md b { font-weight: 600; }
.md code { font-family: var(--mono); font-size: 12.5px; padding: 1px 5px; border-radius: 4px; background: #2A2A2A; color: #FF9C9C; }
.md pre { margin: 0 0 10px; padding: 12px; border-radius: 6px; background: var(--s2); overflow-x: auto; white-space: pre; }
.md pre code { padding: 0; background: none; color: var(--text); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.md a { color: var(--text); text-decoration: underline; text-decoration-color: #5A5A5A; text-underline-offset: 3px; }
.md-table { margin: 0 0 12px; overflow-x: auto; }
.md-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.md-table th { text-align: left; padding: 7px 10px; color: var(--mut); font-weight: 400; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); white-space: nowrap; }
.md-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.md-table th + th, .md-table td + td { border-left: 1px solid var(--line); }
.caret { display: inline-block; width: 7px; height: 15px; margin-left: 2px; vertical-align: -2px; background: var(--text); animation: blink 1s steps(2) infinite; }
.jsteps { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.jstep { display: flex; align-items: center; gap: 8px; width: fit-content; max-width: 100%; min-height: 28px; padding: 0 8px; border-radius: 6px; background: var(--s2); font-size: 13px; color: var(--mut); }
.jstep svg { flex: none; color: var(--em); }
.jstep.run svg { color: var(--cy); }
.jstep.bad svg { color: var(--am); }
.jstep .jsum { color: var(--dim); white-space: nowrap; }
.jstep .jsum::before { content: "·"; margin-right: 8px; }
.msg-tools { display: flex; gap: 2px; margin-top: 4px; margin-left: -8px; opacity: 0; transition: opacity 0.15s; }
.turn:hover .msg-tools { opacity: 1; }
@media (hover: none) { .msg-tools { opacity: 1; } }

.info { position: relative; display: inline-flex; vertical-align: middle; }
.info-btn { display: inline-grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--dim); cursor: help; }
.info-btn:hover, .info-btn[aria-expanded="true"] { color: var(--text); background: var(--hov); }
.info-pop { position: absolute; z-index: 70; left: -8px; top: calc(100% + 6px); width: max-content; max-width: min(320px, 80vw); padding: 10px 12px; border-radius: 8px; background: var(--s2); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--sub); font-size: 13px; font-weight: 400; line-height: 1.5; white-space: normal; }

.gsec summary { display: flex; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer; list-style: none; }
.gsec summary::-webkit-details-marker { display: none; }
.gsec summary svg { color: var(--mut); transition: transform 0.15s; }
.gsec[open] summary svg { transform: rotate(90deg); }

/* ── Connexion ────────────────────────────────────────────── */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login .glass { width: min(400px, 100%); padding: 28px 26px; display: flex; flex-direction: column; gap: 16px; background: var(--s1); }
.login h1 { margin: 0; font-size: 24px; font-weight: 700; }
.logo { width: 30px; height: 30px; border-radius: 6px; background: var(--text); color: var(--bg); display: grid; place-items: center; font-weight: 700; flex: none; }
.brand-name { font-weight: 600; font-size: 15px; }
.brand-name span { color: var(--mut); font-weight: 400; }
.brand-sub { font-size: 12px; color: var(--mut); }

/* Graphique Keepa */
.kchart { display: flex; flex-direction: column; gap: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.kchart svg { display: block; width: 100%; height: 200px; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }

@media (max-width: 980px) { .split { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .side { position: fixed; left: 0; top: 0; bottom: 0; z-index: 90; width: 280px; transform: translateX(-100%); transition: transform 0.25s var(--ease); }
  .shell[data-side="closed"] .side { display: flex; }
  .shell[data-nav="open"] .side { transform: none; box-shadow: 30px 0 80px -20px rgba(0, 0, 0, 0.9); }
  .btn.menu-btn { display: inline-flex; }
  .top-meta, .top .share { display: none; }
  .cover { height: 120px; }
  .page-head h2 { font-size: 30px; }
  .page-emoji { font-size: 48px; width: 60px; height: 60px; }
  .content { padding: 0 16px 96px; }
  .drawer { width: 100%; }
  .jpanel { inset: 0; width: 100%; height: 100dvh; border-radius: 0; border: 0; }
  .orb.on { display: none; }
  .prop { grid-template-columns: 120px minmax(0, 1fr); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { min-height: 0; padding: 12px; }
  .kpi .v { font-size: 22px; }
  .kpi .hint { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

/* ── Réglages ─────────────────────────────────────────────── */
.setwrap { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 32px; align-items: start; }
.setnav { position: sticky; top: 60px; display: flex; flex-direction: column; gap: 1px; }
.setnav a { display: flex; align-items: center; gap: 8px; min-height: 30px; padding: 0 8px; border-radius: 6px; color: var(--mut); font-size: 14px; }
.setnav a:hover { background: var(--hov); color: var(--text); }
.setbody { display: flex; flex-direction: column; gap: 34px; min-width: 0; max-width: 820px; }
.setsec { display: flex; flex-direction: column; scroll-margin-top: 64px; }
.setsec h3 { margin: 0 0 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); font-size: 18px; font-weight: 600; }
.setsec.danger { border: 1px solid var(--t-red-bg); border-radius: 8px; padding: 14px 16px; }
.setsec.danger h3 { color: var(--t-red); border-bottom-color: var(--t-red-bg); }
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid rgba(47, 47, 47, 0.6); flex-wrap: wrap; }
.setlab { display: flex; flex-direction: column; min-width: 200px; flex: 1 1 260px; }
.setlab b { font-weight: 500; }
.setlab small { color: var(--mut); font-size: 12px; }
.setctl { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.setctl .input[type="number"] { width: 110px; text-align: right; }
.switch { position: relative; width: 34px; height: 20px; border: 0; border-radius: 999px; background: #444; padding: 0; transition: background 0.15s; }
.switch i { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.switch.on { background: var(--blue); }
.switch.on i { transform: translateX(14px); }
.savebar { position: sticky; bottom: 16px; z-index: 20; display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 16px; border-radius: 8px; background: var(--s2); border: 1px solid var(--line2); box-shadow: var(--shadow); }
.savebar > span { flex: 1; color: var(--sub); font-size: 13px; }
@media (max-width: 860px) { .setwrap { grid-template-columns: 1fr; } .setnav { position: static; flex-direction: row; flex-wrap: wrap; } }

.err-toast { border-color: var(--t-red-bg); color: var(--t-red); }

/* Fiches : grand titre et propriétés façon page Notion */
.peek-title { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.peek-emoji { font-size: 48px; line-height: 1; }
.peek-title h2 { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -0.3px; line-height: 1.2; }
.drawer .grid.g2 { grid-template-columns: 1fr; gap: 2px !important; }
.drawer .grid.g2 > .field { display: grid; grid-template-columns: 170px minmax(0, 1fr); align-items: center; gap: 8px; min-height: 34px; }
.drawer .grid.g2 > .field > span:first-child { color: var(--mut); font-size: 14px; }
.drawer .grid.g2 > .field .input, .drawer .grid.g2 > .field .select { border-color: transparent; background: transparent; min-height: 32px; padding-left: 6px; }
.drawer .grid.g2 > .field .input:hover, .drawer .grid.g2 > .field .select:hover { background: var(--hov); }
.drawer .grid.g2 > .field .input:focus, .drawer .grid.g2 > .field .select:focus { background: var(--bg); border-color: var(--blue); }
.drawer .grid.g2 > .field .input::placeholder { color: #5f5f5f; }
@media (max-width: 860px) { .drawer .grid.g2 > .field { grid-template-columns: 120px minmax(0, 1fr); } }
.drawer .grid.g2 > .field > span.small { grid-column: 2; margin-top: -6px; font-size: 11px; color: var(--dim); }
.drawer .grid.g2 > .field > span:first-child { display: flex; align-items: center; }
