/* Montserrat served from this origin (variable font, weights 100-900): participants' browsers contact no
   third party. Files from @fontsource-variable/montserrat 5.3.0, licence in montserrat-OFL.txt. */
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/assets/montserrat-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/assets/montserrat-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

/* DRABDA design system, 2026 identity: Montserrat, black on white, greys for sections and rules. Accents are
   fills only, never text: the post-it paper is the DRABDA yellow, cyan marks selection and wayfinding.
   Functional grammar for the app: titles 700, subtitles 600, text 400, radius 8px. */
:root {
  --white: #ffffff;
  --table: #f5f5f5;
  --rule: #e0e0e0;
  --rule-strong: #c8c8c8;
  --ink: #000000;
  --ink-soft: #666666;
  --ink-faint: #8a8a8a;
  /* Brand tokens: the product's defaults, replaced by the account's theme (public/theme.js) on its pages. */
  --accent: #56ccf2;
  --accent-ink: #000000;
  --accent-wash: #e7f8fd;
  --action: #000000;
  --action-ink: #ffffff;
  --paper: #f2c94c;
  --paper-edge: #d9ae2e;
  /* Light tint of the post-it paper: where participants propose groups of their own (never the selection,
     which uses the account's accent). */
  --paper-wash: #fdf6de;
  --danger: #b42318;
  --danger-wash: #fdecea;
  --ok: #1f7a4d;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  /* Drawers (the side navigation on small screens): the iOS sheet curve. */
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --radius-btn: 8px;
  --radius-box: 8px;
  --sidebar-w: 272px;
  --font: 'Montserrat', system-ui, sans-serif;
  /* Type scale, ratio about 1.25 */
  --t-xs: 13px;
  --t-sm: 15px;
  --t-base: 17px;
  --t-md: 21px;
  --t-lg: 27px;
  --t-xl: 34px;
  --t-2xl: 44px;
}

* { box-sizing: border-box; }
/* Components that set their own display (grid, flex) must still disappear when hidden. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-weight: 400;
  font-size: var(--t-base);
  line-height: 1.55;
  color: var(--ink);
  background: var(--white);
}
h1, h2, h3 { margin: 0; line-height: 1.12; }
h1 { font-size: var(--t-xl); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: var(--t-md); font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: var(--t-base); font-weight: 600; }
p { margin: 0; }
a { color: inherit; }
a:hover { text-decoration-thickness: 2px; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--action); outline-offset: 2px; }

/* ---------- Header of the standalone pages (participant, room screen, errors) ---------- */
.topbar {
  display: flex; align-items: center; gap: 20px; min-height: 64px;
  padding: 10px 32px; border-bottom: 1px solid var(--rule); background: var(--white);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; flex: none; color: var(--ink); }
