/* ==========================================================================
   CAVIA — Computer-Aided Volunteer Intake & Appointments
   Single stylesheet. No external dependencies.
   Structure: fonts → tokens → base → layout → components → calendar → utilities
   Reference design system: PILab Backoffice Apps.
   ========================================================================== */

/* ---------- Fonts ----------
   Typefaces of the UniGe visual identity, hosted here (no requests to Google):
   Fira Sans and Fira Code (OFL), Roboto Slab (Apache 2.0). Licences in ../fonts/.*/
@font-face { font-family: "Fira Code"; font-style: normal; font-weight: 400 600; font-display: swap; src: url("../fonts/fira-code-400-600-latin-ext.woff2") format("woff2"); 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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Fira Code"; font-style: normal; font-weight: 400 600; font-display: swap; src: url("../fonts/fira-code-400-600-latin.woff2") format("woff2"); 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: "Fira Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/fira-sans-400-latin-ext.woff2") format("woff2"); 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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/fira-sans-400-latin.woff2") format("woff2"); 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: "Fira Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/fira-sans-600-latin-ext.woff2") format("woff2"); 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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/fira-sans-600-latin.woff2") format("woff2"); 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: "Fira Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/fira-sans-700-latin-ext.woff2") format("woff2"); 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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/fira-sans-700-latin.woff2") format("woff2"); 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: "Roboto Slab"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("../fonts/roboto-slab-400-700-latin-ext.woff2") format("woff2"); 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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Roboto Slab"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("../fonts/roboto-slab-400-700-latin.woff2") format("woff2"); 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; }

/* ---------- Tokens ----------*/
:root {
  color-scheme: light;

  /* Palette: UniGe visual identity (id.unige.it/elementi-visivi)*/
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f2f3f5;
  --surface-3: #e8e9ec;
  --border: #e3e3e0;
  --border-strong: #d9d9d6;        /* Cool Gray 1 */

  --text: #25282a;                 /* PANTONE 426 */
  --text-2: #4f5357;
  --text-3: #82868a;

  --primary: #002677;              /* UniGe blue, PANTONE 2147*/
  --primary-hover: #001d5c;
  --primary-soft: #e6ebf6;
  --primary-text: #002677;
  --on-primary: #ffffff;
  /* second accent: navigation, links, calendar — light blue PANTONE 2192*/
  --accent: #199bfc;
  --accent-soft: #e3f2ff;
  --accent-text: #0a6bc2;
  --accent-hover: #0757a0;
  --on-accent: #ffffff;
  --focus-ring: 0 0 0 3px rgba(25, 155, 252, .35);

  --ok: #007c58;      --ok-soft: #e3f3ee;     /* Science (MFN) green*/
  --warn: #8a6d00;    --warn-soft: #fdf6d3;   /* yellow PANTONE 7404*/
  --danger: #c8102e;  --danger-soft: #fbe7ea; /* red PANTONE 186*/
  --danger-hover: #a50d26;  --on-danger: #ffffff;
  --info: #574676;    --info-soft: #eeebf3;   /* Engineering purple*/
  --muted-soft: #eeefef;

  --font: "Fira Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-slab: "Roboto Slab", Georgia, serif;   /* headings only*/
  --font-mono: "Fira Code", ui-monospace, "SF Mono", Consolas, monospace;

  --fs-xs: .75rem;
  --fs-sm: .8125rem;
  --fs-md: .9375rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: 1.75rem;

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;

  --shadow-1: 0 1px 2px rgba(37, 40, 42, .06);
  --shadow-2: 0 4px 16px rgba(37, 40, 42, .08), 0 1px 3px rgba(37, 40, 42, .06);
  --shadow-3: 0 16px 48px rgba(37, 40, 42, .18);
  --shadow-up: 0 -4px 16px rgba(37, 40, 42, .08);
  --backdrop: rgba(20, 19, 17, .45);

  --container: 1440px; /* wide enough for the weekly calendar (7 days) beside its side panel */
  --narrow: 720px;
  --topbar-h: 56px;

  /* calendar*/
  --cal-hour-h: 52px;
  --cal-time-w: 56px;
}

/* The default theme is light; dark is enabled only with data-theme="dark".*/
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #16191c;
  --surface: #1f2225;
  --surface-2: #272a2e;
  --surface-3: #303337;
  --border: #33373b;
  --border-strong: #4a4e53;
  --text: #e3e4e4;
  --text-2: #aeb1b4;
  --text-3: #80848a;
  --primary: #6f93e6;
  --primary-hover: #8aa7ec;
  --primary-soft: #1c2849;
  --primary-text: #9db5f0;
  --on-primary: #08143a;
  --accent: #58b5fd;
  --accent-soft: #13304a;
  --accent-text: #8ccbff;
  --accent-hover: #7cc3fd;
  --on-accent: #04213a;
  --focus-ring: 0 0 0 3px rgba(88, 181, 253, .3);
  --ok: #4fbf98;      --ok-soft: #16302a;
  --warn: #f4da40;    --warn-soft: #3a3315;
  --danger: #f0707f;  --danger-soft: #3d1a20;
  --danger-hover: #f48d99;  --on-danger: #1a0508;
  --info: #b3a3d6;    --info-soft: #2a2538;
  --muted-soft: #2b2e32;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .25);
  --shadow-2: 0 4px 16px rgba(0, 0, 0, .3);
  --shadow-3: 0 16px 48px rgba(0, 0, 0, .45);
  --shadow-up: 0 -4px 16px rgba(0, 0, 0, .3);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
