/* =====================================================================
   Aesthetic Architecture Research — design system
   Sober, photographic, architecture-oriented. Tokens first, components after.
   ===================================================================== */

:root {
  /* spacing (4px grid) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  /* radii */
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-pill: 999px;
  /* typography */
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --fs-xs: .75rem; --fs-sm: .8125rem; --fs-base: .9375rem; --fs-md: 1.0625rem; --fs-lg: 1.375rem; --fs-xl: 1.875rem; --fs-2xl: 2.75rem;
  --lh: 1.55;
  /* motion */
  --ease: cubic-bezier(.2,.7,.2,1); --t-fast: 120ms; --t: 200ms;

  /* light theme */
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #f0efeb;
  --surface-3: #e7e5df;
  --border: #e2e0da;
  --border-strong: #cfccc4;
  --text: #1b1b1a;
  --text-muted: #6b6963;
  --text-faint: #9a978f;
  --accent: #2f5d62;
  --accent-hover: #264d51;
  --accent-soft: #e3eceb;
  --accent-contrast: #ffffff;
  --success: #2e6b3f; --success-soft: #e3efe5;
  --warning: #8a5a0b; --warning-soft: #f6ecd8;
  --danger: #a13a2e; --danger-soft: #f6e2df;
  --info: #3b5b86; --info-soft: #e3e9f2;
  --focus: #2f5d62;
  --shadow-1: 0 1px 2px rgba(20,18,12,.06), 0 1px 1px rgba(20,18,12,.04);
  --shadow-2: 0 8px 24px rgba(20,18,12,.08), 0 2px 6px rgba(20,18,12,.05);
  --shadow-3: 0 24px 64px rgba(20,18,12,.18);
  /* participant stage: identical in both themes to keep viewing conditions constant across raters */
  --stage-bg: #262626;
  --stage-text: #ececea;
  --stage-muted: #a6a6a2;
  --stage-surface: #333332;
  --stage-border: #474745;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141413; --surface: #1c1c1b; --surface-2: #232322; --surface-3: #2c2c2a;
    --border: #30302e; --border-strong: #42423f;
    --text: #ecebe7; --text-muted: #a3a19a; --text-faint: #75736d;
    --accent: #7fb0b3; --accent-hover: #93c0c3; --accent-soft: #1f3134; --accent-contrast: #0f1a1b;
    --success: #7fbf8f; --success-soft: #1d2d21; --warning: #d9aa5a; --warning-soft: #33291a;
    --danger: #e0877b; --danger-soft: #3a211d; --info: #8fb0da; --info-soft: #1f2836;
    --focus: #93c0c3;
    --shadow-1: 0 1px 2px rgba(0,0,0,.4); --shadow-2: 0 8px 24px rgba(0,0,0,.45); --shadow-3: 0 24px 64px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141413; --surface: #1c1c1b; --surface-2: #232322; --surface-3: #2c2c2a;
  --border: #30302e; --border-strong: #42423f;
  --text: #ecebe7; --text-muted: #a3a19a; --text-faint: #75736d;
  --accent: #7fb0b3; --accent-hover: #93c0c3; --accent-soft: #1f3134; --accent-contrast: #0f1a1b;
  --success: #7fbf8f; --success-soft: #1d2d21; --warning: #d9aa5a; --warning-soft: #33291a;
  --danger: #e0877b; --danger-soft: #3a211d; --info: #8fb0da; --info-soft: #1f2836;
  --focus: #93c0c3;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4); --shadow-2: 0 8px 24px rgba(0,0,0,.45); --shadow-3: 0 24px 64px rgba(0,0,0,.6);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: var(--fs-base); line-height: var(--lh);
  color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 var(--s3); font-weight: 600; letter-spacing: -.015em; }
h1 { font-size: var(--fs-xl); letter-spacing: -.025em; }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }
p { margin: 0 0 var(--s4); }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }
code, .mono { font-family: var(--font-mono); font-size: .92em; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--s5) 0; }
small, .small { font-size: var(--fs-sm); }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: var(--s4); top: -100px; background: var(--surface); padding: var(--s2) var(--s3); border-radius: var(--r-sm); z-index: 100; box-shadow: var(--shadow-2); }
.skip-link:focus { top: var(--s3); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }

