:root {
  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --canvas: #f3f3f4;
  --side: #fafafa;
  --surface: #fff;
  --ink: #17171a;
  --text: #2c2c31;
  --muted: #71717a;
  --faint: #a1a1aa;
  --line: rgba(20, 20, 24, .08);
  --hover: rgba(20, 20, 24, .05);
  --press: rgba(20, 20, 24, .08);
  --accent: #eb512f;
  --accent-2: #e6411c;
  --rim: 0 0 0 1px rgba(20, 20, 24, .06), 0 0 0 5px rgba(255, 255, 255, .62), 0 0 0 6px rgba(20, 20, 24, .035);
  --float: var(--rim), 0 14px 30px -14px rgba(20, 20, 24, .25);
  --pop: 0 0 0 1px rgba(20, 20, 24, .07), 0 20px 44px -14px rgba(20, 20, 24, .3), 0 4px 10px -4px rgba(20, 20, 24, .08);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.3, 1.45, .5, 1);
  --panel-w: 372px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font: 400 13.5px/1.4 var(--font);
  color: var(--text);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: rgba(232, 80, 47, .2); }

.app { display: grid; grid-template-columns: 272px minmax(0, 1fr); height: 100dvh; }

/* ---------- colonne de gauche ---------- */

.side { display: flex; flex-direction: column; min-height: 0; padding: 16px 12px 10px; background: var(--side); box-shadow: 1px 0 0 rgba(20, 20, 24, .05), 16px 0 32px -26px rgba(20, 20, 24, .3); z-index: 30; }
.brand { display: block; width: fit-content; padding: 6px 10px 18px; color: var(--ink); border-radius: 10px; }
.brand .logo { height: 27px; }
.mark, .logo { display: block; background: currentColor; -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; }
.mark { --m: url(/silk-mark.png); aspect-ratio: 223 / 166; }
.logo { --m: url(/silk-logo.png); aspect-ratio: 551 / 166; }

.search { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 13px; margin-bottom: 12px; border-radius: 19px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); transition: box-shadow .15s; }
.search:focus-within { box-shadow: 0 0 0 1.5px var(--accent), 0 0 0 5px rgba(235, 81, 47, .14); }
.search-icon { color: var(--faint); }
.search-icon svg { width: 16px; height: 16px; }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; padding: 0; }
.search input::placeholder { color: var(--faint); }
.search input::-webkit-search-cancel-button { display: none; }
.search kbd { font: 500 11px/1 var(--font); color: var(--faint); padding: 3px 6px; border-radius: 6px; background: var(--hover); }
.search:focus-within kbd, .search input:not(:placeholder-shown) ~ kbd { display: none; }
.search input:placeholder-shown ~ .scope-x { display: none; }

.nav { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -4px; padding: 2px 4px; scrollbar-width: thin; scrollbar-color: rgba(20, 20, 24, .15) transparent; }
.row { position: relative; display: flex; align-items: center; border-radius: 16px; transition: background .12s; }
.row:hover { background: var(--hover); }
.row.on { background: var(--surface); box-shadow: 0 0 0 1px var(--line), 0 6px 14px -10px rgba(20, 20, 24, .35); }
.row-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 12px 0 8px; border: 0; background: none; text-align: left; border-radius: 16px; }
.row-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 600; font-size: 15px; letter-spacing: -.012em; }
.row-n { color: var(--faint); font-variant-numeric: tabular-nums; font-size: 13px; }
.row-icon { display: grid; place-items: center; flex: none; width: 16px; height: 16px; color: var(--muted); }
.row-icon.src svg { width: 13px; height: 13px; }
.row-icon b { font-weight: 600; font-size: 12px; line-height: 1; }
.row-more { position: absolute; right: 6px; display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 9px; background: var(--side); color: var(--muted); opacity: 0; }
.row.on .row-more { background: var(--surface); }
.row-more svg { width: 16px; height: 16px; }
.row:hover .row-more, .row-more:focus-visible, .row-more[aria-expanded="true"] { opacity: 1; }