/* hidden always wins over a component's display (flex, grid, block...). */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0 0 var(--sp-3); font-family: var(--font-slab); line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }
p { margin: 0 0 var(--sp-3); }
a { color: var(--accent-text); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
small, .small { font-size: var(--fs-sm); }
code, .mono { font-family: var(--font-mono); font-size: .92em; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--sp-5) 0; }
img, svg { max-width: 100%; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }
.num, time, .time { font-variant-numeric: tabular-nums; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--sp-4); }
.narrow { width: 100%; max-width: var(--narrow); margin: 0 auto; padding: 0 var(--sp-4); }
@media (min-width: 768px) { .container, .narrow { padding: 0 var(--sp-5); } }

/* Topbar (researcher area)*/
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar .container { height: 100%; display: flex; align-items: center; gap: var(--sp-5); }
.brand {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-weight: 700; letter-spacing: .04em; color: var(--text); text-decoration: none;
}
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--primary); color: var(--on-primary);
  display: grid; place-items: center; font-size: 15px; font-weight: 800;
}
/* Lab logo inside the brand square: light tile in both themes so the dark artwork stays legible */
.brand-mark-logo {
  width: 32px; height: 32px; flex: none; padding: 2px;
  background: #fff; border: 1px solid var(--border); box-sizing: border-box;
}
.brand-logo { width: 32px; height: 32px; flex: none; display: block; }
.brand-sub { font-weight: 500; color: var(--text-3); letter-spacing: 0; font-size: var(--fs-sm); }
.nav { display: flex; gap: var(--sp-1); flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav a {
  padding: 6px 12px; border-radius: var(--radius); white-space: nowrap;
  color: var(--text-2); text-decoration: none; font-weight: 500; font-size: var(--fs-sm);
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
.topbar-end { display: flex; align-items: center; gap: var(--sp-2); margin-left: auto; }
@media (max-width: 767px) {
  .topbar { height: auto; }
  .topbar .container { flex-wrap: wrap; gap: var(--sp-2); padding-top: var(--sp-2); padding-bottom: var(--sp-2); }
  .nav { order: 3; flex-basis: 100%; }
}

/* Public header*/
.public-header { padding: var(--sp-4) 0; }
.public-header .narrow { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.public-footer { padding: var(--sp-6) 0; color: var(--text-3); font-size: var(--fs-sm); text-align: center; }

main { padding: var(--sp-5) 0 var(--sp-7); }

.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: var(--sp-3); margin-bottom: var(--sp-5);
}
.page-head h1 { margin: 0; }
.page-head .meta { color: var(--text-2); font-size: var(--fs-sm); margin-top: var(--sp-1); }
.breadcrumb { font-size: var(--fs-sm); color: var(--text-3); margin-bottom: var(--sp-2); }
.breadcrumb a { color: var(--text-2); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

.stack > * + * { margin-top: var(--sp-4); }
.stack-sm > * + * { margin-top: var(--sp-2); }
.stack-lg > * + * { margin-top: var(--sp-5); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.row-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.grid { display: grid; gap: var(--sp-4); }
.grid-2 { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid-3 { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.split { display: grid; gap: var(--sp-5); }
@media (min-width: 960px) { .split { grid-template-columns: minmax(0, 1fr) 340px; } }

/* ---------- Buttons ----------*/
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 38px; padding: 0 16px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: var(--fs-sm); font-weight: 600;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--on-primary); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { color: var(--danger); border-color: var(--border-strong); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: var(--on-danger); }
.btn-danger-solid:hover { background: var(--danger-hover); border-color: var(--danger-hover); color: var(--on-danger); }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: var(--fs-xs); border-radius: var(--radius-sm); }
.btn-lg { min-height: 46px; padding: 0 22px; font-size: var(--fs-md); }
.btn-block { width: 100%; }
.btn-icon { width: 38px; padding: 0; }
.btn-sm.btn-icon { width: 30px; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Form ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: var(--sp-4); }
.label { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.label .opt { font-weight: 400; color: var(--text-3); }
.label .req, .check .req { color: var(--danger); }
.help { font-size: var(--fs-xs); color: var(--text-3); }
.error-text { font-size: var(--fs-xs); color: var(--danger); font-weight: 500; }

.input, .select, .textarea {
  width: 100%; min-height: 40px; padding: 8px 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  font: inherit; font-size: var(--fs-md);
  transition: border-color .12s, box-shadow .12s;
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%;
  background-size: 5px 5px; background-repeat: no-repeat; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }
.input[aria-invalid="true"], .is-invalid { border-color: var(--danger); }
/* Disabled fields look greyed out, not just locked. */
.input:disabled, .select:disabled, .textarea:disabled,
.input:disabled:hover, .select:disabled:hover, .textarea:disabled:hover {
  background: var(--surface-2); border-color: var(--border); color: var(--text-3); cursor: not-allowed;
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input-sm { min-height: 32px; padding: 4px 10px; font-size: var(--fs-sm); }
.select-sm { min-height: 32px; padding: 4px 32px 4px 10px; font-size: var(--fs-sm); }

/* Maps of locations (Leaflet): pin editor in the location dialog, read-only maps on public pages. */
.loc-map, .place-map { border: 1px solid var(--border); border-radius: var(--radius); z-index: 0; }
.loc-map { height: 240px; }
.place-map { height: 220px; }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: var(--radius) 0 0 var(--radius); }
.input-group .btn { border-radius: 0 var(--radius) var(--radius) 0; margin-left: -1px; min-height: 40px; }
.input-affix { display: flex; align-items: center; gap: var(--sp-2); }
.input-affix .input { width: auto; flex: 1; }
.input-affix .affix { color: var(--text-3); font-size: var(--fs-sm); }
.form-row { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
.form-row .field + .field { margin-top: 0; }
/* Fields side by side in a grid: no stacking margin, or the second one drops. */
.grid-2 > .field + .field { margin-top: 0; }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: flex-end; margin-top: var(--sp-5); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; font-weight: 700; margin-bottom: var(--sp-3); }

.check { display: flex; align-items: flex-start; gap: var(--sp-2); cursor: pointer; font-size: var(--fs-md); }
.check input { margin: 3px 0 0; width: 16px; height: 16px; accent-color: var(--primary); flex: none; }
.check .help { display: block; }
.check + .check { margin-top: var(--sp-2); }

/* Toggle switch*/
.switch { display: inline-flex; align-items: center; gap: var(--sp-3); cursor: pointer; }
.switch input { appearance: none; width: 36px; height: 20px; border-radius: 999px; margin: 0;
  background: var(--border-strong); position: relative; cursor: pointer; transition: background .15s; flex: none; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: var(--shadow-1); transition: transform .15s; }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(16px); }

/* Segmented control (e.g. hidden / optional / required)*/
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 5px 12px; border-radius: var(--radius-sm); font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); font-weight: 600; }
.seg input:focus-visible + span { box-shadow: var(--focus-ring); }

/* Weekday picker*/
.weekdays { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.weekdays label { position: relative; }
.weekdays input { position: absolute; opacity: 0; }
.weekdays span { display: grid; place-items: center; min-width: 42px; height: 36px; padding: 0 8px;
  border: 1px solid var(--border-strong); border-radius: var(--radius); font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); cursor: pointer; }
.weekdays input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.weekdays input:focus-visible + span { box-shadow: var(--focus-ring); }

/* "Card" radio (e.g. booking mode)*/
.choice-cards { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.choice-card { position: relative; display: block; padding: var(--sp-4); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); cursor: pointer; }
.choice-card input { position: absolute; top: 16px; right: 16px; accent-color: var(--primary); }
.choice-card strong { display: block; margin-bottom: 2px; padding-right: 24px; }
.choice-card span { color: var(--text-2); font-size: var(--fs-sm); }
.choice-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }

/* ---------- Cards and sections ----------*/
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); }
.card-body { padding: var(--sp-5); }
.card-head { padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.card-head h2, .card-head h3 { margin: 0; font-size: var(--fs-lg); }
.card-foot { padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
@media (max-width: 600px) { .card-body { padding: var(--sp-4); } .card-head, .card-foot { padding-left: var(--sp-4); padding-right: var(--sp-4); } }
a.card { display: block; color: inherit; text-decoration: none; transition: border-color .12s, box-shadow .12s; }
a.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); color: inherit; }
/* Card with clickable area + footer with separate actions*/
.card-link { display: block; color: inherit; text-decoration: none; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.card-link:hover { color: inherit; }
.card:has(> .card-link) { display: flex; flex-direction: column; transition: border-color .12s, box-shadow .12s; }
.card > .card-link { flex: 1 1 auto; }
/* Dashboard cards: push the meter and details to the bottom so meters line up across a row. */
.dash-card > .card-link, .dash-card .card-body { display: flex; flex-direction: column; }
.dash-card .card-body { flex: 1 1 auto; }
.dash-card-summary { margin-bottom: auto; }
.card:has(> .card-link:hover) { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.card-foot.row-between { padding-top: var(--sp-2); padding-bottom: var(--sp-2); }

.section { padding: var(--sp-5) 0; border-top: 1px solid var(--border); }
.section:first-child { border-top: 0; padding-top: 0; }
.section-head { margin-bottom: var(--sp-4); }
.section-head h2, .section-head h3 { margin-bottom: var(--sp-1); }
.section-head p { color: var(--text-2); font-size: var(--fs-sm); margin: 0; }
@media (min-width: 900px) {
  .section-aside { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: var(--sp-6); }
  .section-aside .section-head { margin: 0; }
}

/* Statistics*/
.stats { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.stat { padding: var(--sp-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.stat .stat-label { font-size: var(--fs-xs); color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.stat .stat-value { font-size: var(--fs-2xl); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 2px; }
.stat .stat-sub { font-size: var(--fs-xs); color: var(--text-2); }

/* Fill bar*/
.meter { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }

/* Key/value descriptions*/
.dl { display: grid; grid-template-columns: max-content 1fr; gap: var(--sp-2) var(--sp-4); margin: 0; font-size: var(--fs-sm); }
.dl dt { color: var(--text-3); }
.dl dd { margin: 0; color: var(--text); }

/* ---------- Tabs ----------*/
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--border); margin-bottom: var(--sp-5); overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button {
  padding: 10px 14px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; background: none;
  font: inherit; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs [aria-selected="true"], .tabs [aria-current="page"] { color: var(--accent-text); border-bottom-color: var(--accent); }
.tabs .count { margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: var(--fs-xs); }

/* ---------- Tables ----------*/
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: var(--fs-xs); font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; background: var(--surface-2); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .actions { text-align: right; white-space: nowrap; }
/* Icon-only buttons have no text baseline: align every action on the middle. */
.table .actions .btn, .table .actions form { vertical-align: middle; }
.table input[type="checkbox"] { accent-color: var(--primary); }

/* ---------- Badges and statuses ----------*/
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: var(--radius-pill);
  font-size: var(--fs-xs); font-weight: 600; line-height: 1.6; white-space: nowrap;
  background: var(--muted-soft); color: var(--text-2);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.no-dot::before { display: none; }
.badge-ok, .badge-confirmed, .badge-open { background: var(--ok-soft); color: var(--ok); }
.badge-warn, .badge-pending { background: var(--warn-soft); color: var(--warn); }
.badge-danger, .badge-cancelled, .badge-noshow { background: var(--danger-soft); color: var(--danger); }
.badge-info, .badge-full { background: var(--info-soft); color: var(--info); }
.badge-draft, .badge-closed { background: var(--muted-soft); color: var(--text-2); }
.badge-primary { background: var(--accent-soft); color: var(--accent-text); }
.tag { display: inline-block; padding: 1px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: var(--fs-xs); color: var(--text-2); font-family: var(--font-mono); }

/* ---------- Alerts ----------*/
.alert { display: flex; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-radius: var(--radius); border: 1px solid transparent; font-size: var(--fs-sm); background: var(--surface-2); }
.alert .icon { margin-top: 2px; }
.alert strong { display: block; }
.alert p { margin: 0; }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert > div { color: var(--text); }
.alert > div strong { color: inherit; }

/* ---------- Modal (<dialog> element) ----------*/
dialog.modal {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-3);
}
dialog.modal-lg { width: min(820px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: var(--backdrop); }
.modal-head { padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.modal-head h2 { margin: 0; font-size: var(--fs-lg); }
.modal-body { padding: var(--sp-5); overflow-y: auto; }
.modal-foot { padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2); background: var(--surface-2); }

/* ---------- Toast ---------- */
.toasts { position: fixed; bottom: var(--sp-4); right: var(--sp-4); left: var(--sp-4); z-index: 50; display: flex; flex-direction: column; align-items: flex-end; gap: var(--sp-2); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: var(--sp-3); max-width: 420px; padding: 10px 14px; border-radius: var(--radius); background: var(--text); color: var(--bg); box-shadow: var(--shadow-2); font-size: var(--fs-sm); }
.toast .btn { min-height: 26px; color: var(--bg); background: transparent; border-color: transparent; text-decoration: underline; padding: 0 4px; }

/* ---------- Dropdown menu (details) ----------*/
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 200px; padding: var(--sp-1); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-2); }
.menu-list a, .menu-list button { display: flex; align-items: center; gap: var(--sp-2); width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: var(--radius-sm); color: var(--text); font: inherit; font-size: var(--fs-sm); text-decoration: none; text-align: left; cursor: pointer; }
.menu-list a:hover, .menu-list button:hover { background: var(--surface-2); }
.menu-list .danger { color: var(--danger); }
.menu-list hr { margin: var(--sp-1) 0; }

/* ---------- Empty state ----------*/
.empty { text-align: center; padding: var(--sp-7) var(--sp-4); color: var(--text-2); }
.empty .empty-icon { width: 48px; height: 48px; margin: 0 auto var(--sp-3); border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; color: var(--text-3); }
.empty h3 { color: var(--text); }

/* ---------- Steps (multi-session / wizard) ----------*/
.steps { display: flex; gap: var(--sp-2); counter-reset: step; list-style: none; padding: 0; margin: 0 0 var(--sp-5); overflow-x: auto; }
.steps li { flex: 1; min-width: 120px; counter-increment: step; padding-top: var(--sp-2); border-top: 3px solid var(--surface-3); font-size: var(--fs-sm); color: var(--text-3); }
.steps li::before { content: counter(step) ". "; font-weight: 700; }
.steps li strong { display: block; color: inherit; font-weight: 600; }
.steps li.done { border-top-color: var(--primary); color: var(--text-2); }
.steps li.current { border-top-color: var(--primary); color: var(--text); }

/* ---------- Slot picking (public page) ----------*/
.day-group + .day-group { margin-top: var(--sp-5); }
.day-title { display: flex; align-items: baseline; gap: var(--sp-2); margin-bottom: var(--sp-2); font-weight: 700; }
.day-title .muted { font-weight: 400; }
.slot-grid { display: grid; gap: var(--sp-2); grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); }
/* Days side by side (cancelling a booking: a few sessions, often weeks apart). */
.day-row { display: flex; flex-wrap: wrap; gap: var(--sp-5); }
.day-row .day-group + .day-group { margin-top: 0; }
.day-row .slot-grid { grid-template-columns: repeat(auto-fill, minmax(108px, max-content)); justify-content: center; }
.day-row .day-title { justify-content: center; }
.slot-chip { position: relative; display: block; }
.slot-chip input { position: absolute; opacity: 0; }
.slot-chip span {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 52px; padding: 6px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer;
  transition: border-color .12s, background .12s;
}
.slot-chip small { font-weight: 500; color: var(--text-3); font-size: var(--fs-xs); }
.slot-chip span:hover { border-color: var(--primary); }
.slot-chip input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.slot-chip input:checked + span small { color: var(--on-primary); opacity: .85; }
.slot-chip input:focus-visible + span { box-shadow: var(--focus-ring); }
/* Chips of sessions to cancel: the chosen ones in red. */
.slot-chip-danger span:hover { border-color: var(--danger); }
.slot-chip-danger input:checked + span { background: var(--danger); border-color: var(--danger); color: var(--on-danger); }
.slot-chip-danger input:checked + span small { color: var(--on-danger); }
.slot-chip input:disabled + span { background: var(--surface-2); border-style: dashed; color: var(--text-3); cursor: not-allowed; text-decoration: line-through; }
.slot-chip input:disabled + span small { text-decoration: none; }

/* Booking summary*/
.summary { padding: var(--sp-4); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2); }
.summary-item { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-2) 0; }
.summary-item + .summary-item { border-top: 1px solid var(--border); }
.date-badge { flex: none; width: 48px; text-align: center; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); overflow: hidden; }
.date-badge .m { display: block; background: #c8102e; color: #fff; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 1px 0; }
.date-badge .d { display: block; font-size: var(--fs-lg); font-weight: 700; line-height: 1.6; }

/* Participant code*/
.code-box { display: inline-flex; align-items: center; gap: var(--sp-2); padding: 6px 12px; border-radius: var(--radius); background: var(--surface-2); border: 1px dashed var(--border-strong); font-family: var(--font-mono); font-weight: 600; letter-spacing: .04em; }

/* Language picker*/
.lang-switch { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; font-size: var(--fs-xs); font-weight: 700; }
.lang-switch a { padding: 3px 8px; color: var(--text-3); text-decoration: none; }
.lang-switch a[aria-current="true"] { background: var(--surface-3); color: var(--text); }

/* Avatar */
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); display: inline-grid; place-items: center; font-size: var(--fs-xs); font-weight: 700; flex: none; }

