:root {
  --bg: #f5f2eb;
  --card: #fffdfa;
  --stroke: #ddd6ca;
  --text: #2d2924;
  --muted: #70675d;
  --gold: #b7832f;
  --gold-deep: #976d26;
  --shadow: 0 1px 2px rgba(45, 41, 36, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "SF Pro Display", "SF Pro Icons", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

button,
input {
  font: inherit;
}

.page-shell {
  width: min(1400px, calc(100% - 48px));
  margin: 0 auto;
}

.topbar,
.card {
  background: var(--card);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
}

.topbar {
  min-height: 64px;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  border-radius: 0 0 12px 12px;
  border-top: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* ── Inbox ───────────────────────────────────────────────────────────────── */

.inbox-wrap {
  position: relative;
}

.inbox-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--stroke);
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.12s, color 0.12s;
}

.inbox-btn:hover {
  background: #f2eee7;
  color: var(--text);
}

.inbox-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #d94f3d;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
}

.inbox-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.14);
  z-index: 400;
  overflow: hidden;
}

.inbox-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--stroke);
  font-weight: 600;
  font-size: 0.875rem;
}

.inbox-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inbox-compose-btn {
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--gold-deep, #8a6a1a);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 3px 10px;
  cursor: pointer;
}

.inbox-compose-btn:hover {
  opacity: 0.88;
}

.inbox-dm-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: #e8d9f7;
  color: #6b3fa0;
  flex-shrink: 0;
  letter-spacing: 0.03em;
}

/* Received DMs stay purple (default above); sent DMs are green so you can
   tell at a glance which way a conversation is flowing. */
.inbox-dm-badge--received {
  background: #e8d9f7;
  color: #6b3fa0;
}

.inbox-dm-badge--sent {
  background: #d4f0e0;
  color: #1e7a48;
}

.inbox-reply-btn {
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 8px;
  background: transparent;
  border: 1px solid var(--stroke);
  border-radius: 6px;
  padding: 4px 12px;
  cursor: pointer;
  color: var(--text);
}

.inbox-reply-btn:hover {
  background: #f2eee7;
}

/* ── Compose popup ────────────────────────────────────────────────────────── */

.compose-overlay {
  position: fixed;
  inset: 0;
  z-index: 450;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 26, 20, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.compose-overlay.hidden {
  display: none;
}

.compose-popup {
  background: var(--card);
  border-radius: 14px;
  padding: 24px;
  width: min(480px, calc(100vw - 40px));
  box-shadow: 0 8px 36px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.compose-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.compose-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
}

.compose-select,
.compose-input {
  font-family: inherit;
  font-size: 0.875rem;
  padding: 7px 10px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: #fdfcfa;
  color: var(--text);
}

.compose-select:focus,
.compose-input:focus {
  outline: 2px solid rgba(183,131,47,0.2);
  border-color: transparent;
}

.compose-status {
  font-size: 0.78rem;
  color: #c0392b;
  margin: 0;
  flex: 1;
}

.inbox-mark-all-btn {
  font-family: inherit;
  font-size: 0.75rem;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.inbox-mark-all-btn:hover {
  color: var(--text);
}

.inbox-list {
  max-height: 340px;
  overflow-y: auto;
}

.inbox-empty {
  padding: 20px 16px;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
}

.inbox-msg {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--stroke);
  transition: background 0.1s;
}

.inbox-msg:last-child {
  border-bottom: none;
}

.inbox-msg:hover {
  background: #faf8f4;
}

.inbox-msg--unread {
  background: #fdf9f2;
}

.inbox-msg-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.inbox-unread-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d94f3d;
  flex-shrink: 0;
}

.inbox-msg-subject {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inbox-msg--unread .inbox-msg-subject {
  font-weight: 700;
}

.inbox-msg-date {
  font-size: 0.75rem;
  color: var(--muted);
  flex-shrink: 0;
}

.inbox-msg-from {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}

.inbox-msg-body {
  font-size: 0.83rem;
  color: var(--text);
  margin-top: 8px;
  line-height: 1.55;
  white-space: pre-wrap;
  border-top: 1px solid var(--stroke);
  padding-top: 8px;
}

/* ── Full sidebar layout ─────────────────────────────────────────────────── */

.dashboard-layout { display: flex; min-height: 100vh; }
.dash-main { flex: 1; min-width: 0; overflow-x: hidden; }

.founder-side-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.dash-sidebar { display: none; }

.dash-sidebar-brand { padding: 20px 18px 14px; border-bottom: 1px solid var(--stroke); }

.dash-sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 12px 8px; flex: 1; }

.dash-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 9px; text-decoration: none;
  color: var(--muted); font-size: .875rem; font-weight: 500;
  transition: background .12s, color .12s;
}
.dash-nav-item:hover,
.dash-nav-item.is-active { background: #f2eee7; color: var(--text); }
.dash-nav-icon { font-size: 1rem; flex-shrink: 0; }

.dash-sidebar-stats {
  padding: 12px 10px; border-top: 1px solid var(--stroke);
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px;
}
.dash-sidebar-stat {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 6px 4px; border-radius: 8px; background: #faf8f4;
}
.dash-sidebar-stat span:first-child { font-size: .95rem; font-weight: 700; line-height: 1; }
.dash-sidebar-stat span:last-child  { font-size: .6rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* ── Auto-logout warning ─────────────────────────────────────────────────── */

.auto-logout-overlay {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 26, 20, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.auto-logout-overlay.hidden {
  display: none;
}

.auto-logout-modal {
  background: var(--card);
  border-radius: 14px;
  padding: 32px 28px;
  max-width: 360px;
  width: calc(100% - 40px);
  box-shadow: 0 8px 36px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}

.auto-logout-modal strong {
  font-variant-numeric: tabular-nums;
}

.idle-debug-dock {
  position: fixed;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 520;
  display: flex;
  flex-direction: column;
  align-items: end;
  gap: 8px;
}

.idle-debug-tab {
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.94);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(45, 38, 25, 0.08);
}

.idle-debug-panel {
  width: 180px;
  border: 1px solid var(--stroke);
  background: rgba(255, 252, 246, 0.97);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 16px 30px rgba(45, 38, 25, 0.12);
}

.idle-debug-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 0.76rem;
  color: var(--muted);
  margin-top: 8px;
}

.idle-debug-row strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ── Welcome modal ───────────────────────────────────────────────────────── */

.welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 26, 20, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.welcome-overlay.hidden {
  display: none;
}

.welcome-modal {
  background: var(--card);
  border-radius: 18px;
  padding: 36px 32px;
  max-width: 440px;
  width: calc(100% - 40px);
  box-shadow: 0 12px 48px rgba(0,0,0,0.22);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
}

.welcome-logo {
  width: 140px;
  margin-bottom: 4px;
}

.welcome-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
}

.welcome-subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
}

.welcome-tips {
  text-align: left;
  width: 100%;
  padding-left: 20px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--text);
}

.welcome-tips li {
  margin: 0;
}

.brand-block {
  display: flex;
  align-items: center;
  min-width: 0;
}

.brand-logo {
  width: 144px;
  height: auto;
  display: block;
  object-fit: contain;
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  font-size: 1.5rem;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.375rem;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 1.125rem;
  font-weight: 700;
}

main {
  min-height: calc(100vh - 64px);
}

.workspace-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
}

.card {
  border-radius: 12px;
  padding: 20px;
}

.label,
.helper-text {
  color: var(--muted);
  letter-spacing: 0.04em;
}

.label {
  font-size: 0.8rem;
  font-weight: 600;
  margin: 0 0 6px;
  text-transform: uppercase;
}

.qa-list {
  margin: 0;
  padding-left: 18px;
}

.qa-list li {
  margin: 10px 0;
}

