:root {
  --coral: #F97362;
  --coral-700: #e25a48;
  --coral-50: #fdece9;
  --obsidian: #0B1220;
  --ink: #0B1220;
  --ink-2: #2a3242;
  --muted: #6b7280;
  --cream: #FBF8F2;
  --cream-2: #f3efe6;
  --line: #e7e2d6;
  --line-2: #d8d2c2;
  --teal: #2DD4BF;
  --white: #ffffff;
  --shadow-sm: 0 1px 2px rgba(11,18,32,.06);
  --shadow-md: 0 4px 14px rgba(11,18,32,.08);
  --radius: 10px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--ink);
  background: var(--cream);
  font-size: 14px;
  line-height: 1.5;
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; color: inherit; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-left { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.icon-btn {
  width: 36px; height: 36px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--cream-2); border-color: var(--line-2); }
.study-title {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 18px;
  color: var(--obsidian);
  border: 1px solid transparent;
  background: transparent;
  padding: 6px 8px;
  border-radius: 6px;
  width: 220px;
}
.study-title:hover { border-color: var(--line); }
.study-title:focus { outline: none; border-color: var(--coral); background: var(--white); }

.stepper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.step {
  background: none;
  border: 0;
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
  padding: 6px 4px;
  border-bottom: 2px solid transparent;
}
.step.is-active { color: var(--obsidian); border-bottom-color: var(--coral); }
.step-sep { color: #c7c0ae; font-size: 16px; }

.topbar-right { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.autosave {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted);
  font-size: 13px;
  padding-right: 4px;
}
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  padding: 9px 14px;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-ghost { background: var(--white); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--cream-2); }
.btn-primary { background: var(--coral); color: white; }
.btn-primary:hover { background: var(--coral-700); }

/* ---------- Sub nav ---------- */
.subnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  padding: 0 20px;
  position: sticky;
  top: 61px;
  z-index: 9;
}
.tabs { display: flex; gap: 8px; }
.tab {
  background: transparent;
  border: 0;
  padding: 14px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--obsidian); border-bottom-color: var(--coral); font-weight: 600; }

.guides-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent;
  border: 0;
  color: var(--ink);
  font-weight: 500;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 8px;
}
.guides-btn:hover { background: var(--cream-2); }
.guides-caret { transition: transform .15s; }
.guides.is-open .guides-caret { transform: rotate(180deg); }

.guides-menu {
  left: auto;
  right: 0;
  min-width: 220px;
  padding: 8px;
  border-radius: 12px;
}
.guides-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  background: transparent;
  border: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
}
.guides-item:hover { background: var(--cream-2); }
.guides-ico {
  width: 28px; height: 28px;
  border-radius: 999px;
  border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2);
  flex: 0 0 auto;
}
.guides-ext { color: var(--muted); margin-left: auto; }

/* ---------- Page / panel ---------- */
.page { padding: 28px 24px 80px; max-width: 1200px; margin: 0 auto; }
.panel.hidden { display: none; }

.panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 40px;
}
@media (max-width: 900px) { .panel-grid { grid-template-columns: 1fr; } }

.h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 24px;
  color: var(--obsidian);
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.muted { color: var(--muted); margin: 0 0 22px; font-size: 13.5px; }

/* ---------- Form ---------- */
.field { margin-bottom: 22px; }
.label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 8px;
}
.input, .select, .textarea-sm {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea-sm:focus, .rte:focus-within {
  border-color: var(--coral);
  box-shadow: 0 0 0 3px var(--coral-50);
}
.input-readonly { background: var(--cream-2); color: var(--ink-2); }
.textarea-sm { resize: vertical; min-height: 80px; font-family: inherit; }

.select-wrap { position: relative; }
.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
}
.select-caret {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

/* ---------- Rich text editor ---------- */
.rte {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  overflow: hidden;
}
.rte-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--white);
}
.rte-btn {
  width: 30px; height: 30px;
  border-radius: 6px;
  background: transparent;
  border: 0;
  color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.rte-btn:hover { background: var(--cream-2); color: var(--ink); }
.rte-help {
  margin-left: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  width: 22px; height: 22px;
  font-size: 12px;
  color: var(--muted);
}
.rte-spacer { flex: 1; }

.seg {
  display: inline-flex;
  background: var(--cream-2);
  border-radius: 8px;
  padding: 3px;
  margin-left: 8px;
}
.seg-btn {
  border: 0;
  background: transparent;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  color: var(--ink-2);
}
.seg-btn.is-active {
  background: var(--coral);
  color: white;
  box-shadow: var(--shadow-sm);
}

.rte-area {
  min-height: 160px;
  padding: 14px 16px;
  outline: none;
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13.5px;
  color: var(--ink);
  line-height: 1.65;
}
.rte-area:empty::before {
  content: attr(data-placeholder);
  color: #a8a294;
  white-space: pre-wrap;
}

/* ---------- Side panel ---------- */
.panel-side .field { margin-bottom: 18px; }

/* ---------- Cards tab ---------- */
.cards-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px; flex-wrap: wrap;
}
.inline-h1 { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.help-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  border-radius: 999px;
  background: var(--cream-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: help;
  border: 1px solid var(--line);
}
.help-dot.inline { width: 16px; height: 16px; font-size: 10px; vertical-align: middle; margin-left: 4px; }
.cards-actions { display: flex; gap: 8px; }
.btn-danger {
  background: var(--white);
  color: #c0392b;
  border: 1px solid #f3c8c1;
}
.btn-danger:hover { background: #fdf2f0; border-color: #e9b3aa; }

.dropdown { position: relative; }
.dropdown-trigger { padding-right: 10px; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px); left: 0;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  min-width: 160px;
  padding: 6px;
  display: none;
  z-index: 5;
}
.dropdown.is-open .dropdown-menu { display: block; }
.dropdown-menu button {
  display: block; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: 6px;
  background: transparent; border: 0;
  font-size: 13px; color: var(--ink);
}
.dropdown-menu button:hover { background: var(--cream-2); }

.cards-listLabel {
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  margin-bottom: 8px;
}
.cards-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.card-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  transition: border-color .15s, box-shadow .15s;
}
.card-row:focus-within { border-color: var(--coral); box-shadow: 0 0 0 3px var(--coral-50); }
.card-row.is-dragging { opacity: .5; }
.drag-handle {
  width: 22px; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  cursor: grab; user-select: none;
  font-size: 14px; line-height: 1;
}
.drag-handle:active { cursor: grabbing; }
.card-input {
  flex: 1;
  border: 0; outline: none;
  background: transparent;
  padding: 8px 6px;
  font-size: 14px;
}
.card-delete {
  width: 32px; height: 32px;
  border-radius: 6px;
  background: transparent;
  border: 0;
  color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
}
.card-delete:hover { background: #fdf2f0; color: #c0392b; }

.cards-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 16px;
}
.cards-count { color: var(--ink-2); font-size: 13px; }
.cards-count strong { color: var(--obsidian); font-weight: 700; margin-left: 4px; }

/* Options sidebar */
.h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--obsidian);
  margin: 0 0 14px;
}
.opt-list { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-direction: column; gap: 12px; }
.opt label {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--ink);
}
.opt input[type="checkbox"] {
  position: absolute; opacity: 0; pointer-events: none;
}
.check {
  width: 18px; height: 18px;
  border-radius: 4px;
  border: 1.5px solid var(--line-2);
  background: var(--white);
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
  transition: background .15s, border-color .15s;
}
.opt input:checked + .check {
  background: var(--coral);
  border-color: var(--coral);
}
.opt input:checked + .check::after {
  content: "";
  width: 5px; height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}
.opt input:focus-visible + .check { box-shadow: 0 0 0 3px var(--coral-50); }
.opt-text { flex: 1; }