/* Public page hero*/
.hero { padding: var(--sp-5) 0 var(--sp-4); }
.hero h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
.hero .lead { font-size: var(--fs-lg); color: var(--text-2); }
.facts { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); margin: var(--sp-4) 0; padding: 0; list-style: none; font-size: var(--fs-sm); color: var(--text-2); }
.facts li { display: inline-flex; align-items: center; gap: var(--sp-2); }
.facts strong { color: var(--text); }

/* ---------- Weekly calendar (researcher area) ----------*/
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.cal-toolbar .cal-range { font-weight: 700; font-size: var(--fs-lg); }
.cal-legend { display: flex; flex-wrap: wrap; gap: var(--sp-3); font-size: var(--fs-xs); color: var(--text-2); }
.cal-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

.cal { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); overflow: auto; max-height: 72vh; }
.cal-grid { display: grid; grid-template-columns: var(--cal-time-w) repeat(var(--cal-days, 7), minmax(110px, 1fr)); min-width: calc(var(--cal-time-w) + var(--cal-days, 7) * 110px); }
.cal-head { position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--border); padding: 8px 6px; text-align: center; font-size: var(--fs-xs); color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.cal-head b { display: block; font-size: var(--fs-lg); color: var(--text); letter-spacing: 0; text-transform: none; }
.cal-head.is-today b { color: var(--accent-text); }
.cal-head.corner { left: 0; z-index: 4; }
.cal-times { position: sticky; left: 0; z-index: 2; background: var(--surface); border-right: 1px solid var(--border); }
.cal-time { height: var(--cal-hour-h); padding: 0 6px; text-align: right; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; transform: translateY(-7px); }
.cal-col {
  position: relative; border-left: 1px solid var(--border);
  height: calc(var(--cal-hours, 10) * var(--cal-hour-h));
  background-image: linear-gradient(to bottom, var(--border) 1px, transparent 1px),
                    linear-gradient(to bottom, transparent calc(var(--cal-hour-h) / 2), color-mix(in srgb, var(--border) 50%, transparent) calc(var(--cal-hour-h) / 2), transparent calc(var(--cal-hour-h) / 2 + 1px));
  background-size: 100% var(--cal-hour-h);
  cursor: crosshair; user-select: none;
}
.cal-col:first-of-type { border-left: 0; }
.cal-col.is-off { background-color: var(--surface-2); cursor: default; }
/* Positioned slot: set --start (hours from the grid start, decimals) and --len (hours)*/
.cal-slot {
  position: absolute; left: 3px; right: 3px;
  top: calc(var(--start) * var(--cal-hour-h) + 1px);
  height: calc(var(--len) * var(--cal-hour-h) - 2px);
  padding: 3px 6px; border-radius: var(--radius-sm); overflow: hidden;
  font-size: 11px; line-height: 1.3; cursor: pointer;
  /* Default state: free (no bookings) */
  background: var(--ok-soft); color: var(--ok);
  border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent); border-left-width: 3px;
}
.cal-slot .t { font-weight: 700; font-variant-numeric: tabular-nums; }
.cal-slot .c { float: right; font-weight: 700; }
.cal-slot .p { display: block; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-slot:hover { box-shadow: var(--shadow-2); z-index: 1; }
.cal-slot.is-partial { background: var(--accent-soft); color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
/* Full, to be confirmed: the only state asking the researcher to act */
.cal-slot.is-full { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
/* Confirmed: solid fill, the slot is closed */
.cal-slot.is-confirmed { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.cal-slot.is-confirmed .p { color: color-mix(in srgb, var(--on-primary) 80%, transparent); }
.cal-slot.is-confirmed .cal-person:hover { color: var(--on-primary); }
.cal-slot.is-selected { box-shadow: 0 0 0 2px var(--danger); z-index: 2; } /* the current-time line's red, visible on every fill */
.cal-slot.is-draft { background: transparent; border: 2px dashed var(--primary); color: var(--primary-text); }
.cal-slot.is-past { opacity: .5; }
.cal-slot.is-drop { box-shadow: 0 0 0 2px var(--primary), var(--shadow-2); }
.cal-now { position: absolute; left: 0; right: 0; top: calc(var(--start) * var(--cal-hour-h)); border-top: 2px solid var(--danger); z-index: 2; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -4px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }

/* Slot details side panel*/
.panel { position: sticky; top: calc(var(--topbar-h) + var(--sp-4)); }
.person { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) 0; }
.person + .person { border-top: 1px solid var(--border); }
.person .who { flex: 1; min-width: 0; }
.person .who strong { display: block; font-size: var(--fs-sm); overflow-wrap: anywhere; }
.person > .btn { flex-shrink: 0; }
/* A row that opens its slot in the calendar. */
a.person-link { color: inherit; text-decoration: none; margin: 0 calc(-1 * var(--sp-2)); padding-inline: var(--sp-2); border-radius: var(--radius); }
a.person-link:hover { background: var(--surface-2); }
a.person-link:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.person .who span { display: block; font-size: var(--fs-xs); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drag-handle { cursor: grab; color: var(--text-3); }

/* QR */
.qr { display: inline-block; flex: none; padding: var(--sp-3); background: #fff; border-radius: var(--radius); border: 1px solid var(--border); }
.qr img, .qr svg { display: block; width: 198px; height: 198px; image-rendering: pixelated; }

/* ---------- Public page components ----------*/
/* Summary fixed at the bottom (slot picking)*/
.sticky-bar { position: sticky; bottom: 0; z-index: 10; display: flex; align-items: center; gap: var(--sp-3);
  margin: var(--sp-5) calc(-1 * var(--sp-4)) 0; padding: var(--sp-3) var(--sp-4);
  background: var(--surface); border-top: 1px solid var(--border); box-shadow: var(--shadow-up); }
.sticky-bar-text { flex: 1; min-width: 0; font-size: var(--fs-sm); line-height: 1.35; }
.sticky-bar-text strong { display: block; font-size: var(--fs-md); }
@media (min-width: 768px) {
  .sticky-bar { bottom: var(--sp-4); margin: var(--sp-5) 0 0; border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-2); }
}
/* Day visible but not selectable (constraint between sessions)*/
.day-off { display: flex; gap: var(--sp-2); align-items: flex-start; padding: var(--sp-2) var(--sp-3);
  border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--text-3); font-size: var(--fs-sm); }
.day-off strong { color: var(--text-2); font-weight: 600; }
.day-off .icon { margin-top: 3px; }
/* Large outcome icon*/
.status-icon { width: 56px; height: 56px; margin: 0 auto var(--sp-3); border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.status-icon .icon { width: 28px; height: 28px; }
.status-icon.is-ok { background: var(--ok-soft); color: var(--ok); }
.status-icon.is-info { background: var(--info-soft); color: var(--info); }
.status-icon.is-warn { background: var(--warn-soft); color: var(--warn); }
.status-icon.is-danger { background: var(--danger-soft); color: var(--danger); }
@media (max-width: 600px) { .btn-block-sm { width: 100%; } }
/* Collapsible long text (information sheet)*/
.disclosure { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.disclosure > summary { padding: var(--sp-3) var(--sp-4); cursor: pointer; font-weight: 600; font-size: var(--fs-sm); color: var(--accent-text); }
.disclosure-body { max-height: 240px; overflow-y: auto; padding: 0 var(--sp-4) var(--sp-3); font-size: var(--fs-sm); color: var(--text-2); }
.disclosure-body h4 { margin: var(--sp-3) 0 var(--sp-1); font-size: var(--fs-sm); color: var(--text); }
/* Checklist*/
.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { display: flex; align-items: flex-start; gap: var(--sp-2); }
.check-list li + li { margin-top: var(--sp-2); }
.check-list .icon { margin-top: 3px; color: var(--ok); }
.card.is-locked { background: var(--surface-2); box-shadow: none; }
@media (max-width: 600px) { .steps li { min-width: 0; } }

/* ---------- Researcher area components ----------*/
.split > * { min-width: 0; }
.input-affix .input { min-width: 0; }
.seg { flex-wrap: wrap; max-width: 100%; }
/* Login page*/
.auth { min-height: 100vh; display: grid; place-items: center; padding: var(--sp-5) var(--sp-4); }
.auth-card { width: 100%; max-width: 400px; }
/* Save/Cancel bar fixed at the bottom*/
.action-bar { position: sticky; bottom: 0; z-index: 10; margin-top: var(--sp-5); padding: var(--sp-3) var(--sp-4);
  background: var(--surface); border-top: 1px solid var(--border); box-shadow: var(--shadow-up); }
/* Action bar for multiple selection*/
.selection-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-3); border-radius: var(--radius);
  background: var(--accent-soft); color: var(--accent-text); font-size: var(--fs-sm); font-weight: 600; }
.strike { text-decoration: line-through; color: var(--text-3); }
/* Free place in a slot*/
.person-empty { justify-content: center; margin-top: var(--sp-2); border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--text-3); font-size: var(--fs-sm); }
.qr.qr-lg img, .qr.qr-lg svg { width: 231px; height: 231px; }

/* ---------- Utilities ----------*/
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.danger-text { color: var(--danger); }
.ok-text { color: var(--ok); }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-0 { margin-top: 0 !important; } .mb-0 { margin-bottom: 0 !important; }
.mt-2 { margin-top: var(--sp-2); } .mt-4 { margin-top: var(--sp-4); } .mt-5 { margin-top: var(--sp-5); }
.mb-2 { margin-bottom: var(--sp-2); } .mb-4 { margin-bottom: var(--sp-4); } .mb-5 { margin-bottom: var(--sp-5); }
.w-full { width: 100%; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (max-width: 600px) { .hide-sm { display: none !important; } }
@media (min-width: 601px) { .show-sm { display: none !important; } }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  .topbar, .nav, .btn, .public-footer { display: none !important; }
  body { background: #fff; }
}

/* ==========================================================================
   Calendar component (web/static/js/calendar.js)
   Interaction states added by the JS: drag ghost, resize handle, lanes for
   overlapping slots, person chips, dialog lists. Existing tokens only.
   ========================================================================== */
.cal-root.is-busy .cal { cursor: progress; }
.cal[aria-busy="true"] .cal-grid { opacity: .6; transition: opacity .15s; }
.cal-slot { -webkit-touch-callout: none; }
.cal-slot:focus-visible { box-shadow: var(--focus-ring); z-index: 3; }
.cal-slot.is-selected:focus-visible { box-shadow: 0 0 0 2px var(--danger), var(--focus-ring); }
/* Overlapping slots side by side: --lane (0-based) of --lanes*/
.cal-slot.in-lane { right: auto; left: calc(3px + var(--lane) * (100% - 6px) / var(--lanes)); width: calc((100% - 6px) / var(--lanes) - 2px); }
/* Resize handle on the bottom edge*/
.cal-resize { position: absolute; left: 0; right: 0; bottom: 0; height: 7px; cursor: ns-resize; touch-action: none; }
.cal-resize::after { content: ""; position: absolute; left: 50%; bottom: 2px; width: 18px; height: 2px; margin-left: -9px; border-radius: 2px; background: currentColor; opacity: 0; }
.cal-slot:hover .cal-resize::after, .cal-slot.is-selected .cal-resize::after { opacity: .45; }
.cal-slot.is-past .cal-resize { display: none; }
/* Participants inside a slot: draggable chips*/
.cal-slot .p.is-list { white-space: normal; }
.cal-slot .p.is-list .cal-person { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-person { cursor: grab; border-radius: 3px; touch-action: none; }
.cal-person:hover { background: color-mix(in srgb, currentColor 12%, transparent); color: var(--text); }
/* Drag feedback*/
.cal-slot.is-dragging { opacity: .35; }
.cal-slot.cal-ghost { pointer-events: none; z-index: 4; background: color-mix(in srgb, var(--primary-soft) 85%, transparent); box-shadow: var(--shadow-2); }
.cal-person-ghost { position: fixed; z-index: 60; pointer-events: none; transform: translate(12px, 12px); padding: 3px 10px; border-radius: var(--radius-pill); background: var(--primary); color: var(--on-primary); font-size: var(--fs-xs); font-weight: 600; font-family: var(--font-mono); box-shadow: var(--shadow-2); white-space: nowrap; }
.cal-root.is-dragging, .cal-root.is-dragging * { user-select: none; -webkit-user-select: none; }
.cal-root.is-drag-move, .cal-root.is-drag-move *, .cal-root.is-drag-person, .cal-root.is-drag-person * { cursor: grabbing !important; }
.cal-root.is-drag-resize, .cal-root.is-drag-resize * { cursor: ns-resize !important; }
.cal-root.is-drag-create, .cal-root.is-drag-create * { cursor: crosshair !important; }
.drag-handle[data-booking] { touch-action: none; }
/* Confirmation dialogs*/
.cal-dialog-list { max-height: 260px; overflow-y: auto; margin: var(--sp-2) 0 0; }

/* Settings: who takes over the slots and rules of a researcher leaving the team. */
.handover { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); }

/* Researchers of reference picker (res-picker.js): chips and a pencil that opens the list. */
.res-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.res-chip { display: inline-flex; align-items: center; gap: 2px; min-height: 30px; box-sizing: border-box; padding: 0 12px; border-radius: var(--radius-pill, 999px); background: var(--accent-soft); color: var(--text); font-size: var(--fs-sm); font-weight: 600; }
.res-chip:has(.x) { padding-right: 4px; }
.res-chip .x { width: 26px; height: 26px; border: 0; background: transparent; border-radius: 999px; display: grid; place-items: center; color: var(--text-2); cursor: pointer; padding: 0; }
.res-chip .x:hover { background: var(--surface-3); color: var(--text); }
.res-chip .x .icon { width: 14px; height: 14px; }
.res-menu { position: relative; display: inline-block; }
.res-menu > summary { list-style: none; }
.res-menu > summary::-webkit-details-marker { display: none; }
.res-edit { display: grid; place-items: center; width: 30px; height: 30px; box-sizing: border-box; border-radius: 999px; border: 1px dashed var(--border-strong); background: var(--surface); color: var(--text-2); cursor: pointer; }
.res-edit:hover, .res-menu[open] > .res-edit { background: var(--surface-2); color: var(--text); }
.res-edit .icon { width: 16px; height: 16px; }
.res-list { position: absolute; left: 0; top: calc(100% + 6px); z-index: 40; min-width: 240px; max-height: 320px; overflow-y: auto; padding: var(--sp-1); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-2); }
.res-list .pick { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); font-size: var(--fs-sm); cursor: pointer; }
.res-list .pick:hover { background: var(--surface-2); }
.res-list .pick input { margin-top: 3px; }
.res-list .pick span { display: flex; flex-direction: column; font-weight: 600; }
.res-list small { font-size: var(--fs-xs); font-weight: 400; color: var(--text-2); }
.res-foot { margin-top: var(--sp-1); padding-top: var(--sp-1); border-top: 1px solid var(--border); }

/* Slot side panel: place and researchers changed but not saved yet (a light
   bar beside the field, Cancel/Save in the footer, shown only then). */
.panel-draft .row { justify-content: flex-end; }
.panel-head-actions { flex-wrap: nowrap; flex-shrink: 0; align-self: flex-start; }
.dl dd.is-changed { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--warn) 40%, transparent); padding-left: 8px; }
.res-foot .btn { width: 100%; justify-content: flex-start; }

/* Calendar toolbar: "only my slots" (hidden when the user is not in the team). */
.cal-mine { white-space: nowrap; }