/* ---------- layout ---------- */
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 var(--s5); }
.container-narrow { max-width: 760px; }
.stack > * + * { margin-top: var(--s4); }
.stack-lg > * + * { margin-top: var(--s6); }
.row { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: var(--s3); align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grid { display: grid; gap: var(--s4); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
@media (max-width: 1024px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); } .container { padding: 0 var(--s4); } }

/* ---------- public header ---------- */
.site-header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: var(--s4); }
.brand { display: inline-flex; align-items: center; gap: var(--s3); font-weight: 600; letter-spacing: -.01em; color: var(--text); text-decoration: none; }
.brand-mark { width: 22px; height: 22px; border: 2px solid currentColor; border-radius: 3px; position: relative; flex: none; }
.brand-mark::after { content: ""; position: absolute; left: 3px; right: 3px; bottom: 3px; height: 45%; background: currentColor; }
.brand small { font-weight: 400; color: var(--text-muted); }
.header-tools { display: flex; align-items: center; gap: var(--s2); }
.site-nav { display: flex; align-items: center; gap: var(--s4); margin-right: auto; margin-left: var(--s5); }
.site-nav a { color: var(--text-muted); text-decoration: none; font-size: var(--fs-sm); font-weight: 550; padding: 6px 2px; border-bottom: 2px solid transparent; }
.site-nav a:hover { color: var(--text); }
.site-nav a[aria-current="page"] { color: var(--text); border-bottom-color: currentColor; }
@media (max-width: 560px) { .site-nav { margin-left: var(--s2); } .brand > span:last-child { display: none; } }

/* ---------- about us ---------- */
.about-summary { max-width: 68ch; }
.about-summary p { color: var(--text-muted); }
.about-summary .lead { color: var(--text); }
.about-team { padding-bottom: var(--s8, 64px); }
.team-grid { list-style: none; padding: 0; margin: var(--s5) 0 0; display: grid; gap: var(--s5); grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.team-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.team-card img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; background: var(--surface-3); }
.team-body { padding: var(--s4); }
.team-body h3 { margin: 0 0 2px; font-size: 1.05rem; }
.team-role { margin: 0; font-size: var(--fs-sm); font-weight: 550; color: var(--accent); }
.team-affiliation { margin: 2px 0 0; font-size: var(--fs-xs); color: var(--text-faint); }
.team-bio { margin: var(--s3) 0 0; font-size: var(--fs-sm); color: var(--text-muted); line-height: 1.55; }
.lang-switch { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r-pill); padding: 2px; background: var(--surface); }
.lang-switch button { border: 0; background: transparent; color: var(--text-muted); font: inherit; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: 4px 9px; border-radius: var(--r-pill); cursor: pointer; }
.lang-switch button[aria-current="true"] { background: var(--text); color: var(--bg); }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-pill); border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); cursor: pointer; }
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.site-footer { border-top: 1px solid var(--border); margin-top: var(--s8); padding: var(--s5) 0; color: var(--text-muted); font-size: var(--fs-sm); }

/* ---------- landing ---------- */
.hero { padding: clamp(48px, 10vw, 120px) 0 var(--s7); }
.hero h1 { font-size: clamp(2rem, 5vw, 3.4rem); max-width: 16ch; letter-spacing: -.035em; font-weight: 600; }
.hero .lead { font-size: var(--fs-md); color: var(--text-muted); max-width: 58ch; }
.hero-figure { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; margin-top: var(--s7); height: 160px; }
.hero-figure span { background: var(--surface-3); border-radius: 2px; }
.hero-figure span { overflow: hidden; }
.hero-figure img { display: block; width: 100%; height: 100%; object-fit: cover; }
.hero-credits { margin-top: var(--s3); font-size: var(--fs-xs); color: var(--text-faint); line-height: 1.6; }
.hero-credits span { margin-right: .35em; }
.hero-credits a { color: inherit; }
@media (max-width: 720px) { .hero-figure { height: 110px; gap: 4px; } }
.hero-figure span:nth-child(1) { grid-column: span 3; } .hero-figure span:nth-child(2) { grid-column: span 2; margin-top: 40px; }
.hero-figure span:nth-child(3) { grid-column: span 4; margin-top: 16px; background: var(--accent-soft); } .hero-figure span:nth-child(4) { grid-column: span 1; margin-top: 70px; }
.hero-figure span:nth-child(5) { grid-column: span 2; margin-top: 28px; }
.cta-card { display: flex; justify-content: space-between; align-items: center; gap: var(--s5); padding: var(--s5) var(--s6); }
@media (max-width: 720px) { .cta-card { flex-direction: column; align-items: flex-start; } }