.opt-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13.5px;
  color: var(--ink);
  flex-wrap: wrap;
}
.inline-select { width: 90px; }
.inline-select .select { padding: 6px 28px 6px 10px; font-size: 13px; }

/* ---------- Categories tab ---------- */
.sort-types { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 14px; }
.sort-type label {
  display: flex; gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.sort-type label:hover { border-color: var(--line-2); }
.sort-type input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.radio {
  width: 18px; height: 18px;
  border-radius: 999px;
  border: 1.5px solid var(--line-2);
  background: var(--white);
  flex: 0 0 auto;
  margin-top: 2px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: border-color .15s;
}
.sort-type input:checked + .radio {
  border-color: var(--coral);
}
.sort-type input:checked + .radio::after {
  content: "";
  width: 10px; height: 10px; border-radius: 999px;
  background: var(--coral);
}
.sort-type input:checked ~ .sort-type-body .sort-type-title { color: var(--obsidian); }
.sort-type:has(input:checked) label {
  border-color: var(--coral);
  box-shadow: 0 0 0 3px var(--coral-50);
  background: #fffaf8;
}
.sort-type-body { flex: 1; }
.sort-type-title { font-weight: 600; color: var(--obsidian); font-size: 15px; margin-bottom: 4px; }
.sort-type-desc { color: var(--ink-2); font-size: 13.5px; margin-bottom: 10px; }
.sort-type-tools { color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.sort-type-tools strong { color: var(--ink-2); font-weight: 600; }

/* ---------- Study flow tab ---------- */
.flow-grid {
  display: grid;
  grid-template-columns: minmax(380px, 480px) 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 1000px) { .flow-grid { grid-template-columns: 1fr; } }

.flow-col { display: flex; flex-direction: column; gap: 14px; }
.flow-head { display: flex; align-items: center; justify-content: space-between; }
.feedback-btn { font-size: 12.5px; padding: 6px 10px; }

.flow-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.flow-item {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.flow-item:has(.flow-row-ritual) { border-color: #b9efe5; }

.flow-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--white);
}
.flow-row.is-disabled { opacity: .55; }
.flow-row[data-preview] { cursor: pointer; }
.flow-row[data-preview]:hover { background: var(--cream-2); }
.flow-row.is-selected { background: var(--coral-50); }
.flow-row.is-selected .flow-title { color: var(--coral-700); }
.flow-row-section { padding: 14px 14px 10px; }

.flow-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.flow-icon-dark { background: var(--obsidian); color: white; }
.flow-icon-light { background: var(--cream-2); color: var(--muted); }
.flow-icon-teal { background: #e6fbf6; color: #0e9d8a; border: 1px solid #b9efe5; }

.flow-meta { flex: 1; min-width: 0; }
.flow-title { font-weight: 600; color: var(--obsidian); font-size: 14px; }
.flow-title-lg { font-family: 'Fraunces', Georgia, serif; font-size: 17px; font-weight: 600; flex: 1; }
.flow-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.flow-collapse {
  background: transparent; border: 0;
  width: 22px; height: 22px;
  color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 4px;
  transition: transform .15s, background .15s;
}
.flow-collapse:hover { background: var(--cream-2); }
.flow-collapse[aria-expanded="false"] { transform: rotate(180deg); }

.kebab {
  background: transparent; border: 0;
  width: 28px; height: 28px;
  border-radius: 6px;
  color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
}
.kebab:hover { background: var(--cream-2); color: var(--ink); }

/* Toggle (iOS-style) */
.toggle { position: relative; display: inline-block; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track {
  display: inline-block;
  width: 36px; height: 20px;
  border-radius: 999px;
  background: #d1d5db;
  position: relative;
  transition: background .15s;
  cursor: pointer;
}
.toggle-track::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 999px;
  background: white;
  transition: transform .18s;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.toggle input:checked + .toggle-track { background: var(--coral); }
.toggle input:checked + .toggle-track::after { transform: translateX(16px); }
.toggle input:focus-visible + .toggle-track { box-shadow: 0 0 0 3px var(--coral-50); }

/* Body region under section header */
.flow-body {
  padding: 0 14px 14px 42px;
  display: flex; flex-direction: column; gap: 8px;
}
.flow-questions { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.flow-question {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  background: var(--white);
}
.flow-question:focus-within { border-color: var(--coral); box-shadow: 0 0 0 3px var(--coral-50); }
.flow-question .card-input { padding: 6px; font-size: 13.5px; }
.flow-add {
  align-self: center;
  width: 28px; height: 28px;
  border-radius: 999px;
  background: var(--white);
  border: 1px dashed var(--line-2);
  color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  margin-top: 4px;
}
.flow-add:hover { border-color: var(--coral); color: var(--coral); border-style: solid; }

.flow-subitem {
  background: var(--cream-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0;
}

.bare-select {
  border: 0; background: transparent;
  font-family: inherit; font-size: 14px; font-weight: 600;
  color: var(--obsidian);
  padding: 0;
  cursor: pointer;
}
.bare-select:focus { outline: none; }

.pill {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.pill-teal { background: #e6fbf6; color: #0e9d8a; border: 1px solid #b9efe5; }

/* Preview pane */
.flow-preview {
  position: sticky;
  top: 130px;
  background: var(--cream-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 480px;
  padding: 24px;
  display: flex; align-items: center; justify-content: center;
}
.flow-preview-empty {
  text-align: center; color: var(--muted);
  font-size: 13px;
}
.flow-preview-empty p { margin: 8px 0 0; }

.preview-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%; max-width: 480px;
  box-shadow: var(--shadow-sm);
}
.preview-card h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 22px; font-weight: 600; margin: 0 0 8px;
  color: var(--obsidian);
}
.preview-card p { color: var(--ink-2); font-size: 14px; margin: 0 0 16px; line-height: 1.55; }
.preview-card .preview-cta {
  display: inline-block;
  background: var(--coral); color: white;
  padding: 10px 18px; border-radius: 8px;
  font-weight: 600; font-size: 13px;
}

/* ---------- Settings tab ---------- */
.settings-wrap { max-width: 720px; }
.setting-block { margin-bottom: 28px; }
.setting-label {
  display: block;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--obsidian);
  margin-bottom: 6px;
}
.setting-help {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 12px;
  line-height: 1.55;
}

.radio-group { display: flex; flex-direction: column; gap: 10px; }
.radio-row {
  display: inline-flex; align-items: center; gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--ink);
}
.radio-row input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.radio-row .radio {
  width: 18px; height: 18px;
  border-radius: 999px;
  border: 1.5px solid var(--line-2);
  background: var(--white);
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  margin-top: 0;
  transition: border-color .15s;
}
.radio-row input:checked + .radio { border-color: var(--coral); }
.radio-row input:checked + .radio::after {
  content: ""; width: 10px; height: 10px; border-radius: 999px; background: var(--coral);
}
.radio-row input:focus-visible + .radio { box-shadow: 0 0 0 3px var(--coral-50); }

.closing-extras { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.setting-extra .label { font-weight: 600; }

/* ---------- Branding tab ---------- */
.upload-row { display: flex; gap: 16px; align-items: center; }
.upload-preview {
  width: 200px; height: 80px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  background: var(--white);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  padding: 8px;
}
.upload-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.upload-placeholder { color: var(--muted); font-size: 12.5px; font-family: 'IBM Plex Mono', monospace; }
.upload-actions { display: flex; gap: 8px; flex-direction: column; }
.upload-btn { position: relative; cursor: pointer; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.swatch {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform .1s, border-color .15s, box-shadow .15s;
}
.swatch:hover { transform: scale(1.05); }
.swatch.is-selected {
  border-color: var(--obsidian);
  box-shadow: 0 0 0 2px var(--white) inset;
}
.color-input-row { display: flex; gap: 8px; align-items: center; max-width: 280px; }
.color-input-row .input { font-family: 'IBM Plex Mono', monospace; text-transform: uppercase; }
.color-input-row input[type="color"] {
  width: 42px; height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--white);
  cursor: pointer;
  padding: 2px;
}

/* Brand preview panel */
.brand-preview-side {
  position: sticky;
  top: 130px;
}
.brand-preview {
  background: var(--cream-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.bp-frame {
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.bp-bar {
  display: flex; gap: 6px;
  padding: 10px 12px;
  background: #f6f3ec;
  border-bottom: 1px solid var(--line);
}
.bp-bar span {
  width: 10px; height: 10px; border-radius: 999px;
  background: #d8d2c2;
}
.bp-bar span:first-child { background: #f97362; }
.bp-bar span:nth-child(2) { background: #f5b840; }
.bp-bar span:nth-child(3) { background: #2dd4bf; }
.bp-body { padding: 28px 22px 22px; text-align: center; }
.bp-logo {
  width: 48px; height: 48px;
  border-radius: 10px;
  margin: 0 auto 16px;
  background: var(--obsidian);
  color: white;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.bp-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.bp-logo-fallback {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700; font-size: 26px;
}
.bp-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 20px; font-weight: 600;
  color: var(--obsidian);
  margin: 0 0 8px;
}
.bp-text {
  color: var(--ink-2);
  font-size: 13.5px;
  margin: 0 0 18px;
  line-height: 1.55;
}
.bp-cta {
  background: var(--coral);
  color: white;
  border: 0;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.bp-progress {
  height: 4px; background: var(--cream-2);
  border-radius: 999px;
  margin: 22px 0 14px;
  overflow: hidden;
}
.bp-progress-bar {
  width: 35%; height: 100%;
  background: var(--coral);
  border-radius: 999px;
}
.bp-footer {
  color: var(--muted);
  font-size: 11px;
}
.bp-footer strong { font-family: 'Fraunces', Georgia, serif; color: var(--ink-2); }

/* ---------- View switching ---------- */
.view-hidden { display: none !important; }

/* ---------- Login view ---------- */
.login-view {
  position: relative;
  min-height: 100vh;
  background: #FBF5EE;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.login-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  z-index: 0;
}
.login-google-overlay {
  position: absolute;
  top: 33%;
  right: 7%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 360px;
}
.login-marketing-overlay {
  position: absolute;
  top: 33%;
  left: calc(7% - 15px);
  z-index: 2;
  max-width: 460px;
}
.login-marketing-overlay .login-marketing-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--obsidian);
  margin: 0 0 18px;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.login-marketing-overlay .login-marketing-body {
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 14px;
}
.login-marketing-overlay .login-marketing-body a {
  color: var(--coral);
  font-weight: 500;
  text-decoration: underline;
}
.login-alert-overlay {
  position: absolute;
  top: 28%;
  right: 6%;
  z-index: 3;
  width: 380px;
}
@media (max-width: 1000px) {
  .login-google-overlay {
    top: auto;
    bottom: 15%;
    right: 50%;
    transform: translateX(50%);
  }
  .login-alert-overlay {
    top: auto;
    bottom: 25%;
    right: 50%;
    transform: translateX(50%);
  }
}

.login-alert {
  background: #fdf2f0;
  color: #c0392b;
  border: 1px solid #f3c8c1;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}
.login-alert.is-success { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }

#googleSignIn { display: flex; justify-content: stretch; }
#googleSignIn > div { width: 100% !important; }
.login-google-fallback {
  width: 100%;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow-md);
}
.login-google-fallback:hover { background: var(--cream-2); border-color: var(--line-2); }
.g-logo { display: inline-flex; }
.login-help {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
}
.login-help strong { color: var(--ink-2); }

/* User dropdown menu in sidebar */
.user-menu {
  bottom: calc(100% + 6px);
  top: auto;
  left: 8px;
  right: 8px;
  min-width: 0;
}

/* ---------- Home / Dashboard ---------- */
#homeView {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  transition: grid-template-columns .25s ease;
}
#homeView.is-sidebar-collapsed {
  grid-template-columns: 64px 1fr;
}
.sidebar {
  background: var(--white);
  border-right: 1px solid var(--line);
  padding: 16px 14px;
  display: flex; flex-direction: column;
  gap: 16px;
  position: sticky; top: 0;
  height: 100vh;
  overflow: hidden;
}
.side-brand {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 6px 12px;
  border-bottom: 1px solid var(--line);
  gap: 8px;
}
.side-brand-name {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 24px;
  font-weight: 400;
  color: var(--obsidian);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
}
.side-toggle {
  flex: 0 0 auto;
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.side-toggle:hover { background: var(--cream-2); color: var(--ink); }

.is-sidebar-collapsed .sidebar { padding: 16px 8px; }
.is-sidebar-collapsed .side-brand { justify-content: space-between; padding: 4px 2px 12px; gap: 4px; }
.is-sidebar-collapsed .side-brand-name { display: none; }
.is-sidebar-collapsed .ws-switcher { padding: 6px 0 12px; }
.is-sidebar-collapsed .ws-btn {
  justify-content: center;
  padding: 6px 4px;
  gap: 4px;
}
.is-sidebar-collapsed .ws-name { display: none; }
.is-sidebar-collapsed .side-link {
  justify-content: center;
  padding: 10px 0;
  gap: 0;
}
.is-sidebar-collapsed .side-link .side-label,
.is-sidebar-collapsed .side-link .ext { display: none; }
.is-sidebar-collapsed .side-user-name { display: none; }
.is-sidebar-collapsed .side-user { justify-content: center; padding: 6px 0; }
.is-sidebar-collapsed .side-user .kebab { display: none; }

.ws-switcher { padding: 6px 4px 12px; border-bottom: 1px solid var(--line); }
.ws-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  background: transparent; border: 0;
  padding: 6px 8px;
  border-radius: 8px;
  font-weight: 600; color: var(--obsidian);
  font-size: 14px;
  cursor: pointer;
}
.ws-btn:hover { background: var(--cream-2); }
.ws-name { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border: 0; background: transparent;
  border-radius: 10px;
  color: var(--ink-2);
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.side-link:hover { background: var(--cream-2); color: var(--ink); }
.side-link.is-active {
  background: #e9f7ef;
  color: #0e9d8a;
}
.side-link.is-active svg { color: #0e9d8a; }
.side-link .ext { color: var(--muted); margin-left: auto; }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; padding-top: 12px; border-top: 1px solid var(--line); }
.side-user {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px;
  margin-top: 8px;
}
.avatar {
  width: 28px; height: 28px;
  border-radius: 999px;
  background: #d4eddb;
  color: #0e9d8a;
  font-weight: 700;
  font-size: 11px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid #b9e3c5;
}
.side-user-name { flex: 1; font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

main.home-main {
  padding: 32px 48px 80px;
  background: var(--cream);
  min-width: 0;
  display: block;
}
.home-hero {
  background: linear-gradient(135deg, #fdece9 0%, #fbf3ef 60%, #fbf8f2 100%);
  border-radius: 16px;
  padding: 28px 32px;
  margin-bottom: 28px;
  position: relative; overflow: hidden;
}
.home-hero::after {
  content: "";
  position: absolute;
  right: -60px; top: -60px;
  width: 240px; height: 240px;
  border: 60px solid rgba(249,115,98,.12);
  border-radius: 999px;
  pointer-events: none;
}
.hero-greeting { display: inline-flex; align-items: center; gap: 10px; }
.hero-mark {
  width: 32px; height: 32px;
  border-radius: 999px;
  background: #fad6cf;
  color: #c0392b;
  display: inline-flex; align-items: center; justify-content: center;
}
.hero-hello {
  font-size: 14px; font-weight: 600; color: var(--ink-2);
}
.hero-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 36px; font-weight: 600;
  color: var(--obsidian);
  margin: 8px 0 0;
  letter-spacing: -0.01em;
}

.home-section { margin-bottom: 36px; }
.home-section-head { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.home-h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  margin: 0;
  color: var(--obsidian);
}
.pill-btn {
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}
.pill-btn:hover { background: var(--cream-2); }

.study-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; max-width: 720px; }
.study-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .1s;
  display: flex; flex-direction: column; gap: 10px;
  min-height: 200px;
}
.study-card:hover { border-color: var(--coral); box-shadow: 0 4px 14px rgba(249,115,98,.12); transform: translateY(-1px); }
.study-card-head { display: flex; align-items: flex-start; justify-content: space-between; }
.study-icon {
  width: 56px; height: 56px;
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  position: relative;
}
.study-icon-cardsort, .tool-icon-cardsort {
  position: relative;
  width: 56px; height: 56px;
}
.study-icon-cardsort span, .tool-icon-cardsort span {
  position: absolute;
  width: 30px; height: 30px;
  border-radius: 6px;
}
.study-icon-cardsort span:nth-child(1), .tool-icon-cardsort span:nth-child(1) {
  background: #f97362; left: 0; top: 8px;
}
.study-icon-cardsort span:nth-child(2), .tool-icon-cardsort span:nth-child(2) {
  background: #fbb09f; left: 14px; top: 0;
}
.study-icon-cardsort span:nth-child(3), .tool-icon-cardsort span:nth-child(3) {
  background: #fdd9d0; left: 22px; top: 14px;
}
.kebab-onlight { color: var(--muted); }

.study-tag {
  display: inline-block;
  background: var(--cream-2);
  color: var(--ink-2);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  align-self: flex-start;
}
.study-name {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--obsidian);
  margin-top: auto;
}
.study-meta {
  display: flex; align-items: center; gap: 6px;
  color: var(--muted);
  font-size: 12.5px;
}
.study-meta-live { color: #1a8a5b; font-weight: 600; }
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block;
}
.status-dot-live {
  background: #1a8a5b;
  box-shadow: 0 0 0 3px rgba(26, 138, 91, 0.18);
}
#launchBtn.is-end-study {
  background: #2a7d5f;
  border-color: #2a7d5f;
  color: white;
}
#launchBtn.is-end-study:hover { background: #236b50; border-color: #236b50; }

.home-tools-intro {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 18px;
  color: var(--obsidian);
  margin: 0 0 14px;
  font-weight: 500;
}
.filter-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.filter-pill {
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: all .15s;
}
.filter-pill:hover { background: var(--cream-2); }
.filter-pill.is-active {
  background: var(--obsidian);
  color: white;
  border-color: var(--obsidian);
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
@media (max-width: 1200px) {
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .tool-grid { grid-template-columns: 1fr; }
}
.tool-tile {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  display: flex; flex-direction: column;
  gap: 10px;
  position: relative;
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.tool-tile.is-cardsort { cursor: pointer; }
.tool-tile.is-cardsort:hover {
  border-color: var(--coral);
  box-shadow: 0 6px 18px rgba(249,115,98,.14);
  transform: translateY(-1px);
}
.tool-icon {
  width: 56px; height: 56px;
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
}
.tool-icon-interviews { background: linear-gradient(135deg, #2dd4bf 0%, #5eead4 100%); color: white; }
.tool-icon-livesite { background: linear-gradient(135deg, #fbb09f 0%, #f97362 100%); color: white; }
.tool-icon-proto { background: linear-gradient(135deg, #d8b4fe 0%, #a855f7 100%); color: white; }
.tool-icon-survey { background: linear-gradient(135deg, #fde68a 0%, #f5b840 100%); color: #92400e; }
.tool-icon-firstclick { background: linear-gradient(135deg, #c4b5fd 0%, #8b5cf6 100%); color: white; }
.tool-icon-tree { background: linear-gradient(135deg, #bbf7d0 0%, #16a34a 100%); color: white; }
.tool-icon-qual { background: linear-gradient(135deg, #bfdbfe 0%, #2563eb 100%); color: white; }

.tool-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--obsidian);
  margin: 4px 0 0;
}
.tool-desc {
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.55;
  margin: 0;
  flex: 1;
}
.tool-tag {
  align-self: flex-start;
  background: var(--cream-2);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
}
.tool-actions {
  display: flex; gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.tool-actions .btn { padding: 7px 12px; font-size: 12.5px; }
.tool-new { background: var(--coral); }
.tile-clickhint {
  position: absolute;
  bottom: 8px; right: 14px;
  font-size: 11px;
  color: var(--coral);
  font-weight: 600;
  opacity: 0;
  transition: opacity .15s;
}
.tool-tile.is-cardsort:hover .tile-clickhint { opacity: 1; }

@media (max-width: 720px) {
  #homeView { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .home-main { padding: 24px 20px 60px; }
  .hero-title { font-size: 28px; }
}

/* ---------- Placeholder for not-yet-built tabs ---------- */
.placeholder {
  border: 1px dashed var(--line-2);
  background: var(--white);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  color: var(--muted);
  font-family: 'Fraunces', Georgia, serif;
  font-size: 16px;
}

/* ---------- Recruit stage ---------- */
.stage-recruit { padding: 32px 48px 80px; background: var(--cream); }
.recruit-wrap { max-width: 1280px; margin: 0 auto; }
.recruit-head { margin-bottom: 24px; }
.recruit-sub { max-width: 900px; }

.recruit-table {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.recruit-row {
  display: grid;
  grid-template-columns: 220px repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}
.recruit-row:first-child { border-top: 0; }
.recruit-cell {
  padding: 18px 20px;
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.55;
  border-left: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.recruit-cell:first-child { border-left: 0; }
.recruit-cell-side {
  background: #f7f3ea;
  font-weight: 600;
  color: var(--obsidian);
  align-items: center;
}
.recruit-row-head { background: var(--cream-2); }
.recruit-row-head .recruit-cell { padding: 22px 20px; }
.recruit-cell-plan {
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  text-align: center;
}
.recruit-plan-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--obsidian);
  margin: 0;
  letter-spacing: -0.005em;
}
.recruit-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background: var(--white);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}
.recruit-cta:hover { background: var(--cream-2); }
.recruit-cta-disabled {
  background: #eef0f2;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  cursor: default;
}
.recruit-cta-disabled a { color: var(--coral); text-decoration: underline; }

.recruit-x {
  color: #c0392b;
  font-weight: 700;
  flex-shrink: 0;
  font-size: 16px;
  line-height: 1.2;
}
.recruit-check {
  color: #0e9d8a;
  font-weight: 700;
  flex-shrink: 0;
  font-size: 16px;
  line-height: 1.2;
}

@media (max-width: 1000px) {
  .recruit-row { grid-template-columns: 1fr; }
  .recruit-cell { border-left: 0; border-top: 1px solid var(--line); }
  .recruit-cell:first-child { border-top: 0; }
}

.recruit-link-card {
  margin-top: 24px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px 28px;
}
.recruit-link-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--obsidian);
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.recruit-link-note {
  margin: 0 0 18px;
  font-style: italic;
  color: var(--muted);
  font-size: 13.5px;
}
.recruit-link-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.recruit-link-field {
  flex: 1 1 380px;
  display: flex; align-items: center; gap: 10px;
  background: var(--cream-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--muted);
}
.recruit-link-field input {
  flex: 1;
  border: 0;
  background: transparent;
  font-size: 13.5px;
  color: var(--ink-2);
  outline: none;
}
.recruit-copy { padding: 10px 14px; }
.recruit-link-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.recruit-link-actions .btn {
  border: 1px solid var(--line-2);
  background: var(--white);
  padding: 9px 14px;
  font-size: 13.5px;
}
.recruit-link-actions .btn:hover { background: var(--cream-2); }

.recruit-sync-card code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  background: var(--cream-2);
  padding: 1px 5px;
  border-radius: 4px;
  font-style: normal;
}
.sync-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.sync-url-field { flex: 1 1 420px; }
.sync-row .btn { padding: 10px 14px; border: 1px solid var(--line-2); background: var(--white); }
.sync-row .btn:hover { background: var(--cream-2); }
.sync-status {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--ink-2);
}
.sync-status-ok { color: #0f7a52; }
.sync-status-err { color: #b42318; }
.sync-status-pending { color: var(--muted); }

.sync-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  background: #2a3242;
  color: #fff;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  max-width: 520px;
  box-shadow: 0 10px 32px rgba(0,0,0,.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 2000;
}
.sync-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.invite-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.invite-refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--white);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  color: var(--ink-2);
  font-size: 13px;
  padding: 6px 10px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.invite-refresh-btn:hover { background: var(--cream-2); color: var(--obsidian); }
.invite-refresh-btn svg { transition: transform .6s linear; }
.invite-refresh-btn.is-loading svg {
  animation: invite-refresh-spin 1s linear infinite;
}
@keyframes invite-refresh-spin {
  to { transform: rotate(360deg); }
}

.recruit-invite-card { margin-top: 18px; }
.invite-add-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap;
}
.invite-name-field { flex: 1; min-width: 200px; }
.invite-email-field { flex: 1.2; min-width: 240px; }
.invite-list { display: flex; flex-direction: column; gap: 8px; }
.invite-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.invite-row.is-disabled { opacity: 0.6; }
.invite-row.is-completed { background: #f4faf6; border-color: #c9e7d6; }
.invite-email {
  font-size: 14px; font-weight: 500; color: var(--ink);
  min-width: 180px;
}
.invite-link {
  flex: 1;
  font-size: 13px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: var(--cream-2);
  padding: 6px 10px;
  border-radius: 6px;
  user-select: all;
}
.invite-status {
  font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px;
  white-space: nowrap;
}
.invite-status-draft { background: #fff4e0; color: #a16207; }
.invite-status-live { background: #e1f4eb; color: #1a8a5b; }
.invite-status-ended { background: #fde8e8; color: #b91c1c; }
.invite-status-completed { background: #1a8a5b; color: white; }
.invite-actions { display: flex; gap: 6px; }
.invite-icon-btn {
  background: var(--white);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  padding: 6px 8px;
  cursor: pointer;
  color: var(--ink);
  display: flex; align-items: center; justify-content: center;
}
.invite-icon-btn:hover { background: var(--cream-2); }
.invite-empty {
  font-size: 13px; color: var(--muted); font-style: italic;
  padding: 8px 0;
}

/* Invite landing — invalid / inactive participant link */
.invite-blocked {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; padding: 40px;
  text-align: center;
  background: var(--cream);
}
.invite-blocked h1 { font-family: 'Fraunces', Georgia, serif; font-size: 32px; color: var(--ink); margin: 0 0 12px; }
.invite-blocked p { color: var(--muted); font-size: 15px; max-width: 480px; }

/* Participant badge — sits inline in the sort toolbar */
.participant-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}
.preview-sort-toolbar-spacer { flex: 1; }
.participant-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #f97362 0%, #fbb09f 100%);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
  text-transform: uppercase;
  flex-shrink: 0;
}
.participant-info { display: flex; flex-direction: column; line-height: 1.25; }
.participant-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.participant-email { font-size: 12px; color: var(--muted); }

/* ---------- Study preview view ---------- */
.preview-view {
  min-height: 100vh;
  background: #f3f4f6;
  display: flex;
  flex-direction: column;
}
/* On the standalone participant page the "this is a preview" banner is never
   appropriate — participants are taking a real study, not previewing one. */
body[data-mode="participant"] .preview-banner { display: none !important; }
.preview-banner {
  background: #e6f4f3;
  color: #0e9d8a;
  text-align: center;
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 500;
  position: relative;
}
.preview-close {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  color: #0e9d8a;
  width: 32px; height: 32px;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.preview-close:hover { background: rgba(14,157,138,.1); }
.preview-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 80px 24px 60px;
  gap: 28px;
}
.preview-card {
  width: 100%;
  max-width: 880px;
  background: var(--white);
  border-radius: 14px;
  padding: 44px 56px 48px;
  box-shadow: 0 1px 2px rgba(11,18,32,.04);
}
.preview-title {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 32px;
  font-weight: 600;
  color: #2a3242;
  margin: 0 0 22px;
  letter-spacing: -0.01em;
}
.preview-card p {
  font-size: 15px;
  color: #2a3242;
  line-height: 1.6;
  margin: 0 0 16px;
}
.preview-card p:last-child { margin-bottom: 0; }
.preview-cta {
  align-self: flex-start;
  margin-left: max(0px, calc((100% - 880px) / 2));
  background: #0f7a52;
  color: var(--white);
  border: 0;
  border-radius: 999px;
  padding: 14px 32px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(11,18,32,.06);
}
.preview-cta:hover { background: #0d6646; }

.preview-step { display: flex; flex-direction: column; align-items: stretch; gap: 28px; width: 100%; max-width: 880px; }
.preview-step[hidden] { display: none; }
.preview-step .preview-cta { align-self: flex-start; margin-left: 0; }

.preview-back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: 0;
  font-size: 15px;
  font-weight: 500;
  color: #2a3242;
  cursor: pointer;
  padding: 6px 4px;
  margin-bottom: -8px;
}
.preview-back:hover { color: #0b1220; }

.preview-subhead {
  font-size: 15px;
  color: #2a3242;
  margin: -10px 0 26px;
}
.preview-terms {
  border: 1.5px solid #2a3242;
  border-radius: 10px;
  padding: 28px 32px;
  margin-bottom: 26px;
  font-size: 15px;
  color: #2a3242;
  line-height: 1.6;
}
.preview-terms p { margin: 0 0 14px; }
.preview-terms ul { margin: 0 0 18px; padding-left: 24px; }
.preview-terms ul:last-child { margin-bottom: 0; }
.preview-terms li { margin-bottom: 6px; }
.preview-h2 {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #0b1220;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.preview-privacy { font-size: 14.5px; color: #2a3242; margin: 0 0 22px; }
.preview-privacy a { color: #1a73d6; text-decoration: underline; }

.preview-radio-group { display: flex; flex-direction: column; gap: 14px; }
.preview-radio {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-size: 16px;
  color: #2a3242;
  cursor: pointer;
}
.preview-radio input { position: absolute; opacity: 0; pointer-events: none; }
.preview-radio-dot {
  width: 22px; height: 22px;
  border-radius: 999px;
  border: 2px solid #c7c0ae;
  background: var(--white);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.preview-radio input:checked + .preview-radio-dot {
  border-color: #0b1220;
  border-width: 3px;
}
.preview-radio input:checked + .preview-radio-dot::after {
  content: "";
  width: 10px; height: 10px;
  border-radius: 999px;
  background: #0b1220;
}

/* ---------- Sort step (preview) ---------- */
.preview-sort-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 10px 24px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.preview-sort-toolbar[hidden] { display: none; }
.preview-sort-bar {
  height: 4px;
  background: #1a8a5b;
}
.preview-sort-bar[hidden] { display: none; }
.preview-instr-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--white);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
}
.preview-instr-btn:hover { background: var(--cream-2); }
.preview-finish-btn {
  background: #0f7a52;
  color: var(--white);
  border: 0;
  border-radius: 6px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.preview-finish-btn:hover { background: #0d6646; }

.preview-step-sort { padding: 0 !important; max-width: none; gap: 0; }
.preview-stage:has(.preview-step-sort:not([hidden])) { padding: 0; }

.psort {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: calc(100vh - 110px);
  width: 100vw;
}
.psort-tray {
  background: #b6c0c0;
  padding: 24px 28px 100px;
  position: relative;
  display: flex;
  flex-direction: column;
}
.psort-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.psort-card {
  background: var(--white);
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  padding: 14px 18px;
  font-size: 14px;
  color: var(--ink);
  cursor: grab;
  user-select: none;
}
.psort-card:active { cursor: grabbing; }
.psort-card.is-dragging { opacity: 0.4; }

.psort-progress {
  position: absolute;
  bottom: 24px;
  left: 28px;
  right: 28px;
}
.psort-progress-text {
  font-size: 13px;
  color: var(--ink);
  text-align: center;
  margin-bottom: 8px;
}
.psort-progress-bar {
  height: 6px;
  background: rgba(255,255,255,.6);
  border-radius: 999px;
  overflow: hidden;
}
.psort-progress-fill {
  height: 100%;
  background: #2563eb;
  width: 0%;
  transition: width .2s;
}

.psort-board {
  background: #f1f3f4;
  padding: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: flex-start;
  align-content: flex-start;
}
.psort-cat {
  width: 260px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.psort-cat.is-drop-target {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37,99,235,.15);
}
.psort-cat-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.psort-cat-caret {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  padding: 2px;
  margin: 0;
  color: inherit;
  cursor: pointer;
  transition: transform .2s;
}
.psort-cat.is-collapsed .psort-cat-caret { transform: rotate(-90deg); }
.psort-cat-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  flex: 1;
  min-width: 0;
  word-break: break-word;
}
.psort-cat-name.is-editable {
  cursor: text;
  border-radius: 4px;
  padding: 2px 6px;
  margin: -2px -6px;
}
.psort-cat-name.is-editable:hover { background: rgba(37,99,235,.06); }
.psort-cat-name.is-editable[contenteditable="true"] {
  background: var(--white);
  outline: 2px solid #2563eb;
  outline-offset: 0;
}
.psort-cat-name.is-editable[data-empty="true"]::before {
  content: "Click to name this group";
  color: var(--muted);
  font-style: italic;
  font-weight: 400;
}
.psort-cat-delete {
  background: transparent;
  border: 0;
  padding: 2px;
  margin: 0;
  color: var(--muted);
  cursor: pointer;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .15s, color .15s, background .15s;
}
.psort-cat:hover .psort-cat-delete,
.psort-cat .psort-cat-delete:focus-visible { opacity: 1; }
.psort-cat-delete:hover { color: #b42318; background: rgba(180,35,24,.08); }

.psort-cat-new {
  background: transparent;
  border: 1.5px dashed var(--line-2, #c8ccd2);
  padding: 0;
}
.psort-cat-new.is-drop-target {
  border-color: #2563eb;
  background: rgba(37,99,235,.05);
}
.psort-cat-new-btn {
  width: 100%;
  height: 100%;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: 0;
  padding: 18px 14px;
  color: var(--ink-2);
  cursor: pointer;
  font-family: inherit;
}
.psort-cat-new-btn:hover { color: #2563eb; }
.psort-cat-new-icon { display: inline-flex; }
.psort-cat-new-label { font-size: 14px; font-weight: 600; }
.psort-cat-new-hint { font-size: 12.5px; color: var(--muted); }
.psort-cat-slot {
  background: #ebeded;
  border-radius: 6px;
  min-height: 64px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.psort-cat.is-collapsed .psort-cat-slot { display: none; }
.psort-cat.is-collapsed .psort-cat-count { display: none; }
.psort-cat-count {
  font-size: 13.5px;
  color: var(--ink-2);
  padding: 4px 2px 0;
}

/* Instructions modal */
.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.preview-modal[hidden] { display: none; }
.preview-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11,18,32,.5);
}
.preview-modal-card {
  position: relative;
  background: var(--white);
  border-radius: 6px;
  padding: 36px 44px 28px;
  max-width: 720px;
  width: 100%;
  box-shadow: 0 24px 80px rgba(0,0,0,.18);
}
.preview-modal-title {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 22px;
  font-weight: 600;
  color: #0b1220;
  margin: 0 0 24px;
  text-align: center;
}
.preview-modal-card p { font-size: 15px; color: #2a3242; line-height: 1.7; margin: 0 0 18px; }
.preview-modal-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
.preview-modal-ok {
  background: #0f7a52;
  color: var(--white);
  border: 0;
  border-radius: 6px;
  padding: 10px 28px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.preview-modal-ok:hover { background: #0d6646; }

.preview-modal-card-finish p {
  font-size: 15px;
  color: #2a3242;
  margin: 0 0 10px;
}
.preview-modal-card-finish p[hidden] { display: none; }

.psort-card.is-drop-before { box-shadow: 0 -3px 0 0 #2563eb inset, 0 0 0 0 transparent; position: relative; }
.psort-card.is-drop-before::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  top: -5px;
  height: 3px;
  background: #2563eb;
  border-radius: 2px;
}
.psort-card.is-drop-after { position: relative; }
.psort-card.is-drop-after::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: -5px;
  height: 3px;
  background: #2563eb;
  border-radius: 2px;
}
.psort-card.is-drop-before { box-shadow: none; }

.preview-step-thanks { max-width: 1100px; padding-top: 60px; }
.preview-thanks { padding: 0 24px; }
.preview-thanks-title {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 32px;
  font-weight: 600;
  color: #2a3242;
  margin: 0 0 18px;
  letter-spacing: -0.01em;
}
.preview-thanks p {
  font-size: 15px;
  color: #2a3242;
  line-height: 1.7;
  margin: 0 0 8px;
  max-width: 900px;
}
.thanks-download-btn {
  margin-top: 24px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ---------- Launch confirmation modal ---------- */
.preview-modal-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 32px; height: 32px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 1;
}
.preview-modal-close:hover { background: var(--cream-2); }
.launch-modal-card {
  max-width: 560px;
  padding: 36px 40px 32px;
  text-align: left;
}
.launch-icon {
  display: flex;
  justify-content: center;
  color: #2a3242;
  margin-bottom: 18px;
}
.launch-title {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 22px;
  font-weight: 600;
  color: #0b1220;
  margin: 0 0 22px;
  text-align: center;
}
.launch-warn {
  background: #f5f7f9;
  border-left: 4px solid #e8a23a;
  border-radius: 4px;
  padding: 16px 20px;
  font-size: 14.5px;
  color: #2a3242;
  line-height: 1.55;
  margin-bottom: 22px;
}
.launch-body {
  font-size: 14.5px;
  color: #2a3242;
  line-height: 1.6;
  margin: 0 0 14px;
}
.launch-body a { color: #1a73d6; text-decoration: underline; }
.launch-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}
.launch-cancel {
  background: var(--white);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
.launch-cancel:hover { background: var(--cream-2); }
.launch-confirm {
  background: #0f7a52;
  color: var(--white);
  border: 0;
  border-radius: 6px;
  padding: 10px 26px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.launch-confirm:hover { background: #0d6646; }

/* ---------- Results stage ---------- */
.results-subnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  padding: 0 32px;
  position: sticky;
  top: 61px;
  z-index: 9;
}
.results-tabs { display: flex; gap: 4px; }
.results-tab {
  background: transparent;
  border: 0;
  padding: 18px 16px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
}
.results-tab:hover { color: var(--ink); }
.results-tab.is-active { color: #0f7a52; border-bottom-color: #0f7a52; font-weight: 600; }

.results-page { padding: 28px 32px 80px; max-width: 1400px; margin: 0 auto; background: var(--cream); }
.results-tab-panel[hidden] { display: none; }

.results-section-title {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--obsidian);
  margin: 0 0 16px;
}
.results-section-title:not(:first-child) { margin-top: 36px; }

.results-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.results-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1100px) { .results-grid, .results-grid-2 { grid-template-columns: 1fr; } }

.results-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  min-height: 380px;
  overflow: hidden;
}
.results-card-head {
  padding: 18px 22px;
  font-size: 15px;
  font-weight: 600;
  color: var(--obsidian);
  border-bottom: 1px solid var(--line);
}
.results-card-body {
  padding: 26px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}
.results-card-body-center { align-items: center; text-align: center; }
.results-card-foot { font-size: 13.5px; color: var(--ink-2); margin: 0; line-height: 1.55; }
.results-card-lede { font-size: 14px; color: var(--ink-2); margin: 0 0 12px; line-height: 1.55; }

/* Completion ring */
.ring-stat { position: relative; width: 180px; height: 180px; margin: 8px 0 12px; }
.ring-text {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.ring-num { font-family: 'Inter', sans-serif; font-size: 44px; font-weight: 600; color: var(--obsidian); line-height: 1; }
.ring-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* Time taken */
.time-stat { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 18px 0 4px; }
.time-icon { display: inline-flex; }
.time-value { font-family: 'Inter', sans-serif; font-size: 44px; font-weight: 600; color: var(--obsidian); letter-spacing: -0.01em; line-height: 1; }
.time-unit { font-size: 18px; font-weight: 500; color: var(--ink-2); margin-left: 2px; }
.time-big { display: inline-block; }

/* Location */
.loc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0 8px;
}
.loc-name {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 22px;
  font-weight: 600;
  color: var(--obsidian);
}
.loc-pct { font-family: 'Inter', sans-serif; font-weight: 600; color: var(--obsidian); }
.loc-pct-num { font-size: 36px; }
.loc-pct-unit { font-size: 14px; margin-left: 2px; color: var(--ink-2); }

/* Bar chart */
.results-bars {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  height: 220px;
  padding: 8px 0 0;
}
.results-bar-yax {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  height: 100%;
  padding-bottom: 1px;
}
.results-bar-area {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  border-bottom: 1px solid var(--line);
  border-left: 1px solid var(--line);
  padding: 0 12px;
  position: relative;
}
.results-bar {
  width: 32px;
  background: #c7c0ae;
  border-radius: 2px 2px 0 0;
  height: var(--h, 0%);
  position: relative;
}
.bar-cap {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}
.results-bar-xlabel {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0 0;
}

/* Standardization promo */
.results-card-promo-body { position: relative; }
.promo-title {
  font-family: 'Inter', sans-serif;
  font-size: 17px;
  font-weight: 600;
  color: #2563eb;
  margin: 0 0 10px;
}
.results-card-promo-body p { font-size: 14px; color: var(--ink-2); margin: 0; max-width: 60%; line-height: 1.5; }
.promo-illus {
  position: absolute;
  right: 22px;
  bottom: 18px;
}

/* End study button (used on Results stage) */
.btn-endstudy { background: #0f7a52; color: var(--white); border: 0; }
.btn-endstudy:hover { background: #0d6646; }

/* ---------- Results > Participants tab ---------- */
.rp-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.rp-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}
.rp-filter-btn:hover { background: var(--cream-2); }
.rp-count-pill {
  background: #ebeaea;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13.5px;
  color: var(--ink-2);
  font-weight: 500;
}

.rp-subtabs-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.rp-subtabs { display: flex; gap: 0; }
.rp-subtab {
  background: transparent;
  border: 0;
  padding: 12px 0;
  margin-right: 28px;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
}
.rp-subtab:hover { color: var(--ink); }
.rp-subtab.is-active { color: #0f7a52; border-bottom-color: #0f7a52; font-weight: 600; }
.rp-expand {
  background: transparent;
  border: 0;
  color: var(--ink-2);
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
}
.rp-expand:hover { background: var(--cream-2); }

.rp-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.rp-card[hidden] { display: none; }
.rp-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px 16px;
}
.rp-card-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--obsidian);
}
.rp-help {
  width: 18px; height: 18px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  display: inline-flex;
  align-items: center; justify-content: center;
  font-size: 11px;
  color: var(--muted);
  cursor: help;
}
.rp-show { display: inline-flex; align-items: center; gap: 12px; }
.rp-show-label { font-size: 13.5px; color: var(--ink-2); }
.rp-show-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}
.rp-show-btn:hover { background: var(--cream-2); }

.rp-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 24px 14px;
}
.rp-selected {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--ink-2);
}
.rp-selected-num {
  background: #ebeaea;
  border-radius: 999px;
  width: 28px; height: 28px;
  display: inline-flex;
  align-items: center; justify-content: center;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
}
.rp-exclude {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}
.rp-exclude[disabled] { cursor: not-allowed; opacity: 0.6; }

.rp-table-wrap { overflow-x: auto; }
.rp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.rp-table thead th {
  background: var(--white);
  text-align: left;
  padding: 12px 14px;
  font-weight: 500;
  font-size: 13.5px;
  color: var(--ink);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.rp-table tbody td {
  padding: 18px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  vertical-align: middle;
}
.rp-table th:first-child, .rp-table td:first-child { padding-left: 24px; }
.rp-table th:last-child, .rp-table td:last-child { padding-right: 24px; }
.rp-col-check { width: 36px; }
.rp-sort { color: #c7c0ae; margin-left: 4px; font-size: 11px; }
.rp-pname { color: #1a73d6; text-decoration: none; font-weight: 500; }
.rp-pname:hover { text-decoration: underline; }
.rp-status {
  display: inline-block;
  background: #d4eddb;
  color: #0e9d8a;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
}
.rp-row-btn {
  background: var(--white);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}
.rp-row-btn:hover { background: var(--cream-2); }
.rp-row-action { text-align: right; }
.rp-empty {
  text-align: center;
  color: var(--muted);
  padding: 32px 24px;
  font-size: 14px;
  font-style: italic;
}

.rp-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--ink-2);
  flex-wrap: wrap;
  gap: 12px;
}
.rp-pagesize { display: inline-flex; align-items: center; gap: 8px; }
.rp-pagesize-select {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.rp-pagesize-select select {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  padding: 6px 28px 6px 12px;
  font-size: 13px;
  cursor: pointer;
}
.rp-pagesize-select svg {
  position: absolute;
  right: 8px;
  pointer-events: none;
  color: var(--muted);
}
.rp-pager { display: inline-flex; align-items: center; gap: 10px; }
.rp-pager-btn {
  width: 32px; height: 32px;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 6px;
  display: inline-flex;
  align-items: center; justify-content: center;
  color: var(--ink-2);
  cursor: pointer;
}
.rp-pager-btn:hover:not([disabled]) { background: var(--cream-2); }
.rp-pager-btn[disabled] { opacity: 0.4; cursor: not-allowed; }

/* ---------- Results > Analysis tab ---------- */
.ra-panel[hidden] { display: none; }
.ra-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.ra-note-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}
.ra-note-btn:hover { background: var(--cream-2); }

.ra-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 22px;
  margin-bottom: 14px;
}
.ra-toggle { display: inline-flex; align-items: center; gap: 12px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.ra-switch { position: relative; display: inline-block; width: 36px; height: 20px; }
.ra-switch input { opacity: 0; position: absolute; pointer-events: none; }
.ra-switch-track {
  position: absolute; inset: 0;
  background: #c7c0ae;
  border-radius: 999px;
  transition: background .15s;
}
.ra-switch-track::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: var(--white);
  border-radius: 999px;
  transition: transform .15s;
}
.ra-switch input:checked + .ra-switch-track { background: #0f7a52; }
.ra-switch input:checked + .ra-switch-track::after { transform: translateX(16px); }

.ra-search {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  width: 280px;
  color: var(--muted);
}
.ra-search input { border: 0; outline: none; background: transparent; flex: 1; font-size: 13.5px; color: var(--ink); }

.ra-table-wrap { background: transparent; }
.ra-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.ra-table thead th {
  text-align: left;
  padding: 12px 18px;
  font-weight: 500;
  font-size: 14px;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.ra-table tbody td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  vertical-align: middle;
}
.ra-card-pill {
  display: inline-block;
  background: #ebeaea;
  border-radius: 4px;
  padding: 6px 14px;
  font-size: 14px;
  color: var(--ink);
}
.ra-cat-cell { display: inline-flex; align-items: center; gap: 8px; }
.ra-cat-cell svg { color: var(--muted); }

/* Results status bar */
.results-status-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 24px;
  background: var(--cream-2);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-2);
}
.results-status-bar:empty { display: none; }
.results-status-left { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.results-status-pill {
  display: inline-block;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--white);
  border: 1px solid var(--line);
  color: var(--ink-2);
}
.results-status-ok { background: #e7f5ee; color: #0f7a52; border-color: #b8e2cd; }
.results-status-warn { background: #fff4e5; color: #92591b; border-color: #f2d8a1; }
.results-status-neutral { background: #eef1f5; color: var(--ink-2); }
.results-status-loading { background: #e5edf6; color: #2353b2; border-color: #c5d6eb; }
.results-status-refresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--white);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  color: var(--ink-2);
  font-size: 13px;
  padding: 6px 10px;
  cursor: pointer;
}
.results-status-refresh:hover { background: var(--cream-2); color: var(--obsidian); }
.results-status-err {
  width: 100%;
  color: #b42318;
  font-size: 12.5px;
  margin-top: 4px;
}

.ra-content { padding: 8px 24px 24px; }
.ra-empty {
  display: block;
  background: var(--cream-2);
  border: 1px dashed var(--line-2);
  border-radius: 8px;
  color: var(--ink-2);
  padding: 28px 24px;
  text-align: center;
  font-size: 14px;
  line-height: 1.6;
  margin: 12px 0;
}
.ra-lede {
  font-size: 13.5px;
  color: var(--ink-2);
  margin: 4px 0 16px;
}
.ra-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ra-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--cream-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.ra-chip em { color: var(--muted); font-style: normal; font-size: 11.5px; }

/* Similarity matrix */
.ra-matrix-wrap { overflow: auto; max-height: 70vh; border: 1px solid var(--line); border-radius: 8px; }
.ra-matrix { border-collapse: collapse; font-size: 12px; }
.ra-matrix th, .ra-matrix td { width: 38px; height: 32px; text-align: center; vertical-align: middle; }
.ra-cell-h {
  background: var(--white);
  color: var(--ink-2);
  font-weight: 500;
  padding: 4px 8px;
  position: sticky;
  white-space: nowrap;
}
.ra-matrix thead .ra-cell-h { top: 0; z-index: 2; border-bottom: 1px solid var(--line); }
.ra-matrix tbody .ra-cell-h { left: 0; z-index: 1; border-right: 1px solid var(--line); text-align: right; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.ra-matrix thead th:first-child { left: 0; z-index: 3; }
.ra-cell-rot { height: 110px; vertical-align: bottom; }
.ra-cell-rot span {
  display: inline-block;
  transform: rotate(-60deg);
  transform-origin: left bottom;
  white-space: nowrap;
  font-weight: 500;
  font-size: 12px;
  color: var(--ink);
  padding-left: 6px;
}
.ra-cell { font-variant-numeric: tabular-nums; font-weight: 600; }

/* PCA / 3D scatter */
.ra-scatter-wrap { background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.ra-scatter { width: 100%; height: auto; max-width: 720px; display: block; margin: 0 auto; }
.scatter-bg { fill: #fafaf7; }
.scatter-axis { stroke: var(--line); stroke-width: 1; }
.scatter-pt circle { fill: #1a8a5b; stroke: var(--white); stroke-width: 1.5; }
.scatter-pt text { font-size: 11px; fill: var(--ink); font-family: 'Inter', sans-serif; }

/* Dendrogram */
.ra-dendro-wrap { background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.ra-dendro { width: 100%; height: auto; display: block; }
.dendro-lines line { stroke: #1a8a5b; stroke-width: 1.5; fill: none; }
.dendro-label { font-size: 12px; fill: var(--ink); font-family: 'Inter', sans-serif; }

/* Notes */
.ra-notes {
  width: 100%;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  resize: vertical;
  min-height: 200px;
}
.ra-notes:focus { outline: none; border-color: #1a8a5b; }

/* ---------- Results > Downloads tab ---------- */
.dl-title {
  font-family: 'Inter', sans-serif;
  font-size: 26px;
  font-weight: 600;
  color: var(--obsidian);
  margin: 0 0 16px;
}
.dl-legend { display: flex; flex-direction: column; gap: 6px; margin-bottom: 22px; }
.dl-legend-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--ink-2);
}
.dl-legend-row strong { color: var(--obsidian); font-weight: 600; }

.dl-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
@media (max-width: 1100px) { .dl-grid { grid-template-columns: 1fr; } }

.dl-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.dl-card-head { display: flex; align-items: center; gap: 12px; }
.dl-card-title {
  font-family: 'Inter', sans-serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--obsidian);
  margin: 0;
  flex: 1;
}
.dl-fmt {
  background: #ebeaea;
  border-radius: 4px;
  padding: 3px 10px;
  font-size: 13px;
  color: var(--ink-2);
  white-space: nowrap;
}
.dl-card-desc { font-size: 14px; color: var(--ink-2); line-height: 1.55; margin: 0; }
.dl-card-desc a { color: #1a73d6; text-decoration: underline; }
.dl-card-actions { display: flex; gap: 10px; margin-top: auto; padding-top: 4px; }
.dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--white);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}
.dl-btn:hover { background: var(--cream-2); }
.dl-btn.is-active { background: #ebeaea; border-color: #c7c0ae; }

/* ── Sharing tab ── */
.sharing-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.sharing-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}
.sharing-info-btn {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
}
.sharing-info-btn:hover { color: var(--ink); }

.sharing-warning {
  color: #999;
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 32px;
  max-width: 640px;
  font-style: italic;
}
.sharing-link {
  color: var(--accent);
  text-decoration: underline;
}

.sharing-columns {
  display: flex;
  gap: 80px;
  margin-bottom: 36px;
}
.sharing-col-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 20px;
}
.sharing-optional {
  font-weight: 400;
  font-style: italic;
  color: #999;
}

.sharing-checkbox {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  margin-bottom: 16px;
}
.sharing-checkbox input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.sharing-check-box {
  width: 22px;
  height: 22px;
  border: 2px solid #ccc;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--white);
  transition: background 0.15s, border-color 0.15s;
}
.sharing-checkbox input:checked + .sharing-check-box {
  background: #2a7d5f;
  border-color: #2a7d5f;
}
.sharing-checkbox input:checked + .sharing-check-box::after {
  content: '';
  display: block;
  width: 6px;
  height: 11px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}
.sharing-check-label {
  font-size: 15px;
  color: var(--ink);
}

.sharing-create-btn {
  background: #2a7d5f;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.sharing-create-btn:hover {
  background: #236b50;
}