a.brand { cursor: pointer; }
.mark { display: block; width: 26px; height: 26px; color: var(--ink); flex: none; }
.wordmark { font-weight: 700; font-size: 19px; letter-spacing: -0.03em; line-height: 1; }
/* An account's logo keeps its proportions inside the bar; without a logo its name stands in. */
.brand-logo { display: block; height: 32px; width: auto; max-width: 200px; object-fit: contain; object-position: left center; }
.brand-name { font-weight: 700; font-size: var(--t-md); letter-spacing: -0.015em; }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; font-size: var(--t-sm); }
.crumbs a { color: var(--ink-soft); text-decoration: none; cursor: pointer; white-space: nowrap; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.crumbs [aria-current] { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb-sep { color: var(--rule-strong); }

/* ---------- Page ---------- */
.page { max-width: 1120px; margin: 0 auto; padding: 48px 40px 112px; }
.page-head { display: grid; gap: 14px; }
.page-head.with-actions { grid-template-columns: 1fr auto; align-items: start; gap: 24px; }
.lede { font-size: var(--t-base); line-height: 1.5; color: var(--ink-soft); max-width: 62ch; }
.muted { color: var(--ink-soft); }
.small { font-size: var(--t-sm); }
.narrow { max-width: 640px; }
.role-line { margin-top: 4px; }
.section { margin-top: 48px; display: grid; gap: 20px; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; }
.section-head p { max-width: 70ch; margin-top: 6px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 9px 18px; border-radius: var(--radius-btn);
  border: 1px solid var(--rule-strong); background: var(--white); color: var(--ink);
  font-weight: 600; font-size: var(--t-sm); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color .12s, color .12s, border-color .12s, transform 120ms var(--ease-out);
}
.btn:hover { border-color: var(--ink); background: var(--table); }
/* Press feedback: the button gives a little under the finger. */
.btn:active:not(:disabled), .icon-btn:active, .nav-toggle:active { transform: scale(0.97); }
/* Text on the action colour: black or white, whichever reads better (public/theme.js). */
.btn-primary { background: var(--action); border-color: var(--action); color: var(--action-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--action) 80%, var(--white)); border-color: transparent; color: var(--action-ink); }
.btn-ghost { border-color: transparent; background: transparent; padding-inline: 12px; }
.btn-ghost:hover { background: var(--table); color: var(--ink); }
.btn-danger { border-color: transparent; background: transparent; color: var(--danger); padding-inline: 10px; min-height: 36px; }
.btn-danger:hover { background: var(--danger-wash); color: var(--danger); }
/* The confirming button of a destructive action (confirmAction in common.js): the action, never «OK». */
.btn-danger-solid { border-color: var(--danger); background: var(--danger); color: var(--white); }
.btn-danger-solid:hover { filter: brightness(0.92); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:disabled:hover { background: var(--white); color: var(--ink); border-color: var(--rule-strong); }
.btn-primary:disabled:hover { background: var(--action); border-color: var(--action); color: var(--action-ink); }
.btn svg { width: 18px; height: 18px; flex: none; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.field label, .field-title { font-weight: 700; font-size: var(--t-sm); }
.hint { font-size: var(--t-sm); color: var(--ink-soft); }
.input, .textarea, .select {
  width: 100%; min-height: 44px; padding: 9px 13px; border: 1px solid var(--rule-strong);
  border-radius: var(--radius-btn); background: var(--white); font-size: var(--t-base);
}
.select { width: auto; cursor: pointer; padding-right: 36px; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); outline: none; }
.input:focus-visible, .textarea:focus-visible, .select:focus-visible { outline: 3px solid var(--action); outline-offset: 1px; }
.textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.lists { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.lists .textarea { min-height: 300px; }
.form-grid { display: grid; gap: 28px; margin-top: 40px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.count { font-size: var(--t-sm); color: var(--ink-soft); }
.error { color: var(--danger); font-weight: 400; }
/* Irreversible actions, kept apart at the end of a page. */
.danger-zone {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--rule);
}
.danger-zone h2 { font-size: var(--t-md); }
.danger-zone p { max-width: 60ch; margin-top: 6px; }
.danger-zone .btn-danger { border-color: var(--danger); }
.notice {
  border-left: 4px solid var(--accent); background: var(--accent-wash);
  padding: 12px 16px; border-radius: 0 var(--radius-btn) var(--radius-btn) 0;
}
.fixed-list { margin: 0; padding: 14px 16px 14px 38px; background: var(--table); border-radius: var(--radius-btn); display: grid; gap: 8px; }
.axes-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- Activity glyphs ---------- */
.glyph { display: block; width: 100%; height: 100%; }
.study-glyph {
  display: grid; place-items: center; flex: none; width: 52px; height: 52px; padding: 10px;
  border-radius: 10px; background: var(--table); color: var(--ink);
  transition: background-color .12s, color .12s;
}
.study-glyph.is-large { width: 76px; height: 76px; padding: 14px; border-radius: 14px; background: var(--accent-wash); color: var(--accent-ink); }
.study-head { display: flex; gap: 20px; align-items: flex-start; }
.study-head > div { display: grid; gap: 12px; }

/* Activity picker */
.kinds { border: 0; margin: 0; padding: 0; display: grid; gap: 12px; min-width: 0; }
.kinds legend { padding: 0; margin-bottom: 12px; }
.kind-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.kind {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr); row-gap: 6px; align-content: start;
  padding: 10px 10px 18px; cursor: pointer; border: 2px solid var(--rule); border-radius: var(--radius-box); background: var(--white);
  transition: border-color .12s;
}
.kind:hover { border-color: var(--rule-strong); }
.kind:has(input:checked) { border-color: var(--ink); }
.kind:has(input:focus-visible) { outline: 3px solid var(--action); outline-offset: 2px; }
.kind input { position: absolute; opacity: 0; pointer-events: none; }
.kind .scene { margin-bottom: 8px; }
.kind-name { font-weight: 700; font-size: var(--t-base); padding-inline: 6px; }
.kind-desc { font-size: var(--t-sm); color: var(--ink-soft); line-height: 1.45; padding-inline: 6px; }
@media (max-width: 860px) {
  .kind-options { grid-template-columns: minmax(0, 1fr); }
  .kind { grid-template-columns: 128px minmax(0, 1fr); column-gap: 14px; align-items: center; padding: 10px; }
  .kind .scene { grid-row: 1 / span 2; margin: 0; align-self: center; }
  .kind-name { align-self: end; }
  .kind-desc { align-self: start; }
}

.tool-picks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.tool-pick {
  display: grid; row-gap: 6px; padding: 10px 10px 18px; border: 2px solid var(--rule); border-radius: var(--radius-box);
  text-decoration: none; cursor: pointer; transition: border-color .12s; height: 100%; align-content: start;
}
.tool-pick:hover { border-color: var(--ink); }
.tool-pick .scene { margin-bottom: 8px; }
@media (max-width: 860px) {
  .tool-picks { grid-template-columns: minmax(0, 1fr); }
  .tool-pick { grid-template-columns: 128px minmax(0, 1fr); column-gap: 14px; align-items: center; padding: 10px; }
  .tool-pick .scene { grid-row: 1 / span 2; margin: 0; }
  .tool-pick .kind-name { align-self: end; }
  .tool-pick .kind-desc { align-self: start; }
}

/* ---------- Activity scenes: a tabletop with paper post-its, one still in hand ---------- */
.scene {
  position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 9px;
  background-color: var(--table); background-image: radial-gradient(#d6d6d6 1px, transparent 1px); background-size: 14px 14px;
}
.scene > * { position: absolute; left: calc(var(--x) * 1%); top: calc(var(--y) * 1%); width: calc(var(--w) * 1%); height: calc(var(--h) * 1%); }
/* A group, a band: the outline participants drop into, with a stub where its name would be. */
.scene-group, .scene-band { border: 1.5px dashed var(--rule-strong); border-radius: 6px; background: rgb(255 255 255 / .6); }
.scene-group::before, .scene-band::before {
  content: ''; position: absolute; border-radius: 2px; height: 3px; background: var(--ink-faint);
}
.scene-group::before { left: 9%; top: 8%; width: 44%; }
.scene-band::before { left: 3%; top: calc(50% - 1.5px); width: 9%; }
.scene-group.is-target, .scene-band.is-target { border-style: solid; border-color: var(--accent); background: var(--accent-wash); }
.scene-group.is-target::before, .scene-band.is-target::before { background: var(--accent-ink); }
.scene-band.is-faded, .scene-note.is-faded { opacity: .45; }
.scene-quadrant.is-target { border: 1.5px dashed var(--accent); border-radius: 6px; background: var(--accent-wash); }
.scene-axis { background: var(--ink-soft); border-radius: 1px; }
.scene-axis.is-vertical { width: 2px; margin-left: -1px; }
.scene-axis.is-horizontal { height: 2px; margin-top: -1px; }
.scene-note {
  border-radius: 1px 1px 2px 7px / 1px 1px 2px 4px;
  background-color: var(--paper);
  /* Two strokes of handwriting. */
  background-image: linear-gradient(rgb(0 0 0 / .2), rgb(0 0 0 / .2)), linear-gradient(rgb(0 0 0 / .2), rgb(0 0 0 / .2));
  background-repeat: no-repeat; background-size: 62% 1.5px, 42% 1.5px; background-position: 20% 36%, 20% 58%;
  border-bottom: 1px solid var(--paper-edge);
  box-shadow: 0 1px 1px rgb(60 45 0 / .14), 1px 3px 5px -3px rgb(60 45 0 / .45);
  transform: rotate(var(--r));
}
/* The post-it in hand: lifted above the table, away from its slot. */
.scene-note.is-moving {
  z-index: 2;
  transform: translate(calc(var(--dx) * 1%), calc(var(--dy) * 1%)) rotate(var(--lift)) scale(1.1);
  box-shadow: 0 2px 2px rgb(60 45 0 / .1), 4px 12px 14px -6px rgb(60 45 0 / .55);
  transition: transform 420ms var(--ease-out), box-shadow 420ms var(--ease-out);
}
/* Pointing at an activity draws the post-it towards its slot; choosing it puts it down. */
.kind:hover .scene-note.is-moving, .tool-pick:hover .scene-note.is-moving {
  transform: translate(calc(var(--dx) * .55%), calc(var(--dy) * .55%)) rotate(calc(var(--lift) * .6)) scale(1.07);
}
.kind:has(input:checked) .scene-note.is-moving, .tool-pick:focus-visible .scene-note.is-moving {
  transform: rotate(var(--r)) scale(1);
  box-shadow: 0 1px 1px rgb(60 45 0 / .14), 1px 3px 5px -3px rgb(60 45 0 / .45);
}

/* ---------- Index lists (workspaces, studies) ---------- */
.index-list { list-style: none; margin: 40px 0 0; padding: 0; border-top: 2px solid var(--ink); }
.section .index-list { margin-top: 0; }
.index-row {
  display: flex; align-items: center; gap: 20px; padding: 22px 4px;
  border-bottom: 1px solid var(--rule); text-decoration: none; cursor: pointer;
}
.index-main { display: grid; gap: 4px; flex: 1; min-width: 0; }
.index-title { font-size: var(--t-md); font-weight: 700; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.index-desc { color: var(--ink-soft); font-size: var(--t-sm); }
/* The title keeps the room: the meta column wraps before it squeezes the title. */
.index-meta { flex: 0 1 340px; display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; justify-content: flex-end; font-size: var(--t-sm); color: var(--ink-soft); }
.index-row:hover .index-title { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.index-row:hover .study-glyph { background: var(--accent-wash); color: var(--accent-ink); }

.role-tag {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px;
  font-size: var(--t-xs); font-weight: 700; color: var(--ink); background: var(--table); white-space: nowrap;
}
.role-admin { background: var(--ink); color: var(--white); }
.role-editor { background: var(--accent-wash); color: var(--accent-ink); }
.status-pill {
  display: inline-flex; align-items: center; gap: 8px; font-size: var(--t-xs); font-weight: 700; color: var(--ink);
  padding: 4px 12px; border-radius: 999px; background: var(--table); white-space: nowrap;
}
.status-pill::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); }
.status-pill.is-open::before { background: var(--ok); }

.empty { padding: 32px; border: 2px dashed var(--rule); border-radius: var(--radius-box); color: var(--ink-soft); max-width: 70ch; }
.page-head + .empty { margin-top: 40px; }
.empty strong { display: block; color: var(--ink); font-size: var(--t-md); margin-bottom: 6px; }

/* People of a workspace */
.people { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.people li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.people-email { flex: 1; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.people .select { min-height: 40px; font-size: var(--t-sm); }
.add-person { display: grid; grid-template-columns: minmax(220px, 1fr) auto auto; gap: 12px; align-items: end; max-width: 760px; }

/* ---------- Study page ---------- */
.share { margin-top: 40px; display: grid; gap: 10px; padding: 20px; border-radius: var(--radius-box); background: var(--table); }
.share-label { font-weight: 700; font-size: var(--t-sm); }
.share-row { display: flex; gap: 8px; flex-wrap: wrap; }
/* The address to send to people added to a workspace or an account. */
.access-link { display: grid; gap: 8px; margin-top: 8px; padding: 16px 20px; border-radius: var(--radius-box); background: var(--table); }
.share-row .input { flex: 1 1 320px; font-size: var(--t-sm); border-color: var(--white); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--rule); margin-top: 48px; }
.tab {
  border: 0; background: none; padding: 12px 16px; font-weight: 700; font-size: var(--t-sm); color: var(--ink-soft);
  border-bottom: 3px solid transparent; margin-bottom: -1px; cursor: pointer;
}
.tab[aria-selected='true'] { color: var(--ink); border-bottom-color: var(--ink); }
.tab:hover { color: var(--ink); }

.matrix-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius-box); }
.matrix { border-collapse: collapse; width: 100%; font-size: var(--t-sm); }
.matrix th, .matrix td { padding: 11px 12px; border-bottom: 1px solid var(--rule); text-align: center; }
.matrix thead th { font-weight: 700; vertical-align: bottom; background: var(--white); position: sticky; top: 0; min-width: 96px; }
.matrix tbody th { text-align: left; font-weight: 400; min-width: 200px; max-width: 320px; }
.matrix tr:last-child th, .matrix tr:last-child td { border-bottom: 0; }
.matrix td.cell { font-variant-numeric: tabular-nums; }
.matrix td.top { font-weight: 700; }
.matrix td.agree { font-weight: 700; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

.responses { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.responses li { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.response-main { display: grid; gap: 4px; min-width: 0; }
.response-comment { display: flex; gap: 8px; align-items: baseline; color: var(--ink-soft); font-size: var(--t-sm); white-space: pre-line; overflow-wrap: anywhere; }
.response-comment svg { width: 14px; height: 14px; flex: none; position: relative; top: 2px; }

/* Card sorting results: what went into groups the participants proposed, with the same hatch as on the board. */
.matrix .is-proposed { border-left: 1px dashed var(--rule-strong); background-image: repeating-linear-gradient(-45deg, transparent 0 7px, rgb(0 0 0 / 0.035) 7px 14px); }
.matrix thead th.is-proposed { font-weight: 600; color: var(--ink-soft); }
.proposals { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.proposals li { display: grid; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.proposal-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.proposal-label { font-weight: 700; overflow-wrap: anywhere; }
.proposal-cards { display: flex; flex-wrap: wrap; gap: 6px; }
.proposal-chip {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 3px 10px; border: 1px dashed var(--ink-faint); border-radius: 999px;
  font-size: var(--t-sm); overflow-wrap: anywhere;
}
.response-proposals { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; font-size: var(--t-sm); color: var(--ink-soft); }

/* Card sorting: pairs placed together, with a bar for the share. */
.pairs { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.pairs li { display: grid; grid-template-columns: minmax(0, 1fr) 160px 110px; align-items: center; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.pair-labels { font-weight: 700; overflow-wrap: anywhere; }
.pair-sep { color: var(--accent-ink); padding-inline: 8px; }
.pair-bar { height: 8px; border-radius: 4px; background: var(--table); overflow: hidden; }
.pair-bar span { display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(var(--share)); }
.pair-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.pair-value .small { display: block; font-weight: 400; }
@media (max-width: 640px) {
  .pairs li { grid-template-columns: minmax(0, 1fr) 80px; }
  .pair-bar { grid-column: 1 / -1; grid-row: 2; }
}

/* Modal dialog (duplicate a study). */
.dialog { border: none; border-radius: var(--radius-box); padding: 28px; width: min(520px, calc(100vw - 32px)); color: var(--ink); background: var(--white); box-shadow: 0 24px 60px rgb(0 0 0 / 0.18); }
.dialog::backdrop { background: rgb(0 0 0 / 0.4); }
/* Dialogs (occasional): rise in place over 200ms, leave in 150ms. Modals are not anchored to a trigger, so
   they scale from their centre. Closing animates only where the browser can keep the dialog in the top layer
   (`overlay`, `display` allow-discrete); elsewhere it closes at once. */
.dialog, .dialog::backdrop {
  transition: opacity 150ms var(--ease-out), scale 150ms var(--ease-out), overlay 150ms allow-discrete, display 150ms allow-discrete;
}
.dialog:not([open]) { opacity: 0; scale: 0.98; }
.dialog:not([open])::backdrop { opacity: 0; }
.dialog[open], .dialog[open]::backdrop { transition-duration: 200ms; }
@starting-style {
  .dialog[open] { opacity: 0; scale: 0.96; }
  .dialog[open]::backdrop { opacity: 0; }
}
.dialog h2 { font-size: var(--t-lg); }

/* ---------- Participant board ---------- */
.board-head { max-width: 1440px; margin: 0 auto; padding: 36px 32px 8px; display: grid; gap: 10px; }
.board-head h1 { font-size: var(--t-xl); }
.board-head .lede { font-size: var(--t-base); }

.board {
  max-width: 1440px; margin: 0 auto; padding: 24px 32px 150px;
  display: grid; grid-template-columns: minmax(220px, 1fr) minmax(320px, 1.6fr) minmax(220px, 1fr);
  gap: 20px; align-items: start;
}
.side { display: grid; gap: 16px; align-content: start; }

.table {
  position: sticky; top: 16px;
  min-height: 420px; max-height: calc(100vh - 170px); overflow: auto;
  background-color: var(--table);
  background-image: radial-gradient(#d6d6d6 1px, transparent 1px);
  background-size: 20px 20px;
  border-radius: var(--radius-box);
  padding: 28px 20px;
  display: flex; flex-wrap: wrap; gap: 18px 14px; align-content: flex-start; justify-content: center;
}
.table:has(> .table-empty:not([hidden])) { align-content: center; }
.table.is-target { box-shadow: inset 0 0 0 3px var(--accent); }
.table-empty { align-self: center; margin: auto; text-align: center; color: var(--ink-soft); max-width: 28ch; }
.table-empty strong { display: block; color: var(--ink); font-size: var(--t-md); font-weight: 700; margin-bottom: 4px; }

.group {
  border: 2px dashed var(--rule); border-radius: var(--radius-box); background: var(--white);
  padding: 12px; min-height: 120px; cursor: pointer;
  transition: border-color .12s, background-color .12s;
}
.group.has-notes { border-style: solid; }
.group:hover { border-color: var(--rule-strong); }
.group.is-target { border-color: var(--accent); border-style: solid; background: var(--accent-wash); }
.selecting .group { border-color: var(--accent); }
.group-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.group-name { font-weight: 700; font-size: var(--t-base); overflow-wrap: anywhere; }
.group-count { font-size: var(--t-sm); color: var(--ink-soft); flex: none; font-variant-numeric: tabular-nums; }
.group-notes { display: flex; flex-wrap: wrap; gap: 8px; min-height: 40px; }
.group-hint { font-size: var(--t-sm); color: var(--ink-faint); }

/* Groups proposed by the participant (card sorting): dashed even when filled, a faint hatch and a dark tag, so
   they never read as the study's own groups; the name is written in place. */
.group.is-proposal, .group.is-proposal.has-notes {
  border-style: dashed; border-color: var(--paper-edge); background-color: var(--paper-wash);
  background-image: repeating-linear-gradient(-45deg, transparent 0 9px, rgb(0 0 0 / 0.028) 9px 18px);
}
.group.is-proposal.is-target, .selecting .group.is-proposal { border-color: var(--accent); }
.group.is-proposal.is-target { background-color: var(--accent-wash); }
.proposal-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.proposal-tag { padding: 2px 9px; border-radius: 999px; background: var(--ink); color: var(--white); font-size: var(--t-xs); font-weight: 600; }
.proposal-remove {
  display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: var(--radius-btn);
  background: none; color: var(--ink-soft); cursor: pointer; transition: background-color .12s, color .12s;
}
.proposal-remove { margin-left: auto; }
.proposal-remove:hover { background: var(--danger-wash); color: var(--danger); }
/* Open card sorting: the table and one column of the participant's own groups. */
.board.board-open { grid-template-columns: minmax(320px, 1.6fr) minmax(260px, 1fr); }
.open-empty { color: var(--ink-soft); font-size: var(--t-sm); }
.proposal-remove svg { width: 16px; height: 16px; }
.proposal-name {
  flex: 1; min-width: 0; min-height: 34px; padding: 4px 8px; border: 1px dashed var(--rule-strong); border-radius: 6px;
  background: rgb(255 255 255 / 0.85); font-weight: 700; font-size: var(--t-base); color: var(--ink); cursor: text;
}
.proposal-name::placeholder { font-weight: 400; color: var(--ink-faint); }
.proposal-name:focus { border-style: solid; border-color: var(--ink); outline: none; }
.proposal-name:focus-visible { outline: 3px solid var(--action); outline-offset: 1px; }
.propose {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 64px; padding: 12px 14px; text-align: left;
  border: 2px dashed var(--paper-edge); border-radius: var(--radius-box); background: var(--paper-wash); color: var(--ink);
  font-weight: 600; font-size: var(--t-sm); cursor: pointer; transition: border-color .12s, background-color .12s, transform 120ms var(--ease-out);
}
.propose:hover:not(:disabled) { border-color: var(--ink); }
.propose:disabled { background: var(--table); border-color: var(--rule-strong); }
.propose:active:not(:disabled) { transform: scale(0.98); }
.propose:disabled { cursor: default; color: var(--ink-soft); }
.propose:disabled svg { display: none; }
.propose svg { width: 20px; height: 20px; flex: none; }
.propose-text { display: grid; gap: 2px; }
.propose-left { font-weight: 400; font-size: var(--t-xs); color: var(--ink-soft); }

/* Post-it */
.note {
  --t: var(--tilt, 0deg);
  position: relative;
  width: 148px; min-height: 104px; padding: 14px 12px 12px;
  background: var(--paper);
  background-image: linear-gradient(180deg, rgba(0,0,0,.035) 0, rgba(0,0,0,0) 18px);
  border-bottom: 2px solid var(--paper-edge);
  border-radius: 2px 2px 3px 14px / 2px 2px 3px 6px;
  box-shadow: 0 1px 1px rgba(60,45,0,.12), 2px 6px 10px -6px rgba(60,45,0,.45);
  font-weight: 400; font-size: var(--t-sm); line-height: 1.35; overflow-wrap: anywhere;
  transform: rotate(var(--t));
  cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none;
  transition: transform 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
}
.group .note, .note.is-compact {
  --t: 0deg;
  width: auto; max-width: 100%; min-height: 0; padding: 7px 10px 6px; font-size: 14px;
  border-radius: 2px; box-shadow: 0 1px 2px rgba(60,45,0,.2);
}
@media (hover: hover) and (pointer: fine) {
  .note:hover { transform: rotate(var(--t)) translateY(-2px); }
}
.note.is-selected { outline: 3px solid var(--ink); outline-offset: 3px; }
.note.is-dragging {
  position: fixed; z-index: 1000; margin: 0; pointer-events: none; cursor: grabbing;
  transform: rotate(calc(var(--t) + 3deg)) scale(1.06);
  box-shadow: 0 2px 3px rgba(60,45,0,.15), 8px 20px 28px -10px rgba(60,45,0,.5);
}

/* First visit: the post-its land on the table as one wave */
@keyframes note-in { from { opacity: 0; translate: 0 -14px; scale: .96; } }
.note.entering { animation: note-in 420ms var(--ease-out) both; animation-delay: var(--enter-delay, 0ms); }

/* 2×2 matrix: table on the left, plane on the right. High values sit top and right. */
.board-plane { grid-template-columns: minmax(240px, 1fr) minmax(360px, 2.2fr); }
.plane-wrap { display: grid; grid-template-columns: auto 1fr; grid-template-rows: 1fr auto; gap: 8px; min-width: 0; }
.plane {
  grid-column: 2; grid-row: 1; position: relative; height: clamp(380px, 66vh, 680px);
  border-radius: var(--radius-box); border: 2px solid var(--rule); background-color: var(--white);
  background-image: linear-gradient(var(--rule), var(--rule)), linear-gradient(var(--rule), var(--rule));
  background-size: 2px 100%, 100% 2px; background-position: center; background-repeat: no-repeat;
  cursor: pointer; transition: border-color .12s, background-color .12s;
}
.plane.is-target, .selecting .plane { border-color: var(--accent); }
.plane.is-target { background-color: var(--accent-wash); }
.quadrant {
  position: absolute; max-width: 45%; padding: 10px 12px; pointer-events: none;
  font-size: var(--t-xs); font-weight: 700; color: var(--ink-faint); line-height: 1.3;
}
.q-tl { top: 0; left: 0; }
.q-tr { top: 0; right: 0; text-align: right; }
.q-bl { bottom: 0; left: 0; }
.q-br { bottom: 0; right: 0; text-align: right; }
.axis { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: var(--t-xs); color: var(--ink-soft); }
.axis strong { color: var(--ink); font-weight: 700; font-size: var(--t-sm); }
.axis-x { grid-column: 2; grid-row: 2; }
/* Read bottom-to-top, so «basso» sits at the bottom of the vertical axis. */
.axis-y { grid-column: 1; grid-row: 1; writing-mode: vertical-rl; transform: rotate(180deg); }
.plane .note {
  position: absolute; left: calc(var(--x) * 100%); top: calc((1 - var(--y)) * 100%);
  width: max-content; max-width: 180px; transform: translate(-50%, -50%);
}
@media (hover: hover) and (pointer: fine) {
  .plane .note:hover { transform: translate(-50%, calc(-50% - 2px)); }
}
.plane .note:focus-visible, .plane .note.is-selected, .plane .note:hover { z-index: 2; }

/* Matrix results: mean positions, numbered */
.plot-wrap { max-width: 760px; }
.plot { height: clamp(320px, 56vh, 560px); cursor: default; }
.plot-dot {
  position: absolute; left: calc(var(--x) * 100%); top: calc((1 - var(--y)) * 100%); transform: translate(-50%, -50%);
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); color: var(--white); font-size: var(--t-xs); font-weight: 700; box-shadow: 0 0 0 3px var(--white);
}

/* Submit bar */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--white); border-top: 1px solid var(--rule);
  padding: 12px 32px calc(12px + env(safe-area-inset-bottom));
}
.dock-inner { max-width: 1440px; margin: 0 auto; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.progress { flex: 1 1 220px; display: grid; gap: 6px; min-width: 0; }
.progress-text { font-size: var(--t-sm); }
.progress-text strong { font-weight: 700; }
.progress-bar { height: 6px; border-radius: 3px; background: var(--rule); overflow: hidden; }
.progress-bar span { display: block; height: 100%; width: 100%; background: var(--ink); transform: scaleX(0); transform-origin: left; transition: transform 250ms var(--ease-out); }
.dock .input { width: 220px; min-height: 44px; }
/* Medium widths: the secondary actions show only their icon, so «Invia» stays on the same line. */
@media (max-width: 1100px) {
  .dock #reset .label, .dock #toggle-comment .label { display: none; }
  .dock #reset, .dock #toggle-comment { padding-inline: 10px; }
}
/* Narrow screens: the places a selected note can go, listed above the bar (see updatePicker in sort.js). */
.dock-pick { max-width: 1440px; margin: 0 auto 12px; display: grid; gap: 8px; max-height: 38vh; overflow-y: auto; }
.pick-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pick-title { font-weight: 700; font-size: var(--t-sm); overflow-wrap: anywhere; min-width: 0; }
.pick-cancel { flex: none; min-height: 36px; padding-inline: 10px; }
.pick-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.pick-option {
  display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 12px; border-radius: var(--radius-btn); overflow-wrap: anywhere;
  border: 1px solid var(--rule-strong); background: var(--white); color: var(--ink); font: inherit; font-size: var(--t-sm); font-weight: 600;
  text-align: left; cursor: pointer; transition: background-color .12s, border-color .12s, transform 120ms var(--ease-out);
}
.pick-option:active { transform: scale(0.97); }
.pick-option.is-current { border-color: var(--accent); background: var(--accent-wash); }
.pick-option.is-new { border-style: dashed; border-color: var(--paper-edge); background: var(--paper-wash); }
.pick-option.is-table { color: var(--ink-soft); }
.pick-option svg { width: 16px; height: 16px; flex: none; }
.dock-comment { max-width: 1440px; margin: 0 auto 12px; display: grid; gap: 6px; }
.dock-comment .textarea { min-height: 0; resize: vertical; }

.done { max-width: 560px; margin: 88px auto; padding: 0 24px; display: grid; gap: 16px; text-align: left; }
.done .stack { display: flex; margin-bottom: 8px; }
.done .stack .note { width: 72px; min-height: 52px; cursor: default; margin-right: -12px; }
/* Participant page opened as a preview from the study page: nothing is sent. */
.preview-banner { margin: 0; padding: 10px 32px; background: var(--paper-wash); border-bottom: 1px solid var(--paper-edge); font-size: var(--t-sm); }
.preview-banner strong { margin-right: 8px; }
@media (max-width: 720px) { .preview-banner { padding-inline: 16px; } }
.privacy-note a { color: inherit; text-decoration: underline; cursor: pointer; }
.done .again { display: grid; gap: 4px; justify-items: start; margin-top: 8px; }
.done .again .btn { padding-inline: 0; }

/* ---------- Welcome cards before the board, closing cards after sending ---------- */
.guide-flow { max-width: 620px; margin: 0 auto; padding: 48px 24px 64px; display: grid; gap: 22px; }
.guide-study { font-weight: 600; color: var(--ink-soft); font-size: var(--t-sm); }
/* Old and new card share one cell, so a swap never changes the page layout. */
.guide-stage { display: grid; }
.guide-card { grid-area: 1 / 1; display: grid; gap: 12px; align-content: start; }
.guide-card.is-leaving { pointer-events: none; }
.guide-card h1 { font-size: var(--t-xl); }
.guide-card .avatar-lg { width: 72px; height: 72px; border-radius: 14px; margin-bottom: 8px; }
.guide-card .avatar-lg svg { width: 38px; height: 38px; }
.guide-count { font-size: var(--t-sm); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.guide-body { white-space: pre-line; color: var(--ink-soft); font-size: var(--t-md); line-height: 1.5; overflow-wrap: anywhere; }
.guide-image { display: block; width: 100%; max-height: 320px; object-fit: cover; border-radius: var(--radius-box); background: var(--table); margin-bottom: 8px; }
/* Back, dots, next: the dots stay centred under the card even when Back is not there yet. */
.guide-nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding-top: 18px; border-top: 1px solid var(--rule); }
.guide-nav #guide-back { justify-self: start; }
.guide-nav #guide-next { justify-self: end; }
.guide-nav #guide-back.is-unavailable { visibility: hidden; }
.guide-dots { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.guide-dots li { width: 8px; height: 8px; border-radius: 50%; background: var(--rule-strong); transition: background-color 200ms var(--ease-out), scale 200ms var(--ease-out); }
.guide-dots li.is-current { background: var(--ink); scale: 1.25; }
.board-guide { padding-inline: 0; min-height: 0; color: var(--ink-soft); }
.board-guide:hover { background: none; color: var(--ink); text-decoration: underline; }
.guide-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; border-top: 1px solid var(--rule); }
.guide-item { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: start; padding: 18px 0; border-bottom: 1px solid var(--rule); }
.guide-item:not(:has(> .avatar, > .guide-image)) { grid-template-columns: minmax(0, 1fr); }
.guide-item h2 { font-size: var(--t-md); margin-bottom: 4px; }
.guide-item .guide-body { font-size: var(--t-base); }
.guide-item .guide-image { width: 96px; height: 72px; max-height: none; margin: 0; }
.done.is-arriving .guide-list { animation: copy-in 400ms var(--ease-out) 120ms both; }

/* ---------- Editor of the welcome and closing cards (study page) ---------- */
.guide-editor { display: grid; gap: 40px; margin-top: 32px; }
.guide-part { display: grid; gap: 16px; }
.step-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.step-item {
  display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 20px; align-items: start;
  padding: 18px; border: 1px solid var(--rule); border-radius: var(--radius-box); background: var(--white);
}
.step-preview { position: relative; width: 72px; }
.step-thumb { display: block; width: 72px; height: 72px; border-radius: var(--radius-btn); object-fit: cover; background: var(--table); }
.step-thumb.is-empty { border: 1px dashed var(--rule-strong); background: none; }
.step-preview .avatar-md { width: 72px; height: 72px; border-radius: var(--radius-btn); }
.step-preview .avatar-md svg { width: 34px; height: 34px; }
.step-number {
  position: absolute; left: -8px; top: -8px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--ink); color: var(--white); font-size: var(--t-xs); font-weight: 600;
}
.step-fields { display: grid; gap: 14px; min-width: 0; }
.step-body { min-height: 80px; }
.step-media { border: 0; margin: 0; padding: 0; display: grid; gap: 10px; min-width: 0; }
.step-media legend { padding: 0; margin-bottom: 8px; }
.step-icon { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.step-image { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.step-tools { display: grid; gap: 4px; }
.icon-btn:disabled { opacity: .35; cursor: default; background: none; border-color: transparent; }
.icon-btn.is-danger:hover { background: var(--danger-wash); color: var(--danger); border-color: transparent; }
.segmented { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius-btn); background: var(--table); width: fit-content; max-width: 100%; }
.segment { position: relative; cursor: pointer; }
.segment input { position: absolute; opacity: 0; pointer-events: none; }
.segment span { display: block; padding: 6px 12px; border-radius: 6px; font-size: var(--t-sm); font-weight: 600; color: var(--ink-soft); transition: background-color .12s, color .12s; }
.segment:hover span { color: var(--ink); }
.segment input:checked + span { background: var(--white); color: var(--ink); box-shadow: 0 0 0 1px var(--rule); }
.segment input:focus-visible + span { outline: 3px solid var(--action); outline-offset: 1px; }
.reuse-dialog { width: min(640px, calc(100vw - 32px)); }
.reuse-list { list-style: none; margin: 16px 0; padding: 0; display: grid; gap: 8px; max-height: min(60vh, 520px); overflow-y: auto; }
.reuse-option {
  display: grid; gap: 4px; width: 100%; padding: 14px 16px; text-align: left; border: 1px solid var(--rule); border-radius: var(--radius-box);
  background: var(--white); color: var(--ink); cursor: pointer; transition: border-color .12s, background-color .12s;
}
.reuse-option:hover { border-color: var(--ink); background: var(--table); }
.reuse-option:disabled { opacity: .5; cursor: progress; }
.reuse-title { font-weight: 700; }
.reuse-steps { display: grid; gap: 2px; margin-top: 6px; font-size: var(--t-sm); color: var(--ink-soft); }
@media (max-width: 720px) {
  .step-item { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 16px 14px; }
  .step-tools { display: flex; order: -1; justify-content: flex-end; }
  .guide-flow { padding-top: 28px; }
  .guide-card h1 { font-size: var(--t-lg); }
}

/* Sent: the copy rises, the stack of post-its drops right after */
@keyframes copy-in { from { opacity: 0; translate: 0 8px; } }
@keyframes stack-in { from { opacity: 0; translate: 0 -18px; scale: .96; } }
.done.is-arriving .done-copy { animation: copy-in 400ms var(--ease-out) both; }
.done.is-arriving .stack .note { animation: stack-in 450ms var(--ease-out) both; }
.done.is-arriving .stack .note:nth-child(1) { animation-delay: 60ms; }
.done.is-arriving .stack .note:nth-child(2) { animation-delay: 110ms; }
.done.is-arriving .stack .note:nth-child(3) { animation-delay: 140ms; }
.done-copy { display: grid; gap: 12px; }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 12px); z-index: 2000;
  background: var(--ink); color: var(--white); padding: 10px 18px; border-radius: var(--radius-btn);
  font-weight: 400; font-size: var(--t-sm); opacity: 0; pointer-events: none; transition: opacity 240ms var(--ease-out), transform 240ms var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: var(--danger); }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .note, .btn, .kind, .group, .plane, .study-glyph, .progress-bar span, .scene-note.is-moving, .pick-option { transition: none; }
  .toast { transition-property: opacity; }
  .note.entering, .done.is-arriving .done-copy, .done.is-arriving .stack .note, .done.is-arriving .guide-list { animation: none; }
  .guide-dots li { transition: none; }
}

@media (max-width: 960px) {
  .board { grid-template-columns: 1fr 1fr; }
  .table { grid-column: 1 / -1; grid-row: 1; position: static; max-height: none; min-height: 240px; }
  .side { grid-row: 2; }
  .board-plane, .board.board-open { grid-template-columns: 1fr; }
  .board-plane .plane-wrap { grid-row: 2; }
  .plane { height: auto; aspect-ratio: 1; }
}
@media (max-width: 720px) {
  h1 { font-size: var(--t-xl); }
  .lede { font-size: var(--t-base); }
  .topbar { padding: 10px 16px; gap: 12px; }
  .page { padding: 28px 16px 96px; }
  .page-head.with-actions { grid-template-columns: 1fr; }
  .lists, .axes-fields { grid-template-columns: 1fr; }
  .lists .textarea { min-height: 200px; }
  .index-row { flex-wrap: wrap; gap: 12px 16px; }
  .index-meta { justify-content: flex-start; flex-basis: 100%; }
  .study-row .index-meta { padding-left: 68px; }
  .add-person { grid-template-columns: 1fr; }
  .people li { flex-wrap: wrap; }
  .people-email { flex-basis: 100%; }
  .study-glyph.is-large { width: 56px; height: 56px; padding: 10px; }
  .board-head { padding: 24px 16px 4px; }
  .board-head h1 { font-size: var(--t-lg); }
  .board { padding: 16px 16px 200px; gap: 12px; }
  .table { padding: 20px 12px; gap: 14px 10px; }
  .note { width: calc(50% - 10px); min-height: 88px; font-size: 14px; }
  .dock { padding-inline: 16px; }
  .dock-inner { gap: 10px 8px; }
  .progress { flex: 1 1 calc(100% - 60px); }
  .dock #reset { padding-inline: 10px; }
  .dock .label { display: none; }
  .dock .input { flex: 1 1 0; width: auto; min-width: 0; }
}

/* ---------- Room screen (projected during a workshop) ---------- */
.room-tools { margin-left: auto; display: flex; gap: 8px; }
.room {
  min-height: calc(100vh - 80px); max-width: 1280px; margin: 0 auto; padding: 32px 40px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 56px;
}
.room-copy { display: grid; gap: 14px; }
.room-kind { font-weight: 700; color: var(--accent-ink); font-size: var(--t-md); }
.room h1 { font-size: clamp(36px, 5vw, 64px); line-height: 1.05; }
.room-step { font-size: var(--t-md); color: var(--ink-soft); margin-top: 16px; }
.room-link { font-size: clamp(22px, 2.6vw, 34px); font-weight: 700; overflow-wrap: anywhere; }
.room-count { margin-top: 24px; font-size: var(--t-lg); }
.room-count strong { display: inline-block; font-size: clamp(48px, 6vw, 88px); font-weight: 700; font-variant-numeric: tabular-nums; }
.room-state { color: var(--danger); font-weight: 700; }
.room-qr { width: min(42vw, 72vh, 520px); aspect-ratio: 1; background: var(--white); border: 1px solid var(--rule); border-radius: var(--radius-box); padding: 12px; }
@media (max-width: 760px) {
  .room { grid-template-columns: 1fr; padding: 24px 16px; gap: 24px; min-height: 0; }
  .room-qr { width: min(100%, 360px); }
  .room-tools .btn { padding-inline: 10px; }
}

/* ---------- Accounts, projects (white label) ---------- */
.eyebrow { font-weight: 700; font-size: var(--t-sm); color: var(--accent-ink); }
.account-group + .account-group { margin-top: 40px; }
.account-group .group-title { font-size: var(--t-md); margin-top: 40px; }
.account-group .group-title a { color: inherit; text-decoration: none; cursor: pointer; }
.account-group .group-title a:hover { text-decoration: underline; }
.account-swatch { width: 28px; height: 28px; border-radius: 8px; background: var(--swatch); flex: none; border: 1px solid rgb(0 0 0 / 0.08); }
.inline-create { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; padding-top: 8px; }
.color-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.color-field { display: flex; gap: 8px; align-items: center; }
.color-field input[type=color] { width: 48px; height: 44px; padding: 2px; border: 1px solid var(--rule-strong); border-radius: var(--radius-btn); background: var(--white); cursor: pointer; flex: none; }
.color-field input[type=color]:disabled { cursor: not-allowed; }
.color-field .input { font-variant-numeric: tabular-nums; text-transform: uppercase; }
.logo-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.brand-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 40px; align-items: start; }
.brand-preview { display: grid; gap: 12px; border: 1px solid var(--rule); border-radius: var(--radius-box); overflow: hidden; padding-bottom: 16px; }
.brand-preview > p { padding-inline: 20px; }
.brand-preview-bar { display: flex; align-items: center; min-height: 64px; padding: 12px 20px; border-bottom: 1px solid var(--rule); }
.brand-preview-body { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; padding: 20px; background: var(--table); }
.brand-preview .note { position: static; width: 140px; min-height: 72px; cursor: default; }
@media (max-width: 760px) {
  .inline-create, .color-pair, .brand-grid { grid-template-columns: 1fr; }
}

/* ---------- Management shell: side navigation, top bar with the trail, page ---------- */
.app-body { background: var(--white); }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 300; padding: 10px 16px; border-radius: var(--radius-btn); background: var(--ink); color: var(--white); font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 12px; }
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; min-width: 0;
  background: var(--table); border-right: 1px solid var(--rule);
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 64px; padding: 12px 16px 12px 20px; }
.sidebar .brand-logo { height: 28px; max-width: 180px; }
.sidenav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 4px 12px 16px; display: grid; align-content: start; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 36px; padding: 6px 10px;
  border-radius: var(--radius-btn); color: var(--ink); text-decoration: none; font-size: var(--t-sm); cursor: pointer;
  transition: background-color .12s;
}
.nav-item:hover { background: rgb(0 0 0 / 0.05); }
.nav-item[aria-current='page'] { background: var(--white); font-weight: 600; box-shadow: 0 0 0 1px var(--rule); }
.nav-item.is-parent { font-weight: 600; }
.nav-item > svg { width: 18px; height: 18px; flex: none; color: var(--ink-soft); }
.nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-overview { margin-bottom: 4px; }
.nav-filter { min-height: 38px; margin: 6px 0 4px; font-size: var(--t-sm); background: var(--white); }
.nav-group { display: grid; gap: 2px; }
.nav-group-title { margin: 18px 10px 6px; font-size: var(--t-xs); font-weight: 600; color: var(--ink-soft); }
.nav-group-title a { color: inherit; text-decoration: none; cursor: pointer; }
.nav-group-title a:hover { color: var(--ink); text-decoration: underline; }
.nav-list, .nav-sub { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav-list > li, .nav-sub > li { min-width: 0; }
.nav-row { display: flex; align-items: center; gap: 2px; }
.nav-row .nav-item { flex: 1; }
.nav-toggle {
  display: grid; place-items: center; flex: none; width: 30px; height: 30px; padding: 0; border: 0; border-radius: var(--radius-btn);
  background: none; color: var(--ink-soft); cursor: pointer;
}
.nav-toggle:hover { background: rgb(0 0 0 / 0.05); color: var(--ink); }
.nav-toggle svg { width: 16px; height: 16px; transition: transform 160ms var(--ease-out); }
.nav-toggle[aria-expanded='true'] svg { transform: rotate(90deg); }
.nav-sub { margin: 2px 0 6px 21px; padding-left: 9px; border-left: 1px solid var(--rule); }
.nav-item.is-sub { min-height: 32px; padding-block: 4px; }
.nav-item.is-add { color: var(--ink-soft); }
.nav-item.is-add svg { width: 16px; height: 16px; margin-inline: 1px; }
.nav-empty { padding: 12px 10px; font-size: var(--t-sm); color: var(--ink-soft); }
.nav-end { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--rule); }
.sidebar-foot { border-top: 1px solid var(--rule); padding: 14px 16px 16px 20px; display: grid; gap: 12px; }
.whoami { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 36px; }
.me-initial {
  display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%;
  background: var(--ink); color: var(--white); font-weight: 600; font-size: var(--t-sm);
}
.me-text { display: grid; min-width: 0; line-height: 1.3; }
.me-email { font-size: var(--t-xs); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-links { font-size: var(--t-xs); }
.me-links a { color: var(--ink-soft); cursor: pointer; }
.me-links a:hover { color: var(--ink); }
/* «con Intraworkshop» under a consultancy's brand: the product signs quietly. */
.powered { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-xs); color: var(--ink-soft); text-decoration: none; cursor: pointer; width: fit-content; }
.powered .mark { width: 14px; height: 14px; }
.powered:hover { color: var(--ink); }

.main { min-width: 0; display: flex; flex-direction: column; }
.main .topbar { position: sticky; top: 0; z-index: 40; min-height: 56px; padding: 8px 40px; background: rgb(255 255 255 / 0.94); backdrop-filter: blur(8px); }
.main .page { width: 100%; }
.icon-btn {
  display: grid; place-items: center; flex: none; width: 40px; height: 40px; padding: 0; border: 1px solid transparent;
  border-radius: var(--radius-btn); background: none; color: var(--ink); cursor: pointer;
}
.icon-btn:hover { background: var(--table); border-color: var(--rule); }
.icon-btn svg { width: 20px; height: 20px; }
.nav-open, .sidebar-close { display: none; }
.nav-scrim { display: none; }

@media (max-width: 1000px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; z-index: 100; left: 0; top: 0; bottom: 0; height: auto; width: min(320px, 86vw);
    transform: translateX(-100%); transition: transform 300ms var(--ease-drawer); box-shadow: 0 0 0 1px var(--rule);
  }
  .nav-is-open .sidebar { transform: none; }
  /* The scrim fades with the drawer, on the same curve, in and out. */
  .nav-scrim {
    display: block; position: fixed; inset: 0; z-index: 90; background: rgb(0 0 0 / 0.35);
    opacity: 0; visibility: hidden; transition: opacity 300ms var(--ease-drawer), visibility 0s 300ms;
  }
  .nav-is-open .nav-scrim { opacity: 1; visibility: visible; transition: opacity 300ms var(--ease-drawer), visibility 0s; }
  .nav-open, .sidebar-close { display: grid; }
  .main .topbar { padding: 8px 16px; gap: 10px; }
}
@media (max-width: 720px) {
  .entity-head { flex-direction: column; align-items: flex-start; gap: 14px; }
  .entity-head h1 { font-size: var(--t-lg); }
  .avatar-lg { width: 52px; height: 52px; border-radius: 10px; }
  .avatar-lg svg { width: 28px; height: 28px; }
}
/* Narrow screens: the trail keeps its last two steps, the side navigation has the rest. */
@media (max-width: 720px) {
  .crumbs { overflow: hidden; }
  .crumbs > :not(:nth-last-child(-n + 3)) { display: none; }
  .crumbs a { overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
}

/* ---------- Identity of workspaces and projects: icon on a colour tile, or an image ---------- */
.avatar {
  display: inline-grid; place-items: center; flex: none; overflow: hidden;
  background: var(--avatar-fill, var(--rule)); color: var(--avatar-ink, var(--ink));
}
.avatar.is-image { background: var(--white); box-shadow: inset 0 0 0 1px var(--rule); object-fit: contain; }
.avatar-xs { width: 18px; height: 18px; border-radius: 4px; }
.avatar-xs svg { width: 12px; height: 12px; }
.avatar-sm { width: 24px; height: 24px; border-radius: 6px; }
.avatar-sm svg { width: 15px; height: 15px; }
.avatar-md { width: 40px; height: 40px; border-radius: var(--radius-btn); }
.avatar-md svg { width: 22px; height: 22px; }
.avatar-lg { width: 64px; height: 64px; border-radius: 12px; }
.avatar-lg svg { width: 34px; height: 34px; }
.avatar.is-image.avatar-xs, .avatar.is-image.avatar-sm { padding: 1px; }
.avatar.is-image.avatar-md { padding: 3px; }
.avatar.is-image.avatar-lg { padding: 6px; }

.entity-head { display: flex; gap: 20px; align-items: center; min-width: 0; }
.entity-head > div { display: grid; gap: 6px; min-width: 0; }
.entity-head h1 { overflow-wrap: anywhere; }
.entity-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: var(--t-sm); color: var(--ink-soft); }
.entity-parent { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-weight: 600; text-decoration: none; cursor: pointer; }
.entity-parent:hover { text-decoration: underline; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.page-head.with-actions { align-items: center; }
.page-head > div:not(.entity-head):not(.page-actions) { display: grid; gap: 10px; }
/* The overview has no trail: on wide screens its top bar would be an empty strip. */
@media (min-width: 1001px) {
  .main .topbar:has(.crumbs:empty) { display: none; }
}

.identity-fields { border: 0; margin: 0; padding: 0; display: grid; gap: 10px; min-width: 0; }
.identity-fields legend { padding: 0; margin-bottom: 10px; }
.identity-image { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.identity-image-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; flex: 1 1 260px; }
.identity-image-actions .hint { flex-basis: 100%; }
.icon-choices { display: grid; grid-template-columns: repeat(auto-fill, 44px); gap: 6px; max-width: 594px; }
.icon-choice {
  position: relative; display: grid; place-items: center; height: 44px; border: 1px solid var(--rule); border-radius: var(--radius-btn);
  background: var(--white); color: var(--ink-soft); cursor: pointer;
}
.icon-choice:hover { border-color: var(--ink-soft); color: var(--ink); }
.icon-choice:has(input:checked) { border-color: var(--ink); background: var(--table); color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.icon-choice:has(input:focus-visible), .color-choice:has(input:focus-visible) { outline: 3px solid var(--action); outline-offset: 2px; }
.icon-choice input, .color-choice input { position: absolute; opacity: 0; pointer-events: none; }
.icon-choice svg { width: 20px; height: 20px; }
.icon-choice, .color-choice { transition: border-color .12s, background-color .12s, color .12s, box-shadow .12s, transform 120ms var(--ease-out); }
.icon-choice:active, .color-choice:active { transform: scale(0.94); }
.color-choices { display: flex; flex-wrap: wrap; gap: 10px; }
.color-choice {
  position: relative; width: 34px; height: 34px; border-radius: 50%; background: var(--swatch); cursor: pointer;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.14);
}
.color-choice:has(input:checked) { box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.14), 0 0 0 2px var(--white), 0 0 0 4px var(--ink); }