.login-layout {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.section-header,
.action-stack {
  display: flex;
  gap: 12px;
}

.ghost-pill {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: #f2eee7;
  color: var(--muted);
}

.ghost-pill.warning {
  background: #f3e7d4;
  color: var(--gold-deep);
}

.ghost-pill.success {
  background: #d4f0e0;
  color: #1e7a48;
}

.stats-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 26, 20, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.stats-overlay.hidden {
  display: none;
}

.stats-modal {
  background: var(--surface, #fff);
  border-radius: 18px;
  padding: 32px;
  max-width: 580px;
  width: calc(100% - 48px);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.22);
}

.stats-modal-footer {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
}

.submitted-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.stat-item {
  background: #faf8f4;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.todo-empty {
  margin: 4px 0 10px;
  padding: 12px 14px;
  border: 1px solid #e3ddd2;
  border-radius: 10px;
  background: #f4f0e8;
  color: #8d8578;
  font-size: 0.85rem;
  font-weight: 500;
}

.todo-items {
  margin: 0 0 10px;
  padding-left: 0;
  list-style: none;
}

.todo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--stroke);
  font-size: 0.875rem;
}

.todo-item:last-child {
  border-bottom: none;
}

.todo-delete-btn {
  flex-shrink: 0;
  font-family: inherit;
  font-size: 0.78rem;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
}

.todo-delete-btn:hover {
  background: #f0ede8;
  color: #b05a2a;
}

.todo-add-form {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.todo-add-input {
  flex: 1;
  font-family: inherit;
  font-size: 0.82rem;
  padding: 5px 10px;
  border: 1px solid var(--stroke);
  border-radius: 7px;
  background: #fdfcfa;
  color: var(--text);
  min-width: 0;
}

.todo-add-input:focus {
  outline: 2px solid rgba(183, 131, 47, 0.2);
  outline-offset: 1px;
  border-color: transparent;
}

.todo-add-btn {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 5px 12px;
  background: #f2eee7;
  border: 1px solid var(--stroke);
  border-radius: 7px;
  cursor: pointer;
  color: var(--text);
  white-space: nowrap;
}

.todo-add-btn:hover {
  background: #e8e3da;
}

.not-finished-pill {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 999px;
  background: #fdecd4;
  color: #a85a10;
  white-space: nowrap;
}

.in-progress-row:hover {
  background: transparent !important;
}

.todo-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.todo-tab {
  border: 1px solid var(--stroke);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.todo-tab.is-active {
  background: #f2eee7;
  color: var(--text);
  border-color: #d7ccb8;
}

.login-card {
  width: min(100%, 460px);
  padding: 24px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
}

.login-subtitle {
  margin: 8px 0 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.login-card label {
  display: block;
  margin: 18px 0 8px;
  font-size: 0.9rem;
  font-weight: 600;
}

.login-card input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: #fff;
  color: var(--text);
}

.login-card input:focus {
  outline: 2px solid rgba(183, 131, 47, 0.14);
  outline-offset: 1px;
  border-color: var(--gold);
}

.primary-button,
.secondary-button {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 11px 16px;
  font-weight: 600;
  font-family: "SF Pro Display", "SF Pro Icons", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0;
  cursor: pointer;
}

.primary-button {
  width: 100%;
  margin-top: 20px;
  background: var(--gold);
  color: white;
  box-shadow: none;
}

.primary-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.secondary-button {
  background: #fff;
  border: 1px solid var(--stroke);
  color: var(--text);
}

.helper-text,
.error-text {
  margin: 12px 0 0;
  font-size: 0.82rem;
}

.error-text {
  color: #ba5539;
  min-height: 1.2em;
}

.section-header {
  justify-content: space-between;
  align-items: start;
  margin-bottom: 22px;
}

.qa-view {
  display: grid;
  gap: 22px;
}

.hidden,
.qa-view.hidden {
  display: none !important;
}

.qa-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.qa-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}


.test-id-panel {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr;
  gap: 28px;
  align-items: end;
}

.test-id-copy {
  min-width: 0;
}

.test-id-form {
  display: grid;
  gap: 10px;
  align-items: end;
}

.test-id-form select {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 10px 12px;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  width: 100%;
}

/* ── Upload confirm modal ────────────────────────────────────────────────── */

.upload-modal-overlay {
  position: fixed; inset: 0; z-index: 600;
  display: flex; align-items: center; justify-content: center;
  background: rgba(30,26,20,.45);
  backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px);
}
.upload-modal-overlay.hidden { display: none; }

.upload-modal {
  background: var(--card); border-radius: 16px; padding: 28px 28px 24px;
  width: min(500px, calc(100vw - 32px));
  box-shadow: 0 10px 44px rgba(0,0,0,.2);
  display: flex; flex-direction: column; gap: 16px;
}