/* ---------- buttons ---------- */
.btn {
  --btn-bg: var(--surface); --btn-fg: var(--text); --btn-bd: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 38px; padding: 0 var(--s4); border-radius: var(--r-md); border: 1px solid var(--btn-bd);
  background: var(--btn-bg); color: var(--btn-fg); font: inherit; font-weight: 550; font-size: var(--fs-sm);
  text-decoration: none; cursor: pointer; white-space: nowrap; user-select: none;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), box-shadow var(--t-fast);
}
.btn:hover { border-color: var(--text-faint); color: var(--btn-fg); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn-primary { --btn-bg: var(--accent); --btn-fg: var(--accent-contrast); --btn-bd: var(--accent); }
.btn-primary:hover { --btn-bg: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { --btn-fg: var(--danger); --btn-bd: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { min-height: 30px; padding: 0 var(--s3); font-size: var(--fs-xs); border-radius: var(--r-sm); }
.btn-lg { min-height: 48px; padding: 0 var(--s5); font-size: var(--fs-base); border-radius: var(--r-md); }
.btn-block { width: 100%; }
.btn .spinner { display: none; }
.btn.is-loading .spinner { display: inline-block; }
.btn.is-loading { pointer-events: none; opacity: .8; }
.spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- cards & surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.card-body { padding: var(--s5); }
.card-header { padding: var(--s4) var(--s5); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.card-header h2, .card-header h3 { margin: 0; font-size: var(--fs-md); }
.card-footer { padding: var(--s3) var(--s5); border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card-flat { box-shadow: none; }
.panel { background: var(--surface-2); border-radius: var(--r-md); padding: var(--s4); }

/* ---------- stat tiles ---------- */
.stat { padding: var(--s4) var(--s5); }
.stat-label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); font-weight: 600; }
.stat-value { font-size: 1.9rem; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat-value small { font-size: var(--fs-sm); font-weight: 500; color: var(--text-muted); letter-spacing: 0; }
.stat-sub { font-size: var(--fs-sm); color: var(--text-muted); margin-top: var(--s1); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600; line-height: 1.6; background: var(--surface-3); color: var(--text-muted); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border: 1px solid var(--border); border-radius: var(--r-pill); font-size: var(--fs-xs); color: var(--text-muted); background: var(--surface); }
.chip-danger { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); color: var(--danger); background: var(--danger-soft); }

/* ---------- alerts ---------- */
.alert { display: flex; gap: var(--s3); padding: var(--s3) var(--s4); border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-2); font-size: var(--fs-sm); }
.alert strong { font-weight: 600; }
.alert-info { background: var(--info-soft); border-color: transparent; color: var(--text); }
.alert-warning { background: var(--warning-soft); border-color: transparent; }
.alert-danger { background: var(--danger-soft); border-color: transparent; }
.alert-success { background: var(--success-soft); border-color: transparent; }
.alert ul { margin: 0; padding-left: 1.1em; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: var(--fs-sm); font-weight: 550; color: var(--text); }
.hint { font-size: var(--fs-xs); color: var(--text-muted); }
.input, .select, .textarea {
  width: 100%; font: inherit; font-size: var(--fs-sm); color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm); padding: 8px 10px; min-height: 38px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
.textarea.tall { min-height: 220px; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.input[readonly], .input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-2); color: var(--text-muted); }
.check { display: inline-flex; align-items: flex-start; gap: var(--s2); font-size: var(--fs-sm); cursor: pointer; }
.check input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.form-grid { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-all { grid-column: 1 / -1; }
@media (max-width: 720px) { .form-grid .span-2 { grid-column: 1 / -1; } }
.form-actions { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; margin-top: var(--s5); }
fieldset { border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s4); margin: 0; min-width: 0; }
legend { padding: 0 var(--s2); font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); }
input[type="file"].input { padding: 6px; }

