/* ════════════════════════════════════════════════════════════════════
   MVTLoop "Signal" admin theme
   Visual-only layer. Loaded AFTER admin.css. No behaviour is changed:
   every rule here targets existing classes/ids.
   ════════════════════════════════════════════════════════════════════ */

:root {
  --a-sidebar-w: 264px;
  --a-content-w: 1160px;
  --a-gap: 20px;
  --a-card-radius: 16px;
  --a-line: var(--border);
  --a-hairline: rgba(23, 32, 51, .08);
  --workspace-header-height: 72px;
  --workspace-sticky-offset: 96px;
}

/* ── Base ───────────────────────────────────────────────────────────── */
html, body { font-size: 16px !important; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 100% -10%, rgba(117, 105, 238, .10), transparent 60%),
    radial-gradient(700px 380px at -10% 110%, rgba(81, 70, 216, .05), transparent 60%),
    var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -.015em; color: var(--ink); }
::selection { background: rgba(117, 105, 238, .24); color: var(--brand-ink); }
.hint, .field-note { color: var(--ink-muted); font-size: .8125rem; line-height: 1.5; }

/* ── Buttons ────────────────────────────────────────────────────────── */
.btn {
  border-radius: 10px;
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: -.005em;
  min-height: 40px;
  padding: 9px 16px;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), transform var(--transition), color var(--transition);
}
.btn.btn-sm { min-height: 34px; padding: 6px 12px; font-size: .8125rem; border-radius: 9px; }
.btn-primary {
  background: var(--brand-primary);
  background-image: linear-gradient(180deg, #5b4fe0 0%, #4338ca 100%);
  border-color: #5146D8;
  color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 6px 14px -6px rgba(81, 70, 216, .42);
}
.btn-primary:hover:not(:disabled) {
  background-image: linear-gradient(180deg, #4f43d6 0%, #3a2fb3 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,.22) inset, 0 10px 22px -8px rgba(81, 70, 216, .48);
  transform: translateY(-1px);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); box-shadow: 0 1px 0 rgba(0,0,0,.1) inset; }
.btn-ghost {
  background: #fff;
  border: 1px solid var(--border-strong);
  color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--accent-light);
  border-color: color-mix(in srgb, var(--brand-primary) 45%, var(--border));
  color: var(--brand-primary);
}
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }
.btn:focus-visible { box-shadow: var(--ring); outline: none; }

/* ── Form controls ──────────────────────────────────────────────────── */
label { color: var(--ink-soft); font-weight: 600; font-size: .8125rem; letter-spacing: .005em; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="number"], input[type="datetime-local"],
input[type="search"], input:not([type]), textarea, select {
  font-family: var(--font-body);
  font-size: .9375rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 42px;
  box-shadow: 0 1px 0 rgba(17,19,58,.03) inset;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
input::placeholder, textarea::placeholder { color: #9AA0BE; }
input:hover, textarea:hover, select:hover { border-color: color-mix(in srgb, var(--brand-primary) 40%, var(--border-strong)); background: #fff; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--brand-secondary);
  box-shadow: var(--ring);
  background: #fff;
}
textarea { line-height: 1.55; }
input[type="file"] { padding: 6px; background: var(--canvas); border-style: dashed; cursor: pointer; }
input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 7px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--brand-primary);
  font: 600 .8125rem var(--font-body);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
input[type="file"]::file-selector-button:hover { background: var(--accent-light); border-color: var(--brand-secondary); }
input[type="checkbox"]:checked { background: var(--brand-primary); border-color: var(--brand-primary); }

/* ── Login ──────────────────────────────────────────────────────────── */
.login-panel {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  /* Light-theme direction: soft brand tints on the canvas token (the dark ink
     gradient belongs to the app sidebar, not the sign-in screen). */
  background:
    radial-gradient(700px 500px at 12% 8%, rgba(81, 70, 216, .12), transparent 60%),
    radial-gradient(600px 420px at 92% 92%, rgba(117, 105, 238, .10), transparent 60%),
    var(--canvas);
}
.login-card {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 36px 34px 28px;
  box-shadow: var(--shadow-lg);
}
.login-logo { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 16px; background: #fff; box-shadow: var(--shadow-md), 0 0 0 1px var(--border); margin-bottom: 18px; }
.login-card h2 { font-size: 1.75rem; margin: 0 0 6px; }
.login-card > p { color: var(--ink-muted); margin: 0 0 20px; }
.login-card form { display: grid; gap: 12px; }
.login-card h2 { font-weight: 700; letter-spacing: -.02em; }
.login-card form { gap: 14px; }
.login-field { display: grid; gap: 6px; }
.login-panel .login-label { display: block; color: var(--ink); font-size: .8125rem; font-weight: 600; letter-spacing: .005em; }
.login-panel .login-card form input {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  font-size: 1rem; /* 16px also stops iOS Safari zooming on focus */
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: 0 1px 0 rgba(17,19,58,.03) inset;
}
.login-panel .login-card form input::placeholder { color: #667085; opacity: 1; }
.login-panel .login-card form input:hover { border-color: color-mix(in srgb, var(--brand-primary) 40%, var(--border-strong)); }
.login-panel .login-card form input:focus { outline: none; border-color: var(--brand-secondary); box-shadow: var(--ring); }
.login-panel .login-card form input[aria-invalid="true"] { border-color: var(--danger); background: #fff; }
.login-panel .login-card form input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(200, 40, 63, .22); }
.login-card .login-field-error {
  margin: 0; display: flex; align-items: center; gap: 6px; text-align: left;
  color: var(--danger); font-size: .8125rem; font-weight: 600; line-height: 1.4;
}
.login-card .login-field-error[hidden] { display: none; }
.login-card .login-field-error::before {
  content: "!"; flex: none; display: grid; place-items: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--danger-light); color: var(--danger); font-size: .7rem; font-weight: 800;
}
.login-card .btn-primary { min-height: 46px; font-size: 1rem; margin-top: 4px; }
.login-submit { gap: 10px; }
.login-submit:disabled { opacity: .82; cursor: wait; transform: none; }
.login-submit-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: login-submit-spin .7s linear infinite;
}
@keyframes login-submit-spin { to { transform: rotate(360deg); } }
.login-footer-note { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); color: var(--ink-muted); font-size: .75rem; line-height: 1.55; }
.login-footer-note p { margin: 0 0 6px; }

/* ── App shell + sidebar (dark ink) ─────────────────────────────────── */
.layout { grid-template-columns: var(--a-sidebar-w) minmax(0, 1fr); }
.app-sidebar {
  background:
    radial-gradient(260px 260px at 0% 0%, rgba(79,84,201,.45), transparent 70%),
    linear-gradient(180deg, var(--brand-ink) 0%, #161948 100%);
  border-right: 0;
  padding: 22px 14px 14px;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  color: #C9CDEE;
}
.sidebar-brand { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 8px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-logo { width: 40px; height: 40px; border-radius: 12px; background: #fff; padding: 3px; box-shadow: 0 8px 20px -6px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.15); }
.brand-name { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; letter-spacing: -.02em; color: #fff; }
.sidebar-nav { gap: 2px; align-content: start; }
.sidebar-nav-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  color: #B7BCE4;
  font-weight: 500;
  font-size: .9375rem;
  transition: background var(--admin-motion-fast), color var(--admin-motion-fast);
}
.sidebar-nav-icon { width: 18px; height: 18px; flex: none; opacity: .85; }
.sidebar-nav-btn:hover { background: rgba(255,255,255,.07); color: #fff; border-color: transparent; }
.sidebar-nav-btn.active { background: rgba(255,255,255,.11); color: #fff; font-weight: 600; border-color: transparent; }
.sidebar-nav-btn.active::before {
  content: "";
  position: absolute;
  left: -14px; top: 9px; bottom: 9px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--brand-secondary);
  box-shadow: 0 0 12px rgba(117,105,238,.55);
}
.sidebar-nav-btn.active .sidebar-nav-icon { color: var(--brand-secondary); opacity: 1; }
.sidebar-nav-btn:focus-visible, .sidebar-link:focus-visible { outline: 2px solid var(--brand-secondary); outline-offset: 1px; box-shadow: none; }
.sidebar-meta { border-top: 1px solid rgba(255,255,255,.08); padding-top: 14px; }
.sidebar-meta-user, .sidebar-meta-info { color: #fff; }
.sidebar-meta-info small, .sidebar-meta-info span { color: #9096C8; }
.sidebar-avatar { background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary)); color: #fff; font-weight: 700; }
.sidebar-link { color: #AEB3DE; border-radius: 8px; padding: 7px 8px; font-weight: 500; transition: background var(--admin-motion-fast), color var(--admin-motion-fast); }
.sidebar-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-link-danger:hover { color: #FFB3BE; background: rgba(255, 90, 110, .12); }

/* ── Main + dashboard hero ──────────────────────────────────────────── */
.app-main { padding: 28px clamp(20px, 3vw, 44px) 56px; }
.dashboard-panel { max-width: var(--a-content-w); margin: 0 auto; }

.dashboard-hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border: 0;
  border-radius: 24px;
  padding: 30px 32px 0;
  color: #fff;
  background:
    radial-gradient(520px 260px at 100% 0%, rgba(117, 105, 238, .20), transparent 62%),
    radial-gradient(520px 320px at 0% 100%, rgba(81, 70, 216, .22), transparent 65%),
    linear-gradient(135deg, var(--brand-ink) 0%, #303B52 100%);
  box-shadow: 0 24px 48px -28px rgba(17, 19, 58, .7);
}
.dashboard-hero::after {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background-image: radial-gradient(rgba(255,255,255,.07) 1px, transparent 1px);
  background-size: 18px 18px;
  mask-image: linear-gradient(120deg, transparent 30%, #000 100%);
  -webkit-mask-image: linear-gradient(120deg, transparent 30%, #000 100%);
}
.dashboard-hero--compact { padding-bottom: 26px; }
.dashboard-hero-inner { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; }
.dashboard-hero-text { flex: 1 1 380px; min-width: 0; }
.dashboard-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0 0 10px;
  color: #BDB7FF;
  font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
}
.dashboard-eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--brand-secondary); box-shadow: 0 0 0 4px rgba(117,105,238,.24); }
.dashboard-hero-title, .dashboard-hero h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 3.2vw, 2.6rem);
  font-weight: 700; letter-spacing: -.03em; line-height: 1.08; color: #fff;
}
.dashboard-hero-sub, .dashboard-hero p { color: #C5C9EE; max-width: 58ch; font-size: .975rem; line-height: 1.55; margin: 0; }
.dashboard-hero .btn-new-study {
  order: 2;
  background: var(--brand-primary); background-image: none;
  color: #fff;
  border-color: var(--brand-primary);
  box-shadow: 0 10px 26px -8px rgba(81, 70, 216, .42);
  min-height: 46px; padding: 10px 20px; font-size: .975rem; font-weight: 700;
}
.dashboard-hero .btn-new-study:hover { background: var(--accent-hover); box-shadow: 0 14px 30px -8px rgba(81,70,216,.48); }
.dashboard-hero .btn-restore-study { order: 3; min-height: 46px; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.22); color: #fff; box-shadow: none; }
.dashboard-hero .btn-restore-study:hover { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.4); }

.dashboard-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  margin: 26px -32px 0; padding: 0;
  border-top: 1px solid rgba(255,255,255,.12);
  background: rgba(8, 10, 38, .28);
}
.dash-stat { display: flex; flex-direction: column-reverse; gap: 2px; padding: 16px 32px; }
.dash-stat-divider { display: none; }
.dash-stat + .dash-stat-divider + .dash-stat { border-left: 1px solid rgba(255,255,255,.12); }
.dash-stat-value { font-family: var(--font-display); font-size: 2rem; font-weight: 700; letter-spacing: -.03em; color: #fff; line-height: 1.05; }
.dash-stat-label { font-size: .72rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #9EA4D9; }
.dash-stat:nth-of-type(2) .dash-stat-value { color: var(--brand-signal); }

/* ── Study grid + cards ─────────────────────────────────────────────── */
.study-grid-wrap { margin-top: 30px; }
.study-grid-label {
  margin: 0 0 14px; color: var(--ink-muted);
  font-size: .75rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
}
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--a-gap); }
.study-card {
  position: relative;
  display: flex; flex-direction: column; gap: 12px;
  min-height: 0;
  padding: 20px 20px 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--a-card-radius);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.study-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; opacity: 1;
  background: var(--border-strong);
  transition: background var(--transition);
}
.study-card:has(.status-published)::before { background: linear-gradient(90deg, var(--brand-primary), var(--brand-secondary)); }
.study-card:has(.status-draft)::before { background: linear-gradient(90deg, #CDD2DC, #E3E6ED); }
.study-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--brand-primary) 35%, var(--border)); }
.study-card:focus-visible { outline: 2px solid var(--brand-secondary); outline-offset: 2px; }
.study-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding-right: 34px; }
.study-card h3 { margin: 2px 0 0; font-size: 1.0625rem; font-weight: 700; line-height: 1.3; letter-spacing: -.015em; flex: 1; min-width: 0; }
.study-card-description, .study-card p.study-card-description {
  margin: 0; color: var(--ink-muted); font-size: .875rem; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.study-card-metrics { display: flex; gap: 0; margin-top: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--canvas); overflow: hidden; }