.upload-modal-steps {
  display: flex; gap: 6px; margin-bottom: 4px;
}
.us-dot {
  height: 5px; flex: 1; border-radius: 999px;
  background: var(--stroke); transition: background .2s;
}
.us-dot.is-active { background: var(--gold-deep, #8a6a1a); }

.upload-file-table {
  max-height: 200px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 3px;
  margin: 6px 0;
}
.upload-file-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; font-size: .78rem; padding: 3px 6px;
  border-radius: 5px; background: #faf8f4;
}
.upload-file-path { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: monospace; }
.upload-badge-safe    { font-size: .7rem; color: #1e7a48; font-weight: 700; }
.upload-badge-warn    { font-size: .7rem; color: #a85a10; font-weight: 700; }
.upload-badge-danger  { font-size: .7rem; color: #c0392b; font-weight: 700; }

.upload-summary {
  font-size: .8rem; color: var(--muted); margin: 0;
}

.upload-modal-actions {
  display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px;
}

.upload-testid-row {
  display: flex; gap: 8px; align-items: center;
}
.upload-testid-input {
  flex: 1; font-family: inherit; font-size: .9rem;
  padding: 8px 12px; border: 1px solid var(--stroke);
  border-radius: 9px; background: var(--card); color: var(--text);
}
.upload-testid-input:focus { outline: 2px solid rgba(183,131,47,.2); border-color: transparent; }

.upload-questions-list {
  display: flex; flex-direction: column; gap: 10px;
  max-height: min(46vh, 460px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  margin-right: -4px;
  scrollbar-width: thin;
  scrollbar-color: #a29b92 transparent;
}
.upload-questions-list::-webkit-scrollbar { width: 10px; }
.upload-questions-list::-webkit-scrollbar-track { background: transparent; }
.upload-questions-list::-webkit-scrollbar-thumb {
  background: #c9c0b3; border-radius: 999px; border: 2px solid var(--card);
}
.upload-question-row {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px; border: 1px solid var(--stroke); border-radius: 10px;
  background: var(--card-alt, rgba(0,0,0,.02));
}
.upload-question-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.upload-question-main .upload-question-num {
  font-size: .78rem; color: var(--muted, #888); min-width: 22px; text-align: right;
}
.upload-question-input {
  flex: 1; min-width: 160px; font-family: inherit; font-size: .88rem;
  padding: 8px 12px; border: 1px solid var(--stroke);
  border-radius: 9px; background: var(--card); color: var(--text);
}
.upload-question-input:focus { outline: 2px solid rgba(183,131,47,.2); border-color: transparent; }
.upload-question-type {
  font-family: inherit; font-size: .82rem; padding: 7px 10px;
  border: 1px solid var(--stroke); border-radius: 9px;
  background: var(--card); color: var(--text);
}
.upload-question-remove {
  border: none; background: transparent; color: var(--muted, #888);
  font-size: 1.05rem; line-height: 1; cursor: pointer; padding: 4px 6px; border-radius: 6px;
}
.upload-question-remove:hover { background: rgba(185,28,28,.1); color: #b91c1c; }

.upload-question-extra {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px; margin-left: 30px;
  border-left: 2px solid var(--stroke); border-radius: 0 8px 8px 0;
  background: var(--card);
}
.upload-question-extra-label { font-size: .76rem; color: var(--muted, #888); margin: 0; }
.upload-option-list, .upload-option-row { display: flex; flex-direction: column; gap: 6px; }
.upload-option-row { flex-direction: row; align-items: center; }
.upload-option-input {
  flex: 1; font-family: inherit; font-size: .85rem;
  padding: 6px 10px; border: 1px solid var(--stroke);
  border-radius: 8px; background: var(--card-alt, rgba(0,0,0,.02)); color: var(--text);
}
.upload-option-input:focus { outline: 2px solid rgba(183,131,47,.2); border-color: transparent; }
.upload-option-remove {
  border: none; background: transparent; color: var(--muted, #888);
  font-size: 1rem; line-height: 1; cursor: pointer; padding: 4px 6px; border-radius: 6px;
}
.upload-option-remove:hover { background: rgba(185,28,28,.1); color: #b91c1c; }
.upload-scale-row { display: flex; align-items: center; gap: 8px; }
.upload-scale-num {
  font-size: .78rem; font-weight: 600; color: var(--gold-deep, #8a6a1a);
  background: var(--card-alt, rgba(0,0,0,.04)); border-radius: 6px; padding: 3px 8px;
}
.upload-scale-arrow { color: var(--muted, #888); font-size: .85rem; }
.upload-scale-low, .upload-scale-high {
  flex: 1; font-family: inherit; font-size: .82rem;
  padding: 6px 10px; border: 1px solid var(--stroke);
  border-radius: 8px; background: var(--card-alt, rgba(0,0,0,.02)); color: var(--text);
}
.upload-scale-low:focus, .upload-scale-high:focus { outline: 2px solid rgba(183,131,47,.2); border-color: transparent; }

.sc-questions-list { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.sc-questions-empty { font-size: .82rem; color: var(--muted, #888); font-style: italic; }
.sc-question-row {
  display: flex; align-items: baseline; gap: 8px;
  font-size: .85rem; padding: 6px 10px;
  background: var(--card-alt, rgba(0,0,0,.03)); border-radius: 7px;
}
.sc-question-num { font-weight: 600; color: var(--gold-deep, #8a6a1a); white-space: nowrap; }
.sc-question-text { flex: 1; }
.sc-question-row--rich { flex-direction: column; align-items: stretch; gap: 4px; }
.sc-question-row-top { display: flex; align-items: baseline; gap: 8px; }
.sc-question-type-tag {
  font-size: .68rem; background: #d9ecf7; color: #2466a0;
  padding: 1px 7px; border-radius: 4px; white-space: nowrap;
}
.sc-question-detail {
  font-size: .78rem; color: var(--muted, #888);
  padding-left: 30px; line-height: 1.4;
}

.upload-recap { display: flex; flex-direction: column; gap: 12px; }
.upload-recap-row {
  display: flex; align-items: center; gap: 12px;
  font-size: .92rem;
}
.upload-recap-label { color: var(--muted); width: 56px; flex-shrink: 0; }
.upload-recap-files {
  display: flex; flex-direction: column; gap: 4px;
  max-height: 220px; overflow-y: auto;
  background: #faf8f4; border: 1px solid var(--stroke);
  border-radius: 8px; padding: 8px 12px;
  min-width: 0;
}
.upload-recap-file {
  font-size: .82rem;
  font-family: inherit;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 3px 0;
}

.upload-recap-file.is-danger { color: #c0392b; }
.upload-recap-file.is-warn   { color: #a85a10; }

/* Step 3 two-column layout */
.upload-step3-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
  min-width: 0;
  overflow: hidden;
}

.upload-step3-layout > * {
  min-width: 0;
  overflow: hidden;
}

.upload-step3-preview {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.upload-preview-label {
  font-size: .72rem;
  color: var(--muted);
  font-weight: 500;
  margin: 0;
}

.upload-step-desc {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 10px;
}

.preview-open-link {
  display: block;
  font-size: 0.78rem;
  text-align: center;
  padding: 6px;
  color: var(--gold-deep, #8a6a1a);
  text-decoration: underline;
}

.upload-preview-wrap {
  position: relative;
  width: 100%;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  overflow: hidden;
  background: transparent;
}

.upload-preview-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(255,255,255,.92);
  border-radius: 8px;
  font-size: 0.82rem;
  color: var(--muted);
  transition: opacity 1s;
  z-index: 2;
}

.upload-preview-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--stroke);
  border-top-color: var(--gold-deep, #8a6a1a);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.upload-preview-frame {
  display: block;
  border: none;
  background: transparent;
  /* width/height/transform set by JS after load */
}

/* Wider modal for step 3 */
.upload-modal.is-wide {
  width: min(820px, calc(100vw - 32px));
}

/* ── Founder submissions overview ───────────────────────────────────────── */

.submissions-panel { display: flex; flex-direction: column; gap: 12px; }

.sub-view-tabs { display: flex; gap: 6px; }
.sub-view-tab {
  font-family: inherit; font-size: .8rem; font-weight: 500;
  padding: 5px 14px; border-radius: 999px;
  border: 1px solid var(--stroke); background: transparent;
  color: var(--muted); cursor: pointer;
}
.sub-view-tab.is-active { background: #f2eee7; color: var(--text); border-color: var(--gold-deep,#8a6a1a); }

.sub-export-row {
  display: flex; align-items: center; gap: 8px;
  padding-top: 8px; border-top: 1px solid var(--stroke);
  flex-wrap: wrap;
}

.sub-q-answer {
  border: 1px solid var(--stroke); border-radius: 9px;
  padding: 10px 14px; background: #faf8f4;
  display: flex; flex-direction: column; gap: 6px;
}
.sub-q-meta { display: flex; align-items: center; gap: 10px; }

.sub-label-toggle {
  font-family: inherit; font-size: .72rem;
  background: transparent; border: 1px solid var(--stroke);
  border-radius: 5px; padding: 2px 8px; cursor: pointer;
  color: var(--muted); align-self: flex-start;
}
.sub-label-toggle:hover { background: #f2eee7; }

.sub-label-form { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; border-top: 1px solid var(--stroke); }
.sub-label-row { display: flex; gap: 16px; flex-wrap: wrap; font-size: .8rem; align-items: center; }
.sub-label-row label { display: flex; align-items: center; gap: 5px; }
.sub-score-sel { font-family: inherit; font-size: .78rem; padding: 2px 5px; border: 1px solid var(--stroke); border-radius: 5px; background: var(--card); }
.sub-notes { font-family: inherit; font-size: .82rem; padding: 6px 8px; border: 1px solid var(--stroke); border-radius: 7px; resize: vertical; background: var(--card); }

/* ── Latest submissions card ─────────────────────────────────────────────── */

.latest-sub-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--stroke);
}
.latest-sub-row:last-child { border-bottom: none; }

.latest-sub-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.latest-sub-name { font-size: .85rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.latest-sub-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.latest-sub-count { font-size: .75rem; font-weight: 600; color: var(--text); }

/* ── Matrix overview ─────────────────────────────────────────────────────── */

.sub-matrix-header { display:flex; gap:10px; margin-bottom:12px; flex-wrap:wrap; }

.matrix-group { border:1px solid var(--stroke); border-radius:12px; overflow:hidden; margin-bottom:12px; }
.matrix-group[open] > .matrix-group-header { border-bottom:1px solid var(--stroke); }

.matrix-group-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 16px; background:#f2eee7; cursor:pointer; list-style:none; gap:12px;
}
.matrix-group-header::-webkit-details-marker { display:none; }
.matrix-group-title { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.matrix-group-stats { display:flex; align-items:center; gap:8px; font-size:.78rem; color:var(--muted); flex-shrink:0; }

.matrix-col-tag { font-size:.72rem; background:#fff; border:1px solid var(--stroke); padding:1px 7px; border-radius:999px; color:var(--muted); }
.matrix-cat-tag { font-size:.72rem; background:#fdf9f0; border:1px solid #e0c060; padding:1px 7px; border-radius:999px; color:#a85a10; }

.matrix-wrap { overflow-x:auto; }

.matrix-table { width:100%; border-collapse:collapse; font-size:.82rem; }
.matrix-th-tester { text-align:left; padding:8px 12px; font-weight:600; font-size:.75rem; color:var(--muted); border-bottom:1px solid var(--stroke); min-width:150px; }
.matrix-th-q { text-align:center; padding:8px 10px; font-weight:600; font-size:.75rem; color:var(--muted); border-bottom:1px solid var(--stroke); min-width:60px; }

.matrix-td-tester { padding:8px 12px; border-bottom:1px solid var(--stroke); }
.matrix-tester-name { display:block; font-weight:500; }
.matrix-tester-role { display:block; font-size:.72rem; color:var(--muted); }

.matrix-cell { padding:6px 8px; border-bottom:1px solid var(--stroke); text-align:center; vertical-align:top; cursor:pointer; }
.matrix-cell--empty { color:var(--muted); opacity:.4; cursor:default; }
.matrix-cell--done:hover { background:#fdf9f0; }
.matrix-cell--total { font-weight:700; color:var(--text); cursor:default; }

.matrix-cell-top { display:flex; align-items:center; justify-content:center; gap:4px; }
.matrix-check { color:#4caf50; font-size:.85rem; }
.matrix-wc { font-size:.72rem; color:var(--muted); }

.matrix-row--complete .matrix-td-tester { border-left:3px solid #4caf50; }

.matrix-has-note {
  font-size: .7rem;
  color: var(--gold-deep, #8a6a1a);
  line-height: 1;
}

.matrix-note {
  margin-top: 6px;
  padding: 5px 7px;
  background: #fdf9f0;
  border-left: 3px solid var(--gold-deep, #8a6a1a);
  border-radius: 0 5px 5px 0;
  font-size: .72rem;
  color: var(--muted);
}

.matrix-note-label {
  font-weight: 600;
  color: var(--text);
  margin-right: 4px;
}

.matrix-answer {
  margin-top:6px; padding:6px 8px;
  background:#fff; border:1px solid var(--stroke);
  border-radius:6px; font-size:.75rem; color:var(--text);
  text-align:left; white-space:pre-wrap; max-width:200px;
  word-break:break-word; cursor:default;
}

.sub-compare-form { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.sub-compare-q { border: 1px solid var(--stroke); border-radius: 9px; padding: 10px 14px; background: #faf8f4; margin-bottom: 6px; }
.sub-compare-q.is-changed { border-color: #f0a040; background: #fdf9f0; }
.sub-compare-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.sub-compare-col { display: flex; flex-direction: column; gap: 4px; }

.submissions-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.sub-stat {
  background: #faf8f4;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 3px;
}
.sub-stat-label { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 500; }
.sub-stat-value { font-size: 1.1rem; font-weight: 700; color: var(--text); }

.submissions-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 320px; overflow-y: auto;
}

.sub-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.sub-group:last-child { margin-bottom: 0; }

.sub-group-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 4px;
}
.sub-group-id    { font-weight: 700; font-size: .9rem; }
.sub-group-count { font-size: .78rem; color: var(--muted); }

.sub-status-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
}
.sub-status-dot.answered { background: #4caf50; }
.sub-status-dot.pending  { background: #ccc; }

.sub-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px;
  border: 1px solid var(--stroke);
  border-radius: 9px;
  background: #faf8f4;
  cursor: pointer;
  transition: background .12s;
}
.sub-row--pending { opacity: .65; cursor: default; }
.sub-row:not(.sub-row--pending):hover,
.sub-row.is-active { background: #f2eee7; border-color: var(--gold-deep, #8a6a1a); }

.sub-pending-label { font-size: .75rem; color: var(--muted); }

.sub-row-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sub-name     { font-size: .88rem; font-weight: 600; }
.sub-meta     { font-size: .75rem; color: var(--muted); }

.sub-row-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.sub-progress-bar {
  width: 80px; height: 5px; background: var(--stroke);
  border-radius: 999px; overflow: hidden;
}
.sub-progress-bar span { display: block; height: 100%; background: var(--gold-deep, #8a6a1a); border-radius: 999px; }
.sub-count { font-size: .78rem; font-weight: 600; color: var(--text); }

.submission-detail {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 16px;
  background: #faf8f4;
  display: flex; flex-direction: column; gap: 12px;
}
.sub-detail-header { display: flex; flex-direction: column; gap: 4px; border-bottom: 1px solid var(--stroke); padding-bottom: 10px; position: relative; }
.sub-detail-close { position: absolute; top: 0; right: 0; background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: .9rem; padding: 2px 4px; }
.sub-empty-answer { color: var(--muted); font-style: italic; }

.sub-tester-note {
  margin: 4px 0 0;
  padding: 5px 10px;
  background: #fdf9f0;
  border-left: 3px solid var(--gold-deep, #8a6a1a);
  border-radius: 0 6px 6px 0;
  font-size: .8rem;
  color: var(--muted);
  font-style: italic;
}
.sub-answer { display: flex; flex-direction: column; gap: 4px; }
.sub-answer-label-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.sub-answer-label {
  font-size: .75rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
  display: inline-block; max-width: 100%;
}
.sub-answer-label[title] { cursor: help; border-bottom: 1px dotted var(--muted); }
.sub-answer-type-tag {
  font-size: .66rem; font-weight: 600; text-transform: none; letter-spacing: normal;
  background: #d9ecf7; color: #2466a0;
  padding: 1px 7px; border-radius: 4px; white-space: nowrap; flex-shrink: 0;
}
.sub-answer-text { font-size: .875rem; color: var(--text); margin: 0; white-space: pre-wrap; }

/* ── Stage drop zone ─────────────────────────────────────────────────────── */

.stage-drop-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stage-drop-zone {
  border: 2px dashed var(--stroke);
  border-radius: 12px;
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: default;
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
}

.stage-drop-zone.is-over {
  border-color: var(--gold-deep, #8a6a1a);
  background: #fdf9f0;
}

.stage-drop-icon { font-size: 2rem; line-height: 1; }
.stage-drop-text { font-weight: 600; font-size: 0.95rem; margin: 0; }
.stage-drop-sub  { color: var(--muted); font-size: 0.82rem; margin: 0; }

.stage-drop-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stage-progress-bar {
  height: 6px;
  background: #f0ede8;
  border-radius: 999px;
  overflow: hidden;
}

.stage-progress-bar span {
  display: block;
  height: 100%;
  background: var(--gold-deep, #8a6a1a);
  border-radius: 999px;
  width: 0;
  transition: width 0.2s;
}

.stage-progress-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
}

.stage-file-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
}

.stage-tabs {
  display: flex; gap: 4px; margin-bottom: 10px; flex-wrap: wrap;
}
.stage-tab {
  font-family: inherit; font-size: .78rem; font-weight: 500;
  padding: 5px 14px; border-radius: 999px;
  border: 1px solid var(--stroke); background: transparent;
  color: var(--muted); cursor: pointer;
}
.stage-tab.is-active { background: #f2eee7; color: var(--text); border-color: var(--gold-deep,#8a6a1a); }
.stage-tab--upload { margin-left: auto; }

.stage-upload-section { margin-top: 8px; }

.stage-config-panel {
  margin-top: 10px; border: 1px solid var(--stroke);
  border-radius: 12px; overflow: hidden;
}
.stage-config-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: #f2eee7;
  border-bottom: 1px solid var(--stroke);
  font-weight: 600; font-size: .88rem;
}
.stage-config-body { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.stage-config-field { display: flex; flex-direction: column; gap: 5px; }
.stage-config-field label { font-size: .8rem; font-weight: 500; }
.stage-config-field select,
.stage-config-field input[type=datetime-local],
.stage-config-field textarea {
  font-family: inherit; font-size: .85rem; padding: 7px 10px;
  border: 1px solid var(--stroke); border-radius: 8px;
  background: var(--card); color: var(--text);
}
.stage-target-roles { display: flex; gap: 12px; flex-wrap: wrap; font-size: .82rem; }
.stage-target-roles label { display: flex; align-items: center; gap: 5px; }
.stage-hint { font-size: .72rem; color: var(--muted); }
.stage-config-actions { display: flex; justify-content: flex-end; gap: 8px; }

.members-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
  align-items: start;
}

.members-sidebar {
  display: flex; flex-direction: column; gap: 10px;
}

.members-side-tabs {
  display: flex; border-bottom: 1px solid var(--stroke); margin-bottom: 4px;
}
.members-side-tab {
  font-family: inherit; font-size: .78rem; font-weight: 500;
  padding: 5px 12px; border: none; border-bottom: 2px solid transparent;
  background: transparent; color: var(--muted); cursor: pointer;
  margin-bottom: -1px;
}
.members-side-tab.is-active { color: var(--text); border-bottom-color: var(--gold-deep,#8a6a1a); }

.members-side-panel { display: flex; flex-direction: column; gap: 8px; }

.members-stat-card {
  border: 1px solid var(--stroke); border-radius: 10px;
  padding: 14px 16px; background: #faf8f4;
  display: flex; flex-direction: column; gap: 3px;
}
.members-stat-card.members-stat-green { border-color: #b2e0c0; background: #f0faf4; }
.members-stat-card.members-stat-muted { opacity: .7; }

.members-stat-val   { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.members-stat-label { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 500; }

.members-role-breakdown {
  border: 1px solid var(--stroke); border-radius: 10px;
  padding: 10px 14px; background: #faf8f4;
  display: flex; flex-direction: column; gap: 6px; margin-top: 4px;
}
.members-role-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: .8rem;
}
.members-role-name  { color: var(--muted); }
.members-role-count { font-weight: 700; }

.stage-members-list { display: flex; flex-direction: column; gap: 16px; }

.members-filters {
  display: flex; gap: 6px; flex: 1; justify-content: center; flex-wrap: wrap;
}
.members-filter-btn {
  font-family: inherit; font-size: .78rem; font-weight: 500;
  padding: 4px 14px; border-radius: 999px;
  border: 1px solid var(--stroke); background: transparent;
  color: var(--muted); cursor: pointer; transition: background .12s;
}
.members-filter-btn.is-active { background: #f2eee7; color: var(--text); border-color: var(--gold-deep,#8a6a1a); }
.members-filter-btn:hover:not(.is-active) { background: #faf8f4; }

.stage-member-group { display: flex; flex-direction: column; gap: 4px; }
.stage-member-group-label {
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); padding: 4px 0 6px;
  border-bottom: 1px solid var(--stroke); margin-bottom: 4px;
}

.stage-member-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px; border-radius: 8px; background: #faf8f4;
  border: 1px solid var(--stroke);
}
.stage-member-info { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.stage-member-name { font-size: .85rem; font-weight: 500; }
.stage-member-code { font-size: .72rem; color: var(--muted); font-family: monospace; }

.member-pct-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 2px; flex-shrink: 0;
}
.member-pct-bar {
  width: 60px; height: 5px; background: #e8e3dc;
  border-radius: 999px; overflow: hidden;
}
.member-pct-bar span {
  display: block; height: 100%; border-radius: 999px; transition: width .3s;
}
.member-pct-label { font-size: .72rem; font-weight: 700; }

.stage-member-toggle {
  display: flex; align-items: center; gap: 7px; cursor: pointer; user-select: none;
}
.stage-member-toggle input { display: none; }

.stage-toggle-track {
  width: 36px; height: 20px; border-radius: 999px;
  background: #ddd; position: relative; transition: background .2s; flex-shrink: 0;
}
.stage-toggle-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; position: absolute; top: 2px; left: 2px;
  transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.member-active-cb:checked + .stage-toggle-track { background: #4caf50; }
.member-active-cb:checked + .stage-toggle-track .stage-toggle-thumb { transform: translateX(16px); }

.stage-toggle-label { font-size: .78rem; color: var(--muted); min-width: 46px; }

.creds-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  background: #faf8f4; border: 1px solid var(--stroke);
  margin-bottom: 4px;
}

.creds-name {
  display: flex; align-items: center; gap: 6px;
  font-size: .85rem; font-weight: 500;
}

.creds-edit-btn {
  background: transparent; border: none; cursor: pointer;
  color: var(--muted); font-size: .78rem; padding: 0 2px;
}
.creds-edit-btn:hover { color: var(--text); }

.creds-code-wrap {
  display: flex; align-items: center; gap: 6px;
  font-size: .8rem; font-family: monospace;
}

.creds-masked {
  letter-spacing: .08em; color: transparent;
  text-shadow: 0 0 8px rgba(0,0,0,.55);
  user-select: none; pointer-events: none;
}

.creds-real { color: var(--text); font-weight: 600; }

.creds-reveal-btn {
  font-family: inherit; font-size: .7rem; padding: 2px 8px;
  border: 1px solid var(--stroke); border-radius: 5px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.creds-reveal-btn:hover { background: #f2eee7; color: var(--text); }

.creds-name-input {
  font-family: inherit; font-size: .85rem; padding: 3px 8px;
  border: 1px solid var(--stroke); border-radius: 6px;
  background: var(--card); color: var(--text); width: 130px;
}
.creds-save-name {
  font-size: .72rem; padding: 3px 9px;
  background: var(--gold-deep,#8a6a1a); color: #fff;
  border: none; border-radius: 5px; cursor: pointer;
}
.creds-cancel-name {
  font-size: .72rem; padding: 3px 8px;
  background: transparent; border: 1px solid var(--stroke);
  border-radius: 5px; cursor: pointer; color: var(--muted);
}

.stage-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #faf8f4;
  border: 1px solid var(--stroke);
}

.stage-entry-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.stage-entry-id {
  font-size: 0.85rem;
  color: var(--text);
}

.stage-entry-file {
  font-size: 0.78rem;
  font-family: monospace;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-entry-meta {
  font-size: 0.72rem;
  color: var(--muted);
}

.stage-delete-btn {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
  padding: 4px 6px;
  border-radius: 4px;
}

.stage-delete-btn:hover { color: #c0392b; background: #fde; }

.stage-empty {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0;
}

.stage-file-hint {
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--muted);
  margin-left: 4px;
}

.stage-file-hint code {
  font-family: monospace;
  background: #f0ede8;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.85em;
}

.test-id-form label {
  font-size: 0.9rem;
  font-weight: 600;
}

.test-id-form input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: #fff;
  color: var(--text);
  font-size: 1rem;
}

/* Locked because a staged test file is selected — the file carries its own
   test ID, so manual entry is disabled until that selection is cleared. */
.test-id-form input.input-locked {
  background: #f4f1ea;
  color: var(--muted, #888);
  cursor: not-allowed;
}

.test-id-form input:focus {
  outline: 2px solid rgba(183, 131, 47, 0.14);
  outline-offset: 1px;
  border-color: var(--gold);
}

.test-id-button {
  height: 56px;
  margin-top: 4px;
  font-size: 1.05rem;
}

.test-id-text {
  margin: 10px 0 0;
}

.test-page-layout {
  display: grid;
  gap: 22px;
  padding: 32px 0;
}

.test-page-hero {
  display: grid;
  gap: 12px;
}

.test-page-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.issue-list {
  display: grid;
  gap: 16px;
}

.answers-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.answers-table thead th {
  text-align: left;
  padding: 6px 10px;
  color: var(--muted);
  font-weight: 500;
  border-bottom: 1px solid var(--stroke);
}

.answers-row {
  cursor: pointer;
  border-bottom: 1px solid var(--stroke);
  transition: background 0.1s;
}

.answers-row:hover {
  background: #faf8f4;
}

.answers-row td {
  padding: 10px 10px;
}

.answers-row-date {
  color: var(--muted);
  font-size: 0.8rem;
}

.answers-row-chevron {
  text-align: right;
  color: var(--muted);
  transition: transform 0.2s;
}

.answers-row.is-open .answers-row-chevron {
  display: inline-block;
  transform: rotate(180deg);
}

.answers-detail td {
  padding: 0;
  background: #faf8f4;
  border-bottom: 1px solid var(--stroke);
}

.answers-detail-inner {
  display: grid;
  gap: 10px;
  padding: 12px 16px;
}

.answers-detail-item {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px;
  align-items: start;
}

.answers-detail-label {
  font-weight: 500;
  color: var(--muted);
  font-size: 0.8rem;
  padding-top: 2px;
}

.answers-detail-answer-col {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.answers-detail-answer {
  color: var(--text);
  white-space: pre-wrap;
}

.comment-note-display {
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
  white-space: pre-wrap;
}

.comment-change-btn {
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 500;
  background: transparent;
  border: 1px solid var(--stroke);
  border-radius: 5px;
  padding: 2px 8px;
  cursor: pointer;
  color: var(--muted);
  align-self: flex-start;
  transition: background 0.12s, color 0.12s;
}

.comment-change-btn:hover {
  background: #f3e7d4;
  color: var(--gold-deep, #8a6a1a);
  border-color: #e0c98a;
}

/* Note popup */
.note-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 26, 20, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.note-popup-overlay.hidden {
  display: none;
}

.note-popup {
  background: var(--surface, #fff);
  border-radius: 14px;
  padding: 24px;
  width: min(420px, calc(100vw - 40px));
  box-shadow: 0 8px 36px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.note-popup-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  margin-top: -8px;
}

.note-popup-preview {
  background: #faf8f4;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 10px 14px;
}

.note-popup-preview-label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 5px;
}

.note-popup-answer {
  font-size: 0.88rem;
  color: var(--text);
  white-space: pre-wrap;
  margin: 0;
}

.note-popup-textarea-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
}

.comment-textarea {
  width: 100%;
  resize: vertical;
  font-family: inherit;
  font-size: 0.85rem;
  padding: 8px 11px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: #fdfcfa;
  color: var(--text);
  box-sizing: border-box;
}

.comment-textarea:focus {
  outline: 2px solid rgba(183, 131, 47, 0.2);
  outline-offset: 1px;
  border-color: transparent;
}

.note-popup-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.comment-cancel-btn {
  font-family: inherit;
  font-size: 0.82rem;
  background: transparent;
  border: 1px solid var(--stroke);
  border-radius: 7px;
  padding: 6px 14px;
  cursor: pointer;
  color: var(--muted);
}

.comment-save-btn {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  background: var(--gold-deep, #8a6a1a);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 6px 16px;
  cursor: pointer;
}

.answer-attachment-preview {
  margin-top: 6px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  overflow: hidden;
}
.answer-attach-label {
  display: block;
  font-size: .68rem;
  color: var(--muted);
  padding: 4px 8px;
  background: #faf8f4;
  border-bottom: 1px solid var(--stroke);
}
.answer-attach-frame {
  display: block;
  width: 100%;
  height: 120px;
  border: none;
  background: #fff;
}

.answers-detail-empty {
  color: var(--muted);
  font-size: 0.85rem;
}

.answers-detail-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--stroke);
}

.detail-more-button {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--gold-deep, #8a6a1a);
  background: transparent;
  border: 1px solid var(--stroke);
  border-radius: 6px;
  padding: 5px 12px;
  cursor: pointer;
  transition: background 0.12s;
}

.detail-more-button:hover {
  background: #f3e7d4;
}

.answers-detail-timing {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.8rem;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--stroke);
  margin-bottom: 4px;
}

.issue {
  padding: 16px;
  border-radius: 10px;
  background: #faf8f4;
  border: 1px solid var(--stroke);
}

.issue strong {
  display: block;
  margin-bottom: 6px;
}

.issue span,
#sessionSummary {
  color: var(--muted);
}

.action-stack {
  flex-direction: column;
}

.review-body {
  overflow-x: hidden;
}

.review-body.rules-open {
  overflow: hidden;
}

.review-body:not(.demo-ready) .test-surface {
  filter: blur(28px);
  pointer-events: none;
  user-select: none;
}

.review-page-shell {
  width: 100%;
}

.review-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  margin-bottom: 0;
  border-radius: 0;
}

.review-topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.review-topbar-meta {
  display: flex;
  align-items: center;
  gap: 14px;
}

.review-topbar-copy {
  display: flex;
  flex-direction: column;
  align-items: end;
  gap: 4px;
}

.review-session-note {
  font-size: 0.82rem;
  color: var(--muted);
}

.compact-button {
  width: auto;
  margin-top: 0;
  padding: 9px 14px;
}

.header-rules-button {
  min-height: 38px;
}

.question-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 112px;
}

.question-progress-bar {
  width: 96px;
  height: 8px;
  border-radius: 999px;
  background: #ece6dc;
  overflow: hidden;
}

.question-progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--gold);
  transition: width 220ms ease;
}

.question-progress-text {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--muted);
}

.question-progress-percent {
  font-size: 0.78rem;
  font-weight: 600;
  color: #8b8379;
}

.question-dock {
  position: fixed;
  left: 0;
  top: 152px;
  z-index: 31;
  display: flex;
  align-items: flex-start;
  overflow: visible;
  transform: translateX(-10px);
  transition: transform 560ms cubic-bezier(0.16, 1, 0.3, 1);
}

.question-dock.open {
  transform: translateX(0);
}

.question-tab-button {
  border: 1px solid var(--stroke);
  border-right: 0;
  border-radius: 12px 0 0 12px;
  background: rgba(255, 253, 250, 0.98);
  color: var(--text);
  padding: 18px 12px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  box-shadow: var(--shadow);
  margin-left: 0;
  position: relative;
  z-index: 2;
}

.question-panel {
  width: 0;
  /* Cap height to whatever actually fits below the dock's fixed offset, so
     the panel never runs off the bottom of the viewport — its own
     overflow-y:auto then guarantees the Submit button stays reachable by
     scrolling no matter how many questions are linked. */
  max-height: min(72vh, 720px, calc(100vh - 190px));
  margin-left: 0;
  padding: 22px 0;
  border: 0 solid var(--stroke);
  border-radius: 0 0 14px 0;
  background: rgba(255, 253, 250, 0.98);
  box-shadow: 0 16px 42px rgba(45, 41, 36, 0.12);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  overflow: hidden;
  overflow-y: auto;
  transition: width 560ms cubic-bezier(0.16, 1, 0.3, 1), padding 560ms cubic-bezier(0.16, 1, 0.3, 1), border-width 560ms cubic-bezier(0.16, 1, 0.3, 1), opacity 260ms ease-out, visibility 0s linear 560ms;
  position: relative;
  z-index: 1;
  scrollbar-width: thin;
  scrollbar-color: #a29b92 transparent;
}

.question-panel.open {
  width: min(360px, calc(100vw - 48px));
  padding: 22px 18px;
  border-width: 1px;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: width 560ms cubic-bezier(0.16, 1, 0.3, 1), padding 560ms cubic-bezier(0.16, 1, 0.3, 1), border-width 560ms cubic-bezier(0.16, 1, 0.3, 1), opacity 260ms ease-out, visibility 0s linear 0s;
}

.question-panel::-webkit-scrollbar {
  width: 12px;
}

.question-panel::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 999px;
}

.question-panel::-webkit-scrollbar-thumb {
  background: #a29b92;
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}

.question-panel::-webkit-scrollbar-corner {
  background: transparent;
}

.question-panel::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

.question-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.question-item + .question-item {
  margin-top: 18px;
}

.question-label {
  display: block;
  margin-bottom: 10px;
  font-size: 1rem;
  font-weight: 600;
}

.question-answer {
  width: 100%;
  resize: vertical;
  min-height: 108px;
  padding: 14px 16px;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 0.98rem;
}

.question-answer:focus {
  outline: 2px solid rgba(183, 131, 47, 0.14);
  outline-offset: 1px;
  border-color: var(--gold);
}

.question-status {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.9rem;
  color: var(--muted);
}

.submit-button-wrap {
  position: sticky;
  bottom: -22px;
  display: block;
  margin-top: 22px;
  padding-bottom: 14px;
  background: linear-gradient(to bottom, rgba(255,253,250,0) 0%, rgba(255,253,250,0.96) 28%, rgba(255,253,250,0.98) 100%);
  z-index: 2;
}

.submit-button-wrap .question-submit-button {
  width: 100%;
}

.submit-button-wrap::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #2d2a25;
  color: #fff;
  font-size: 0.75rem;
  line-height: 1.4;
  padding: 7px 12px;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 10;
}

.submit-button-wrap[data-tooltip]:hover::after {
  opacity: 1;
}

.question-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.question-item-top .question-label {
  margin: 0;
}

.question-screenshot-btn {
  font-size: 1rem;
  background: transparent;
  border: 1px solid var(--stroke);
  border-radius: 7px;
  padding: 2px 7px;
  cursor: pointer;
  line-height: 1.4;
  transition: background 0.12s;
}

.question-screenshot-btn:hover {
  background: #f2eee7;
}

.question-attachment {
  margin-top: 6px;
}

/* ── Dynamic question controls (text/choice/scale/ranking) ──────────────── */

.question-items-loading {
  color: var(--muted);
  font-size: 0.92rem;
}

.question-prompt-text {
  margin: 0 0 10px;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.45;
}

.question-controls {
  margin-bottom: 4px;
}

.question-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.question-option-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--stroke);
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
  font-size: 0.94rem;
  transition: border-color 0.12s, background 0.12s;
}

.question-option-row:hover {
  border-color: var(--gold);
  background: #fbf6ec;
}

.question-option-row input {
  accent-color: var(--gold-deep, #8a6a1a);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.question-options-empty {
  font-size: 0.88rem;
  color: var(--muted);
  font-style: italic;
  margin: 0;
}

.question-scale {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.question-scale-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.question-scale-slider {
  flex: 1;
  accent-color: var(--gold-deep, #8a6a1a);
}

.question-scale-value {
  min-width: 28px;
  text-align: center;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--gold-deep, #8a6a1a);
}

.question-scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--muted);
  gap: 10px;
}

.question-scale-endpoint {
  max-width: 48%;
  line-height: 1.35;
}

.question-scale-endpoint:last-child {
  text-align: right;
}

.question-ranking-hint {
  margin: 0 0 8px;
  font-size: 0.82rem;
  color: var(--muted);
}

.question-ranking-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.question-ranking-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--stroke);
  border-radius: 9px;
  background: #fff;
  font-size: 0.92rem;
  cursor: grab;
  user-select: none;
  transition: border-color 0.12s, box-shadow 0.12s, opacity 0.12s;
}

.question-ranking-item:active {
  cursor: grabbing;
}

.question-ranking-item.dragging {
  opacity: 0.45;
  border-color: var(--gold);
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
}

.question-ranking-handle {
  color: var(--muted);
  font-size: 0.95rem;
  flex-shrink: 0;
}

.question-ranking-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  border-radius: 6px;
  background: #f2eee7;
  color: var(--gold-deep, #8a6a1a);
  font-weight: 700;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.question-ranking-text {
  flex: 1;
}

.answers-locked .question-option-row,
.answers-locked .question-ranking-item {
  opacity: 0.65;
  cursor: not-allowed;
  pointer-events: none;
}

.attachment-thumb {
  position: relative;
  display: inline-block;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--stroke);
  max-width: 100%;
}

.attachment-img {
  display: block;
  max-width: 100%;
  max-height: 140px;
  object-fit: contain;
  background: #1e1e1e;
}

.attachment-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Bottom draw panel ───────────────────────────────────────────────────── */

.dp-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 800;
  font-family: inherit;
}

.dp-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 18px;
  background: #2a2a2a;
  border: none;
  border-top: 2px solid #444;
  color: #ccc;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}

.dp-tab:hover { background: #333; }
.dp-tab-icon { font-size: 1rem; }
.dp-tab-label { flex: 1; }
.dp-tab-arrow { font-size: 0.7rem; transition: transform 0.2s; }

.dp-body {
  background: #1e1e1e;
  border-top: 1px solid #333;
  display: flex;
  flex-direction: column;
}

.dp-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #2a2a2a;
  border-bottom: 1px solid #333;
}

.dp-sep {
  width: 1px;
  height: 20px;
  background: #444;
  flex-shrink: 0;
}

.dp-spacer { flex: 1; }

.dp-btn {
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 5px;
  border: 1px solid #555;
  background: transparent;
  color: #bbb;
  cursor: pointer;
  white-space: nowrap;
}

.dp-btn:hover  { background: #3a3a3a; color: #fff; }
.dp-btn.is-active { background: #444; color: #fff; border-color: #777; }

.dp-pick { color: #7ec8f0; border-color: #2a6080; }
.dp-pick:hover,
.dp-pick.is-active { background: #0a2a3a; color: #7ec8f0; border-color: #7ec8f0; }

.dp-clear:hover { background: #3a1010; color: #f66; border-color: #833; }
.dp-attach { background: #1a4a1a; border-color: #4caf50; color: #7cca7c; }
.dp-attach:hover { background: #2a6a2a; }

.dp-color {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.1s;
}
.dp-color.is-active { border-color: #fff; transform: scale(1.25); }

.dp-upload {
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 5px;
  border: 1px solid #555;
  background: transparent;
  color: #bbb;
  cursor: pointer;
  user-select: none;
}
.dp-upload:hover { background: #3a3a3a; color: #fff; }

.dp-select {
  font-family: inherit;
  font-size: 0.75rem;
  padding: 4px 6px;
  border-radius: 5px;
  border: 1px solid #555;
  background: #2a2a2a;
  color: #ccc;
}

.dp-attach-label {
  font-size: 0.75rem;
  color: #888;
}

.dp-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
  padding: 10px;
  background: #2a2a2a;
}

.dp-preview-frame,
.attachment-frame {
  display: block;
  width: 100%;
  border: none;
  background: #fff;
}

.dp-preview-frame { min-height: 60px; }
.attachment-frame { height: 120px; }

.dp-hint {
  font-size: 0.72rem;
  color: #666;
  padding: 5px 14px;
  margin: 0;
  background: #1e1e1e;
}

/* ── Inline draw panel (kept for reference, unused) ──────────────────────── */

.inline-draw {
  margin-top: 14px;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  overflow: hidden;
}

.inline-draw-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  background: #f2eee7;
  border-bottom: 1px solid var(--stroke);
}

.inline-draw-title {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
}

.inline-draw-close {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0 2px;
  line-height: 1;
}

.inline-draw-close:hover { color: var(--text); }

.inline-draw-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  background: #faf8f4;
  border-bottom: 1px solid var(--stroke);
}

.idraw-sep {
  width: 1px;
  height: 18px;
  background: var(--stroke);
  flex-shrink: 0;
}

.idraw-tool {
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 5px;
  border: 1px solid var(--stroke);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.idraw-tool.is-active { background: #e8e3dc; color: var(--text); }

.idraw-color {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.1s;
}

.idraw-color.is-active { border-color: #555; transform: scale(1.25); }

.idraw-size {
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: 1px solid var(--stroke);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.idraw-size.is-active { background: #e8e3dc; color: var(--text); }

.idraw-clear {
  font-family: inherit;
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 5px;
  border: 1px solid var(--stroke);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  margin-left: auto;
}

.idraw-clear:hover { background: #fde; border-color: #e66; color: #c00; }

.idraw-upload-label {
  font-family: inherit;
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 5px;
  border: 1px solid var(--stroke);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.idraw-upload-label:hover { background: #e8e3dc; color: var(--text); }

#drawCanvas {
  display: block;
  width: 100%;
  cursor: crosshair;
  touch-action: none;
  background: #f0ede8;
}

.inline-draw-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  background: #faf8f4;
  border-top: 1px solid var(--stroke);
  flex-wrap: wrap;
  gap: 6px;
}

.idraw-paste-hint {
  font-size: 0.72rem;
  color: var(--muted);
}

.idraw-attach-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.idraw-attach-label {
  font-size: 0.72rem;
  color: var(--muted);
}

.idraw-select {
  font-family: inherit;
  font-size: 0.75rem;
  padding: 3px 6px;
  border-radius: 5px;
  border: 1px solid var(--stroke);
  background: #fff;
  color: var(--text);
}

.idraw-attach-btn {
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 6px;
  border: none;
  background: #4caf50;
  color: #fff;
  cursor: pointer;
}

.idraw-attach-btn:hover { background: #43a047; }

.question-submit-button {
  width: 100%;
  margin-top: 0;
}

.question-answer:disabled {
  background: #f0ede8;
  color: var(--muted);
  cursor: not-allowed;
  border-color: var(--stroke);
}

.answers-locked .question-label {
  color: var(--muted);
}

.submitted-pill {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 999px;
  background: #e8e3dc;
  color: var(--muted);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.reset-debug-button {
  display: block;
  margin-top: 10px;
  width: 100%;
  padding: 7px 12px;
  font-size: 0.78rem;
  font-family: inherit;
  background: transparent;
  color: #b05a2a;
  border: 1px dashed #b05a2a;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  opacity: 0.75;
  transition: opacity 0.15s;
}

.reset-debug-button:hover {
  opacity: 1;
}

.question-submit-status {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.9rem;
  color: var(--muted);
}

.entry-gate {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 35;
  width: min(620px, calc(100vw - 48px));
  max-height: min(78vh, 760px);
  overflow-y: auto;
  padding: 28px 26px 20px;
  border: 1px solid var(--stroke);
  border-radius: 20px;
  background: rgba(255, 253, 250, 0.985);
  box-shadow: 0 24px 80px rgba(45, 41, 36, 0.2);
  transform: translate(-50%, -50%);
}

.entry-gate .hero-text {
  margin: 12px 0 18px;
  color: var(--muted);
}

.gate-button {
  margin-top: 18px;
  background: #c8c2b7;
  color: #fff;
}

.gate-button.ready {
  background: #4f8f5b;
}

.gate-info-tab {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0 0;
  border-top: 1px solid var(--stroke);
  color: var(--muted);
}

.gate-info-label {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.gate-info-text {
  font-size: 0.84rem;
}

.review-layout {
  padding: 0;
}

.review-stage-card {
  position: relative;
  min-height: calc(100vh - 64px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.test-surface {
  min-height: calc(100vh - 64px);
  padding-top: 0;
  position: relative;
}

.elem-picker-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  pointer-events: none; /* let mouse events reach the iframe */
}

.elem-picker-badge {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.72);
  color: #fff;
  font-size: 0.78rem;
  padding: 6px 14px;
  border-radius: 20px;
  white-space: nowrap;
  pointer-events: none;
}

.elem-picker-badge .elem-picker-cancel {
  pointer-events: all;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  font-size: 0.75rem;
  padding: 1px 8px;
  border-radius: 10px;
  cursor: pointer;
  margin-left: 8px;
  font-family: inherit;
}

.elem-picker-cancel:hover { background: rgba(255,255,255,0.15); }

.test-surface-frame {
  display: block;
  width: 100%;
  min-height: calc(100vh - 64px);
  height: calc(100vh - 64px);
  border: 0;
  border-radius: 0;
  background: #fff;
}

.test-surface-empty {
  display: grid;
  align-content: center;
  min-height: calc(100vh - 64px);
  padding: 32px;
  border: 0;
  border-radius: 0;
  background: #fcfaf6;
}

.test-surface-empty code {
  padding: 2px 6px;
  border-radius: 6px;
  background: #f2eee7;
  color: var(--text);
}

.rules-backdrop {
  position: fixed;
  inset: 64px 0 0;
  z-index: 33;
  background: rgba(34, 30, 26, 0.22);
  backdrop-filter: blur(10px);
}

.progress-popup-backdrop {
  position: fixed;
  inset: 64px 0 0;
  z-index: 36;
  background: rgba(34, 30, 26, 0.2);
  backdrop-filter: blur(8px);
}

.progress-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 37;
  width: min(560px, calc(100vw - 48px));
  padding: 26px 24px;
  border: 1px solid var(--stroke);
  border-radius: 18px;
  background: rgba(255, 253, 250, 0.99);
  box-shadow: 0 22px 64px rgba(45, 41, 36, 0.16);
  transform: translate(-50%, -50%);
}

.progress-popup-bar {
  width: 100%;
  height: 16px;
  margin-top: 18px;
  border-radius: 999px;
  background: #ece6dc;
  overflow: hidden;
}

.progress-popup-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--gold);
  transition: width 220ms ease;
}

.progress-popup-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.progress-popup-count {
  font-size: 1.2rem;
  font-weight: 700;
}

.progress-popup-percent {
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
}

.progress-popup-copy {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.progress-popup-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 22px;
}

.popup-leave-button {
  width: auto;
  margin-top: 0;
}

.rules-list {
  display: grid;
  gap: 6px;
}

@media (max-width: 1100px) {
  .qa-grid,
  .test-id-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: calc(100% - 24px);
    margin: 0 12px;
  }

  .brand-logo { width: 110px; }
  .workspace-title { display: none; }

  .topbar {
    padding-left: 12px;
    padding-right: 12px;
    min-height: 54px;
    gap: 10px;
  }

  .qa-hero { padding-left: 0; padding-right: 0; }

  h2 { max-width: 100%; }

  /* ── Dashboard cards ──────────────────────────────────────────────── */
  .card { padding: 14px; }

  /* Founder two-column grid → single column */
  .founder-side-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  /* Members panel sidebar + list → stacked */
  .members-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  /* Submissions stats: 4-col → 2-col */
  .submissions-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Compare view 2-col → 1-col */
  .sub-compare-cols { grid-template-columns: 1fr; }

  /* Topbar inbox dropdown: full width, anchored to viewport right */
  .inbox-dropdown {
    width: calc(100vw - 24px);
    right: -12px;
  }

  /* Section header: allow wrapping */
  .section-header {
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
  }

  /* Stage tabs: allow wrapping */
  .stage-tabs { flex-wrap: wrap; gap: 6px; }
  .stage-tab--upload { margin-left: 0; }

  /* Latest submissions list: smaller */
  .submissions-list { max-height: 240px; }

  /* Progress bar in sub-row: hide on very small */
  .sub-progress-bar { width: 56px; }

  /* Matrix: force horizontal scroll */
  .matrix-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Test ID form: stacked on mobile (already 1-col at 1100px) */
  .test-id-panel { gap: 14px; }

  /* Active-test topbar */
  .review-page-shell { width: 100%; }
  .review-topbar, .review-stage-card { border-radius: 0; }
  .review-topbar-meta { flex-direction: column; align-items: end; }
  .test-surface-empty { padding: 16px; }

  .rules-backdrop { inset: 54px 0 0; }
  .progress-popup-backdrop { inset: 54px 0 0; }

  .progress-popup {
    width: min(560px, calc(100vw - 24px));
    padding: 22px 18px;
  }

  .question-progress { min-width: 80px; gap: 6px; }
  .question-progress-bar { width: 60px; }
  .question-panel { max-height: min(68vh, 640px, calc(100vh - 156px)); }
  .question-dock { top: 118px; }

  .gate-info-tab { align-items: start; flex-direction: column; gap: 4px; }
  .entry-gate {
    width: min(620px, calc(100vw - 24px));
    padding: 22px 18px 16px;
  }

  /* Login card */
  .login-card { padding: 18px 16px; }

  /* Answer detail items: stack label above answer */
  .answers-detail-item { grid-template-columns: 1fr; gap: 2px; }

  /* Members filter: wrap */
  .members-filters { flex-wrap: wrap; justify-content: flex-start; }

  /* Compose popup */
  .compose-popup { padding: 18px; gap: 10px; }

  /* Sub export row */
.sub-export-row { flex-direction: column; align-items: flex-start; }
}

.ip-registry-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.ip-registry-list,
.ip-registry-detail {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: #fbfaf6;
}

.ip-registry-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 720px;
  overflow-y: auto;
  padding: 12px;
}

.ip-registry-row {
  width: 100%;
  text-align: left;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: #fff;
  padding: 12px;
  cursor: pointer;
}

.ip-registry-row.is-active {
  border-color: #d9c7a0;
  background: #fdf8ee;
}

.ip-registry-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ip-registry-row-top strong {
  font-size: 0.92rem;
  font-family: monospace;
}

.ip-registry-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.74rem;
  color: var(--muted);
}

.ip-registry-detail {
  padding: 16px;
}

.ip-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 14px;
}

.ip-detail-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ip-level-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.ip-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.ip-stat-box {
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: #fff;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ip-stat-box strong {
  font-size: 1rem;
}

.ip-stat-box span {
  font-size: 0.74rem;
  color: var(--muted);
}

.ip-detail-block + .ip-detail-block {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--stroke);
}

.ip-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ip-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--stroke);
  font-size: 0.76rem;
}

.ip-chip--mono {
  font-family: monospace;
}

.ip-legal-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
}

.ip-legal-copy {
  margin: 8px 0 0;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text);
}

.ip-history-copy {
  width: 100%;
  min-height: 260px;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: #fff;
  padding: 12px;
  resize: vertical;
  font: 0.78rem/1.45 Consolas, Monaco, monospace;
  color: var(--text);
}

@media (max-width: 980px) {
  .ip-registry-layout {
    grid-template-columns: 1fr;
  }

  .ip-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