/* segmented radio (expertise etc.) */
.segmented { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border-strong); border-radius: var(--r-md); overflow: hidden; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; }
.segmented span { display: block; padding: 8px 16px; font-size: var(--fs-sm); font-weight: 550; cursor: pointer; border-right: 1px solid var(--border); min-width: 44px; text-align: center; }
.segmented label:last-child span { border-right: 0; }
.segmented input:checked + span { background: var(--accent); color: var(--accent-contrast); }
.segmented input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: -3px; }

/* ---------- tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th { text-align: left; font-weight: 600; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); padding: 10px var(--s3); border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
.table td { padding: 10px var(--s3); border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.table .num, .table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-compact td, .table-compact th { padding: 6px var(--s2); }
.table a { font-weight: 550; }

/* ---------- mini distribution bars ---------- */
.dist { display: inline-flex; align-items: flex-end; gap: 2px; height: 26px; vertical-align: middle; }
.dist i { display: block; width: 7px; background: var(--accent); opacity: .75; border-radius: 1px 1px 0 0; min-height: 1px; }
.hbar { height: 8px; background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden; }
.hbar > span { display: block; height: 100%; background: var(--accent); border-radius: var(--r-pill); }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding-top: var(--s2); }
.bars > div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; justify-content: flex-end; height: 100%; }
.bars > div > span { width: 100%; background: var(--accent); opacity: .8; border-radius: 3px 3px 0 0; min-height: 1px; }
.bars > div > small { color: var(--text-muted); font-size: 10px; }

/* ---------- progress ---------- */
.progress { height: 6px; background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: var(--r-pill); transition: width var(--t) var(--ease); }
.progress.success > span { background: var(--success); }

/* ---------- admin shell ---------- */
.admin-top { position: sticky; top: 0; z-index: 30; height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 var(--s5); background: var(--surface); border-bottom: 1px solid var(--border); gap: var(--s4); }
.admin-top .crumbs { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-sm); color: var(--text-muted); min-width: 0; }
.admin-top .crumbs a { color: var(--text-muted); text-decoration: none; }
.admin-top .crumbs a:hover { color: var(--text); }
.admin-top .crumbs .sep { color: var(--text-faint); }
.admin-top .crumbs strong { color: var(--text); font-weight: 600; }
.admin-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: calc(100vh - 56px); }
.admin-shell.no-sidebar { grid-template-columns: minmax(0, 1fr); }
.sidebar { border-right: 1px solid var(--border); background: var(--surface); padding: var(--s4) var(--s3); position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; }
.sidebar .exp-head { padding: var(--s2) var(--s3) var(--s4); border-bottom: 1px solid var(--border); margin-bottom: var(--s3); }
.sidebar .exp-head .code { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-muted); }
.sidebar .exp-head .name { font-weight: 600; font-size: var(--fs-sm); line-height: 1.35; margin: 2px 0 var(--s2); }
.nav-group { margin-bottom: var(--s3); }
.nav-group-title { font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--text-faint); padding: var(--s2) var(--s3) var(--s1); }
.nav-link { display: flex; align-items: center; gap: var(--s2); padding: 7px var(--s3); border-radius: var(--r-sm); color: var(--text-muted); text-decoration: none; font-size: var(--fs-sm); font-weight: 500; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-link .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); flex: none; }
.nav-link .dot.done { background: var(--success); }
.nav-link .dot.active { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.admin-main { padding: var(--s6) var(--s6) var(--s8); min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s5); }
.page-head h1 { margin: 0; font-size: 1.6rem; }
.page-head p { margin: var(--s1) 0 0; color: var(--text-muted); max-width: 72ch; }
.section-title { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); margin: var(--s6) 0 var(--s3); }
.menu-toggle { display: none; }
@media (max-width: 1024px) {
  .admin-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 56px; bottom: 0; width: 280px; z-index: 40; transform: translateX(-100%); transition: transform var(--t) var(--ease); box-shadow: var(--shadow-3); }
  .sidebar.open { transform: none; }
  .menu-toggle { display: inline-grid; }
  .admin-main { padding: var(--s5) var(--s4) var(--s7); }
}