/* Un sous-groupe : en retrait sous son groupe, relié par un coude */
.row.sub, .row-edit.sub { margin-left: 32px; }
.row.sub .row-main { height: 46px; gap: 10px; }
.row.sub .row-label { font-weight: 450; font-size: 13.5px; letter-spacing: 0; color: var(--text); }
.row.sub.on .row-label { font-weight: 550; color: var(--ink); }
.row.sub::before, .row-edit.sub::before { content: ''; position: absolute; left: -15px; top: -8px; width: 11px; height: 31px; border: solid #d6d6dc; border-width: 0 0 1.5px 1.5px; border-bottom-left-radius: 9px; pointer-events: none; }

/* La petite pile d'images qui identifie un groupe */
.stack { position: relative; flex: none; width: 54px; height: 44px; }
.stack i { position: absolute; width: 38px; height: 30px; border-radius: 7px; background: #e4e4e7 50% 0 / cover no-repeat; box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(20, 20, 24, .05), 0 5px 9px -4px rgba(20, 20, 24, .45); transition: rotate .3s var(--spring), translate .3s var(--spring); }
.stack i:first-child { left: 3px; top: 4px; rotate: -9deg; }
.stack i:last-child { left: 13px; top: 9px; rotate: 4deg; }
.stack.one i { left: 8px; top: 7px; rotate: -3deg; }
.row:hover .stack i:first-child { rotate: -15deg; translate: -2px 0; }
.row:hover .stack i:last-child { rotate: 7deg; translate: 2px 0; }
.stack.small { width: 40px; height: 32px; }
.stack.small i { width: 28px; height: 22px; border-radius: 6px; }
.stack.small i:first-child { left: 2px; top: 3px; }
.stack.small i:last-child { left: 10px; top: 7px; }
.stack.small.one i { left: 6px; top: 5px; }
.stack.empty i { left: 8px; top: 7px; rotate: -3deg; background: rgba(255, 255, 255, .6); box-shadow: none; outline: 1.5px dashed #cdcdd4; outline-offset: -1px; }
.stack.small.empty i { left: 6px; top: 5px; }

/* Un titre de section : il nomme ce qui suit et porte l'ajout */
.sec { display: flex; align-items: center; justify-content: space-between; height: 32px; margin-top: 14px; padding: 0 6px 0 10px; color: var(--muted); font-weight: 500; font-size: 13px; }
.sec .icon-btn { width: 26px; height: 26px; border-radius: 8px; }
.sec .icon-btn svg { width: 16px; height: 16px; }

/* Une source : son picto occupe la place de la pile, pour que les noms s'alignent sur ceux des groupes */
.row.source .row-main { height: 42px; }
.row.source .row-label { font-weight: 450; font-size: 14px; letter-spacing: 0; color: var(--text); }
.row.source.on .row-label { font-weight: 550; color: var(--ink); }
.row.source .row-icon { width: 54px; }
.row.source .row-icon svg { width: 15px; height: 15px; }

.row-edit { position: relative; display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 12px 0 8px; border-radius: 16px; background: var(--surface); box-shadow: 0 0 0 1.5px var(--accent), 0 0 0 5px rgba(235, 81, 47, .14); }
.row-edit.sub { height: 46px; gap: 10px; }
.row-edit input { flex: 1; min-width: 0; border: 0; outline: none; background: none; padding: 0; font-weight: 600; font-size: 15px; }
.row-edit.sub input { font-weight: 450; font-size: 13.5px; }

.side-foot { display: flex; align-items: center; justify-content: flex-end; gap: 2px; padding-top: 10px; margin-top: 8px; border-top: 1px solid var(--line); }
.foot-btn { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 10px; background: none; color: var(--muted); }
.foot-btn svg { width: 18px; height: 18px; }
.scrim { display: none; }

/* ---------- zone principale ---------- */

.main { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
.pill { display: flex; align-items: center; height: 40px; border-radius: 13px; background: var(--surface); box-shadow: var(--float); }

.top { position: absolute; z-index: 8; top: 16px; left: 18px; right: 18px; display: flex; align-items: center; gap: 12px; pointer-events: none; transition: right .4s var(--ease); }
.top > * { pointer-events: auto; }
.app.has-panel .top { right: calc(var(--panel-w) + 30px); }
.icon-only { justify-content: center; width: 40px; border: 0; color: var(--ink); }
.icon-only svg { width: 18px; height: 18px; }
.narrow-only { display: none; }

.scope { gap: 9px; padding: 0 14px; min-width: 0; margin-right: auto; }
.scope h1 { font-size: 14px; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scope-n { color: var(--faint); font-variant-numeric: tabular-nums; }
.scope-x { display: grid; place-items: center; width: 24px; height: 24px; margin: 0 -6px 0 -2px; border: 0; border-radius: 7px; background: none; color: var(--muted); }
.scope-x svg { width: 15px; height: 15px; }
.scope .row-icon.src svg { width: 13px; height: 13px; }

.seg { padding: 4px; gap: 2px; flex: none; }
.seg button { display: flex; align-items: center; justify-content: center; gap: 6px; width: 40px; height: 32px; padding: 0; border: 0; border-radius: 9px; background: none; color: var(--muted); font-weight: 500; transition: background .15s, color .15s; }
.seg-icon svg { width: 18px; height: 18px; }
#view-seg { margin-left: auto; }
/* Dans la vue en piles, ce qu'on regarde se lit sur la vue elle-même. */
.app[data-view="web"]:not(.searching) .scope { display: none; }
.app[data-view="grid"] .web-only { display: none; }

/* ---------- la toile ---------- */

.stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; background: var(--canvas); }
.stage.grabbing { cursor: grabbing; }
.dots { position: absolute; inset: 0; pointer-events: none; background-image: radial-gradient(circle, rgba(20, 20, 24, .17) 1px, transparent 1.5px); }
.threads { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.world { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-origin: 0 0; }

.core { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 2; }
/* Le centre : un disque clair, de la même matière que les groupes, avec le signe de Silk */
.core-in { position: absolute; left: -44px; top: -44px; display: grid; place-items: center; width: 88px; height: 88px; padding: 0; border: 0; border-radius: 50%; background: var(--surface); color: var(--ink); box-shadow: var(--rim), 0 14px 26px -14px rgba(20, 20, 24, .42); transition: filter .18s; }
.core-in .mark { width: 56px; translate: -14% 0; }
.core-in:hover { filter: brightness(.97); }

/* Un groupe : fermé, une pile de ses trois dernières images et son étiquette ; ouvert, un disque */
.hub { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 2; transition: opacity .3s; }
/* !important : un sous-groupe replié reste invisible même quand un survol met les autres piles en retrait */
.hub.born, .hub.gone, .hub.hid { opacity: 0 !important; pointer-events: none; }
.hub.dim { opacity: .3; }
.hub-body { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.pile-cards { position: absolute; left: 0; top: -30px; width: 0; height: 0; transition: opacity .25s, scale .4s var(--spring); }
.pc { position: absolute; left: calc(var(--w) / -2); top: calc(var(--h) / -2); width: var(--w); height: var(--h); display: grid; place-items: center; overflow: hidden; border-radius: 13px; background: var(--tint, #ececef); box-shadow: 0 0 0 4px #fff, 0 0 0 5px rgba(20, 20, 24, .06), 0 14px 24px -10px rgba(20, 20, 24, .4); cursor: pointer; transition: transform .45s var(--spring); }
.pc img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; pointer-events: none; }
.pc svg { width: 26px; height: 26px; }
.pc b { font-size: 26px; font-weight: 600; }
.pc:nth-child(1) { transform: translate(-36px, 2px) rotate(-11deg); }
.pc:nth-child(2) { transform: translate(-8px, -8px) rotate(-3deg); }
.pc:nth-child(3) { transform: translate(22px, 4px) rotate(5deg); }
.hub.pile:hover .pc:nth-child(1), .hub.pile.near .pc:nth-child(1), .hub.drop .pc:nth-child(1) { transform: translate(-58px, 6px) rotate(-17deg); }
.hub.pile:hover .pc:nth-child(2), .hub.pile.near .pc:nth-child(2), .hub.drop .pc:nth-child(2) { transform: translate(-8px, -20px) rotate(-2deg); }
.hub.pile:hover .pc:nth-child(3), .hub.pile.near .pc:nth-child(3), .hub.drop .pc:nth-child(3) { transform: translate(42px, 6px) rotate(10deg); }
/* Une ou deux images : pas d'éventail. Une seule se redresse et se soulève ; deux s'écartent de part et d'autre. */
.hub.one .pc:nth-child(3) { transform: rotate(-4deg); }
.hub.one.pile:hover .pc:nth-child(3), .hub.one.pile.near .pc:nth-child(3), .hub.one.drop .pc:nth-child(3) { transform: translate(0, -9px) rotate(0deg) scale(1.05); }
.hub.two .pc:nth-child(2) { transform: translate(-18px, -4px) rotate(-7deg); }
.hub.two .pc:nth-child(3) { transform: translate(16px, 4px) rotate(5deg); }
.hub.two.pile:hover .pc:nth-child(2), .hub.two.pile.near .pc:nth-child(2), .hub.two.drop .pc:nth-child(2) { transform: translate(-36px, -4px) rotate(-12deg); }
.hub.two.pile:hover .pc:nth-child(3), .hub.two.pile.near .pc:nth-child(3), .hub.two.drop .pc:nth-child(3) { transform: translate(32px, 6px) rotate(9deg); }
.hub.empty .pc:nth-child(3), .hub.empty.pile:hover .pc:nth-child(3), .hub.empty.pile.near .pc:nth-child(3), .hub.empty.drop .pc:nth-child(3) { transform: rotate(-3deg); background: rgba(255, 255, 255, .55); box-shadow: none; outline: 1.5px dashed #c9c9d1; outline-offset: -1px; }
.hub.open .pile-cards, .hub.trail .pile-cards { opacity: 0; scale: .35; pointer-events: none; }

.hub-in { position: absolute; left: 0; translate: -50% -50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: var(--pw, 120px); height: 58px; padding: 0 16px; border: 0; border-radius: 22px; background: var(--surface); color: var(--ink); box-shadow: var(--rim), 0 14px 26px -14px rgba(20, 20, 24, .42); transition: width .4s var(--ease), height .4s var(--ease), border-radius .4s var(--ease), transform .3s var(--spring), box-shadow .2s; touch-action: none; }
.hub-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: 17px; line-height: 1.12; letter-spacing: -.02em; }
.hub-n { color: var(--faint); font-size: 14px; line-height: 1; font-variant-numeric: tabular-nums; }
.hub.open .hub-in, .hub.trail .hub-in { width: 112px; height: 112px; border-radius: 56px; padding: 0 10px; }
.hub.open .hub-name, .hub.trail .hub-name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; white-space: normal; text-align: center; text-wrap: balance; font-size: 16px; }
.hub.trail .hub-in { color: var(--muted); }
.hub-in:hover, .hub.near .hub-in { transform: scale(1.04); }
.hub.drop .hub-in { transform: scale(1.08); box-shadow: 0 0 0 2px var(--accent), 0 0 0 9px rgba(235, 81, 47, .16), 0 14px 26px -14px rgba(20, 20, 24, .42); }
.hub.bump .hub-body { animation: bump .55s var(--spring); }
@keyframes bump { 35% { transform: scale(1.09); } }
.world.focus .hub:not(.near) { opacity: .62; }
.world.focus .hub.dim:not(.near) { opacity: .22; }

/* Une inspiration du groupe ouvert : une carte à la forme de son image, légèrement penchée */
.n { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 3; transition: opacity .25s; }
.n-in { position: absolute; left: calc(var(--w) / -2); top: calc(var(--h) / -2); width: var(--w); height: var(--h); padding: 0; border: 0; border-radius: 14px; background: none; rotate: var(--r); transition: scale .35s var(--spring), rotate .35s var(--spring), opacity .2s; touch-action: none; -webkit-tap-highlight-color: transparent; }
.n-face { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; border-radius: 14px; background: var(--tint, #ececef); box-shadow: 0 0 0 4px #fff, 0 0 0 5px rgba(20, 20, 24, .06), 0 16px 26px -12px rgba(20, 20, 24, .42); transition: box-shadow .2s; }
.n-face img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; opacity: 0; transition: opacity .4s; pointer-events: none; }
.n-face img.on { opacity: 1; }
.n-src { position: absolute; right: -8px; bottom: -8px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px rgba(20, 20, 24, .07), 0 3px 6px rgba(20, 20, 24, .18); }
.n-src svg { width: 12px; height: 12px; }
.n-src b { font-weight: 600; font-size: 12px; line-height: 1; }
.n.bare .n-face { align-content: center; gap: 8px; padding: 12px; background: #fff; }
.n.bare .n-face svg { width: 22px; height: 22px; }
.n.bare .n-face b { font-weight: 600; font-size: 22px; line-height: 1; }
.n.bare .n-face em { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; font-style: normal; font-size: 12.5px; line-height: 1.25; color: var(--text); text-align: center; overflow-wrap: anywhere; }
.n.bare .n-src { display: none; }
.n.born .n-in, .n.gone .n-in { scale: .2; opacity: 0; }
.n:hover, .n.near, .n.sel, .n.drag { z-index: 5; }
.n:hover .n-in, .n.near .n-in { scale: 1.07; rotate: 0deg; }
.n.drag .n-in { scale: 1.1; rotate: 0deg; cursor: grabbing; }
.n.drag .n-face { box-shadow: 0 0 0 4px #fff, 0 0 0 5px rgba(20, 20, 24, .06), 0 28px 40px -14px rgba(20, 20, 24, .5); }
.n.dim { opacity: .2; }
.world.focus .n:not(.near) { opacity: .66; }
.world.focus .n.dim:not(.near) { opacity: .14; }

/* Sélection : quatre coins, comme un viseur */
.n.sel .n-in::before {
  content: ''; position: absolute; inset: -12px; pointer-events: none;
  --b: var(--accent);
  background:
    linear-gradient(var(--b) 0 0) 0 0 / 11px 2px, linear-gradient(var(--b) 0 0) 0 0 / 2px 11px,
    linear-gradient(var(--b) 0 0) 100% 0 / 11px 2px, linear-gradient(var(--b) 0 0) 100% 0 / 2px 11px,
    linear-gradient(var(--b) 0 0) 0 100% / 11px 2px, linear-gradient(var(--b) 0 0) 0 100% / 2px 11px,
    linear-gradient(var(--b) 0 0) 100% 100% / 11px 2px, linear-gradient(var(--b) 0 0) 100% 100% / 2px 11px;
  background-repeat: no-repeat;
  animation: aim .3s var(--spring);
}
@keyframes aim { from { inset: -24px; opacity: 0; } }

/* Lien en cours de lecture : un cercle en pointillés qui tourne */
.n.pending .n-face::after, .card.pending .card-img::after, .pc.pending::after { content: ''; position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px; border-radius: 50%; border: 2px dashed #b4b4bd; animation: spin 2.6s linear infinite; }
.n.pending .n-face > * { opacity: 0; }
@keyframes spin { to { rotate: 1turn; } }

.peek { position: absolute; left: 0; top: 0; z-index: 6; display: grid; gap: 3px; max-width: 280px; padding: 8px 12px 9px; border-radius: 13px; background: var(--ink); color: #fff; box-shadow: 0 14px 28px -12px rgba(20, 20, 24, .55); pointer-events: none; opacity: 0; scale: .95; transition: opacity .14s, scale .22s var(--spring); }
.peek.on { opacity: 1; scale: 1; }
.peek strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-weight: 500; font-size: 13px; line-height: 1.3; }
.peek span { display: flex; align-items: center; gap: 6px; min-width: 0; color: rgba(255, 255, 255, .62); font-size: 12px; }
.peek span svg { flex: none; width: 11px; height: 11px; color: #fff !important; }
.peek span b { font-size: 11px; font-weight: 600; color: #fff !important; }
.peek em { font-style: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.zoom { position: absolute; z-index: 8; left: 18px; bottom: 22px; flex-direction: column; width: 40px; height: auto; padding: 4px; gap: 1px; }

.zoom button { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 9px; background: none; color: var(--muted); }
.zoom button svg { width: 16px; height: 16px; }
.zoom output { padding: 4px 0; color: var(--text); font-variant-numeric: tabular-nums; font-size: 11px; }
.zoom i { width: 18px; height: 1px; margin: 3px 0; background: var(--line); }

/* ---------- barre d'ajout ---------- */

.dock { position: absolute; z-index: 9; left: 76px; right: 76px; bottom: 22px; max-width: 620px; margin-inline: auto; display: grid; justify-items: center; gap: 12px; pointer-events: none; transition: right .4s var(--ease); }
.dock > * { pointer-events: auto; }
.app.has-panel .dock { right: calc(var(--panel-w) + 40px); }
.addbar { display: flex; align-items: center; gap: 8px; width: 100%; height: 54px; padding: 0 9px 0 15px; border-radius: 18px; background: var(--surface); box-shadow: var(--rim), 0 18px 38px -16px rgba(20, 20, 24, .35); }
/* Pendant la saisie : deux traits de lumière orangée courent le long du contour. Le contour est déplié en une bande
   horizontale, le haut file vers la droite et le bas vers la gauche : la vitesse reste constante quelle que soit
   la largeur de la barre, et les deux moitiés se rejoignent exactement aux extrémités. Une seule teinte qui
   s'efface et une lueur très serrée : un grand halo flou fait une tache sur ce fond clair. */
.addbar { position: relative; }
.beam { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; filter: drop-shadow(0 0 3px rgba(235, 81, 47, .6)); transition: opacity .4s var(--ease); }
.beam i {
  --trait: rgba(235, 81, 47, 0) 0 28%, rgba(235, 81, 47, .1) 34%, rgba(235, 81, 47, .38) 41%, rgba(235, 81, 47, .82) 47%, var(--accent-2) 49.6%, rgba(235, 81, 47, 0) 50%;
  /* une bordure et pas un padding : le navigateur l'arrondit au pixel de la même façon sur les quatre côtés */
  position: absolute; inset: -1px; border: 2px solid transparent; border-radius: 19px;
  background: repeating-linear-gradient(90deg, var(--trait)) 0 0 / 200% 51% repeat-x border-box, repeating-linear-gradient(270deg, var(--trait)) 0 100% / 200% 51% repeat-x border-box;
  -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) padding-box exclude, linear-gradient(#000 0 0);
  animation: beam 3s linear infinite paused;
}
.addbar:has(input:focus) .beam { opacity: 1; }
.addbar:has(input:focus) .beam i { animation-play-state: running; }
@keyframes beam { to { background-position: -100% 0, 100% 100%; } }
@media (prefers-reduced-motion: reduce) { .beam i { animation: none; } }
.addbar-icon { color: var(--faint); }
.addbar-icon svg { width: 18px; height: 18px; }
.addbar input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: none; padding: 0; font-size: 14px; }
.addbar input::placeholder { color: var(--faint); }
.addbar-group { display: flex; align-items: center; gap: 7px; max-width: 190px; height: 34px; padding: 0 8px 0 10px; border: 0; border-radius: 10px; background: #f1f1f3; color: var(--text); }
.addbar-group span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.addbar-group svg { flex: none; width: 15px; height: 15px; color: var(--muted); }
.add-go { width: 44px; height: 38px; padding: 0; border-radius: 12px; }
.add-go svg { width: 19px; height: 19px; stroke-width: 1.8; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 13px; border: 0; border-radius: 11px; background: #f1f1f3; color: var(--ink); font-weight: 500; text-decoration: none; white-space: nowrap;  }
.btn svg { width: 16px; height: 16px; }

.hint { max-width: 100%; padding: 0 8px; color: var(--muted); font-size: 12.5px; text-align: center; text-wrap: balance; }
.hint.big { display: grid; gap: 6px; margin-bottom: 6px; }
.hint.big strong { font-weight: 600; font-size: 24px; line-height: 1.15; color: var(--ink); letter-spacing: -.03em; }
.hint.big span { font-size: 14px; }
.hint button { border: 0; background: none; padding: 0; color: var(--faint); text-decoration: underline; text-underline-offset: 2px; }
.hint button:hover { color: var(--ink); }

/* Le message en bas de page : la même matière que les pastilles du haut et la barre d'ajout. */
.toast { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 5px 0 14px; border-radius: 13px; background: var(--surface); color: var(--text); box-shadow: var(--float); animation: rise .28s var(--spring); }
.toast:not(:has(button)) { padding-right: 14px; }
.toast b { font-weight: 500; color: var(--ink); }
.toast button { height: 30px; padding: 0 11px; border-radius: 9px; font-weight: 500; white-space: nowrap; }
@keyframes rise { from { opacity: 0; translate: 0 8px; } }

/* ---------- grille ---------- */

.wall { position: absolute; inset: 0; overflow-y: auto; padding: 78px 18px 130px; scrollbar-width: thin; scrollbar-color: rgba(20, 20, 24, .18) transparent; }
/* Les cartes s'effacent en passant sous la barre d'ajout */
.app[data-view="grid"] .main::after { content: ''; position: absolute; z-index: 7; inset: auto 0 0; height: 124px; background: linear-gradient(to top, var(--canvas) 18%, rgba(243, 243, 244, 0)); pointer-events: none; }
.app.has-panel .wall { padding-right: calc(var(--panel-w) + 30px); }
.cols { display: flex; gap: 14px; align-items: flex-start; }
.col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.card { display: block; width: 100%; padding: 6px 6px 0; border: 0; border-radius: 17px; background: var(--surface); text-align: left; box-shadow: 0 0 0 1px rgba(20, 20, 24, .05), 0 6px 14px -8px rgba(20, 20, 24, .16); transition: translate .25s var(--ease), box-shadow .25s; }
.card:hover { translate: 0 -2px; box-shadow: 0 0 0 1px rgba(20, 20, 24, .06), 0 16px 26px -14px rgba(20, 20, 24, .3); }
.card.sel { box-shadow: 0 0 0 2px var(--accent), 0 16px 26px -14px rgba(20, 20, 24, .3); }
.card-img { position: relative; overflow: hidden; border-radius: 12px; background: #ececef; }
.card-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; }
.card-img svg { width: 30px; height: 30px; }
.card-img b { font-size: 30px; font-weight: 600; }
.card.bare .card-img { display: grid; place-items: center; background: #f4f4f5; }
.card-meta { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 6px; }
.card-src { flex: none; display: grid; place-items: center; width: 14px; }
.card-src svg { width: 12px; height: 12px; }
.card-src b { font-size: 12px; font-weight: 600; line-height: 1; }
.card-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.wall-empty { display: grid; place-content: center; justify-items: center; gap: 8px; height: 100%; color: var(--muted); text-align: center; }
.wall-empty strong { font-weight: 600; font-size: 24px; line-height: 1.15; color: var(--ink); letter-spacing: -.03em; }

/* ---------- panneau de détail ---------- */

.panel { position: fixed; z-index: 20; top: 12px; right: 12px; bottom: 12px; width: var(--panel-w); display: flex; flex-direction: column; border-radius: 22px; background: var(--surface); box-shadow: var(--pop); animation: slide .42s var(--ease); overflow: hidden; }
@keyframes slide { from { translate: 40px 0; opacity: 0; } }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 10px 16px; }
.panel-src { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; color: var(--muted); }
.panel-src svg { flex: none; width: 14px; height: 14px; }
.panel-src b { font-size: 14px; font-weight: 600; line-height: 1; }
.panel-src span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 9px; background: none; color: var(--muted); }
.icon-btn svg { width: 17px; height: 17px; }
.panel-body { flex: 1; min-height: 0; overflow: hidden auto; padding: 0 16px 16px; scrollbar-width: thin; scrollbar-color: rgba(20, 20, 24, .15) transparent; }
.panel-img { position: relative; display: block; width: 100%; padding: 0; border: 0; overflow: hidden; border-radius: 14px; background: #ececef; max-height: 46vh; box-shadow: inset 0 0 0 1px rgba(20, 20, 24, .05); cursor: zoom-in; }
.panel-img img { display: block; width: 100%; max-height: 46vh; object-fit: contain; }
.panel-img::after { content: ''; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(20, 20, 24, .06); pointer-events: none; }
.panel-drop { display: grid; place-content: center; justify-items: center; gap: 10px; min-height: 170px; padding: 20px; border-radius: 14px; border: 1.5px dashed #cfcfd6; color: var(--muted); text-align: center; line-height: 1.45; text-wrap: balance; }
.panel-drop svg { width: 22px; height: 22px; color: var(--faint); }
.panel.over .panel-drop, .panel.over .panel-img { outline: 2px solid var(--accent); outline-offset: 3px; }
.panel-title { display: block; width: 100%; margin: 14px 0 0; padding: 4px 6px; margin-left: -6px; width: calc(100% + 12px); border: 0; border-radius: 8px; outline: none; background: none; resize: none; overflow: hidden; font-size: 17px; font-weight: 500; line-height: 1.3; color: var(--ink); letter-spacing: -.005em; field-sizing: content; }
.panel-title:hover { background: var(--hover); }
.panel-title:focus { background: var(--surface); box-shadow: 0 0 0 1.5px var(--accent), 0 0 0 5px rgba(235, 81, 47, .14); }
.panel-desc { margin-top: 6px; color: var(--muted); line-height: 1.5; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; overflow: hidden; overflow-wrap: anywhere; }
.panel-actions { display: flex; gap: 8px; margin-top: 14px; }
.panel-actions .btn.primary { flex: 1; min-width: 0; }
.panel h3 { margin: 22px 0 9px; font-size: 12.5px; font-weight: 400; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; height: 30px; padding: 0 10px 0 9px; border: 0; border-radius: 9px; background: none; box-shadow: inset 0 0 0 1px var(--line); color: var(--text); transition: background .15s, box-shadow .15s; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip svg { width: 14px; height: 14px; margin: 0 -2px; color: var(--muted); }
.chip.new { color: var(--muted); }
.chip-input { height: 30px; width: 150px; padding: 0 9px; border: 0; border-radius: 9px; outline: none; box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 0 5px rgba(235, 81, 47, .14); }
.panel-note { display: block; width: 100%; min-height: 84px; padding: 10px 11px; border: 0; border-radius: 12px; outline: none; background: #f6f6f7; resize: vertical; line-height: 1.5; field-sizing: content; }
.panel-note::placeholder { color: var(--faint); }
.panel-note:focus { background: var(--surface); box-shadow: 0 0 0 1.5px var(--accent), 0 0 0 5px rgba(235, 81, 47, .14); }
.panel-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 4px; margin: 20px -6px 0; padding-top: 12px; border-top: 1px solid var(--line); }
.link-btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 12.5px; }
.link-btn svg { width: 15px; height: 15px; }
.link-btn.danger:hover, .link-btn.armed { color: #c2331a; background: rgba(232, 80, 47, .09); }
.panel-date { margin: 8px 6px 0; width: 100%; color: var(--faint); font-size: 12px; }

/* ---------- menus ---------- */

.menu { position: fixed; z-index: 60; min-width: 200px; max-width: 290px; max-height: min(420px, 70vh); overflow-y: auto; padding: 5px; border-radius: 14px; background: var(--surface); box-shadow: var(--pop); animation: pop .18s var(--spring); transform-origin: var(--o, top left); }
@keyframes pop { from { opacity: 0; scale: .94; } }
.menu button.item { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 32px; padding: 5px 9px; border: 0; border-radius: 9px; background: none; text-align: left; }
.menu button.item:hover, .menu button.item:focus-visible { background: var(--hover); outline: none; }
.menu button.item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu button.item svg { flex: none; width: 15px; height: 15px; color: var(--muted); }
.menu button.item.sub { padding-left: 24px; color: var(--text); }
.menu button.item.danger { color: #c2331a; }
.menu button.item.danger svg { color: inherit; }
.menu button.item.armed { background: rgba(232, 80, 47, .1); white-space: normal; }
.menu button.item.armed span { white-space: normal; }
.menu hr { height: 1px; margin: 5px 4px; border: 0; background: var(--line); }
.menu-note { padding: 9px 10px 10px; line-height: 1.5; color: var(--text); }
.menu-note p + p { margin-top: 8px; }
.menu-note small { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; }
.clip { display: inline-flex; align-items: center; gap: 7px; height: 32px; margin-top: 10px; padding: 0 12px 0 9px; border-radius: 10px; background: var(--ink); color: #fff; font-weight: 500; text-decoration: none; cursor: grab; }
.clip .mark { height: 14px; }

/* ---------- entrée ---------- */

.login { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: #000; }
.login-card { display: grid; justify-items: center; gap: 12px; width: min(320px, 100%); color: #fff; text-align: center; }

.login-card h1 { margin: 0 0 14px; }
.login-card .logo { height: 58px; translate: -5% 0; }
.login-card p { color: #8f8f98; line-height: 1.5; }
.login-card input { width: 100%; height: 46px; margin-top: 10px; padding: 0 14px; border: 0; border-radius: 13px; outline: none; background: #18181b; color: #fff; text-align: center; font-size: 15px; }
.login-card input::placeholder { color: #6f6f78; }
.login-card input:focus { box-shadow: 0 0 0 1.5px var(--accent), 0 0 0 5px rgba(235, 81, 47, .22); }
.login-card .btn { width: 100%; height: 46px; border-radius: 13px; font-size: 14.5px; }
.login-dev { display: grid; gap: 12px; width: 100%; margin-top: 18px; }
.login-card .login-note { margin: 6px 0 0; font-size: 12.5px; color: #6f6f78; }
.login-err { color: #ff8a73 !important; }
.login-card.shake { animation: shake .35s; }
@keyframes shake { 25% { translate: -6px 0; } 50% { translate: 5px 0; } 75% { translate: -3px 0; } }

/* ---------- passage toile ↔ grille ---------- */

::view-transition-group(*) { animation-duration: .5s; animation-timing-function: var(--ease); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .3s; }

/* ---------- petits écrans ---------- */

@media (max-width: 860px) {
  :root { --panel-w: 0px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: min(290px, 84vw); translate: -102% 0; transition: translate .35s var(--ease); box-shadow: var(--pop); }
  .app.side-open .side { translate: 0 0; }
  .app.side-open .scrim { display: block; position: fixed; inset: 0; z-index: 25; border: 0; background: rgba(20, 20, 24, .28); }
  .narrow-only { display: flex; }
  .top { left: 10px; right: 10px; top: 10px; gap: 8px; }
  .app.has-panel .top { right: 10px; }
  .scope { padding: 0 11px; }
  .zoom { display: none; }
  .dock, .app.has-panel .dock { left: 10px; right: 10px; bottom: 12px; }
  .addbar-group span { display: none; }
  .addbar { padding-left: 12px; }
  .wall { padding: 64px 10px 110px; }
  .app.has-panel .wall { padding-right: 10px; }
  .cols, .col { gap: 10px; }
  .panel { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 82dvh; animation-name: sheet; }
  @keyframes sheet { from { translate: 0 60px; opacity: 0; } }
  .panel-img, .panel-img img { max-height: 34vh; }
  .search kbd { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Détails d'état */
.row:has(.row-more):hover .row-n, .row:has(.row-more[aria-expanded="true"]) .row-n { visibility: hidden; }
.dock:has(.toast:not([hidden])) .hint:not(.big) { display: none; }

/* Petite pile de la colonne avec une seule image, ou vide : pas d'éventail au survol */
.row:hover .stack.one i { rotate: 0deg; translate: 0 -1px; }
.row:hover .stack.empty i { rotate: -3deg; translate: none; }

/* Tri automatique : le bouton « Ranger » de la pile À ranger, et le groupe proposé dans le panneau */
.row-act { position: absolute; right: 8px; height: 28px; padding: 0 10px; border: 0; border-radius: 9px; background: var(--ink); color: #fff; font-size: 12.5px; font-weight: 500; opacity: 0; transition: opacity .15s; }
.row:hover .row-act, .row-act:focus-visible, .row-act:disabled { opacity: 1; }
.row:has(.row-act):hover .row-n, .row:has(.row-act:disabled) .row-n { visibility: hidden; }


/* ---------- boutons ----------
   Trois matières, d'après les planches de référence : clair (par défaut), sombre (l'action d'un panneau),
   orangé (l'action de la page). Chacune a un fond, un liseré dégradé qui accroche la lumière en haut,
   un cerne fin et une ombre portée. Aucun bouton ne bouge : au survol il s'éclaircit, au clic il s'assombrit
   et perd son ombre. */

.btn, .chip, .toast button, .clip, .seg button, .icon-btn, .foot-btn, .zoom button, .scope-x, .link-btn { position: relative; }

.btn, .chip, .toast button, .row-act, .clip, .seg button[aria-pressed="true"] {
  --fill: rgba(227, 227, 227, .8); --fill-2: rgba(227, 227, 227, .8);
  --hi: #fdfdfd; --hi-2: rgba(241, 241, 241, 0);
  --ring: rgba(0, 0, 0, .16); --drop: 0 2px 4px rgba(0, 0, 0, .1); --over: 1.04;
  --fg: #2b2b30;
  border: 0;
  background: linear-gradient(var(--fill), var(--fill-2));
  color: var(--fg);
  box-shadow: 0 0 0 1px var(--ring), var(--drop);
  transition: box-shadow .18s, filter .18s, color .18s;
}
/* le liseré : un dégradé dessiné seulement sur un pixel de bord */
.btn::before, .chip::before, .toast button::before, .row-act::before, .clip::before, .seg button::before,
.icon-btn::before, .foot-btn::before, .zoom button::before, .row-more::before, .scope-x::before, .link-btn::before {
  content: ''; position: absolute; inset: 0; padding: 1px; border-radius: inherit; pointer-events: none;
  background: linear-gradient(var(--hi, #fdfdfd), var(--hi-2, rgba(241, 241, 241, 0)));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.btn:hover, .chip:hover, .toast button:hover, .row-act:hover, .clip:hover, .seg button[aria-pressed="true"]:hover { filter: brightness(var(--over)); }
.btn:active, .chip:active, .toast button:active, .row-act:active, .clip:active, .seg button[aria-pressed="true"]:active {
  filter: brightness(.93); box-shadow: 0 0 0 1px var(--ring); transition-duration: .06s;
}
.btn:disabled, .row-act:disabled { filter: saturate(.25) opacity(.6); cursor: default; }

/* sombre */
.btn.primary, .chip[aria-pressed="true"] {
  --fill: #201e25; --fill-2: #323137; --hi: #4b4951; --hi-2: #313036; --ring: #0d0d0d; --fg: #ececee; --over: 1.22;
}
.chip[aria-pressed="true"] svg { color: #ececee !important; }
.chip[aria-pressed="true"] { font-weight: 500; }

/* orangé : un cerne fin, un ton plus foncé que le fond */
.btn.accent, .row-act, .clip, .chip.suggest {
  --fill: var(--accent); --fill-2: var(--accent-2); --hi: rgba(255, 255, 255, .56); --hi-2: rgba(255, 255, 255, 0);
  --ring: #b9351b; --drop: 0 1px 2px rgba(62, 22, 13, .5); --over: 1.07;
  --fg: #f0f0f0; text-shadow: 0 0 .5px #fff;
}
.chip.suggest svg { color: #f0f0f0; }
.btn.accent svg { stroke-width: 1.9; }

.chip.new { --fg: var(--muted); }

/* Boutons discrets (icônes, liens du panneau, vue non choisie) : la matière n'apparaît qu'au survol. */
.icon-btn, .foot-btn, .zoom button, .row-more, .scope-x, .link-btn, .seg button:not([aria-pressed="true"]) {
  border: 0; transition: box-shadow .18s, background .18s, color .18s, filter .18s;
}
.icon-btn::before, .foot-btn::before, .zoom button::before, .row-more::before, .scope-x::before, .link-btn::before, .seg button:not([aria-pressed="true"])::before { opacity: 0; transition: opacity .18s; }
.icon-btn:hover, .foot-btn:hover, .zoom button:hover, .row-more:hover, .scope-x:hover, .link-btn:hover, .seg button:not([aria-pressed="true"]):hover {
  background: rgba(227, 227, 227, .8); color: var(--ink); box-shadow: 0 0 0 1px rgba(0, 0, 0, .14), 0 2px 4px rgba(0, 0, 0, .08);
}
.icon-btn:hover::before, .foot-btn:hover::before, .zoom button:hover::before, .row-more:hover::before, .scope-x:hover::before, .link-btn:hover::before, .seg button:not([aria-pressed="true"]):hover::before { opacity: 1; }
.icon-btn:active, .foot-btn:active, .zoom button:active, .row-more:active, .scope-x:active, .link-btn:active, .seg button:not([aria-pressed="true"]):active {
  filter: brightness(.93); box-shadow: 0 0 0 1px rgba(0, 0, 0, .14); transition-duration: .06s;
}
.link-btn.danger:hover, .link-btn.armed { color: #c2331a; }

/* Le choix du groupe dans la barre d'ajout est une liste déroulante, pas un bouton : un champ plat,
   dont le chevron se retourne et le contour s'allume tant que la liste est ouverte. */
.addbar-group { cursor: pointer; box-shadow: inset 0 0 0 1px rgba(20, 20, 24, .07); transition: background .15s, box-shadow .15s; }
.addbar-group:hover { background: #e9e9ec; }
.addbar-group svg { transition: rotate .22s var(--ease); }
.addbar-group[aria-expanded="true"] { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--accent); }
.addbar-group[aria-expanded="true"] svg { rotate: 180deg; color: var(--ink); }

/* Le menu « pour mon navigateur » : l'extension d'abord, le bouton de favoris ensuite */
.menu-note strong { font-weight: 600; color: var(--ink); }
.menu-note .dl { width: 100%; margin-top: 10px; }
.menu-note hr { margin: 12px 0 10px; }
.menu:has(.menu-note) { max-width: 300px; }

/* ---------- vue en grand ----------
   L'application s'estompe derrière, l'image est incrustée dans une carte blanche à double liseré dont la largeur suit
   ses proportions (--r). Les flèches restent aux bords de l'écran : elles ne bougent pas d'une image à l'autre. */
.viewer { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; padding: 20px 76px; background: rgba(243, 243, 244, .62); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); animation: veil .24s var(--ease); }
@keyframes veil { from { opacity: 0; } }
.viewer-card { --hmax: calc(100dvh - 124px); --wmax: min(1240px, calc(100vw - 172px)); box-sizing: content-box; width: max(min(540px, calc(100vw - 44px)), min(var(--wmax), calc(var(--hmax) * var(--r)))); padding: 10px 10px 0; border-radius: 28px; background: var(--surface); box-shadow: var(--rim), 0 30px 60px -24px rgba(20, 20, 24, .4); transition: width .28s var(--ease); animation: viewer-in .32s var(--ease); }
@keyframes viewer-in { from { opacity: 0; scale: .97; } }
.viewer-img { position: relative; height: min(var(--hmax), calc(var(--wmax) / var(--r))); overflow: hidden; border-radius: 19px; background: #ececef center / contain no-repeat; box-shadow: inset 0 0 0 1px rgba(20, 20, 24, .06); transition: height .28s var(--ease); }
.viewer-img img { display: block; width: 100%; height: 100%; object-fit: contain; transition: opacity .18s; }
.viewer-img.loading img { opacity: 0; }
.viewer-x { position: absolute; top: 12px; right: 12px; width: 36px; padding: 0; border-radius: 50%; }
.viewer-x svg { width: 16px; height: 16px; }
.viewer-foot { display: flex; align-items: center; gap: 14px; height: 72px; padding: 0 8px; }
.viewer-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.viewer-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 15px; letter-spacing: -.012em; color: var(--ink); }
.viewer-src { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--muted); font-size: 12.5px; }
.viewer-src span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-src svg { flex: none; width: 12px; height: 12px; }
.viewer-src b { font-weight: 600; font-size: 12px; line-height: 1; }
.viewer-n { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.viewer-foot .btn { flex: none; }
.viewer-nav { position: absolute; z-index: 1; top: 50%; left: 18px; width: 44px; height: 44px; margin-top: -22px; padding: 0; border-radius: 50%; }
.viewer-nav.next { left: auto; right: 18px; }
.viewer-nav svg { width: 20px; height: 20px; rotate: 90deg; }
.viewer-nav.next svg { rotate: -90deg; }
@media (max-width: 860px) {
  .viewer { padding: 12px; }
  .viewer-card { --hmax: calc(100dvh - 172px); --wmax: calc(100vw - 44px); width: var(--wmax); }
  .viewer-foot { flex-wrap: wrap; align-content: center; height: 118px; row-gap: 10px; }
  .viewer-foot .btn { width: 100%; }
  .viewer-nav { left: 20px; width: 38px; height: 38px; margin-top: -19px; }
  .viewer-nav.next { right: 20px; }
}

/* ---------- compte et toiles ---------- */

/* Le choix de la toile est une liste déroulante : il reprend l'allure du choix de groupe de la barre d'ajout. */
.canvas-pick { width: 100%; max-width: none; height: 38px; flex: none; margin-bottom: 8px; padding: 0 10px 0 13px; border-radius: 12px; font-weight: 500; text-align: left; }
.canvas-pick span { display: block; flex: 1; min-width: 0; }
.side-account { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px 0 10px; border: 0; border-radius: 9px; background: none; text-align: left; color: var(--muted); font-size: 12.5px; transition: color .15s, background .15s; }
.side-account span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-account:hover, .side-account[aria-expanded="true"] { color: var(--ink); background: var(--hover); }

/* « Ma place » : des chiffres, sans jauge ; une ligne ne se colore que tout près de sa limite. */
.menu:has(.place) { width: 300px; max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
.place dl { display: grid; margin: 6px 0 0; }
.place-row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.place-row dt { color: var(--text); }
.place-row dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 500; color: var(--ink); white-space: nowrap; }
.place-row dd span { font-weight: 400; color: var(--muted); }
.place-row.near dd, .place-row.near dd span { color: #c2331a; }
.place-sub { margin-top: 12px !important; color: var(--muted); font-size: 12px; }
.place-warn { margin-top: 10px !important; color: #c2331a; }
.menu .chip-input { width: 100%; height: 32px; }
.pick-tag { flex: none; font-style: normal; font-weight: 400; font-size: 12px; color: var(--muted); }
.pick-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(235, 81, 47, .15); }

/* Une toile partagée : sous son nom, à qui elle est et ce que j'y peux ; chez sa propriétaire, avec combien de personnes. */
.menu button.item span small { display: block; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 12px; }
.menu-invite { display: grid; gap: 10px; padding: 9px 9px 11px; }
.menu-invite p { line-height: 1.45; color: var(--text); }
.menu-invite b { font-weight: 600; color: var(--ink); }
.menu-invite small { display: block; color: var(--muted); font-size: 12px; }
.menu-invite .btn { height: 32px; }

/* Lecture seule : la barre d'ajout laisse sa place à une phrase ; dans le panneau, les groupes sont de simples étiquettes. */
.app.readonly .addbar { display: none; }
.chip-tag { display: inline-flex; align-items: center; max-width: 100%; height: 30px; padding: 0 10px; border-radius: 9px; box-shadow: inset 0 0 0 1px var(--line); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-none { color: var(--faint); }
.login-card .login-invite { color: #d4d4d9; }

/* ---------- partager une toile ---------- */

.menu.wide { width: 372px; min-width: 0; max-width: calc(100vw - 16px); max-height: min(640px, calc(100dvh - 80px)); }
.share { display: grid; padding: 6px 8px 8px; }
.share-title { padding: 4px 2px 10px; font-weight: 600; color: var(--ink); }
/* Une personne : son nom et son adresse, puis son rôle et de quoi la retirer. Moi : une seule ligne. */
.share-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 10px 2px; border-top: 1px solid var(--line); }
.share-row > .share-who { grid-column: 1 / -1; }
.share-row:has(.share-role) > .share-who { grid-column: auto; }
.share-row > :nth-child(2) { justify-self: start; }
.share-who { min-width: 0; display: grid; gap: 1px; }
.share-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; color: var(--ink); }
.share-who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }
.share-role { color: var(--muted); font-size: 12.5px; }
.share-row .link-btn { height: 28px; margin-right: -4px; }
/* Le choix du rôle : la même matière que le choix de la vue, en plus petit */
.share-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.share-seg button { width: auto; height: 28px; padding: 0 10px; border-radius: 8px; font-size: 12.5px; }
.share-form { display: grid; gap: 8px; margin-top: 2px; padding: 12px 2px 4px; border-top: 1px solid var(--line); }
.share-label { color: var(--muted); font-size: 12.5px; }
.share-input { width: 100%; height: 36px; padding: 0 11px; border: 0; border-radius: 10px; outline: none; background: #f6f6f7; }
.share-input::placeholder { color: var(--faint); }
.share-input:focus { background: var(--surface); box-shadow: 0 0 0 1.5px var(--accent), 0 0 0 5px rgba(235, 81, 47, .14); }
.share-go { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.share-go .btn { height: 34px; }
.share-link { display: grid; gap: 10px; margin-top: 8px; padding: 12px; border-radius: 12px; background: #f6f6f7; line-height: 1.45; }
.share-link b { font-weight: 500; color: var(--ink); }
.share-link .btn { justify-self: start; height: 32px; }
.share-err { margin-top: 8px; padding: 0 2px; color: #c2331a; font-size: 12.5px; }

/* ---------- mes assistants ---------- */

.agents-lead { padding: 0 2px 10px; color: var(--muted); line-height: 1.5; }
/* Un accès : son nom et ce qu'il peut faire à gauche, « Retirer » à droite, sur une seule ligne. */
.agents .share-row > .share-who { grid-column: auto; }
.agents .share-row > :nth-child(2) { justify-self: end; }
.agents-none { padding: 10px 2px; border-top: 1px solid var(--line); color: var(--faint); }
.agents-how { display: grid; gap: 6px; margin-top: 2px; padding: 12px 2px 4px; border-top: 1px solid var(--line); }
.agents-how .share-label { margin-top: 8px; }
.agents-how .share-label:first-child { margin-top: 0; }
.agents-steps { display: grid; gap: 6px; margin: 0; padding-left: 18px; line-height: 1.5; color: var(--text); }
.agents-text { line-height: 1.5; color: var(--text); }
.agents-small { color: var(--muted); font-size: 12px; line-height: 1.45; }
.agents code { padding: 1px 5px; border-radius: 6px; background: #f1f1f3; font: 500 12px/1.6 ui-monospace, 'SF Mono', Consolas, monospace; color: var(--ink); overflow-wrap: anywhere; }
.agents .link-btn { height: 26px; padding: 0 6px; vertical-align: middle; }
.agents-cmd { line-height: 1.6; }
.agents-form { margin-top: 0; padding-top: 0; border-top: 0; }
.agents-secret { display: block; padding: 8px 10px !important; background: var(--surface) !important; box-shadow: inset 0 0 0 1px var(--line); user-select: all; }

/* ---------- la page d'accord (OAuth) ---------- */

body.consent-page { overflow: auto; display: grid; place-items: center; min-height: 100dvh; padding: 24px 16px; }
.consent { display: grid; gap: 14px; width: min(440px, 100%); padding: 28px; border-radius: 22px; background: var(--surface); box-shadow: var(--pop); }
.consent-logo { height: 26px; color: var(--ink); margin-bottom: 4px; }
.consent h1 { font-size: 20px; font-weight: 600; line-height: 1.25; letter-spacing: -.02em; color: var(--ink); }
.consent p { line-height: 1.5; color: var(--text); }
.consent-form { display: grid; gap: 14px; }
.consent-modes { display: flex; flex-wrap: wrap; gap: 8px; }
.consent-mode { position: relative; }
.consent-mode input { position: absolute; opacity: 0; pointer-events: none; }
.consent-mode span { display: inline-flex; align-items: center; height: 36px; padding: 0 13px; border-radius: 11px; box-shadow: inset 0 0 0 1px var(--line); color: var(--text); cursor: pointer; transition: box-shadow .15s, color .15s; }
.consent-mode input:checked + span { box-shadow: inset 0 0 0 1.5px var(--accent); color: var(--ink); font-weight: 500; }
.consent-mode input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.consent-small { color: var(--muted) !important; font-size: 12.5px; }
.consent-go { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- la direction de la toile ---------- */

.dir-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; margin: 0 0 12px; padding: 8px 12px 8px 8px; border: 0; border-radius: 16px; background: none; box-shadow: inset 0 0 0 1px var(--line); text-align: left; transition: background .12s; }
.dir-row:hover { background: var(--hover); }
.dir-row.on { background: var(--surface); box-shadow: 0 0 0 1px var(--line), 0 6px 14px -10px rgba(20, 20, 24, .35); }
.dir-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.dir-text b { color: var(--ink); font-weight: 600; font-size: 15px; letter-spacing: -.012em; }
.dir-text span { color: var(--faint); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.panel-body.dir h3 small { margin-left: 4px; color: var(--faint); font-size: 12.5px; }
.panel-body.dir > #d-prop:empty + h3 { margin-top: 6px; }
.dir-list { margin: 0; padding: 0; list-style: none; }
.dir-list li { display: flex; align-items: center; gap: 9px; min-height: 36px; padding: 0 2px; border-bottom: 1px solid var(--line); line-height: 1.4; }
.dir-list li::before { content: ''; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); }
.dir-list.no li::before { background: none; box-shadow: inset 0 0 0 1.5px var(--faint); }
.dir-line { flex: 1; min-width: 0; height: 34px; margin-left: -6px; padding: 0 6px; border: 0; border-radius: 8px; outline: none; background: none; }
.dir-line:hover { background: var(--hover); }
.dir-line:focus { background: var(--surface); box-shadow: 0 0 0 1.5px var(--accent), 0 0 0 5px rgba(235, 81, 47, .14); }
.dir-add { display: inline-flex; align-items: center; gap: 6px; height: 32px; margin-top: 2px; padding: 0 8px 0 4px; border: 0; border-radius: 8px; background: none; color: var(--faint); }
.dir-add svg { width: 14px; height: 14px; }
.dir-add:hover { color: var(--muted); background: var(--hover); }
.dir-refs { display: grid; gap: 8px; }
.dir-ref { display: flex; align-items: center; gap: 4px; padding-right: 4px; border-radius: 13px; box-shadow: inset 0 0 0 1px var(--line); }
.dir-ref-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 5px; border: 0; border-radius: 13px; background: none; text-align: left; }
.dir-ref-main:hover { background: var(--hover); }
.dir-ref-main i { flex: none; width: 74px; height: 48px; border-radius: 9px; background: #ececef 50% 0 / cover no-repeat; }
.dir-ref-main > span { min-width: 0; display: grid; gap: 1px; }
.dir-ref-main b { font-weight: 500; color: var(--ink); }
.dir-ref-main > span > span { color: var(--muted); font-size: 12.5px; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.dir-ref-main > span > .dir-by { color: var(--faint); font-size: 12px; }
.dir-ref .dir-acts { margin: 0; gap: 4px; flex: none; }
.dir-none { color: var(--faint); line-height: 1.5; }
.dir-text-ro { color: var(--text); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.dir-small { margin: 12px 0 7px; color: var(--muted); font-size: 12.5px; }
.dir-prop { margin: 6px 0 4px; padding: 12px; border-radius: 14px; background: #f6f6f7; }
.dir-prop-h { color: var(--ink); font-weight: 500; }
.dir-prop .dir-small { margin-top: 10px; }
.dir-prop .dir-list li { min-height: 30px; }
.dir-acts { display: flex; gap: 8px; margin-top: 12px; }
.dir-offer { color: var(--text); line-height: 1.5; }
.btn.small { height: 30px; padding: 0 10px; border-radius: 9px; font-size: 12.5px; }
.dir-why { display: block; width: 100%; height: 36px; padding: 0 11px; border: 0; border-radius: 10px; outline: none; background: #f6f6f7; }
.dir-why::placeholder { color: var(--faint); }
.dir-why:focus { background: var(--surface); box-shadow: 0 0 0 1.5px var(--accent), 0 0 0 5px rgba(235, 81, 47, .14); }
.dir-why-ro { margin-top: 8px; color: var(--muted); }
.dir-foot { margin: 20px 0 0; padding-top: 12px; border-top: 1px solid var(--line); color: var(--faint); font-size: 12px; line-height: 1.5; }
.chip:disabled { opacity: .5; cursor: default; }
.chip-tag svg { width: 14px; height: 14px; margin-right: 6px; color: var(--muted); }

/* Envoyer dans Figma : la sélection par Ctrl+clic, et sa barre à la place de la barre d'ajout. */
.card.picked { box-shadow: 0 0 0 2px var(--ink), 0 16px 26px -14px rgba(20, 20, 24, .3); }
.pick-tick { position: absolute; z-index: 2; top: 8px; right: 8px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: #fff; box-shadow: 0 0 0 2px #fff; }
.pick-tick svg { width: 15px; height: 15px; }
.pick-bar { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 8px 0 18px; border-radius: 18px; background: var(--surface); box-shadow: var(--float); }
.pick-bar b { font-weight: 600; color: var(--ink); white-space: nowrap; }
.pick-bar .btn svg, .menu button.item.figma svg { width: 15px; height: 15px; }
.app.picking .addbar { display: none; }
.menu button.item.figma svg { color: var(--ink); }
.pick-bar .btn.primary svg { color: #fff !important; }

/* Une référence se reconnaît dans la grille et dans les piles. */
.ref-pin { position: absolute; z-index: 2; top: 8px; left: 8px; display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px 0 6px; border-radius: 7px; background: rgba(23, 23, 26, .86); color: #fff; font-size: 11.5px; font-weight: 500; }
.ref-pin svg { width: 13px; height: 13px; }
.card-tag { flex: none; color: var(--faint); font-size: 12.5px; }
.n.ref .n-face { box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--ink), 0 16px 26px -12px rgba(20, 20, 24, .42); }
.n.ref .n-in::before { content: ''; position: absolute; z-index: 3; top: -14px; left: -14px; width: 34px; height: 34px; border-radius: 50%; box-shadow: 0 0 0 3px #fff; pointer-events: none;
  background: var(--ink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='white' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 13.5V17'/%3E%3Cpath d='M7 3.5h6l-.8 4.2 2.3 2.3v1.5h-9V10l2.3-2.3z'/%3E%3C/svg%3E") center / 19px no-repeat; }