.study-card-metric { flex: 1; display: flex; align-items: baseline; gap: 7px; padding: 10px 14px; border: 0; background: transparent; border-radius: 0; }
.study-card-metric + .study-card-metric { border-left: 1px solid var(--border); }
.study-card-metric-value { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; color: var(--ink); }
.study-card-metric-label { font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); }
.study-card-meta { display: flex; justify-content: space-between; gap: 10px; padding-top: 2px; font-size: .75rem; color: var(--ink-muted); }
.study-card-meta span:last-child { max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .7rem; background: var(--canvas); padding: 2px 8px; border-radius: 6px; }
.study-card-delete {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 30px; height: 30px; display: grid; place-items: center;
  border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ink-muted);
  opacity: 0; transition: opacity var(--transition), background var(--transition), color var(--transition);
}
.study-card:hover .study-card-delete, .study-card:focus-within .study-card-delete, .study-card-delete:focus-visible { opacity: 1; }
.study-card-delete:hover { background: var(--danger-light); color: var(--danger); border-color: #F5C2CA; }
@media (hover: none) { .study-card-delete { opacity: 1; } }
.study-card-duplicate {
  position: absolute; top: 12px; right: 48px; z-index: 2;
  width: 30px; height: 30px; display: grid; place-items: center;
  border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ink-muted);
  opacity: 0; cursor: pointer; transition: opacity var(--transition), background var(--transition), color var(--transition);
}
.study-card:hover .study-card-duplicate, .study-card:focus-within .study-card-duplicate, .study-card-duplicate:focus-visible { opacity: 1; }
.study-card-duplicate:hover { background: var(--accent-light); color: var(--brand-primary); border-color: var(--border-strong); }
.study-card-duplicate[aria-busy="true"] { opacity: 1; cursor: progress; }
@media (hover: none) { .study-card-duplicate { opacity: 1; } }
/* Study move-to-Trash in progress: only this card is affected. */
.study-card.is-deleting { opacity: .6; pointer-events: none; }
.study-card-delete[aria-busy="true"] { opacity: 1; cursor: progress; color: transparent; }
.study-card-delete[aria-busy="true"] svg { visibility: hidden; }
.study-card-delete[aria-busy="true"]::after {
  content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--border-strong, #cfd3e6); border-top-color: var(--accent, #5146d8);
  animation: study-delete-spin .7s linear infinite;
}
@keyframes study-delete-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .study-card-delete[aria-busy="true"]::after { animation-duration: 2s; } }