/* phase header (status, prerequisites, warnings, next action) */
.phase-strip { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s4); align-items: center; padding: var(--s4) var(--s5); }
.checks { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); list-style: none; margin: 0; padding: 0; font-size: var(--fs-sm); }
.checks li { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); }
.checks li.ok { color: var(--text); }
.checks .mark { width: 16px; height: 16px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 10px; font-weight: 700; background: var(--surface-3); color: var(--text-faint); }
.checks li.ok .mark { background: var(--success-soft); color: var(--success); }
@media (max-width: 720px) { .phase-strip { grid-template-columns: minmax(0, 1fr); } }

/* timeline of phases on overview */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: var(--s3); padding-bottom: var(--s4); position: relative; }
.timeline li::before { content: ""; position: absolute; left: 13px; top: 26px; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline .node { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--text-faint); }
.timeline li.done .node { border-color: var(--success); background: var(--success); color: #fff; }
.timeline li.active .node { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.timeline h4 { margin: 3px 0 var(--s1); font-size: var(--fs-base); }

/* thumbnails */
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: var(--s3); }
.thumb { position: relative; display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; text-decoration: none; color: var(--text); transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast); }
.thumb:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); color: var(--text); }
.thumb .img { aspect-ratio: 4 / 3; background: var(--surface-3); overflow: hidden; }
.thumb .img img { width: 100%; height: 100%; object-fit: cover; }
.thumb .meta { padding: var(--s2) var(--s3); font-size: var(--fs-xs); }
.thumb .meta .code { font-family: var(--font-mono); font-weight: 600; }
.thumb .meta .sub { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb.is-excluded .img { opacity: .35; filter: grayscale(1); }
.thumb .corner { position: absolute; top: var(--s2); right: var(--s2); }
.mini-thumb { width: 64px; height: 48px; object-fit: cover; border-radius: var(--r-sm); background: var(--surface-3); }
.img-preview { width: 100%; max-height: 70vh; object-fit: contain; background: var(--surface-3); border-radius: var(--r-md); }

/* skeleton */
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: var(--r-sm); }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* empty state */
.empty { text-align: center; padding: var(--s7) var(--s5); color: var(--text-muted); }
.empty .empty-icon { width: 44px; height: 44px; margin: 0 auto var(--s3); border: 2px dashed var(--border-strong); border-radius: var(--r-md); }
.empty h3 { color: var(--text); margin-bottom: var(--s2); }

/* pager */
.pager { display: flex; gap: var(--s1); align-items: center; justify-content: center; margin-top: var(--s5); flex-wrap: wrap; }
.pager a, .pager span { min-width: 34px; height: 34px; display: inline-grid; place-items: center; padding: 0 var(--s2); border-radius: var(--r-sm); font-size: var(--fs-sm); text-decoration: none; color: var(--text-muted); border: 1px solid transparent; }
.pager a:hover { border-color: var(--border); color: var(--text); }
.pager .current { background: var(--text); color: var(--bg); font-weight: 600; }