/* Tabs that switch the sections of a workspace or a project (address #fragment). */
.section-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--rule); margin-top: 32px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.section-tabs a {
  padding: 12px 14px; font-weight: 600; font-size: var(--t-sm); color: var(--ink-soft); text-decoration: none; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer;
}
.section-tabs a:hover { color: var(--ink); }
.section-tabs a[aria-current='true'] { color: var(--ink); border-bottom-color: var(--ink); }
.tab-panel { margin-top: 32px; display: grid; gap: 20px; }
.tab-panel > .section:first-child { margin-top: 0; }
.tab-panel .index-list { margin-top: 0; }
.section-tabs + .tab-panel .index-list { border-top: 0; }
.dialog form { display: grid; gap: 22px; margin-top: 20px; }
.dialog .form-actions { justify-content: flex-end; }

@media (prefers-reduced-motion: reduce) {
  .sidebar, .nav-toggle svg { transition: none; }
  /* Fewer, gentler: dialogs and the scrim keep their fade, nothing moves or scales. */
  .dialog, .dialog::backdrop { transition-property: opacity, overlay, display; }
  .btn:active:not(:disabled), .icon-btn:active, .nav-toggle:active, .icon-choice:active, .color-choice:active, .propose:active:not(:disabled) { transform: none; }
}