/* status badges / pills */
.study-badge, .status-pill, .feedback-status, .task-type-pill, .type-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  background: var(--canvas-2); color: var(--ink-soft); border: 1px solid var(--border);
  white-space: nowrap;
}
.study-badge::before, .status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.study-badge.status-published, .status-pill.status-published, .status-pill.published, .status-pill.is-published {
  background: var(--brand-primary); color: #fff; border-color: var(--brand-primary);
}
.study-badge.status-published::before, .status-pill.status-published::before, .status-pill.published::before, .status-pill.is-published::before {
  background: #22C506; opacity: 1;
}
.study-badge.status-draft { background: var(--canvas-2); color: var(--ink-soft); }
.study-badge.status-trashed { background: var(--danger-light); color: var(--danger); border-color: #F5C2CA; }
.task-type-pill, .type-chip { background: var(--accent-light); color: var(--brand-primary); border-color: #D5D8F6; text-transform: none; letter-spacing: 0; font-size: .72rem; }

/* ── Workspace header + stepper ─────────────────────────────────────── */
.workspace-header {
  position: sticky; top: 0; z-index: 40;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  margin: -28px calc(-1 * clamp(20px, 3vw, 44px)) 8px;
  padding: 12px clamp(20px, 3vw, 44px);
  min-height: var(--workspace-header-height);
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(1.6) blur(16px);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
  border: 0; border-bottom: 1px solid var(--border);
  border-radius: 0;
  box-shadow: 0 6px 20px -16px rgba(17,19,58,.5);
}
.workspace-header-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.btn-back {
  width: 38px; height: 38px; border-radius: 10px;
  background: #fff; color: var(--ink-soft); border: 1px solid var(--border-strong); box-shadow: var(--shadow-sm);
  transition: background var(--transition), color var(--transition), transform var(--transition);
}
.btn-back:hover { background: var(--brand-primary); color: #fff; border-color: var(--brand-primary); transform: translateX(-2px); }
.workspace-meta-copy { display: flex; flex-direction: column; min-width: 0; }
.workspace-meta-copy .status-pill { align-self: flex-start; width: max-content; max-width: 100%; margin-top: 5px; }
.workspace-meta-copy strong { font-family: var(--font-display); font-size: 1.0625rem; font-weight: 700; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 34ch; }
.workspace-meta-kicker { font-size: .68rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-muted); }
.workspace-study-logo { border-radius: 8px; }
.workspace-study-logo {
  width: auto !important;
  height: auto !important;
  max-width: 80px;
  max-height: 60px;
  object-fit: contain !important;
  object-position: center;
  overflow: visible;
  border-radius: 0;
}
.workspace-header { min-height: 88px; }

.header-stage-wrap { justify-self: center; }
.stage-nav.stage-create { gap: 6px; background: var(--canvas-2); border: 1px solid var(--border); border-radius: 999px; padding: 4px; }
.stage-nav.stage-create::before { display: none; }
.stage-nav.stage-create .stage-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 16px 7px 8px; border-radius: 999px; border: 0; background: transparent;
  color: var(--ink-soft); cursor: pointer;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}
.stage-nav.stage-create .stage-tab:hover:not(.active) { background: rgba(255,255,255,.75); color: var(--ink); }
.stage-nav.stage-create .stage-tab.active { background: #fff; color: var(--brand-primary); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.stage-nav.stage-create .stage-tab .step-label strong { font-size: .875rem; font-weight: 600; color: inherit; }
.stage-nav.stage-create .stage-tab.active .step-label strong { color: var(--brand-primary); }
.stage-nav.stage-create .stage-tab .step-dot { width: 22px; height: 22px; box-shadow: none; }
.stage-nav.stage-create .stage-tab.active .step-dot { background: var(--brand-primary); border-color: var(--brand-primary); }
.stage-nav.stage-create .stage-tab.step-done .step-dot { background: var(--brand-signal); border-color: var(--brand-signal); }
.stage-nav.stage-create .stage-tab.step-done .step-dot::after { border-color: #fff; }
.stage-nav.stage-create .stage-tab:focus-visible { outline: 2px solid var(--brand-secondary); outline-offset: 2px; }

/* ── Workspace shell (builder) ──────────────────────────────────────── */
.workspace-shell { max-width: var(--a-content-w); gap: 28px; padding: 22px 0 0; grid-template-columns: 252px minmax(0, 1fr); }
.workspace-content { max-width: none; padding-bottom: 96px; }
body.invite-stage-active .workspace-shell, body.results-stage-active .workspace-shell { max-width: var(--a-content-w); margin: 0 auto; padding: 22px 0 0; }
body.results-stage-active .workspace-shell { max-width: 1320px; }

/* Flow rail */
.create-nav {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: none;
  padding: 14px 10px 12px;
}
.create-nav h3 { font-family: var(--font-body); font-size: .68rem; font-weight: 700; letter-spacing: .14em; color: var(--ink-muted); }
.rail-list { gap: 2px; }
.create-nav-link, .create-nav-task-link {
  border-radius: 10px; color: var(--ink-soft); font-weight: 500;
  transition: background var(--transition), color var(--transition);
}
.create-nav-link:hover, .create-nav-task-link:hover { background: var(--canvas); color: var(--ink); }
.create-nav-link.active, .create-nav-link[aria-current="true"], .create-nav-link.is-active,
.create-nav-task-link.active, .create-nav-task-link[aria-current="true"], .create-nav-task-link.is-active {
  background: var(--accent-light); color: var(--brand-primary); font-weight: 600;
  box-shadow: inset 3px 0 0 var(--brand-primary);
}
.create-nav-link-index, .create-nav-task-index { font-variant-numeric: tabular-nums; }
.create-nav-link .create-nav-link-index, .create-nav-link > span:first-child {
  background: var(--canvas-2); color: var(--ink-soft); border-radius: 999px;
}
.create-nav-link.active .create-nav-link-index, .create-nav-link.active > span:first-child,
.create-nav-link[aria-current="true"] .create-nav-link-index {
  background: var(--brand-primary); color: #fff;
}
.create-nav-footer { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 12px; display: grid; gap: 8px; }
.create-nav-footer .btn { width: 100%; }
.builder-history-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.create-nav-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 4px; background: var(--canvas); border-radius: 12px; border: 1px solid var(--border); }
.create-nav-actions .btn {
  flex-direction: column; gap: 3px; min-height: 48px; padding: 7px 2px;
  font-size: .68rem; font-weight: 600; border: 0; background: transparent; box-shadow: none; color: var(--ink-soft);
}
.create-nav-actions .btn:hover { background: #fff; color: var(--brand-primary); box-shadow: var(--shadow-sm); }
.create-nav-actions .btn-primary { background: var(--brand-primary); background-image: none; color: #fff; box-shadow: 0 6px 14px -6px rgba(58,62,152,.7); }
.create-nav-actions .btn-primary:hover { background: #4036B5; color: #fff; }
.create-nav-actions .create-nav-action-icon {
  background: linear-gradient(180deg, #5b4fe0 0%, #4338ca 100%);
  color: #fff;
  border-right-color: rgba(255,255,255,.2);
  box-shadow: none;
}
.create-nav-actions .create-nav-action-icon:hover:not(.create-nav-action-delete) {
  background: linear-gradient(180deg, #4f43d6 0%, #3a2fb3 100%);
  color: #fff;
}
.create-nav-actions .create-nav-action-icon.create-nav-action-delete {
  background: #C8283F;
  color: #fff;
  border-color: #C8283F;
}
.create-nav-actions .create-nav-action-icon.create-nav-action-delete:hover {
  background: #A91F33;
  color: #fff;
  border-color: #A91F33;
}

/* ── Section cards (Basics / Setup / Screener / Tasks …) ───────────── */
.admin-section, .builder-card, .dashboard-card, .dashboard-integration-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--a-card-radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--a-gap);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.admin-section:hover, .builder-card:hover { box-shadow: var(--shadow-md); }
.admin-section:focus-within { border-color: color-mix(in srgb, var(--brand-secondary) 45%, var(--border)); box-shadow: var(--shadow-md), 0 0 0 3px rgba(79,84,201,.08); }
.section-header { padding: 18px 22px; gap: 14px; align-items: center; border-bottom: 0; }
.admin-section:not(.is-collapsed) > .section-header { border-bottom: 1px solid var(--border); }
.section-title { font-family: var(--font-display); font-size: 1.125rem; font-weight: 700; letter-spacing: -.02em; color: var(--ink); margin: 0; }
.section-desc { color: var(--ink-muted); font-size: .875rem; margin: 4px 0 0; max-width: 72ch; }
.section-body { padding: 20px 22px 22px; }
.section-toggle, .btn-question-focus {
  min-height: 34px; padding: 6px 14px; border-radius: 9px;
  border: 1px solid var(--border-strong); background: #fff; color: var(--brand-primary);
  font: 600 .8125rem var(--font-body); cursor: pointer; box-shadow: var(--shadow-sm);
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.section-toggle:hover, .btn-question-focus:hover { background: var(--accent-light); border-color: var(--brand-secondary); }
.task-accordion-toggle {
  display: inline-grid;
  place-items: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.task-accordion-toggle:hover { background: var(--accent-light); border-color: var(--border); color: var(--brand-primary); }
.task-accordion-toggle:focus-visible { outline: 2px solid var(--brand-secondary); outline-offset: 2px; }
.task-accordion-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform var(--transition); }
.task-accordion-toggle.is-expanded svg { transform: rotate(180deg); }
.section-title-count, .section-summary-count {
  background: var(--accent-light); color: var(--brand-primary); border-radius: 999px; padding: 2px 9px; font-size: .75rem; font-weight: 700;
}
.btn-add {
  border: 1.5px dashed var(--border-strong); background: transparent; color: var(--brand-primary);
  border-radius: 12px; font-weight: 600; min-height: 44px; padding: 10px 18px; box-shadow: none;
  transition: background var(--transition), border-color var(--transition);
}
.btn-add:hover { background: var(--accent-light); border-color: var(--brand-secondary); }

/* Tasks & questions */
.task-editor, .question-editor {
  background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.task-editor:hover, .question-editor:hover { border-color: var(--border-strong); }
.task-editor-head, .question-editor-head { padding: 12px 14px; border-radius: 14px; }
.task-drag-handle { color: var(--ink-muted); cursor: grab; border-radius: 6px; }
.task-drag-handle:hover { background: var(--canvas-2); color: var(--brand-primary); }
.task-drop-marker { background: var(--brand-secondary); box-shadow: 0 0 10px rgba(117,105,238,.5); border-radius: 4px; }
.question-editor, .followup-list .question-editor { background: var(--canvas); }
.task-image-preview, .question-image-preview { border: 1px solid var(--border); border-radius: 12px; background: var(--canvas); overflow: hidden; }
.task-image-preview img, .question-image-preview img { border-radius: 8px; }
.task-image-remove { border-radius: 9px; }
.task-empty-state, .study-empty, .results-empty {
  border: 1.5px dashed var(--border-strong); border-radius: 14px; background: var(--canvas); color: var(--ink-muted);
}

/* AI builder card */
.ai-question-builder {
  border: 1px solid #D5D8F6; border-radius: 16px;
  background: linear-gradient(180deg, #F6F7FF 0%, #fff 100%);
}
.ai-builder-mark { background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary)); color: #fff; border-radius: 12px; box-shadow: 0 8px 18px -8px rgba(58,62,152,.8); }
.ai-builder-heading, .welcome-brand-preview-head { color: var(--ink); }

/* Modal / task picker */
.task-picker-backdrop { background: rgba(17,19,58,.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.task-picker-dialog, .ai-progress-dialog, .task-type-library-modal {
  background: #fff; border: 1px solid var(--border); border-radius: 22px; box-shadow: 0 40px 80px -24px rgba(17,19,58,.55);
}
.task-type-card {
  border: 1px solid var(--border); border-radius: 14px; background: #fff; transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.task-type-card:hover { transform: translateY(-2px); border-color: var(--brand-secondary); box-shadow: var(--shadow-md); }
.task-picker-eyebrow, .task-empty-eyebrow, .task-library-label { color: var(--brand-primary); font-weight: 700; letter-spacing: .12em; }
.task-picker-close { border-radius: 10px; }

/* ── Invite stage ───────────────────────────────────────────────────── */
.invite-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.invite-row input { flex: 1 1 320px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .875rem; background: var(--canvas); }

/* ── Results ────────────────────────────────────────────────────────── */
.results-intelligence, .results-share-panel, .results-summary, .research-executive {
  border: 1px solid var(--border); border-radius: 20px; background: #fff; box-shadow: var(--shadow-sm);
}
.results-intelligence { background: linear-gradient(180deg, #F8F9FF 0%, #fff 60%); }
.results-intelligence-head h2, .executive-heading { font-family: var(--font-display); letter-spacing: -.025em; }
.result-kpi, .people-stat, .people-summary-card, .avg-time-row {
  background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm);
}
.result-kpi { position: relative; overflow: hidden; }
.result-kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand-secondary); }
.result-kpi strong, .people-stat strong, .meta-value { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; letter-spacing: -.03em; color: var(--ink); }
.result-kpi span, .people-stat span, .meta-label, .result-status-label {
  font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted);
}
.chart-card { border: 1px solid var(--border); border-radius: 16px; background: #fff; box-shadow: var(--shadow-sm); padding: 18px 20px; }
.chart-card h4 { font-family: var(--font-display); font-size: .9375rem; letter-spacing: -.01em; }
.chart-fill, .chart-bar { background: linear-gradient(90deg, var(--brand-primary), var(--brand-secondary)); border-radius: 999px; }

.results-table-wrap { border: 1px solid var(--border); border-radius: 14px; overflow: auto; background: #fff; }
.results-table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .875rem; }
.results-table thead th {
  position: sticky; top: 0; background: var(--canvas); color: var(--ink-soft);
  font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  padding: 11px 14px; border-bottom: 1px solid var(--border); text-align: left;
}
.results-table td { padding: 12px 14px; border-bottom: 1px solid #EEF0F8; }
.results-table tbody tr { transition: background var(--transition); }
.results-table tbody tr:hover { background: #F7F8FE; }
.results-person-link { color: var(--brand-primary); font-weight: 600; text-decoration: none; }
.results-person-link:hover { text-decoration: underline; }
.results-filters { background: var(--canvas); border: 1px solid var(--border); border-radius: 14px; }

.feedback-card, .feedback-group, .feedback-item, .research-analysis-section { border-radius: 14px; border-color: var(--border); }
.feedback-card { background: #fff; box-shadow: var(--shadow-sm); }
.feedback-participant-mark { background: var(--accent-light); color: var(--brand-primary); }
.research-theme-grid > *, .research-findings-grid > * { border-radius: 14px; border: 1px solid var(--border); background: #fff; box-shadow: var(--shadow-sm); }

/* ── Integrations / people / demo / about ───────────────────────────── */
.dashboard-integration-card, .dashboard-card { padding: 22px; }
.integration-card-header h3 { font-size: 1.125rem; margin: 0 0 4px; }
.integration-body { max-width: var(--a-content-w); margin: 22px auto 0; display: grid; gap: var(--a-gap); }
.dashboard-panel .integration-body { max-width: none; padding: 28px 0; }
.dashboard-panel .integration-body > .dashboard-integration-card { width: 100%; max-width: none; }
.people-card, .demo-study-card { border: 1px solid var(--border); border-radius: 14px; background: #fff; box-shadow: var(--shadow-sm); transition: box-shadow var(--transition), transform var(--transition); }
.people-card:hover, .demo-study-card:hover { box-shadow: var(--shadow-md); }
.about-card h3 { margin-top: 22px; }
.about-list li::marker { color: var(--brand-primary); }
.trash-purge-btn { border-radius: 9px; }

/* ── Scrollbars ─────────────────────────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: #C3C8E4 transparent; }
.app-sidebar * { scrollbar-color: rgba(255,255,255,.25) transparent; }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .workspace-shell { grid-template-columns: 1fr; }
  .create-nav { position: static !important; max-height: none; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .app-sidebar { position: static; height: auto; grid-template-rows: auto; padding: 14px; }
  .sidebar-nav { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .sidebar-nav-btn.active::before { display: none; }
  .sidebar-meta { display: none; }
  .dashboard-hero { padding: 24px 20px 0; border-radius: 18px; }
  .dashboard-stats { margin: 22px -20px 0; }
  .dash-stat { padding: 14px 16px; }
  .dash-stat-value { font-size: 1.5rem; }
  .workspace-header { grid-template-columns: 1fr; justify-items: stretch; }
  .header-stage-wrap { justify-self: stretch; }
  .stage-nav.stage-create { width: 100%; justify-content: space-between; }
}
@media (max-width: 560px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .section-header, .section-body { padding-left: 16px; padding-right: 16px; }
  .login-panel { padding: 16px; }
  .login-card { padding: 28px 20px 22px; border-radius: 20px; }
  .login-card h2 { font-size: 1.5rem; }
}

/* ════════════════════════════════════════════════════════════════════
   Specificity settlement (admin.css scopes many rules with
   .layout:not(.workspace-mode); these mirror that scope)
   ════════════════════════════════════════════════════════════════════ */
.layout:not(.workspace-mode) .sidebar-brand { flex-direction: row; align-items: center; justify-content: flex-start; gap: 12px; padding: 4px 8px 18px; margin-bottom: 6px; }
.layout:not(.workspace-mode) .brand-logo { width: 40px; height: 40px; }
.layout:not(.workspace-mode) .brand-name { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; letter-spacing: -.03em; color: #fff; }
.layout:not(.workspace-mode) .sidebar-nav { gap: 2px; }

.layout .sidebar-meta { background: transparent; border-top: 1px solid rgba(255,255,255,.1); padding: 14px 0 0; }
.layout .sidebar-meta-user { padding: 6px 8px 10px; }
.layout .sidebar-meta-info .meta-value { color: #fff; font-family: var(--font-body); font-size: .875rem; font-weight: 600; letter-spacing: 0; text-transform: none; }
.layout .sidebar-meta-info .meta-label { color: #9096C8; font-size: .72rem; letter-spacing: 0; text-transform: none; font-weight: 500; }
.layout .sidebar-meta-info { background: transparent; }
.layout .sidebar-link { color: #AEB3DE; }
.layout .sidebar-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.layout .sidebar-link-danger:hover { background: rgba(255,90,110,.14); color: #FFB3BE; }
.layout .sidebar-link-toggle[aria-pressed="true"] { background: rgba(117,105,238,.16); color: #BDB7FF; }

.layout .dashboard-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 26px -32px 0; padding: 0; gap: 0; }
.layout .dash-stat { padding: 16px 32px; flex: none; }
.layout .dash-stat:first-child { padding-left: 32px; }
.layout .dash-stat-value { font-size: 2.1rem; color: #fff; }
.layout .dash-stat:nth-of-type(2) .dash-stat-value { color: var(--brand-signal); }
.layout .dash-stat-label { color: #9EA4D9; }
.layout .study-grid-wrap { padding: 0; margin-top: 30px; overflow: visible; }
.layout .dashboard-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--a-gap); }
.layout .study-grid-label { padding: 0; }
.layout .dashboard-hero { margin: 0 0 4px; }

/* Study card head: badge above title, title gets full width */
.study-card-head { flex-direction: column-reverse; align-items: flex-start; gap: 8px; padding-right: 30px; }
.study-card h3 { margin: 0; }
.study-card-description { flex: 1; }
.study-card-metrics { margin-top: 4px; }
.layout:not(.workspace-mode) .sidebar-meta { background: transparent; padding-top: 14px; }
.layout:not(.workspace-mode) .dashboard-hero { padding: 30px 32px 0; border-radius: 24px; overflow: hidden; }
.layout:not(.workspace-mode) .dashboard-hero--compact { padding: 28px 32px 26px; }
.layout:not(.workspace-mode) .dashboard-hero-inner { align-items: flex-start; gap: 12px; }
.layout:not(.workspace-mode) .btn-new-study { margin-left: auto; align-self: flex-start; }
.layout:not(.workspace-mode) .btn-new-study { box-shadow: 0 10px 26px -8px rgba(81,70,216,.42); }

/* Sticky header: old rule fixes width:100%, so widen explicitly to bleed edge-to-edge */
.workspace-header { width: calc(100% + 2 * clamp(20px, 3vw, 44px)); }
.field-note, .hint { font-weight: 400; }

/* Eyebrows: indigo on light surfaces, neon only on the dark hero */
.dashboard-eyebrow { color: var(--brand-primary); }
.dashboard-eyebrow::before { background: var(--brand-primary); box-shadow: 0 0 0 4px rgba(81,70,216,.14); }
.dashboard-hero .dashboard-eyebrow { color: #BDB7FF; }
.dashboard-hero .dashboard-eyebrow::before { background: var(--brand-secondary); box-shadow: 0 0 0 4px rgba(117,105,238,.24); }
.stage-nav.stage-create .stage-tab.active .step-dot { color: #fff; }
.stage-nav.stage-create .stage-tab::before, .stage-nav.stage-create .stage-tab::after { display: none !important; }
.stage-nav.stage-create .stage-tab.active .step-dot::after, .stage-nav.stage-create .stage-tab.step-done .step-dot::after { display: block !important; }
.stage-nav.stage-create::before, .stage-nav.stage-create::after,
body.results-stage-active .stage-nav.stage-create::after, body.invite-stage-active .stage-nav.stage-create::after { display: none !important; }

/* ══ Authoring rail redesign (2026-11) ═══════════════════════════════════════
   Calmer surfaces, one accent, a clear tree for tasks. */
.layout .create-nav { background: #fff; border: 1px solid #e6e8f2; box-shadow: 0 1px 2px rgba(23,32,51,.04), 0 8px 24px rgba(23,32,51,.05); }
.rail-list .create-nav-link,
.rail-list button.create-nav-link { position: relative; border: 1px solid transparent; border-radius: 10px; background: transparent; color: #3b4160; font-weight: 600; min-height: 40px; padding: 8px 10px; box-shadow: none; }
.rail-list .create-nav-link:hover { background: #f5f6fb; color: #1d2040; }
.rail-list .create-nav-link.active,
.rail-list .create-nav-link:focus-visible { background: #f1f0ff; border-color: #dedaff; color: #3a2fb0; box-shadow: none; }
.rail-list .create-nav-link.active::before { content: ""; position: absolute; left: -1px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: #5b4ee6; }
.rail-list .create-nav-link-index { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: #f0f1f7; color: #6a7090; font-size: .68rem; font-weight: 700; border: 0; box-shadow: none; }
.rail-list .create-nav-link.active .create-nav-link-index { background: #5b4ee6; color: #fff; }
.create-nav-link-meta { background: #eceefe; color: #4a3fd0; border: 0; font-weight: 700; }
.rail-list .create-nav-link.active .create-nav-link-meta { background: #fff; color: #4a3fd0; }
.create-nav-tree-toggle { border-radius: 8px; color: #8a90ad; }

/* Task tree: a quiet rail with numbered nodes */
.create-nav-task-tree { position: relative; margin: 4px 0 8px 22px; padding: 2px 0 2px 12px; border-left: 2px solid #e7e8f3; background: none; }
.create-nav-task-tree::before, .create-nav-task-tree > li::before { display: none !important; }
.create-nav-task-tree > li + li { margin-top: 1px; }
.create-nav-task-link { position: relative; display: flex; align-items: center; gap: 9px; width: 100%; min-height: 32px; padding: 5px 8px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #565d7c; font-size: .8rem; font-weight: 500; text-align: left; }
.create-nav-task-link::before { content: ""; position: absolute; left: -18px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: #fff; border: 2px solid #d3d6e6; }
.create-nav-task-link:hover { background: #f6f7fb; color: #1d2040; }
.create-nav-task-link:hover::before { border-color: #a9a2f5; }
.create-nav-task-link.active { background: #fff; border-color: #dcd8ff; color: #2d2490; font-weight: 650; box-shadow: 0 2px 8px rgba(91,78,230,.12); }
.create-nav-task-link.active::before { background: #5b4ee6; border-color: #5b4ee6; box-shadow: 0 0 0 3px rgba(91,78,230,.18); }
.create-nav-task-index { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 4px; border-radius: 6px; background: #f0f1f7; color: #6a7090; font-size: .66rem; font-weight: 700; opacity: 1; }
.create-nav-task-link.active .create-nav-task-index { background: #eceaff; color: #4a3fd0; }

/* Task card: config on white, questions in their own tinted well */
.task-editor { border-color: #e3e5ef; }
.task-editor:not(.is-collapsed) { border-color: #cfcaff; box-shadow: 0 10px 30px rgba(45,36,144,.08); }
.task-editor-body > h5 { display: flex; align-items: center; gap: 8px; margin: 22px 0 0; padding: 14px 16px 10px; border: 1px solid #e4e6f2; border-bottom: 0; border-radius: 14px 14px 0 0; background: #f7f8fc; color: #2a2f4f; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.task-editor-body > h5::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: #5b4ee6; transform: rotate(45deg); }
.task-editor-body > .followup-list { display: grid; gap: 8px; margin: 0; padding: 4px 12px 12px; border: 1px solid #e4e6f2; border-top: 0; border-radius: 0 0 14px 14px; background: #f7f8fc; }
.task-editor-body > .followup-list:empty::after { content: "No questions yet. Add one below."; display: block; padding: 10px 4px; color: #7a8099; font-size: .85rem; }
.followup-list .question-editor,
.question-editor { background: #fff; border: 1px solid #e3e5ef; border-left: 3px solid #c9c4fb; border-radius: 10px; box-shadow: none; }
.followup-list .question-editor:hover,
.question-editor:hover { border-color: #d3d6e6; border-left-color: #8f85f2; }
.question-editor:not(.is-collapsed) { border-left-color: #5b4ee6; box-shadow: 0 6px 20px rgba(45,36,144,.08); }
.question-editor.is-collapsed { padding: 0; min-height: 0; }

/* Accordion head: the whole row opens or closes the question */
.question-editor-head.is-accordion { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 12px; border-radius: 9px; cursor: pointer; user-select: none; }
.question-editor-head.is-accordion:hover { background: #fafaff; }
.question-editor-head.is-accordion:focus-visible { outline: 3px solid rgba(91,78,230,.35); outline-offset: 1px; }
.question-editor-head.is-accordion h4 { flex: 1 1 auto; min-width: 0; margin: 0; font-family: var(--font-body); font-size: .92rem; font-weight: 600; line-height: 1.35; color: #1d2040; }
.question-editor.is-collapsed .question-editor-head.is-accordion h4 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.question-editor-num { flex: 0 0 auto; display: inline-grid; place-items: center; min-width: 30px; height: 22px; padding: 0 6px; border-radius: 6px; background: #f0eeff; color: #4a3fd0; font-size: .7rem; font-weight: 800; letter-spacing: .02em; }
.question-editor-meta { flex: 0 0 auto; color: #7a8099; font-size: .75rem; white-space: nowrap; }
.question-editor-chevron { flex: 0 0 auto; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: #6a7090; transition: transform 160ms ease, background 160ms ease; }
.question-editor-chevron svg { width: 18px; height: 18px; }
.question-editor:not(.is-collapsed) .question-editor-chevron { transform: rotate(180deg); background: #f1f0ff; color: #4a3fd0; }
.question-editor:not(.is-collapsed) .question-editor-head.is-accordion { border-bottom: 1px solid #eef0f6; border-radius: 9px 9px 0 0; margin-bottom: 8px; }
@media (max-width: 720px) { .question-editor-meta { display: none; } }

/* Intro screen editor */
.task-intro-editor { margin: 0 0 16px; border: 1px dashed #d6d2fb; border-radius: 12px; background: #fbfaff; }
.task-intro-editor.is-on { border-style: solid; border-color: #cfcaff; background: #f8f7ff; }
.task-intro-editor > summary { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; list-style: none; }
.task-intro-editor > summary::-webkit-details-marker { display: none; }
.task-intro-editor > summary strong { display: block; color: #2d2490; font-size: .9rem; }
.task-intro-editor > summary small { display: block; color: #6a7090; font-size: .78rem; }
.task-intro-editor-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: #eceaff; color: #4a3fd0; flex: 0 0 auto; }
.task-intro-editor-icon svg { width: 18px; height: 18px; }
.task-intro-editor-body { padding: 4px 14px 14px; }
.task-intro-image-field { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; align-items: start; }
.task-intro-image-preview { grid-row: span 2; min-height: 90px; display: grid; place-items: center; border: 1px solid #e3e5ef; border-radius: 10px; background: #fff; overflow: hidden; }
.task-intro-image-preview img { display: block; max-width: 100%; max-height: 180px; object-fit: contain; }
@media (max-width: 720px) { .task-intro-image-field { grid-template-columns: 1fr; } }
.task-editor-body > .followup-list { grid-template-columns: minmax(0, 1fr); }
.task-editor-body > .followup-list > .question-editor,
#section-global .question-editor { min-width: 0; max-width: 100%; margin: 0; background: #fff; }
.task-editor-body > .followup-list > .question-editor.is-collapsed { opacity: 1; }
.question-editor-head.is-accordion { margin-bottom: 0; }
/* #section-tasks .builder-card tinted every card purple; tasks and questions are white so they read as distinct surfaces. */
#section-tasks .task-editor { background: #fff; border-color: #e3e5ef; }
#section-tasks .task-editor:not(.is-collapsed) { border-color: #cfcaff; }
#section-tasks .followup-list > .question-editor { background: #fff; border-color: #e3e5ef; border-left-color: #c9c4fb; }
#section-tasks .followup-list > .question-editor:hover { border-color: #d3d6e6; border-left-color: #8f85f2; }
#section-tasks .followup-list > .question-editor:not(.is-collapsed) { border-color: #dcd8ff; border-left-color: #5b4ee6; }
/* Question accordion: no underline under the title (old .builder-card h4 rule) and no divider when open. */
.question-editor .question-editor-head h4 { margin: 0; padding-bottom: 0; border-bottom: 0; }
.question-editor:not(.is-collapsed) .question-editor-head.is-accordion { border-bottom: 0; margin-bottom: 4px; }

/* ── Task editor sections: Intro screen · Task details · Method settings / Completion gate ── */
.task-section { margin: 0 0 16px; border: 1px solid #e3e5ef; border-radius: 12px; background: #fff; }
.task-section > summary { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; list-style: none; border-radius: 12px; transition: background-color 140ms cubic-bezier(.2,.7,.2,1); }
.task-section > summary::-webkit-details-marker { display: none; }
.task-section > summary:hover { background: #fafaff; }
.task-section > summary:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(81,70,216,.28); }
.task-section > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid #8a90ad; border-bottom: 2px solid #8a90ad; transform: rotate(45deg); transition: transform 200ms cubic-bezier(.2,.7,.2,1); }
.task-section[open] > summary::after { transform: rotate(-135deg); }
.task-section > summary strong { display: block; color: #2d2490; font-size: .9rem; }
.task-section > summary small { display: block; color: #6a7090; font-size: .78rem; }
.task-section-icon { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 auto; border-radius: 9px; background: #eceaff; color: #4a3fd0; }
.task-section-icon svg { width: 18px; height: 18px; }
.task-section[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.task-section > .task-details-grid, .task-section > .task-section-body { padding: 4px 14px 16px; }
.task-intro-editor > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid #8a90ad; border-bottom: 2px solid #8a90ad; transform: rotate(45deg); transition: transform 200ms cubic-bezier(.2,.7,.2,1); }
.task-intro-editor[open] > summary::after { transform: rotate(-135deg); }
/* Method panel lives inside its section now: drop its own box so there is one container, not two. */
.task-method-section .method-panel { padding: 0; border: 0; background: none; gap: 14px; }
.task-method-section .method-guide { padding: 10px 12px; border: 1px solid #eef0f6; border-radius: 10px; background: #fafbfd; }
.task-method-section .method-guide summary { font-size: .82rem; color: #3b4160; }
.task-method-section .method-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
/* Gate: checkbox row reads on one line; the question field spans the full width. */
.task-method-section .gate-toggle { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid #e3e5ef; border-radius: 10px; background: #fafbfd; font-size: .875rem; font-weight: 600; color: #1d2040; line-height: 1.4; white-space: normal; }
.task-method-section .gate-toggle input { margin-top: 1px; flex: 0 0 auto; }
.task-method-section .gate-toggle:has(input:checked) { border-color: #cfcaff; background: #f8f7ff; }
.task-method-section .gate-question { display: grid; gap: 6px; }
.task-method-section .gate-question[hidden] { display: none !important; }
.task-method-section .method-readiness { margin: 0; }
/* Task footer: readiness sits with the task's own actions, not inside a settings section */
.task-editor .task-footer { margin-top: 16px; }
.task-editor .task-footer .method-readiness { margin: 0; padding: 10px 14px; border-radius: 10px; font-size: .8125rem; }
.task-editor .task-footer .method-readiness ul { margin: 4px 0 0; }
.task-editor .task-footer + .inline-actions { margin-top: 12px; }

/* Accordion titles carry no underline anywhere (task, question, screener/final-question cards,
   study sections and results feedback cards). Spacing replaces the old divider. */
.builder-card h4, .builder-card h5:not(.task-editor-body > h5) { padding-bottom: 0; border-bottom: 0; }
.task-editor-head h4, .question-editor-head h4 { margin: 0; }
.task-editor-head { margin-bottom: 12px; }
.task-editor.is-collapsed .task-editor-head { margin-bottom: 0; }
.admin-section:not(.is-collapsed) > .section-header { border-bottom: 0; padding-bottom: 8px; }
.results-feedback details.feedback-card[open] .feedback-card-header,
.results-feedback .feedback-card-header { border-bottom: 0; }
.results-participant-section > .section-header { border-bottom: 0; }
/* Collapsed task cards: one compact row (~54px), not a tall empty box */
.task-editor.is-collapsed { padding: 0 !important; }
.task-editor.is-collapsed .task-editor-head { position: static; min-height: 0; padding: 8px 10px 8px 12px; border-radius: 13px; background: transparent; }
.task-editor.is-collapsed .task-accordion-toggle { width: 32px; height: 32px; }
.task-editor.is-collapsed .task-drag-handle { width: 28px; height: 28px; }
.task-editor-body > .followup-list:not(:has(.question-editor))::after { content: "No questions yet. Use “+ Add Follow-up Question” below."; display: block; padding: 10px 4px 2px; color: #6a7090; font-size: .85rem; }

/* ── Left nav: Tasks group (2026-11) ─────────────────────────────────────
   The section with children sits in one subtle tinted block; the active row
   (number, label, count and the expand arrow) shares one background; child
   tasks are flush with no rail, indent or bullet dots. */
.rail-list > .create-nav-section-item:has(.create-nav-task-tree:not([hidden])):has(.create-nav-link.active) { padding: 4px; border-radius: 12px; background: #F6F7FB; }
.create-nav-row { position: relative; border-radius: 10px; }
.create-nav-row:has(.create-nav-link.active) { background: #f1f0ff; box-shadow: inset 0 0 0 1px #dedaff; }
.create-nav-row:has(.create-nav-link.active)::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: #5b4ee6; }
.create-nav-row:has(.create-nav-link.active) .create-nav-link { background: transparent; border-color: transparent; box-shadow: none; }
.create-nav-row:has(.create-nav-link.active) .create-nav-link::before { display: none; }
.create-nav-row .create-nav-tree-toggle { flex: 0 0 auto; width: 32px; height: 32px; margin-right: 4px; align-self: center; border-radius: 8px; background: transparent; }
.create-nav-row:has(.create-nav-link.active) .create-nav-tree-toggle { color: #4a3fd0; }
.create-nav-row .create-nav-tree-toggle:hover { background: rgba(91,78,230,.1); }
.create-nav-task-tree { width: 100% !important; margin: 4px 0 0 !important; padding: 0 !important; border-left: 0 !important; }
.create-nav-task-tree > li + li { margin-top: 2px; }
.create-nav-task-link { padding: 6px 8px !important; }
.create-nav-task-title { flex: 1 1 auto; }
.create-nav-task-link::before { display: none !important; }
.create-nav-task-link:hover { background: #fff !important; }
.create-nav-task-link.active { background: #fff !important; border-color: #dcd8ff !important; }
/* Task count reads as a count, not another step number: plain muted text, no circle */
.rail-list .create-nav-link-meta, .create-nav-link-meta,
.rail-list .create-nav-link.active .create-nav-link-meta {
  min-width: 0; height: auto; padding: 0; margin-left: auto; border: 0; border-radius: 0;
  background: none !important; box-shadow: none; color: #6a7090; font-size: .75rem; font-weight: 500; white-space: nowrap;
}
.create-nav-row:has(.create-nav-link.active) .create-nav-link-meta { color: #4a3fd0; }
.rail-list .create-nav-link-meta, .create-nav-link-meta { display: inline-flex !important; align-items: baseline; gap: 3px; width: auto !important; }
/* Hover highlights the whole row (label, count and chevron together), not just the label link */
.rail-list .create-nav-link:hover, .rail-list .create-nav-link:focus-visible { background: transparent !important; border-color: transparent !important; box-shadow: none !important; }
.create-nav-row { transition: background-color 140ms cubic-bezier(.2,.7,.2,1), box-shadow 140ms cubic-bezier(.2,.7,.2,1); }
.create-nav-row:hover:not(:has(.create-nav-link.active)) { background: #f3f4f9; box-shadow: inset 0 0 0 1px #e3e5ef; }
.create-nav-row:has(.create-nav-link.active):hover { background: #eae8ff; }
.create-nav-row:has(.create-nav-link:focus-visible) { box-shadow: 0 0 0 3px rgba(81,70,216,.28); }
.create-nav-row .create-nav-tree-toggle:hover { background: rgba(91,78,230,.12); color: #4a3fd0; }

/* ══ Authoring layout: use the width, collapsible study panel (2026-11) ══ */
@media (min-width: 1101px) {
  body:not(.invite-stage-active):not(.results-stage-active) .workspace-shell {
    max-width: 1760px; margin: 0 auto; padding: 22px 0 0; /* the page container already provides the side margin */
    grid-template-columns: 280px minmax(0, 1fr); gap: clamp(16px, 1.6vw, 28px);
    transition: grid-template-columns 220ms cubic-bezier(.2,.7,.2,1);
  }
  body:not(.invite-stage-active):not(.results-stage-active) .workspace-content { max-width: none; }
  body.rail-collapsed:not(.invite-stage-active):not(.results-stage-active) .workspace-shell { grid-template-columns: 64px minmax(0, 1fr); }
}
.create-nav-head { display: flex; align-items: center; gap: 8px; }
.rail-toggle { flex: 0 0 auto; display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 1px solid #e3e5ef; border-radius: 8px; background: #fff; color: #5c6283; cursor: pointer; transition: background-color 140ms ease, color 140ms ease, transform 200ms cubic-bezier(.2,.7,.2,1); }
.rail-toggle svg { width: 16px; height: 16px; transition: transform 200ms cubic-bezier(.2,.7,.2,1); }
.rail-toggle:hover { background: #f1f0ff; color: #4a3fd0; border-color: #dcd8ff; }
.rail-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(81,70,216,.28); }
@media (max-width: 1100px) { .rail-toggle { display: none; } }

/* Collapsed strip: section numbers + icon actions only */
@media (min-width: 1101px) {
  body.rail-collapsed .create-nav { padding: 10px 6px !important; overflow: visible; }
  body.rail-collapsed .create-nav-head { flex-direction: column; gap: 10px; padding: 0 0 10px; }
  body.rail-collapsed .create-nav-head h3 { display: none; }
  body.rail-collapsed .rail-toggle svg { transform: rotate(180deg); }
  body.rail-collapsed .rail-list { padding: 0; gap: 4px; }
  body.rail-collapsed .rail-list > .create-nav-section-item { padding: 0 !important; background: none !important; }
  body.rail-collapsed .create-nav-row { justify-content: center; }
  body.rail-collapsed .create-nav-link { justify-content: center; padding: 6px 0 !important; min-height: 40px; }
  body.rail-collapsed .create-nav-link-text, body.rail-collapsed .create-nav-link-meta {
    position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  body.rail-collapsed .create-nav-tree-toggle, body.rail-collapsed .create-nav-task-tree { display: none !important; }
  body.rail-collapsed .create-nav-footer { padding-top: 10px; }
  body.rail-collapsed .study-backup-export, body.rail-collapsed .builder-history-actions,
  body.rail-collapsed .study-autosave-status { display: none !important; }
  body.rail-collapsed .create-nav-actions { grid-template-columns: 1fr !important; gap: 6px; padding: 4px; }
  body.rail-collapsed .create-nav-actions .create-nav-action-icon { min-height: 40px; padding: 0; }
  body.rail-collapsed .create-nav-actions .create-nav-action-icon span { display: none; }
}

/* Collapsed study panel: every item on one centre line */
@media (min-width: 1101px) {
  body.rail-collapsed .create-nav { display: flex; flex-direction: column; align-items: center; }
  body.rail-collapsed .create-nav-head { width: 100%; align-items: center; justify-content: center; }
  body.rail-collapsed #create-nav-list, body.rail-collapsed .rail-list { width: 100%; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: center; }
  body.rail-collapsed .rail-list > .create-nav-section-item { width: 100%; display: flex; justify-content: center; }
  body.rail-collapsed .create-nav-row { display: flex; justify-content: center; align-items: center; width: 44px; height: 44px; margin: 0 auto; }
  body.rail-collapsed .create-nav-row > .create-nav-link,
  body.rail-collapsed .rail-list .create-nav-link { display: flex !important; align-items: center; justify-content: center; flex: 0 0 100%; width: 100%; min-height: 44px; margin: 0; padding: 0 !important; gap: 0; grid-template-columns: none; }
  body.rail-collapsed .rail-list .create-nav-link-index { margin: 0 !important; flex: 0 0 auto; }
  /* The left marker bar belongs to the expanded view only: the highlighted pill is enough here. */
  body.rail-collapsed .create-nav-row::before,
  body.rail-collapsed .create-nav-row:has(.create-nav-link.active)::before,
  body.rail-collapsed .rail-list .create-nav-link::before,
  body.rail-collapsed .rail-list .create-nav-link.active::before { content: none !important; display: none !important; }
  body.rail-collapsed .rail-list .create-nav-link.active { box-shadow: none !important; border-left-color: transparent !important; }
  body.rail-collapsed .create-nav-footer { width: 100%; display: flex; flex-direction: column; align-items: center; }
  body.rail-collapsed .create-nav-actions { width: 44px; margin: 0 auto; padding: 0; background: none; border: 0; box-shadow: none; justify-items: center; }
  body.rail-collapsed .create-nav-actions .create-nav-action-icon { display: grid; place-items: center; width: 40px; height: 40px; min-height: 40px; margin: 0; }
}
/* Setup → Text: font + size side by side */
.setup-text-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 10px 16px; margin: 14px 0 6px; }
.setup-text-row .setup-text-title { grid-column: 1 / -1; margin: 0; font-size: .8125rem; font-weight: 700; color: var(--ink, #172033); }
.setup-text-row .setup-text-title .hint-inline { font-weight: 400; color: var(--ink-muted, #566176); margin-left: 6px; }
@media (max-width: 640px) { .setup-text-row { grid-template-columns: 1fr; } }
/* Integration profile save feedback, next to the button */
#btn-save-dashboard-integration + .integration-save-status, .integration-save-status { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 0 12px; font-size: .85rem; color: var(--ink-muted, #566176); vertical-align: middle; }
.integration-save-status:empty { display: none; }
.integration-save-status[data-state="saving"]::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: ui-spin .8s linear infinite; }
.integration-save-status[data-state="saved"] { color: var(--success, #12794F); font-weight: 600; }
.integration-save-status[data-state="saved"]::before { content: "✓"; font-weight: 700; }
.integration-save-status[data-state="dirty"] { color: var(--warn, #B26A00); }
.integration-save-status[data-state="error"] { color: var(--danger, #C8283F); font-weight: 600; }

/* Participant wording editor (study panel + per task) */
.setup-wording-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; }
.setup-wording-head p { max-width: 68ch; }
.setup-wording-head .hint { margin-top: 6px; }
.wording-groups { display: grid; gap: 8px; }
.wording-group, .task-wording { border: 1px solid var(--border, #E3E6ED); border-radius: 12px; background: #fff; }
.wording-group > summary, .task-wording > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 0 14px; cursor: pointer; font-weight: 600; color: var(--ink, #172033); list-style: none; border-radius: 12px; transition: background-color 140ms cubic-bezier(.2,.7,.2,1); }
.wording-group > summary::-webkit-details-marker, .task-wording > summary::-webkit-details-marker { display: none; }
.wording-group > summary::after, .task-wording > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin-left: 4px; opacity: .6; transition: transform 200ms cubic-bezier(.2,.7,.2,1); flex: none; }
.wording-group[open] > summary::after, .task-wording[open] > summary::after { transform: rotate(-135deg); }
.wording-group > summary:hover, .task-wording > summary:hover { background: #F6F7FB; }
.wording-group > summary:focus-visible, .task-wording > summary:focus-visible { outline: 2px solid #7569EE; outline-offset: 2px; }
.wording-group > summary > span:first-child { flex: 1; }
.task-wording > summary { justify-content: flex-start; }
.task-wording > summary .wording-count { margin-left: auto; }
.wording-count { font-size: .78rem; font-weight: 600; color: #342B9B; background: #EFEDFF; border-radius: 999px; padding: 2px 8px; }
.wording-count:empty { display: none; }
.wording-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px 16px; padding: 4px 14px 14px; }
.wording-field { position: relative; display: grid; gap: 4px; min-width: 0; }
.wording-field label { font-size: .82rem; font-weight: 600; color: #566176; }
.wording-field input, .wording-field textarea { width: 100%; font: inherit; }
.wording-field input::placeholder, .wording-field textarea::placeholder { color: #8A93A6; }
.wording-reset { position: absolute; top: -2px; right: 0; border: 0; background: none; padding: 0 2px; font-size: .78rem; font-weight: 600; color: #5146D8; cursor: pointer; }
.wording-reset:hover { text-decoration: underline; }
.task-wording { margin: 16px 0 8px; }
.task-wording > .hint { margin: 0 14px 8px; }
.task-wording .wording-group { margin: 0 14px 8px; }
.task-wording .wording-group:last-child { margin-bottom: 14px; }
@media (max-width: 640px) { .setup-wording-head { flex-direction: column; } }

/* Figma prototype view (task editor) */
.task-editor .task-field-figma-view { order: 2; display: grid; gap: 8px; margin: 0; padding: 12px 14px; border: 1px solid var(--border, #E3E6ED); border-radius: 12px; min-width: 0; }
.task-editor .task-field-figma-view legend { padding: 0 4px; font-size: .8125rem; font-weight: 700; color: var(--ink, #172033); }
.task-editor .task-field-figma-view select { max-width: 360px; }
.task-editor .task-field-figma-view .hint { margin: 0; font-size: .8125rem; color: var(--ink-muted, #566176); }
/* Figma end-screen settings */
.task-editor .figma-end-field { display: grid; gap: 8px; margin: 0; padding: 12px 14px; border: 1px solid var(--border, #E3E6ED); border-radius: 12px; min-width: 0; }
.task-editor .figma-end-field legend { padding: 0 4px; font-size: .8125rem; font-weight: 700; color: var(--ink, #172033); }

/* Writing assistant: the field is locked and shows the work happening inside it */
.rich-text-field { position: relative; }
.rich-text-field.is-ai-working textarea, .is-ai-working > textarea { color: color-mix(in srgb, var(--ink, #172033) 45%, transparent); cursor: progress; background:
  linear-gradient(100deg, transparent 20%, rgba(117,105,238,.16) 40%, rgba(117,105,238,.28) 50%, rgba(117,105,238,.16) 60%, transparent 80%) 0 0 / 250% 100% no-repeat, #fff;
  animation: ai-sweep 1.4s cubic-bezier(.4,0,.2,1) infinite; }
@keyframes ai-sweep { from { background-position: 130% 0, 0 0; } to { background-position: -130% 0, 0 0; } }
.ai-working-badge { position: absolute; right: 10px; bottom: 10px; z-index: 2; display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: #5146D8; color: #fff; font-size: .8rem; font-weight: 600; box-shadow: 0 6px 18px rgba(81,70,216,.3); pointer-events: none; }
.ai-working-dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: ai-pulse 1s ease-in-out infinite; }
@keyframes ai-pulse { 0%, 100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.15); } }
.rich-text-field.ai-just-rewritten { box-shadow: 0 0 0 3px rgba(18,121,79,.28); transition: box-shadow 600ms ease; }
.ai-undo-chip { display: flex; align-items: center; gap: 10px; margin-top: 6px; padding: 6px 8px 6px 12px; border-radius: 10px; background: #E3F6EC; color: #12794F; font-size: .82rem; font-weight: 600; width: fit-content; animation: ui-fade 200ms ease; }
.ai-undo-chip button { border: 1px solid rgba(18,121,79,.35); background: #fff; color: #12794F; border-radius: 8px; padding: 4px 10px; font: inherit; cursor: pointer; }
.ai-undo-chip button:hover { background: #F2FBF6; }
.ai-undo-chip button:focus-visible { outline: 2px solid #7569EE; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .rich-text-field.is-ai-working textarea, .ai-working-dot { animation: none; } }

/* Task image preview: click to view full size; actions below the thumbnail */
.task-image-preview.has-image { height: auto !important; min-height: 200px; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px; }
.task-image-preview.has-image img { max-height: 240px; cursor: zoom-in; border-radius: 8px; transition: box-shadow 140ms cubic-bezier(.2,.7,.2,1), transform 140ms cubic-bezier(.2,.7,.2,1); }
.task-image-preview.has-image img:hover { box-shadow: 0 6px 18px rgba(17,19,58,.14); transform: translateY(-1px); }
.task-image-preview img:focus-visible, .question-image-preview img:focus-visible, .task-intro-image-preview img:focus-visible { outline: 2px solid #7569EE; outline-offset: 3px; }
.question-image-preview img, .task-intro-image-preview img { cursor: zoom-in; }
.task-image-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.task-image-actions .task-image-remove { position: static !important; }

/* Lightbox */
.img-lightbox { width: min(1400px, 96vw); height: 94vh; max-width: none; max-height: none; padding: 0; border: 0; border-radius: 14px; background: #0f1222; color: #fff; overflow: hidden; display: flex; flex-direction: column; }
.img-lightbox:not([open]) { display: none; }
.img-lightbox::backdrop { background: rgba(10,12,28,.72); }
.img-lightbox-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: rgba(255,255,255,.06); border-bottom: 1px solid rgba(255,255,255,.1); }
.img-lightbox-title { flex: 1; font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.img-lightbox-bar .btn { background: rgba(255,255,255,.1) !important; color: #fff !important; border-color: rgba(255,255,255,.2) !important; text-decoration: none; }
.img-lightbox-bar .btn:hover { background: rgba(255,255,255,.18) !important; }
.img-lightbox-stage { flex: 1; overflow: auto; display: grid; place-items: center; padding: 16px; }
.img-lightbox-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; background: #fff; }
.img-lightbox-stage.is-actual { place-items: start; }
.img-lightbox-stage.is-actual img { max-width: none; max-height: none; }

/* Markup editor */
.markup-dialog { width: 98vw; height: 96vh; max-width: none; max-height: none; padding: 0; border: 0; border-radius: 14px; background: #F6F7FB; display: flex; flex-direction: column; overflow: hidden; }
.markup-dialog:not([open]) { display: none; }
.markup-dialog::backdrop { background: rgba(10,12,28,.6); }
.markup-dialog.is-opening { animation: ui-dialog-in 200ms cubic-bezier(.2,.7,.2,1); }
.markup-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; background: #fff; border-bottom: 1px solid #E3E6ED; }
.markup-group { display: flex; align-items: center; gap: 4px; padding-right: 10px; border-right: 1px solid #E3E6ED; }
.markup-group:last-child, .markup-end { border-right: 0; }
.markup-end { margin-left: auto; gap: 8px; }
.markup-tool { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #566176; font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; }
.markup-tool svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.markup-tool:hover { background: #F6F7FB; color: #172033; }
.markup-tool[aria-pressed="true"] { background: #EFEDFF; border-color: #5146D8; color: #342B9B; }
.markup-swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; background: var(--sw); box-shadow: 0 0 0 1px #CDD2DC; cursor: pointer; }
.markup-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px #5146D8; }
.markup-size { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid transparent; border-radius: 8px; background: transparent; cursor: pointer; }
.markup-size i { display: block; width: var(--d); height: var(--d); border-radius: 50%; background: #172033; }
.markup-size[aria-pressed="true"] { background: #EFEDFF; border-color: #5146D8; }
.markup-tool:focus-visible, .markup-swatch:focus-visible, .markup-size:focus-visible { outline: 2px solid #7569EE; outline-offset: 2px; }
.markup-pinstyle { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; color: #566176; }
.markup-pinstyle select { min-height: 32px; padding: 0 8px; border-radius: 8px; }
.markup-hint { margin: 0; padding: 8px 14px; font-size: .82rem; color: #566176; }
.markup-stage { flex: 1; overflow: auto; padding: 0 16px 16px; }
.markup-canvas-wrap { position: relative; width: fit-content; max-width: 100%; margin: 0 auto; box-shadow: 0 6px 18px rgba(17,19,58,.08); }
.markup-canvas-wrap canvas { display: block; max-width: 100%; height: auto; background: #fff; touch-action: none; }
.markup-canvas-wrap[data-tool="pen"] canvas, .markup-canvas-wrap[data-tool="rect"] canvas, .markup-canvas-wrap[data-tool="arrow"] canvas { cursor: crosshair; }
.markup-canvas-wrap[data-tool="pin"] canvas { cursor: copy; }
.markup-canvas-wrap[data-tool="text"] canvas { cursor: text; }
.markup-canvas-wrap[data-tool="select"] canvas { cursor: move; }
.markup-text-input { position: absolute; z-index: 3; min-width: 160px; padding: 2px 4px; border: 2px dashed #5146D8; border-radius: 4px; background: rgba(255,255,255,.9); font-family: Inter, Arial, sans-serif; font-weight: 700; line-height: 1.25; resize: both; }
@media (max-width: 900px) { .markup-tool span { display: none; } .markup-group { border-right: 0; padding-right: 0; } }
.task-image-preview.has-image { max-height: none !important; overflow: visible; }
.task-image-preview.has-image img { width: auto; height: auto; max-width: 100%; }
/* Soft length guidance under long instructions */
.soft-limit-note { display: flex; gap: 8px; margin: 6px 0 0; padding: 8px 12px; border-radius: 10px; background: #FFF1D6; color: #7A4A00; font-size: .82rem; line-height: 1.45; }
.soft-limit-note::before { content: "!"; flex: none; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #B26A00; color: #fff; font-weight: 800; font-size: .72rem; }

/* Rewrite split button + options menu */
.rich-text-ai-split { display: inline-flex; align-items: stretch; margin-left: auto; border-radius: 8px; }
.rich-text-ai-split .rich-text-ai { border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; margin-left: 0 !important; }
.rich-text-ai-more { display: inline-grid; place-items: center; width: 28px; min-height: 30px; border: 0; border-left: 1px solid rgba(81,70,216,.2); border-radius: 0 8px 8px 0; background: transparent; color: #5146D8; cursor: pointer; }
.rich-text-ai-more:hover, .rich-text-ai-more[aria-expanded="true"] { background: #EFEDFF; }
.rich-text-ai-more:focus-visible { outline: 2px solid #7569EE; outline-offset: 2px; }
.rich-text-ai-more:disabled { opacity: .5; cursor: progress; }
.rewrite-menu { position: absolute; z-index: 4000; width: 280px; padding: 6px; border: 1px solid #E3E6ED; border-radius: 12px; background: #fff; box-shadow: 0 18px 48px rgba(17,19,58,.16); animation: rewrite-menu-in 160ms cubic-bezier(.2,.7,.2,1); }
@keyframes rewrite-menu-in { from { opacity: 0; transform: translateY(4px); } }
.rewrite-menu [role="menuitem"] { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; text-align: left; font: inherit; cursor: pointer; color: #172033; }
.rewrite-menu [role="menuitem"] strong { font-size: .86rem; }
.rewrite-menu [role="menuitem"] small { font-size: .75rem; color: #566176; }
.rewrite-menu [role="menuitem"]:hover, .rewrite-menu [role="menuitem"]:focus-visible { background: #EFEDFF; outline: none; }
.rewrite-menu [role="menuitem"]:first-child strong::after { content: "Default"; margin-left: 8px; padding: 1px 6px; border-radius: 999px; background: #EFEDFF; color: #342B9B; font-size: .68rem; font-weight: 700; }
.rewrite-menu-custom { margin-top: 4px; padding: 8px 10px 4px; border-top: 1px solid #E3E6ED; }
.rewrite-menu-custom label { display: block; margin-bottom: 6px; font-size: .78rem; font-weight: 700; color: #566176; }
.rewrite-menu-custom div { display: flex; gap: 6px; }
.rewrite-menu-custom input { flex: 1; min-width: 0; min-height: 34px; padding: 0 8px; border: 1px solid #CDD2DC; border-radius: 8px; font: inherit; font-size: .82rem; }
.rewrite-menu-custom input:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(81,70,216,.24); border-color: #7569EE; }
@media (prefers-reduced-motion: reduce) { .rewrite-menu { animation: none; } }

/* ── Study journey bar: Create → Invite → Results as connected nodes ──
   Each step shows its live status; the connector between steps fills when the study moves on
   (published → ready to share; responses → results), and a soft flow runs along filled connectors. */
.journey-nav { display: flex; align-items: center; gap: 0; padding: 6px 10px; border: 1px solid var(--border, #E3E6ED); border-radius: 16px; background: #fff; box-shadow: 0 1px 2px rgba(17,19,58,.06); }
.journey-nav .stage-tab.journey-step { display: flex; flex-direction: row; align-items: center; justify-items: start; gap: 10px; padding: 6px 12px 6px 6px; border: 0; border-radius: 12px; background: transparent; color: #566176; text-align: left; white-space: nowrap; transform: none; box-shadow: none; transition: background-color 140ms cubic-bezier(.2,.7,.2,1); }
.journey-nav .stage-tab.journey-step::before, .journey-nav .stage-tab.journey-step::after { display: none !important; }
.journey-nav .journey-step:hover { background: #F6F7FB; }
.journey-nav .journey-step:focus-visible { outline: 2px solid #7569EE; outline-offset: 2px; }
.journey-node { position: relative; display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%; border: 2px solid #CDD2DC; background: #fff; color: #566176; transition: background-color 200ms cubic-bezier(.2,.7,.2,1), border-color 200ms, color 200ms, box-shadow 200ms; }
.journey-node svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.journey-text { display: flex; flex-direction: column; line-height: 1.2; }
.journey-text strong { font-size: .875rem; font-weight: 700; color: #172033; }
.journey-text small { font-size: .72rem; font-weight: 500; color: #566176; }
/* Completed step: tinted node with a small check badge */
.journey-step.is-complete .journey-node { border-color: var(--brand-primary, #5146D8); color: var(--brand-primary, #5146D8); background: #EFEDFF; }
.journey-step.is-complete .journey-node::after { content: ""; position: absolute; right: -3px; bottom: -3px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; background: #12794F url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/10px no-repeat; }
.journey-step.is-complete .journey-text small { color: #12794F; font-weight: 600; }
.journey-step.has-data .journey-text small { color: var(--brand-primary, #5146D8); font-weight: 700; }
/* Current step: filled node with a soft halo */
.journey-nav .journey-step.active { background: #F6F5FF; }
.journey-step.active .journey-node { border-color: var(--brand-primary, #5146D8); background: var(--brand-primary, #5146D8); color: #fff; box-shadow: 0 0 0 4px rgba(81,70,216,.16); }
.journey-step.active .journey-text strong { color: var(--brand-primary, #5146D8); }
/* Connectors */
.journey-link { position: relative; width: clamp(28px, 4vw, 64px); height: 4px; margin: 0 2px; border-radius: 999px; background: #E3E6ED; overflow: hidden; flex: none; }
.journey-link i { position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(90deg, #7569EE, var(--brand-primary, #5146D8)); transform: scaleX(0); transform-origin: left; transition: transform 420ms cubic-bezier(.2,.7,.2,1); }
.journey-link.is-filled i { transform: scaleX(1); }
.journey-link.is-filled::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle, rgba(255,255,255,.95) 0 1.4px, transparent 1.8px) 0 50% / 12px 4px repeat-x; animation: journey-flow 1.6s linear infinite; }
.journey-link:not(.is-filled) { background: repeating-linear-gradient(90deg, #CDD2DC 0 6px, transparent 6px 10px); }
@keyframes journey-flow { from { background-position: 0 50%; } to { background-position: 12px 50%; } }
@media (prefers-reduced-motion: reduce) { .journey-link.is-filled::after { animation: none; } .journey-link i { transition: none; } }
@media (max-width: 1100px) { .journey-text small { display: none; } .journey-nav .stage-tab.journey-step { padding-right: 10px; } }
@media (max-width: 720px) { .journey-nav { width: 100%; justify-content: space-between; } .journey-text strong { font-size: .8rem; } .journey-node { width: 30px; height: 30px; } .journey-link { flex: 1; width: auto; } }

/* Tip under Figma link fields: keep all prototypes in one Figma file so they load faster */
.hint.figma-speed-tip { margin: -8px 0 12px; padding: 8px 10px; border-radius: 8px; background: #f3f6fc; border-left: 3px solid var(--brand-primary, #3b4fd8); font-weight: 400; color: var(--ink-soft, #4a5568); }
.hint.figma-speed-tip b { color: var(--ink, #172033); font-weight: 650; }
.ab-ed-fields .hint.figma-speed-tip { margin: 4px 0 0; }

/* Nav action buttons (Preview, Save, …): text colour comes from the design tokens, so it can't fall back to the ink colour. */
button.create-nav-action-icon:not(.create-nav-action-delete) { color: var(--brand-on-primary); }
button.create-nav-action-icon:not(.create-nav-action-delete) span { color: var(--brand-on-primary); }

/* Context pre-task pop-up: first item in Task details, aligned with the grid below (no doubled margins) */
.task-section > .task-details-context { padding: 4px 14px 0; }
.task-section > .task-details-context > .task-intro-editor { margin: 0 0 16px; }