/* tabs */
.tabs { display: flex; gap: var(--s1); border-bottom: 1px solid var(--border); margin-bottom: var(--s5); overflow-x: auto; }
.tabs a { padding: var(--s2) var(--s3); text-decoration: none; color: var(--text-muted); font-size: var(--fs-sm); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

/* toasts */
.toasts { position: fixed; right: var(--s4); bottom: var(--s4); z-index: 100; display: flex; flex-direction: column; gap: var(--s2); max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; gap: var(--s3); align-items: flex-start; background: var(--text); color: var(--bg); padding: var(--s3) var(--s4); border-radius: var(--r-md); box-shadow: var(--shadow-3); font-size: var(--fs-sm); animation: toast-in var(--t) var(--ease); white-space: pre-line; }
.toast.error { background: var(--danger); color: #fff; }
.toast button { margin-left: auto; background: transparent; border: 0; color: inherit; opacity: .7; cursor: pointer; font-size: 18px; line-height: 1; padding: 0; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* dialogs */
dialog.modal { border: 0; padding: 0; border-radius: var(--r-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-3); width: min(520px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(10,10,8,.45); backdrop-filter: blur(2px); }
dialog.modal .modal-body { padding: var(--s5); }
dialog.modal .modal-actions { display: flex; justify-content: flex-end; gap: var(--s2); padding: var(--s3) var(--s5) var(--s5); }
dialog.modal[open] { animation: modal-in var(--t) var(--ease); }
@keyframes modal-in { from { transform: translateY(10px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }

details.disclosure { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
details.disclosure > summary { cursor: pointer; padding: var(--s3) var(--s4); font-weight: 600; font-size: var(--fs-sm); list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.disclosure > summary::after { content: "+"; color: var(--text-muted); font-weight: 400; font-size: 18px; }
details.disclosure[open] > summary::after { content: "–"; }
details.disclosure > .body { padding: 0 var(--s4) var(--s4); }

.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px var(--s4); font-size: var(--fs-sm); margin: 0; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.term-flag { background: var(--danger-soft); color: var(--danger); border-radius: 3px; padding: 0 2px; }
.caption-row .textarea { min-height: 64px; }
.status-saved { color: var(--success); font-size: var(--fs-xs); }

/* ---------- consent & profile ---------- */
.consent-text { white-space: pre-line; font-size: var(--fs-base); line-height: 1.7; }
.consent-text strong { display: block; }
.anon-code { font-family: var(--font-mono); font-size: 1.4rem; font-weight: 600; letter-spacing: .06em; padding: var(--s3) var(--s4); background: var(--surface-2); border-radius: var(--r-md); display: inline-block; }
.copy-field { display: flex; gap: var(--s2); }
.copy-field .input { font-family: var(--font-mono); font-size: var(--fs-xs); }

/* =====================================================================
   Participant task stage (rating / pairwise)
   Neutral, constant viewing conditions: the stage colour does not follow the theme.
   ===================================================================== */
.task-body { background: var(--stage-bg); color: var(--stage-text); min-height: 100vh; }
.task { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100vh; height: 100dvh; }
.task-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding: var(--s3) var(--s5); }
.task-top .counter { font-size: var(--fs-xs); color: var(--stage-muted); font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.task-top .thin-progress { flex: 1; max-width: 360px; height: 3px; background: var(--stage-surface); border-radius: var(--r-pill); overflow: hidden; }
.task-top .thin-progress > span { display: block; height: 100%; background: var(--stage-text); opacity: .8; transition: width var(--t) var(--ease); }
.task-top .end-link { background: none; border: 0; color: var(--stage-muted); font: inherit; font-size: var(--fs-xs); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.task-top .end-link:hover { color: var(--stage-text); }
.stage { position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; overflow: hidden; padding: var(--s2) var(--s5); }
.stage-image { max-width: 100%; max-height: 100%; width: auto; height: auto; min-width: 0; min-height: 0; object-fit: contain; border-radius: 2px; box-shadow: 0 20px 60px rgba(0,0,0,.35); opacity: 0; transition: opacity 220ms var(--ease); cursor: zoom-in; }
.stage-image.is-ready { opacity: 1; }
.stage .loading { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.stage .loading .spinner { width: 26px; height: 26px; color: var(--stage-muted); border-width: 2px; }
.task-bottom { padding: var(--s4) var(--s5) max(var(--s5), env(safe-area-inset-bottom)); display: grid; justify-items: center; gap: var(--s3); }
.question { font-size: var(--fs-md); font-weight: 500; text-align: center; max-width: 60ch; letter-spacing: -.005em; }
.scale { display: grid; grid-template-columns: repeat(var(--points, 7), minmax(44px, 64px)); gap: var(--s2); }
.scale button {
  height: 52px; border-radius: var(--r-md); border: 1px solid var(--stage-border); background: var(--stage-surface); color: var(--stage-text);
  font: inherit; font-size: 1.15rem; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.scale button:hover { border-color: var(--stage-muted); background: #3c3c3b; }
.scale button:active { transform: scale(.96); }
.scale button:focus-visible { outline: 2px solid var(--stage-text); outline-offset: 2px; }
.scale button.is-chosen { background: var(--stage-text); color: var(--stage-bg); border-color: var(--stage-text); }
.scale-labels { display: flex; justify-content: space-between; width: 100%; max-width: 480px; font-size: var(--fs-xs); color: var(--stage-muted); gap: var(--s4); }
.task-hint { font-size: var(--fs-xs); color: var(--stage-muted); }
.task-hint kbd { font-family: var(--font-mono); border: 1px solid var(--stage-border); border-radius: 4px; padding: 0 5px; font-size: 11px; }
.task-error { background: #4a2a26; color: #ffd9d3; padding: var(--s2) var(--s3); border-radius: var(--r-sm); font-size: var(--fs-sm); }
.task.is-busy .scale button, .task.is-busy .pair-choices button { pointer-events: none; }

/* pairwise */
.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: var(--s4); width: 100%; height: 100%; align-items: center; }
.pair figure { margin: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: var(--s2); height: 100%; min-height: 0; justify-items: center; }
.pair figure .frame { position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; height: 100%; width: 100%; overflow: hidden; border-radius: var(--r-md); outline: 2px solid transparent; outline-offset: 4px; transition: outline-color var(--t-fast); }
.pair figure .frame img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pair figure figcaption { font-size: var(--fs-sm); font-weight: 700; letter-spacing: .1em; color: var(--stage-muted); }
.pair figure.is-chosen .frame { outline-color: var(--stage-text); }
.pair-choices { display: flex; gap: var(--s3); flex-wrap: wrap; justify-content: center; }
.pair-choices button { min-width: 120px; height: 50px; border-radius: var(--r-md); border: 1px solid var(--stage-border); background: var(--stage-surface); color: var(--stage-text); font: inherit; font-weight: 600; font-size: var(--fs-base); cursor: pointer; transition: background var(--t-fast), border-color var(--t-fast); }
.pair-choices button:hover { border-color: var(--stage-muted); background: #3c3c3b; }
.pair-choices button.tie { min-width: 160px; color: var(--stage-muted); }
.pair-choices button.is-chosen { background: var(--stage-text); color: var(--stage-bg); }
@media (max-width: 760px) {
  .task-top { padding: var(--s2) var(--s4); }
  .stage { padding: 0 var(--s3); }
  .pair { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s2); }
  .scale { grid-template-columns: repeat(var(--points, 7), minmax(36px, 1fr)); width: 100%; gap: 6px; }
  .scale button { height: 50px; font-size: 1.05rem; }
  .pair-choices { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .pair-choices button { min-width: 0; }
  .pair-choices button.tie { grid-column: 1 / -1; }
  .task-hint { display: none; }
}

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.94); display: none; place-items: center; padding: var(--s4); cursor: zoom-out; }
.lightbox.open { display: grid; animation: fade var(--t) var(--ease); }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox .close { position: absolute; top: var(--s4); right: var(--s4); width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(255,255,255,.3); background: transparent; color: #fff; font-size: 22px; cursor: pointer; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.flash { animation: flash 260ms var(--ease); }
@keyframes flash { 0% { transform: scale(1); } 40% { transform: scale(1.06); } 100% { transform: scale(1); } }

.task-message { max-width: 560px; margin: 0 auto; padding: var(--s8) var(--s5); text-align: center; }
.task-message h1 { font-size: var(--fs-xl); }
.task-message p { color: var(--stage-muted); }
.task-message .btn { --btn-bg: var(--stage-text); --btn-fg: var(--stage-bg); --btn-bd: var(--stage-text); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

@media print {
  .admin-top, .sidebar, .toasts, .form-actions, .btn { display: none !important; }
  .admin-shell { display: block; }
  body { background: #fff; }
}
